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/settings/launcher/tabdialog.cpp | |
parent | c7cda5d104efd75ab608384215e40a541697392e (diff) | |
download | opie-9ae22dd605f8de697c5c8d98e114a3701d8774fb.zip opie-9ae22dd605f8de697c5c8d98e114a3701d8774fb.tar.gz opie-9ae22dd605f8de697c5c8d98e114a3701d8774fb.tar.bz2 |
Fix default settings for background in Edit tab dialog
Diffstat (limited to 'core/settings/launcher/tabdialog.cpp') (more/less context) (ignore whitespace changes)
-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 | |||
@@ -156,22 +156,15 @@ public: | |||
156 | setBackgroundColor ( val ); | 156 | setBackgroundColor ( val ); |
157 | break; | 157 | break; |
158 | } | 158 | } |
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 | } |
175 | } | 168 | } |
176 | m_bgtype = t; | 169 | m_bgtype = t; |
177 | viewport ( )-> update ( ); | 170 | viewport ( )-> update ( ); |
@@ -296,26 +289,26 @@ TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig | |||
296 | 289 | ||
297 | m_sample = new SampleView ( sample ); | 290 | m_sample = new SampleView ( sample ); |
298 | 291 | ||
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 | ||
319 | 312 | ||
320 | TabDialog::~TabDialog ( ) | 313 | TabDialog::~TabDialog ( ) |
321 | { | 314 | { |
@@ -349,12 +342,13 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) | |||
349 | 342 | ||
350 | QLabel* label = new QLabel( tr( "Type:" ), tab ); | 343 | QLabel* label = new QLabel( tr( "Type:" ), tab ); |
351 | gridLayout-> addWidget ( label, 0, 0 ); | 344 | gridLayout-> addWidget ( label, 0, 0 ); |
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" ); |
358 | m_bgtype-> insert ( rb, TabConfig::Ruled ); | 352 | m_bgtype-> insert ( rb, TabConfig::Ruled ); |
359 | gridLayout-> addWidget( rb, 0, 1 ); | 353 | gridLayout-> addWidget( rb, 0, 1 ); |
360 | 354 | ||
@@ -389,14 +383,12 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) | |||
389 | gridLayout-> addLayout ( hb, 2, 1 ); | 383 | gridLayout-> addLayout ( hb, 2, 1 ); |
390 | 384 | ||
391 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); | 385 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); |
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; |
400 | } | 392 | } |
401 | 393 | ||
402 | QWidget *TabDialog::createIconTab ( QWidget *parent ) | 394 | QWidget *TabDialog::createIconTab ( QWidget *parent ) |
@@ -458,30 +450,26 @@ void TabDialog::fontClicked ( const QFont &f ) | |||
458 | m_sample-> setViewFont ( f ); | 450 | m_sample-> setViewFont ( f ); |
459 | } | 451 | } |
460 | 452 | ||
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 ) |
485 | { | 473 | { |
486 | m_sample-> setTextColor ( col ); | 474 | m_sample-> setTextColor ( col ); |
487 | } | 475 | } |
@@ -498,20 +486,22 @@ void TabDialog::bgImageClicked ( ) | |||
498 | 486 | ||
499 | QString file = OFileDialog::getOpenFileName ( 1, m_tc.m_last_directory, QString::null, types ); | 487 | QString file = OFileDialog::getOpenFileName ( 1, m_tc.m_last_directory, QString::null, types ); |
500 | 488 | ||
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 ( ) |
515 | { | 505 | { |
516 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); | 506 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); |
517 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); | 507 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); |