-rw-r--r-- | core/launcher/launcher.h | 177 |
1 files changed, 81 insertions, 96 deletions
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 0616734..2917027 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h | |||
@@ -2,5 +2,6 @@ | |||
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 | ** 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 |
6 | ** 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 |
@@ -20,107 +21,105 @@ | |||
20 | #define LAUNCHER_H | 21 | #define LAUNCHER_H |
21 | 22 | ||
22 | #include <qpe/config.h> | 23 | #include <qtopia/config.h> |
23 | #include <qpe/applnk.h> | 24 | #include <qtopia/storage.h> |
24 | 25 | #include <qtopia/applnk.h> | |
25 | #include <opie/ofileselector.h> | ||
26 | |||
27 | #include <qmainwindow.h> | 26 | #include <qmainwindow.h> |
28 | #include <qtabbar.h> | ||
29 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qprogressbar.h> | ||
30 | #include <qvbox.h> | 29 | #include <qvbox.h> |
31 | #include <qlist.h> | 30 | #include <qlist.h> |
32 | #include <qpe/palmtopuidgen.h> | 31 | #include <qdict.h> |
33 | #include "launcherview.h" | 32 | #include "launcherview.h" |
33 | #include "launchertab.h" | ||
34 | #include "serverinterface.h" | ||
34 | 35 | ||
35 | class AppLnk; | ||
36 | class AppLnkSet; | ||
37 | class DocLnkSet; | ||
38 | class QWidgetStack; | 36 | class QWidgetStack; |
39 | class StorageInfo; | 37 | class TaskBar; |
40 | class SyncDialog; | 38 | class Launcher; |
41 | 39 | ||
42 | 40 | class LauncherTabWidget : public QVBox { | |
43 | class DocumentTab : public OFileSelector | 41 | // can't use a QTabWidget, since it won't let us set the frame style. |
44 | { | 42 | Q_OBJECT |
45 | Q_OBJECT | ||
46 | public: | 43 | public: |
47 | DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName);//, 4,0, "/",""); | 44 | LauncherTabWidget( Launcher* parent ); |
48 | ~DocumentTab(); | ||
49 | private: | ||
50 | 45 | ||
51 | }; | 46 | void updateDocs(AppLnkSet* docFolder); |
47 | void setBusy(bool on); | ||
48 | LauncherView *currentView(void); | ||
52 | 49 | ||
53 | class CategoryTabBar : public QTabBar | 50 | LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); |
54 | { | 51 | void deleteView( const QString& ); |
55 | Q_OBJECT | 52 | void setTabViewAppearance( LauncherView *v, Config &cfg ); |
56 | public: | 53 | void setTabAppearance( LauncherTab *, Config &cfg ); |
57 | CategoryTabBar( QWidget *parent=0, const char *name=0 ); | ||
58 | ~CategoryTabBar(); | ||
59 | 54 | ||
60 | signals: | 55 | LauncherView *view( const QString & ); |
56 | LauncherView *docView(); | ||
61 | 57 | ||
62 | protected slots: | 58 | void createDocLoadingWidget(); |
63 | virtual void layoutTabs(); | 59 | void setLoadingWidgetEnabled( bool v ); |
60 | void setLoadingProgress( int percent ); | ||
64 | 61 | ||
65 | protected: | 62 | LauncherTabBar* categoryBar; |
66 | void paint ( QPainter *p, QTab *t, bool f ) const; | 63 | |
67 | void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const; | 64 | void setBusyIndicatorType( const QString& type ); |
68 | |||
69 | }; | ||
70 | 65 | ||
71 | class CategoryTabWidget : public QVBox { | ||
72 | // can't use a QTabWidget, since it won't let us set the frame style. | ||
73 | Q_OBJECT | ||
74 | public: | ||
75 | CategoryTabWidget( QWidget* parent ); | ||
76 | void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder, | ||
77 | const QList<FileSystem> &); | ||
78 | // void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs); | ||
79 | void updateLink(const QString& linkfile); | ||
80 | void setBusy(bool on); | ||
81 | QString getAllDocLinkInfo() const; | ||
82 | LauncherView *view( const QString &id ); | ||
83 | void setBusyIndicatorType ( const QString &type ); | ||
84 | DocumentTab *fileSel; | ||
85 | signals: | 66 | signals: |
86 | void selected(const QString&); | 67 | void selected(const QString&); |
87 | void clicked(const AppLnk*); | 68 | void clicked(const AppLnk*); |
88 | void rightPressed(AppLnk*); | 69 | void rightPressed(AppLnk*); |
89 | void ofileSel(const DocLnk &); | 70 | |
90 | public slots: | ||
91 | void nextTab(); | ||
92 | void prevTab(); | ||
93 | void showTab(const QString&); | ||
94 | void clickie(const DocLnk&); | ||
95 | void clickie(const QString &); | ||
96 | protected slots: | 71 | protected slots: |
72 | void raiseTabWidget(); | ||
97 | void tabProperties(); | 73 | void tabProperties(); |
74 | void initLayout(); | ||
75 | |||
76 | private slots: | ||
77 | void launcherMessage( const QCString &, const QByteArray &); | ||
78 | void appMessage( const QCString &, const QByteArray &); | ||
79 | void setProgressStyle(); | ||
98 | 80 | ||
99 | protected: | 81 | protected: |
100 | void setTabAppearance( const QString &id, Config &cfg ); | ||
101 | void paletteChange( const QPalette &p ); | 82 | void paletteChange( const QPalette &p ); |
83 | void styleChange( QStyle & ); | ||
102 | 84 | ||
103 | private: | 85 | private: |
104 | CategoryTabBar* categoryBar; | 86 | Launcher *launcher; |
105 | QWidgetStack* stack; | 87 | LauncherView *docview; |
106 | LauncherView* docview; | 88 | |
107 | QStringList ids; | 89 | QWidgetStack *stack; |
108 | int tabs; | 90 | LauncherView *docLoadingWidget; |
109 | LauncherView* newView( const QString&, const QPixmap& pm, const QString& label ); | 91 | QProgressBar *docLoadingWidgetProgress; |
110 | void addItem( const QString& ); | 92 | bool docLoadingWidgetEnabled; |
111 | }; | 93 | }; |
112 | 94 | ||
113 | class Launcher : public QMainWindow | 95 | class Launcher : public QMainWindow, public ServerInterface |
114 | { | 96 | { |
115 | Q_OBJECT | 97 | Q_OBJECT |
116 | friend class LauncherPrivate; | ||
117 | public: | 98 | public: |
118 | Launcher( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 99 | Launcher(); |
119 | ~Launcher(); | 100 | ~Launcher(); |
120 | 101 | ||
121 | static QString appsFolderName(); | 102 | // implementing ServerInterface |
122 | 103 | void createGUI(); | |
123 | virtual void showMaximized(); | 104 | void destroyGUI(); |
124 | static bool mkdir(const QString &path); | 105 | void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ); |
106 | void typeRemoved( const QString& type ); | ||
107 | void applicationAdded( const QString& type, const AppLnk& doc ); | ||
108 | void applicationRemoved( const QString& type, const AppLnk& doc ); | ||
109 | void allApplicationsRemoved(); | ||
110 | void applicationStateChanged( const QString& name, ApplicationState state ); | ||
111 | void documentAdded( const DocLnk& doc ); | ||
112 | void documentRemoved( const DocLnk& doc ); | ||
113 | void allDocumentsRemoved(); | ||
114 | void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); | ||
115 | void storageChanged( const QList<FileSystem> & ); | ||
116 | void applicationScanningProgress( int percent ); | ||
117 | void documentScanningProgress( int percent ); | ||
118 | bool requiresApplications() const { return TRUE; } | ||
119 | bool requiresDocuments() const { return TRUE; } | ||
120 | void showLoadingDocs(); | ||
121 | void showDocTab(); | ||
122 | |||
123 | QStringList idList() const { return ids; } | ||
125 | 124 | ||
126 | public slots: | 125 | public slots: |
@@ -128,19 +127,18 @@ public slots: | |||
128 | void showTab(const QString&); | 127 | void showTab(const QString&); |
129 | void select( const AppLnk * ); | 128 | void select( const AppLnk * ); |
130 | void externalSelected( const AppLnk *); | ||
131 | void properties( AppLnk * ); | 129 | void properties( AppLnk * ); |
132 | void nextView(); | 130 | void makeVisible(); |
133 | 131 | ||
134 | signals: | 132 | signals: |
135 | void executing( const AppLnk * ); | 133 | void executing( const AppLnk * ); |
136 | void busy(); | ||
137 | void notBusy(const QString&); | ||
138 | 134 | ||
139 | private slots: | 135 | private slots: |
140 | void doMaximize(); | ||
141 | void systemMessage( const QCString &, const QByteArray &); | 136 | void systemMessage( const QCString &, const QByteArray &); |
142 | void launcherMessage( const QCString &, const QByteArray &); | 137 | void toggleSymbolInput(); |
143 | void storageChanged(); | 138 | void toggleNumLockState(); |
144 | void cancelSync(); | 139 | void toggleCapsLockState(); |
140 | |||
141 | protected: | ||
142 | bool eventFilter( QObject *o, QEvent *ev ); | ||
145 | 143 | ||
146 | private: | 144 | private: |
@@ -149,22 +147,9 @@ private: | |||
149 | void updateDocs(); | 147 | void updateDocs(); |
150 | void updateTabs(); | 148 | void updateTabs(); |
151 | void updateMimeTypes(); | 149 | |
152 | void updateMimeTypes(AppLnkSet*); | 150 | LauncherTabWidget *tabs; |
153 | void preloadApps(); | 151 | QStringList ids; |
154 | AppLnkSet *rootFolder; | 152 | TaskBar *tb; |
155 | DocLnkSet *docsFolder; | ||
156 | CategoryTabWidget *tabs; | ||
157 | StorageInfo *storage; | ||
158 | SyncDialog *syncDialog; | ||
159 | |||
160 | void updateLink(const QString& link); | ||
161 | bool in_lnk_props; | ||
162 | bool got_lnk_change; | ||
163 | QString lnk_change; | ||
164 | |||
165 | QString m_timeStamp; | ||
166 | Qtopia::UidGen uidgen; | ||
167 | }; | 153 | }; |
168 | 154 | ||
169 | #endif // LAUNCHERVIEW_H | 155 | #endif // LAUNCHERVIEW_H |
170 | |||