author | sandman <sandman> | 2002-09-27 00:56:30 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-27 00:56:30 (UTC) |
commit | 82012ba8a063b729dec92db60c939834530a9fa4 (patch) (unidiff) | |
tree | 105de4a377a4fb5c1a4c0c2e450e1ed3e93d66f7 | |
parent | dcd5eb6949787321c278b10772bd75a27ec6d508 (diff) | |
download | opie-82012ba8a063b729dec92db60c939834530a9fa4.zip opie-82012ba8a063b729dec92db60c939834530a9fa4.tar.gz opie-82012ba8a063b729dec92db60c939834530a9fa4.tar.bz2 |
- fixed the font selection
- added a .control file
- fixed the default bg type
-rw-r--r-- | core/settings/launcher/opie-launcher-settings.control | 9 | ||||
-rw-r--r-- | core/settings/launcher/tabconfig.h | 3 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 16 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 14 |
4 files changed, 29 insertions, 13 deletions
diff --git a/core/settings/launcher/opie-launcher-settings.control b/core/settings/launcher/opie-launcher-settings.control new file mode 100644 index 0000000..e0c5005 --- a/dev/null +++ b/core/settings/launcher/opie-launcher-settings.control | |||
@@ -0,0 +1,9 @@ | |||
1 | Files: bin/launchersettings apps/Settings/Launcher.desktop pics/launchersettings | ||
2 | Priority: optional | ||
3 | Section: opie/settings | ||
4 | Maintainer: Robert Griebl <sandman@handhelds.org> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-$SUB_VERSION | ||
7 | Depends: opie-base ($QPE_VERSION) | ||
8 | Description: Launcher settings dialog | ||
9 | For the Opie environment. | ||
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h index 1c2e94d..8b6b103 100644 --- a/core/settings/launcher/tabconfig.h +++ b/core/settings/launcher/tabconfig.h | |||
@@ -1,52 +1,53 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | #ifndef __TABCONFIG_H__ | 27 | #ifndef __TABCONFIG_H__ |
28 | #define __TABCONFIG_H__ | 28 | #define __TABCONFIG_H__ |
29 | 29 | ||
30 | struct TabConfig { | 30 | struct TabConfig { |
31 | enum ViewMode { | 31 | enum ViewMode { |
32 | Icon, | 32 | Icon, |
33 | List | 33 | List |
34 | }; | 34 | }; |
35 | enum BackgroundType { | 35 | enum BackgroundType { |
36 | Ruled, | 36 | Ruled, |
37 | SolidColor, | 37 | SolidColor, |
38 | Image | 38 | Image |
39 | }; | 39 | }; |
40 | 40 | ||
41 | ViewMode m_view; | 41 | ViewMode m_view; |
42 | BackgroundType m_bg_type; | 42 | BackgroundType m_bg_type; |
43 | QString m_bg_image; | 43 | QString m_bg_image; |
44 | QString m_bg_color; | 44 | QString m_bg_color; |
45 | QString m_text_color; | 45 | QString m_text_color; |
46 | QString m_font_family; | 46 | QString m_font_family; |
47 | QString m_font_style; | ||
48 | int m_font_size; | 47 | int m_font_size; |
48 | int m_font_weight; | ||
49 | bool m_font_italic; | ||
49 | bool m_changed; | 50 | bool m_changed; |
50 | }; | 51 | }; |
51 | 52 | ||
52 | #endif | 53 | #endif |
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index 86202f0..75a3de5 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -171,324 +171,328 @@ public: | |||
171 | { | 171 | { |
172 | m_textcolor = tc; | 172 | m_textcolor = tc; |
173 | QColorGroup cg = colorGroup ( ); | 173 | QColorGroup cg = colorGroup ( ); |
174 | cg. setColor ( QColorGroup::Text, tc ); | 174 | cg. setColor ( QColorGroup::Text, tc ); |
175 | setPalette ( QPalette ( cg, cg, cg )); | 175 | setPalette ( QPalette ( cg, cg, cg )); |
176 | viewport ( )-> update ( ); | 176 | viewport ( )-> update ( ); |
177 | } | 177 | } |
178 | 178 | ||
179 | void setViewFont ( const QFont &f ) | 179 | void setViewFont ( const QFont &f ) |
180 | { | 180 | { |
181 | setFont ( f ); | 181 | setFont ( f ); |
182 | } | 182 | } |
183 | 183 | ||
184 | void setItemTextPos ( ItemTextPos pos ) | 184 | void setItemTextPos ( ItemTextPos pos ) |
185 | { | 185 | { |
186 | calculateGrid ( pos ); | 186 | calculateGrid ( pos ); |
187 | QIconView::setItemTextPos( pos ); | 187 | QIconView::setItemTextPos( pos ); |
188 | } | 188 | } |
189 | 189 | ||
190 | void calculateGrid ( ItemTextPos pos ) | 190 | void calculateGrid ( ItemTextPos pos ) |
191 | { | 191 | { |
192 | int dw = QApplication::desktop ( )-> width ( ); | 192 | int dw = QApplication::desktop ( )-> width ( ); |
193 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); | 193 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); |
194 | if ( pos == Bottom ) { | 194 | if ( pos == Bottom ) { |
195 | int cols = 3; | 195 | int cols = 3; |
196 | if ( viewerWidth <= 200 ) | 196 | if ( viewerWidth <= 200 ) |
197 | cols = 2; | 197 | cols = 2; |
198 | else if ( viewerWidth >= 400 ) | 198 | else if ( viewerWidth >= 400 ) |
199 | cols = viewerWidth/96; | 199 | cols = viewerWidth/96; |
200 | setSpacing ( 4 ); | 200 | setSpacing ( 4 ); |
201 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 201 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
202 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); | 202 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); |
203 | } | 203 | } |
204 | else { | 204 | else { |
205 | int cols = 2; | 205 | int cols = 2; |
206 | if ( viewerWidth < 150 ) | 206 | if ( viewerWidth < 150 ) |
207 | cols = 1; | 207 | cols = 1; |
208 | else if ( viewerWidth >= 400 ) | 208 | else if ( viewerWidth >= 400 ) |
209 | cols = viewerWidth / 150; | 209 | cols = viewerWidth / 150; |
210 | setSpacing ( 2 ); | 210 | setSpacing ( 2 ); |
211 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 211 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
212 | setGridY ( fontMetrics ( ). height ( ) + 2 ); | 212 | setGridY ( fontMetrics ( ). height ( ) + 2 ); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | void paletteChange( const QPalette &p ) | 216 | void paletteChange( const QPalette &p ) |
217 | { | 217 | { |
218 | static bool excllock = false; | 218 | static bool excllock = false; |
219 | 219 | ||
220 | if ( excllock ) | 220 | if ( excllock ) |
221 | return; | 221 | return; |
222 | excllock = true; | 222 | excllock = true; |
223 | 223 | ||
224 | unsetPalette ( ); | 224 | unsetPalette ( ); |
225 | QIconView::paletteChange ( p ); | 225 | QIconView::paletteChange ( p ); |
226 | if ( m_bgtype == TabConfig::Ruled ) | 226 | if ( m_bgtype == TabConfig::Ruled ) |
227 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 227 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
228 | QColorGroup cg = colorGroup ( ); | 228 | QColorGroup cg = colorGroup ( ); |
229 | cg.setColor ( QColorGroup::Text, m_textcolor ); | 229 | cg.setColor ( QColorGroup::Text, m_textcolor ); |
230 | setPalette ( QPalette ( cg, cg, cg )); | 230 | setPalette ( QPalette ( cg, cg, cg )); |
231 | 231 | ||
232 | excllock = false; | 232 | excllock = false; |
233 | } | 233 | } |
234 | 234 | ||
235 | void setBackgroundPixmap ( const QPixmap &pm ) | 235 | void setBackgroundPixmap ( const QPixmap &pm ) |
236 | { | 236 | { |
237 | m_bgpix = pm; | 237 | m_bgpix = pm; |
238 | } | 238 | } |
239 | 239 | ||
240 | void setBackgroundColor ( const QColor &c ) | 240 | void setBackgroundColor ( const QColor &c ) |
241 | { | 241 | { |
242 | m_bgcolor = c; | 242 | m_bgcolor = c; |
243 | } | 243 | } |
244 | 244 | ||
245 | void drawBackground ( QPainter *p, const QRect &r ) | 245 | void drawBackground ( QPainter *p, const QRect &r ) |
246 | { | 246 | { |
247 | if ( !m_bgpix. isNull ( )) { | 247 | if ( !m_bgpix. isNull ( )) { |
248 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), | 248 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), |
249 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); | 249 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); |
250 | } | 250 | } |
251 | else | 251 | else |
252 | p-> fillRect ( r, m_bgcolor ); | 252 | p-> fillRect ( r, m_bgcolor ); |
253 | } | 253 | } |
254 | 254 | ||
255 | private: | 255 | private: |
256 | QColor m_textcolor; | 256 | QColor m_textcolor; |
257 | QColor m_bgcolor; | 257 | QColor m_bgcolor; |
258 | QPixmap m_bgpix; | 258 | QPixmap m_bgpix; |
259 | TabConfig::BackgroundType m_bgtype; | 259 | TabConfig::BackgroundType m_bgtype; |
260 | }; | 260 | }; |
261 | 261 | ||
262 | 262 | ||
263 | 263 | ||
264 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl ) | 264 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl ) |
265 | : QDialog ( parent, name, modal, fl ), m_tc ( tc ) | 265 | : QDialog ( parent, name, modal, fl ), m_tc ( tc ) |
266 | { | 266 | { |
267 | setCaption ( tr( "Edit Tab" )); | 267 | setCaption ( tr( "Edit Tab" )); |
268 | 268 | ||
269 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 269 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); |
270 | 270 | ||
271 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 271 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
272 | QWidget *bgtab; | 272 | QWidget *bgtab; |
273 | 273 | ||
274 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); | 274 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" )); |
275 | tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); | 275 | tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); |
276 | tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); | 276 | tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) ); |
277 | 277 | ||
278 | tw-> setCurrentTab ( bgtab ); | 278 | tw-> setCurrentTab ( bgtab ); |
279 | 279 | ||
280 | QWidget *sample = new QVBox ( this ); | 280 | QWidget *sample = new QVBox ( this ); |
281 | QTabBar *tb = new QTabBar ( sample ); | 281 | QTabBar *tb = new QTabBar ( sample ); |
282 | QString name ( tr( "Previewing %1" ). arg ( tabname )); | 282 | QString name ( tr( "Previewing %1" ). arg ( tabname )); |
283 | 283 | ||
284 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); | 284 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); |
285 | 285 | ||
286 | m_sample = new SampleView ( sample ); | 286 | m_sample = new SampleView ( sample ); |
287 | 287 | ||
288 | lay-> addWidget ( tw, 10 ); | 288 | lay-> addWidget ( tw, 10 ); |
289 | lay-> addWidget ( sample, 1 ); | 289 | lay-> addWidget ( sample, 1 ); |
290 | 290 | ||
291 | m_iconsize-> setButton ( tc. m_view ); | 291 | m_iconsize-> setButton ( tc. m_view ); |
292 | iconSizeClicked ( tc. m_view ); | 292 | iconSizeClicked ( tc. m_view ); |
293 | m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); | 293 | m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); |
294 | iconColorClicked ( m_iconcolor-> color ( )); | 294 | iconColorClicked ( m_iconcolor-> color ( )); |
295 | m_bgtype-> setButton ( tc. m_bg_type ); | 295 | m_bgtype-> setButton ( tc. m_bg_type ); |
296 | m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); | 296 | m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); |
297 | m_bgimage = tc. m_bg_image; | 297 | m_bgimage = tc. m_bg_image; |
298 | bgTypeClicked ( tc. m_bg_type ); | 298 | bgTypeClicked ( tc. m_bg_type ); |
299 | m_fontselect-> setSelectedFont ( tc. m_font_family, tc. m_font_style, tc. m_font_size ); | 299 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); |
300 | fontClicked ( m_fontselect-> selectedFont ( )); | 300 | fontClicked ( m_fontselect-> selectedFont ( )); |
301 | } | 301 | } |
302 | 302 | ||
303 | 303 | ||
304 | TabDialog::~TabDialog ( ) | 304 | TabDialog::~TabDialog ( ) |
305 | { | 305 | { |
306 | } | 306 | } |
307 | 307 | ||
308 | QWidget *TabDialog::createFontTab ( QWidget *parent ) | 308 | QWidget *TabDialog::createFontTab ( QWidget *parent ) |
309 | { | 309 | { |
310 | m_fontselect = new OFontSelector ( parent, "FontTab" ); | 310 | m_fontselect = new OFontSelector ( parent, "FontTab" ); |
311 | 311 | ||
312 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), | 312 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), |
313 | this, SLOT( fontClicked ( const QFont & ))); | 313 | this, SLOT( fontClicked ( const QFont & ))); |
314 | 314 | ||
315 | return m_fontselect; | 315 | return m_fontselect; |
316 | } | 316 | } |
317 | 317 | ||
318 | QWidget *TabDialog::createBgTab ( QWidget *parent ) | 318 | QWidget *TabDialog::createBgTab ( QWidget *parent ) |
319 | { | 319 | { |
320 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 320 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); |
321 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 321 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); |
322 | 322 | ||
323 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 323 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
324 | gridLayout-> setColStretch ( 1, 10 ); | 324 | gridLayout-> setColStretch ( 1, 10 ); |
325 | 325 | ||
326 | QLabel* label = new QLabel( tr( "Type:" ), tab ); | 326 | QLabel* label = new QLabel( tr( "Type:" ), tab ); |
327 | gridLayout-> addWidget ( label, 0, 0 ); | 327 | gridLayout-> addWidget ( label, 0, 0 ); |
328 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); | 328 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); |
329 | m_bgtype-> hide ( ); | 329 | m_bgtype-> hide ( ); |
330 | m_bgtype-> setExclusive ( true ); | 330 | m_bgtype-> setExclusive ( true ); |
331 | 331 | ||
332 | QRadioButton *rb; | 332 | QRadioButton *rb; |
333 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); | 333 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); |
334 | m_bgtype-> insert ( rb, TabConfig::Ruled ); | 334 | m_bgtype-> insert ( rb, TabConfig::Ruled ); |
335 | gridLayout-> addWidget( rb, 0, 1 ); | 335 | gridLayout-> addWidget( rb, 0, 1 ); |
336 | 336 | ||
337 | QHBoxLayout *hb = new QHBoxLayout ( ); | 337 | QHBoxLayout *hb = new QHBoxLayout ( ); |
338 | hb-> setSpacing ( 4 ); | 338 | hb-> setSpacing ( 4 ); |
339 | 339 | ||
340 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); | 340 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); |
341 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); | 341 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); |
342 | hb-> addWidget ( rb ); | 342 | hb-> addWidget ( rb ); |
343 | hb-> addSpacing ( 10 ); | 343 | hb-> addSpacing ( 10 ); |
344 | 344 | ||
345 | m_solidcolor = new OColorButton ( tab ); | 345 | m_solidcolor = new OColorButton ( tab ); |
346 | connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); | 346 | connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); |
347 | hb-> addWidget ( m_solidcolor ); | 347 | hb-> addWidget ( m_solidcolor ); |
348 | hb-> addStretch ( 10 ); | 348 | hb-> addStretch ( 10 ); |
349 | 349 | ||
350 | gridLayout-> addLayout ( hb, 1, 1 ); | 350 | gridLayout-> addLayout ( hb, 1, 1 ); |
351 | 351 | ||
352 | hb = new QHBoxLayout ( ); | 352 | hb = new QHBoxLayout ( ); |
353 | hb-> setSpacing ( 4 ); | 353 | hb-> setSpacing ( 4 ); |
354 | 354 | ||
355 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); | 355 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); |
356 | m_bgtype-> insert ( rb, TabConfig::Image ); | 356 | m_bgtype-> insert ( rb, TabConfig::Image ); |
357 | hb-> addWidget( rb ); | 357 | hb-> addWidget( rb ); |
358 | hb-> addSpacing ( 10 ); | 358 | hb-> addSpacing ( 10 ); |
359 | 359 | ||
360 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); | 360 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); |
361 | connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); | 361 | connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); |
362 | hb-> addWidget ( m_imagebrowse ); | 362 | hb-> addWidget ( m_imagebrowse ); |
363 | hb-> addStretch ( 10 ); | 363 | hb-> addStretch ( 10 ); |
364 | 364 | ||
365 | gridLayout-> addLayout ( hb, 2, 1 ); | 365 | gridLayout-> addLayout ( hb, 2, 1 ); |
366 | 366 | ||
367 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); | 367 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); |
368 | connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); | 368 | connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); |
369 | gridLayout-> addWidget ( p, 3, 1 ); | 369 | gridLayout-> addWidget ( p, 3, 1 ); |
370 | 370 | ||
371 | connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); | 371 | connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); |
372 | 372 | ||
373 | vertLayout-> addStretch ( 10 ); | 373 | vertLayout-> addStretch ( 10 ); |
374 | 374 | ||
375 | return tab; | 375 | return tab; |
376 | } | 376 | } |
377 | 377 | ||
378 | QWidget *TabDialog::createIconTab ( QWidget *parent ) | 378 | QWidget *TabDialog::createIconTab ( QWidget *parent ) |
379 | { | 379 | { |
380 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 380 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); |
381 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 381 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); |
382 | 382 | ||
383 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 383 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
384 | gridLayout-> setColStretch ( 1, 10 ); | 384 | gridLayout-> setColStretch ( 1, 10 ); |
385 | 385 | ||
386 | QLabel* label = new QLabel( tr( "Size:" ), tab ); | 386 | QLabel* label = new QLabel( tr( "Size:" ), tab ); |
387 | gridLayout-> addWidget ( label, 0, 0 ); | 387 | gridLayout-> addWidget ( label, 0, 0 ); |
388 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); | 388 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); |
389 | m_iconsize-> hide ( ); | 389 | m_iconsize-> hide ( ); |
390 | m_iconsize-> setExclusive ( true ); | 390 | m_iconsize-> setExclusive ( true ); |
391 | 391 | ||
392 | QRadioButton *rb; | 392 | QRadioButton *rb; |
393 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); | 393 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); |
394 | m_iconsize-> insert ( rb, TabConfig::List ); | 394 | m_iconsize-> insert ( rb, TabConfig::List ); |
395 | gridLayout-> addWidget( rb, 0, 1 ); | 395 | gridLayout-> addWidget( rb, 0, 1 ); |
396 | 396 | ||
397 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); | 397 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); |
398 | m_iconsize-> insert ( rb, TabConfig::Icon ); | 398 | m_iconsize-> insert ( rb, TabConfig::Icon ); |
399 | gridLayout-> addWidget( rb, 1, 1 ); | 399 | gridLayout-> addWidget( rb, 1, 1 ); |
400 | 400 | ||
401 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); | 401 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); |
402 | 402 | ||
403 | //vertLayout-> addSpacing ( 8 ); | 403 | //vertLayout-> addSpacing ( 8 ); |
404 | 404 | ||
405 | //gridLayout = new QGridLayout ( vertLayout ); | 405 | //gridLayout = new QGridLayout ( vertLayout ); |
406 | gridLayout-> addRowSpacing ( 2, 8 ); | 406 | gridLayout-> addRowSpacing ( 2, 8 ); |
407 | 407 | ||
408 | label = new QLabel ( tr( "Color:" ), tab ); | 408 | label = new QLabel ( tr( "Color:" ), tab ); |
409 | gridLayout-> addWidget ( label, 3, 0 ); | 409 | gridLayout-> addWidget ( label, 3, 0 ); |
410 | 410 | ||
411 | m_iconcolor = new OColorButton ( tab ); | 411 | m_iconcolor = new OColorButton ( tab ); |
412 | connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); | 412 | connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); |
413 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); | 413 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); |
414 | 414 | ||
415 | vertLayout-> addStretch ( 10 ); | 415 | vertLayout-> addStretch ( 10 ); |
416 | 416 | ||
417 | return tab; | 417 | return tab; |
418 | } | 418 | } |
419 | 419 | ||
420 | 420 | ||
421 | void TabDialog::iconSizeClicked ( int s ) | 421 | void TabDialog::iconSizeClicked ( int s ) |
422 | { | 422 | { |
423 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); | 423 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); |
424 | } | 424 | } |
425 | 425 | ||
426 | void TabDialog::fontClicked ( const QFont &f ) | 426 | void TabDialog::fontClicked ( const QFont &f ) |
427 | { | 427 | { |
428 | m_sample-> setViewFont ( f ); | 428 | m_sample-> setViewFont ( f ); |
429 | } | 429 | } |
430 | 430 | ||
431 | void TabDialog::bgTypeClicked ( int t ) | 431 | void TabDialog::bgTypeClicked ( int t ) |
432 | { | 432 | { |
433 | QString s; | 433 | QString s; |
434 | 434 | ||
435 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) | 435 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) |
436 | m_bgtype-> setButton ( t ); | 436 | m_bgtype-> setButton ( t ); |
437 | 437 | ||
438 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); | 438 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); |
439 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); | 439 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); |
440 | 440 | ||
441 | if ( t == TabConfig::SolidColor ) | 441 | if ( t == TabConfig::SolidColor ) |
442 | s = m_solidcolor-> color ( ). name ( ); | 442 | s = m_solidcolor-> color ( ). name ( ); |
443 | else if ( t == TabConfig::Image ) | 443 | else if ( t == TabConfig::Image ) |
444 | s = m_bgimage; | 444 | s = Resource::findPixmap ( m_bgimage ); |
445 | 445 | ||
446 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); | 446 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); |
447 | } | 447 | } |
448 | 448 | ||
449 | void TabDialog::bgColorClicked ( const QColor & ) | 449 | void TabDialog::bgColorClicked ( const QColor & ) |
450 | { | 450 | { |
451 | bgTypeClicked ( TabConfig::SolidColor ); | 451 | bgTypeClicked ( TabConfig::SolidColor ); |
452 | } | 452 | } |
453 | 453 | ||
454 | void TabDialog::iconColorClicked ( const QColor &col ) | 454 | void TabDialog::iconColorClicked ( const QColor &col ) |
455 | { | 455 | { |
456 | m_sample-> setTextColor ( col ); | 456 | m_sample-> setTextColor ( col ); |
457 | } | 457 | } |
458 | 458 | ||
459 | void TabDialog::bgImageClicked ( ) | 459 | void TabDialog::bgImageClicked ( ) |
460 | { | 460 | { |
461 | // ### use OFileSelector here ### | 461 | // ### use OFileSelector here ### |
462 | // this is just a quick c&p from the old appearance app | 462 | // this is just a quick c&p from the old appearance app |
463 | 463 | ||
464 | MimeTypes types; | 464 | MimeTypes types; |
465 | QStringList list; | 465 | QStringList list; |
466 | list << "image/*"; | 466 | list << "image/*"; |
467 | types. insert ( "Images", list ); | 467 | types. insert ( "Images", list ); |
468 | 468 | ||
469 | QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); | 469 | QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); |
470 | if ( !file. isEmpty ( )) { | 470 | if ( !file. isEmpty ( )) { |
471 | m_bgimage = DocLnk ( file ). file ( ); | 471 | m_bgimage = DocLnk ( file ). file ( ); |
472 | bgTypeClicked ( TabConfig::Image ); | 472 | bgTypeClicked ( TabConfig::Image ); |
473 | } | 473 | } |
474 | } | 474 | } |
475 | 475 | ||
476 | void TabDialog::bgDefaultClicked ( ) | 476 | void TabDialog::bgDefaultClicked ( ) |
477 | { | 477 | { |
478 | m_bgimage = Resource::findPixmap ( "launcher/opie-background.jpg" ); | 478 | m_bgimage = "launcher/opie-background"; |
479 | bgTypeClicked ( TabConfig::Image ); | 479 | bgTypeClicked ( TabConfig::Image ); |
480 | } | 480 | } |
481 | 481 | ||
482 | void TabDialog::accept ( ) | 482 | void TabDialog::accept ( ) |
483 | { | 483 | { |
484 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); | 484 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); |
485 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); | 485 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); |
486 | m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); | 486 | m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); |
487 | m_tc. m_bg_image = m_bgimage; | 487 | m_tc. m_bg_image = m_bgimage; |
488 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); | 488 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); |
489 | m_tc. m_font_family = m_fontselect-> fontFamily ( ); | 489 | |
490 | m_tc. m_font_size = m_fontselect-> fontSize ( ); | 490 | QFont f = m_fontselect-> selectedFont ( ); |
491 | m_tc. m_font_style = m_fontselect-> fontStyle ( ); | 491 | |
492 | m_tc. m_font_family = f. family ( ); | ||
493 | m_tc. m_font_size = f. pointSize ( ); | ||
494 | m_tc. m_font_weight = f. weight ( ); | ||
495 | m_tc. m_font_italic = f. italic ( ); | ||
492 | 496 | ||
493 | QDialog::accept ( ); | 497 | QDialog::accept ( ); |
494 | } | 498 | } |
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp index 0faaea3..8f5f7fa 100644 --- a/core/settings/launcher/tabssettings.cpp +++ b/core/settings/launcher/tabssettings.cpp | |||
@@ -1,234 +1,236 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "tabssettings.h" | 28 | #include "tabssettings.h" |
29 | 29 | ||
30 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | #include <qpe/applnk.h> | 32 | #include <qpe/applnk.h> |
33 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
34 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
35 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
36 | 36 | ||
37 | #include <qlistbox.h> | 37 | #include <qlistbox.h> |
38 | #include <qpushbutton.h> | 38 | #include <qpushbutton.h> |
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
42 | 42 | ||
43 | #include "tabdialog.h" | 43 | #include "tabdialog.h" |
44 | 44 | ||
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
47 | 47 | ||
48 | 48 | ||
49 | 49 | ||
50 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) | 50 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) |
51 | : QWidget ( parent, name ) | 51 | : QWidget ( parent, name ) |
52 | { | 52 | { |
53 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); | 53 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); |
54 | 54 | ||
55 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); | 55 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); |
56 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); | 56 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); |
57 | 57 | ||
58 | m_list = new QListBox ( this ); | 58 | m_list = new QListBox ( this ); |
59 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); | 59 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); |
60 | 60 | ||
61 | QWhatsThis::add ( m_list, tr( "foobar" )); | 61 | QWhatsThis::add ( m_list, tr( "foobar" )); |
62 | 62 | ||
63 | QPushButton *p; | 63 | QPushButton *p; |
64 | p = new QPushButton ( tr( "New" ), this ); | 64 | p = new QPushButton ( tr( "New" ), this ); |
65 | lay-> addWidget ( p, 1, 1 ); | 65 | lay-> addWidget ( p, 1, 1 ); |
66 | connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); | 66 | connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); |
67 | 67 | ||
68 | p = new QPushButton ( tr( "Edit" ), this ); | 68 | p = new QPushButton ( tr( "Edit" ), this ); |
69 | lay-> addWidget ( p, 2, 1 ); | 69 | lay-> addWidget ( p, 2, 1 ); |
70 | connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); | 70 | connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); |
71 | 71 | ||
72 | p = new QPushButton ( tr( "Delete" ), this ); | 72 | p = new QPushButton ( tr( "Delete" ), this ); |
73 | lay-> addWidget ( p, 3, 1 ); | 73 | lay-> addWidget ( p, 3, 1 ); |
74 | connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); | 74 | connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); |
75 | 75 | ||
76 | lay-> setRowStretch ( 4, 10 ); | 76 | lay-> setRowStretch ( 4, 10 ); |
77 | 77 | ||
78 | init ( ); | 78 | init ( ); |
79 | } | 79 | } |
80 | 80 | ||
81 | void TabsSettings::init ( ) | 81 | void TabsSettings::init ( ) |
82 | { | 82 | { |
83 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); | 83 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); |
84 | QStringList types = rootFolder. types ( ); | 84 | QStringList types = rootFolder. types ( ); |
85 | 85 | ||
86 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { | 86 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { |
87 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); | 87 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); |
88 | m_ids << *it; | 88 | m_ids << *it; |
89 | } | 89 | } |
90 | QImage img ( Resource::loadImage ( "DocsIcon" )); | 90 | QImage img ( Resource::loadImage ( "DocsIcon" )); |
91 | QPixmap pix; | 91 | QPixmap pix; |
92 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); | 92 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); |
93 | m_list-> insertItem ( pix, tr( "Documents" )); | 93 | m_list-> insertItem ( pix, tr( "Documents" )); |
94 | m_ids += "Documents"; // No tr | 94 | m_ids += "Documents"; // No tr |
95 | 95 | ||
96 | readTabSettings ( ); | 96 | readTabSettings ( ); |
97 | } | 97 | } |
98 | 98 | ||
99 | void TabsSettings::readTabSettings ( ) | 99 | void TabsSettings::readTabSettings ( ) |
100 | { | 100 | { |
101 | Config cfg ( "Launcher" ); | 101 | Config cfg ( "Launcher" ); |
102 | QString grp ( "Tab %1" ); // No tr | 102 | QString grp ( "Tab %1" ); // No tr |
103 | m_tabs. clear ( ); | 103 | m_tabs. clear ( ); |
104 | 104 | ||
105 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 105 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
106 | TabConfig tc; | 106 | TabConfig tc; |
107 | tc. m_view = TabConfig::Icon; | 107 | tc. m_view = TabConfig::Icon; |
108 | tc. m_bg_type = TabConfig::Ruled; | 108 | tc. m_bg_type = TabConfig::Ruled; |
109 | tc. m_changed = false; | 109 | tc. m_changed = false; |
110 | 110 | ||
111 | cfg. setGroup ( grp. arg ( *it )); | 111 | cfg. setGroup ( grp. arg ( *it )); |
112 | 112 | ||
113 | QString view = cfg. readEntry ( "View", "Icon" ); | 113 | QString view = cfg. readEntry ( "View", "Icon" ); |
114 | if ( view == "List" ) // No tr | 114 | if ( view == "List" ) // No tr |
115 | tc. m_view = TabConfig::List; | 115 | tc. m_view = TabConfig::List; |
116 | 116 | ||
117 | QString bgType = cfg. readEntry ( "BackgroundType", "Ruled" ); | 117 | QString bgType = cfg. readEntry ( "BackgroundType", "Image" ); |
118 | if ( bgType == "SolidColor" ) | 118 | if ( bgType == "SolidColor" ) |
119 | tc. m_bg_type = TabConfig::SolidColor; | 119 | tc. m_bg_type = TabConfig::SolidColor; |
120 | else if ( bgType == "Image" ) // No tr | 120 | else if ( bgType == "Image" ) // No tr |
121 | tc. m_bg_type = TabConfig::Image; | 121 | tc. m_bg_type = TabConfig::Image; |
122 | 122 | ||
123 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "wallpaper/opie" ); | 123 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "launcher/opie-background" ); |
124 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( )); | 124 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( )); |
125 | tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( )); | 125 | tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( )); |
126 | QStringList f = cfg. readListEntry ( "Font", ',' ); | 126 | QStringList f = cfg. readListEntry ( "Font", ',' ); |
127 | if ( f. count ( ) == 4 ) { | 127 | if ( f. count ( ) == 4 ) { |
128 | tc. m_font_family = f [0]; | 128 | tc. m_font_family = f [0]; |
129 | tc. m_font_size = f [1]. toInt ( ); | 129 | tc. m_font_size = f [1]. toInt ( ); |
130 | tc. m_font_style = f [2]; | 130 | tc. m_font_weight = f [2]. toInt ( ); |
131 | tc. m_font_italic = ( f [3]. toInt ( )); | ||
131 | } else { | 132 | } else { |
132 | tc. m_font_family = font ( ). family ( ); | 133 | tc. m_font_family = font ( ). family ( ); |
133 | tc. m_font_size = font ( ). pointSize ( ); | 134 | tc. m_font_size = font ( ). pointSize ( ); |
134 | tc. m_font_style = "Regular"; | 135 | tc. m_font_weight = 50; |
136 | tc. m_font_italic = false; | ||
135 | } | 137 | } |
136 | m_tabs [*it] = tc; | 138 | m_tabs [*it] = tc; |
137 | } | 139 | } |
138 | } | 140 | } |
139 | 141 | ||
140 | 142 | ||
141 | void TabsSettings::accept ( ) | 143 | void TabsSettings::accept ( ) |
142 | { | 144 | { |
143 | Config cfg ( "Launcher" ); | 145 | Config cfg ( "Launcher" ); |
144 | 146 | ||
145 | // Launcher Tab | 147 | // Launcher Tab |
146 | QString grp ( "Tab %1" ); // No tr | 148 | QString grp ( "Tab %1" ); // No tr |
147 | 149 | ||
148 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 150 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
149 | TabConfig &tc = m_tabs [*it]; | 151 | TabConfig &tc = m_tabs [*it]; |
150 | 152 | ||
151 | cfg. setGroup ( grp. arg ( *it )); | 153 | cfg. setGroup ( grp. arg ( *it )); |
152 | if ( !tc. m_changed ) | 154 | if ( !tc. m_changed ) |
153 | continue; | 155 | continue; |
154 | switch ( tc. m_view ) { | 156 | switch ( tc. m_view ) { |
155 | case TabConfig::Icon: | 157 | case TabConfig::Icon: |
156 | cfg.writeEntry ( "View", "Icon" ); | 158 | cfg.writeEntry ( "View", "Icon" ); |
157 | break; | 159 | break; |
158 | case TabConfig::List: | 160 | case TabConfig::List: |
159 | cfg.writeEntry ( "View", "List" ); | 161 | cfg.writeEntry ( "View", "List" ); |
160 | break; | 162 | break; |
161 | } | 163 | } |
162 | 164 | ||
163 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); | 165 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); |
164 | e << *it << tc. m_view; | 166 | e << *it << tc. m_view; |
165 | 167 | ||
166 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); | 168 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); |
167 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); | 169 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); |
168 | cfg. writeEntry ( "TextColor", tc. m_text_color ); | 170 | cfg. writeEntry ( "TextColor", tc. m_text_color ); |
169 | 171 | ||
170 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + tc. m_font_style + ",0"; | 172 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); |
171 | cfg. writeEntry ( "Font", f ); | 173 | cfg. writeEntry ( "Font", f ); |
172 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); | 174 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); |
173 | 175 | ||
174 | switch ( tc. m_bg_type ) { | 176 | switch ( tc. m_bg_type ) { |
175 | case TabConfig::Ruled: | 177 | case TabConfig::Ruled: |
176 | cfg.writeEntry( "BackgroundType", "Ruled" ); | 178 | cfg.writeEntry( "BackgroundType", "Ruled" ); |
177 | be << *it << tc. m_bg_type << QString(""); | 179 | be << *it << tc. m_bg_type << QString(""); |
178 | break; | 180 | break; |
179 | case TabConfig::SolidColor: | 181 | case TabConfig::SolidColor: |
180 | cfg.writeEntry( "BackgroundType", "SolidColor" ); | 182 | cfg.writeEntry( "BackgroundType", "SolidColor" ); |
181 | be << *it << tc. m_bg_type << tc. m_bg_color; | 183 | be << *it << tc. m_bg_type << tc. m_bg_color; |
182 | break; | 184 | break; |
183 | case TabConfig::Image: | 185 | case TabConfig::Image: |
184 | cfg.writeEntry( "BackgroundType", "Image" ); | 186 | cfg.writeEntry( "BackgroundType", "Image" ); |
185 | be << *it << tc. m_bg_type << tc. m_bg_image; | 187 | be << *it << tc. m_bg_type << tc. m_bg_image; |
186 | break; | 188 | break; |
187 | } | 189 | } |
188 | 190 | ||
189 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); | 191 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); |
190 | te << *it << tc. m_text_color; | 192 | te << *it << tc. m_text_color; |
191 | 193 | ||
192 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); | 194 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); |
193 | fe << *it << tc. m_font_family; | 195 | fe << *it << tc. m_font_family; |
194 | fe << tc. m_font_size; | 196 | fe << tc. m_font_size; |
195 | fe << 50 << 0; | 197 | fe << tc. m_font_weight << ( tc. m_font_italic ? 1 : 0 ); |
196 | 198 | ||
197 | tc. m_changed = false; | 199 | tc. m_changed = false; |
198 | } | 200 | } |
199 | } | 201 | } |
200 | 202 | ||
201 | void TabsSettings::newClicked ( ) | 203 | void TabsSettings::newClicked ( ) |
202 | { | 204 | { |
203 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 205 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
204 | } | 206 | } |
205 | 207 | ||
206 | void TabsSettings::deleteClicked ( ) | 208 | void TabsSettings::deleteClicked ( ) |
207 | { | 209 | { |
208 | int ind = m_list-> currentItem ( ); | 210 | int ind = m_list-> currentItem ( ); |
209 | 211 | ||
210 | if ( ind < 0 ) | 212 | if ( ind < 0 ) |
211 | return; | 213 | return; |
212 | 214 | ||
213 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 215 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
214 | } | 216 | } |
215 | 217 | ||
216 | void TabsSettings::editClicked ( ) | 218 | void TabsSettings::editClicked ( ) |
217 | { | 219 | { |
218 | int ind = m_list-> currentItem ( ); | 220 | int ind = m_list-> currentItem ( ); |
219 | 221 | ||
220 | if ( ind < 0 ) | 222 | if ( ind < 0 ) |
221 | return; | 223 | return; |
222 | 224 | ||
223 | TabConfig tc = m_tabs [m_ids [ind]]; | 225 | TabConfig tc = m_tabs [m_ids [ind]]; |
224 | 226 | ||
225 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); | 227 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); |
226 | 228 | ||
227 | d-> showMaximized ( ); | 229 | d-> showMaximized ( ); |
228 | if ( d-> exec ( ) == QDialog::Accepted ) { | 230 | if ( d-> exec ( ) == QDialog::Accepted ) { |
229 | tc. m_changed = true; | 231 | tc. m_changed = true; |
230 | m_tabs [m_ids [ind]] = tc; | 232 | m_tabs [m_ids [ind]] = tc; |
231 | } | 233 | } |
232 | 234 | ||
233 | delete d; | 235 | delete d; |
234 | } | 236 | } |