32 files changed, 3723 insertions, 111 deletions
diff --git a/apps/Applications/camera2.desktop b/apps/Applications/camera2.desktop new file mode 100644 index 0000000..4662080 --- a/dev/null +++ b/apps/Applications/camera2.desktop | |||
@@ -0,0 +1,26 @@ | |||
1 | [Desktop Entry] | ||
2 | Exec=camera2 | ||
3 | File=camera2 | ||
4 | Icon=camera2/Camera | ||
5 | Type=Application | ||
6 | Name=OpieCam2 | ||
7 | Comment=A Camera Program | ||
8 | Name[de]=Kamera2 | ||
9 | Comment[de]=Ein Kamera-Programm | ||
10 | Name[fr]=Photo2 | ||
11 | Comment[fr]=Gestionnaire de photos et images | ||
12 | Name[it]=Telecamera2 | ||
13 | Comment[it]=Programma per telecamera | ||
14 | Name[pt]=Câmera2 | ||
15 | Comment[pt]=Uma aplicação de câmera | ||
16 | Name[pt_BR]=Câmera2 | ||
17 | Comment[pt_BR]=Uma aplicação de câmera | ||
18 | Name[sl]=OpieKamera2 | ||
19 | Comment[sl]=Program za kamero | ||
20 | Naam[nl]=Camera2 | ||
21 | Comment[nl]=Een camerabesturingsprogramma | ||
22 | Name[ru]=Камера2 | ||
23 | Comment[ru]=Программа для управления (фото)камерой | ||
24 | Name[lv]=OpieCam2 | ||
25 | Comment[lv]=Opie Kameras Programma | ||
26 | |||
diff --git a/library/backend/categories.h b/library/backend/categories.h index 91c93e7..6be3bc0 100644 --- a/library/backend/categories.h +++ b/library/backend/categories.h | |||
@@ -1,161 +1,162 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free | 7 | ** GNU General Public License version 2 as published by the Free |
8 | ** Software Foundation and appearing in the file LICENSE.GPL included | 8 | ** Software Foundation and appearing in the file LICENSE.GPL included |
9 | ** in the packaging of this file. | 9 | ** in the packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING |
12 | ** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A | 12 | ** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A |
13 | ** PARTICULAR PURPOSE. | 13 | ** PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #ifndef QTPALMTOP_CATEGORIES_H | 22 | #ifndef QTPALMTOP_CATEGORIES_H |
23 | #define QTPALMTOP_CATEGORIES_H | 23 | #define QTPALMTOP_CATEGORIES_H |
24 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qmap.h> | 27 | #include <qmap.h> |
28 | #include <qlistview.h> | 28 | #include <qlistview.h> |
29 | #include <qarray.h> | 29 | #include <qarray.h> |
30 | #include "qpcglobal.h" | 30 | #include "qpcglobal.h" |
31 | #include "palmtopuidgen.h" | 31 | #include "palmtopuidgen.h" |
32 | 32 | ||
33 | class CategoryGroup; | 33 | class CategoryGroup; |
34 | QString categoryFileName(); | ||
34 | 35 | ||
35 | #if defined(QPC_TEMPLATEDLL) | 36 | #if defined(QPC_TEMPLATEDLL) |
36 | // MOC_SKIP_BEGIN | 37 | // MOC_SKIP_BEGIN |
37 | template class QPC_EXPORT QMap<int, QString>; | 38 | template class QPC_EXPORT QMap<int, QString>; |
38 | template class QPC_EXPORT QMap<QString, int>; | 39 | template class QPC_EXPORT QMap<QString, int>; |
39 | template class QPC_EXPORT QMap< QString, CategoryGroup >; | 40 | template class QPC_EXPORT QMap< QString, CategoryGroup >; |
40 | // MOC_SKIP_END | 41 | // MOC_SKIP_END |
41 | #endif | 42 | #endif |
42 | 43 | ||
43 | class QPC_EXPORT CategoryGroup | 44 | class QPC_EXPORT CategoryGroup |
44 | { | 45 | { |
45 | friend class Categories; | 46 | friend class Categories; |
46 | public: | 47 | public: |
47 | CategoryGroup(): mIdLabelMap(), mLabelIdMap() { } | 48 | CategoryGroup(): mIdLabelMap(), mLabelIdMap() { } |
48 | CategoryGroup( const CategoryGroup &c ) : | 49 | CategoryGroup( const CategoryGroup &c ) : |
49 | mIdLabelMap( c.mIdLabelMap), mLabelIdMap( c.mLabelIdMap ) { } | 50 | mIdLabelMap( c.mIdLabelMap), mLabelIdMap( c.mLabelIdMap ) { } |
50 | 51 | ||
51 | void clear() { mIdLabelMap.clear(); mLabelIdMap.clear(); } | 52 | void clear() { mIdLabelMap.clear(); mLabelIdMap.clear(); } |
52 | 53 | ||
53 | int add( const QString &label ); | 54 | int add( const QString &label ); |
54 | bool add( int uid, const QString &label ); | 55 | bool add( int uid, const QString &label ); |
55 | 56 | ||
56 | bool remove( const QString &label ); | 57 | bool remove( const QString &label ); |
57 | bool remove( int uid ); | 58 | bool remove( int uid ); |
58 | 59 | ||
59 | bool rename( int uid, const QString &newLabel ); | 60 | bool rename( int uid, const QString &newLabel ); |
60 | bool rename( const QString &oldLabel, const QString &newLabel ); | 61 | bool rename( const QString &oldLabel, const QString &newLabel ); |
61 | 62 | ||
62 | bool contains(int id) const; | 63 | bool contains(int id) const; |
63 | bool contains(const QString &label) const; | 64 | bool contains(const QString &label) const; |
64 | 65 | ||
65 | /** Returns label associated with the uid or QString::null if | 66 | /** Returns label associated with the uid or QString::null if |
66 | * not found | 67 | * not found |
67 | */ | 68 | */ |
68 | const QString &label(int id) const; | 69 | const QString &label(int id) const; |
69 | /** Returns the uid associated with label or 0 if not found */ | 70 | /** Returns the uid associated with label or 0 if not found */ |
70 | int id(const QString &label) const; | 71 | int id(const QString &label) const; |
71 | 72 | ||
72 | /** Returns a sorted list of labels */ | 73 | /** Returns a sorted list of labels */ |
73 | QStringList labels() const; | 74 | QStringList labels() const; |
74 | 75 | ||
75 | QStringList labels( const QArray<int> &catids ) const; | 76 | QStringList labels( const QArray<int> &catids ) const; |
76 | 77 | ||
77 | const QMap<int, QString> &idMap() const { return mIdLabelMap; } | 78 | const QMap<int, QString> &idMap() const { return mIdLabelMap; } |
78 | 79 | ||
79 | private: | 80 | private: |
80 | void insert( int uid, const QString &label ); | 81 | void insert( int uid, const QString &label ); |
81 | QMap<int, QString> mIdLabelMap; | 82 | QMap<int, QString> mIdLabelMap; |
82 | QMap<QString, int> mLabelIdMap; | 83 | QMap<QString, int> mLabelIdMap; |
83 | 84 | ||
84 | static Qtopia::UidGen &uidGen() { return sUidGen; } | 85 | static Qtopia::UidGen &uidGen() { return sUidGen; } |
85 | static Qtopia::UidGen sUidGen; | 86 | static Qtopia::UidGen sUidGen; |
86 | }; | 87 | }; |
87 | 88 | ||
88 | /* Map from application name to categories */ | 89 | /* Map from application name to categories */ |
89 | class QPC_EXPORT Categories : public QObject | 90 | class QPC_EXPORT Categories : public QObject |
90 | { | 91 | { |
91 | Q_OBJECT | 92 | Q_OBJECT |
92 | public: | 93 | public: |
93 | Categories( QObject *parent=0, const char *name = 0 ) | 94 | Categories( QObject *parent=0, const char *name = 0 ) |
94 | : QObject( parent, name ), mGlobalCats(), mAppCats() { } | 95 | : QObject( parent, name ), mGlobalCats(), mAppCats() { } |
95 | Categories( const Categories ©From ) : QObject( copyFrom.parent() ), | 96 | Categories( const Categories ©From ) : QObject( copyFrom.parent() ), |
96 | mGlobalCats( copyFrom.mGlobalCats ), | 97 | mGlobalCats( copyFrom.mGlobalCats ), |
97 | mAppCats( copyFrom.mAppCats ) { } | 98 | mAppCats( copyFrom.mAppCats ) { } |
98 | virtual ~Categories() { } | 99 | virtual ~Categories() { } |
99 | 100 | ||
100 | Categories &operator= ( const Categories &c ) | 101 | Categories &operator= ( const Categories &c ) |
101 | { mAppCats = c.mAppCats; mGlobalCats = c.mGlobalCats; return *this; } | 102 | { mAppCats = c.mAppCats; mGlobalCats = c.mGlobalCats; return *this; } |
102 | 103 | ||
103 | void clear(); | 104 | void clear(); |
104 | 105 | ||
105 | /** Add the category name as long as it doesn't already exist | 106 | /** Add the category name as long as it doesn't already exist |
106 | * locally or globally. Return UID if added, 0 if conflicts | 107 | * locally or globally. Return UID if added, 0 if conflicts |
107 | * (error). | 108 | * (error). |
108 | */ | 109 | */ |
109 | int addCategory( const QString &appname, const QString &catname); | 110 | int addCategory( const QString &appname, const QString &catname); |
110 | /** Add the category name as long as it doesn't already exist | 111 | /** Add the category name as long as it doesn't already exist |
111 | * locally or globally. Return UID if added, 0 if conflicts | 112 | * locally or globally. Return UID if added, 0 if conflicts |
112 | * (error). | 113 | * (error). |
113 | */ | 114 | */ |
114 | int addCategory( const QString &appname, const QString &catname, int uid); | 115 | int addCategory( const QString &appname, const QString &catname, int uid); |
115 | /** Add the global category just checking that it doesn't | 116 | /** Add the global category just checking that it doesn't |
116 | * already exist globally. Return UID if added, 0 if conflicts. | 117 | * already exist globally. Return UID if added, 0 if conflicts. |
117 | */ | 118 | */ |
118 | int addGlobalCategory( const QString &catname ); | 119 | int addGlobalCategory( const QString &catname ); |
119 | /** Add the global category just checking that it doesn't | 120 | /** Add the global category just checking that it doesn't |
120 | * already exist globally. Return UID if added, 0 if conflicts. | 121 | * already exist globally. Return UID if added, 0 if conflicts. |
121 | */ | 122 | */ |
122 | int addGlobalCategory( const QString &catname, int uid ); | 123 | int addGlobalCategory( const QString &catname, int uid ); |
123 | /** Removes the category from the application; if it is not found | 124 | /** Removes the category from the application; if it is not found |
124 | * in the application, then it removes it from the global list | 125 | * in the application, then it removes it from the global list |
125 | */ | 126 | */ |
126 | bool removeCategory( const QString &appName, const QString &catName, | 127 | bool removeCategory( const QString &appName, const QString &catName, |
127 | bool checkGlobal = TRUE); | 128 | bool checkGlobal = TRUE); |
128 | bool removeCategory( const QString &appName, int uid ); | 129 | bool removeCategory( const QString &appName, int uid ); |
129 | bool removeGlobalCategory( const QString &catName ); | 130 | bool removeGlobalCategory( const QString &catName ); |
130 | bool removeGlobalCategory( int uid ); | 131 | bool removeGlobalCategory( int uid ); |
131 | 132 | ||
132 | QArray<int> ids( const QString &app, const QStringList &labels) const; | 133 | QArray<int> ids( const QString &app, const QStringList &labels) const; |
133 | 134 | ||
134 | /** Returns the id associated with the app */ | 135 | /** Returns the id associated with the app */ |
135 | int id( const QString &app, const QString &cat ) const; | 136 | int id( const QString &app, const QString &cat ) const; |
136 | /** Returns the label associated with the id */ | 137 | /** Returns the label associated with the id */ |
137 | QString label( const QString &app, int id ) const; | 138 | QString label( const QString &app, int id ) const; |
138 | 139 | ||
139 | enum ExtraLabels { NoExtra, AllUnfiled, AllLabel, UnfiledLabel }; | 140 | enum ExtraLabels { NoExtra, AllUnfiled, AllLabel, UnfiledLabel }; |
140 | /** Returns the sorted list of all categories that are | 141 | /** Returns the sorted list of all categories that are |
141 | * associated with the app. | 142 | * associated with the app. |
142 | * If includeGlobal parameter is TRUE then the returned | 143 | * If includeGlobal parameter is TRUE then the returned |
143 | * categories will include the global category items. | 144 | * categories will include the global category items. |
144 | * If extra = NoExtra, then | 145 | * If extra = NoExtra, then |
145 | * If extra = AllUnfiled, then All and Unfiled will be prepended to | 146 | * If extra = AllUnfiled, then All and Unfiled will be prepended to |
146 | * the list | 147 | * the list |
147 | * If extra = AllLabel, then All is prepended | 148 | * If extra = AllLabel, then All is prepended |
148 | * If extra = UnfiledLabel, then Unfiled is prepended | 149 | * If extra = UnfiledLabel, then Unfiled is prepended |
149 | */ | 150 | */ |
150 | QStringList labels( const QString &app, | 151 | QStringList labels( const QString &app, |
151 | bool includeGlobal = TRUE, | 152 | bool includeGlobal = TRUE, |
152 | ExtraLabels extra = NoExtra ) const; | 153 | ExtraLabels extra = NoExtra ) const; |
153 | 154 | ||
154 | QStringList labels( const QString &app, | 155 | QStringList labels( const QString &app, |
155 | const QArray<int> &catids ) const; | 156 | const QArray<int> &catids ) const; |
156 | 157 | ||
157 | enum DisplaySingle { ShowMulti, ShowAll, ShowFirst }; | 158 | enum DisplaySingle { ShowMulti, ShowAll, ShowFirst }; |
158 | 159 | ||
159 | /** Returns a single string associated with the cat ids for display in | 160 | /** Returns a single string associated with the cat ids for display in |
160 | * a combobox or any area that requires one string. If catids are empty | 161 | * a combobox or any area that requires one string. If catids are empty |
161 | * then "Unfiled" will be returned. If multiple categories are assigned | 162 | * then "Unfiled" will be returned. If multiple categories are assigned |
diff --git a/library/global.cpp b/library/global.cpp index ec87555..f7a0767 100644 --- a/library/global.cpp +++ b/library/global.cpp | |||
@@ -683,130 +683,179 @@ void Global::execute( const QString &c, const QString& document ) | |||
683 | QString Global::shellQuote(const QString& s) | 683 | QString Global::shellQuote(const QString& s) |
684 | { | 684 | { |
685 | QString r="\""; | 685 | QString r="\""; |
686 | for (int i=0; i<(int)s.length(); i++) { | 686 | for (int i=0; i<(int)s.length(); i++) { |
687 | char c = s[i].latin1(); | 687 | char c = s[i].latin1(); |
688 | switch (c) { | 688 | switch (c) { |
689 | case '\\': case '"': case '$': | 689 | case '\\': case '"': case '$': |
690 | r+="\\"; | 690 | r+="\\"; |
691 | } | 691 | } |
692 | r += s[i]; | 692 | r += s[i]; |
693 | } | 693 | } |
694 | r += "\""; | 694 | r += "\""; |
695 | return r; | 695 | return r; |
696 | } | 696 | } |
697 | 697 | ||
698 | /*! | 698 | /*! |
699 | Returns the string \a s with the characters '\' and '"' quoted by a | 699 | Returns the string \a s with the characters '\' and '"' quoted by a |
700 | preceeding '\'. | 700 | preceeding '\'. |
701 | 701 | ||
702 | \sa shellQuote() | 702 | \sa shellQuote() |
703 | */ | 703 | */ |
704 | QString Global::stringQuote(const QString& s) | 704 | QString Global::stringQuote(const QString& s) |
705 | { | 705 | { |
706 | QString r="\""; | 706 | QString r="\""; |
707 | for (int i=0; i<(int)s.length(); i++) { | 707 | for (int i=0; i<(int)s.length(); i++) { |
708 | char c = s[i].latin1(); | 708 | char c = s[i].latin1(); |
709 | switch (c) { | 709 | switch (c) { |
710 | case '\\': case '"': | 710 | case '\\': case '"': |
711 | r+="\\"; | 711 | r+="\\"; |
712 | } | 712 | } |
713 | r += s[i]; | 713 | r += s[i]; |
714 | } | 714 | } |
715 | r += "\""; | 715 | r += "\""; |
716 | return r; | 716 | return r; |
717 | } | 717 | } |
718 | 718 | ||
719 | /*! | 719 | /*! |
720 | Finds all documents on the system's document directories which | 720 | Finds all documents on the system's document directories which |
721 | match the filter \a mimefilter, and appends the resulting DocLnk | 721 | match the filter \a mimefilter, and appends the resulting DocLnk |
722 | objects to \a folder. | 722 | objects to \a folder. |
723 | */ | 723 | */ |
724 | void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) | 724 | void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) |
725 | { | 725 | { |
726 | QString homedocs = QString(getenv("HOME")) + "/Documents"; | 726 | QString homedocs = QString(getenv("HOME")) + "/Documents"; |
727 | DocLnkSet d(homedocs,mimefilter); | 727 | DocLnkSet d(homedocs,mimefilter); |
728 | folder->appendFrom(d); | 728 | folder->appendFrom(d); |
729 | /** let's do intellegint way of searching these files | 729 | /** let's do intellegint way of searching these files |
730 | * a) the user don't want to check mediums global | 730 | * a) the user don't want to check mediums global |
731 | * b) the user wants to check but use the global options for it | 731 | * b) the user wants to check but use the global options for it |
732 | * c) the user wants to check it but not this medium | 732 | * c) the user wants to check it but not this medium |
733 | * d) the user wants to check and this medium as well | 733 | * d) the user wants to check and this medium as well |
734 | * | 734 | * |
735 | * In all cases we need to apply a different mimefilter to | 735 | * In all cases we need to apply a different mimefilter to |
736 | * the medium. | 736 | * the medium. |
737 | * a) mimefilter.isEmpty() we need to apply the responding filter | 737 | * a) mimefilter.isEmpty() we need to apply the responding filter |
738 | * either the global or the one on the medium | 738 | * either the global or the one on the medium |
739 | * | 739 | * |
740 | * b) mimefilter is set to an application we need to find out if the | 740 | * b) mimefilter is set to an application we need to find out if the |
741 | * mimetypes are included in the mime mask of the medium | 741 | * mimetypes are included in the mime mask of the medium |
742 | */ | 742 | */ |
743 | StorageInfo storage; | 743 | StorageInfo storage; |
744 | const QList<FileSystem> &fs = storage.fileSystems(); | 744 | const QList<FileSystem> &fs = storage.fileSystems(); |
745 | QListIterator<FileSystem> it ( fs ); | 745 | QListIterator<FileSystem> it ( fs ); |
746 | for ( ; it.current(); ++it ) { | 746 | for ( ; it.current(); ++it ) { |
747 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 747 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
748 | // this is a candidate look at the cf and see if we should search on it | 748 | // this is a candidate look at the cf and see if we should search on it |
749 | QString path = (*it)->path(); | 749 | QString path = (*it)->path(); |
750 | Config conf((*it)->path() + "/.opiestorage.cf", Config::File ); | 750 | Config conf((*it)->path() + "/.opiestorage.cf", Config::File ); |
751 | conf.setGroup("main"); | 751 | conf.setGroup("main"); |
752 | if (!conf.readBoolEntry("check",true)) { | 752 | if (!conf.readBoolEntry("check",true)) { |
753 | continue; | 753 | continue; |
754 | } | 754 | } |
755 | conf.setGroup("subdirs"); | 755 | conf.setGroup("subdirs"); |
756 | if (conf.readBoolEntry("wholemedia",true)) { | 756 | if (conf.readBoolEntry("wholemedia",true)) { |
757 | DocLnkSet ide( path,mimefilter); | 757 | DocLnkSet ide( path,mimefilter); |
758 | folder->appendFrom(ide); | 758 | folder->appendFrom(ide); |
759 | } else { | 759 | } else { |
760 | QStringList subDirs = conf.readListEntry("subdirs",':'); | 760 | QStringList subDirs = conf.readListEntry("subdirs",':'); |
761 | if (subDirs.isEmpty()) { | 761 | if (subDirs.isEmpty()) { |
762 | subDirs.append("Documents"); | 762 | subDirs.append("Documents"); |
763 | } | 763 | } |
764 | for (unsigned c = 0; c < subDirs.count();++c) { | 764 | for (unsigned c = 0; c < subDirs.count();++c) { |
765 | DocLnkSet ide( path+"/"+subDirs[c], mimefilter ); | 765 | DocLnkSet ide( path+"/"+subDirs[c], mimefilter ); |
766 | folder->appendFrom(ide); | 766 | folder->appendFrom(ide); |
767 | } | 767 | } |
768 | } | 768 | } |
769 | } else if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { | 769 | } else if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { |
770 | QString path = (*it)->path() + "/Documents"; | 770 | QString path = (*it)->path() + "/Documents"; |
771 | DocLnkSet ide( path, mimefilter ); | 771 | DocLnkSet ide( path, mimefilter ); |
772 | folder->appendFrom(ide); | 772 | folder->appendFrom(ide); |
773 | } | 773 | } |
774 | } | 774 | } |
775 | } | 775 | } |
776 | 776 | ||
777 | QStringList Global::languageList() | 777 | QStringList Global::languageList() |
778 | { | 778 | { |
779 | QString lang = getenv("LANG"); | 779 | QString lang = getenv("LANG"); |
780 | QStringList langs; | 780 | QStringList langs; |
781 | langs.append(lang); | 781 | langs.append(lang); |
782 | int i = lang.find("."); | 782 | int i = lang.find("."); |
783 | if ( i > 0 ) | 783 | if ( i > 0 ) |
784 | lang = lang.left( i ); | 784 | lang = lang.left( i ); |
785 | i = lang.find( "_" ); | 785 | i = lang.find( "_" ); |
786 | if ( i > 0 ) | 786 | if ( i > 0 ) |
787 | langs.append(lang.left(i)); | 787 | langs.append(lang.left(i)); |
788 | return langs; | 788 | return langs; |
789 | } | 789 | } |
790 | 790 | ||
791 | QStringList Global::helpPath() | 791 | QStringList Global::helpPath() |
792 | { | 792 | { |
793 | QString qpeDir = QPEApplication::qpeDir(); | 793 | QString qpeDir = QPEApplication::qpeDir(); |
794 | QStringList path; | 794 | QStringList path; |
795 | QStringList langs = Global::languageList(); | 795 | QStringList langs = Global::languageList(); |
796 | for (QStringList::ConstIterator it = langs.fromLast(); it!=langs.end(); --it) { | 796 | for (QStringList::ConstIterator it = langs.fromLast(); it!=langs.end(); --it) { |
797 | QString lang = *it; | 797 | QString lang = *it; |
798 | if ( !lang.isEmpty() ) | 798 | if ( !lang.isEmpty() ) |
799 | path += qpeDir + "/help/" + lang + "/html"; | 799 | path += qpeDir + "/help/" + lang + "/html"; |
800 | } | 800 | } |
801 | path += qpeDir + "/pics"; | 801 | path += qpeDir + "/pics"; |
802 | path += qpeDir + "/help/html"; | 802 | path += qpeDir + "/help/html"; |
803 | /* we even put english into the en dir so try it as fallback as well for opie */ | 803 | /* we even put english into the en dir so try it as fallback as well for opie */ |
804 | path += qpeDir + "/help/en/html"; | 804 | path += qpeDir + "/help/en/html"; |
805 | path += qpeDir + "/docs"; | 805 | path += qpeDir + "/docs"; |
806 | 806 | ||
807 | 807 | ||
808 | return path; | 808 | return path; |
809 | } | 809 | } |
810 | 810 | ||
811 | /*! | ||
812 | \internal | ||
813 | Truncate file to size specified | ||
814 | \a f must be an open file | ||
815 | \a size must be a positive value | ||
816 | */ | ||
817 | bool Global::truncateFile(QFile &f, int size){ | ||
818 | if (!f.isOpen()) | ||
819 | return FALSE; | ||
820 | |||
821 | return ::ftruncate(f.handle(), size) != -1; | ||
822 | } | ||
823 | |||
824 | |||
825 | |||
826 | |||
827 | // #if defined(Q_OS_UNIX) && defined(Q_WS_QWS) | ||
828 | // extern int qws_display_id; | ||
829 | // #endif | ||
830 | |||
831 | /*! | ||
832 | /internal | ||
833 | Returns the default system path for storing temporary files. | ||
834 | Note: This does not it ensure that the provided directory exists | ||
835 | */ | ||
836 | QString Global::tempDir() | ||
837 | { | ||
838 | QString result; | ||
839 | #ifdef Q_OS_UNIX | ||
840 | #ifdef Q_WS_QWS | ||
841 | result = QString("/tmp/qtopia-%1/").arg(QString::number(qws_display_id)); | ||
842 | #else | ||
843 | result="/tmp/"; | ||
844 | #endif | ||
845 | #else | ||
846 | if (getenv("TEMP")) | ||
847 | result = getenv("TEMP"); | ||
848 | else | ||
849 | result = getenv("TMP"); | ||
850 | |||
851 | if (result[(int)result.length() - 1] != QDir::separator()) | ||
852 | result.append(QDir::separator()); | ||
853 | #endif | ||
854 | |||
855 | return result; | ||
856 | } | ||
857 | |||
858 | //#endif | ||
859 | |||
811 | 860 | ||
812 | #include "global.moc" | 861 | #include "global.moc" |
diff --git a/library/global.h b/library/global.h index 1136b12..f32c498 100644 --- a/library/global.h +++ b/library/global.h | |||
@@ -1,90 +1,94 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef GLOBAL_H | 20 | #ifndef GLOBAL_H |
21 | #define GLOBAL_H | 21 | #define GLOBAL_H |
22 | 22 | ||
23 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
24 | #include <qguardedptr.h> | 24 | #include <qguardedptr.h> |
25 | class QDawg; | 25 | class QDawg; |
26 | class QLabel; | 26 | class QLabel; |
27 | class QWidget; | 27 | class QWidget; |
28 | class AppLnk; | 28 | class AppLnk; |
29 | class DocLnkSet; | 29 | class DocLnkSet; |
30 | 30 | class QFile; | |
31 | class Global | 31 | class Global |
32 | { | 32 | { |
33 | public: | 33 | public: |
34 | Global(); | 34 | Global(); |
35 | 35 | ||
36 | // Dictionaries | 36 | // Dictionaries |
37 | static const QDawg& fixedDawg(); | 37 | static const QDawg& fixedDawg(); |
38 | static const QDawg& addedDawg(); | 38 | static const QDawg& addedDawg(); |
39 | static const QDawg& dawg(const QString& name); | 39 | static const QDawg& dawg(const QString& name); |
40 | 40 | ||
41 | static void addWords(const QStringList& word); | 41 | static void addWords(const QStringList& word); |
42 | static void addWords(const QString& dictname, const QStringList& word); | 42 | static void addWords(const QString& dictname, const QStringList& word); |
43 | // static void removeWords(const QStringList& word); -- if someone wants it | 43 | // static void removeWords(const QStringList& word); -- if someone wants it |
44 | 44 | ||
45 | static void createDocDir(); | 45 | static void createDocDir(); |
46 | 46 | ||
47 | static void findDocuments(DocLnkSet* folder, const QString &mimefilter=QString::null); | 47 | static void findDocuments(DocLnkSet* folder, const QString &mimefilter=QString::null); |
48 | 48 | ||
49 | static QString applicationFileName(const QString& appname, const QString& filename); | 49 | static QString applicationFileName(const QString& appname, const QString& filename); |
50 | 50 | ||
51 | struct Command { | 51 | struct Command { |
52 | const char *file; | 52 | const char *file; |
53 | QWidget *(*func)( bool ); | 53 | QWidget *(*func)( bool ); |
54 | bool maximized; | 54 | bool maximized; |
55 | bool documentary; | 55 | bool documentary; |
56 | }; | 56 | }; |
57 | static void setBuiltinCommands( Command* ); | 57 | static void setBuiltinCommands( Command* ); |
58 | 58 | ||
59 | static void execute( const QString &exec, const QString &document=QString::null ); | 59 | static void execute( const QString &exec, const QString &document=QString::null ); |
60 | static void setDocument( QWidget* receiver, const QString& document ); | 60 | static void setDocument( QWidget* receiver, const QString& document ); |
61 | static bool terminateBuiltin( const QString& ); | 61 | static bool terminateBuiltin( const QString& ); |
62 | static void terminate( const AppLnk* ); | 62 | static void terminate( const AppLnk* ); |
63 | 63 | ||
64 | static bool isBuiltinCommand( const QString &name ); | 64 | static bool isBuiltinCommand( const QString &name ); |
65 | 65 | ||
66 | // system messaging | 66 | // system messaging |
67 | static void applyStyle(); | 67 | static void applyStyle(); |
68 | static void statusMessage(const QString&); | 68 | static void statusMessage(const QString&); |
69 | static QWidget *shutdown( bool = FALSE ); | 69 | static QWidget *shutdown( bool = FALSE ); |
70 | static QWidget *restart( bool = FALSE ); | 70 | static QWidget *restart( bool = FALSE ); |
71 | static void hideInputMethod(); | 71 | static void hideInputMethod(); |
72 | static void showInputMethod(); | 72 | static void showInputMethod(); |
73 | 73 | ||
74 | static void writeHWClock(); | 74 | static void writeHWClock(); |
75 | 75 | ||
76 | static QString shellQuote(const QString& s); | 76 | static QString shellQuote(const QString& s); |
77 | static QString stringQuote(const QString& s); | 77 | static QString stringQuote(const QString& s); |
78 | 78 | ||
79 | #ifdef QTOPIA_INTERNAL_LANGLIST | 79 | #ifdef QTOPIA_INTERNAL_LANGLIST |
80 | static QStringList languageList(); | 80 | static QStringList languageList(); |
81 | static QStringList helpPath(); | 81 | static QStringList helpPath(); |
82 | #endif | 82 | #endif |
83 | //#ifdef QTOPIA_INTERNAL_FILEOPERATIONS | ||
84 | static bool truncateFile(QFile &f, int size); | ||
85 | static QString tempDir( ); | ||
86 | //#endif | ||
83 | 87 | ||
84 | private: | 88 | private: |
85 | static void invoke( const QString &exec); | 89 | static void invoke( const QString &exec); |
86 | static Command* builtin; | 90 | static Command* builtin; |
87 | static QGuardedPtr<QWidget> *running; | 91 | static QGuardedPtr<QWidget> *running; |
88 | }; | 92 | }; |
89 | 93 | ||
90 | #endif | 94 | #endif |
diff --git a/library/library.pro b/library/library.pro index 7143454..4142529 100644 --- a/library/library.pro +++ b/library/library.pro | |||
@@ -1,141 +1,143 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | #CONFIG += qt warn_on release | 2 | #CONFIG += qt warn_on release |
3 | CONFIG += qt warn_on debug | 3 | CONFIG += qt warn_on debug |
4 | HEADERS= calendar.h \ | 4 | HEADERS= calendar.h \ |
5 | global.h \ | 5 | global.h \ |
6 | resource.h \ | 6 | resource.h \ |
7 | xmlreader.h \ | 7 | xmlreader.h \ |
8 | mimetype.h \ | 8 | mimetype.h \ |
9 | menubutton.h \ | 9 | menubutton.h \ |
10 | network.h \ | 10 | network.h \ |
11 | networkinterface.h \ | 11 | networkinterface.h \ |
12 | filemanager.h \ | 12 | filemanager.h \ |
13 | fontmanager.h \ | 13 | fontmanager.h \ |
14 | qdawg.h \ | 14 | qdawg.h \ |
15 | datebookmonth.h \ | 15 | datebookmonth.h \ |
16 | fileselector.h \ | 16 | fileselector.h \ |
17 | fileselector_p.h \ | 17 | fileselector_p.h \ |
18 | imageedit.h \ | 18 | imageedit.h \ |
19 | qcopenvelope_qws.h \ | 19 | qcopenvelope_qws.h \ |
20 | qpedecoration_qws.h \ | 20 | qpedecoration_qws.h \ |
21 | qpeapplication.h \ | 21 | qpeapplication.h \ |
22 | qpestyle.h \ | 22 | qpestyle.h \ |
23 | qpedialog.h \ | 23 | qpedialog.h \ |
24 | lightstyle.h \ | 24 | lightstyle.h \ |
25 | config.h \ | 25 | config.h \ |
26 | applnk.h \ | 26 | applnk.h \ |
27 | sound.h \ | 27 | sound.h \ |
28 | tzselect.h \ | 28 | tzselect.h \ |
29 | qmath.h \ | 29 | qmath.h \ |
30 | datebookdb.h \ | 30 | datebookdb.h \ |
31 | alarmserver.h \ | 31 | alarmserver.h \ |
32 | process.h \ | 32 | process.h \ |
33 | password.h \ | 33 | password.h \ |
34 | timestring.h \ | 34 | timestring.h \ |
35 | fontfactoryinterface.h \ | 35 | fontfactoryinterface.h \ |
36 | fontdatabase.h \ | 36 | fontdatabase.h \ |
37 | power.h \ | 37 | power.h \ |
38 | storage.h \ | 38 | storage.h \ |
39 | qpemessagebox.h \ | 39 | qpemessagebox.h \ |
40 | timeconversion.h \ | 40 | timeconversion.h \ |
41 | qpedebug.h \ | 41 | qpedebug.h \ |
42 | qpemenubar.h \ | 42 | qpemenubar.h \ |
43 | qpetoolbar.h \ | 43 | qpetoolbar.h \ |
44 | backend/categories.h \ | 44 | backend/categories.h \ |
45 | stringutil.h \ | 45 | stringutil.h \ |
46 | backend/palmtoprecord.h \ | 46 | backend/palmtoprecord.h \ |
47 | backend/task.h \ | 47 | backend/task.h \ |
48 | backend/event.h \ | 48 | backend/event.h \ |
49 | backend/contact.h\ | 49 | backend/contact.h\ |
50 | categorymenu.h \ | 50 | categorymenu.h \ |
51 | categoryedit_p.h \ | 51 | categoryedit_p.h \ |
52 | categoryselect.h \ | 52 | categoryselect.h \ |
53 | categorywidget.h \ | 53 | categorywidget.h \ |
54 | ir.h \ | 54 | ir.h \ |
55 | backend/vobject_p.h \ | 55 | backend/vobject_p.h \ |
56 | findwidget_p.h \ | 56 | findwidget_p.h \ |
57 | finddialog.h \ | 57 | finddialog.h \ |
58 | lnkproperties.h \ | 58 | lnkproperties.h \ |
59 | windowdecorationinterface.h \ | 59 | windowdecorationinterface.h \ |
60 | textcodecinterface.h \ | 60 | textcodecinterface.h \ |
61 | imagecodecinterface.h \ | 61 | imagecodecinterface.h \ |
62 | locationcombo.h \ | ||
62 | qpeglobal.h | 63 | qpeglobal.h |
63 | 64 | ||
64 | SOURCES= calendar.cpp \ | 65 | SOURCES= calendar.cpp \ |
65 | global.cpp \ | 66 | global.cpp \ |
66 | xmlreader.cpp \ | 67 | xmlreader.cpp \ |
67 | mimetype.cpp \ | 68 | mimetype.cpp \ |
68 | menubutton.cpp \ | 69 | menubutton.cpp \ |
69 | network.cpp \ | 70 | network.cpp \ |
70 | networkinterface.cpp \ | 71 | networkinterface.cpp \ |
71 | filemanager.cpp \ | 72 | filemanager.cpp \ |
72 | fontmanager.cpp \ | 73 | fontmanager.cpp \ |
73 | qdawg.cpp \ | 74 | qdawg.cpp \ |
74 | datebookmonth.cpp \ | 75 | datebookmonth.cpp \ |
75 | fileselector.cpp \ | 76 | fileselector.cpp \ |
76 | imageedit.cpp \ | 77 | imageedit.cpp \ |
77 | resource.cpp \ | 78 | resource.cpp \ |
78 | qpedecoration_qws.cpp \ | 79 | qpedecoration_qws.cpp \ |
79 | qcopenvelope_qws.cpp \ | 80 | qcopenvelope_qws.cpp \ |
80 | qpeapplication.cpp \ | 81 | qpeapplication.cpp \ |
81 | qpestyle.cpp \ | 82 | qpestyle.cpp \ |
82 | qpedialog.cpp \ | 83 | qpedialog.cpp \ |
83 | lightstyle.cpp \ | 84 | lightstyle.cpp \ |
84 | config.cpp \ | 85 | config.cpp \ |
85 | applnk.cpp \ | 86 | applnk.cpp \ |
86 | sound.cpp \ | 87 | sound.cpp \ |
87 | tzselect.cpp \ | 88 | tzselect.cpp \ |
88 | qmath.c \ | 89 | qmath.c \ |
89 | datebookdb.cpp \ | 90 | datebookdb.cpp \ |
90 | alarmserver.cpp \ | 91 | alarmserver.cpp \ |
91 | password.cpp \ | 92 | password.cpp \ |
92 | process.cpp \ | 93 | process.cpp \ |
93 | process_unix.cpp \ | 94 | process_unix.cpp \ |
94 | timestring.cpp \ | 95 | timestring.cpp \ |
95 | fontdatabase.cpp \ | 96 | fontdatabase.cpp \ |
96 | power.cpp \ | 97 | power.cpp \ |
97 | storage.cpp \ | 98 | storage.cpp \ |
98 | qpemessagebox.cpp \ | 99 | qpemessagebox.cpp \ |
99 | backend/timeconversion.cpp \ | 100 | backend/timeconversion.cpp \ |
100 | qpedebug.cpp \ | 101 | qpedebug.cpp \ |
101 | qpemenubar.cpp \ | 102 | qpemenubar.cpp \ |
102 | qpetoolbar.cpp \ | 103 | qpetoolbar.cpp \ |
103 | backend/categories.cpp \ | 104 | backend/categories.cpp \ |
104 | backend/stringutil.cpp \ | 105 | backend/stringutil.cpp \ |
105 | backend/palmtoprecord.cpp \ | 106 | backend/palmtoprecord.cpp \ |
106 | backend/task.cpp \ | 107 | backend/task.cpp \ |
107 | backend/event.cpp \ | 108 | backend/event.cpp \ |
108 | backend/contact.cpp \ | 109 | backend/contact.cpp \ |
109 | categorymenu.cpp \ | 110 | categorymenu.cpp \ |
110 | categoryedit_p.cpp \ | 111 | categoryedit_p.cpp \ |
111 | categoryselect.cpp \ | 112 | categoryselect.cpp \ |
112 | categorywidget.cpp \ | 113 | categorywidget.cpp \ |
113 | ir.cpp \ | 114 | ir.cpp \ |
114 | backend/vcc_yacc.cpp \ | 115 | backend/vcc_yacc.cpp \ |
115 | backend/vobject.cpp \ | 116 | backend/vobject.cpp \ |
116 | findwidget_p.cpp \ | 117 | findwidget_p.cpp \ |
117 | finddialog.cpp \ | 118 | finddialog.cpp \ |
118 | lnkproperties.cpp \ | 119 | lnkproperties.cpp \ |
120 | locationcombo.cpp \ | ||
119 | widget_showing.cpp | 121 | widget_showing.cpp |
120 | 122 | ||
121 | 123 | ||
122 | 124 | ||
123 | # Qt 3 compatibility | 125 | # Qt 3 compatibility |
124 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h | 126 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h |
125 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp | 127 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp |
126 | 128 | ||
127 | DEFINES += OPIE_INTERNAL_LIBRARY_BUILD | 129 | DEFINES += OPIE_INTERNAL_LIBRARY_BUILD |
128 | INCLUDEPATH += $(OPIEDIR)/include backend | 130 | INCLUDEPATH += $(OPIEDIR)/include backend |
129 | LIBS += -ldl -lcrypt -lm | 131 | LIBS += -ldl -lcrypt -lm |
130 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui | 132 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui |
131 | TARGET = qpe | 133 | TARGET = qpe |
132 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 134 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
133 | VERSION = 1.5.0.1 | 135 | VERSION = 1.5.0.1 |
134 | 136 | ||
135 | include( $(OPIEDIR)/include.pro ) | 137 | include( $(OPIEDIR)/include.pro ) |
136 | 138 | ||
137 | contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){ | 139 | contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){ |
138 | DEFINES += OPIE_WITHROHFEEDBACK | 140 | DEFINES += OPIE_WITHROHFEEDBACK |
139 | SOURCES += backend/rohfeedback.cpp | 141 | SOURCES += backend/rohfeedback.cpp |
140 | HEADERS += backend/rohfeedback.h | 142 | HEADERS += backend/rohfeedback.h |
141 | } | 143 | } |
diff --git a/library/locationcombo.cpp b/library/locationcombo.cpp new file mode 100644 index 0000000..31429f5 --- a/dev/null +++ b/library/locationcombo.cpp | |||
@@ -0,0 +1,295 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #include "locationcombo.h" | ||
37 | |||
38 | #include <qpe/ir.h> | ||
39 | #include <qpe/applnk.h> | ||
40 | #include <qpe/global.h> | ||
41 | #include <qpe/categorywidget.h> | ||
42 | #include <qpe/categoryselect.h> | ||
43 | #ifdef QWS | ||
44 | #include <qpe/qcopenvelope_qws.h> | ||
45 | #endif | ||
46 | #include <qpe/filemanager.h> | ||
47 | #include <qpe/config.h> | ||
48 | #include <qpe/storage.h> | ||
49 | #include <qpe/global.h> | ||
50 | #include <qtopia/qpemessagebox.h> | ||
51 | |||
52 | #include <qlineedit.h> | ||
53 | #include <qtoolbutton.h> | ||
54 | #include <qpushbutton.h> | ||
55 | #include <qgroupbox.h> | ||
56 | #include <qcheckbox.h> | ||
57 | #include <qlabel.h> | ||
58 | #include <qlayout.h> | ||
59 | #include <qfile.h> | ||
60 | #include <qdir.h> | ||
61 | #include <qfileinfo.h> | ||
62 | #include <qmessagebox.h> | ||
63 | #include <qsize.h> | ||
64 | #include <qcombobox.h> | ||
65 | #include <qregexp.h> | ||
66 | |||
67 | #include <qradiobutton.h> | ||
68 | #include <qlayout.h> | ||
69 | |||
70 | #include <stdlib.h> | ||
71 | |||
72 | /*! | ||
73 | \class LocationCombo locationcombo.h | ||
74 | \brief The LocationCombo class displays a list of available storage | ||
75 | locations. | ||
76 | |||
77 | First availability: Qtopia 1.6 | ||
78 | |||
79 | \ingroup qtopiaemb | ||
80 | \sa DocPropertiesDialog | ||
81 | */ | ||
82 | |||
83 | |||
84 | class LocationComboPrivate | ||
85 | { | ||
86 | public: | ||
87 | LocationComboPrivate() : homeLocation(-1), fileSize(0), listEmpty(TRUE) {} | ||
88 | QString originalPath; | ||
89 | int homeLocation; | ||
90 | int fileSize; | ||
91 | bool listEmpty; | ||
92 | }; | ||
93 | |||
94 | /*! | ||
95 | Constructs a LocationCombo with parent \a parent and name \a name. | ||
96 | */ | ||
97 | LocationCombo::LocationCombo( QWidget *parent, const char *name ) | ||
98 | : QComboBox( FALSE, parent, name ) | ||
99 | { | ||
100 | storage = new StorageInfo; | ||
101 | d = new LocationComboPrivate; | ||
102 | setLocation( 0 ); | ||
103 | connect( this, SIGNAL(activated(int)), this, SIGNAL(newPath()) ); | ||
104 | connect( storage, SIGNAL(disksChanged()), this, SLOT(updatePaths()) ); | ||
105 | } | ||
106 | |||
107 | /*! | ||
108 | Constructs a LocationCombo with parent \a parent and name \a name. | ||
109 | \a lnk is pointer to an existing AppLnk. | ||
110 | */ | ||
111 | LocationCombo::LocationCombo( const AppLnk * lnk, QWidget *parent, const char *name ) | ||
112 | : QComboBox( FALSE, parent, name ) | ||
113 | { | ||
114 | storage = new StorageInfo; | ||
115 | d = new LocationComboPrivate; | ||
116 | setLocation(lnk); | ||
117 | connect( this, SIGNAL(activated(int)), this, SIGNAL(newPath()) ); | ||
118 | connect( storage, SIGNAL(disksChanged()), this, SLOT(updatePaths()) ); | ||
119 | } | ||
120 | |||
121 | /*! | ||
122 | Destroys the widget. | ||
123 | */ | ||
124 | LocationCombo::~LocationCombo() | ||
125 | { | ||
126 | delete storage; | ||
127 | delete d; | ||
128 | } | ||
129 | |||
130 | /*! | ||
131 | Sets the display of the LocationCombo to the location associated with the | ||
132 | AppLnk \a lnk. | ||
133 | */ | ||
134 | void LocationCombo::setLocation( const AppLnk * lnk ) | ||
135 | { | ||
136 | // NB: setLocation(const QString) assumes only lnk->file() is used. | ||
137 | |||
138 | if ( lnk ) { | ||
139 | QFileInfo fi( lnk->file() ); | ||
140 | d->fileSize = fi.size(); | ||
141 | const FileSystem *fs = storage->fileSystemOf( lnk->file() ); | ||
142 | d->originalPath = fs ? fs->path() : QString::null; | ||
143 | } else { | ||
144 | d->fileSize = 0; | ||
145 | d->originalPath = QString::null; | ||
146 | } | ||
147 | |||
148 | setupCombo(); | ||
149 | |||
150 | int currentLocation = -1; | ||
151 | if ( lnk ) { | ||
152 | int n = locations.count(); | ||
153 | for ( int i = 0; i < n; i++ ) { | ||
154 | if ( lnk->file().contains( locations[i] ) ) | ||
155 | currentLocation = i; | ||
156 | } | ||
157 | } | ||
158 | if ( currentLocation == -1 ) | ||
159 | currentLocation = 0; //default to the first one | ||
160 | |||
161 | setCurrentItem( currentLocation ); | ||
162 | } | ||
163 | |||
164 | /*! | ||
165 | \internal | ||
166 | */ | ||
167 | void LocationCombo::setupCombo() | ||
168 | { | ||
169 | clear(); | ||
170 | locations.clear(); | ||
171 | |||
172 | const QList<FileSystem> &fs = storage->fileSystems(); | ||
173 | QListIterator<FileSystem> it ( fs ); | ||
174 | QString s; | ||
175 | QString homeDir = QDir::homeDirPath(); | ||
176 | QString homeFs; | ||
177 | QString homeFsPath; | ||
178 | int index = 0; | ||
179 | for ( ; it.current(); ++it ) { | ||
180 | // we add 10k to the file size so we are sure we can also save the desktop file | ||
181 | if ( !d->fileSize || (*it)->path() == d->originalPath || | ||
182 | (ulong)(*it)->availBlocks() * (ulong)(*it)->blockSize() | ||
183 | > (ulong)d->fileSize + 10000 ) | ||
184 | { | ||
185 | if ( (*it)->isRemovable() ) { | ||
186 | insertItem( (*it)->name(), index ); | ||
187 | locations.append( (*it)->path() ); | ||
188 | index++; | ||
189 | } else if ( homeDir.contains( (*it)->path() ) && | ||
190 | (*it)->path().length() > homeFsPath.length() ) { | ||
191 | homeFs = (*it)->name(); | ||
192 | homeFsPath = (*it)->path(); | ||
193 | } | ||
194 | } | ||
195 | } | ||
196 | |||
197 | // $HOME is *somewhere*, but not shown in Storage::fileSystems(), | ||
198 | // eg. because it's mounted in some unexpected way. | ||
199 | if ( homeFsPath.isEmpty() ) { | ||
200 | homeFs = StorageInfo::tr("Internal Storage"); | ||
201 | homeFsPath = homeDir; | ||
202 | } | ||
203 | |||
204 | if ( !homeFsPath.isEmpty() ) { | ||
205 | d->homeLocation = 0; | ||
206 | insertItem( homeFs, d->homeLocation ); | ||
207 | locations.prepend( homeDir ); | ||
208 | } else { | ||
209 | d->homeLocation = -1; | ||
210 | } | ||
211 | |||
212 | d->listEmpty = locations.count() == 0; | ||
213 | if ( d->listEmpty ) { | ||
214 | insertItem( tr("No FileSystems Available!"), 0 ); | ||
215 | locations.append( "" ); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | /*! | ||
220 | \internal | ||
221 | */ | ||
222 | void LocationCombo::updatePaths() | ||
223 | { | ||
224 | QString oldPath = locations[currentItem()]; | ||
225 | |||
226 | setupCombo(); | ||
227 | |||
228 | int currentLocation = 0; | ||
229 | int n = locations.count(); | ||
230 | for ( int i = 0; i < n; i++ ) { | ||
231 | if ( oldPath == locations[i] ) { | ||
232 | currentLocation = i; | ||
233 | } | ||
234 | } | ||
235 | setCurrentItem( currentLocation ); | ||
236 | if ( locations[currentItem()] != oldPath ) | ||
237 | emit newPath(); | ||
238 | } | ||
239 | |||
240 | /*! | ||
241 | Returns TRUE to indicate that the user has changed the location displayed | ||
242 | by the LocationCombo. Most useful when the LocationCombo is part of a | ||
243 | dialog; when the dialog is accept()ed, LocationCombo::isChanged() can be | ||
244 | examined to check for a change of location. | ||
245 | */ | ||
246 | bool LocationCombo::isChanged() const | ||
247 | { | ||
248 | if ( const FileSystem *fs = storage->fileSystemOf(locations[currentItem()]) ) | ||
249 | return fs->path() != d->originalPath; | ||
250 | |||
251 | return TRUE; | ||
252 | } | ||
253 | |||
254 | /*! | ||
255 | Returns the default (home) location for the file associated with this | ||
256 | LocationCombo. | ||
257 | */ | ||
258 | QString LocationCombo::installationPath() const | ||
259 | { | ||
260 | return currentItem() == d->homeLocation ? | ||
261 | QString("/") : locations[ currentItem() ]+"/"; | ||
262 | } | ||
263 | |||
264 | /*! | ||
265 | Returns the document path associated with this LocationCombo. This | ||
266 | will be "\<path\>/Documents". | ||
267 | */ | ||
268 | QString LocationCombo::documentPath() const | ||
269 | { | ||
270 | return locations[ currentItem() ]+"/Documents/"; | ||
271 | } | ||
272 | |||
273 | /*! | ||
274 | Returns a pointer to FileSystem object, associated with the current | ||
275 | selection of the LocationCombo. | ||
276 | */ | ||
277 | const FileSystem *LocationCombo::fileSystem() const | ||
278 | { | ||
279 | if ( d->listEmpty ) | ||
280 | return 0; | ||
281 | return storage->fileSystemOf( locations[ currentItem() ] ); | ||
282 | } | ||
283 | |||
284 | /*! | ||
285 | \fn LocationCombo::newPath() | ||
286 | Emitted when the LocationCombo changes to a new location. | ||
287 | */ | ||
288 | |||
289 | |||
290 | #if 0 | ||
291 | void LocationCombo::apply() | ||
292 | { | ||
293 | } | ||
294 | #endif | ||
295 | |||
diff --git a/library/locationcombo.h b/library/locationcombo.h new file mode 100644 index 0000000..fab3dfc --- a/dev/null +++ b/library/locationcombo.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #ifndef LOCATIONCOMBO_H | ||
37 | #define LOCATIONCOMBO_H | ||
38 | |||
39 | #include <qpe/qpeglobal.h> | ||
40 | |||
41 | #ifdef Q_WS_QWS | ||
42 | |||
43 | #include <qstringlist.h> | ||
44 | #include <qcombobox.h> | ||
45 | |||
46 | class AppLnk; | ||
47 | class QListViewItem; | ||
48 | class DocLnk; | ||
49 | class FileSystem; | ||
50 | class StorageInfo; | ||
51 | |||
52 | |||
53 | class LocationComboPrivate; | ||
54 | |||
55 | class LocationCombo : public QComboBox | ||
56 | { | ||
57 | Q_OBJECT | ||
58 | public: | ||
59 | LocationCombo( QWidget *parent, const char *name=0 ); | ||
60 | LocationCombo( const AppLnk * lnk, QWidget *parent, const char *name=0 ); | ||
61 | |||
62 | ~LocationCombo(); | ||
63 | |||
64 | void setLocation( const QString& path ); // qtopia 2 | ||
65 | void setLocation( const AppLnk * ); | ||
66 | |||
67 | QString installationPath() const; | ||
68 | QString documentPath() const; | ||
69 | const FileSystem *fileSystem() const; | ||
70 | |||
71 | bool isChanged() const; | ||
72 | |||
73 | signals: | ||
74 | void newPath(); | ||
75 | |||
76 | private slots: | ||
77 | void updatePaths(); | ||
78 | |||
79 | private: | ||
80 | void setupCombo(); | ||
81 | QStringList locations; | ||
82 | StorageInfo *storage; | ||
83 | LocationComboPrivate *d; | ||
84 | }; | ||
85 | |||
86 | |||
87 | #endif // QWS | ||
88 | #endif // LNKPROPERTIES_H | ||
diff --git a/library/qlibrary_unix.cpp b/library/qlibrary_unix.cpp index fee73c2..f4d60cb 100644 --- a/library/qlibrary_unix.cpp +++ b/library/qlibrary_unix.cpp | |||
@@ -73,171 +73,171 @@ void* QLibraryPrivate::resolveSymbol( const char* symbol ) | |||
73 | #endif | 73 | #endif |
74 | return 0; | 74 | return 0; |
75 | } | 75 | } |
76 | return address; | 76 | return address; |
77 | } | 77 | } |
78 | 78 | ||
79 | #elif defined(_NULL_LIB_) | 79 | #elif defined(_NULL_LIB_) |
80 | 80 | ||
81 | bool QLibraryPrivate::loadLibrary() | 81 | bool QLibraryPrivate::loadLibrary() |
82 | { | 82 | { |
83 | //qDebug("QLibraryPrivate::loadLibrary\n"); | 83 | //qDebug("QLibraryPrivate::loadLibrary\n"); |
84 | return FALSE; | 84 | return FALSE; |
85 | } | 85 | } |
86 | bool QLibraryPrivate::freeLibrary() | 86 | bool QLibraryPrivate::freeLibrary() |
87 | { | 87 | { |
88 | //qDebug("QLibraryPrivate::freeLibrary\n"); | 88 | //qDebug("QLibraryPrivate::freeLibrary\n"); |
89 | return FALSE; | 89 | return FALSE; |
90 | } | 90 | } |
91 | void* QLibraryPrivate::resolveSymbol( const char* symbol ) | 91 | void* QLibraryPrivate::resolveSymbol( const char* symbol ) |
92 | { | 92 | { |
93 | //qDebug("QLibraryPrivate::resolveSymbol\n"); | 93 | //qDebug("QLibraryPrivate::resolveSymbol\n"); |
94 | return FALSE; | 94 | return FALSE; |
95 | } | 95 | } |
96 | 96 | ||
97 | #elif defined(Q_OS_MACX) | 97 | #elif defined(Q_OS_MACX) |
98 | 98 | ||
99 | #define ENUM_DYLD_BOOL | 99 | #define ENUM_DYLD_BOOL |
100 | enum DYLD_BOOL { | 100 | enum DYLD_BOOL { |
101 | DYLD_FALSE, | 101 | DYLD_FALSE, |
102 | DYLD_TRUE | 102 | DYLD_TRUE |
103 | }; | 103 | }; |
104 | #include <mach-o/dyld.h> | 104 | #include <mach-o/dyld.h> |
105 | typedef struct { | 105 | typedef struct { |
106 | NSObjectFileImage img; | 106 | NSObjectFileImage img; |
107 | NSModule mod; | 107 | NSModule mod; |
108 | } DyldLibDesc; | 108 | } DyldLibDesc; |
109 | 109 | ||
110 | bool QLibraryPrivate::loadLibrary() | 110 | bool QLibraryPrivate::loadLibrary() |
111 | { | 111 | { |
112 | // qDebug("QLibraryPrivate::loadLibrary\n"); | 112 | // qDebug("QLibraryPrivate::loadLibrary\n"); |
113 | // return FALSE; | 113 | // return FALSE; |
114 | if ( pHnd ) | 114 | if ( pHnd ) |
115 | return TRUE; | 115 | return TRUE; |
116 | 116 | ||
117 | QString filename = library->library(); | 117 | QString filename = library->library(); |
118 | 118 | ||
119 | NSObjectFileImage img = 0; | 119 | NSObjectFileImage img = 0; |
120 | NSModule mod = 0; | 120 | NSModule mod = 0; |
121 | NSObjectFileImageReturnCode ret = NSCreateObjectFileImageFromFile( filename.latin1() , &img ); | 121 | NSObjectFileImageReturnCode ret = NSCreateObjectFileImageFromFile( filename.latin1() , &img ); |
122 | if ( ret != NSObjectFileImageSuccess ) { | 122 | if ( ret != NSObjectFileImageSuccess ) { |
123 | qWarning( "Error in NSCreateObjectFileImageFromFile(): %d; Filename: %s", ret, filename.latin1() ); | 123 | qWarning( "Error in NSCreateObjectFileImageFromFile(): %d; Filename: %s", ret, filename.latin1() ); |
124 | if (ret == NSObjectFileImageAccess) { | 124 | if (ret == NSObjectFileImageAccess) { |
125 | qWarning ("(NSObjectFileImageAccess)" ); | 125 | qWarning ("(NSObjectFileImageAccess)" ); |
126 | } | 126 | } |
127 | } else { | 127 | } else { |
128 | mod = NSLinkModule(img, filename.latin1(), NSLINKMODULE_OPTION_BINDNOW | | 128 | mod = NSLinkModule(img, filename.latin1(), NSLINKMODULE_OPTION_BINDNOW | |
129 | NSLINKMODULE_OPTION_PRIVATE | | 129 | NSLINKMODULE_OPTION_PRIVATE | |
130 | NSLINKMODULE_OPTION_RETURN_ON_ERROR); | 130 | NSLINKMODULE_OPTION_RETURN_ON_ERROR); |
131 | if (mod == 0) { | 131 | if (mod == 0) { |
132 | qWarning( "Error in NSLinkModule()" ); | 132 | qWarning( "Error in NSLinkModule()" ); |
133 | NSDestroyObjectFileImage(img); | 133 | NSDestroyObjectFileImage(img); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | DyldLibDesc* desc = 0; | 136 | DyldLibDesc* desc = 0; |
137 | if (img != 0 && mod != 0) { | 137 | if (img != 0 && mod != 0) { |
138 | desc = new DyldLibDesc; | 138 | desc = new DyldLibDesc; |
139 | desc->img = img; | 139 | desc->img = img; |
140 | desc->mod = mod; | 140 | desc->mod = mod; |
141 | } | 141 | } |
142 | pHnd = desc; | 142 | pHnd = desc; |
143 | return pHnd != 0; | 143 | return pHnd != 0; |
144 | } | 144 | } |
145 | 145 | ||
146 | bool QLibraryPrivate::freeLibrary() | 146 | bool QLibraryPrivate::freeLibrary() |
147 | { | 147 | { |
148 | //qDebug("QLibraryPrivate::freeLibrary\n"); | 148 | //qDebug("QLibraryPrivate::freeLibrary\n"); |
149 | //return FALSE; | 149 | //return FALSE; |
150 | if ( !pHnd ) | 150 | if ( !pHnd ) |
151 | return TRUE; | 151 | return TRUE; |
152 | 152 | ||
153 | DyldLibDesc* desc = (DyldLibDesc*) pHnd; | 153 | DyldLibDesc* desc = (DyldLibDesc*) pHnd; |
154 | NSModule mod = desc->mod; | 154 | NSModule mod = desc->mod; |
155 | NSObjectFileImage img = desc->img; | 155 | NSObjectFileImage img = desc->img; |
156 | bool success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE); | 156 | bool success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE); |
157 | if ( success ) { | 157 | if ( success ) { |
158 | NSDestroyObjectFileImage(img); | 158 | NSDestroyObjectFileImage(img); |
159 | delete desc; | 159 | delete desc; |
160 | pHnd = 0; | 160 | pHnd = 0; |
161 | } | 161 | } |
162 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | 162 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) |
163 | else { | 163 | else { |
164 | qWarning( "Error in NSUnLinkModule()" ); | 164 | qWarning( "Error in NSUnLinkModule()" ); |
165 | } | 165 | } |
166 | #endif | 166 | #endif |
167 | return pHnd == 0; | 167 | return pHnd == 0; |
168 | } | 168 | } |
169 | 169 | ||
170 | void* QLibraryPrivate::resolveSymbol( const char* symbol ) | 170 | void* QLibraryPrivate::resolveSymbol( const char* symbol ) |
171 | { | 171 | { |
172 | //qDebug("QLibraryPrivate::resolveSymbol\n"); | 172 | //qDebug("QLibraryPrivate::resolveSymbol\n"); |
173 | //return FALSE; | 173 | //return FALSE; |
174 | if ( !pHnd ) | 174 | if ( !pHnd ) |
175 | return 0; | 175 | return 0; |
176 | 176 | ||
177 | DyldLibDesc* desc = (DyldLibDesc*) pHnd; | 177 | DyldLibDesc* desc = (DyldLibDesc*) pHnd; |
178 | NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol); | 178 | NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol); |
179 | void* address = 0; | 179 | void* address = 0; |
180 | if (sym != 0) { | 180 | if (sym != 0) { |
181 | address = NSAddressOfSymbol(sym); | 181 | address = NSAddressOfSymbol(sym); |
182 | } | 182 | } |
183 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | 183 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) |
184 | if ( address == 0 ) | 184 | if ( address == 0 ) |
185 | qWarning( "Cannot find symbol: %s", symbol ); | 185 | qWarning( "Cannot find symbol: %s", symbol ); |
186 | #endif | 186 | #endif |
187 | return address; | 187 | return address; |
188 | } | 188 | } |
189 | 189 | ||
190 | #else | 190 | #else |
191 | // Something else, assuming POSIX | 191 | // Something else, assuming POSIX |
192 | #include <dlfcn.h> | 192 | #include <dlfcn.h> |
193 | 193 | ||
194 | bool QLibraryPrivate::loadLibrary() | 194 | bool QLibraryPrivate::loadLibrary() |
195 | { | 195 | { |
196 | if ( pHnd ) | 196 | if ( pHnd ) |
197 | return TRUE; | 197 | return TRUE; |
198 | 198 | ||
199 | QString filename = library->library(); | 199 | QString filename = library->library(); |
200 | 200 | ||
201 | pHnd = dlopen( filename.latin1() , RTLD_LAZY ); | 201 | pHnd = ::dlopen( filename.latin1() , RTLD_LAZY ); |
202 | // #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | 202 | // #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) |
203 | if ( !pHnd ) | 203 | if ( !pHnd ) |
204 | qWarning( "%s", dlerror() ); | 204 | qWarning( "%s", dlerror() ); |
205 | // #endif | 205 | // #endif |
206 | return pHnd != 0; | 206 | return pHnd != 0; |
207 | } | 207 | } |
208 | 208 | ||
209 | bool QLibraryPrivate::freeLibrary() | 209 | bool QLibraryPrivate::freeLibrary() |
210 | { | 210 | { |
211 | if ( !pHnd ) | 211 | if ( !pHnd ) |
212 | return TRUE; | 212 | return TRUE; |
213 | 213 | ||
214 | int ec = dlclose( pHnd ); | 214 | int ec = ::dlclose( pHnd ); |
215 | if ( !ec ) | 215 | if ( !ec ) |
216 | pHnd = 0; | 216 | pHnd = 0; |
217 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | 217 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) |
218 | else { | 218 | else { |
219 | const char* error = dlerror(); | 219 | const char* error = dlerror(); |
220 | if ( error ) | 220 | if ( error ) |
221 | qWarning( "%s", error ); | 221 | qWarning( "%s", error ); |
222 | } | 222 | } |
223 | #endif | 223 | #endif |
224 | return pHnd == 0; | 224 | return pHnd == 0; |
225 | } | 225 | } |
226 | 226 | ||
227 | void* QLibraryPrivate::resolveSymbol( const char* f ) | 227 | void* QLibraryPrivate::resolveSymbol( const char* f ) |
228 | { | 228 | { |
229 | if ( !pHnd ) | 229 | if ( !pHnd ) |
230 | return 0; | 230 | return 0; |
231 | 231 | ||
232 | void* address = dlsym( pHnd, f ); | 232 | void* address = dlsym( pHnd, f ); |
233 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | 233 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) |
234 | const char* error = dlerror(); | 234 | const char* error = dlerror(); |
235 | if ( error ) | 235 | if ( error ) |
236 | qWarning( "%s", error ); | 236 | qWarning( "%s", error ); |
237 | #endif | 237 | #endif |
238 | return address; | 238 | return address; |
239 | } | 239 | } |
240 | 240 | ||
241 | #endif // POSIX | 241 | #endif // POSIX |
242 | 242 | ||
243 | #endif // QT_NO_COMPONENT | 243 | #endif // QT_NO_COMPONENT |
diff --git a/library/timestring.cpp b/library/timestring.cpp index 91c29ae..afd162d 100644 --- a/library/timestring.cpp +++ b/library/timestring.cpp | |||
@@ -1,365 +1,466 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This program is free software; you can redistribute it and/or modify it |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** under the terms of the GNU General Public License as published by the |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Free Software Foundation; either version 2 of the License, or (at your |
9 | ** packaging of this file. | 9 | ** option) any later version. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** A copy of the GNU GPL license version 2 is included in this package as |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** LICENSE.GPL. |
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
13 | ** | 28 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 30 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 32 | ** not clear to you. |
18 | ** | 33 | ** |
19 | **********************************************************************/ | 34 | **********************************************************************/ |
20 | 35 | ||
21 | #include "timestring.h" | 36 | #include "timestring.h" |
22 | #include <qobject.h> | 37 | #include <qobject.h> |
23 | #include <qpe/qpeapplication.h> //for qApp | 38 | #include <qdatetime.h> |
39 | #include <qapplication.h> | ||
24 | #include "config.h" | 40 | #include "config.h" |
25 | 41 | ||
42 | #include <time.h> | ||
43 | |||
26 | 44 | ||
27 | class TimeStringFormatKeeper : public QObject | 45 | class TimeStringFormat : public QObject |
28 | { | 46 | { |
29 | Q_OBJECT | 47 | Q_OBJECT |
30 | public: | 48 | public: |
31 | static DateFormat currentFormat() | 49 | static DateFormat currentFormat() |
32 | { | 50 | { |
33 | if ( !self ) | 51 | if ( !self ) |
34 | self = new TimeStringFormatKeeper; | 52 | self = new TimeStringFormat; |
35 | return self->format; | 53 | return self->format; |
36 | } | 54 | } |
37 | private slots: | 55 | private slots: |
38 | void formatChanged( DateFormat f ) | 56 | void formatChanged( DateFormat f ) |
39 | { | 57 | { |
40 | format = f; | 58 | format = f; |
41 | } | 59 | } |
42 | private: | 60 | private: |
43 | static TimeStringFormatKeeper *self; | 61 | static TimeStringFormat *self; |
44 | DateFormat format; | 62 | DateFormat format; |
45 | 63 | ||
46 | TimeStringFormatKeeper() | 64 | TimeStringFormat() |
47 | : QObject( qApp ) | 65 | : QObject( qApp ) |
48 | { | 66 | { |
49 | Config config("qpe"); | 67 | Config config("qpe"); |
50 | config.setGroup( "Date" ); | 68 | config.setGroup( "Date" ); |
51 | format = DateFormat(QChar(config.readEntry("Separator", "/")[0]), | 69 | format = ::DateFormat(QChar(config.readEntry("Separator", "/")[0]), |
52 | (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), | 70 | (::DateFormat::Order)config.readNumEntry("ShortOrder", ::DateFormat::DayMonthYear), |
53 | (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); | 71 | (::DateFormat::Order)config.readNumEntry("LongOrder", ::DateFormat::DayMonthYear)); |
54 | 72 | ||
55 | connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ), | 73 | connect( qApp, SIGNAL( dateFormatChanged(DateFormat) ), |
56 | this, SLOT( formatChanged(DateFormat) ) ); | 74 | this, SLOT( formatChanged(DateFormat) ) ); |
57 | } | 75 | } |
58 | }; | 76 | }; |
59 | 77 | ||
60 | TimeStringFormatKeeper *TimeStringFormatKeeper::self = 0; | 78 | TimeStringFormat *TimeStringFormat::self = 0; |
61 | 79 | ||
62 | QString DateFormat::toNumberString() const | 80 | QString DateFormat::toNumberString() const |
63 | { | 81 | { |
64 | QString buf = ""; | 82 | QString buf = ""; |
65 | // for each part of the order | 83 | // for each part of the order |
66 | for (int i = 0; i < 3; i++) { | 84 | for (int i = 0; i < 3; i++) { |
67 | // switch on the relavent 3 bits. | 85 | // switch on the relavent 3 bits. |
68 | switch((_shortOrder >> (i * 3)) & 0x0007) { | 86 | switch((_shortOrder >> (i * 3)) & 0x0007) { |
69 | case 0x0001: | 87 | case 0x0001: |
70 | buf += QObject::tr( "D" , "Shortcut for Day"); | 88 | buf += TimeStringFormat::tr( "D", "first letter of the word 'Day'" ); |
71 | break; | 89 | break; |
72 | case 0x0002: | 90 | case 0x0002: |
73 | buf += QObject::tr( "M", "Shortcur for Month" ); | 91 | buf += TimeStringFormat::tr( "M" , "first letter of the word 'Month'" ); |
74 | break; | 92 | break; |
75 | case 0x0004: | 93 | case 0x0004: |
76 | buf += QObject::tr( "Y" ); | 94 | buf += TimeStringFormat::tr( "Y" , "first letter of the word 'Year'" ); |
77 | break; | 95 | break; |
78 | } | 96 | } |
79 | if (i < 2) | 97 | if (i < 2) |
80 | buf += _shortSeparator; | 98 | buf += _shortSeparator; |
81 | } | 99 | } |
82 | return buf; | 100 | return buf; |
83 | } | 101 | } |
84 | 102 | ||
85 | QString DateFormat::toWordString() const | 103 | QString DateFormat::toWordString() const |
86 | { | 104 | { |
87 | QString buf = ""; | 105 | QString buf = ""; |
88 | // for each part of the order | 106 | // for each part of the order |
89 | for (int i = 0; i < 3; i++) { | 107 | for (int i = 0; i < 3; i++) { |
90 | // switch on the relavent 3 bits. | 108 | // switch on the relavent 3 bits. |
91 | switch((_longOrder >> (i * 3)) & 0x0007) { | 109 | switch((_longOrder >> (i * 3)) & 0x0007) { |
92 | case 0x0001: | 110 | case 0x0001: |
93 | buf += QObject::tr( "day" ); | 111 | buf += TimeStringFormat::tr( "day", "in month" ); |
94 | if (i < 2) { | 112 | if (i < 2) { |
95 | if ((_shortOrder << ((i+1) * 3)) & 0x0007) | 113 | if ((_shortOrder << ((i+1) * 3)) & 0x0007) |
96 | buf += ", "; | 114 | buf += ", "; |
97 | else | 115 | else |
98 | buf += " "; | 116 | buf += " "; |
99 | } | 117 | } |
100 | break; | 118 | break; |
101 | case 0x0002: | 119 | case 0x0002: |
102 | buf += QObject::tr( "month" ); | 120 | buf += TimeStringFormat::tr( "month" ); |
103 | if (i < 2) | 121 | if (i < 2) |
104 | buf += " "; | 122 | buf += " "; |
105 | break; | 123 | break; |
106 | case 0x0004: | 124 | case 0x0004: |
107 | buf += QObject::tr( "year" ); | 125 | buf += TimeStringFormat::tr( "year" ); |
108 | if (i < 2) | 126 | if (i < 2) |
109 | buf += ", "; | 127 | buf += ", "; |
110 | break; | 128 | break; |
111 | } | 129 | } |
112 | } | 130 | } |
113 | return buf; | 131 | return buf; |
114 | } | 132 | } |
115 | 133 | ||
116 | QString DateFormat::numberDate(const QDate &d, int v) const | 134 | QString DateFormat::numberDate(const QDate &d, int v) const |
117 | { | 135 | { |
118 | QString buf = ""; | 136 | QString buf = ""; |
119 | 137 | ||
120 | int pad = 2; | 138 | int pad = 2; |
121 | 139 | ||
122 | // for each part of the order | 140 | // for each part of the order |
123 | for (int i = 0; i < 3; i++) { | 141 | for (int i = 0; i < 3; i++) { |
124 | // switch on the relavent 3 bits. | 142 | // switch on the relavent 3 bits. |
125 | switch((_shortOrder >> (i * 3)) & 0x0007) { | 143 | switch((_shortOrder >> (i * 3)) & 0x0007) { |
126 | case 0x0001: | 144 | case 0x0001: |
127 | if (pad==2) buf += QString().sprintf("%02d",d.day()); | 145 | if (pad==2) buf += QString().sprintf("%02d",d.day()); |
128 | else buf += QString().sprintf("%d",d.day()); | 146 | else buf += QString().sprintf("%d",d.day()); |
129 | break; | 147 | break; |
130 | case 0x0002: | 148 | case 0x0002: |
131 | if (i==0) { // no padding with only MM/DD/YY format | 149 | if (i==0) { // no padding with only MM/DD/YY format |
132 | pad=0; | 150 | pad=0; |
133 | } | 151 | } |
134 | if (pad==2) buf += QString().sprintf("%02d",d.month()); | 152 | if (pad==2) buf += QString().sprintf("%02d",d.month()); |
135 | else buf += QString().sprintf("%d",d.month()); | 153 | else buf += QString().sprintf("%d",d.month()); |
136 | break; | 154 | break; |
137 | case 0x0004: | 155 | case 0x0004: |
138 | { | 156 | { |
139 | int year = d.year(); | 157 | int year = d.year(); |
140 | if (!(v & longNumber)) | 158 | if (!(v & longNumber)) |
141 | year = year % 100; | 159 | year = year % 100; |
142 | buf += QString().sprintf("%02d",year); | 160 | buf += QString().sprintf("%02d",year); |
143 | } | 161 | } |
144 | break; | 162 | break; |
145 | } | 163 | } |
146 | if (i < 2) | 164 | if (i < 2) |
147 | buf += _shortSeparator; | 165 | buf += _shortSeparator; |
148 | } | 166 | } |
149 | return buf; | 167 | return buf; |
150 | } | 168 | } |
151 | 169 | ||
170 | static const char* unTranslatedFullMonthNames[] = { | ||
171 | QT_TRANSLATE_NOOP( "QDate", "January" ), | ||
172 | QT_TRANSLATE_NOOP( "QDate", "February" ), | ||
173 | QT_TRANSLATE_NOOP( "QDate", "March" ), | ||
174 | QT_TRANSLATE_NOOP( "QDate", "April" ), | ||
175 | QT_TRANSLATE_NOOP( "QDate", "May" ), | ||
176 | QT_TRANSLATE_NOOP( "QDate", "June" ), | ||
177 | QT_TRANSLATE_NOOP( "QDate", "July" ), | ||
178 | QT_TRANSLATE_NOOP( "QDate", "August" ), | ||
179 | QT_TRANSLATE_NOOP( "QDate", "September" ), | ||
180 | QT_TRANSLATE_NOOP( "QDate", "October" ), | ||
181 | QT_TRANSLATE_NOOP( "QDate", "November" ), | ||
182 | QT_TRANSLATE_NOOP( "QDate", "December" ) | ||
183 | }; | ||
184 | |||
185 | static const char* unTranslatedFullDayNames[] = { | ||
186 | QT_TRANSLATE_NOOP( "QDate", "Monday" ), | ||
187 | QT_TRANSLATE_NOOP( "QDate", "Tuesday" ), | ||
188 | QT_TRANSLATE_NOOP( "QDate", "Wednesday" ), | ||
189 | QT_TRANSLATE_NOOP( "QDate", "Thursday" ), | ||
190 | QT_TRANSLATE_NOOP( "QDate", "Friday" ), | ||
191 | QT_TRANSLATE_NOOP( "QDate", "Saturday" ), | ||
192 | QT_TRANSLATE_NOOP( "QDate", "Sunday" ) | ||
193 | }; | ||
194 | |||
195 | #ifdef QTOPIA_DESKTOP | ||
196 | //translations in qt.qm | ||
197 | static const char* unTranslatedMediumDayNames[] = { | ||
198 | "Mon" , "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" | ||
199 | }; | ||
200 | |||
201 | static const char* unTranslatedMediumMonthNames[] = { | ||
202 | "Jan", "Feb", "Mar", "Apr", "May", "Jun", | ||
203 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" | ||
204 | }; | ||
205 | #endif | ||
206 | |||
207 | static QString dayname(const QDate& d, bool lng) | ||
208 | { | ||
209 | if (lng && qApp) | ||
210 | return qApp->translate("QDate", unTranslatedFullDayNames[d.dayOfWeek()-1]); | ||
211 | else { | ||
212 | #ifdef QTOPIA_DESKTOP | ||
213 | if (qApp) | ||
214 | return qApp->translate("QDate", unTranslatedMediumDayNames[ d.dayOfWeek()-1]); | ||
215 | #endif | ||
216 | return d.dayName(d.dayOfWeek()); | ||
217 | } | ||
218 | } | ||
219 | |||
152 | QString DateFormat::wordDate(const QDate &d, int v) const | 220 | QString DateFormat::wordDate(const QDate &d, int v) const |
153 | { | 221 | { |
154 | QString buf = ""; | ||
155 | // for each part of the order | 222 | // for each part of the order |
156 | if (v & showWeekDay) { | 223 | QString weekDay; |
157 | QString weekDay = d.dayName(d.dayOfWeek()); | 224 | if (v & showWeekDay) |
158 | if (!(v & longWord)) { | 225 | weekDay = ::dayname(d,(v & longWord)); |
159 | weekDay = weekDay.left(3); | ||
160 | } | ||
161 | buf += weekDay; | ||
162 | if ((_longOrder & 0x0007) == 0x0002) | ||
163 | buf += ' '; | ||
164 | else | ||
165 | buf += ", "; | ||
166 | } | ||
167 | 226 | ||
227 | QString date=""; | ||
228 | QString sep=""; | ||
168 | for (int i = 0; i < 3; i++) { | 229 | for (int i = 0; i < 3; i++) { |
169 | // switch on the relavent 3 bits. | 230 | // switch on the relavent 3 bits. |
170 | switch((_longOrder >> (i * 3)) & 0x0007) { | 231 | int field = (_longOrder >> (i * 3)) & 0x0007; |
171 | case 0x0001: | 232 | if ( field && !date.isEmpty() ) |
172 | if (i==1) { | 233 | date += sep; |
173 | buf += QString().sprintf("%02d, ",d.day()); | 234 | switch (field) { |
174 | } else { | 235 | case 0x0001: // Day |
175 | buf += QString().sprintf("%2d",d.day()); | 236 | { |
176 | if (separator()=='.') // 2002/1/11 | 237 | QString daysuffix = TimeStringFormat::tr("@day", "day suffix - applies to some asian languages (e.g. Japanese and Trad. Chinese). If it doesn't apply to your language it has to be translated to an '@day' " ); |
177 | buf += ". "; | 238 | if (i==1) { |
178 | else | 239 | date += QString().sprintf("%02d",d.day()); |
179 | buf += " "; | 240 | if (daysuffix != "@day") |
180 | } | 241 | date+=daysuffix; |
242 | sep = TimeStringFormat::tr(",","day-date separator") + " "; | ||
243 | } else { | ||
244 | date += QString().sprintf("%2d",d.day()); | ||
245 | if (daysuffix == "@day") { | ||
246 | if (separator()=='.') // 2002/1/11 | ||
247 | sep = ". "; | ||
248 | else | ||
249 | sep = " "; | ||
250 | } else { | ||
251 | date += daysuffix+" "; | ||
252 | sep = " "; | ||
253 | } | ||
254 | } | ||
255 | } | ||
181 | break; | 256 | break; |
182 | case 0x0002: | 257 | case 0x0002: // Month |
183 | { | 258 | { |
184 | QString monthName = d.monthName(d.month()); | 259 | QString monthName; |
185 | if (!(v & longWord)) { | 260 | |
186 | monthName = monthName.left(3); | 261 | if (v & longWord) |
187 | } | 262 | monthName = qApp->translate("QDate", unTranslatedFullMonthNames[d.month()-1] ); |
188 | buf += monthName; | 263 | else { |
264 | #ifdef QTOPIA_DESKTOP | ||
265 | monthName = qApp->translate("QDate", unTranslatedMediumMonthNames[d.month()-1] ); | ||
266 | #else | ||
267 | monthName = d.monthName( d.month() ); | ||
268 | #endif | ||
269 | } | ||
270 | date += monthName; | ||
189 | } | 271 | } |
190 | if (i < 2) | 272 | sep = " ";//TimeStringFormat::tr(" ","month-date separator"); |
191 | buf += " "; | ||
192 | break; | 273 | break; |
193 | case 0x0004: | 274 | case 0x0004: // Year |
194 | { | 275 | { |
195 | int year = d.year(); | 276 | int year = d.year(); |
196 | if (!(v & longNumber)) | 277 | if (!(v & longNumber)) |
197 | year = year % 100; | 278 | year = year % 100; |
198 | 279 | ||
199 | if (year < 10) | 280 | if (year < 10) |
200 | buf += "0"; | 281 | date += "0"; |
282 | |||
283 | date += QString::number(year); | ||
284 | QString yearsuffix = TimeStringFormat::tr("@year", "year suffix - applies to some asian languages (e.g. Japanese and Trad. Chinese). If it doesn't apply to your language it has to be translated to an '@year' " ); | ||
285 | if (yearsuffix != "@year") | ||
286 | date += yearsuffix; | ||
201 | 287 | ||
202 | buf += QString::number(year); | ||
203 | } | 288 | } |
204 | if (i < 2) | 289 | sep = TimeStringFormat::tr(",","year-date seperator") + " "; |
205 | buf += ", "; | ||
206 | break; | 290 | break; |
207 | } | 291 | } |
208 | } | 292 | } |
209 | return buf; | 293 | |
294 | QString r = ""; | ||
295 | if ( weekDay.isEmpty() ) | ||
296 | r = date; | ||
297 | else if ((_longOrder & 0x0007) == 0x0002) | ||
298 | r = TimeStringFormat::tr("%1 %2","1=Monday 2=January 12").arg(weekDay).arg(date); | ||
299 | else if ( _longOrder ) | ||
300 | r = TimeStringFormat::tr("%1, %2","1=Monday 2=12 January").arg(weekDay).arg(date); | ||
301 | else | ||
302 | r = weekDay; | ||
303 | return r; | ||
210 | } | 304 | } |
211 | 305 | ||
212 | #ifndef QT_NO_DATASTREAM | 306 | #ifndef QT_NO_DATASTREAM |
213 | void DateFormat::save(QDataStream &d) const | 307 | void DateFormat::save(QDataStream &d) const |
214 | { | 308 | { |
215 | d << _shortSeparator.unicode(); | 309 | d << _shortSeparator.unicode(); |
216 | uint v= _shortOrder; | 310 | uint v= _shortOrder; |
217 | d << v; | 311 | d << v; |
218 | v = _longOrder; | 312 | v = _longOrder; |
219 | d << v; | 313 | d << v; |
220 | } | 314 | } |
221 | 315 | ||
222 | void DateFormat::load(QDataStream &d) | 316 | void DateFormat::load(QDataStream &d) |
223 | { | 317 | { |
224 | ushort value; | 318 | ushort value; |
225 | d >> value; | 319 | d >> value; |
226 | _shortSeparator = QChar(value); | 320 | _shortSeparator = QChar(value); |
227 | uint v = 0; | 321 | uint v = 0; |
228 | d >> v; | 322 | d >> v; |
229 | _shortOrder = (Order)v; | 323 | _shortOrder = (Order)v; |
230 | v = 0; | 324 | v = 0; |
231 | d >> v; | 325 | d >> v; |
232 | _longOrder = (Order)v; | 326 | _longOrder = (Order)v; |
233 | } | 327 | } |
234 | 328 | ||
235 | QDataStream &operator<<(QDataStream &s, const DateFormat&df) | 329 | QDataStream &operator<<(QDataStream &s, const DateFormat&df) |
236 | { | 330 | { |
237 | df.save(s); | 331 | df.save(s); |
238 | return s; | 332 | return s; |
239 | } | 333 | } |
240 | QDataStream &operator>>(QDataStream &s, DateFormat&df) | 334 | QDataStream &operator>>(QDataStream &s, DateFormat&df) |
241 | { | 335 | { |
242 | df.load(s); | 336 | df.load(s); |
243 | return s; | 337 | return s; |
244 | } | 338 | } |
245 | #endif | 339 | #endif |
246 | 340 | ||
247 | QString TimeString::shortDate( const QDate &d, DateFormat dtf ) | 341 | QString TimeString::shortDate( const QDate &d, DateFormat dtf ) |
248 | { | 342 | { |
249 | return dtf.wordDate(d); | 343 | return dtf.wordDate(d); |
250 | } | 344 | } |
251 | 345 | ||
252 | QString TimeString::dateString( const QDate &d, DateFormat dtf ) | 346 | QString TimeString::dateString( const QDate &d, DateFormat dtf ) |
253 | { | 347 | { |
254 | return QObject::tr( dtf.wordDate(d, DateFormat::longNumber | DateFormat::longWord) ); | 348 | return dtf.wordDate(d, DateFormat::longNumber); |
255 | } | 349 | } |
256 | 350 | ||
257 | 351 | ||
258 | QString TimeString::longDateString( const QDate &d, DateFormat dtf ) | 352 | QString TimeString::longDateString( const QDate &d, DateFormat dtf ) |
259 | { | 353 | { |
260 | return QObject::tr( dtf.wordDate(d, DateFormat::showWeekDay | DateFormat::longNumber | 354 | return dtf.wordDate(d, DateFormat::showWeekDay | DateFormat::longNumber |
261 | | DateFormat::longWord) ); | 355 | | DateFormat::longWord); |
262 | } | 356 | } |
263 | 357 | ||
264 | DateFormat TimeString::currentDateFormat() | 358 | DateFormat TimeString::currentDateFormat() |
265 | { | 359 | { |
266 | return TimeStringFormatKeeper::currentFormat(); | 360 | return TimeStringFormat::currentFormat(); |
267 | } | 361 | } |
268 | 362 | ||
269 | 363 | ||
270 | QString TimeString::dateString( const QDateTime &dt, bool ampm, bool seconds, DateFormat dtf ) | 364 | QString TimeString::dateString( const QDateTime &dt, bool ampm, bool seconds, DateFormat dtf ) |
271 | { | 365 | { |
272 | const QDate& d = dt.date(); | 366 | const QDate& d = dt.date(); |
273 | const QTime& t = dt.time(); | 367 | const QTime& t = dt.time(); |
274 | 368 | ||
275 | // based on QDateTime::toString() | 369 | // based on QDateTime::toString() |
276 | QString buf = timeString(t,ampm,seconds); | 370 | QString buf = timeString(t,ampm,seconds); |
277 | buf += " "; | 371 | buf += " "; |
278 | buf += longDateString( d, dtf ); | 372 | buf += longDateString( d, dtf ); |
279 | 373 | ||
280 | return buf; | 374 | return buf; |
281 | } | 375 | } |
282 | 376 | ||
283 | QString TimeString::timeString( const QTime &t, bool ampm, bool seconds ) | 377 | QString TimeString::timeString( const QTime &t, bool ampm, bool seconds ) |
284 | { | 378 | { |
285 | if ( !ampm ) { | 379 | if ( !ampm ) { |
286 | if ( seconds ) | 380 | if ( seconds ) |
287 | return t.toString(); | 381 | return t.toString(); |
288 | QString r = QString::number(t.hour()); | 382 | QString r = QString::number(t.hour()); |
289 | if ( t.hour() < 10 ) r.prepend( "0" ); | 383 | if ( t.hour() < 10 ) r.prepend( "0" ); |
290 | r.append( ":" ); | 384 | r.append( ":" ); |
291 | if ( t.minute() < 10 ) r.append( "0" ); | 385 | if ( t.minute() < 10 ) r.append( "0" ); |
292 | r.append(QString::number(t.minute())); | 386 | r.append(QString::number(t.minute())); |
293 | return r; | 387 | return r; |
294 | } | 388 | } |
295 | // ### else the hard case that should disappear in Qt 3.0 | 389 | // ### else the hard case that should disappear in Qt 3.0 |
296 | QString argString = seconds ? "%4:%5:%6 %7" : "%4:%5 %7"; | 390 | QString argString = seconds ? "%4:%5:%6 %7" : "%4:%5 %7"; |
297 | int hour = t.hour(); | 391 | int hour = t.hour(); |
298 | QString strMin = QString::number( t.minute() ); | 392 | QString strMin = QString::number( t.minute() ); |
299 | QString strSec = QString::number( t.second() ); | 393 | QString strSec = QString::number( t.second() ); |
300 | if ( hour > 12 ) | 394 | if ( hour > 12 ) |
301 | argString = argString.arg( hour - 12, 2 ); | 395 | argString = argString.arg( hour - 12, 2 ); |
302 | else { | 396 | else { |
303 | if ( hour == 0 ) | 397 | if ( hour == 0 ) |
304 | argString = argString.arg( 12 ); | 398 | argString = argString.arg( 12 ); |
305 | else | 399 | else |
306 | argString = argString.arg( hour, 2 ); | 400 | argString = argString.arg( hour, 2 ); |
307 | } | 401 | } |
308 | if ( t.minute() < 10 ) | 402 | if ( t.minute() < 10 ) |
309 | strMin.prepend( "0" ); | 403 | strMin.prepend( "0" ); |
310 | if ( t.second() < 10 ) | 404 | if ( t.second() < 10 ) |
311 | strSec.prepend( "0" ); | 405 | strSec.prepend( "0" ); |
312 | argString = argString.arg( strMin ); | 406 | argString = argString.arg( strMin ); |
313 | if ( seconds ) | 407 | if ( seconds ) |
314 | argString = argString.arg( strSec ); | 408 | argString = argString.arg( strSec ); |
315 | if ( hour >= 12 ) | 409 | if ( hour >= 12 ) |
316 | argString = argString.arg( QObject::tr("PM") ); | 410 | argString = argString.arg( TimeStringFormat::tr("PM") ); |
317 | else | 411 | else |
318 | argString = argString.arg( QObject::tr("AM") ); | 412 | argString = argString.arg( TimeStringFormat::tr("AM") ); |
319 | return argString; | 413 | return argString; |
320 | } | 414 | } |
321 | 415 | ||
322 | QString TimeString::shortTime( bool ampm, bool seconds ) | 416 | QString TimeString::shortTime( bool ampm, bool seconds ) |
323 | { | 417 | { |
324 | static const char* const day[] = { | ||
325 | QT_TRANSLATE_NOOP( "QObject", "Mon" ), | ||
326 | QT_TRANSLATE_NOOP( "QObject", "Tue" ), | ||
327 | QT_TRANSLATE_NOOP( "QObject", "Wed" ), | ||
328 | QT_TRANSLATE_NOOP( "QObject", "Thu" ), | ||
329 | QT_TRANSLATE_NOOP( "QObject", "Fri" ), | ||
330 | QT_TRANSLATE_NOOP( "QObject", "Sat" ), | ||
331 | QT_TRANSLATE_NOOP( "QObject", "Sun" ) | ||
332 | }; | ||
333 | // just create a shorter time String | 418 | // just create a shorter time String |
334 | QDateTime dtTmp = QDateTime::currentDateTime(); | 419 | QDateTime dtTmp = QDateTime::currentDateTime(); |
335 | QString strTime; | 420 | QString strTime = TimeStringFormat::tr( "%1 %2", "1=Monday 2=12:45" ) |
336 | strTime = QObject::tr( day[dtTmp.date().dayOfWeek()-1] ) + " " + | 421 | .arg(::dayname(dtTmp.date(),FALSE)) |
337 | timeString( dtTmp.time(), ampm, seconds ); | 422 | .arg(timeString( dtTmp.time(), ampm, seconds )); |
338 | return strTime; | 423 | return strTime; |
339 | } | 424 | } |
340 | 425 | ||
341 | QString TimeString::dateString( const QDateTime &t, bool ampm ) | 426 | QString TimeString::dateString( const QDateTime &t, bool ampm ) |
342 | { | 427 | { |
343 | return dateString(t,ampm,FALSE); | 428 | return dateString(t,ampm,FALSE); |
344 | } | 429 | } |
345 | 430 | ||
346 | QString TimeString::timeString( const QTime &t, bool ampm) | 431 | QString TimeString::timeString( const QTime &t, bool ampm) |
347 | { | 432 | { |
348 | return timeString(t,ampm,FALSE); | 433 | return timeString(t,ampm,FALSE); |
349 | } | 434 | } |
350 | 435 | ||
351 | QString TimeString::shortTime( bool ampm ) | 436 | QString TimeString::shortTime( bool ampm ) |
352 | { | 437 | { |
353 | return shortTime(ampm,FALSE); | 438 | return shortTime(ampm,FALSE); |
354 | } | 439 | } |
355 | 440 | ||
356 | QString TimeString::numberDateString( const QDate &d, DateFormat dtf ) | 441 | QString TimeString::numberDateString( const QDate &d, DateFormat dtf ) |
357 | { | 442 | { |
358 | return dtf.numberDate(d); | 443 | return dtf.numberDate(d); |
359 | } | 444 | } |
360 | QString TimeString::longNumberDateString( const QDate &d, DateFormat dtf ) | 445 | QString TimeString::longNumberDateString( const QDate &d, DateFormat dtf ) |
361 | { | 446 | { |
362 | return dtf.numberDate(d,DateFormat::longNumber); | 447 | return dtf.numberDate(d,DateFormat::longNumber); |
363 | } | 448 | } |
449 | /*! | ||
450 | Returns date/time \a dt as a string, | ||
451 | showing year, month, date, hours, minutes, and seconds. | ||
452 | \a len determines the length of the resulting string. | ||
453 | |||
454 | The format, including order depends on the user's settings. | ||
455 | |||
456 | First availability: Qtopia 1.6 | ||
457 | */ | ||
458 | //QString TimeString::localYMDHMS( const QDateTime &dt, Length len ) | ||
459 | //{ | ||
460 | // const QDate& d = dt.date(); | ||
461 | // const QTime& t = dt.time(); | ||
462 | // return LocalTimeFormat::tr("%1 %2","date,time").arg(localYMD(d,len)).arg(localHMS(t)); | ||
463 | //} | ||
464 | |||
364 | 465 | ||
365 | #include "timestring.moc" | 466 | #include "timestring.moc" |
diff --git a/library/timestring.h b/library/timestring.h index 875c8bf..b8d1aea 100644 --- a/library/timestring.h +++ b/library/timestring.h | |||
@@ -1,150 +1,182 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
5 | ** | 13 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This program is distributed in the hope that it will be useful, but |
7 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
9 | ** packaging of this file. | 17 | ** See the GNU General Public License for more details. |
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | 18 | ** |
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 30 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 32 | ** not clear to you. |
18 | ** | 33 | ** |
19 | **********************************************************************/ | 34 | **********************************************************************/ |
20 | 35 | ||
21 | #ifndef _TIMESTRING_H_ | 36 | #ifndef _TIMESTRING_H_ |
22 | #define _TIMESTRING_H_ | 37 | #define _TIMESTRING_H_ |
23 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
24 | #include <qstring.h> | 39 | #include <qstring.h> |
40 | #include <qarray.h> | ||
25 | 41 | ||
26 | #if (QT_VERSION-0 >= 0x030000) | 42 | #if (QT_VERSION-0 >= 0x030000) |
27 | #define DateFormat QPEDateFormat | 43 | #define DateFormat QPEDateFormat |
28 | #endif | 44 | #endif |
29 | 45 | ||
46 | #include <qtopia/qpeglobal.h> | ||
47 | |||
48 | class QObject; | ||
49 | |||
30 | // return a string with the time based on whether or not you want | 50 | // return a string with the time based on whether or not you want |
31 | // you want it in 12 hour form. if ampm is true, then return | 51 | // you want it in 12 hour form. if ampm is true, then return |
32 | // it in 12 hour (am/pm) form otherwise return it in 24 hour form | 52 | // it in 12 hour (am/pm) form otherwise return it in 24 hour form |
33 | // in theory Qt 3,0 handles this better (hopefully obsoleteing this) | 53 | // in theory Qt 3,0 handles this better (hopefully obsoleteing this) |
34 | class DateFormat | 54 | class DateFormat |
35 | { | 55 | { |
36 | public: | 56 | public: |
37 | // date format type 001,010,100 = day month year | 57 | // date format type 1,2,4 = day,month,year |
38 | enum Order { | 58 | enum Order { |
39 | DayMonthYear = 0x0111, // 0x001 + 0x010(0x2 << 3) + 0x100(0x4 << 3) | 59 | DayMonthYear = 0421, // right-to-left |
40 | MonthDayYear = 0x010A, | 60 | MonthDayYear = 0412, |
41 | YearMonthDay = 0x0054 | 61 | YearMonthDay = 0124 |
42 | }; | 62 | }; |
43 | 63 | ||
44 | DateFormat(QChar s = '/', Order so = MonthDayYear) : _shortOrder(so), | 64 | DateFormat(QChar s = '/', Order so = MonthDayYear) : _shortOrder(so), |
45 | _longOrder(so), _shortSeparator(s) { } | 65 | _longOrder(so), _shortSeparator(s) { } |
46 | DateFormat(QChar s, Order so, Order lo) : _shortOrder(so), | 66 | DateFormat(QChar s, Order so, Order lo) : _shortOrder(so), |
47 | _longOrder(lo), _shortSeparator(s) { } | 67 | _longOrder(lo), _shortSeparator(s) { } |
48 | DateFormat(const DateFormat &o) : _shortOrder(o._shortOrder), | 68 | DateFormat(const DateFormat &o) : _shortOrder(o._shortOrder), |
49 | _longOrder(o._longOrder), _shortSeparator(o._shortSeparator) { } | 69 | _longOrder(o._longOrder), _shortSeparator(o._shortSeparator) { } |
50 | 70 | ||
51 | bool operator==(const DateFormat &o) | 71 | bool operator==(const DateFormat &o) |
52 | { | 72 | { |
53 | if (o._shortOrder == _shortOrder && o._longOrder == _longOrder && | 73 | if (o._shortOrder == _shortOrder && o._longOrder == _longOrder && |
54 | o._shortSeparator == _shortSeparator) | 74 | o._shortSeparator == _shortSeparator) |
55 | return TRUE; | 75 | return TRUE; |
56 | return FALSE; | 76 | return FALSE; |
57 | } | 77 | } |
58 | 78 | ||
59 | // verbosity specifiers | 79 | // verbosity specifiers |
60 | enum Verbosity { | 80 | enum Verbosity { |
61 | shortNumber = 0x01, // default | 81 | shortNumber = 0x01, // default |
62 | longNumber = 0x02, | 82 | longNumber = 0x02, |
63 | 83 | ||
64 | padNumber = 0x04, | 84 | padNumber = 0x04, |
65 | 85 | ||
66 | shortWord = 0x08, // default | 86 | shortWord = 0x08, // default |
67 | longWord = 0x10, | 87 | longWord = 0x10, |
68 | 88 | ||
69 | showWeekDay = 0x20 | 89 | showWeekDay = 0x20 |
70 | }; | 90 | }; |
71 | 91 | ||
72 | QString toNumberString() const; // the M/D/Y string. | 92 | QString toNumberString() const; // the M/D/Y string. |
73 | QString toWordString() const; // the Month day, year string. | 93 | QString toWordString() const; // the Month day, year string. |
74 | 94 | ||
75 | QString numberDate(const QDate &d, int v = 0) const; | 95 | QString numberDate(const QDate &d, int v = 0) const; |
76 | QString wordDate(const QDate &d, int v = 0) const; | 96 | QString wordDate(const QDate &d, int v = 0) const; |
77 | 97 | ||
78 | #ifndef QT_NO_DATASTREAM | 98 | #ifndef QT_NO_DATASTREAM |
79 | void load(QDataStream&); | 99 | void load(QDataStream&); |
80 | void save(QDataStream&) const; | 100 | void save(QDataStream&) const; |
81 | #endif | 101 | #endif |
82 | 102 | ||
83 | QChar separator() const { return _shortSeparator; }; | 103 | QChar separator() const { return _shortSeparator; }; |
84 | Order shortOrder() const { return _shortOrder; }; | 104 | Order shortOrder() const { return _shortOrder; }; |
85 | Order longOrder() const { return _longOrder; }; | 105 | Order longOrder() const { return _longOrder; }; |
86 | 106 | ||
87 | private: | 107 | private: |
88 | Order _shortOrder; | 108 | Order _shortOrder; |
89 | Order _longOrder; | 109 | Order _longOrder; |
90 | QChar _shortSeparator; | 110 | QChar _shortSeparator; |
91 | }; | 111 | }; |
92 | 112 | ||
93 | #ifndef QT_NO_DATASTREAM | 113 | #ifndef QT_NO_DATASTREAM |
94 | QDataStream &operator<<(QDataStream &s, const DateFormat&df); | 114 | QDataStream &operator<<(QDataStream &s, const DateFormat&df); |
95 | QDataStream &operator>>(QDataStream &s, DateFormat&df); | 115 | QDataStream &operator>>(QDataStream &s, DateFormat&df); |
96 | #endif | 116 | #endif |
97 | 117 | ||
98 | class TimeString | 118 | class TimeString |
99 | { | 119 | { |
100 | public: | 120 | public: |
101 | 121 | ||
102 | //enum DateFormat { MonthDayYear, DayMonthYear, ISO8601, | 122 | //enum DateFormat { MonthDayYear, DayMonthYear, ISO8601, |
103 | //YearMonthDay = ISO8601 }; | 123 | //YearMonthDay = ISO8601 }; |
104 | 124 | ||
105 | /** | 125 | |
106 | * @name Convience functions which use currentDateFormat | 126 | //private: |
107 | */ | 127 | static QString shortDate( const QDate &d ) |
108 | //@{ | ||
109 | static QString shortDate( const QDate &d ) | ||
110 | { return shortDate( d, currentDateFormat() ); } | 128 | { return shortDate( d, currentDateFormat() ); } |
111 | static QString dateString( const QDate &d ) | 129 | static QString dateString( const QDate &d ) |
112 | { return dateString( d, currentDateFormat() ); } | 130 | { return dateString( d, currentDateFormat() ); } |
113 | static QString longDateString( const QDate &d ) | 131 | static QString longDateString( const QDate &d ) |
114 | { return longDateString( d, currentDateFormat() ); } | 132 | { return longDateString( d, currentDateFormat() ); } |
115 | //@} | ||
116 | static QString dateString( const QDateTime &dt, bool ampm, bool seconds ) | 133 | static QString dateString( const QDateTime &dt, bool ampm, bool seconds ) |
117 | { return dateString( dt, ampm, seconds, currentDateFormat() ); } | 134 | { return dateString( dt, ampm, seconds, currentDateFormat() ); } |
118 | 135 | ||
136 | public: | ||
137 | enum Length { Short, Medium, Long }; | ||
138 | static QString localH( int hour ); | ||
139 | static QString localHM( const QTime & ); | ||
140 | static QString localHM( const QTime &, Length ); // qtopia 2.1.0 | ||
141 | static QString localHMS( const QTime & ); | ||
142 | static QString localHMDayOfWeek( const QDateTime &t ); | ||
143 | static QString localHMSDayOfWeek( const QDateTime &t ); | ||
144 | static QString localMD( const QDate &, Length=Medium ); | ||
145 | static QString localYMD( const QDate &, Length=Medium ); | ||
146 | static QString localYMDHMS( const QDateTime &, Length=Medium ); | ||
147 | static QString localDayOfWeek( const QDate&, Length=Medium ); | ||
148 | static QString localDayOfWeek( int day1to7, Length=Medium ); | ||
149 | |||
150 | static QString hourString( int hour, bool ampm ); | ||
151 | static bool currentAMPM(); | ||
152 | static DateFormat currentDateFormat(); | ||
153 | static QArray<DateFormat> formatOptions(); // qtopia 1.6.0 | ||
154 | |||
155 | static void connectChange(QObject*,const char* member); | ||
156 | static void disconnectChange(QObject*,const char* member); | ||
119 | 157 | ||
120 | /** @name Do not use as they don't honor system settings for AMPM | 158 | // Not recommended to call these (they don't honor system ampm) |
121 | * | 159 | static QString dateString( const QDateTime &t, bool ampm ); |
122 | */ | ||
123 | //@{ | ||
124 | static QString dateString( const QDateTime &t, bool ampm = false ); | ||
125 | static QString timeString( const QTime &t, bool ampm, bool seconds ); | 160 | static QString timeString( const QTime &t, bool ampm, bool seconds ); |
126 | static QString timeString( const QTime &t, bool ampm = false ); | 161 | static QString timeString( const QTime &t, bool ampm ); |
127 | static QString shortTime( bool ampm, bool seconds ); | 162 | static QString shortTime( bool ampm, bool seconds ); |
128 | static QString shortTime( bool ampm = false ); | 163 | static QString shortTime( bool ampm ); |
129 | //@} | ||
130 | 164 | ||
131 | static QString numberDateString( const QDate &d, DateFormat ); | 165 | static QString numberDateString( const QDate &d, DateFormat ); |
132 | static QString numberDateString( const QDate &d ) | 166 | static QString numberDateString( const QDate &d ) |
133 | { return numberDateString( d, currentDateFormat() ); } | 167 | { return numberDateString( d, currentDateFormat() ); } |
134 | static QString longNumberDateString( const QDate &d, DateFormat ); | 168 | static QString longNumberDateString( const QDate &d, DateFormat ); |
135 | static QString longNumberDateString( const QDate &d ) | 169 | static QString longNumberDateString( const QDate &d ) |
136 | { return longNumberDateString( d, currentDateFormat() ); } | 170 | { return longNumberDateString( d, currentDateFormat() ); } |
137 | 171 | ||
138 | static QString shortDate( const QDate &, DateFormat ); | 172 | static QString shortDate( const QDate &, DateFormat ); |
139 | static QString dateString( const QDate &, DateFormat ); | 173 | static QString dateString( const QDate &, DateFormat ); |
140 | static QString longDateString( const QDate &, DateFormat ); | 174 | static QString longDateString( const QDate &, DateFormat ); |
141 | 175 | ||
142 | static DateFormat currentDateFormat(); | ||
143 | |||
144 | private: | 176 | private: |
145 | static QString dateString( const QDateTime &t, bool ampm, bool seconds, DateFormat ); | 177 | static QString dateString( const QDateTime &t, bool ampm, bool seconds, DateFormat ); |
146 | 178 | ||
147 | 179 | ||
148 | }; | 180 | }; |
149 | 181 | ||
150 | #endif | 182 | #endif |
diff --git a/noncore/multimedia/camera2/camera2.pro b/noncore/multimedia/camera2/camera2.pro new file mode 100644 index 0000000..b6e2826 --- a/dev/null +++ b/noncore/multimedia/camera2/camera2.pro | |||
@@ -0,0 +1,27 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | ||
2 | TEMPLATE = app | ||
3 | CONFIG += qte warn_on quick_app | ||
4 | INTERFACES=camerabase.ui camerasettings.ui | ||
5 | HEADERS = mainwindow.h \ | ||
6 | image.h \ | ||
7 | thumbbutton.h \ | ||
8 | videocaptureview.h | ||
9 | SOURCES = mainwindow.cpp\ | ||
10 | image.cpp \ | ||
11 | videocaptureview.cpp \ | ||
12 | main.cpp | ||
13 | |||
14 | TARGET = camera2 | ||
15 | DEFINES += HAVE_VIDEO4LINUX | ||
16 | |||
17 | LIBS += -lopiecore2 -lopieui2 | ||
18 | INCLUDEPATH += $(OPIEDIR)/include | ||
19 | DEPENDPATH += $(OPIEDIR)/include | ||
20 | contains(CONFIG,quick-app) { | ||
21 | DESTDIR = $(OPIEDIR)/bin | ||
22 | DEFINES += NOQUICKLAUNCH | ||
23 | } | ||
24 | |||
25 | |||
26 | include( $(OPIEDIR)/include.pro ) | ||
27 | |||
diff --git a/noncore/multimedia/camera2/camerabase.cpp b/noncore/multimedia/camera2/camerabase.cpp new file mode 100644 index 0000000..cbb1ba9 --- a/dev/null +++ b/noncore/multimedia/camera2/camerabase.cpp | |||
@@ -0,0 +1,93 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'camerabase.ui' | ||
3 | ** | ||
4 | ** Created: Mon Jul 10 04:21:25 2006 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "camerabase.h" | ||
10 | |||
11 | #include <qframe.h> | ||
12 | #include <qpushbutton.h> | ||
13 | #include "thumbbutton.h" | ||
14 | #include "videocaptureview.h" | ||
15 | #include <qlayout.h> | ||
16 | #include <qvariant.h> | ||
17 | #include <qtooltip.h> | ||
18 | #include <qwhatsthis.h> | ||
19 | |||
20 | /* | ||
21 | * Constructs a CameraBase which is a child of 'parent', with the | ||
22 | * name 'name' and widget flags set to 'f' | ||
23 | */ | ||
24 | CameraBase::CameraBase( QWidget* parent, const char* name, WFlags fl ) | ||
25 | : QWidget( parent, name, fl ) | ||
26 | { | ||
27 | if ( !name ) | ||
28 | setName( "camera" ); | ||
29 | resize( 311, 381 ); | ||
30 | setCaption( tr( "Camera" ) ); | ||
31 | cameraLayout = new QGridLayout( this ); | ||
32 | cameraLayout->setSpacing( 0 ); | ||
33 | cameraLayout->setMargin( 0 ); | ||
34 | |||
35 | Frame3 = new QFrame( this, "Frame3" ); | ||
36 | Frame3->setFrameShape( QFrame::Panel ); | ||
37 | Frame3->setFrameShadow( QFrame::Sunken ); | ||
38 | Frame3->setLineWidth( 4 ); | ||
39 | Frame3->setMargin( 4 ); | ||
40 | Frame3->setMidLineWidth( 3 ); | ||
41 | Frame3Layout = new QVBoxLayout( Frame3 ); | ||
42 | Frame3Layout->setSpacing( 6 ); | ||
43 | Frame3Layout->setMargin( 4 ); | ||
44 | |||
45 | videocaptureview = new VideoCaptureView( Frame3, "videocaptureview" ); | ||
46 | videocaptureview->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, videocaptureview->sizePolicy().hasHeightForWidth() ) ); | ||
47 | Frame3Layout->addWidget( videocaptureview ); | ||
48 | |||
49 | cameraLayout->addMultiCellWidget( Frame3, 0, 0, 0, 1 ); | ||
50 | |||
51 | photo = new QPushButton( this, "photo" ); | ||
52 | photo->setText( tr( "Photo" ) ); | ||
53 | |||
54 | cameraLayout->addWidget( photo, 1, 0 ); | ||
55 | |||
56 | video = new QPushButton( this, "video" ); | ||
57 | video->setText( tr( "Video" ) ); | ||
58 | |||
59 | cameraLayout->addWidget( video, 1, 1 ); | ||
60 | |||
61 | thumbs = new QFrame( this, "thumbs" ); | ||
62 | thumbs->setFrameShape( QFrame::NoFrame ); | ||
63 | thumbs->setFrameShadow( QFrame::Plain ); | ||
64 | thumbsLayout = new QHBoxLayout( thumbs ); | ||
65 | thumbsLayout->setSpacing( 0 ); | ||
66 | thumbsLayout->setMargin( 0 ); | ||
67 | |||
68 | thumb1 = new ThumbButton( thumbs, "thumb1" ); | ||
69 | thumbsLayout->addWidget( thumb1 ); | ||
70 | |||
71 | thumb2 = new ThumbButton( thumbs, "thumb2" ); | ||
72 | thumbsLayout->addWidget( thumb2 ); | ||
73 | |||
74 | thumb3 = new ThumbButton( thumbs, "thumb3" ); | ||
75 | thumbsLayout->addWidget( thumb3 ); | ||
76 | |||
77 | thumb4 = new ThumbButton( thumbs, "thumb4" ); | ||
78 | thumbsLayout->addWidget( thumb4 ); | ||
79 | |||
80 | thumb5 = new ThumbButton( thumbs, "thumb5" ); | ||
81 | thumbsLayout->addWidget( thumb5 ); | ||
82 | |||
83 | cameraLayout->addMultiCellWidget( thumbs, 2, 2, 0, 1 ); | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * Destroys the object and frees any allocated resources | ||
88 | */ | ||
89 | CameraBase::~CameraBase() | ||
90 | { | ||
91 | // no need to delete child widgets, Qt does it all for us | ||
92 | } | ||
93 | |||
diff --git a/noncore/multimedia/camera2/camerabase.h b/noncore/multimedia/camera2/camerabase.h new file mode 100644 index 0000000..77ab4f0 --- a/dev/null +++ b/noncore/multimedia/camera2/camerabase.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'camerabase.ui' | ||
3 | ** | ||
4 | ** Created: Mon Jul 10 04:21:22 2006 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef CAMERA_H | ||
10 | #define CAMERA_H | ||
11 | |||
12 | #include <qvariant.h> | ||
13 | #include <qwidget.h> | ||
14 | class QVBoxLayout; | ||
15 | class QHBoxLayout; | ||
16 | class QGridLayout; | ||
17 | class QFrame; | ||
18 | class QPushButton; | ||
19 | class ThumbButton; | ||
20 | class VideoCaptureView; | ||
21 | |||
22 | class CameraBase : public QWidget | ||
23 | { | ||
24 | Q_OBJECT | ||
25 | |||
26 | public: | ||
27 | CameraBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
28 | ~CameraBase(); | ||
29 | |||
30 | QFrame* Frame3; | ||
31 | VideoCaptureView* videocaptureview; | ||
32 | QPushButton* photo; | ||
33 | QPushButton* video; | ||
34 | QFrame* thumbs; | ||
35 | ThumbButton* thumb1; | ||
36 | ThumbButton* thumb2; | ||
37 | ThumbButton* thumb3; | ||
38 | ThumbButton* thumb4; | ||
39 | ThumbButton* thumb5; | ||
40 | |||
41 | protected: | ||
42 | QGridLayout* cameraLayout; | ||
43 | QVBoxLayout* Frame3Layout; | ||
44 | QHBoxLayout* thumbsLayout; | ||
45 | }; | ||
46 | |||
47 | #endif // CAMERA_H | ||
diff --git a/noncore/multimedia/camera2/camerabase.ui b/noncore/multimedia/camera2/camerabase.ui new file mode 100644 index 0000000..e102f79 --- a/dev/null +++ b/noncore/multimedia/camera2/camerabase.ui | |||
@@ -0,0 +1,209 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>CameraBase</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>camera</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>311</width> | ||
15 | <height>381</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Camera</string> | ||
21 | </property> | ||
22 | <grid> | ||
23 | <property stdset="1"> | ||
24 | <name>margin</name> | ||
25 | <number>0</number> | ||
26 | </property> | ||
27 | <property stdset="1"> | ||
28 | <name>spacing</name> | ||
29 | <number>0</number> | ||
30 | </property> | ||
31 | <widget row="0" column="0" rowspan="1" colspan="2" > | ||
32 | <class>QFrame</class> | ||
33 | <property stdset="1"> | ||
34 | <name>name</name> | ||
35 | <cstring>Frame3</cstring> | ||
36 | </property> | ||
37 | <property stdset="1"> | ||
38 | <name>frameShape</name> | ||
39 | <enum>Panel</enum> | ||
40 | </property> | ||
41 | <property stdset="1"> | ||
42 | <name>frameShadow</name> | ||
43 | <enum>Sunken</enum> | ||
44 | </property> | ||
45 | <property stdset="1"> | ||
46 | <name>lineWidth</name> | ||
47 | <number>4</number> | ||
48 | </property> | ||
49 | <property stdset="1"> | ||
50 | <name>margin</name> | ||
51 | <number>4</number> | ||
52 | </property> | ||
53 | <property stdset="1"> | ||
54 | <name>midLineWidth</name> | ||
55 | <number>3</number> | ||
56 | </property> | ||
57 | <property> | ||
58 | <name>layoutMargin</name> | ||
59 | </property> | ||
60 | <vbox> | ||
61 | <property stdset="1"> | ||
62 | <name>margin</name> | ||
63 | <number>4</number> | ||
64 | </property> | ||
65 | <property stdset="1"> | ||
66 | <name>spacing</name> | ||
67 | <number>6</number> | ||
68 | </property> | ||
69 | <widget> | ||
70 | <class>VideoCaptureView</class> | ||
71 | <property stdset="1"> | ||
72 | <name>name</name> | ||
73 | <cstring>videocaptureview</cstring> | ||
74 | </property> | ||
75 | <property stdset="1"> | ||
76 | <name>sizePolicy</name> | ||
77 | <sizepolicy> | ||
78 | <hsizetype>7</hsizetype> | ||
79 | <vsizetype>7</vsizetype> | ||
80 | </sizepolicy> | ||
81 | </property> | ||
82 | </widget> | ||
83 | </vbox> | ||
84 | </widget> | ||
85 | <widget row="1" column="0" > | ||
86 | <class>QPushButton</class> | ||
87 | <property stdset="1"> | ||
88 | <name>name</name> | ||
89 | <cstring>photo</cstring> | ||
90 | </property> | ||
91 | <property stdset="1"> | ||
92 | <name>text</name> | ||
93 | <string>Photo</string> | ||
94 | </property> | ||
95 | </widget> | ||
96 | <widget row="1" column="1" > | ||
97 | <class>QPushButton</class> | ||
98 | <property stdset="1"> | ||
99 | <name>name</name> | ||
100 | <cstring>video</cstring> | ||
101 | </property> | ||
102 | <property stdset="1"> | ||
103 | <name>text</name> | ||
104 | <string>Video</string> | ||
105 | </property> | ||
106 | </widget> | ||
107 | <widget row="2" column="0" rowspan="1" colspan="2" > | ||
108 | <class>QFrame</class> | ||
109 | <property stdset="1"> | ||
110 | <name>name</name> | ||
111 | <cstring>thumbs</cstring> | ||
112 | </property> | ||
113 | <property stdset="1"> | ||
114 | <name>frameShape</name> | ||
115 | <enum>NoFrame</enum> | ||
116 | </property> | ||
117 | <property stdset="1"> | ||
118 | <name>frameShadow</name> | ||
119 | <enum>Plain</enum> | ||
120 | </property> | ||
121 | <hbox> | ||
122 | <property stdset="1"> | ||
123 | <name>margin</name> | ||
124 | <number>0</number> | ||
125 | </property> | ||
126 | <property stdset="1"> | ||
127 | <name>spacing</name> | ||
128 | <number>0</number> | ||
129 | </property> | ||
130 | <widget> | ||
131 | <class>ThumbButton</class> | ||
132 | <property stdset="1"> | ||
133 | <name>name</name> | ||
134 | <cstring>thumb1</cstring> | ||
135 | </property> | ||
136 | </widget> | ||
137 | <widget> | ||
138 | <class>ThumbButton</class> | ||
139 | <property stdset="1"> | ||
140 | <name>name</name> | ||
141 | <cstring>thumb2</cstring> | ||
142 | </property> | ||
143 | </widget> | ||
144 | <widget> | ||
145 | <class>ThumbButton</class> | ||
146 | <property stdset="1"> | ||
147 | <name>name</name> | ||
148 | <cstring>thumb3</cstring> | ||
149 | </property> | ||
150 | </widget> | ||
151 | <widget> | ||
152 | <class>ThumbButton</class> | ||
153 | <property stdset="1"> | ||
154 | <name>name</name> | ||
155 | <cstring>thumb4</cstring> | ||
156 | </property> | ||
157 | </widget> | ||
158 | <widget> | ||
159 | <class>ThumbButton</class> | ||
160 | <property stdset="1"> | ||
161 | <name>name</name> | ||
162 | <cstring>thumb5</cstring> | ||
163 | </property> | ||
164 | </widget> | ||
165 | </hbox> | ||
166 | </widget> | ||
167 | </grid> | ||
168 | </widget> | ||
169 | <customwidgets> | ||
170 | <customwidget> | ||
171 | <class>VideoCaptureView</class> | ||
172 | <header location="local">videocaptureview.h</header> | ||
173 | <sizehint> | ||
174 | <width>-1</width> | ||
175 | <height>-1</height> | ||
176 | </sizehint> | ||
177 | <container>0</container> | ||
178 | <sizepolicy> | ||
179 | <hordata>7</hordata> | ||
180 | <verdata>7</verdata> | ||
181 | </sizepolicy> | ||
182 | <pixmap>image0</pixmap> | ||
183 | </customwidget> | ||
184 | <customwidget> | ||
185 | <class>ThumbButton</class> | ||
186 | <header location="local">thumbbutton.h</header> | ||
187 | <sizehint> | ||
188 | <width>-1</width> | ||
189 | <height>-1</height> | ||
190 | </sizehint> | ||
191 | <container>0</container> | ||
192 | <sizepolicy> | ||
193 | <hordata>5</hordata> | ||
194 | <verdata>5</verdata> | ||
195 | </sizepolicy> | ||
196 | <pixmap>image1</pixmap> | ||
197 | </customwidget> | ||
198 | </customwidgets> | ||
199 | <images> | ||
200 | <image> | ||
201 | <name>image0</name> | ||
202 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | ||
203 | </image> | ||
204 | <image> | ||
205 | <name>image1</name> | ||
206 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> | ||
207 | </image> | ||
208 | </images> | ||
209 | </UI> | ||
diff --git a/noncore/multimedia/camera2/camerasettings.cpp b/noncore/multimedia/camera2/camerasettings.cpp new file mode 100644 index 0000000..d284128 --- a/dev/null +++ b/noncore/multimedia/camera2/camerasettings.cpp | |||
@@ -0,0 +1,166 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'camerasettings.ui' | ||
3 | ** | ||
4 | ** Created: Mon Jul 10 04:21:25 2006 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "camerasettings.h" | ||
10 | |||
11 | #include <qcombobox.h> | ||
12 | #include <qgroupbox.h> | ||
13 | #include <qlabel.h> | ||
14 | #include <qpushbutton.h> | ||
15 | #include <qslider.h> | ||
16 | #include <qtopia/locationcombo.h> | ||
17 | #include <qlayout.h> | ||
18 | #include <qvariant.h> | ||
19 | #include <qtooltip.h> | ||
20 | #include <qwhatsthis.h> | ||
21 | |||
22 | /* | ||
23 | * Constructs a CameraSettings which is a child of 'parent', with the | ||
24 | * name 'name' and widget flags set to 'f' | ||
25 | * | ||
26 | * The dialog will by default be modeless, unless you set 'modal' to | ||
27 | * TRUE to construct a modal dialog. | ||
28 | */ | ||
29 | CameraSettings::CameraSettings( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
30 | : QDialog( parent, name, modal, fl ) | ||
31 | { | ||
32 | if ( !name ) | ||
33 | setName( "CameraSettings" ); | ||
34 | resize( 324, 465 ); | ||
35 | setCaption( tr( "Settings" ) ); | ||
36 | CameraSettingsLayout = new QVBoxLayout( this ); | ||
37 | CameraSettingsLayout->setSpacing( 6 ); | ||
38 | CameraSettingsLayout->setMargin( 11 ); | ||
39 | |||
40 | location = new LocationCombo( this, "location" ); | ||
41 | CameraSettingsLayout->addWidget( location ); | ||
42 | |||
43 | photo = new QGroupBox( this, "photo" ); | ||
44 | photo->setTitle( tr( "Photo" ) ); | ||
45 | photo->setColumnLayout(0, Qt::Vertical ); | ||
46 | photo->layout()->setSpacing( 0 ); | ||
47 | photo->layout()->setMargin( 0 ); | ||
48 | photoLayout = new QVBoxLayout( photo->layout() ); | ||
49 | photoLayout->setAlignment( Qt::AlignTop ); | ||
50 | photoLayout->setSpacing( 2 ); | ||
51 | photoLayout->setMargin( 4 ); | ||
52 | |||
53 | Layout1 = new QHBoxLayout; | ||
54 | Layout1->setSpacing( 6 ); | ||
55 | Layout1->setMargin( 0 ); | ||
56 | |||
57 | TextLabel1 = new QLabel( photo, "TextLabel1" ); | ||
58 | TextLabel1->setText( tr( "Size" ) ); | ||
59 | Layout1->addWidget( TextLabel1 ); | ||
60 | |||
61 | photo_size = new QComboBox( FALSE, photo, "photo_size" ); | ||
62 | photo_size->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, photo_size->sizePolicy().hasHeightForWidth() ) ); | ||
63 | Layout1->addWidget( photo_size ); | ||
64 | photoLayout->addLayout( Layout1 ); | ||
65 | |||
66 | Layout2 = new QHBoxLayout; | ||
67 | Layout2->setSpacing( 6 ); | ||
68 | Layout2->setMargin( 0 ); | ||
69 | |||
70 | TextLabel2 = new QLabel( photo, "TextLabel2" ); | ||
71 | TextLabel2->setText( tr( "Quality" ) ); | ||
72 | Layout2->addWidget( TextLabel2 ); | ||
73 | |||
74 | photo_quality = new QSlider( photo, "photo_quality" ); | ||
75 | photo_quality->setMinValue( 0 ); | ||
76 | photo_quality->setMaxValue( 100 ); | ||
77 | photo_quality->setValue( 75 ); | ||
78 | photo_quality->setOrientation( QSlider::Horizontal ); | ||
79 | Layout2->addWidget( photo_quality ); | ||
80 | |||
81 | photo_quality_n = new QLabel( photo, "photo_quality_n" ); | ||
82 | photo_quality_n->setText( tr( "75" ) ); | ||
83 | Layout2->addWidget( photo_quality_n ); | ||
84 | photoLayout->addLayout( Layout2 ); | ||
85 | CameraSettingsLayout->addWidget( photo ); | ||
86 | |||
87 | video = new QGroupBox( this, "video" ); | ||
88 | video->setTitle( tr( "Video" ) ); | ||
89 | video->setColumnLayout(0, Qt::Vertical ); | ||
90 | video->layout()->setSpacing( 0 ); | ||
91 | video->layout()->setMargin( 0 ); | ||
92 | videoLayout = new QVBoxLayout( video->layout() ); | ||
93 | videoLayout->setAlignment( Qt::AlignTop ); | ||
94 | videoLayout->setSpacing( 2 ); | ||
95 | videoLayout->setMargin( 4 ); | ||
96 | |||
97 | Layout1_2 = new QHBoxLayout; | ||
98 | Layout1_2->setSpacing( 6 ); | ||
99 | Layout1_2->setMargin( 0 ); | ||
100 | |||
101 | TextLabel1_2 = new QLabel( video, "TextLabel1_2" ); | ||
102 | TextLabel1_2->setText( tr( "Size" ) ); | ||
103 | Layout1_2->addWidget( TextLabel1_2 ); | ||
104 | |||
105 | video_size = new QComboBox( FALSE, video, "video_size" ); | ||
106 | video_size->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, video_size->sizePolicy().hasHeightForWidth() ) ); | ||
107 | Layout1_2->addWidget( video_size ); | ||
108 | videoLayout->addLayout( Layout1_2 ); | ||
109 | |||
110 | Layout2_2 = new QHBoxLayout; | ||
111 | Layout2_2->setSpacing( 6 ); | ||
112 | Layout2_2->setMargin( 0 ); | ||
113 | |||
114 | TextLabel2_2 = new QLabel( video, "TextLabel2_2" ); | ||
115 | TextLabel2_2->setText( tr( "Quality" ) ); | ||
116 | Layout2_2->addWidget( TextLabel2_2 ); | ||
117 | |||
118 | video_quality = new QSlider( video, "video_quality" ); | ||
119 | video_quality->setMinValue( 0 ); | ||
120 | video_quality->setMaxValue( 100 ); | ||
121 | video_quality->setValue( 75 ); | ||
122 | video_quality->setOrientation( QSlider::Horizontal ); | ||
123 | Layout2_2->addWidget( video_quality ); | ||
124 | |||
125 | video_quality_n = new QLabel( video, "video_quality_n" ); | ||
126 | video_quality_n->setText( tr( "75" ) ); | ||
127 | Layout2_2->addWidget( video_quality_n ); | ||
128 | videoLayout->addLayout( Layout2_2 ); | ||
129 | |||
130 | Layout6 = new QHBoxLayout; | ||
131 | Layout6->setSpacing( 6 ); | ||
132 | Layout6->setMargin( 0 ); | ||
133 | |||
134 | TextLabel4 = new QLabel( video, "TextLabel4" ); | ||
135 | TextLabel4->setText( tr( "Frame rate" ) ); | ||
136 | Layout6->addWidget( TextLabel4 ); | ||
137 | |||
138 | video_framerate = new QSlider( video, "video_framerate" ); | ||
139 | video_framerate->setMinValue( 1 ); | ||
140 | video_framerate->setMaxValue( 60 ); | ||
141 | video_framerate->setValue( 5 ); | ||
142 | video_framerate->setOrientation( QSlider::Horizontal ); | ||
143 | Layout6->addWidget( video_framerate ); | ||
144 | |||
145 | TextLabel6 = new QLabel( video, "TextLabel6" ); | ||
146 | TextLabel6->setText( tr( "5" ) ); | ||
147 | Layout6->addWidget( TextLabel6 ); | ||
148 | videoLayout->addLayout( Layout6 ); | ||
149 | CameraSettingsLayout->addWidget( video ); | ||
150 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | ||
151 | CameraSettingsLayout->addItem( spacer ); | ||
152 | |||
153 | // signals and slots connections | ||
154 | connect( photo_quality, SIGNAL( valueChanged(int) ), photo_quality_n, SLOT( setNum(int) ) ); | ||
155 | connect( video_quality, SIGNAL( valueChanged(int) ), video_quality_n, SLOT( setNum(int) ) ); | ||
156 | connect( video_framerate, SIGNAL( valueChanged(int) ), TextLabel6, SLOT( setNum(int) ) ); | ||
157 | } | ||
158 | |||
159 | /* | ||
160 | * Destroys the object and frees any allocated resources | ||
161 | */ | ||
162 | CameraSettings::~CameraSettings() | ||
163 | { | ||
164 | // no need to delete child widgets, Qt does it all for us | ||
165 | } | ||
166 | |||
diff --git a/noncore/multimedia/camera2/camerasettings.h b/noncore/multimedia/camera2/camerasettings.h new file mode 100644 index 0000000..dcc48a0 --- a/dev/null +++ b/noncore/multimedia/camera2/camerasettings.h | |||
@@ -0,0 +1,59 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'camerasettings.ui' | ||
3 | ** | ||
4 | ** Created: Mon Jul 10 04:21:22 2006 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef CAMERASETTINGS_H | ||
10 | #define CAMERASETTINGS_H | ||
11 | |||
12 | #include <qvariant.h> | ||
13 | #include <qdialog.h> | ||
14 | class QVBoxLayout; | ||
15 | class QHBoxLayout; | ||
16 | class QGridLayout; | ||
17 | class LocationCombo; | ||
18 | class QComboBox; | ||
19 | class QGroupBox; | ||
20 | class QLabel; | ||
21 | class QSlider; | ||
22 | |||
23 | class CameraSettings : public QDialog | ||
24 | { | ||
25 | Q_OBJECT | ||
26 | |||
27 | public: | ||
28 | CameraSettings( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | ||
29 | ~CameraSettings(); | ||
30 | |||
31 | LocationCombo* location; | ||
32 | QGroupBox* photo; | ||
33 | QLabel* TextLabel1; | ||
34 | QComboBox* photo_size; | ||
35 | QLabel* TextLabel2; | ||
36 | QSlider* photo_quality; | ||
37 | QLabel* photo_quality_n; | ||
38 | QGroupBox* video; | ||
39 | QLabel* TextLabel1_2; | ||
40 | QComboBox* video_size; | ||
41 | QLabel* TextLabel2_2; | ||
42 | QSlider* video_quality; | ||
43 | QLabel* video_quality_n; | ||
44 | QLabel* TextLabel4; | ||
45 | QSlider* video_framerate; | ||
46 | QLabel* TextLabel6; | ||
47 | |||
48 | protected: | ||
49 | QVBoxLayout* CameraSettingsLayout; | ||
50 | QVBoxLayout* photoLayout; | ||
51 | QHBoxLayout* Layout1; | ||
52 | QHBoxLayout* Layout2; | ||
53 | QVBoxLayout* videoLayout; | ||
54 | QHBoxLayout* Layout1_2; | ||
55 | QHBoxLayout* Layout2_2; | ||
56 | QHBoxLayout* Layout6; | ||
57 | }; | ||
58 | |||
59 | #endif // CAMERASETTINGS_H | ||
diff --git a/noncore/multimedia/camera2/camerasettings.ui b/noncore/multimedia/camera2/camerasettings.ui new file mode 100644 index 0000000..276694b --- a/dev/null +++ b/noncore/multimedia/camera2/camerasettings.ui | |||
@@ -0,0 +1,433 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>CameraSettings</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>CameraSettings</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>324</width> | ||
15 | <height>465</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Settings</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>11</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>6</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>LocationCombo</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>location</cstring> | ||
42 | </property> | ||
43 | </widget> | ||
44 | <widget> | ||
45 | <class>QGroupBox</class> | ||
46 | <property stdset="1"> | ||
47 | <name>name</name> | ||
48 | <cstring>photo</cstring> | ||
49 | </property> | ||
50 | <property stdset="1"> | ||
51 | <name>title</name> | ||
52 | <string>Photo</string> | ||
53 | </property> | ||
54 | <property> | ||
55 | <name>layoutMargin</name> | ||
56 | </property> | ||
57 | <property> | ||
58 | <name>layoutSpacing</name> | ||
59 | </property> | ||
60 | <vbox> | ||
61 | <property stdset="1"> | ||
62 | <name>margin</name> | ||
63 | <number>4</number> | ||
64 | </property> | ||
65 | <property stdset="1"> | ||
66 | <name>spacing</name> | ||
67 | <number>2</number> | ||
68 | </property> | ||
69 | <widget> | ||
70 | <class>QLayoutWidget</class> | ||
71 | <property stdset="1"> | ||
72 | <name>name</name> | ||
73 | <cstring>Layout1</cstring> | ||
74 | </property> | ||
75 | <hbox> | ||
76 | <property stdset="1"> | ||
77 | <name>margin</name> | ||
78 | <number>0</number> | ||
79 | </property> | ||
80 | <property stdset="1"> | ||
81 | <name>spacing</name> | ||
82 | <number>6</number> | ||
83 | </property> | ||
84 | <widget> | ||
85 | <class>QLabel</class> | ||
86 | <property stdset="1"> | ||
87 | <name>name</name> | ||
88 | <cstring>TextLabel1</cstring> | ||
89 | </property> | ||
90 | <property stdset="1"> | ||
91 | <name>text</name> | ||
92 | <string>Size</string> | ||
93 | </property> | ||
94 | </widget> | ||
95 | <widget> | ||
96 | <class>QComboBox</class> | ||
97 | <property stdset="1"> | ||
98 | <name>name</name> | ||
99 | <cstring>photo_size</cstring> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>sizePolicy</name> | ||
103 | <sizepolicy> | ||
104 | <hsizetype>7</hsizetype> | ||
105 | <vsizetype>0</vsizetype> | ||
106 | </sizepolicy> | ||
107 | </property> | ||
108 | </widget> | ||
109 | </hbox> | ||
110 | </widget> | ||
111 | <widget> | ||
112 | <class>QLayoutWidget</class> | ||
113 | <property stdset="1"> | ||
114 | <name>name</name> | ||
115 | <cstring>Layout2</cstring> | ||
116 | </property> | ||
117 | <hbox> | ||
118 | <property stdset="1"> | ||
119 | <name>margin</name> | ||
120 | <number>0</number> | ||
121 | </property> | ||
122 | <property stdset="1"> | ||
123 | <name>spacing</name> | ||
124 | <number>6</number> | ||
125 | </property> | ||
126 | <widget> | ||
127 | <class>QLabel</class> | ||
128 | <property stdset="1"> | ||
129 | <name>name</name> | ||
130 | <cstring>TextLabel2</cstring> | ||
131 | </property> | ||
132 | <property stdset="1"> | ||
133 | <name>text</name> | ||
134 | <string>Quality</string> | ||
135 | </property> | ||
136 | </widget> | ||
137 | <widget> | ||
138 | <class>QSlider</class> | ||
139 | <property stdset="1"> | ||
140 | <name>name</name> | ||
141 | <cstring>photo_quality</cstring> | ||
142 | </property> | ||
143 | <property stdset="1"> | ||
144 | <name>minValue</name> | ||
145 | <number>0</number> | ||
146 | </property> | ||
147 | <property stdset="1"> | ||
148 | <name>maxValue</name> | ||
149 | <number>100</number> | ||
150 | </property> | ||
151 | <property stdset="1"> | ||
152 | <name>value</name> | ||
153 | <number>75</number> | ||
154 | </property> | ||
155 | <property stdset="1"> | ||
156 | <name>orientation</name> | ||
157 | <enum>Horizontal</enum> | ||
158 | </property> | ||
159 | </widget> | ||
160 | <widget> | ||
161 | <class>QLabel</class> | ||
162 | <property stdset="1"> | ||
163 | <name>name</name> | ||
164 | <cstring>photo_quality_n</cstring> | ||
165 | </property> | ||
166 | <property stdset="1"> | ||
167 | <name>text</name> | ||
168 | <string>75</string> | ||
169 | </property> | ||
170 | </widget> | ||
171 | </hbox> | ||
172 | </widget> | ||
173 | </vbox> | ||
174 | </widget> | ||
175 | <widget> | ||
176 | <class>QGroupBox</class> | ||
177 | <property stdset="1"> | ||
178 | <name>name</name> | ||
179 | <cstring>video</cstring> | ||
180 | </property> | ||
181 | <property stdset="1"> | ||
182 | <name>title</name> | ||
183 | <string>Video</string> | ||
184 | </property> | ||
185 | <property> | ||
186 | <name>layoutMargin</name> | ||
187 | </property> | ||
188 | <property> | ||
189 | <name>layoutSpacing</name> | ||
190 | </property> | ||
191 | <vbox> | ||
192 | <property stdset="1"> | ||
193 | <name>margin</name> | ||
194 | <number>4</number> | ||
195 | </property> | ||
196 | <property stdset="1"> | ||
197 | <name>spacing</name> | ||
198 | <number>2</number> | ||
199 | </property> | ||
200 | <widget> | ||
201 | <class>QLayoutWidget</class> | ||
202 | <property stdset="1"> | ||
203 | <name>name</name> | ||
204 | <cstring>Layout1_2</cstring> | ||
205 | </property> | ||
206 | <hbox> | ||
207 | <property stdset="1"> | ||
208 | <name>margin</name> | ||
209 | <number>0</number> | ||
210 | </property> | ||
211 | <property stdset="1"> | ||
212 | <name>spacing</name> | ||
213 | <number>6</number> | ||
214 | </property> | ||
215 | <widget> | ||
216 | <class>QLabel</class> | ||
217 | <property stdset="1"> | ||
218 | <name>name</name> | ||
219 | <cstring>TextLabel1_2</cstring> | ||
220 | </property> | ||
221 | <property stdset="1"> | ||
222 | <name>text</name> | ||
223 | <string>Size</string> | ||
224 | </property> | ||
225 | </widget> | ||
226 | <widget> | ||
227 | <class>QComboBox</class> | ||
228 | <property stdset="1"> | ||
229 | <name>name</name> | ||
230 | <cstring>video_size</cstring> | ||
231 | </property> | ||
232 | <property stdset="1"> | ||
233 | <name>sizePolicy</name> | ||
234 | <sizepolicy> | ||
235 | <hsizetype>7</hsizetype> | ||
236 | <vsizetype>0</vsizetype> | ||
237 | </sizepolicy> | ||
238 | </property> | ||
239 | </widget> | ||
240 | </hbox> | ||
241 | </widget> | ||
242 | <widget> | ||
243 | <class>QLayoutWidget</class> | ||
244 | <property stdset="1"> | ||
245 | <name>name</name> | ||
246 | <cstring>Layout2_2</cstring> | ||
247 | </property> | ||
248 | <hbox> | ||
249 | <property stdset="1"> | ||
250 | <name>margin</name> | ||
251 | <number>0</number> | ||
252 | </property> | ||
253 | <property stdset="1"> | ||
254 | <name>spacing</name> | ||
255 | <number>6</number> | ||
256 | </property> | ||
257 | <widget> | ||
258 | <class>QLabel</class> | ||
259 | <property stdset="1"> | ||
260 | <name>name</name> | ||
261 | <cstring>TextLabel2_2</cstring> | ||
262 | </property> | ||
263 | <property stdset="1"> | ||
264 | <name>text</name> | ||
265 | <string>Quality</string> | ||
266 | </property> | ||
267 | </widget> | ||
268 | <widget> | ||
269 | <class>QSlider</class> | ||
270 | <property stdset="1"> | ||
271 | <name>name</name> | ||
272 | <cstring>video_quality</cstring> | ||
273 | </property> | ||
274 | <property stdset="1"> | ||
275 | <name>minValue</name> | ||
276 | <number>0</number> | ||
277 | </property> | ||
278 | <property stdset="1"> | ||
279 | <name>maxValue</name> | ||
280 | <number>100</number> | ||
281 | </property> | ||
282 | <property stdset="1"> | ||
283 | <name>value</name> | ||
284 | <number>75</number> | ||
285 | </property> | ||
286 | <property stdset="1"> | ||
287 | <name>orientation</name> | ||
288 | <enum>Horizontal</enum> | ||
289 | </property> | ||
290 | </widget> | ||
291 | <widget> | ||
292 | <class>QLabel</class> | ||
293 | <property stdset="1"> | ||
294 | <name>name</name> | ||
295 | <cstring>video_quality_n</cstring> | ||
296 | </property> | ||
297 | <property stdset="1"> | ||
298 | <name>text</name> | ||
299 | <string>75</string> | ||
300 | </property> | ||
301 | </widget> | ||
302 | </hbox> | ||
303 | </widget> | ||
304 | <widget> | ||
305 | <class>QLayoutWidget</class> | ||
306 | <property stdset="1"> | ||
307 | <name>name</name> | ||
308 | <cstring>Layout6</cstring> | ||
309 | </property> | ||
310 | <hbox> | ||
311 | <property stdset="1"> | ||
312 | <name>margin</name> | ||
313 | <number>0</number> | ||
314 | </property> | ||
315 | <property stdset="1"> | ||
316 | <name>spacing</name> | ||
317 | <number>6</number> | ||
318 | </property> | ||
319 | <widget> | ||
320 | <class>QLabel</class> | ||
321 | <property stdset="1"> | ||
322 | <name>name</name> | ||
323 | <cstring>TextLabel4</cstring> | ||
324 | </property> | ||
325 | <property stdset="1"> | ||
326 | <name>text</name> | ||
327 | <string>Frame rate</string> | ||
328 | </property> | ||
329 | </widget> | ||
330 | <widget> | ||
331 | <class>QSlider</class> | ||
332 | <property stdset="1"> | ||
333 | <name>name</name> | ||
334 | <cstring>video_framerate</cstring> | ||
335 | </property> | ||
336 | <property stdset="1"> | ||
337 | <name>minValue</name> | ||
338 | <number>1</number> | ||
339 | </property> | ||
340 | <property stdset="1"> | ||
341 | <name>maxValue</name> | ||
342 | <number>60</number> | ||
343 | </property> | ||
344 | <property stdset="1"> | ||
345 | <name>value</name> | ||
346 | <number>5</number> | ||
347 | </property> | ||
348 | <property stdset="1"> | ||
349 | <name>orientation</name> | ||
350 | <enum>Horizontal</enum> | ||
351 | </property> | ||
352 | </widget> | ||
353 | <widget> | ||
354 | <class>QLabel</class> | ||
355 | <property stdset="1"> | ||
356 | <name>name</name> | ||
357 | <cstring>TextLabel6</cstring> | ||
358 | </property> | ||
359 | <property stdset="1"> | ||
360 | <name>text</name> | ||
361 | <string>5</string> | ||
362 | </property> | ||
363 | </widget> | ||
364 | </hbox> | ||
365 | </widget> | ||
366 | </vbox> | ||
367 | </widget> | ||
368 | <spacer> | ||
369 | <property> | ||
370 | <name>name</name> | ||
371 | <cstring>Spacer1</cstring> | ||
372 | </property> | ||
373 | <property stdset="1"> | ||
374 | <name>orientation</name> | ||
375 | <enum>Vertical</enum> | ||
376 | </property> | ||
377 | <property stdset="1"> | ||
378 | <name>sizeType</name> | ||
379 | <enum>Expanding</enum> | ||
380 | </property> | ||
381 | <property> | ||
382 | <name>sizeHint</name> | ||
383 | <size> | ||
384 | <width>20</width> | ||
385 | <height>20</height> | ||
386 | </size> | ||
387 | </property> | ||
388 | </spacer> | ||
389 | </vbox> | ||
390 | </widget> | ||
391 | <customwidgets> | ||
392 | <customwidget> | ||
393 | <class>LocationCombo</class> | ||
394 | <header location="global">qtopia/locationcombo.h</header> | ||
395 | <sizehint> | ||
396 | <width>-1</width> | ||
397 | <height>-1</height> | ||
398 | </sizehint> | ||
399 | <container>0</container> | ||
400 | <sizepolicy> | ||
401 | <hordata>5</hordata> | ||
402 | <verdata>5</verdata> | ||
403 | </sizepolicy> | ||
404 | <pixmap>image0</pixmap> | ||
405 | </customwidget> | ||
406 | </customwidgets> | ||
407 | <images> | ||
408 | <image> | ||
409 | <name>image0</name> | ||
410 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | ||
411 | </image> | ||
412 | </images> | ||
413 | <connections> | ||
414 | <connection> | ||
415 | <sender>photo_quality</sender> | ||
416 | <signal>valueChanged(int)</signal> | ||
417 | <receiver>photo_quality_n</receiver> | ||
418 | <slot>setNum(int)</slot> | ||
419 | </connection> | ||
420 | <connection> | ||
421 | <sender>video_quality</sender> | ||
422 | <signal>valueChanged(int)</signal> | ||
423 | <receiver>video_quality_n</receiver> | ||
424 | <slot>setNum(int)</slot> | ||
425 | </connection> | ||
426 | <connection> | ||
427 | <sender>video_framerate</sender> | ||
428 | <signal>valueChanged(int)</signal> | ||
429 | <receiver>TextLabel6</receiver> | ||
430 | <slot>setNum(int)</slot> | ||
431 | </connection> | ||
432 | </connections> | ||
433 | </UI> | ||
diff --git a/noncore/multimedia/camera2/config.in b/noncore/multimedia/camera2/config.in new file mode 100644 index 0000000..8838008 --- a/dev/null +++ b/noncore/multimedia/camera2/config.in | |||
@@ -0,0 +1,7 @@ | |||
1 | config CAMERA2 | ||
2 | boolean "opie-camera2 (camera app to use with Video4Linux)" | ||
3 | default "n" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI | ||
5 | comment "opie-camera needs a libqpe, libopie2core & libopie2ui" | ||
6 | depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI ) | ||
7 | |||
diff --git a/noncore/multimedia/camera2/image.cpp b/noncore/multimedia/camera2/image.cpp new file mode 100644 index 0000000..39b6d8b --- a/dev/null +++ b/noncore/multimedia/camera2/image.cpp | |||
@@ -0,0 +1,239 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #include "image.h" | ||
37 | |||
38 | #include <qfileinfo.h> | ||
39 | #include <qimage.h> | ||
40 | #include <qstring.h> | ||
41 | |||
42 | /*! | ||
43 | Returns an image created by loading the \a filename, | ||
44 | and scalining it, preserving aspect ratio, to fit in | ||
45 | \a width by \a height pixels. | ||
46 | |||
47 | First availability: Qtopia 2.0 | ||
48 | */ | ||
49 | QImage Image::loadScaled(const QString & filename, const int width, const int height, | ||
50 | ScaleMode mode) | ||
51 | { | ||
52 | QImageIO iio; | ||
53 | QString param; | ||
54 | int w = width; | ||
55 | int h = height; | ||
56 | |||
57 | if (width == 0 || height == 0) | ||
58 | return QImage(); | ||
59 | |||
60 | iio.setFileName(filename); | ||
61 | |||
62 | // | ||
63 | // Try and load and scale the image in one hit. | ||
64 | // | ||
65 | param.sprintf("GetHeaderInformation"); | ||
66 | iio.setParameters(param); | ||
67 | iio.read(); | ||
68 | |||
69 | // | ||
70 | // If we don't have bits(), read() understands parameters, | ||
71 | // and we can setup for fast reading. Otherwise, take the | ||
72 | // performance hit and do things slowly. | ||
73 | // | ||
74 | if (!iio.image().bits()) { | ||
75 | if ((iio.image().width() < w) && (iio.image().height() < h)) { | ||
76 | param.sprintf("%s", "Fast"); // No Tr | ||
77 | } | ||
78 | else { | ||
79 | int shrink_factor = 1; | ||
80 | QString smode; | ||
81 | switch (mode) { | ||
82 | case ScaleMin: | ||
83 | smode = "ScaleMin"; | ||
84 | shrink_factor = QMAX(iio.image().width() / w, iio.image().height() / h); | ||
85 | break; | ||
86 | case ScaleMax: | ||
87 | smode = "ScaleMax"; | ||
88 | shrink_factor = QMIN(iio.image().width() / w, iio.image().height() / h); | ||
89 | break; | ||
90 | case ScaleFree: | ||
91 | smode = "ScaleFree"; | ||
92 | shrink_factor = QMIN(iio.image().width() / w, iio.image().height() / h); | ||
93 | break; | ||
94 | } | ||
95 | param.sprintf("Scale( %i, %i, %s )%s, Shrink( %i )", // No tr | ||
96 | w, h, smode.latin1(), ", Fast", shrink_factor); // No tr | ||
97 | } | ||
98 | |||
99 | iio.setParameters(param); | ||
100 | iio.read(); | ||
101 | return iio.image(); | ||
102 | } | ||
103 | |||
104 | if ((iio.image().width() > w) || (iio.image().height() > h)) { | ||
105 | QSize s = aspectScaleSize(iio.image().width(), iio.image().height(), w, h, mode); | ||
106 | return iio.image().smoothScale(s.width(), s.height()); | ||
107 | } | ||
108 | |||
109 | return iio.image(); | ||
110 | } | ||
111 | |||
112 | // | ||
113 | // Returns new size of image, scaled to target_width and target_height, | ||
114 | // whilst preserving aspect ratio. Useful when it's not possible to | ||
115 | // scale an image prior to using it (eg. using RichText). Should be in | ||
116 | // global image utils. | ||
117 | // | ||
118 | // NOTE | ||
119 | // - expensive for images whose drivers do not allow us to retrieve | ||
120 | // parameters without reading the entire image. Currently (20030930) | ||
121 | // only the jpeg driver allows parameter reading. | ||
122 | // | ||
123 | QSize Image::loadScaledImageSize(const QString & filename, int target_width, int target_height, | ||
124 | int maxscale, ScaleMode mode) | ||
125 | { | ||
126 | QImageIO iio; | ||
127 | iio.setFileName(filename); | ||
128 | iio.setParameters("GetHeaderInformation"); | ||
129 | iio.read(); | ||
130 | |||
131 | int w = iio.image().width(); | ||
132 | int h = iio.image().height(); | ||
133 | |||
134 | // | ||
135 | // Scaling up small pictures can be very ugly. | ||
136 | // Leave them alone if they are too small. | ||
137 | // | ||
138 | if (maxscale && w * maxscale < target_width && h * maxscale < target_height) | ||
139 | return QSize(w * maxscale, h * maxscale); | ||
140 | |||
141 | return aspectScaleSize(w, h, target_width, target_height, mode); | ||
142 | } | ||
143 | |||
144 | // Load an image to be used as a portrait. Force its height to height, | ||
145 | // scale width to new height, and crop the width if it's still > width | ||
146 | // XXX : Should be using integer math | ||
147 | QImage Image::loadPortrait(const QString & filename, const int width, const int height) | ||
148 | { | ||
149 | QImageIO iio; | ||
150 | QString param; | ||
151 | int w = width; | ||
152 | int h = height; | ||
153 | |||
154 | if (width == 0 || height == 0) | ||
155 | return QImage(); | ||
156 | |||
157 | iio.setFileName(filename); | ||
158 | |||
159 | // | ||
160 | // Try and load and scale the image in one hit. | ||
161 | // | ||
162 | param.sprintf("GetHeaderInformation"); | ||
163 | iio.setParameters(param); | ||
164 | iio.read(); | ||
165 | |||
166 | // | ||
167 | // If we don't have bits(), read() understands parameters, | ||
168 | // and we can setup for fast reading. Otherwise, take the | ||
169 | // performance hit and do things slowly. | ||
170 | // | ||
171 | if (!iio.image().bits()) { | ||
172 | |||
173 | w = (int) ((double) iio.image().width() / (double) (iio.image().height()) * | ||
174 | (double) height); | ||
175 | param.sprintf("Scale( %i, %i, ScaleFree )%s", // No tr | ||
176 | w, h, ", Fast"); // No tr | ||
177 | |||
178 | iio.setParameters(param); | ||
179 | iio.read(); | ||
180 | |||
181 | if (w > width) { | ||
182 | int x = (int) ((double) (w - width) / 2); | ||
183 | QRect r(x, 0, width, height); | ||
184 | return iio.image().copy(r); | ||
185 | } | ||
186 | else | ||
187 | return iio.image(); | ||
188 | } | ||
189 | else | ||
190 | //scale width to the new height | ||
191 | return sizeToPortrait(iio.image(), width, height); | ||
192 | } | ||
193 | |||
194 | QImage Image::sizeToPortrait(const QImage & image, const int width, const int height) | ||
195 | { | ||
196 | int w = (image.width() * height) / image.height(); | ||
197 | if (w > width) { | ||
198 | int x = (w - width) / 2; | ||
199 | QRect r(x, 0, width, height); | ||
200 | return image.smoothScale(w, height).copy(r); | ||
201 | } | ||
202 | else | ||
203 | return image.smoothScale(width, height); | ||
204 | } | ||
205 | |||
206 | // | ||
207 | // Return (w x h) scaled to (target_width x target_height) with aspect | ||
208 | // ratio preserved. | ||
209 | // | ||
210 | QSize | ||
211 | Image::aspectScaleSize(const int w, const int h, const int target_width, | ||
212 | const int target_height, ScaleMode mode) | ||
213 | { | ||
214 | QSize s; | ||
215 | if (mode == ScaleFree) { | ||
216 | s = QSize(target_width, target_height); | ||
217 | } | ||
218 | else { | ||
219 | bool useHeight = TRUE; | ||
220 | int rw = target_height * w / h; | ||
221 | |||
222 | if (mode == ScaleMin) { | ||
223 | useHeight = (rw <= target_width); | ||
224 | } | ||
225 | else { // mode == ScaleMax | ||
226 | useHeight = (rw >= target_width); | ||
227 | } | ||
228 | |||
229 | if (useHeight) { | ||
230 | s = QSize(rw, target_height); | ||
231 | } | ||
232 | else { | ||
233 | s = QSize(target_width, target_width * h / w); | ||
234 | } | ||
235 | } | ||
236 | |||
237 | return s; | ||
238 | } | ||
239 | |||
diff --git a/noncore/multimedia/camera2/image.h b/noncore/multimedia/camera2/image.h new file mode 100644 index 0000000..36394ff --- a/dev/null +++ b/noncore/multimedia/camera2/image.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #ifndef IMAGE_H | ||
37 | #define IMAGE_H | ||
38 | |||
39 | #include <qimage.h> | ||
40 | #include <qtopia/qpeglobal.h> | ||
41 | |||
42 | class Image { | ||
43 | public: | ||
44 | // namespace | ||
45 | enum ScaleMode { ScaleFree, ScaleMin, ScaleMax }; | ||
46 | static QImage loadScaled(const QString &filename, const int width, const int height, ScaleMode mode=ScaleMin); | ||
47 | static QSize loadScaledImageSize(const QString &filename, int target_width, int target_height, int maxscale=1, ScaleMode mode=ScaleMin); | ||
48 | static QImage loadPortrait(const QString &filename, const int width, const int height); | ||
49 | static QImage sizeToPortrait(const QImage &image, const int width, const int height); | ||
50 | static QSize aspectScaleSize(const int w, const int h, const int target_width, const int target_height, ScaleMode mode=ScaleMin); | ||
51 | }; | ||
52 | |||
53 | #endif // IMAGE_H | ||
diff --git a/noncore/multimedia/camera2/main.cpp b/noncore/multimedia/camera2/main.cpp new file mode 100644 index 0000000..00e21de --- a/dev/null +++ b/noncore/multimedia/camera2/main.cpp | |||
@@ -0,0 +1,44 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #include "mainwindow.h" | ||
37 | #include <opie2/oapplication.h> | ||
38 | #include <opie2/oapplicationfactory.h> | ||
39 | |||
40 | using namespace Opie::Core; | ||
41 | OPIE_EXPORT_APP(OApplicationFactory < CameraMainWindow >) | ||
42 | // QTOPIA_ADD_APPLICATION("camera",CameraMainWindow) | ||
43 | // QTOPIA_MAIN | ||
44 | |||
diff --git a/noncore/multimedia/camera2/mainwindow.cpp b/noncore/multimedia/camera2/mainwindow.cpp new file mode 100644 index 0000000..45f8cdf --- a/dev/null +++ b/noncore/multimedia/camera2/mainwindow.cpp | |||
@@ -0,0 +1,763 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #define QTOPIA_INTERNAL_FILEOPERATIONS | ||
37 | #include "mainwindow.h" | ||
38 | #include "videocaptureview.h" | ||
39 | #include "camerasettings.h" | ||
40 | #include "thumbbutton.h" | ||
41 | |||
42 | #include "image.h" | ||
43 | |||
44 | /* OPIE */ | ||
45 | #include <opie2/odebug.h> | ||
46 | #include <opie2/oresource.h> | ||
47 | using namespace Opie::Core; | ||
48 | |||
49 | #include <qpe/config.h> | ||
50 | #include <qpe/qpeapplication.h> | ||
51 | #include <qpe/locationcombo.h> | ||
52 | //#include <qtopia/contextmenu.h> | ||
53 | #include <qpe/qcopenvelope_qws.h> | ||
54 | #include <qpe/resource.h> | ||
55 | //#include <qtopia/services.h> | ||
56 | #include <qpe/categories.h> | ||
57 | #include <qpe/qpetoolbar.h> | ||
58 | #include <qpe/global.h> | ||
59 | |||
60 | #include <qaction.h> | ||
61 | #include <qlabel.h> | ||
62 | #include <qtoolbutton.h> | ||
63 | #include <qpushbutton.h> | ||
64 | #include <qgroupbox.h> | ||
65 | #include <qsignalmapper.h> | ||
66 | #include <qdir.h> | ||
67 | #include <qimage.h> | ||
68 | #include <qslider.h> | ||
69 | #include <qtimer.h> | ||
70 | #include <qmessagebox.h> | ||
71 | |||
72 | #include <stdlib.h> | ||
73 | |||
74 | #include <sys/types.h> | ||
75 | #include <sys/stat.h> | ||
76 | |||
77 | static const int thmarg = 2; | ||
78 | static const bool video_supported = FALSE; | ||
79 | |||
80 | CameraMainWindow::CameraMainWindow(QWidget * parent, const char *name, WFlags f) | ||
81 | :QMainWindow(parent, name, f) | ||
82 | { | ||
83 | setCaption(tr("Camera")); | ||
84 | |||
85 | picfile = Global::tempDir() + "image.jpg"; | ||
86 | camera = new CameraBase(this); | ||
87 | setCentralWidget(camera); | ||
88 | |||
89 | connect(qApp, SIGNAL(appMessage(const QCString &, const QByteArray &)), | ||
90 | this, SLOT(appMessage(const QCString &, const QByteArray &))); | ||
91 | connect(qApp, SIGNAL(linkChanged(const QString &)), this, SLOT(linkChanged(const QString &))); | ||
92 | |||
93 | Categories cats; | ||
94 | cats.load(categoryFileName()); | ||
95 | camcat = cats.id("Document View", "_Camera"); // No tr | ||
96 | if (!camcat) { | ||
97 | camcat = cats.addCategory("Document View", "_Camera"); // No tr | ||
98 | cats.save(categoryFileName()); | ||
99 | } | ||
100 | |||
101 | camera->photo->setFocus(); | ||
102 | |||
103 | connect(camera->photo, SIGNAL(clicked()), this, SLOT(takePhoto())); | ||
104 | connect(camera->video, SIGNAL(clicked()), this, SLOT(toggleVideo())); | ||
105 | |||
106 | refocusTimer = new QTimer(this); | ||
107 | connect(refocusTimer, SIGNAL(timeout()), this, SLOT(takePhotoNow())); | ||
108 | |||
109 | thumb[0] = camera->thumb1; | ||
110 | thumb[1] = camera->thumb2; | ||
111 | thumb[2] = camera->thumb3; | ||
112 | thumb[3] = camera->thumb4; | ||
113 | thumb[4] = camera->thumb5; | ||
114 | cur_thumb = -1; | ||
115 | |||
116 | QSignalMapper *sm = new QSignalMapper(this); | ||
117 | for (int i = 0; i < nthumb; i++) { | ||
118 | sm->setMapping(thumb[i], i); | ||
119 | connect(thumb[i], SIGNAL(clicked()), sm, SLOT(map())); | ||
120 | thumb[i]->installEventFilter(this); | ||
121 | } | ||
122 | connect(sm, SIGNAL(mapped(int)), this, SLOT(thumbClicked(int))); | ||
123 | |||
124 | #warning fixme | ||
125 | // AppLnk picture_viewer = Service::appLnk("PhotoEdit"); | ||
126 | // AppLnk video_viewer = Service::appLnk("Open/video/mpeg"); | ||
127 | |||
128 | a_pview = new QAction(tr("%1...", "app name").arg("" /*picture_viewer.name() */ ), | ||
129 | Resource::loadPixmap(NULL /*picture_viewer.icon() */ ), QString::null, 0, | ||
130 | this, 0); | ||
131 | connect(a_pview, SIGNAL(activated()), this, SLOT(viewPictures())); | ||
132 | a_vview = new QAction(tr("%1...", "app name").arg("" /*video_viewer.name() */ ), | ||
133 | Resource::loadIconSet(NULL /*video_viewer.icon() */ ), QString::null, 0, | ||
134 | this, 0); | ||
135 | connect(a_vview, SIGNAL(activated()), this, SLOT(viewVideos())); | ||
136 | |||
137 | a_settings = | ||
138 | new QAction(tr("Settings..."), Opie::Core::OResource::loadPixmap("camera2/settings", Opie::Core::OResource::SmallIcon), | ||
139 | QString::null, 0, this, 0); | ||
140 | connect(a_settings, SIGNAL(activated()), this, SLOT(doSettings())); | ||
141 | |||
142 | a_th_edit = new QAction(tr("Edit"), Opie::Core::OResource::loadPixmap("edit", Opie::Core::OResource::SmallIcon), | ||
143 | QString::null, 0, this, 0); | ||
144 | connect(a_th_edit, SIGNAL(activated()), this, SLOT(editThumb())); | ||
145 | a_th_del = new QAction(tr("Delete"), Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon), | ||
146 | QString::null, 0, this, 0); | ||
147 | connect(a_th_del, SIGNAL(activated()), this, SLOT(delThumb())); | ||
148 | a_th_add = | ||
149 | new QAction(tr("Move to Contact..."), Opie::Core::OResource::loadPixmap("addressbook/generic-contact", Opie::Core::OResource::SmallIcon), | ||
150 | QString::null, 0, this, 0); | ||
151 | connect(a_th_add, SIGNAL(activated()), this, SLOT(moveToContact())); | ||
152 | a_send = | ||
153 | new QAction(tr("Beam to Contact..."), Opie::Core::OResource::loadPixmap("beam", Opie::Core::OResource::SmallIcon), | ||
154 | QString::null, 0, this, 0); | ||
155 | connect(a_send, SIGNAL(activated()), this, SLOT(sendFile())); | ||
156 | |||
157 | |||
158 | #ifndef QTOPIA_PHONE | ||
159 | // Create Toolbars | ||
160 | QPEToolBar *bar = new QPEToolBar(this); | ||
161 | bar->setHorizontalStretchable(TRUE); | ||
162 | setToolBarsMovable(FALSE); | ||
163 | |||
164 | a_pview->addTo(bar); | ||
165 | if (video_supported) | ||
166 | a_vview->addTo(bar); | ||
167 | a_th_edit->addTo(bar); | ||
168 | a_th_del->addTo(bar); | ||
169 | a_th_add->addTo(bar); | ||
170 | a_send->addTo(bar); | ||
171 | a_settings->addTo(bar); | ||
172 | #else | ||
173 | ContextMenu *contextMenu = new ContextMenu(this); | ||
174 | a_pview->addTo(contextMenu); | ||
175 | if (video_supported) | ||
176 | a_vview->addTo(contextMenu); | ||
177 | a_th_edit->addTo(contextMenu); | ||
178 | a_th_del->addTo(contextMenu); | ||
179 | a_th_add->addTo(contextMenu); | ||
180 | a_send->addTo(contextMenu); | ||
181 | a_settings->addTo(contextMenu); | ||
182 | #endif | ||
183 | |||
184 | installEventFilter(camera->photo); | ||
185 | installEventFilter(camera->video); | ||
186 | camera->photo->installEventFilter(this); | ||
187 | camera->video->installEventFilter(this); | ||
188 | |||
189 | // Load the allowable sizes from the camera hardware. | ||
190 | photo_size = camera->videocaptureview->photoSizes(); | ||
191 | video_size = camera->videocaptureview->videoSizes(); | ||
192 | |||
193 | settings = new CameraSettings(this, 0, TRUE); | ||
194 | // load settings from config | ||
195 | Config cfg("Camera"); | ||
196 | cfg.setGroup("General"); | ||
197 | QString l = cfg.readEntry("location"); | ||
198 | |||
199 | #warning fixme | ||
200 | /*if ( !l.isEmpty() ) | ||
201 | settings->location->setLocation(l); | ||
202 | */ | ||
203 | |||
204 | storagepath = settings->location->documentPath(); | ||
205 | cfg.setGroup("Photo"); | ||
206 | int w; | ||
207 | w = cfg.readNumEntry("width", camera->videocaptureview->recommendedPhotoSize().width()); | ||
208 | for (psize = 0; psize < (int) photo_size.count() - 1 && photo_size[psize].width() > w;) | ||
209 | psize++; | ||
210 | pquality = cfg.readNumEntry("quality", settings->photo_quality->value()); | ||
211 | cfg.setGroup("Video"); | ||
212 | w = cfg.readNumEntry("width", camera->videocaptureview->recommendedVideoSize().width()); | ||
213 | for (vsize = 0; vsize < (int) video_size.count() - 1 && video_size[vsize].width() > w;) | ||
214 | vsize++; | ||
215 | vquality = cfg.readNumEntry("quality", settings->video_quality->value()); | ||
216 | vframerate = cfg.readNumEntry("framerate", settings->video_framerate->value()); | ||
217 | |||
218 | for (int i = 0; i < (int) photo_size.count(); i++) { | ||
219 | settings->photo_size->insertItem(tr("%1 x %2").arg(photo_size[i].width()). | ||
220 | arg(photo_size[i].height())); | ||
221 | } | ||
222 | for (int i = 0; i < (int) video_size.count(); i++) { | ||
223 | settings->video_size->insertItem(tr("%1 x %2").arg(video_size[i].width()). | ||
224 | arg(video_size[i].height())); | ||
225 | } | ||
226 | |||
227 | namehint = 0; | ||
228 | recording = FALSE; | ||
229 | |||
230 | preview(); | ||
231 | |||
232 | if (!video_supported) { | ||
233 | // Room for longer text | ||
234 | camera->photo->setText(tr("Take Photo")); | ||
235 | camera->video->setEnabled(FALSE); | ||
236 | camera->video->hide(); | ||
237 | } | ||
238 | } | ||
239 | |||
240 | CameraMainWindow::~CameraMainWindow() | ||
241 | { | ||
242 | } | ||
243 | |||
244 | void CameraMainWindow::resizeEvent(QResizeEvent *) | ||
245 | { | ||
246 | thumbw = width() / 5 - 4; | ||
247 | thumbh = thumbw * 3 / 4; | ||
248 | thumb[0]->setFixedHeight(thumbh + thmarg * 2); | ||
249 | loadThumbs(); | ||
250 | } | ||
251 | |||
252 | bool CameraMainWindow::event(QEvent * e) | ||
253 | { | ||
254 | if (e->type() == QEvent::WindowActivate) { | ||
255 | if (cur_thumb < 0) | ||
256 | camera->videocaptureview->setLive(); | ||
257 | } | ||
258 | else if (e->type() == QEvent::WindowDeactivate) { | ||
259 | camera->videocaptureview->setLive(-1); | ||
260 | } | ||
261 | return QMainWindow::event(e); | ||
262 | } | ||
263 | |||
264 | bool CameraMainWindow::eventFilter(QObject * o, QEvent * e) | ||
265 | { | ||
266 | if (e->type() == QEvent::KeyPress) { | ||
267 | QKeyEvent *ke = (QKeyEvent *) e; | ||
268 | |||
269 | #if QTOPIA_PHONE | ||
270 | if (!ke->isAutoRepeat()) { | ||
271 | if (ke->key() == Key_1) { | ||
272 | takePhoto(); | ||
273 | return TRUE; | ||
274 | } | ||
275 | else if (ke->key() == Key_2) { | ||
276 | toggleVideo(); | ||
277 | return TRUE; | ||
278 | } | ||
279 | } | ||
280 | #endif | ||
281 | if (ke->key() == Key_Up) { | ||
282 | camera->photo->setFocus(); | ||
283 | return TRUE; | ||
284 | } | ||
285 | else if (ke->key() == Key_Down) { | ||
286 | thumb[0]->setFocus(); | ||
287 | return TRUE; | ||
288 | } | ||
289 | else if (ke->key() == Key_Left) { | ||
290 | if (o == camera->video) { | ||
291 | camera->photo->setFocus(); | ||
292 | return TRUE; | ||
293 | } | ||
294 | else { | ||
295 | if (o == thumb[0]) | ||
296 | return TRUE; | ||
297 | for (int i = 1; i < nthumb; ++i) { | ||
298 | if (o == thumb[i]) { | ||
299 | thumb[i - 1]->setFocus(); | ||
300 | return TRUE; | ||
301 | } | ||
302 | } | ||
303 | } | ||
304 | } | ||
305 | else if (ke->key() == Key_Right) { | ||
306 | if (o == camera->photo) { | ||
307 | camera->video->setFocus(); | ||
308 | return TRUE; | ||
309 | } | ||
310 | else { | ||
311 | if (o == thumb[nthumb - 1]) | ||
312 | return TRUE; | ||
313 | for (int i = 0; i < nthumb - 1; ++i) { | ||
314 | if (o == thumb[i]) { | ||
315 | thumb[i + 1]->setFocus(); | ||
316 | return TRUE; | ||
317 | } | ||
318 | } | ||
319 | } | ||
320 | } | ||
321 | } | ||
322 | else if (e->type() == QEvent::FocusIn) { | ||
323 | if (o == camera->photo) | ||
324 | camera->photo->setText(tr("Take Photo")); | ||
325 | updateActions(); | ||
326 | } | ||
327 | else if (e->type() == QEvent::FocusOut) { | ||
328 | if (o == camera->photo) | ||
329 | camera->photo->setText(tr("Activate Camera")); | ||
330 | } | ||
331 | return QWidget::eventFilter(o, e); | ||
332 | } | ||
333 | |||
334 | void CameraMainWindow::updateActions() | ||
335 | { | ||
336 | bool p = FALSE, v = FALSE; | ||
337 | QWidget *foc = focusWidget(); | ||
338 | if (foc == camera->photo) { | ||
339 | p = TRUE; | ||
340 | v = FALSE; | ||
341 | } | ||
342 | else if (foc == camera->video) { | ||
343 | v = TRUE; | ||
344 | p = FALSE; | ||
345 | } | ||
346 | a_pview->setEnabled(p); | ||
347 | a_vview->setEnabled(v); | ||
348 | a_settings->setEnabled(p || v); | ||
349 | bool th = !p && !v; | ||
350 | if (th) { | ||
351 | int i; | ||
352 | for (i = 0; i < nthumb; i++) { | ||
353 | if (thumb[i] == foc) { | ||
354 | selectThumb(i); | ||
355 | break; | ||
356 | } | ||
357 | } | ||
358 | if (i == nthumb || !thumb[i]->pixmap()) | ||
359 | th = FALSE; | ||
360 | } | ||
361 | else { | ||
362 | selectThumb(-1); | ||
363 | } | ||
364 | } | ||
365 | |||
366 | void CameraMainWindow::viewPictures() | ||
367 | { | ||
368 | #warning fixme | ||
369 | // ServiceRequest req("PhotoEdit","showCategory(int)"); | ||
370 | // req << camcat; | ||
371 | // req.send(); | ||
372 | } | ||
373 | |||
374 | void CameraMainWindow::viewVideos() | ||
375 | { | ||
376 | #warning fixme | ||
377 | // Service::appLnk("Open/video/mpeg").execute(); | ||
378 | } | ||
379 | |||
380 | void CameraMainWindow::doSettings() | ||
381 | { | ||
382 | bool v = video_supported; | ||
383 | #ifdef QTOPIA_PHONE | ||
384 | bool p; | ||
385 | p = a_pview->isEnabled(); | ||
386 | v = v && a_vview->isEnabled(); | ||
387 | if (p) | ||
388 | settings->photo->show(); | ||
389 | else | ||
390 | settings->photo->hide(); | ||
391 | #endif | ||
392 | if (v) | ||
393 | settings->video->show(); | ||
394 | else | ||
395 | settings->video->hide(); | ||
396 | settings->photo_size->setCurrentItem(psize); | ||
397 | settings->video_size->setCurrentItem(vsize); | ||
398 | settings->photo_quality->setValue(pquality); | ||
399 | settings->video_quality->setValue(vquality); | ||
400 | settings->video_framerate->setValue(vframerate); | ||
401 | settings->video_quality_n->setFixedWidth(fontMetrics().width("100")); | ||
402 | settings->photo_quality_n->setFixedWidth(fontMetrics().width("100")); | ||
403 | |||
404 | if (QPEApplication::execDialog(settings)) { | ||
405 | confirmSettings(); | ||
406 | } | ||
407 | else { | ||
408 | #warning fixme | ||
409 | // settings->location->setLocation(storagepath); | ||
410 | } | ||
411 | } | ||
412 | |||
413 | void CameraMainWindow::confirmSettings() | ||
414 | { | ||
415 | storagepath = settings->location->documentPath(); | ||
416 | psize = settings->photo_size->currentItem(); | ||
417 | vsize = settings->video_size->currentItem(); | ||
418 | pquality = settings->photo_quality->value(); | ||
419 | vquality = settings->video_quality->value(); | ||
420 | vframerate = settings->video_framerate->value(); | ||
421 | |||
422 | // save settings | ||
423 | Config cfg("Camera"); | ||
424 | cfg.setGroup("General"); | ||
425 | cfg.writeEntry("location", storagepath); | ||
426 | cfg.setGroup("Photo"); | ||
427 | cfg.writeEntry("width", photo_size[psize].width()); | ||
428 | cfg.writeEntry("quality", pquality); | ||
429 | cfg.setGroup("Video"); | ||
430 | cfg.writeEntry("width", video_size[vsize].width()); | ||
431 | cfg.writeEntry("quality", vquality); | ||
432 | cfg.writeEntry("framerate", vframerate); | ||
433 | |||
434 | loadThumbs(); | ||
435 | |||
436 | preview(); | ||
437 | } | ||
438 | |||
439 | static int cmpDocLnk(const void *a, const void *b) | ||
440 | { | ||
441 | const DocLnk *la = *(const DocLnk **) a; | ||
442 | const DocLnk *lb = *(const DocLnk **) b; | ||
443 | QFileInfo fa(la->linkFileKnown()? la->linkFile() : la->file()); | ||
444 | QFileInfo fb(lb->linkFileKnown()? lb->linkFile() : lb->file()); | ||
445 | return fa.lastModified().secsTo(fb.lastModified()); | ||
446 | } | ||
447 | |||
448 | void CameraMainWindow::loadThumbs() | ||
449 | { | ||
450 | if (storagepath.isEmpty()) { | ||
451 | updateActions(); | ||
452 | return; | ||
453 | } | ||
454 | |||
455 | DocLnkSet set(storagepath, "image/jpeg"); | ||
456 | const QList < DocLnk > &l = set.children(); | ||
457 | |||
458 | DocLnk *lnk; | ||
459 | DocLnk **array = new DocLnk *[l.count()]; | ||
460 | int n = 0; | ||
461 | for (QListIterator < DocLnk > it(l); (lnk = it.current()); ++it) { | ||
462 | if (lnk->categories().contains(camcat)) | ||
463 | array[n++] = lnk; | ||
464 | } | ||
465 | qsort(array, n, sizeof(array[0]), cmpDocLnk); | ||
466 | for (int i = 0; i < nthumb; i++) { | ||
467 | QPixmap pm; | ||
468 | if (i < n) { | ||
469 | picturefile[i] = *array[i]; | ||
470 | QImage img = Image::loadScaled(picturefile[i].file(), thumbw, thumbh); | ||
471 | pm.convertFromImage(img); | ||
472 | } | ||
473 | if (pm.isNull()) { | ||
474 | thumb[i]->setText(""); | ||
475 | } | ||
476 | else { | ||
477 | thumb[i]->setPixmap(pm); | ||
478 | } | ||
479 | thumb[i]->setEnabled(!pm.isNull()); | ||
480 | } | ||
481 | if (cur_thumb >= 0) | ||
482 | selectThumb(cur_thumb); | ||
483 | |||
484 | if (!camera->videocaptureview->available()) { | ||
485 | camera->photo->setEnabled(FALSE); | ||
486 | camera->video->setEnabled(FALSE); | ||
487 | if (!n) { | ||
488 | thumb[0]->setEnabled(FALSE); | ||
489 | } | ||
490 | else { | ||
491 | thumb[0]->setFocus(); | ||
492 | thumb[0]->setEnabled(TRUE); | ||
493 | } | ||
494 | } | ||
495 | |||
496 | updateActions(); | ||
497 | } | ||
498 | |||
499 | void CameraMainWindow::delThumb(int th) | ||
500 | { | ||
501 | switch (QMessageBox::warning(0, tr("Confirmation"), | ||
502 | tr("<qt>Delete '%1'?</qt>", | ||
503 | "%1 = file name").arg(picturefile[th].name()), QMessageBox::Yes, | ||
504 | QMessageBox::No)) { | ||
505 | case QMessageBox::Yes: | ||
506 | picturefile[th].removeFiles(); | ||
507 | |||
508 | // Rhys Hack - if we have just deleted the last image and there | ||
509 | // is no camera connected, then exit the application. This | ||
510 | // avoids a focus problem where it is impossible to exit with | ||
511 | // the back button due to the focus being in a stupid place. | ||
512 | loadThumbs(); | ||
513 | if (!camera->videocaptureview->available() && !(thumb[0]->isEnabled())) { | ||
514 | close(); | ||
515 | } | ||
516 | break; | ||
517 | default: | ||
518 | //nothing | ||
519 | break; | ||
520 | } | ||
521 | } | ||
522 | |||
523 | void CameraMainWindow::pushThumb(const DocLnk & f, const QImage & img) | ||
524 | { | ||
525 | for (int i = nthumb; --i;) { | ||
526 | bool en = thumb[i - 1]->isEnabled(); | ||
527 | thumb[i]->setEnabled(en); | ||
528 | picturefile[i] = picturefile[i - 1]; | ||
529 | const QPixmap *pm = thumb[i - 1]->pixmap(); | ||
530 | if (en && pm) { | ||
531 | thumb[i]->setPixmap(*pm); | ||
532 | } | ||
533 | else { | ||
534 | thumb[i]->setText(""); | ||
535 | } | ||
536 | } | ||
537 | QPixmap pm; | ||
538 | QSize sz = Image::aspectScaleSize(img.width(), img.height(), thumbw, thumbh); | ||
539 | QImage simg = img.smoothScale(sz.width(), sz.height()); | ||
540 | pm.convertFromImage(simg); | ||
541 | thumb[0]->setPixmap(pm); | ||
542 | thumb[0]->setEnabled(TRUE); | ||
543 | picturefile[0] = f; | ||
544 | } | ||
545 | |||
546 | void CameraMainWindow::takePhoto() | ||
547 | { | ||
548 | if (camera->photo != focusWidget()) { | ||
549 | camera->photo->setFocus(); | ||
550 | return; | ||
551 | } | ||
552 | QSize size = photo_size[psize]; | ||
553 | if (size == camera->videocaptureview->captureSize() || | ||
554 | camera->videocaptureview->refocusDelay() == 0) { | ||
555 | |||
556 | // We can grab the current image immediately. | ||
557 | takePhotoNow(); | ||
558 | |||
559 | } | ||
560 | else { | ||
561 | |||
562 | // Change the camera size and then wait for the camera to refocus. | ||
563 | camera->videocaptureview->setCaptureSize(size); | ||
564 | refocusTimer->start(camera->videocaptureview->refocusDelay(), TRUE); | ||
565 | |||
566 | } | ||
567 | } | ||
568 | |||
569 | void CameraMainWindow::takePhotoNow() | ||
570 | { | ||
571 | QImage img = camera->videocaptureview->image(); | ||
572 | |||
573 | if (inSnapMode()) { | ||
574 | QCopEnvelope e(snap_ch, "valueSupplied(QString,QImage)"); | ||
575 | QSize s = Image::aspectScaleSize(img.width(), img.height(), snap_maxw, snap_maxh); | ||
576 | e << snap_id << img.smoothScale(s.width(), s.height()); | ||
577 | setSnapMode(FALSE); | ||
578 | close(); | ||
579 | } | ||
580 | else { | ||
581 | DocLnk f; | ||
582 | //f.setLocation(storagepath); | ||
583 | f.setType("image/jpeg"); | ||
584 | QDateTime dt = QDateTime::currentDateTime(); | ||
585 | QString date = dt.toString(); | ||
586 | f.setName(tr("Photo, " + date)); | ||
587 | |||
588 | QArray < int >c(1); | ||
589 | c[0] = camcat; | ||
590 | f.setCategories(c); | ||
591 | img.save(f.file(), "JPEG", pquality); // Save the image in its original size. | ||
592 | f.writeLink(); | ||
593 | pushThumb(f, img); | ||
594 | } | ||
595 | |||
596 | preview(); | ||
597 | } | ||
598 | |||
599 | bool CameraMainWindow::inSnapMode() const | ||
600 | { | ||
601 | return !snap_ch.isEmpty(); | ||
602 | } | ||
603 | |||
604 | void CameraMainWindow::setSnapMode(bool y) | ||
605 | { | ||
606 | if (y) { | ||
607 | camera->thumbs->hide(); | ||
608 | camera->video->hide(); | ||
609 | } | ||
610 | else { | ||
611 | camera->thumbs->show(); | ||
612 | if (video_supported) | ||
613 | camera->video->show(); | ||
614 | else | ||
615 | camera->video->hide(); | ||
616 | snap_ch = QString::null; | ||
617 | } | ||
618 | } | ||
619 | |||
620 | void CameraMainWindow::toggleVideo() | ||
621 | { | ||
622 | if (recording) | ||
623 | stopVideo(); | ||
624 | else | ||
625 | startVideo(); | ||
626 | recording = !recording; | ||
627 | camera->video->setText(recording ? tr("Stop") : tr("Video")); | ||
628 | camera->photo->setEnabled(!recording); | ||
629 | for (int i = 0; i < nthumb; i++) | ||
630 | thumb[i]->setEnabled(!recording && thumb[i]->pixmap()); | ||
631 | } | ||
632 | |||
633 | void CameraMainWindow::startVideo() | ||
634 | { | ||
635 | // XXX eg. MJPG | ||
636 | } | ||
637 | void CameraMainWindow::stopVideo() | ||
638 | { | ||
639 | } | ||
640 | |||
641 | void CameraMainWindow::thumbClicked(int i) | ||
642 | { | ||
643 | selectThumb(i); | ||
644 | } | ||
645 | |||
646 | void CameraMainWindow::editThumb() | ||
647 | { | ||
648 | picturefile[cur_thumb].execute(); | ||
649 | } | ||
650 | |||
651 | void CameraMainWindow::selectThumb(int i) | ||
652 | { | ||
653 | cur_thumb = i; | ||
654 | if (i >= 0) { | ||
655 | QImage img(picturefile[i].file()); | ||
656 | camera->videocaptureview->setStill(img); | ||
657 | thumb[i]->setFocus(); | ||
658 | } | ||
659 | else { | ||
660 | camera->videocaptureview->setLive(); | ||
661 | } | ||
662 | a_th_edit->setEnabled(i >= 0); | ||
663 | a_th_del->setEnabled(i >= 0); | ||
664 | a_th_add->setEnabled(i >= 0); | ||
665 | a_send->setEnabled(i >= 0); | ||
666 | } | ||
667 | |||
668 | void CameraMainWindow::moveToContact() | ||
669 | { | ||
670 | if (cur_thumb >= 0) { | ||
671 | #warning fixme | ||
672 | // QCopEnvelope e(Service::channel("Contacts"),"setContactImage(QImage)"); | ||
673 | // QImage img; | ||
674 | // img.load(picturefile[cur_thumb].file()); | ||
675 | // e << img; | ||
676 | } | ||
677 | } | ||
678 | |||
679 | void CameraMainWindow::delThumb() | ||
680 | { | ||
681 | if (cur_thumb >= 0) { | ||
682 | int d = cur_thumb; | ||
683 | if (cur_thumb > 0) | ||
684 | selectThumb(cur_thumb - 1); | ||
685 | delThumb(d); | ||
686 | } | ||
687 | } | ||
688 | |||
689 | void CameraMainWindow::linkChanged(const QString &) | ||
690 | { | ||
691 | loadThumbs(); | ||
692 | } | ||
693 | |||
694 | void CameraMainWindow::appMessage(const QCString & msg, const QByteArray & data) | ||
695 | { | ||
696 | if (msg == "getImage(QCString,QString,int,int,QImage)") { | ||
697 | QDataStream ds(data, IO_ReadOnly); | ||
698 | ds >> snap_ch >> snap_id >> snap_maxw >> snap_maxh; | ||
699 | setSnapMode(TRUE); | ||
700 | QPEApplication::setKeepRunning(); | ||
701 | } | ||
702 | } | ||
703 | |||
704 | void CameraMainWindow::preview() | ||
705 | { | ||
706 | if (camera->videocaptureview->refocusDelay() > 200) { | ||
707 | camera->videocaptureview->setCaptureSize(photo_size[psize]); | ||
708 | } | ||
709 | else { | ||
710 | camera->videocaptureview->setCaptureSize(camera->videocaptureview-> | ||
711 | recommendedPreviewSize()); | ||
712 | } | ||
713 | } | ||
714 | |||
715 | void CameraMainWindow::sendFile() | ||
716 | { | ||
717 | if (cur_thumb >= 0) { | ||
718 | //copy file | ||
719 | QFile input(picturefile[cur_thumb].file()); | ||
720 | if (!input.open(IO_ReadOnly)) { | ||
721 | return; //error | ||
722 | } | ||
723 | QFile output(picfile); | ||
724 | if (!output.open(IO_WriteOnly)) { | ||
725 | return; | ||
726 | } | ||
727 | |||
728 | const int BUFFER_SIZE = 1024; | ||
729 | Q_INT8 buffer[BUFFER_SIZE]; | ||
730 | |||
731 | QDataStream srcStr(&input); | ||
732 | QDataStream destStr(&output); | ||
733 | |||
734 | while (!srcStr.atEnd()) { | ||
735 | int i = 0; | ||
736 | while (!srcStr.atEnd() && i < BUFFER_SIZE) { | ||
737 | srcStr >> buffer[i]; | ||
738 | i++; | ||
739 | } | ||
740 | for (int k = 0; k < i; k++) { | ||
741 | destStr << buffer[k]; | ||
742 | } | ||
743 | } | ||
744 | |||
745 | #warning fixme | ||
746 | // QCopEnvelope e(Service::channel("Email"),"writeMessage(QString,QString,QStringList,QStringList)"); | ||
747 | // e << QString() << QString() << QStringList() << QStringList( QString( picfile ) ); | ||
748 | } | ||
749 | } | ||
750 | |||
751 | void ThumbButton::drawButtonLabel(QPainter * p) | ||
752 | { | ||
753 | const QPixmap *pm = pixmap(); | ||
754 | if (pm) { | ||
755 | QSize s = (size() - pm->size()) / 2; | ||
756 | p->drawPixmap(s.width(), s.height(), *pm); | ||
757 | } | ||
758 | } | ||
759 | |||
760 | ThumbButton::ThumbButton(QWidget * parent, const char *name):QToolButton(parent, name) | ||
761 | { | ||
762 | } | ||
763 | |||
diff --git a/noncore/multimedia/camera2/mainwindow.h b/noncore/multimedia/camera2/mainwindow.h new file mode 100644 index 0000000..d6c5a7e --- a/dev/null +++ b/noncore/multimedia/camera2/mainwindow.h | |||
@@ -0,0 +1,132 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | #ifndef MAINWINDOW_H | ||
36 | #define MAINWINDOW_H | ||
37 | |||
38 | #include "camerabase.h" | ||
39 | #include <qvaluelist.h> | ||
40 | #include <qmainwindow.h> | ||
41 | #include <qpe/applnk.h> | ||
42 | |||
43 | class LocationCombo; | ||
44 | class QAction; | ||
45 | class QTimer; | ||
46 | class CameraSettings; | ||
47 | |||
48 | |||
49 | class CameraMainWindow : public QMainWindow | ||
50 | { | ||
51 | Q_OBJECT | ||
52 | public: | ||
53 | static QString appName() { return QString::fromLatin1("camera2"); } | ||
54 | |||
55 | CameraMainWindow( QWidget *parent=0, const char *name=0, WFlags fl=0 ); | ||
56 | ~CameraMainWindow(); | ||
57 | |||
58 | public slots: | ||
59 | void takePhoto(); | ||
60 | void toggleVideo(); | ||
61 | void selectThumb(int i); | ||
62 | void thumbClicked(int i); | ||
63 | |||
64 | private slots: | ||
65 | void viewPictures(); | ||
66 | void viewVideos(); | ||
67 | void doSettings(); | ||
68 | void appMessage(const QCString& msg, const QByteArray& data); | ||
69 | void editThumb(); | ||
70 | void delThumb(); | ||
71 | void moveToContact(); | ||
72 | void takePhotoNow(); | ||
73 | void sendFile(); | ||
74 | void linkChanged(const QString&); | ||
75 | |||
76 | private: | ||
77 | bool event(QEvent* e); | ||
78 | void updateActions(); | ||
79 | void resizeEvent(QResizeEvent*); | ||
80 | |||
81 | bool eventFilter(QObject*, QEvent*); | ||
82 | QString nextFileName(); | ||
83 | void loadThumbs(); | ||
84 | void pushThumb(const DocLnk& f, const QImage& img); | ||
85 | static const int nthumb = 5; | ||
86 | QToolButton* thumb[nthumb]; | ||
87 | DocLnk picturefile[nthumb]; | ||
88 | int cur_thumb; | ||
89 | void delThumb(int th); | ||
90 | |||
91 | // Settings | ||
92 | void confirmSettings(); | ||
93 | CameraSettings *settings; | ||
94 | QString storagepath; | ||
95 | int thumbw; | ||
96 | int thumbh; | ||
97 | int psize; | ||
98 | int vsize; | ||
99 | int pquality; | ||
100 | int vquality; | ||
101 | int vframerate; | ||
102 | |||
103 | // Snap | ||
104 | QCString snap_ch; | ||
105 | QString snap_id; | ||
106 | int snap_maxw, snap_maxh; | ||
107 | bool inSnapMode() const; | ||
108 | void setSnapMode(bool); | ||
109 | |||
110 | CameraBase *camera; | ||
111 | |||
112 | int namehint; | ||
113 | QAction *a_pview, *a_vview, *a_settings; | ||
114 | QAction *a_th_edit, *a_th_del, *a_th_add; | ||
115 | QAction *a_send; | ||
116 | QValueList<QSize> photo_size; | ||
117 | QValueList<QSize> video_size; | ||
118 | |||
119 | QTimer *refocusTimer; | ||
120 | QString picfile; | ||
121 | |||
122 | bool recording; | ||
123 | void stopVideo(); | ||
124 | void startVideo(); | ||
125 | |||
126 | void preview(); | ||
127 | |||
128 | int camcat; | ||
129 | }; | ||
130 | |||
131 | #endif | ||
132 | |||
diff --git a/noncore/multimedia/camera2/opie-camera2.control b/noncore/multimedia/camera2/opie-camera2.control new file mode 100644 index 0000000..a2d0700 --- a/dev/null +++ b/noncore/multimedia/camera2/opie-camera2.control | |||
@@ -0,0 +1,10 @@ | |||
1 | Package: opie-camera2 | ||
2 | Files: bin/camerapics/camera2 apps/Applications/camera2.desktop | ||
3 | Priority: optional | ||
4 | Section: opie/multimedia | ||
5 | Maintainer: Lorn "ljp" Potter <lorn.potter@trolltech.com> | ||
6 | Architecture: arm | ||
7 | Version: 1.0.1$EXTRAVERSION | ||
8 | Depends: libqpe1, libopiecore2, libopieui2 | ||
9 | Description: A Camera Application | ||
10 | A Camera Application to use with Video4Linux. | ||
diff --git a/noncore/multimedia/camera2/thumbbutton.h b/noncore/multimedia/camera2/thumbbutton.h new file mode 100644 index 0000000..f7ca3b4 --- a/dev/null +++ b/noncore/multimedia/camera2/thumbbutton.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | #ifndef THUMBBUTTON_H | ||
36 | #define THUMBBUTTON_H | ||
37 | |||
38 | #include <qtoolbutton.h> | ||
39 | |||
40 | class ThumbButton : public QToolButton | ||
41 | { | ||
42 | Q_OBJECT | ||
43 | public: | ||
44 | ThumbButton( QWidget *parent, const char* name ); | ||
45 | |||
46 | void drawButtonLabel( QPainter * ); | ||
47 | }; | ||
48 | |||
49 | #endif | ||
50 | |||
diff --git a/noncore/multimedia/camera2/videocaptureview.cpp b/noncore/multimedia/camera2/videocaptureview.cpp new file mode 100644 index 0000000..410634a --- a/dev/null +++ b/noncore/multimedia/camera2/videocaptureview.cpp | |||
@@ -0,0 +1,599 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | |||
36 | #include "videocaptureview.h" | ||
37 | #include <qimage.h> | ||
38 | #include <qpainter.h> | ||
39 | #ifdef Q_WS_QWS | ||
40 | #include <qgfx_qws.h> | ||
41 | #include <qdirectpainter_qws.h> | ||
42 | #endif | ||
43 | |||
44 | #ifdef __linux__ | ||
45 | #defineHAVE_VIDEO4LINUX 1 | ||
46 | #endif | ||
47 | |||
48 | #ifdef HAVE_VIDEO4LINUX | ||
49 | |||
50 | #include <sys/types.h> | ||
51 | #include <sys/ioctl.h> | ||
52 | #include <unistd.h> | ||
53 | #include <fcntl.h> | ||
54 | #include <linux/videodev.h> | ||
55 | #include <errno.h> | ||
56 | #include <string.h> | ||
57 | #include <stdlib.h> | ||
58 | #include <sys/mman.h> | ||
59 | |||
60 | #endif /* HAVE_VIDEO4LINUX */ | ||
61 | |||
62 | class VideoCapture { | ||
63 | public: | ||
64 | VideoCapture(); | ||
65 | ~VideoCapture(); | ||
66 | |||
67 | bool hasCamera() const; | ||
68 | void getCameraImage(QImage & img, bool copy = FALSE); | ||
69 | |||
70 | QValueList < QSize > photoSizes() const; | ||
71 | QValueList < QSize > videoSizes() const; | ||
72 | |||
73 | QSize recommendedPhotoSize() const; | ||
74 | QSize recommendedVideoSize() const; | ||
75 | QSize recommendedPreviewSize() const; | ||
76 | |||
77 | QSize captureSize() const; | ||
78 | void setCaptureSize(QSize size); | ||
79 | |||
80 | uint refocusDelay() const; | ||
81 | int minimumFramePeriod() const; | ||
82 | |||
83 | private: | ||
84 | #ifdef HAVE_VIDEO4LINUX | ||
85 | int fd; | ||
86 | int width, height; | ||
87 | struct video_capability caps; | ||
88 | struct video_mbuf mbuf; | ||
89 | unsigned char *frames; | ||
90 | int currentFrame; | ||
91 | |||
92 | void setupCamera(QSize size); | ||
93 | void shutdown(); | ||
94 | #endif | ||
95 | }; | ||
96 | |||
97 | #ifdef HAVE_VIDEO4LINUX | ||
98 | |||
99 | #define VIDEO_DEVICE "/dev/video" | ||
100 | |||
101 | bool VideoCapture::hasCamera() const | ||
102 | { | ||
103 | return (fd != -1); | ||
104 | } | ||
105 | |||
106 | QSize VideoCapture::captureSize() const | ||
107 | { | ||
108 | return QSize(width, height); | ||
109 | } | ||
110 | |||
111 | uint VideoCapture::refocusDelay() const | ||
112 | { | ||
113 | return 250; | ||
114 | } | ||
115 | |||
116 | int VideoCapture::minimumFramePeriod() const | ||
117 | { | ||
118 | return 40; // milliseconds | ||
119 | } | ||
120 | |||
121 | VideoCapture::VideoCapture() | ||
122 | { | ||
123 | setupCamera(QSize(0, 0)); | ||
124 | } | ||
125 | |||
126 | VideoCapture::~VideoCapture() | ||
127 | { | ||
128 | shutdown(); | ||
129 | } | ||
130 | |||
131 | void VideoCapture::setupCamera(QSize size) | ||
132 | { | ||
133 | qWarning(" VideoCapture::setupCamera"); | ||
134 | // Clear important variables. | ||
135 | frames = 0; | ||
136 | currentFrame = 0; | ||
137 | width = 640; | ||
138 | height = 480; | ||
139 | caps.minwidth = width; | ||
140 | caps.minheight = height; | ||
141 | caps.maxwidth = width; | ||
142 | caps.maxheight = height; | ||
143 | |||
144 | // Open the video device. | ||
145 | fd = open(VIDEO_DEVICE, O_RDWR); | ||
146 | if (fd == -1) { | ||
147 | qWarning("%s: %s", VIDEO_DEVICE, strerror(errno)); | ||
148 | return; | ||
149 | } | ||
150 | |||
151 | // Get the device's current capabilities. | ||
152 | memset(&caps, 0, sizeof(caps)); | ||
153 | if (ioctl(fd, VIDIOCGCAP, &caps) < 0) { | ||
154 | qWarning("%s: could not retrieve the video capabilities", VIDEO_DEVICE); | ||
155 | close(fd); | ||
156 | fd = -1; | ||
157 | return; | ||
158 | } | ||
159 | |||
160 | // Change the channel to the first-connected camera, skipping TV inputs. | ||
161 | // If there are multiple cameras, this may need to be modified. | ||
162 | int chan; | ||
163 | struct video_channel chanInfo; | ||
164 | qWarning("available video capture inputs:"); | ||
165 | for (chan = 0; chan < caps.channels; ++chan) { | ||
166 | chanInfo.channel = chan; | ||
167 | if (ioctl(fd, VIDIOCGCHAN, &chanInfo) >= 0) { | ||
168 | if (chanInfo.type == VIDEO_TYPE_CAMERA) | ||
169 | qWarning(" %s (camera)", chanInfo.name); | ||
170 | else if (chanInfo.type == VIDEO_TYPE_TV) | ||
171 | qWarning(" %s (tv)", chanInfo.name); | ||
172 | else | ||
173 | qWarning(" %s (unknown)", chanInfo.name); | ||
174 | } | ||
175 | } | ||
176 | for (chan = 0; chan < caps.channels; ++chan) { | ||
177 | chanInfo.channel = chan; | ||
178 | if (ioctl(fd, VIDIOCGCHAN, &chanInfo) >= 0) { | ||
179 | if (chanInfo.type == VIDEO_TYPE_CAMERA) { | ||
180 | qWarning("selecting camera on input %s", chanInfo.name); | ||
181 | if (ioctl(fd, VIDIOCSCHAN, &chan) < 0) { | ||
182 | qWarning("%s: could not set the channel", VIDEO_DEVICE); | ||
183 | } | ||
184 | break; | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | |||
189 | // Set the desired picture mode to RGB32. | ||
190 | struct video_picture pict; | ||
191 | memset(&pict, 0, sizeof(pict)); | ||
192 | ioctl(fd, VIDIOCGPICT, &pict); | ||
193 | pict.palette = VIDEO_PALETTE_RGB32; | ||
194 | if (ioctl(fd, VIDIOCSPICT, &pict) < 0) { | ||
195 | qWarning("%s: could not set the picture mode", VIDEO_DEVICE); | ||
196 | close(fd); | ||
197 | fd = -1; | ||
198 | return; | ||
199 | } | ||
200 | |||
201 | // Determine the capture size to use. Zero indicates "preview mode". | ||
202 | if (size.width() == 0) { | ||
203 | size = QSize(caps.minwidth, caps.minheight); | ||
204 | } | ||
205 | |||
206 | // Get the current capture window. | ||
207 | struct video_window wind; | ||
208 | memset(&wind, 0, sizeof(wind)); | ||
209 | ioctl(fd, VIDIOCGWIN, &wind); | ||
210 | |||
211 | // Adjust the capture size to match the camera's aspect ratio. | ||
212 | if (caps.maxwidth > 0 && caps.maxheight > 0) { | ||
213 | if (size.width() > size.height()) { | ||
214 | size = QSize(size.height() * caps.maxwidth / caps.maxheight, size.height()); | ||
215 | } | ||
216 | else { | ||
217 | size = QSize(size.width(), size.width() * caps.maxheight / caps.maxwidth); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | // Set the new capture window. | ||
222 | wind.x = 0; | ||
223 | wind.y = 0; | ||
224 | wind.width = size.width(); | ||
225 | wind.height = size.height(); | ||
226 | if (ioctl(fd, VIDIOCSWIN, &wind) < 0) { | ||
227 | qWarning("%s: could not set the capture window", VIDEO_DEVICE); | ||
228 | } | ||
229 | |||
230 | // Re-read the capture window, to see what it was adjusted to. | ||
231 | ioctl(fd, VIDIOCGWIN, &wind); | ||
232 | width = wind.width; | ||
233 | height = wind.height; | ||
234 | |||
235 | // Enable mmap-based access to the camera. | ||
236 | memset(&mbuf, 0, sizeof(mbuf)); | ||
237 | if (ioctl(fd, VIDIOCGMBUF, &mbuf) < 0) { | ||
238 | qWarning("%s: mmap-based camera access is not available", VIDEO_DEVICE); | ||
239 | close(fd); | ||
240 | fd = -1; | ||
241 | return; | ||
242 | } | ||
243 | |||
244 | // Mmap the designated memory region. | ||
245 | frames = (unsigned char *) mmap(0, mbuf.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); | ||
246 | if (!frames || frames == (unsigned char *) (long) (-1)) { | ||
247 | qWarning("%s: could not mmap the device", VIDEO_DEVICE); | ||
248 | close(fd); | ||
249 | fd = -1; | ||
250 | return; | ||
251 | } | ||
252 | |||
253 | // Start capturing of the first frame. | ||
254 | struct video_mmap capture; | ||
255 | currentFrame = 0; | ||
256 | capture.frame = currentFrame; | ||
257 | capture.width = width; | ||
258 | capture.height = height; | ||
259 | capture.format = VIDEO_PALETTE_RGB32; | ||
260 | ioctl(fd, VIDIOCMCAPTURE, &capture); | ||
261 | } | ||
262 | |||
263 | void VideoCapture::shutdown() | ||
264 | { | ||
265 | if (frames != 0) { | ||
266 | munmap(frames, mbuf.size); | ||
267 | frames = 0; | ||
268 | } | ||
269 | if (fd != -1) { | ||
270 | int flag = 0; | ||
271 | ioctl(fd, VIDIOCSYNC, 0); | ||
272 | ioctl(fd, VIDIOCCAPTURE, &flag); | ||
273 | close(fd); | ||
274 | fd = -1; | ||
275 | } | ||
276 | } | ||
277 | |||
278 | void VideoCapture::getCameraImage(QImage & img, bool copy) | ||
279 | { | ||
280 | if (fd == -1) { | ||
281 | if (img.isNull()) { | ||
282 | img.create(width, height, 32); | ||
283 | } | ||
284 | return; | ||
285 | } | ||
286 | |||
287 | // Start capturing the next frame (we alternate between 0 and 1). | ||
288 | int frame = currentFrame; | ||
289 | struct video_mmap capture; | ||
290 | if (mbuf.frames > 1) { | ||
291 | currentFrame = !currentFrame; | ||
292 | capture.frame = currentFrame; | ||
293 | capture.width = width; | ||
294 | capture.height = height; | ||
295 | capture.format = VIDEO_PALETTE_RGB32; | ||
296 | ioctl(fd, VIDIOCMCAPTURE, &capture); | ||
297 | } | ||
298 | |||
299 | // Wait for the current frame to complete. | ||
300 | ioctl(fd, VIDIOCSYNC, &frame); | ||
301 | |||
302 | // Create an image that refers directly to the kernel's | ||
303 | // frame buffer, to avoid having to copy the data. | ||
304 | if (!copy) { | ||
305 | img = QImage(frames + mbuf.offsets[frame], width, height, 32, 0, 0, QImage::IgnoreEndian); | ||
306 | } | ||
307 | else { | ||
308 | img.create(width, height, 32); | ||
309 | memcpy(img.bits(), frames + mbuf.offsets[frame], width * height * 4); | ||
310 | } | ||
311 | |||
312 | // Queue up another frame if the device only supports one at a time. | ||
313 | if (mbuf.frames <= 1) { | ||
314 | capture.frame = currentFrame; | ||
315 | capture.width = width; | ||
316 | capture.height = height; | ||
317 | capture.format = VIDEO_PALETTE_RGB32; | ||
318 | ioctl(fd, VIDIOCMCAPTURE, &capture); | ||
319 | } | ||
320 | } | ||
321 | |||
322 | QValueList < QSize > VideoCapture::photoSizes() const | ||
323 | { | ||
324 | QValueList < QSize > list; | ||
325 | list.append(QSize(caps.maxwidth, caps.maxheight)); | ||
326 | if (caps.maxwidth != caps.minwidth || caps.maxheight != caps.minheight) | ||
327 | list.append(QSize(caps.minwidth, caps.minheight)); | ||
328 | return list; | ||
329 | } | ||
330 | |||
331 | QValueList < QSize > VideoCapture::videoSizes() const | ||
332 | { | ||
333 | // We use the same sizes for both. | ||
334 | return photoSizes(); | ||
335 | } | ||
336 | |||
337 | QSize VideoCapture::recommendedPhotoSize() const | ||
338 | { | ||
339 | return QSize(caps.maxwidth, caps.maxheight); | ||
340 | } | ||
341 | |||
342 | QSize VideoCapture::recommendedVideoSize() const | ||
343 | { | ||
344 | return QSize(caps.minwidth, caps.minheight); | ||
345 | } | ||
346 | |||
347 | QSize VideoCapture::recommendedPreviewSize() const | ||
348 | { | ||
349 | return QSize(caps.minwidth, caps.minheight); | ||
350 | } | ||
351 | |||
352 | void VideoCapture::setCaptureSize(QSize size) | ||
353 | { | ||
354 | if (size.width() != width || size.height() != height) { | ||
355 | shutdown(); | ||
356 | setupCamera(size); | ||
357 | } | ||
358 | } | ||
359 | |||
360 | #else /* !HAVE_VIDEO4LINUX */ | ||
361 | |||
362 | // Dummy implementation for systems without video. | ||
363 | |||
364 | VideoCapture::VideoCapture() | ||
365 | { | ||
366 | } | ||
367 | |||
368 | VideoCapture::~VideoCapture() | ||
369 | { | ||
370 | } | ||
371 | |||
372 | bool VideoCapture::hasCamera() const | ||
373 | { | ||
374 | return TRUE; | ||
375 | } | ||
376 | |||
377 | QSize VideoCapture::captureSize() const | ||
378 | { | ||
379 | return QSize(640, 480); | ||
380 | } | ||
381 | |||
382 | uint VideoCapture::refocusDelay() const | ||
383 | { | ||
384 | return 0; | ||
385 | } | ||
386 | |||
387 | int VideoCapture::minimumFramePeriod() const | ||
388 | { | ||
389 | return 100; | ||
390 | } | ||
391 | |||
392 | static unsigned int nextrand() | ||
393 | { | ||
394 | #define A 16807 | ||
395 | #define M 2147483647 | ||
396 | #define Q 127773 | ||
397 | #define R 2836 | ||
398 | static unsigned int rnd = 1; | ||
399 | unsigned long hi = rnd / Q; | ||
400 | unsigned long lo = rnd % Q; | ||
401 | unsigned long test = A * lo - R * hi; | ||
402 | if (test > 0) | ||
403 | rnd = test; | ||
404 | else | ||
405 | rnd = test + M; | ||
406 | return rnd; | ||
407 | } | ||
408 | |||
409 | void VideoCapture::getCameraImage(QImage & img, bool) | ||
410 | { | ||
411 | // Just generate something dynamic (rectangles) | ||
412 | static QImage cimg; | ||
413 | int x, y, w, h; | ||
414 | if (cimg.isNull()) { | ||
415 | x = y = 0; | ||
416 | w = 640; | ||
417 | h = 480; | ||
418 | cimg.create(w, h, 32); | ||
419 | } | ||
420 | else { | ||
421 | w = nextrand() % (cimg.width() - 10) + 10; | ||
422 | h = nextrand() % (cimg.height() - 10) + 10; | ||
423 | x = nextrand() % (cimg.width() - w); | ||
424 | y = nextrand() % (cimg.height() - h); | ||
425 | } | ||
426 | QRgb c = qRgb(nextrand() % 255, nextrand() % 255, nextrand() % 255); | ||
427 | for (int j = 0; j < h; j++) { | ||
428 | QRgb *l = (QRgb *) cimg.scanLine(y + j) + x; | ||
429 | for (int i = 0; i < w; i++) | ||
430 | l[i] = c; | ||
431 | } | ||
432 | img = cimg; | ||
433 | } | ||
434 | |||
435 | QValueList < QSize > VideoCapture::photoSizes() constconst | ||
436 | { | ||
437 | QValueList < QSize > list; | ||
438 | list.append(QSize(640, 480)); | ||
439 | list.append(QSize(320, 240)); | ||
440 | return list; | ||
441 | } | ||
442 | |||
443 | QValueList < QSize > VideoCapture::videoSizes() constconst | ||
444 | { | ||
445 | QValueList < QSize > list; | ||
446 | list.append(QSize(640, 480)); | ||
447 | list.append(QSize(320, 240)); | ||
448 | return list; | ||
449 | } | ||
450 | |||
451 | QSize VideoCapture::recommendedPhotoSize() const | ||
452 | { | ||
453 | return QSize(640, 480); | ||
454 | } | ||
455 | |||
456 | QSize VideoCapture::recommendedVideoSize() const | ||
457 | { | ||
458 | return QSize(320, 240); | ||
459 | } | ||
460 | |||
461 | QSize VideoCapture::recommendedPreviewSize() const | ||
462 | { | ||
463 | return QSize(320, 240); | ||
464 | } | ||
465 | |||
466 | void VideoCapture::setCaptureSize(QSize size) | ||
467 | { | ||
468 | } | ||
469 | |||
470 | #endif /* !HAVE_VIDEO4LINUX */ | ||
471 | |||
472 | VideoCaptureView::VideoCaptureView(QWidget * parent, const char *name, WFlags fl):QWidget(parent, | ||
473 | name, fl) | ||
474 | { | ||
475 | capture = new VideoCapture(); | ||
476 | QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Expanding); | ||
477 | setSizePolicy(sp); | ||
478 | tid_update = 0; | ||
479 | setLive(); | ||
480 | } | ||
481 | |||
482 | VideoCaptureView::~VideoCaptureView() | ||
483 | { | ||
484 | delete capture; | ||
485 | } | ||
486 | |||
487 | void VideoCaptureView::setLive(int period) | ||
488 | { | ||
489 | if (tid_update) | ||
490 | killTimer(tid_update); | ||
491 | if (period == 0) | ||
492 | tid_update = startTimer(capture->minimumFramePeriod()); | ||
493 | else if (period > 0) | ||
494 | tid_update = startTimer(period); | ||
495 | else | ||
496 | tid_update = 0; | ||
497 | } | ||
498 | |||
499 | void VideoCaptureView::setStill(const QImage & i) | ||
500 | { | ||
501 | setLive(-1); | ||
502 | img = i; | ||
503 | repaint(TRUE); | ||
504 | } | ||
505 | |||
506 | QValueList < QSize > VideoCaptureView::photoSizes() const | ||
507 | { | ||
508 | return capture->photoSizes(); | ||
509 | } | ||
510 | |||
511 | QValueList < QSize > VideoCaptureView::videoSizes() const | ||
512 | { | ||
513 | return capture->videoSizes(); | ||
514 | } | ||
515 | |||
516 | QSize VideoCaptureView::recommendedPhotoSize() const | ||
517 | { | ||
518 | return capture->recommendedPhotoSize(); | ||
519 | } | ||
520 | |||
521 | QSize VideoCaptureView::recommendedVideoSize() const | ||
522 | { | ||
523 | return capture->recommendedVideoSize(); | ||
524 | } | ||
525 | |||
526 | QSize VideoCaptureView::recommendedPreviewSize() const | ||
527 | { | ||
528 | return capture->recommendedPreviewSize(); | ||
529 | } | ||
530 | |||
531 | QSize VideoCaptureView::captureSize() const | ||
532 | { | ||
533 | return capture->captureSize(); | ||
534 | } | ||
535 | |||
536 | void VideoCaptureView::setCaptureSize(QSize size) | ||
537 | { | ||
538 | capture->setCaptureSize(size); | ||
539 | } | ||
540 | |||
541 | uint VideoCaptureView::refocusDelay() const | ||
542 | { | ||
543 | return capture->refocusDelay(); | ||
544 | } | ||
545 | |||
546 | bool VideoCaptureView::available() const | ||
547 | { | ||
548 | return capture->hasCamera(); | ||
549 | } | ||
550 | |||
551 | void VideoCaptureView::paintEvent(QPaintEvent *) | ||
552 | { | ||
553 | if (tid_update && !capture->hasCamera()) { | ||
554 | QPainter p(this); | ||
555 | p.drawText(rect(), AlignCenter, tr("No Camera")); | ||
556 | return; | ||
557 | } | ||
558 | |||
559 | if (tid_update) | ||
560 | capture->getCameraImage(img); | ||
561 | int w = img.width(); | ||
562 | int h = img.height(); | ||
563 | |||
564 | if (!w || !h) | ||
565 | return; | ||
566 | |||
567 | if (width() * w > height() * h) { | ||
568 | w = w * height() / h; | ||
569 | h = height(); | ||
570 | } | ||
571 | else { | ||
572 | h = h * width() / w; | ||
573 | w = width(); | ||
574 | } | ||
575 | |||
576 | if (qt_screen->transformOrientation() == 0) { | ||
577 | // Stretch and draw the image. | ||
578 | QDirectPainter p(this); | ||
579 | QGfx *gfx = p.internalGfx(); | ||
580 | if (gfx) { | ||
581 | gfx->setSource(&img); | ||
582 | gfx->setAlphaType(QGfx::IgnoreAlpha); | ||
583 | gfx->stretchBlt((width() - w) / 2, (height() - h) / 2, w, h, img.width(), img.height()); | ||
584 | } | ||
585 | } | ||
586 | else { | ||
587 | // This code is nowhere near efficient enough (hence the above). | ||
588 | // TODO - handle rotations during direct painting. | ||
589 | QImage scimg = img.smoothScale(w, h); | ||
590 | QPainter p(this); | ||
591 | p.drawImage((width() - w) / 2, (height() - h) / 2, scimg); | ||
592 | } | ||
593 | } | ||
594 | |||
595 | void VideoCaptureView::timerEvent(QTimerEvent *) | ||
596 | { | ||
597 | repaint(FALSE); | ||
598 | } | ||
599 | |||
diff --git a/noncore/multimedia/camera2/videocaptureview.h b/noncore/multimedia/camera2/videocaptureview.h new file mode 100644 index 0000000..68c3b68 --- a/dev/null +++ b/noncore/multimedia/camera2/videocaptureview.h | |||
@@ -0,0 +1,82 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000-2006 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of the Qtopia Environment. | ||
5 | ** | ||
6 | ** This program is free software; you can redistribute it and/or modify it | ||
7 | ** under the terms of the GNU General Public License as published by the | ||
8 | ** Free Software Foundation; either version 2 of the License, or (at your | ||
9 | ** option) any later version. | ||
10 | ** | ||
11 | ** A copy of the GNU GPL license version 2 is included in this package as | ||
12 | ** LICENSE.GPL. | ||
13 | ** | ||
14 | ** This program is distributed in the hope that it will be useful, but | ||
15 | ** WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** See the GNU General Public License for more details. | ||
18 | ** | ||
19 | ** In addition, as a special exception Trolltech gives permission to link | ||
20 | ** the code of this program with Qtopia applications copyrighted, developed | ||
21 | ** and distributed by Trolltech under the terms of the Qtopia Personal Use | ||
22 | ** License Agreement. You must comply with the GNU General Public License | ||
23 | ** in all respects for all of the code used other than the applications | ||
24 | ** licensed under the Qtopia Personal Use License Agreement. If you modify | ||
25 | ** this file, you may extend this exception to your version of the file, | ||
26 | ** but you are not obligated to do so. If you do not wish to do so, delete | ||
27 | ** this exception statement from your version. | ||
28 | ** | ||
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
30 | ** | ||
31 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
32 | ** not clear to you. | ||
33 | ** | ||
34 | **********************************************************************/ | ||
35 | #ifndef VIDEOVIEW_H | ||
36 | #define VIDEOVIEW_H | ||
37 | |||
38 | #include <qwidget.h> | ||
39 | #include <qimage.h> | ||
40 | #include <qvaluelist.h> | ||
41 | |||
42 | class VideoCapture; | ||
43 | |||
44 | |||
45 | class VideoCaptureView : public QWidget | ||
46 | { | ||
47 | Q_OBJECT | ||
48 | |||
49 | public: | ||
50 | VideoCaptureView( QWidget *parent=0, const char *name=0, WFlags fl=0 ); | ||
51 | ~VideoCaptureView(); | ||
52 | |||
53 | bool available() const; | ||
54 | |||
55 | QImage image() const { return img; } | ||
56 | void setLive(int period=0); | ||
57 | void setStill(const QImage&); | ||
58 | |||
59 | QValueList<QSize> photoSizes() const; | ||
60 | QValueList<QSize> videoSizes() const; | ||
61 | |||
62 | QSize recommendedPhotoSize() const; | ||
63 | QSize recommendedVideoSize() const; | ||
64 | QSize recommendedPreviewSize() const; | ||
65 | |||
66 | QSize captureSize() const; | ||
67 | void setCaptureSize( QSize size ); | ||
68 | |||
69 | uint refocusDelay() const; | ||
70 | |||
71 | protected: | ||
72 | void paintEvent(QPaintEvent*); | ||
73 | void timerEvent(QTimerEvent*); | ||
74 | |||
75 | private: | ||
76 | QImage img; | ||
77 | int tid_update; | ||
78 | VideoCapture *capture; | ||
79 | }; | ||
80 | |||
81 | #endif | ||
82 | |||
@@ -1,150 +1,151 @@ | |||
1 | CONFIG_ABOUTAPPLET core/applets/aboutappletaboutapplet.pro | 1 | CONFIG_ABOUTAPPLET core/applets/aboutappletaboutapplet.pro |
2 | CONFIG_ADDRESSBOOK core/pim/addressbookaddressbook.pro | 2 | CONFIG_ADDRESSBOOK core/pim/addressbookaddressbook.pro |
3 | CONFIG_ADVANCEDFM noncore/apps/advancedfmadvancedfm.pro | 3 | CONFIG_ADVANCEDFM noncore/apps/advancedfmadvancedfm.pro |
4 | CONFIG_APPEARANCE2 noncore/settings/appearance2appearance2.pro | 4 | CONFIG_APPEARANCE2 noncore/settings/appearance2appearance2.pro |
5 | CONFIG_APPSKEY noncore/settings/appskeyappskey.pro | 5 | CONFIG_APPSKEY noncore/settings/appskeyappskey.pro |
6 | CONFIG_AQPKG noncore/settings/aqpkgaqpkg.pro | 6 | CONFIG_AQPKG noncore/settings/aqpkgaqpkg.pro |
7 | CONFIG_AUTOROTATEAPPLET noncore/applets/autorotateappletautorotateapplet.pro | 7 | CONFIG_AUTOROTATEAPPLET noncore/applets/autorotateappletautorotateapplet.pro |
8 | CONFIG_BACKGAMMONnoncore/games/backgammon backgammon.pro | 8 | CONFIG_BACKGAMMONnoncore/games/backgammon backgammon.pro |
9 | CONFIG_BACKUP noncore/settings/backupbackup.pro | 9 | CONFIG_BACKUP noncore/settings/backupbackup.pro |
10 | CONFIG_BARTENDER noncore/apps/opie-bartenderbartender.pro | 10 | CONFIG_BARTENDER noncore/apps/opie-bartenderbartender.pro |
11 | CONFIG_BATTERYAPPLET core/applets/batteryappletbatteryapplet.pro | 11 | CONFIG_BATTERYAPPLET core/applets/batteryappletbatteryapplet.pro |
12 | CONFIG_BEND noncore/unsupported/mail2/bendbend.pro | 12 | CONFIG_BEND noncore/unsupported/mail2/bendbend.pro |
13 | CONFIG_BIGSCREEN_EXAMPLE unsupported/libopie/big-screen/example osplitter_mail.pro | 13 | CONFIG_BIGSCREEN_EXAMPLE unsupported/libopie/big-screen/example osplitter_mail.pro |
14 | CONFIG_BLUE-PIN noncore/net/opietooth/blue-pinblue-pin.pro | 14 | CONFIG_BLUE-PIN noncore/net/opietooth/blue-pinblue-pin.pro |
15 | CONFIG_BOUNCE noncore/games/bouncebounce.pro | 15 | CONFIG_BOUNCE noncore/games/bouncebounce.pro |
16 | CONFIG_BRIGHTNESSAPPLET noncore/applets/brightnessappletbrightnessapplet.pro | 16 | CONFIG_BRIGHTNESSAPPLET noncore/applets/brightnessappletbrightnessapplet.pro |
17 | CONFIG_BUTTON-SETTINGS core/settings/buttonbutton.pro | 17 | CONFIG_BUTTON-SETTINGS core/settings/buttonbutton.pro |
18 | CONFIG_BUZZWORD noncore/games/buzzwordbuzzword.pro | 18 | CONFIG_BUZZWORD noncore/games/buzzwordbuzzword.pro |
19 | CONFIG_CALC2 noncore/tools/calc2calc2.pro | 19 | CONFIG_CALC2 noncore/tools/calc2calc2.pro |
20 | CONFIG_CALCULATOR noncore/tools/calculatorcalculator.pro | 20 | CONFIG_CALCULATOR noncore/tools/calculatorcalculator.pro |
21 | CONFIG_CALIBRATE core/apps/calibratecalibrate.pro | 21 | CONFIG_CALIBRATE core/apps/calibratecalibrate.pro |
22 | CONFIG_CAMERA noncore/multimedia/cameracamera.pro | 22 | CONFIG_CAMERA noncore/multimedia/cameracamera.pro |
23 | CONFIG_CAMERA2 noncore/multimedia/camera2camera2.pro | ||
23 | CONFIG_CARDMON core/applets/cardmoncardmon.pro | 24 | CONFIG_CARDMON core/applets/cardmoncardmon.pro |
24 | CONFIG_CHECKBOOK noncore/apps/checkbookcheckbook.pro | 25 | CONFIG_CHECKBOOK noncore/apps/checkbookcheckbook.pro |
25 | CONFIG_CITYTIME core/settings/citytimecitytime.pro | 26 | CONFIG_CITYTIME core/settings/citytimecitytime.pro |
26 | CONFIG_CLIPBOARDAPPLET core/applets/clipboardappletclipboardapplet.pro | 27 | CONFIG_CLIPBOARDAPPLET core/applets/clipboardappletclipboardapplet.pro |
27 | CONFIG_CLOCKAPPLET core/applets/clockappletclockapplet.pro | 28 | CONFIG_CLOCKAPPLET core/applets/clockappletclockapplet.pro |
28 | CONFIG_CLOCK noncore/tools/clockclock.pro | 29 | CONFIG_CLOCK noncore/tools/clockclock.pro |
29 | CONFIG_CONFEDIT noncore/apps/confeditconfedit.pro | 30 | CONFIG_CONFEDIT noncore/apps/confeditconfedit.pro |
30 | CONFIG_DAGGER noncore/apps/dagger dagger.pro | 31 | CONFIG_DAGGER noncore/apps/dagger dagger.pro |
31 | CONFIG_DASHER inputmethods/dasherdasher.pro | 32 | CONFIG_DASHER inputmethods/dasherdasher.pro |
32 | CONFIG_DATEBOOK2 core/pim/datebook2datebook2.pro | 33 | CONFIG_DATEBOOK2 core/pim/datebook2datebook2.pro |
33 | CONFIG_DATEBOOK core/pim/datebookdatebook.pro | 34 | CONFIG_DATEBOOK core/pim/datebookdatebook.pro |
34 | CONFIG_DATEBOOK_BIRTHDAYS_HOLIDAY core/pim/datebook/holiday/birthday birthdays.pro | 35 | CONFIG_DATEBOOK_BIRTHDAYS_HOLIDAY core/pim/datebook/holiday/birthday birthdays.pro |
35 | CONFIG_DATEBOOK_CHRISTIAN_HOLIDAY core/pim/datebook/holiday/christian christian-holidays.pro | 36 | CONFIG_DATEBOOK_CHRISTIAN_HOLIDAY core/pim/datebook/holiday/christian christian-holidays.pro |
36 | CONFIG_DATEBOOK_NATIONAL_HOLIDAY core/pim/datebook/holiday/national national-holidays.pro | 37 | CONFIG_DATEBOOK_NATIONAL_HOLIDAY core/pim/datebook/holiday/national national-holidays.pro |
37 | CONFIG_DECO_FLAT noncore/decorations/flatflat.pro | 38 | CONFIG_DECO_FLAT noncore/decorations/flatflat.pro |
38 | CONFIG_DECO_LIQUID noncore/decorations/liquidliquid.pro | 39 | CONFIG_DECO_LIQUID noncore/decorations/liquidliquid.pro |
39 | CONFIG_DECO_POLISHED noncore/decorations/polishedpolished.pro | 40 | CONFIG_DECO_POLISHED noncore/decorations/polishedpolished.pro |
40 | CONFIG_DICTIONARY noncore/apps/dictionarydictionary.pro | 41 | CONFIG_DICTIONARY noncore/apps/dictionarydictionary.pro |
41 | CONFIG_DOCTAB noncore/settings/doctab doctab.pro | 42 | CONFIG_DOCTAB noncore/settings/doctab doctab.pro |
42 | CONFIG_DRAWPAD noncore/graphics/drawpaddrawpad.pro | 43 | CONFIG_DRAWPAD noncore/graphics/drawpaddrawpad.pro |
43 | CONFIG_DVORAK inputmethods/dvorakdvorak.pro | 44 | CONFIG_DVORAK inputmethods/dvorakdvorak.pro |
44 | CONFIG_EMBEDDEDKONSOLE core/apps/embeddedkonsoleembeddedkonsole.pro | 45 | CONFIG_EMBEDDEDKONSOLE core/apps/embeddedkonsoleembeddedkonsole.pro |
45 | CONFIG_EUROCONV noncore/tools/euroconv/ euroconv.pro | 46 | CONFIG_EUROCONV noncore/tools/euroconv/ euroconv.pro |
46 | CONFIG_EXAMPLE_APPLET examples/appletapplet.pro | 47 | CONFIG_EXAMPLE_APPLET examples/appletapplet.pro |
47 | CONFIG_EXAMPLE_BOARD examples/inputmethod inputmethod.pro | 48 | CONFIG_EXAMPLE_BOARD examples/inputmethod inputmethod.pro |
48 | CONFIG_EXAMPLE_LIBOPIE2BLUEZ examples/opiebluezopiebluez.pro | 49 | CONFIG_EXAMPLE_LIBOPIE2BLUEZ examples/opiebluezopiebluez.pro |
49 | CONFIG_EXAMPLE_LIBOPIE2COREexamples/opiecore opiecore.pro | 50 | CONFIG_EXAMPLE_LIBOPIE2COREexamples/opiecore opiecore.pro |
50 | CONFIG_EXAMPLE_LIBOPIE2DBexamples/opiedb opiedb.pro | 51 | CONFIG_EXAMPLE_LIBOPIE2DBexamples/opiedb opiedb.pro |
51 | CONFIG_EXAMPLE_LIBOPIE2MMexamples/opiemm opiemm.pro | 52 | CONFIG_EXAMPLE_LIBOPIE2MMexamples/opiemm opiemm.pro |
52 | CONFIG_EXAMPLE_LIBOPIE2NETexamples/opienet opienet.pro | 53 | CONFIG_EXAMPLE_LIBOPIE2NETexamples/opienet opienet.pro |
53 | CONFIG_EXAMPLE_LIBOPIE2PIMexamples/opiepim opiepim.pro | 54 | CONFIG_EXAMPLE_LIBOPIE2PIMexamples/opiepim opiepim.pro |
54 | CONFIG_EXAMPLE_LIBOPIE2SECURITYexamples/opiesecurity opiesecurity.pro | 55 | CONFIG_EXAMPLE_LIBOPIE2SECURITYexamples/opiesecurity opiesecurity.pro |
55 | CONFIG_EXAMPLE_LIBOPIE2UI examples/opieuiopieui.pro | 56 | CONFIG_EXAMPLE_LIBOPIE2UI examples/opieuiopieui.pro |
56 | CONFIG_EXAMPLE_MENU examples/menuapplet menuapplet.pro | 57 | CONFIG_EXAMPLE_MENU examples/menuapplet menuapplet.pro |
57 | CONFIG_EXAMPLE_VPN examples/networksettings networksettings.pro | 58 | CONFIG_EXAMPLE_VPN examples/networksettings networksettings.pro |
58 | CONFIG_FIFTEEN noncore/games/fifteenfifteen.pro | 59 | CONFIG_FIFTEEN noncore/games/fifteenfifteen.pro |
59 | CONFIG_FILEBROWSER noncore/unsupported/filebrowserfilebrowser.pro | 60 | CONFIG_FILEBROWSER noncore/unsupported/filebrowserfilebrowser.pro |
60 | CONFIG_FLAT noncore/styles/flatflat.pro | 61 | CONFIG_FLAT noncore/styles/flatflat.pro |
61 | CONFIG_FORMATTER noncore/tools/formatterformatter.pro | 62 | CONFIG_FORMATTER noncore/tools/formatterformatter.pro |
62 | CONFIG_FREETYPE freetypefreetype.pro | 63 | CONFIG_FREETYPE freetypefreetype.pro |
63 | CONFIG_FRESH noncore/styles/freshfresh.pro | 64 | CONFIG_FRESH noncore/styles/freshfresh.pro |
64 | CONFIG_FTPLIB noncore/net/ftplibftplib.pro | 65 | CONFIG_FTPLIB noncore/net/ftplibftplib.pro |
65 | CONFIG_GO noncore/games/gogo.pro | 66 | CONFIG_GO noncore/games/gogo.pro |
66 | CONFIG_GSMTOOL noncore/unsupported/gsmtoolgsmtool.pro | 67 | CONFIG_GSMTOOL noncore/unsupported/gsmtoolgsmtool.pro |
67 | CONFIG_GUTENBROWSER noncore/apps/opie-gutenbrowseropie-gutenbrowser.pro | 68 | CONFIG_GUTENBROWSER noncore/apps/opie-gutenbrowseropie-gutenbrowser.pro |
68 | CONFIG_HANDWRITING inputmethods/handwritinghandwriting.pro | 69 | CONFIG_HANDWRITING inputmethods/handwritinghandwriting.pro |
69 | CONFIG_HELPBROWSER core/apps/helpbrowserhelpbrowser.pro | 70 | CONFIG_HELPBROWSER core/apps/helpbrowserhelpbrowser.pro |
70 | CONFIG_HOMEAPPLET core/applets/homeapplethomeapplet.pro | 71 | CONFIG_HOMEAPPLET core/applets/homeapplethomeapplet.pro |
71 | CONFIG_HOTPLUG_QCOP core/tools/hotplug-qcophotplug-qcop.pro | 72 | CONFIG_HOTPLUG_QCOP core/tools/hotplug-qcophotplug-qcop.pro |
72 | CONFIG_INTERFACES noncore/settings/networksettings/interfacesinterfaces.pro | 73 | CONFIG_INTERFACES noncore/settings/networksettings/interfacesinterfaces.pro |
73 | CONFIG_IRDAAPPLET core/applets/irdaappletirdaapplet.pro | 74 | CONFIG_IRDAAPPLET core/applets/irdaappletirdaapplet.pro |
74 | CONFIG_JUMPX inputmethods/jumpxjumpx.pro | 75 | CONFIG_JUMPX inputmethods/jumpxjumpx.pro |
75 | CONFIG_KBILL noncore/games/kbillkbill.pro | 76 | CONFIG_KBILL noncore/games/kbillkbill.pro |
76 | CONFIG_KCHECKERS noncore/games/kcheckerskcheckers.pro | 77 | CONFIG_KCHECKERS noncore/games/kcheckerskcheckers.pro |
77 | CONFIG_KEYBOARD inputmethods/keyboardkeyboard.pro | 78 | CONFIG_KEYBOARD inputmethods/keyboardkeyboard.pro |
78 | CONFIG_KEYHELPER noncore/applets/keyhelper keyhelper.pro | 79 | CONFIG_KEYHELPER noncore/applets/keyhelper keyhelper.pro |
79 | CONFIG_KEYPEBBLE noncore/comm/keypebblekeypebble.pro | 80 | CONFIG_KEYPEBBLE noncore/comm/keypebblekeypebble.pro |
80 | CONFIG_KEYVIEW development/keyviewkeyview.pro | 81 | CONFIG_KEYVIEW development/keyviewkeyview.pro |
81 | CONFIG_KJUMPX inputmethods/kjumpxkjumpx.pro | 82 | CONFIG_KJUMPX inputmethods/kjumpxkjumpx.pro |
82 | CONFIG_KPACMAN noncore/games/kpacmankpacman.pro | 83 | CONFIG_KPACMAN noncore/games/kpacmankpacman.pro |
83 | CONFIG_LANGUAGE noncore/settings/languagelanguage.pro | 84 | CONFIG_LANGUAGE noncore/settings/languagelanguage.pro |
84 | CONFIG_LAUNCHER core/launcherserver.pro | 85 | CONFIG_LAUNCHER core/launcherserver.pro |
85 | CONFIG_LAUNCHER-SETTINGS core/settings/launcherlauncher.pro | 86 | CONFIG_LAUNCHER-SETTINGS core/settings/launcherlauncher.pro |
86 | CONFIG_LIBFFMPEG core/multimedia/opieplayer/libffmpeglibffmpeg.pro | 87 | CONFIG_LIBFFMPEG core/multimedia/opieplayer/libffmpeglibffmpeg.pro |
87 | CONFIG_LIBFLASH core/multimedia/opieplayer/libflashlibflash.pro | 88 | CONFIG_LIBFLASH core/multimedia/opieplayer/libflashlibflash.pro |
88 | CONFIG_LIBMAD core/multimedia/opieplayer/libmadlibmad.pro | 89 | CONFIG_LIBMAD core/multimedia/opieplayer/libmadlibmad.pro |
89 | CONFIG_LIBMAIL noncore/unsupported/mail2/libmaillibmail.pro | 90 | CONFIG_LIBMAIL noncore/unsupported/mail2/libmaillibmail.pro |
90 | CONFIG_LIBMAILWRAPPER noncore/net/mail/libmailwrapper libmailwrapper.pro | 91 | CONFIG_LIBMAILWRAPPER noncore/net/mail/libmailwrapper libmailwrapper.pro |
91 | CONFIG_LIBMPEG3 core/multimedia/opieplayer/libmpeg3libmpeg3.pro | 92 | CONFIG_LIBMPEG3 core/multimedia/opieplayer/libmpeg3libmpeg3.pro |
92 | CONFIG_LIBOPIE2BLUEZ libopie2/opiebluezopiebluez.pro | 93 | CONFIG_LIBOPIE2BLUEZ libopie2/opiebluezopiebluez.pro |
93 | CONFIG_LIBOPIE2CORE libopie2/opiecoreopiecore.pro | 94 | CONFIG_LIBOPIE2CORE libopie2/opiecoreopiecore.pro |
94 | CONFIG_LIBOPIE2DB libopie2/opiedbopiedb.pro | 95 | CONFIG_LIBOPIE2DB libopie2/opiedbopiedb.pro |
95 | CONFIG_LIBOPIE2EXAMPLES libopie2/examplesexamples.pro | 96 | CONFIG_LIBOPIE2EXAMPLES libopie2/examplesexamples.pro |
96 | CONFIG_LIBOPIE2MM libopie2/opiemmopiemm.pro | 97 | CONFIG_LIBOPIE2MM libopie2/opiemmopiemm.pro |
97 | CONFIG_LIBOPIE2NET libopie2/opienetopienet.pro | 98 | CONFIG_LIBOPIE2NET libopie2/opienetopienet.pro |
98 | CONFIG_LIBOPIE2PIM libopie2/opiepimopiepim.pro | 99 | CONFIG_LIBOPIE2PIM libopie2/opiepimopiepim.pro |
99 | CONFIG_LIBOPIE2SECURITYlibopie2/opiesecurity opiesecurity.pro | 100 | CONFIG_LIBOPIE2SECURITYlibopie2/opiesecurity opiesecurity.pro |
100 | CONFIG_LIBOPIE2UI libopie2/opieuiopieui.pro | 101 | CONFIG_LIBOPIE2UI libopie2/opieuiopieui.pro |
101 | CONFIG_LIBOPIETOOTH noncore/net/opietooth/liblib.pro | 102 | CONFIG_LIBOPIETOOTH noncore/net/opietooth/liblib.pro |
102 | CONFIG_LIBOPIEnoncore/unsupported/libopie libopie.pro | 103 | CONFIG_LIBOPIEnoncore/unsupported/libopie libopie.pro |
103 | CONFIG_LIBQPE librarylibrary.pro | 104 | CONFIG_LIBQPE librarylibrary.pro |
104 | CONFIG_LIBQPE-X11 x11/libqpe-x11libqpe-x11.pro | 105 | CONFIG_LIBQPE-X11 x11/libqpe-x11libqpe-x11.pro |
105 | CONFIG_LIBQRSYNC rsync rsync.pro | 106 | CONFIG_LIBQRSYNC rsync rsync.pro |
106 | CONFIG_LIBQTAUX libqtauxlibqtaux.pro | 107 | CONFIG_LIBQTAUX libqtauxlibqtaux.pro |
107 | CONFIG_LIBSQL libsqllibsql.pro | 108 | CONFIG_LIBSQL libsqllibsql.pro |
108 | CONFIG_LIBTREMOR core/multimedia/opieplayer/vorbis/tremor tremor.pro | 109 | CONFIG_LIBTREMOR core/multimedia/opieplayer/vorbis/tremor tremor.pro |
109 | CONFIG_LIBTREMORPLUGIN core/multimedia/opieplayer/vorbis libtremor.pro | 110 | CONFIG_LIBTREMORPLUGIN core/multimedia/opieplayer/vorbis libtremor.pro |
110 | CONFIG_LIGHT-AND-POWER core/settings/light-and-powerlight-and-power.pro | 111 | CONFIG_LIGHT-AND-POWER core/settings/light-and-powerlight-and-power.pro |
111 | CONFIG_LIQUID noncore/styles/liquidliquid.pro | 112 | CONFIG_LIQUID noncore/styles/liquidliquid.pro |
112 | CONFIG_LOCKAPPLET core/applets/lockappletlockapplet.pro | 113 | CONFIG_LOCKAPPLET core/applets/lockappletlockapplet.pro |
113 | CONFIG_LOGOUTAPPLET core/applets/logoutappletlogoutapplet.pro | 114 | CONFIG_LOGOUTAPPLET core/applets/logoutappletlogoutapplet.pro |
114 | CONFIG_MAIL3 noncore/net/mail mail.pro | 115 | CONFIG_MAIL3 noncore/net/mail mail.pro |
115 | CONFIG_MAILAPPLET noncore/net/mail/taskbarapplet taskbarapplet.pro | 116 | CONFIG_MAILAPPLET noncore/net/mail/taskbarapplet taskbarapplet.pro |
116 | CONFIG_MAILIT noncore/unsupported/mailit mailit.pro | 117 | CONFIG_MAILIT noncore/unsupported/mailit mailit.pro |
117 | CONFIG_MAIN_TAB_EXAMPLE examples/main-tab main-tab.pro | 118 | CONFIG_MAIN_TAB_EXAMPLE examples/main-tab main-tab.pro |
118 | CONFIG_MEDIUMMOUNT noncore/settings/mediummountmediummount.pro | 119 | CONFIG_MEDIUMMOUNT noncore/settings/mediummountmediummount.pro |
119 | CONFIG_MEMORYAPPLET noncore/applets/memoryappletmemoryapplet.pro | 120 | CONFIG_MEMORYAPPLET noncore/applets/memoryappletmemoryapplet.pro |
120 | CONFIG_METAL noncore/styles/metalmetal.pro | 121 | CONFIG_METAL noncore/styles/metalmetal.pro |
121 | CONFIG_MINDBREAKER noncore/games/mindbreakermindbreaker.pro | 122 | CONFIG_MINDBREAKER noncore/games/mindbreakermindbreaker.pro |
122 | CONFIG_MINESWEEP noncore/games/minesweepminesweep.pro | 123 | CONFIG_MINESWEEP noncore/games/minesweepminesweep.pro |
123 | CONFIG_MOBILEMSG noncore/unsupported/mobilemsgmobilemsg.pro | 124 | CONFIG_MOBILEMSG noncore/unsupported/mobilemsgmobilemsg.pro |
124 | CONFIG_MODPLUG core/multimedia/opieplayer/modplugmodplug.pro | 125 | CONFIG_MODPLUG core/multimedia/opieplayer/modplugmodplug.pro |
125 | CONFIG_MULTIAUTH_BLUEPING noncore/securityplugins/blueping bluepingplugin.pro | 126 | CONFIG_MULTIAUTH_BLUEPING noncore/securityplugins/blueping bluepingplugin.pro |
126 | CONFIG_MULTIAUTH_DUMMY noncore/securityplugins/dummy dummyplugin.pro | 127 | CONFIG_MULTIAUTH_DUMMY noncore/securityplugins/dummy dummyplugin.pro |
127 | CONFIG_MULTIAUTH_NOTICE noncore/securityplugins/notice noticeplugin.pro | 128 | CONFIG_MULTIAUTH_NOTICE noncore/securityplugins/notice noticeplugin.pro |
128 | CONFIG_MULTIAUTH_PIN noncore/securityplugins/pin pinplugin.pro | 129 | CONFIG_MULTIAUTH_PIN noncore/securityplugins/pin pinplugin.pro |
129 | CONFIG_MULTIKEYAPPLET core/applets/multikeyappletmultikeyapplet.pro | 130 | CONFIG_MULTIKEYAPPLET core/applets/multikeyappletmultikeyapplet.pro |
130 | CONFIG_MULTIKEY inputmethods/multikeymultikey.pro | 131 | CONFIG_MULTIKEY inputmethods/multikeymultikey.pro |
131 | CONFIG_NETSYSTEMTIME noncore/settings/netsystemtimenetsystemtime.pro | 132 | CONFIG_NETSYSTEMTIME noncore/settings/netsystemtimenetsystemtime.pro |
132 | CONFIG_NETWORKAPPLET noncore/applets/networkappletnetworkapplet.pro | 133 | CONFIG_NETWORKAPPLET noncore/applets/networkappletnetworkapplet.pro |
133 | CONFIG_NETWORKSETUP noncore/settings/networksettingsnetworksettings.pro | 134 | CONFIG_NETWORKSETUP noncore/settings/networksettingsnetworksettings.pro |
134 | CONFIG_NOTES core/pim/notesopie-notes.pro | 135 | CONFIG_NOTES core/pim/notesopie-notes.pro |
135 | CONFIG_NOTESAPPLET noncore/applets/notesappletnotesapplet.pro | 136 | CONFIG_NOTESAPPLET noncore/applets/notesappletnotesapplet.pro |
136 | CONFIG_NS2BT noncore/settings/networksettings2/bluetoothbluetooth.pro | 137 | CONFIG_NS2BT noncore/settings/networksettings2/bluetoothbluetooth.pro |
137 | CONFIG_NS2GPRS noncore/settings/networksettings2/gprsGPRS.pro | 138 | CONFIG_NS2GPRS noncore/settings/networksettings2/gprsGPRS.pro |
138 | CONFIG_NS2CABLE noncore/settings/networksettings2/cablecable.pro | 139 | CONFIG_NS2CABLE noncore/settings/networksettings2/cablecable.pro |
139 | CONFIG_NS2CORE noncore/settings/networksettings2/networksettings2networksettings2.pro | 140 | CONFIG_NS2CORE noncore/settings/networksettings2/networksettings2networksettings2.pro |
140 | CONFIG_NS2OPIETOOTH noncore/settings/networksettings2/opietooth2opietooth2.pro | 141 | CONFIG_NS2OPIETOOTH noncore/settings/networksettings2/opietooth2opietooth2.pro |
141 | CONFIG_NS2OPIETOOTHAPPLET noncore/settings/networksettings2/opietooth2_appletopietooth2_applet.pro | 142 | CONFIG_NS2OPIETOOTHAPPLET noncore/settings/networksettings2/opietooth2_appletopietooth2_applet.pro |
142 | CONFIG_NS2IRDA noncore/settings/networksettings2/irdairda.pro | 143 | CONFIG_NS2IRDA noncore/settings/networksettings2/irdairda.pro |
143 | CONFIG_NS2LANCARD noncore/settings/networksettings2/lancardlancard.pro | 144 | CONFIG_NS2LANCARD noncore/settings/networksettings2/lancardlancard.pro |
144 | CONFIG_NS2MODEM noncore/settings/networksettings2/modemmodem.pro | 145 | CONFIG_NS2MODEM noncore/settings/networksettings2/modemmodem.pro |
145 | CONFIG_NS2NETWORK noncore/settings/networksettings2/networknetwork.pro | 146 | CONFIG_NS2NETWORK noncore/settings/networksettings2/networknetwork.pro |
146 | CONFIG_NS2 noncore/settings/networksettings2networksettings.pro | 147 | CONFIG_NS2 noncore/settings/networksettings2networksettings.pro |
147 | CONFIG_NS2PPP noncore/settings/networksettings2/pppppp.pro | 148 | CONFIG_NS2PPP noncore/settings/networksettings2/pppppp.pro |
148 | CONFIG_NS2PROFILE noncore/settings/networksettings2/profileprofile.pro | 149 | CONFIG_NS2PROFILE noncore/settings/networksettings2/profileprofile.pro |
149 | CONFIG_NS2USB noncore/settings/networksettings2/usbusb.pro | 150 | CONFIG_NS2USB noncore/settings/networksettings2/usbusb.pro |
150 | CONFIG_NS2VPN noncore/settings/networksettings2/vpnvpn.pro | 151 | CONFIG_NS2VPN noncore/settings/networksettings2/vpnvpn.pro |
diff --git a/pics/camera2/Camera.png b/pics/camera2/Camera.png new file mode 100644 index 0000000..e619c11 --- a/dev/null +++ b/pics/camera2/Camera.png | |||
Binary files differ | |||
diff --git a/pics/camera2/Camera_48.png b/pics/camera2/Camera_48.png new file mode 100644 index 0000000..00b8585 --- a/dev/null +++ b/pics/camera2/Camera_48.png | |||
Binary files differ | |||
diff --git a/pics/camera2/Camera_48_anim.mng b/pics/camera2/Camera_48_anim.mng new file mode 100644 index 0000000..6b19394 --- a/dev/null +++ b/pics/camera2/Camera_48_anim.mng | |||
Binary files differ | |||
diff --git a/pics/camera2/settings.png b/pics/camera2/settings.png new file mode 100644 index 0000000..05bfdf7 --- a/dev/null +++ b/pics/camera2/settings.png | |||
Binary files differ | |||