author | alwin <alwin> | 2004-11-08 20:26:03 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-08 20:26:03 (UTC) |
commit | 1480f96170cb7cd7c262a14ad56ff08f384de10f (patch) (unidiff) | |
tree | ef83e5ce722809c0e84fd88ff885132098a67bf4 /core/launcher/launcherview.h | |
parent | cce0a7a0d315993645870e88591b4afd647480a7 (diff) | |
download | opie-1480f96170cb7cd7c262a14ad56ff08f384de10f.zip opie-1480f96170cb7cd7c262a14ad56ff08f384de10f.tar.gz opie-1480f96170cb7cd7c262a14ad56ff08f384de10f.tar.bz2 |
timer for releasing a reference to opie-eye_slave if exists when unused for ten
minutes.
Diffstat (limited to 'core/launcher/launcherview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/launcherview.h | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h index 0be9a1f..ebb1362 100644 --- a/core/launcher/launcherview.h +++ b/core/launcher/launcherview.h | |||
@@ -1,75 +1,76 @@ | |||
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 LAUNCHERVIEW_H | 20 | #ifndef LAUNCHERVIEW_H |
21 | #define LAUNCHERVIEW_H | 21 | #define LAUNCHERVIEW_H |
22 | 22 | ||
23 | #include <qtopia/storage.h> | 23 | #include <qtopia/storage.h> |
24 | #include <qtopia/applnk.h> | 24 | #include <qtopia/applnk.h> |
25 | 25 | ||
26 | #include <qvbox.h> | 26 | #include <qvbox.h> |
27 | #include <qiconview.h> | 27 | #include <qiconview.h> |
28 | #include <qtimer.h> | ||
28 | 29 | ||
29 | class CategorySelect; | 30 | class CategorySelect; |
30 | class LauncherIconView; | 31 | class LauncherIconView; |
31 | class LauncherItem; | 32 | class LauncherItem; |
32 | class QIconViewItem; | 33 | class QIconViewItem; |
33 | class QLabel; | 34 | class QLabel; |
34 | class QWidgetStack; | 35 | class QWidgetStack; |
35 | class MenuButton; | 36 | class MenuButton; |
36 | class QComboBox; | 37 | class QComboBox; |
37 | 38 | ||
38 | 39 | ||
39 | 40 | ||
40 | enum BusyIndicatorType { | 41 | enum BusyIndicatorType { |
41 | BIT_Normal = 0, | 42 | BIT_Normal = 0, |
42 | BIT_Animated | 43 | BIT_Animated |
43 | }; | 44 | }; |
44 | 45 | ||
45 | class LauncherView : public QVBox | 46 | class LauncherView : public QVBox |
46 | { | 47 | { |
47 | Q_OBJECT | 48 | Q_OBJECT |
48 | 49 | ||
49 | public: | 50 | public: |
50 | LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 51 | LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
51 | ~LauncherView(); | 52 | ~LauncherView(); |
52 | 53 | ||
53 | void hideIcons(); | 54 | void hideIcons(); |
54 | 55 | ||
55 | bool removeLink(const QString& linkfile); | 56 | bool removeLink(const QString& linkfile); |
56 | void addItem(AppLnk* app, bool resort=TRUE); | 57 | void addItem(AppLnk* app, bool resort=TRUE); |
57 | void removeAllItems(); | 58 | void removeAllItems(); |
58 | void setSortEnabled(bool); | 59 | void setSortEnabled(bool); |
59 | void setUpdatesEnabled(bool); | 60 | void setUpdatesEnabled(bool); |
60 | void sort(); | 61 | void sort(); |
61 | 62 | ||
62 | void setToolsEnabled(bool); | 63 | void setToolsEnabled(bool); |
63 | void updateTools(); | 64 | void updateTools(); |
64 | 65 | ||
65 | void setBusy(bool); | 66 | void setBusy(bool); |
66 | void setBusyIndicatorType( const QString& ); | 67 | void setBusyIndicatorType( const QString& ); |
67 | 68 | ||
68 | enum ViewMode { Icon, List }; | 69 | enum ViewMode { Icon, List }; |
69 | void setViewMode( ViewMode m ); | 70 | void setViewMode( ViewMode m ); |
70 | ViewMode viewMode() const { return vmode; } | 71 | ViewMode viewMode() const { return vmode; } |
71 | 72 | ||
72 | enum BackgroundType { Ruled, SolidColor, Image }; | 73 | enum BackgroundType { Ruled, SolidColor, Image }; |
73 | void setBackgroundType( BackgroundType t, const QString & ); | 74 | void setBackgroundType( BackgroundType t, const QString & ); |
74 | BackgroundType backgroundType() const { return bgType; } | 75 | BackgroundType backgroundType() const { return bgType; } |
75 | 76 | ||
@@ -128,127 +129,116 @@ struct PixmapInfo { | |||
128 | } | 129 | } |
129 | int width, height; | 130 | int width, height; |
130 | QString file; | 131 | QString file; |
131 | QPixmap pixmap; | 132 | QPixmap pixmap; |
132 | }; | 133 | }; |
133 | 134 | ||
134 | class LauncherThumbReceiver:public QObject | 135 | class LauncherThumbReceiver:public QObject |
135 | { | 136 | { |
136 | Q_OBJECT | 137 | Q_OBJECT |
137 | typedef QValueList<PixmapInfo> PixmapInfos; | 138 | typedef QValueList<PixmapInfo> PixmapInfos; |
138 | public: | 139 | public: |
139 | LauncherThumbReceiver(); | 140 | LauncherThumbReceiver(); |
140 | ~LauncherThumbReceiver(); | 141 | ~LauncherThumbReceiver(); |
141 | void requestThumb(const QString&file,int width,int height); | 142 | void requestThumb(const QString&file,int width,int height); |
142 | 143 | ||
143 | public slots: | 144 | public slots: |
144 | void recieve( const QCString&, const QByteArray& ); | 145 | void recieve( const QCString&, const QByteArray& ); |
145 | protected slots: | 146 | protected slots: |
146 | virtual void sendRequest(); | 147 | virtual void sendRequest(); |
147 | 148 | ||
148 | signals: | 149 | signals: |
149 | void sig_Thumbnail(const QPixmap&,const QString&,int); | 150 | void sig_Thumbnail(const QPixmap&,const QString&,int); |
150 | 151 | ||
151 | protected: | 152 | protected: |
152 | PixmapInfos m_inThumbNail; | 153 | PixmapInfos m_inThumbNail; |
153 | }; | 154 | }; |
154 | 155 | ||
155 | class LauncherIconView : public QIconView { | 156 | class LauncherIconView : public QIconView { |
156 | Q_OBJECT | 157 | Q_OBJECT |
157 | public: | 158 | public: |
158 | LauncherIconView( QWidget* parent, const char* name=0 ); | 159 | LauncherIconView( QWidget* parent, const char* name=0 ); |
159 | ~LauncherIconView(); | 160 | ~LauncherIconView(); |
160 | QIconViewItem* busyItem() const; | 161 | QIconViewItem* busyItem() const; |
161 | 162 | ||
162 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | 163 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY |
163 | QPixmap busyPixmap() const { return busyPix; } | 164 | QPixmap busyPixmap() const { return busyPix; } |
164 | #endif | 165 | #endif |
165 | void setBigIcons( bool bi ); | 166 | void setBigIcons( bool bi ); |
166 | void updateCategoriesAndMimeTypes(); | 167 | void updateCategoriesAndMimeTypes(); |
167 | void setBusyIndicatorType ( BusyIndicatorType t ); | 168 | void setBusyIndicatorType ( BusyIndicatorType t ); |
168 | void doAutoScroll() | 169 | void doAutoScroll() |
169 | { | 170 | { |
170 | // We don't want rubberbanding (yet) | 171 | // We don't want rubberbanding (yet) |
171 | } | 172 | } |
172 | 173 | ||
173 | void setBusy(bool on); | 174 | void setBusy(bool on); |
174 | bool inKeyEvent() const { return ike; } | 175 | bool inKeyEvent() const { return ike; } |
175 | 176 | ||
176 | void keyPressEvent(QKeyEvent* e) | ||
177 | { | ||
178 | ike = TRUE; | ||
179 | if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { | ||
180 | if ( (e->state() & ShiftButton) ) | ||
181 | emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); | ||
182 | else | ||
183 | returnPressed(currentItem()); | ||
184 | } | ||
185 | |||
186 | QIconView::keyPressEvent(e); | ||
187 | ike = FALSE; | ||
188 | } | ||
189 | |||
190 | void addItem(AppLnk* app, bool resort=TRUE); | 177 | void addItem(AppLnk* app, bool resort=TRUE); |
191 | bool removeLink(const QString& linkfile); | 178 | bool removeLink(const QString& linkfile); |
192 | 179 | ||
193 | QStringList mimeTypes() const; | 180 | QStringList mimeTypes() const; |
194 | QStringList categories() const; | 181 | QStringList categories() const; |
195 | void clear(); | 182 | void clear(); |
196 | void addCatsAndMimes(AppLnk* app); | 183 | void addCatsAndMimes(AppLnk* app); |
197 | 184 | ||
198 | void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} | 185 | void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} |
199 | 186 | ||
200 | void setBackgroundPixmap( const QPixmap &pm ) { | 187 | void setBackgroundPixmap( const QPixmap &pm ) { |
201 | bgPixmap = pm; | 188 | bgPixmap = pm; |
202 | } | 189 | } |
203 | 190 | ||
204 | void setBackgroundColor( const QColor &c ) { | 191 | void setBackgroundColor( const QColor &c ) { |
205 | bgColor = c; | 192 | bgColor = c; |
206 | } | 193 | } |
207 | 194 | ||
208 | void drawBackground( QPainter *p, const QRect &r ); | 195 | void drawBackground( QPainter *p, const QRect &r ); |
209 | void setItemTextPos( ItemTextPos pos ); | 196 | void setItemTextPos( ItemTextPos pos ); |
210 | void hideOrShowItems(bool resort); | 197 | void hideOrShowItems(bool resort); |
211 | 198 | ||
212 | void setTypeFilter(const QString& typefilter, bool resort); | 199 | void setTypeFilter(const QString& typefilter, bool resort); |
213 | void setCategoryFilter( int catfilter, bool resort ); | 200 | void setCategoryFilter( int catfilter, bool resort ); |
214 | 201 | ||
215 | enum SortMethod { Name, Date, Type }; | 202 | enum SortMethod { Name, Date, Type }; |
216 | 203 | ||
217 | void setSortMethod( SortMethod m ); | 204 | void setSortMethod( SortMethod m ); |
218 | int compare(const AppLnk* a, const AppLnk* b); | 205 | int compare(const AppLnk* a, const AppLnk* b); |
219 | void requestEyePix(const LauncherItem*which); | 206 | void requestEyePix(const LauncherItem*which); |
220 | 207 | ||
221 | protected: | 208 | protected: |
222 | void timerEvent( QTimerEvent *te ); | 209 | virtual void timerEvent( QTimerEvent *te ); |
223 | void styleChange( QStyle &old ); | 210 | void styleChange( QStyle &old ); |
224 | void calculateGrid( ItemTextPos pos ); | 211 | void calculateGrid( ItemTextPos pos ); |
225 | void focusInEvent( QFocusEvent * ) {} | 212 | void focusInEvent( QFocusEvent * ) {} |
226 | void focusOutEvent( QFocusEvent * ) {} | 213 | void focusOutEvent( QFocusEvent * ) {} |
227 | LauncherItem*findDocItem(const QString&); | 214 | LauncherItem*findDocItem(const QString&); |
228 | void addCheckItem(AppLnk* app); | 215 | void addCheckItem(AppLnk* app); |
229 | void checkCallback(); | 216 | void checkCallback(); |
217 | virtual void keyPressEvent(QKeyEvent* e); | ||
230 | 218 | ||
231 | protected slots: | 219 | protected slots: |
232 | void setEyePixmap(const QPixmap&,const QString&,int width); | 220 | void setEyePixmap(const QPixmap&,const QString&,int width); |
221 | void stopEyeTimer(); | ||
233 | 222 | ||
234 | private: | 223 | private: |
235 | QList<AppLnk> hidden; | 224 | QList<AppLnk> hidden; |
236 | QDict<void> mimes; | 225 | QDict<void> mimes; |
237 | QDict<void> cats; | 226 | QDict<void> cats; |
238 | SortMethod sortmeth; | 227 | SortMethod sortmeth; |
239 | QRegExp tf; | 228 | QRegExp tf; |
240 | int cf; | 229 | int cf; |
241 | LauncherItem* bsy; | 230 | LauncherItem* bsy; |
242 | int busyTimer; | 231 | int busyTimer; |
243 | bool ike; | 232 | bool ike; |
244 | bool bigIcns; | 233 | bool bigIcns; |
245 | QPixmap bgPixmap; | 234 | QPixmap bgPixmap; |
246 | QColor bgColor; | 235 | QColor bgColor; |
247 | LauncherThumbReceiver*m_EyeCallBack; | 236 | LauncherThumbReceiver*m_EyeCallBack; |
248 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | 237 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY |
249 | QPixmap busyPix; | 238 | QPixmap busyPix; |
250 | #endif | 239 | #endif |
251 | BusyIndicatorType busyType; | 240 | BusyIndicatorType busyType; |
241 | QTimer m_eyeTimer; | ||
252 | }; | 242 | }; |
253 | 243 | ||
254 | #endif // LAUNCHERVIEW_H | 244 | #endif // LAUNCHERVIEW_H |