-rw-r--r-- | core/launcher/launcherview.h | 114 |
1 files changed, 106 insertions, 8 deletions
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h index a9ff9eb..3cca7f7 100644 --- a/core/launcher/launcherview.h +++ b/core/launcher/launcherview.h | |||
@@ -21,17 +21,17 @@ | |||
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 | 28 | ||
28 | class CategorySelect; | 29 | class CategorySelect; |
29 | class LauncherIconView; | 30 | class LauncherIconView; |
30 | class LauncherItem; | 31 | class LauncherItem; |
31 | class QIconView; | ||
32 | class QIconViewItem; | 32 | class QIconViewItem; |
33 | class QLabel; | 33 | class QLabel; |
34 | class QWidgetStack; | 34 | class QWidgetStack; |
35 | class MenuButton; | 35 | class MenuButton; |
36 | class QComboBox; | 36 | class QComboBox; |
37 | 37 | ||
@@ -114,14 +114,13 @@ private: | |||
114 | QColor textCol; | 114 | QColor textCol; |
115 | 115 | ||
116 | QImage loadBackgroundImage(QString &fname); | 116 | QImage loadBackgroundImage(QString &fname); |
117 | 117 | ||
118 | }; | 118 | }; |
119 | 119 | ||
120 | /* taken from opie-eye */ | 120 | /* from opie-eye */ |
121 | |||
122 | struct PixmapInfo { | 121 | struct PixmapInfo { |
123 | PixmapInfo() : width( -1 ), height( -1 ) {} | 122 | PixmapInfo() : width( -1 ), height( -1 ) {} |
124 | bool operator==( const PixmapInfo& r ) { | 123 | bool operator==( const PixmapInfo& r ) { |
125 | if ( width != r.width ) return false; | 124 | if ( width != r.width ) return false; |
126 | if ( height != r.height ) return false; | 125 | if ( height != r.height ) return false; |
127 | if ( file != r.file ) return false; | 126 | if ( file != r.file ) return false; |
@@ -134,22 +133,121 @@ struct PixmapInfo { | |||
134 | 133 | ||
135 | class LauncherThumbReceiver:public QObject | 134 | class LauncherThumbReceiver:public QObject |
136 | { | 135 | { |
137 | Q_OBJECT | 136 | Q_OBJECT |
138 | typedef QValueList<PixmapInfo> PixmapInfos; | 137 | typedef QValueList<PixmapInfo> PixmapInfos; |
139 | public: | 138 | public: |
140 | LauncherThumbReceiver(LauncherItem*parent); | 139 | LauncherThumbReceiver(); |
141 | ~LauncherThumbReceiver(); | 140 | ~LauncherThumbReceiver(); |
142 | void requestThumb(const QString&file,int width,int height); | 141 | void requestThumb(const QString&file,int width,int height); |
143 | 142 | ||
144 | public slots: | 143 | public slots: |
145 | void recieve( const QCString&, const QByteArray& ); | 144 | void recieve( const QCString&, const QByteArray& ); |
146 | protected slots: | 145 | protected slots: |
147 | virtual void sendRequest(); | 146 | virtual void sendRequest(); |
147 | |||
148 | signals: | ||
149 | void sig_Thumbnail(const QPixmap&,const QString&); | ||
150 | |||
148 | protected: | 151 | protected: |
149 | LauncherItem*m_parent; | 152 | PixmapInfos m_inThumbNail; |
150 | QString m_reqFile; | 153 | }; |
151 | PixmapInfo rItem; | 154 | |
152 | bool m_waiting:1; | 155 | class LauncherIconView : public QIconView { |
156 | Q_OBJECT | ||
157 | public: | ||
158 | LauncherIconView( QWidget* parent, const char* name=0 ); | ||
159 | ~LauncherIconView(); | ||
160 | QIconViewItem* busyItem() const; | ||
161 | |||
162 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | ||
163 | QPixmap busyPixmap() const { return busyPix; } | ||
164 | #endif | ||
165 | void setBigIcons( bool bi ); | ||
166 | void updateCategoriesAndMimeTypes(); | ||
167 | void setBusyIndicatorType ( BusyIndicatorType t ); | ||
168 | void doAutoScroll() | ||
169 | { | ||
170 | // We don't want rubberbanding (yet) | ||
171 | } | ||
172 | |||
173 | void setBusy(bool on); | ||
174 | bool inKeyEvent() const { return ike; } | ||
175 | |||
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); | ||
191 | bool removeLink(const QString& linkfile); | ||
192 | |||
193 | QStringList mimeTypes() const; | ||
194 | QStringList categories() const; | ||
195 | void clear(); | ||
196 | void addCatsAndMimes(AppLnk* app); | ||
197 | |||
198 | void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} | ||
199 | |||
200 | void setBackgroundPixmap( const QPixmap &pm ) { | ||
201 | bgPixmap = pm; | ||
202 | } | ||
203 | |||
204 | void setBackgroundColor( const QColor &c ) { | ||
205 | bgColor = c; | ||
206 | } | ||
207 | |||
208 | void drawBackground( QPainter *p, const QRect &r ); | ||
209 | void setItemTextPos( ItemTextPos pos ); | ||
210 | void hideOrShowItems(bool resort); | ||
211 | |||
212 | void setTypeFilter(const QString& typefilter, bool resort); | ||
213 | void setCategoryFilter( int catfilter, bool resort ); | ||
214 | |||
215 | enum SortMethod { Name, Date, Type }; | ||
216 | |||
217 | void setSortMethod( SortMethod m ); | ||
218 | int compare(const AppLnk* a, const AppLnk* b); | ||
219 | |||
220 | protected: | ||
221 | void timerEvent( QTimerEvent *te ); | ||
222 | void styleChange( QStyle &old ); | ||
223 | void calculateGrid( ItemTextPos pos ); | ||
224 | void focusInEvent( QFocusEvent * ) {} | ||
225 | void focusOutEvent( QFocusEvent * ) {} | ||
226 | LauncherItem*findDocItem(const QString&); | ||
227 | void addCheckItem(AppLnk* app); | ||
228 | void checkCallback(); | ||
229 | |||
230 | protected slots: | ||
231 | void setEyePixmap(const QPixmap&,const QString&); | ||
232 | |||
233 | private: | ||
234 | QList<AppLnk> hidden; | ||
235 | QDict<void> mimes; | ||
236 | QDict<void> cats; | ||
237 | SortMethod sortmeth; | ||
238 | QRegExp tf; | ||
239 | int cf; | ||
240 | LauncherItem* bsy; | ||
241 | int busyTimer; | ||
242 | bool ike; | ||
243 | bool bigIcns; | ||
244 | QPixmap bgPixmap; | ||
245 | QColor bgColor; | ||
246 | LauncherThumbReceiver*m_EyeCallBack; | ||
247 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | ||
248 | QPixmap busyPix; | ||
249 | #endif | ||
250 | BusyIndicatorType busyType; | ||
153 | }; | 251 | }; |
154 | 252 | ||
155 | #endif // LAUNCHERVIEW_H | 253 | #endif // LAUNCHERVIEW_H |