author | drw <drw> | 2005-03-12 00:49:08 (UTC) |
---|---|---|
committer | drw <drw> | 2005-03-12 00:49:08 (UTC) |
commit | 9ae22dd605f8de697c5c8d98e114a3701d8774fb (patch) (unidiff) | |
tree | 718a4ee9e4cfca8f437d2e59d2b867f7cac61e07 /core | |
parent | c7cda5d104efd75ab608384215e40a541697392e (diff) | |
download | opie-9ae22dd605f8de697c5c8d98e114a3701d8774fb.zip opie-9ae22dd605f8de697c5c8d98e114a3701d8774fb.tar.gz opie-9ae22dd605f8de697c5c8d98e114a3701d8774fb.tar.bz2 |
Fix default settings for background in Edit tab dialog
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index bd51628..555e64e 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -159,16 +159,9 @@ public: | |||
159 | 159 | ||
160 | case TabConfig::Image: { | 160 | case TabConfig::Image: { |
161 | odebug << "Loading image: " << val << "" << oendl; | 161 | odebug << "Loading image: " << val << "" << oendl; |
162 | QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); | 162 | QPixmap bg = Resource::loadPixmap ( val ); |
163 | if ( bg. isNull ( )) { | 163 | if ( bg. isNull () ) |
164 | QImageIO imgio; | 164 | bg = QPixmap( val ); |
165 | imgio. setFileName ( val ); | ||
166 | QSize ds = qApp-> desktop ( )-> size ( ); | ||
167 | QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr | ||
168 | imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); | ||
169 | imgio. read ( ); | ||
170 | bg = imgio. image ( ); | ||
171 | } | ||
172 | setBackgroundPixmap ( bg ); | 165 | setBackgroundPixmap ( bg ); |
173 | break; | 166 | break; |
174 | } | 167 | } |
@@ -299,20 +292,20 @@ TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig | |||
299 | lay-> addWidget ( tw, 10 ); | 292 | lay-> addWidget ( tw, 10 ); |
300 | lay-> addWidget ( sample, 1 ); | 293 | lay-> addWidget ( sample, 1 ); |
301 | 294 | ||
302 | m_iconsize-> setButton ( tc. m_view ); | ||
303 | iconSizeClicked ( tc. m_view ); | ||
304 | //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); | ||
305 | iconColorClicked ( m_iconcolor-> color ( )); | ||
306 | m_bgtype-> setButton ( tc. m_bg_type ); | ||
307 | //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); | ||
308 | m_iconcolumns->setValue( tc. m_iconcolumns ); | ||
309 | m_bgimage = tc. m_bg_image; | 295 | m_bgimage = tc. m_bg_image; |
310 | bgTypeClicked ( tc. m_bg_type ); | 296 | m_bgtype-> setButton ( tc. m_bg_type ); |
297 | bgTypeClicked( tc.m_bg_type ); | ||
298 | |||
311 | m_fontuse-> setChecked ( tc. m_font_use ); | 299 | m_fontuse-> setChecked ( tc. m_font_use ); |
312 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); | 300 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); |
313 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); | 301 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); |
314 | fontClicked ( m_fontselect-> selectedFont ( )); | 302 | fontClicked ( m_fontselect-> selectedFont ( )); |
315 | 303 | ||
304 | m_iconsize-> setButton ( tc. m_view ); | ||
305 | iconSizeClicked ( tc. m_view ); | ||
306 | iconColorClicked ( m_iconcolor-> color ( )); | ||
307 | m_iconcolumns->setValue( tc. m_iconcolumns ); | ||
308 | |||
316 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); | 309 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); |
317 | } | 310 | } |
318 | 311 | ||
@@ -352,6 +345,7 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) | |||
352 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); | 345 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); |
353 | m_bgtype-> hide ( ); | 346 | m_bgtype-> hide ( ); |
354 | m_bgtype-> setExclusive ( true ); | 347 | m_bgtype-> setExclusive ( true ); |
348 | connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int))); | ||
355 | 349 | ||
356 | QRadioButton *rb; | 350 | QRadioButton *rb; |
357 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); | 351 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); |
@@ -392,8 +386,6 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) | |||
392 | connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked())); | 386 | connect ( p, SIGNAL( clicked()), this, SLOT( bgDefaultClicked())); |
393 | gridLayout-> addWidget ( p, 3, 1 ); | 387 | gridLayout-> addWidget ( p, 3, 1 ); |
394 | 388 | ||
395 | connect ( m_bgtype, SIGNAL( clicked(int)), this, SLOT( bgTypeClicked(int))); | ||
396 | |||
397 | vertLayout-> addStretch ( 10 ); | 389 | vertLayout-> addStretch ( 10 ); |
398 | 390 | ||
399 | return tab; | 391 | return tab; |
@@ -461,24 +453,20 @@ void TabDialog::fontClicked ( const QFont &f ) | |||
461 | void TabDialog::bgTypeClicked ( int t ) | 453 | void TabDialog::bgTypeClicked ( int t ) |
462 | { | 454 | { |
463 | QString s; | 455 | QString s; |
464 | |||
465 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) | ||
466 | m_bgtype-> setButton ( t ); | ||
467 | |||
468 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); | 456 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); |
469 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); | 457 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); |
470 | 458 | ||
471 | if ( t == TabConfig::SolidColor ) | 459 | if ( t == TabConfig::SolidColor ) |
472 | s = m_solidcolor-> color ( ). name ( ); | 460 | s = m_solidcolor-> color ( ). name ( ); |
473 | else if ( t == TabConfig::Image ) | 461 | else if ( t == TabConfig::Image ) |
474 | s = Resource::findPixmap ( m_bgimage ); | 462 | s = m_bgimage; |
475 | 463 | ||
476 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); | 464 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); |
477 | } | 465 | } |
478 | 466 | ||
479 | void TabDialog::bgColorClicked ( const QColor & ) | 467 | void TabDialog::bgColorClicked ( const QColor & ) |
480 | { | 468 | { |
481 | bgTypeClicked ( TabConfig::SolidColor ); | 469 | m_sample-> setBackgroundType ( TabConfig::SolidColor, m_solidcolor-> color ( ). name ( ) ); |
482 | } | 470 | } |
483 | 471 | ||
484 | void TabDialog::iconColorClicked ( const QColor &col ) | 472 | void TabDialog::iconColorClicked ( const QColor &col ) |
@@ -501,14 +489,16 @@ void TabDialog::bgImageClicked ( ) | |||
501 | if ( !file. isEmpty ( )) { | 489 | if ( !file. isEmpty ( )) { |
502 | m_tc.m_last_directory = QFileInfo( file ).dirPath(); | 490 | m_tc.m_last_directory = QFileInfo( file ).dirPath(); |
503 | m_bgimage = DocLnk ( file ). file ( ); | 491 | m_bgimage = DocLnk ( file ). file ( ); |
504 | bgTypeClicked ( TabConfig::Image ); | 492 | m_sample-> setBackgroundType ( TabConfig::Image, m_bgimage ); |
505 | } | 493 | } |
506 | } | 494 | } |
507 | 495 | ||
508 | void TabDialog::bgDefaultClicked ( ) | 496 | void TabDialog::bgDefaultClicked ( ) |
509 | { | 497 | { |
498 | m_bgtype-> setButton ( TabConfig::Image ); | ||
510 | m_bgimage = "launcher/opie-background"; | 499 | m_bgimage = "launcher/opie-background"; |
511 | bgTypeClicked ( TabConfig::Image ); | 500 | bgTypeClicked( TabConfig::Image ); |
501 | //m_sample-> setBackgroundType ( TabConfig::Image, m_bgimage ); | ||
512 | } | 502 | } |
513 | 503 | ||
514 | void TabDialog::accept ( ) | 504 | void TabDialog::accept ( ) |