author | mickeyl <mickeyl> | 2004-02-21 12:25:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-02-21 12:25:50 (UTC) |
commit | 6155f1be5c19fc51a4929c9e173f9e5a24d193e6 (patch) (unidiff) | |
tree | c18ca863f82a559c60728f922519ac696387ec53 /libopie2/opieui | |
parent | a570c2824fcecaf1c278e1b5a592fa14cc0647f8 (diff) | |
download | opie-6155f1be5c19fc51a4929c9e173f9e5a24d193e6.zip opie-6155f1be5c19fc51a4929c9e173f9e5a24d193e6.tar.gz opie-6155f1be5c19fc51a4929c9e173f9e5a24d193e6.tar.bz2 |
the usual cosmetics
-rw-r--r-- | libopie2/opieui/otabwidget.h | 14 | ||||
-rw-r--r-- | libopie2/opieui/owait.cpp | 91 | ||||
-rw-r--r-- | libopie2/opieui/owait.h | 67 |
3 files changed, 98 insertions, 74 deletions
diff --git a/libopie2/opieui/otabwidget.h b/libopie2/opieui/otabwidget.h index 51d1c6d..c7d32c2 100644 --- a/libopie2/opieui/otabwidget.h +++ b/libopie2/opieui/otabwidget.h | |||
@@ -1,295 +1,293 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | Copyright (C) 2002 Dan Williams <williamsdr@acm.org> | |
4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | ||
5 | =. | 4 | =. |
6 | .=l. | 5 | .=l. |
7 | .>+-= | 6 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 13 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 21 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
29 | 28 | ||
30 | */ | 29 | */ |
31 | 30 | ||
32 | #ifndef OTABWIDGET_H | 31 | #ifndef OTABWIDGET_H |
33 | #define OTABWIDGET_H | 32 | #define OTABWIDGET_H |
34 | 33 | ||
35 | /* OPIE */ | 34 | /* OPIE */ |
36 | #include <opie2/otabinfo.h> | 35 | #include <opie2/otabinfo.h> |
37 | 36 | ||
38 | /* QT */ | 37 | /* QT */ |
39 | #include <qwidget.h> | 38 | #include <qwidget.h> |
40 | #include <qlist.h> | 39 | #include <qlist.h> |
41 | 40 | ||
42 | using namespace Opie; | 41 | using namespace Opie; |
43 | 42 | ||
44 | class QComboBox; | 43 | class QComboBox; |
45 | class QPixmap; | 44 | class QPixmap; |
46 | class QTabBar; | 45 | class QTabBar; |
47 | class QWidgetStack; | 46 | class QWidgetStack; |
48 | 47 | ||
49 | namespace Opie | 48 | namespace Opie |
50 | { | 49 | { |
51 | 50 | ||
52 | class OTabBar; | 51 | class OTabBar; |
53 | 52 | ||
54 | /** | 53 | /** |
55 | * @class OTabWidget | 54 | * @class OTabWidget |
56 | * @brief The OTabWidget class provides a stack of widgets. | 55 | * @brief The OTabWidget class provides a stack of widgets. |
57 | * | 56 | * |
58 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides | 57 | * OTabWidget is a derivation of TrollTech's QTabWidget which provides |
59 | * a stack of widgets. Widgets can be selected using either a tab bar or | 58 | * a stack of widgets. Widgets can be selected using either a tab bar or |
60 | * drop down list box. | 59 | * drop down list box. |
61 | * | 60 | * |
62 | * The normal way to use OTabWidget is to do the following in the | 61 | * The normal way to use OTabWidget is to do the following in the |
63 | * constructor: | 62 | * constructor: |
64 | * - Create a OTabWidget. | 63 | * - Create a OTabWidget. |
65 | * - Create a QWidget for each of the pages in the control, insert | 64 | * - Create a QWidget for each of the pages in the control, insert |
66 | * children into it, set up geometry management for it, and use addTab() | 65 | * children into it, set up geometry management for it, and use addTab() |
67 | * to add the widget. | 66 | * to add the widget. |
68 | */ | 67 | */ |
69 | class OTabWidget : public QWidget | 68 | class OTabWidget : public QWidget |
70 | { | 69 | { |
71 | Q_OBJECT | 70 | Q_OBJECT |
72 | public: | 71 | |
73 | 72 | public: | |
74 | /** | 73 | /** |
75 | * @enum TabStyle | 74 | * @enum TabStyle |
76 | * @brief Defines how the widget selection control is displayed. | 75 | * @brief Defines how the widget selection control is displayed. |
77 | * | 76 | * |
78 | * Valid values: | 77 | * Valid values: |
79 | * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) | 78 | * - Global: use globally selected options (qpe.conf - TabStyle & TabPosition) |
80 | * - TextTab: Tabbed widget selection with text labels | 79 | * - TextTab: Tabbed widget selection with text labels |
81 | * - IconTab: Tabbed widget selection with icon labels, text label for active widget | 80 | * - IconTab: Tabbed widget selection with icon labels, text label for active widget |
82 | * (similar to Opie launcher) | 81 | * (similar to Opie launcher) |
83 | * - TextList: Drop down list widget selection with text labels | 82 | * - TextList: Drop down list widget selection with text labels |
84 | * - IconList: Drop down list widget selection with icon & text labels | 83 | * - IconList: Drop down list widget selection with icon & text labels |
85 | */ | 84 | */ |
86 | enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; | 85 | enum TabStyle { Global, TextTab, IconTab, TextList, IconList }; |
87 | 86 | ||
88 | /** | 87 | /** |
89 | * @enum TabPosition | 88 | * @enum TabPosition |
90 | * @brief Defines where the widget selection control is drawn. | 89 | * @brief Defines where the widget selection control is drawn. |
91 | * | 90 | * |
92 | * Valid values: | 91 | * Valid values: |
93 | * - Top: Widget selection control is drawn above widgets | 92 | * - Top: Widget selection control is drawn above widgets |
94 | * - Bottom: Widget selection control is drawn below widgets | 93 | * - Bottom: Widget selection control is drawn below widgets |
95 | */ | 94 | */ |
96 | enum TabPosition { Top, Bottom }; | 95 | enum TabPosition { Top, Bottom }; |
97 | 96 | ||
98 | /** | 97 | /** |
99 | * @fn OTabWidget( QWidget *parent = 0, const char *name = 0, TabStyle s = Global, TabPosition p = Top ) | 98 | * @fn OTabWidget( QWidget *parent = 0, const char *name = 0, TabStyle s = Global, TabPosition p = Top ) |
100 | * @brief Object constructor. | 99 | * @brief Object constructor. |
101 | * | 100 | * |
102 | * @param parent Pointer to parent of this control. | 101 | * @param parent Pointer to parent of this control. |
103 | * @param name Name of control. | 102 | * @param name Name of control. |
104 | * @param s Style of widget selection control. | 103 | * @param s Style of widget selection control. |
105 | * @param p Position of the widget selection control. | 104 | * @param p Position of the widget selection control. |
106 | * | 105 | * |
107 | * Constructs a new OTabWidget control with parent and name. The style and position parameters | 106 | * Constructs a new OTabWidget control with parent and name. The style and position parameters |
108 | * determine how the widget selection control will be displayed. | 107 | * determine how the widget selection control will be displayed. |
109 | */ | 108 | */ |
110 | // FIXME WFlags? -zecke | ||
111 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); | 109 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); |
112 | 110 | ||
113 | /** | 111 | /** |
114 | * @fn ~OTabWidget() | 112 | * @fn ~OTabWidget() |
115 | * @brief Object destructor. | 113 | * @brief Object destructor. |
116 | */ | 114 | */ |
117 | ~OTabWidget(); | 115 | ~OTabWidget(); |
118 | 116 | ||
119 | /** | 117 | /** |
120 | * @fn addTab( QWidget *child, const QString &icon, const QString &label ) | 118 | * @fn addTab( QWidget *child, const QString &icon, const QString &label ) |
121 | * @brief Add new widget to control. | 119 | * @brief Add new widget to control. |
122 | * | 120 | * |
123 | * @param child Widget control. | 121 | * @param child Widget control. |
124 | * @param icon Path to icon. | 122 | * @param icon Path to icon. |
125 | * @param label Text label. | 123 | * @param label Text label. |
126 | */ | 124 | */ |
127 | void addTab( QWidget *, const QString &, const QString & ); | 125 | void addTab( QWidget *, const QString &, const QString & ); |
128 | 126 | ||
129 | /** | 127 | /** |
130 | * @fn removePage( QWidget *widget ) | 128 | * @fn removePage( QWidget *widget ) |
131 | * @brief Remove widget from control. Does not delete widget. | 129 | * @brief Remove widget from control. Does not delete widget. |
132 | * | 130 | * |
133 | * @param widget Widget control to be removed. | 131 | * @param widget Widget control to be removed. |
134 | */ | 132 | */ |
135 | /* ### Page vs. Tab.. yes the widget is a Page but then is addTab wrong -zecke */ | 133 | /* ### Page vs. Tab.. yes the widget is a Page but then is addTab wrong -zecke */ |
136 | void removePage( QWidget * ); | 134 | void removePage( QWidget * ); |
137 | 135 | ||
138 | /** | 136 | /** |
139 | * @fn changeTab( QWidget *widget, const QString &icon, const QString &label ) | 137 | * @fn changeTab( QWidget *widget, const QString &icon, const QString &label ) |
140 | * @brief Change text and/or icon for existing tab | 138 | * @brief Change text and/or icon for existing tab |
141 | * | 139 | * |
142 | * @param child Widget control. | 140 | * @param child Widget control. |
143 | * @param icon Path to icon. | 141 | * @param icon Path to icon. |
144 | * @param label Text label. | 142 | * @param label Text label. |
145 | */ | 143 | */ |
146 | void changeTab( QWidget *, const QString &, const QString & ); | 144 | void changeTab( QWidget *, const QString &, const QString & ); |
147 | 145 | ||
148 | /** | 146 | /** |
149 | * @fn tabStyle()const | 147 | * @fn tabStyle()const |
150 | * @brief Returns current widget selection control style. | 148 | * @brief Returns current widget selection control style. |
151 | */ | 149 | */ |
152 | TabStyle tabStyle() const; | 150 | TabStyle tabStyle() const; |
153 | 151 | ||
154 | /** | 152 | /** |
155 | * @fn setTabStyle( TabStyle s ) | 153 | * @fn setTabStyle( TabStyle s ) |
156 | * @brief Set the current widget selection control style. | 154 | * @brief Set the current widget selection control style. |
157 | * | 155 | * |
158 | * @param s New style to be used. | 156 | * @param s New style to be used. |
159 | */ | 157 | */ |
160 | void setTabStyle( TabStyle ); | 158 | void setTabStyle( TabStyle ); |
161 | 159 | ||
162 | /** | 160 | /** |
163 | * @fn tabPosition()const | 161 | * @fn tabPosition()const |
164 | * @brief Returns current widget selection control position. | 162 | * @brief Returns current widget selection control position. |
165 | */ | 163 | */ |
166 | TabPosition tabPosition() const; | 164 | TabPosition tabPosition() const; |
167 | 165 | ||
168 | /** | 166 | /** |
169 | * @fn setTabPosition( TabPosition p ) | 167 | * @fn setTabPosition( TabPosition p ) |
170 | * @brief Set the current widget selection control position. | 168 | * @brief Set the current widget selection control position. |
171 | * | 169 | * |
172 | * @param p New position of widget selection control. | 170 | * @param p New position of widget selection control. |
173 | */ | 171 | */ |
174 | void setTabPosition( TabPosition ); | 172 | void setTabPosition( TabPosition ); |
175 | 173 | ||
176 | /** | 174 | /** |
177 | * @fn setCurrentTab( QWidget *childwidget ) | 175 | * @fn setCurrentTab( QWidget *childwidget ) |
178 | * @brief Selects and brings to top the desired widget by using widget pointer. | 176 | * @brief Selects and brings to top the desired widget by using widget pointer. |
179 | * | 177 | * |
180 | * @param childwidget Widget to select. | 178 | * @param childwidget Widget to select. |
181 | */ | 179 | */ |
182 | void setCurrentTab( QWidget * ); | 180 | void setCurrentTab( QWidget * ); |
183 | 181 | ||
184 | /** | 182 | /** |
185 | * @fn setCurrentTab( const QString &tabname ) | 183 | * @fn setCurrentTab( const QString &tabname ) |
186 | * @brief Selects and brings to top the desired widget, by using label. | 184 | * @brief Selects and brings to top the desired widget, by using label. |
187 | * | 185 | * |
188 | * @param tabname Text label for widget to select. | 186 | * @param tabname Text label for widget to select. |
189 | */ | 187 | */ |
190 | void setCurrentTab( const QString & ); | 188 | void setCurrentTab( const QString & ); |
191 | 189 | ||
192 | /** | 190 | /** |
193 | * @fn setCurrentTab( int ) | 191 | * @fn setCurrentTab( int ) |
194 | * @brief Selects and brings to top the desired widget, by using id. | 192 | * @brief Selects and brings to top the desired widget, by using id. |
195 | * | 193 | * |
196 | * @param tab id for widget to select. | 194 | * @param tab id for widget to select. |
197 | */ | 195 | */ |
198 | void setCurrentTab(int); | 196 | void setCurrentTab(int); |
199 | 197 | ||
200 | /** | 198 | /** |
201 | * @fn sizeHint()const | 199 | * @fn sizeHint()const |
202 | * @brief Reimplemented for internal purposes. | 200 | * @brief Reimplemented for internal purposes. |
203 | */ | 201 | */ |
204 | QSize sizeHint() const; | 202 | QSize sizeHint() const; |
205 | 203 | ||
206 | /** | 204 | /** |
207 | * @fn currentTab( ) | 205 | * @fn currentTab( ) |
208 | * @brief returns current tab id. | 206 | * @brief returns current tab id. |
209 | */ | 207 | */ |
210 | // ### make const | 208 | // ### make const |
211 | int currentTab()/* const */; | 209 | int currentTab()/* const */; |
212 | /** | 210 | /** |
213 | * @brief returns the current page of the active tab | 211 | * @brief returns the current page of the active tab |
214 | * | 212 | * |
215 | * @since 1.2 | 213 | * @since 1.2 |
216 | */ | 214 | */ |
217 | QWidget* currentWidget()const; | 215 | QWidget* currentWidget()const; |
218 | 216 | ||
219 | protected: | 217 | protected: |
220 | 218 | ||
221 | /** | 219 | /** |
222 | * @fn resizeEvent( QResizeEvent * ) | 220 | * @fn resizeEvent( QResizeEvent * ) |
223 | * @brief Reimplemented for internal purposes. | 221 | * @brief Reimplemented for internal purposes. |
224 | */ | 222 | */ |
225 | void resizeEvent( QResizeEvent * ); | 223 | void resizeEvent( QResizeEvent * ); |
226 | 224 | ||
227 | private: | 225 | private: |
228 | OTabInfoList tabs; | 226 | OTabInfoList tabs; |
229 | OTabInfo *currTab; | 227 | OTabInfo *currTab; |
230 | 228 | ||
231 | TabStyle tabBarStyle; | 229 | TabStyle tabBarStyle; |
232 | TabPosition tabBarPosition; | 230 | TabPosition tabBarPosition; |
233 | 231 | ||
234 | QWidgetStack *tabBarStack; | 232 | QWidgetStack *tabBarStack; |
235 | OTabBar *tabBar; | 233 | OTabBar *tabBar; |
236 | QComboBox *tabList; | 234 | QComboBox *tabList; |
237 | 235 | ||
238 | QWidgetStack *widgetStack; | 236 | QWidgetStack *widgetStack; |
239 | class Private; | 237 | class Private; |
240 | Private* d; | 238 | Private* d; |
241 | 239 | ||
242 | /** | 240 | /** |
243 | * @fn loadSmooth( const QString &name ) | 241 | * @fn loadSmooth( const QString &name ) |
244 | * @brief Loads icon for widget. | 242 | * @brief Loads icon for widget. |
245 | * | 243 | * |
246 | * @param name Name of icon image file. | 244 | * @param name Name of icon image file. |
247 | */ | 245 | */ |
248 | QPixmap loadSmooth( const QString & ); | 246 | QPixmap loadSmooth( const QString & ); |
249 | 247 | ||
250 | /** | 248 | /** |
251 | * @fn selectTab( OTabInfo *tab ) | 249 | * @fn selectTab( OTabInfo *tab ) |
252 | * @brief Internal function to select desired widget. | 250 | * @brief Internal function to select desired widget. |
253 | * | 251 | * |
254 | * @param tab Pointer to data for widget. | 252 | * @param tab Pointer to data for widget. |
255 | */ | 253 | */ |
256 | void selectTab( OTabInfo * ); | 254 | void selectTab( OTabInfo * ); |
257 | 255 | ||
258 | /** | 256 | /** |
259 | * @fn setUpLayout() | 257 | * @fn setUpLayout() |
260 | * @brief Internal function to adjust layout. | 258 | * @brief Internal function to adjust layout. |
261 | */ | 259 | */ |
262 | void setUpLayout(); | 260 | void setUpLayout(); |
263 | 261 | ||
264 | 262 | ||
265 | signals: | 263 | signals: |
266 | /** | 264 | /** |
267 | * @fn currentChanegd( QWidget *widget ) | 265 | * @fn currentChanegd( QWidget *widget ) |
268 | * @brief This signal is emitted whenever the widget has changed. | 266 | * @brief This signal is emitted whenever the widget has changed. |
269 | * | 267 | * |
270 | * @param widget Pointer to new current widget. | 268 | * @param widget Pointer to new current widget. |
271 | */ | 269 | */ |
272 | void currentChanged( QWidget * ); | 270 | void currentChanged( QWidget * ); |
273 | 271 | ||
274 | private slots: | 272 | private slots: |
275 | 273 | ||
276 | /** | 274 | /** |
277 | * @fn slotTabBarSelected( int id ) | 275 | * @fn slotTabBarSelected( int id ) |
278 | * @brief Slot which is called when a tab is selected. | 276 | * @brief Slot which is called when a tab is selected. |
279 | * | 277 | * |
280 | * @param id ID of widget selected. | 278 | * @param id ID of widget selected. |
281 | */ | 279 | */ |
282 | void slotTabBarSelected( int ); | 280 | void slotTabBarSelected( int ); |
283 | 281 | ||
284 | /** | 282 | /** |
285 | * @fn slotTabListSelected( int index ) | 283 | * @fn slotTabListSelected( int index ) |
286 | * @brief Slot which is called when a drop down selection is made. | 284 | * @brief Slot which is called when a drop down selection is made. |
287 | * | 285 | * |
288 | * @param id Index of widget selected. | 286 | * @param id Index of widget selected. |
289 | */ | 287 | */ |
290 | void slotTabListSelected( int ); | 288 | void slotTabListSelected( int ); |
291 | }; | 289 | }; |
292 | 290 | ||
293 | }; | 291 | }; |
294 | 292 | ||
295 | #endif | 293 | #endif |
diff --git a/libopie2/opieui/owait.cpp b/libopie2/opieui/owait.cpp index 0fdf08d..8bb4ed6 100644 --- a/libopie2/opieui/owait.cpp +++ b/libopie2/opieui/owait.cpp | |||
@@ -1,93 +1,110 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* |
2 | Copyright (C) 2003 Maximilian Reiss (harlekin@handhelds.org) | 2 | This file is part of the Opie Project |
3 | 3 | Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> | |
4 | This library is free software; you can redistribute it and/or | 4 | =. |
5 | modify it under the terms of the GNU Library General Public | 5 | .=l. |
6 | License as published by the Free Software Foundation; either | 6 | .>+-= |
7 | version 2 of the License, or (at your option) any later version. | 7 | _;:, .> :=|. This program is free software; you can |
8 | 8 | .> <`_, > . <= redistribute it and/or modify it under | |
9 | This library is distributed in the hope that it will be useful, | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | Library General Public License for more details. | 12 | ._= =} : or (at your option) any later version. |
13 | 13 | .%`+i> _;_. | |
14 | You should have received a copy of the GNU Library General Public License | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | : .. .:, . . . without even the implied warranty of |
17 | Boston, MA 02111-1307, USA. | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | */ | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
19 | 28 | ||
20 | #include <qlabel.h> | 29 | */ |
21 | #include <qlayout.h> | ||
22 | #include <qtimer.h> | ||
23 | #include <qpe/qpeapplication.h> | ||
24 | #include <qpainter.h> | ||
25 | 30 | ||
26 | #include "owait.h" | 31 | #include "owait.h" |
27 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <qpe/qpeapplication.h> | ||
28 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
29 | 36 | ||
37 | /* QT */ | ||
38 | #include <qlayout.h> | ||
39 | #include <qpainter.h> | ||
40 | |||
30 | static int frame = 0; | 41 | static int frame = 0; |
31 | 42 | ||
32 | /** | 43 | /** |
33 | * This will construct a modal dialog. | 44 | * This will construct a modal dialog. |
34 | * | 45 | * |
35 | * The default timer length is 10. | 46 | * The default timer length is 10. |
36 | * | 47 | * |
37 | * @param parent The parent of the widget | 48 | * @param parent The parent of the widget |
38 | * @param msg The name of the object | 49 | * @param msg The name of the object |
39 | * @param dispIcon Display Icon? | 50 | * @param dispIcon Display Icon? |
40 | */ | 51 | */ |
41 | OWait::OWait(QWidget *parent, const char* msg, bool dispIcon ) | 52 | OWait::OWait( QWidget *parent, const char* msg, bool dispIcon ) |
42 | :QDialog(parent, msg, TRUE,WStyle_Customize) { | 53 | :QDialog( parent, msg, TRUE, WStyle_Customize ) |
54 | { | ||
43 | 55 | ||
44 | 56 | ||
45 | QHBoxLayout *hbox = new QHBoxLayout( this ); | 57 | QHBoxLayout * hbox = new QHBoxLayout( this ); |
46 | 58 | ||
47 | m_lb = new QLabel( this ); | 59 | m_lb = new QLabel( this ); |
48 | m_lb->setBackgroundMode ( NoBackground ); | 60 | m_lb->setBackgroundMode ( NoBackground ); |
49 | 61 | ||
50 | hbox->addWidget( m_lb ); | 62 | hbox->addWidget( m_lb ); |
51 | hbox->activate(); | 63 | hbox->activate(); |
52 | 64 | ||
53 | m_pix = Resource::loadPixmap( "BigBusy" ); | 65 | m_pix = Resource::loadPixmap( "BigBusy" ); |
54 | m_aniSize = m_pix.height(); | 66 | m_aniSize = m_pix.height(); |
55 | resize( m_aniSize, m_aniSize ); | 67 | resize( m_aniSize, m_aniSize ); |
56 | 68 | ||
57 | m_timerLength = 10; | 69 | m_timerLength = 10; |
58 | 70 | ||
59 | m_waitTimer = new QTimer( this ); | 71 | m_waitTimer = new QTimer( this ); |
60 | connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); | 72 | connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); |
61 | } | 73 | } |
62 | 74 | ||
63 | void OWait::timerEvent( QTimerEvent * ) { | 75 | void OWait::timerEvent( QTimerEvent * ) |
64 | frame = (++frame) % 4; | 76 | { |
77 | frame = ( ++frame ) % 4; | ||
65 | repaint(); | 78 | repaint(); |
66 | } | 79 | } |
67 | 80 | ||
68 | void OWait::paintEvent( QPaintEvent * ) { | 81 | void OWait::paintEvent( QPaintEvent * ) |
69 | QPainter p( m_lb ); | 82 | { |
70 | p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize ); | 83 | QPainter p( m_lb ); |
84 | p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize ); | ||
71 | } | 85 | } |
72 | 86 | ||
73 | void OWait::show() { | 87 | void OWait::show() |
88 | { | ||
74 | 89 | ||
75 | move( ( ( qApp->desktop()->width() ) / 2 ) - ( m_aniSize / 2 ), ( ( qApp->desktop()->height() ) / 2 ) - ( m_aniSize / 2 ) ); | 90 | move( ( ( qApp->desktop() ->width() ) / 2 ) - ( m_aniSize / 2 ), ( ( qApp->desktop() ->height() ) / 2 ) - ( m_aniSize / 2 ) ); |
76 | startTimer( 300 ); | 91 | startTimer( 300 ); |
77 | m_waitTimer->start( m_timerLength * 1000, true ); | 92 | m_waitTimer->start( m_timerLength * 1000, true ); |
78 | QDialog::show(); | 93 | QDialog::show(); |
79 | } | 94 | } |
80 | 95 | ||
81 | void OWait::hide() { | 96 | void OWait::hide() |
97 | { | ||
82 | killTimers(); | 98 | killTimers(); |
83 | m_waitTimer->stop(); | 99 | m_waitTimer->stop(); |
84 | frame = 0; | 100 | frame = 0; |
85 | QDialog::hide(); | 101 | QDialog::hide(); |
86 | } | 102 | } |
87 | 103 | ||
88 | void OWait::setTimerLength( int length ) { | 104 | void OWait::setTimerLength( int length ) |
105 | { | ||
89 | m_timerLength = length; | 106 | m_timerLength = length; |
90 | } | 107 | } |
91 | 108 | ||
92 | OWait::~OWait() { | 109 | OWait::~OWait() |
93 | } | 110 | {} |
diff --git a/libopie2/opieui/owait.h b/libopie2/opieui/owait.h index cbfc8d6..3267064 100644 --- a/libopie2/opieui/owait.h +++ b/libopie2/opieui/owait.h | |||
@@ -1,77 +1,86 @@ | |||
1 | /* This file is part of the OPIE libraries | 1 | /* |
2 | Copyright (C) 2003 Maximilian Reiss (harlekin@handhelds.org) | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> | ||
4 | =. | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
3 | 28 | ||
4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Library General Public | ||
6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Library General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to | ||
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
17 | Boston, MA 02111-1307, USA. | ||
18 | */ | 29 | */ |
19 | 30 | ||
31 | #ifndef OWAIT_H | ||
32 | #define OWAIT_H | ||
20 | 33 | ||
21 | 34 | /* QT */ | |
22 | #ifndef WAITPOPUP_H | ||
23 | #define WAITPOPUP_H | ||
24 | |||
25 | #include <qdialog.h> | 35 | #include <qdialog.h> |
26 | #include <qpixmap.h> | ||
27 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qpixmap.h> | ||
28 | #include <qtimer.h> | 38 | #include <qtimer.h> |
29 | 39 | ||
30 | /** | 40 | /** |
31 | * This class displays a animated waiting icon in the middle of the screen. | 41 | * This class displays a animated waiting icon in the middle of the screen. |
32 | * | 42 | * |
33 | * @short modal hour glass dialog | 43 | * @short modal hour glass dialog |
34 | * @see QDialog | 44 | * @see QDialog |
35 | * @author Maximilian Reiß | 45 | * @author Maximilian Reiß |
36 | */ | 46 | */ |
37 | class OWait : public QDialog { | 47 | class OWait : public QDialog |
38 | 48 | { | |
39 | Q_OBJECT | 49 | Q_OBJECT |
40 | 50 | ||
41 | public: | 51 | public: |
42 | // FIXME Wflags -zecke? | 52 | OWait( QWidget *parent = 0, const char* name = 0, bool dispIcon = TRUE ); |
43 | OWait(QWidget *parent=0,const char* name=0, bool dispIcon=TRUE); | ||
44 | ~OWait(); | 53 | ~OWait(); |
45 | 54 | ||
46 | /** | 55 | /** |
47 | * reimplemented for control reasons | 56 | * reimplemented for control reasons |
48 | */ | 57 | */ |
49 | void show(); | 58 | void show(); |
50 | 59 | ||
51 | /** | 60 | /** |
52 | * Set the time before the icon will be automaticly hidden | 61 | * Set the time before the icon will be automaticly hidden |
53 | * The timer will be started once the widget will be shown. | 62 | * The timer will be started once the widget will be shown. |
54 | * @param length - time in seconds | 63 | * @param length - time in seconds |
55 | */ | 64 | */ |
56 | void setTimerLength( int length ); | 65 | void setTimerLength( int length ); |
57 | 66 | ||
58 | public slots: | 67 | public slots: |
59 | /** | 68 | /** |
60 | * reimplemented for control reasons | 69 | * reimplemented for control reasons |
61 | */ | 70 | */ |
62 | void hide(); | 71 | void hide(); |
63 | 72 | ||
64 | private: | 73 | private: |
65 | void timerEvent( QTimerEvent * ) ; | 74 | void timerEvent( QTimerEvent * ); |
66 | void paintEvent( QPaintEvent * ); | 75 | void paintEvent( QPaintEvent * ); |
67 | 76 | ||
68 | QPixmap m_pix; | 77 | QPixmap m_pix; |
69 | QLabel *m_lb; | 78 | QLabel *m_lb; |
70 | QTimer *m_waitTimer; | 79 | QTimer *m_waitTimer; |
71 | int m_timerLength; | 80 | int m_timerLength; |
72 | int m_aniSize; | 81 | int m_aniSize; |
73 | class Private; | 82 | class Private; |
74 | Private *d; | 83 | Private *d; |
75 | }; | 84 | }; |
76 | 85 | ||
77 | #endif | 86 | #endif |