-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 30 | ||||
-rw-r--r-- | noncore/settings/appearance2/appearance.h | 3 |
2 files changed, 33 insertions, 0 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index db863d6..32234f0 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -307,284 +307,314 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
307 | m_except-> setAllColumnsShowFocus ( true ); | 307 | m_except-> setAllColumnsShowFocus ( true ); |
308 | m_except-> setMinimumHeight ( 30 ); | 308 | m_except-> setMinimumHeight ( 30 ); |
309 | m_except-> header ( )-> setClickEnabled ( false ); | 309 | m_except-> header ( )-> setClickEnabled ( false ); |
310 | m_except-> header ( )-> setResizeEnabled ( false ); | 310 | m_except-> header ( )-> setResizeEnabled ( false ); |
311 | m_except-> header ( )-> setMovingEnabled ( false ); | 311 | m_except-> header ( )-> setMovingEnabled ( false ); |
312 | m_except-> setSorting ( -1 ); | 312 | m_except-> setSorting ( -1 ); |
313 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); | 313 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); |
314 | QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); | 314 | QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); |
315 | 315 | ||
316 | connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); | 316 | connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); |
317 | 317 | ||
318 | QToolButton *tb = new QToolButton ( tab ); | 318 | QToolButton *tb = new QToolButton ( tab ); |
319 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); | 319 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); |
320 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 320 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
321 | lay-> addWidget ( tb, 2, 1 ); | 321 | lay-> addWidget ( tb, 2, 1 ); |
322 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); | 322 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); |
323 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); | 323 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); |
324 | 324 | ||
325 | tb = new QToolButton ( tab ); | 325 | tb = new QToolButton ( tab ); |
326 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); | 326 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); |
327 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 327 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
328 | lay-> addWidget ( tb, 3, 1 ); | 328 | lay-> addWidget ( tb, 3, 1 ); |
329 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); | 329 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); |
330 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); | 330 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); |
331 | 331 | ||
332 | tb = new QToolButton ( tab ); | 332 | tb = new QToolButton ( tab ); |
333 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); | 333 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); |
334 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 334 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
335 | lay-> addWidget ( tb, 4, 1 ); | 335 | lay-> addWidget ( tb, 4, 1 ); |
336 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); | 336 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); |
337 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); | 337 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); |
338 | 338 | ||
339 | tb = new QToolButton ( tab ); | 339 | tb = new QToolButton ( tab ); |
340 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); | 340 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); |
341 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 341 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
342 | lay-> addWidget ( tb, 5, 1 ); | 342 | lay-> addWidget ( tb, 5, 1 ); |
343 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); | 343 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); |
344 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); | 344 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); |
345 | 345 | ||
346 | lay-> setRowStretch ( 6, 10 ); | 346 | lay-> setRowStretch ( 6, 10 ); |
347 | lay-> setColStretch ( 0, 10 ); | 347 | lay-> setColStretch ( 0, 10 ); |
348 | 348 | ||
349 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); | 349 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); |
350 | QListViewItem *lvit = 0; | 350 | QListViewItem *lvit = 0; |
351 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 351 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { |
352 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 352 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
353 | 353 | ||
354 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); | 354 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); |
355 | } | 355 | } |
356 | 356 | ||
357 | 357 | ||
358 | vertLayout-> addSpacing ( 3 ); | 358 | vertLayout-> addSpacing ( 3 ); |
359 | QFrame *f = new QFrame ( tab ); | 359 | QFrame *f = new QFrame ( tab ); |
360 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | 360 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); |
361 | vertLayout-> addWidget ( f ); | 361 | vertLayout-> addWidget ( f ); |
362 | vertLayout-> addSpacing ( 3 ); | 362 | vertLayout-> addSpacing ( 3 ); |
363 | 363 | ||
364 | 364 | ||
365 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 365 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
366 | 366 | ||
367 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; | 367 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; |
368 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); | 368 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); |
369 | 369 | ||
370 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); | 370 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); |
371 | gridLayout-> addWidget ( label, 0, 0 ); | 371 | gridLayout-> addWidget ( label, 0, 0 ); |
372 | QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); | 372 | QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); |
373 | 373 | ||
374 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); | 374 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); |
375 | btngrp-> hide ( ); | 375 | btngrp-> hide ( ); |
376 | btngrp-> setExclusive ( true ); | 376 | btngrp-> setExclusive ( true ); |
377 | 377 | ||
378 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); | 378 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); |
379 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); | 379 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); |
380 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); | 380 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); |
381 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); | 381 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); |
382 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); | 382 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); |
383 | m_tabstyle_list-> setCurrentItem ( style ); | 383 | m_tabstyle_list-> setCurrentItem ( style ); |
384 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 384 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); |
385 | QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); | 385 | QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); |
386 | 386 | ||
387 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); | 387 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); |
388 | btngrp-> insert ( m_tabstyle_top ); | 388 | btngrp-> insert ( m_tabstyle_top ); |
389 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); | 389 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); |
390 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); | 390 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); |
391 | 391 | ||
392 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); | 392 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); |
393 | btngrp-> insert ( m_tabstyle_bottom ); | 393 | btngrp-> insert ( m_tabstyle_bottom ); |
394 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); | 394 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); |
395 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); | 395 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); |
396 | 396 | ||
397 | m_tabstyle_top-> setChecked ( tabtop ); | 397 | m_tabstyle_top-> setChecked ( tabtop ); |
398 | m_tabstyle_bottom-> setChecked ( !tabtop ); | 398 | m_tabstyle_bottom-> setChecked ( !tabtop ); |
399 | 399 | ||
400 | m_original_tabstyle = style; | 400 | m_original_tabstyle = style; |
401 | m_original_tabpos = tabtop; | 401 | m_original_tabpos = tabtop; |
402 | 402 | ||
403 | vertLayout-> addSpacing ( 3 ); | ||
404 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); | ||
405 | |||
406 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); | ||
407 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); | ||
408 | QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); | ||
409 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); | ||
410 | QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); | ||
411 | QPixmap ccw1; | ||
412 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); | ||
413 | |||
414 | rotbtngrp-> hide ( ); | ||
415 | rotbtngrp-> setExclusive ( true ); | ||
416 | rotbtngrp-> insert ( m_rotdir_cw ); | ||
417 | rotbtngrp-> insert ( m_rotdir_ccw ); | ||
418 | |||
419 | ccw1. convertFromImage( ccwImage ); | ||
420 | m_rotdir_cw-> setPixmap( cw1 ); | ||
421 | m_rotdir_ccw-> setPixmap( ccw1 ); | ||
422 | |||
423 | rotLay-> addWidget ( rotlabel, 0 ); | ||
424 | rotLay-> addWidget ( m_rotdir_cw, 0 ); | ||
425 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); | ||
426 | |||
427 | bool rotcw = !(cfg. readBoolEntry ( "rotatedir", 0 )); | ||
428 | m_rotdir_cw-> setChecked ( rotcw ); | ||
429 | m_rotdir_ccw-> setChecked ( !rotcw ); | ||
430 | |||
403 | return tab; | 431 | return tab; |
404 | } | 432 | } |
405 | 433 | ||
406 | 434 | ||
407 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 435 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
408 | : QDialog ( parent, name, true, WStyle_ContextHelp ) | 436 | : QDialog ( parent, name, true, WStyle_ContextHelp ) |
409 | { | 437 | { |
410 | setCaption( tr( "Appearance Settings" ) ); | 438 | setCaption( tr( "Appearance Settings" ) ); |
411 | 439 | ||
412 | Config config( "qpe" ); | 440 | Config config( "qpe" ); |
413 | config.setGroup( "Appearance" ); | 441 | config.setGroup( "Appearance" ); |
414 | 442 | ||
415 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); | 443 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); |
416 | 444 | ||
417 | m_sample = new SampleWindow ( this ); | 445 | m_sample = new SampleWindow ( this ); |
418 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 446 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
419 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 447 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
420 | 448 | ||
421 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 449 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
422 | QWidget *styletab; | 450 | QWidget *styletab; |
423 | 451 | ||
424 | m_color_list = 0; | 452 | m_color_list = 0; |
425 | 453 | ||
426 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); | 454 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); |
427 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); | 455 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); |
428 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); | 456 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); |
429 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); | 457 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); |
430 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); | 458 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); |
431 | 459 | ||
432 | top-> addWidget ( tw, 10 ); | 460 | top-> addWidget ( tw, 10 ); |
433 | top-> addWidget ( m_sample, 1 ); | 461 | top-> addWidget ( m_sample, 1 ); |
434 | 462 | ||
435 | tw-> setCurrentTab ( styletab ); | 463 | tw-> setCurrentTab ( styletab ); |
436 | connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); | 464 | connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); |
437 | 465 | ||
438 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; | 466 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; |
439 | } | 467 | } |
440 | 468 | ||
441 | Appearance::~Appearance() | 469 | Appearance::~Appearance() |
442 | { | 470 | { |
443 | } | 471 | } |
444 | 472 | ||
445 | void Appearance::tabChanged ( QWidget *w ) | 473 | void Appearance::tabChanged ( QWidget *w ) |
446 | { | 474 | { |
447 | if ( w == m_advtab ) { | 475 | if ( w == m_advtab ) { |
448 | m_sample-> hide ( ); | 476 | m_sample-> hide ( ); |
449 | updateGeometry ( ); // shouldn't be necessary ... | 477 | updateGeometry ( ); // shouldn't be necessary ... |
450 | } | 478 | } |
451 | else | 479 | else |
452 | m_sample-> show ( ); | 480 | m_sample-> show ( ); |
453 | } | 481 | } |
454 | 482 | ||
455 | void Appearance::accept ( ) | 483 | void Appearance::accept ( ) |
456 | { | 484 | { |
457 | bool newtabpos = m_tabstyle_top-> isChecked ( ); | 485 | bool newtabpos = m_tabstyle_top-> isChecked ( ); |
486 | bool is_rotdir_ccw = m_rotdir_ccw-> isChecked ( ); | ||
458 | int newtabstyle = m_tabstyle_list-> currentItem ( ); | 487 | int newtabstyle = m_tabstyle_list-> currentItem ( ); |
459 | 488 | ||
460 | Config config ( "qpe" ); | 489 | Config config ( "qpe" ); |
461 | config. setGroup ( "Appearance" ); | 490 | config. setGroup ( "Appearance" ); |
462 | 491 | ||
463 | if ( m_style_changed ) { | 492 | if ( m_style_changed ) { |
464 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 493 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
465 | if ( item ) | 494 | if ( item ) |
466 | config.writeEntry( "Style", item-> key ( )); | 495 | config.writeEntry( "Style", item-> key ( )); |
467 | } | 496 | } |
468 | 497 | ||
469 | if ( m_deco_changed ) { | 498 | if ( m_deco_changed ) { |
470 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); | 499 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); |
471 | if ( item ) | 500 | if ( item ) |
472 | config.writeEntry( "Decoration", item-> key ( )); | 501 | config.writeEntry( "Decoration", item-> key ( )); |
473 | } | 502 | } |
474 | 503 | ||
475 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { | 504 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { |
476 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | 505 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); |
477 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); | 506 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); |
478 | } | 507 | } |
479 | 508 | ||
480 | if ( m_font_changed ) { | 509 | if ( m_font_changed ) { |
481 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); | 510 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); |
482 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); | 511 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); |
483 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); | 512 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); |
484 | } | 513 | } |
485 | 514 | ||
486 | 515 | ||
487 | if ( m_color_changed ) | 516 | if ( m_color_changed ) |
488 | { | 517 | { |
489 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 518 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
490 | 519 | ||
491 | if ( item ) | 520 | if ( item ) |
492 | item-> save ( config ); | 521 | item-> save ( config ); |
493 | } | 522 | } |
494 | 523 | ||
524 | config. writeEntry ( "rotatedir", is_rotdir_ccw ); | ||
495 | 525 | ||
496 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated | 526 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated |
497 | 527 | ||
498 | QStringList sl; | 528 | QStringList sl; |
499 | QString exceptstr; | 529 | QString exceptstr; |
500 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { | 530 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { |
501 | int fl = 0; | 531 | int fl = 0; |
502 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); | 532 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); |
503 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); | 533 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); |
504 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); | 534 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); |
505 | exceptstr = QString::number ( fl, 32 ); | 535 | exceptstr = QString::number ( fl, 32 ); |
506 | exceptstr.append( it-> pattern ( )); | 536 | exceptstr.append( it-> pattern ( )); |
507 | sl << exceptstr; | 537 | sl << exceptstr; |
508 | } | 538 | } |
509 | config. writeEntry ( "NoStyle", sl, ';' ); | 539 | config. writeEntry ( "NoStyle", sl, ';' ); |
510 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); | 540 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); |
511 | 541 | ||
512 | config. write ( ); // need to flush the config info first | 542 | config. write ( ); // need to flush the config info first |
513 | Global::applyStyle ( ); | 543 | Global::applyStyle ( ); |
514 | 544 | ||
515 | if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart %1 now?" ). arg ( ODevice::inst ( )-> system ( ) == System_Zaurus ? "Qtopia" : "Opie" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { | 545 | if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart %1 now?" ). arg ( ODevice::inst ( )-> system ( ) == System_Zaurus ? "Qtopia" : "Opie" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { |
516 | QCopEnvelope e( "QPE/System", "restart()" ); | 546 | QCopEnvelope e( "QPE/System", "restart()" ); |
517 | } | 547 | } |
518 | 548 | ||
519 | QDialog::accept ( ); | 549 | QDialog::accept ( ); |
520 | } | 550 | } |
521 | 551 | ||
522 | void Appearance::done ( int r ) | 552 | void Appearance::done ( int r ) |
523 | { | 553 | { |
524 | QDialog::done ( r ); | 554 | QDialog::done ( r ); |
525 | close ( ); | 555 | close ( ); |
526 | } | 556 | } |
527 | 557 | ||
528 | 558 | ||
529 | void Appearance::styleClicked ( int index ) | 559 | void Appearance::styleClicked ( int index ) |
530 | { | 560 | { |
531 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); | 561 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); |
532 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); | 562 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); |
533 | 563 | ||
534 | if ( m_sample && sli && sli-> style ( )) { | 564 | if ( m_sample && sli && sli-> style ( )) { |
535 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; | 565 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; |
536 | 566 | ||
537 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); | 567 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); |
538 | } | 568 | } |
539 | 569 | ||
540 | m_style_changed |= ( index != m_original_style ); | 570 | m_style_changed |= ( index != m_original_style ); |
541 | } | 571 | } |
542 | 572 | ||
543 | void Appearance::styleSettingsClicked ( ) | 573 | void Appearance::styleSettingsClicked ( ) |
544 | { | 574 | { |
545 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 575 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
546 | 576 | ||
547 | if ( item && item-> hasSettings ( )) { | 577 | if ( item && item-> hasSettings ( )) { |
548 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); | 578 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); |
549 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); | 579 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); |
550 | 580 | ||
551 | QWidget *w = item-> settings ( d ); | 581 | QWidget *w = item-> settings ( d ); |
552 | 582 | ||
553 | if ( w ) { | 583 | if ( w ) { |
554 | vbox-> addWidget ( w ); | 584 | vbox-> addWidget ( w ); |
555 | 585 | ||
556 | d-> setCaption ( w-> caption ( )); | 586 | d-> setCaption ( w-> caption ( )); |
557 | 587 | ||
558 | d-> showMaximized ( ); | 588 | d-> showMaximized ( ); |
559 | bool accepted = ( d-> exec ( ) == QDialog::Accepted ); | 589 | bool accepted = ( d-> exec ( ) == QDialog::Accepted ); |
560 | 590 | ||
561 | if ( item-> setSettings ( accepted )) | 591 | if ( item-> setSettings ( accepted )) |
562 | m_style_changed = true; | 592 | m_style_changed = true; |
563 | } | 593 | } |
564 | delete d; | 594 | delete d; |
565 | } | 595 | } |
566 | } | 596 | } |
567 | 597 | ||
568 | void Appearance::decoClicked ( int index ) | 598 | void Appearance::decoClicked ( int index ) |
569 | { | 599 | { |
570 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); | 600 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); |
571 | 601 | ||
572 | if ( m_sample ) { | 602 | if ( m_sample ) { |
573 | if ( dli && dli-> interface ( )) | 603 | if ( dli && dli-> interface ( )) |
574 | m_sample-> setDecoration ( dli-> interface ( )); | 604 | m_sample-> setDecoration ( dli-> interface ( )); |
575 | else | 605 | else |
576 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 606 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
577 | m_sample-> repaint ( ); | 607 | m_sample-> repaint ( ); |
578 | } | 608 | } |
579 | m_deco_changed |= ( index != m_original_deco ); | 609 | m_deco_changed |= ( index != m_original_deco ); |
580 | } | 610 | } |
581 | 611 | ||
582 | void Appearance::fontClicked ( const QFont &f ) | 612 | void Appearance::fontClicked ( const QFont &f ) |
583 | { | 613 | { |
584 | m_font_changed |= ( f != m_sample-> font ( )); | 614 | m_font_changed |= ( f != m_sample-> font ( )); |
585 | m_sample-> setFont ( f ); | 615 | m_sample-> setFont ( f ); |
586 | } | 616 | } |
587 | 617 | ||
588 | void Appearance::colorClicked ( int index ) | 618 | void Appearance::colorClicked ( int index ) |
589 | { | 619 | { |
590 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); | 620 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); |
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h index 065dfb7..0e42298 100644 --- a/noncore/settings/appearance2/appearance.h +++ b/noncore/settings/appearance2/appearance.h | |||
@@ -22,102 +22,105 @@ | |||
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef APPEARANCESETTINGS_H | 29 | #ifndef APPEARANCESETTINGS_H |
30 | #define APPEARANCESETTINGS_H | 30 | #define APPEARANCESETTINGS_H |
31 | 31 | ||
32 | #include <qpe/fontdatabase.h> | 32 | #include <qpe/fontdatabase.h> |
33 | 33 | ||
34 | #include <qdialog.h> | 34 | #include <qdialog.h> |
35 | 35 | ||
36 | class QCheckBox; | 36 | class QCheckBox; |
37 | class QComboBox; | 37 | class QComboBox; |
38 | class QLabel; | 38 | class QLabel; |
39 | class QLineEdit; | 39 | class QLineEdit; |
40 | class QListBox; | 40 | class QListBox; |
41 | class QMultiLineEdit; | 41 | class QMultiLineEdit; |
42 | class QPushButton; | 42 | class QPushButton; |
43 | class QRadioButton; | 43 | class QRadioButton; |
44 | class QToolButton; | 44 | class QToolButton; |
45 | class SampleWindow; | 45 | class SampleWindow; |
46 | class OFontSelector; | 46 | class OFontSelector; |
47 | class QListView; | 47 | class QListView; |
48 | class QListViewItem; | 48 | class QListViewItem; |
49 | class Config; | 49 | class Config; |
50 | 50 | ||
51 | class Appearance : public QDialog | 51 | class Appearance : public QDialog |
52 | { | 52 | { |
53 | Q_OBJECT | 53 | Q_OBJECT |
54 | 54 | ||
55 | public: | 55 | public: |
56 | Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 56 | Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
57 | ~Appearance(); | 57 | ~Appearance(); |
58 | 58 | ||
59 | protected: | 59 | protected: |
60 | virtual void accept ( ); | 60 | virtual void accept ( ); |
61 | virtual void done ( int r ); | 61 | virtual void done ( int r ); |
62 | 62 | ||
63 | protected slots: | 63 | protected slots: |
64 | void styleClicked ( int ); | 64 | void styleClicked ( int ); |
65 | void styleSettingsClicked ( ); | 65 | void styleSettingsClicked ( ); |
66 | void decoClicked ( int ); | 66 | void decoClicked ( int ); |
67 | void fontClicked ( const QFont & ); | 67 | void fontClicked ( const QFont & ); |
68 | void colorClicked ( int ); | 68 | void colorClicked ( int ); |
69 | 69 | ||
70 | void editSchemeClicked(); | 70 | void editSchemeClicked(); |
71 | void saveSchemeClicked(); | 71 | void saveSchemeClicked(); |
72 | void deleteSchemeClicked(); | 72 | void deleteSchemeClicked(); |
73 | 73 | ||
74 | void tabChanged ( QWidget * ); | 74 | void tabChanged ( QWidget * ); |
75 | 75 | ||
76 | void addExcept ( ); | 76 | void addExcept ( ); |
77 | void delExcept ( ); | 77 | void delExcept ( ); |
78 | void upExcept ( ); | 78 | void upExcept ( ); |
79 | void downExcept ( ); | 79 | void downExcept ( ); |
80 | void clickedExcept ( QListViewItem *, const QPoint &, int ); | 80 | void clickedExcept ( QListViewItem *, const QPoint &, int ); |
81 | 81 | ||
82 | private: | 82 | private: |
83 | void changeText(); | 83 | void changeText(); |
84 | 84 | ||
85 | QWidget *createStyleTab ( QWidget *parent, Config &cfg ); | 85 | QWidget *createStyleTab ( QWidget *parent, Config &cfg ); |
86 | QWidget *createDecoTab ( QWidget *parent, Config &cfg ); | 86 | QWidget *createDecoTab ( QWidget *parent, Config &cfg ); |
87 | QWidget *createFontTab ( QWidget *parent, Config &cfg ); | 87 | QWidget *createFontTab ( QWidget *parent, Config &cfg ); |
88 | QWidget *createColorTab ( QWidget *parent, Config &cfg ); | 88 | QWidget *createColorTab ( QWidget *parent, Config &cfg ); |
89 | QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); | 89 | QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); |
90 | 90 | ||
91 | private: | 91 | private: |
92 | bool m_style_changed; | 92 | bool m_style_changed; |
93 | bool m_font_changed; | 93 | bool m_font_changed; |
94 | bool m_scheme_changed; | 94 | bool m_scheme_changed; |
95 | bool m_deco_changed; | 95 | bool m_deco_changed; |
96 | bool m_color_changed; | 96 | bool m_color_changed; |
97 | 97 | ||
98 | int m_original_style; | 98 | int m_original_style; |
99 | int m_original_deco; | 99 | int m_original_deco; |
100 | int m_original_tabstyle; | 100 | int m_original_tabstyle; |
101 | bool m_original_tabpos; | 101 | bool m_original_tabpos; |
102 | 102 | ||
103 | QListBox * m_style_list; | 103 | QListBox * m_style_list; |
104 | QPushButton * m_style_settings; | 104 | QPushButton * m_style_settings; |
105 | 105 | ||
106 | QListBox * m_deco_list; | 106 | QListBox * m_deco_list; |
107 | 107 | ||
108 | QListBox * m_color_list; | 108 | QListBox * m_color_list; |
109 | 109 | ||
110 | OFontSelector *m_fontselect; | 110 | OFontSelector *m_fontselect; |
111 | 111 | ||
112 | SampleWindow *m_sample; | 112 | SampleWindow *m_sample; |
113 | 113 | ||
114 | QComboBox * m_tabstyle_list; | 114 | QComboBox * m_tabstyle_list; |
115 | QRadioButton *m_tabstyle_top; | 115 | QRadioButton *m_tabstyle_top; |
116 | QRadioButton *m_tabstyle_bottom; | 116 | QRadioButton *m_tabstyle_bottom; |
117 | 117 | ||
118 | QRadioButton *m_rotdir_cw; | ||
119 | QRadioButton *m_rotdir_ccw; | ||
120 | |||
118 | QWidget * m_advtab; | 121 | QWidget * m_advtab; |
119 | QListView * m_except; | 122 | QListView * m_except; |
120 | QCheckBox * m_force; | 123 | QCheckBox * m_force; |
121 | }; | 124 | }; |
122 | 125 | ||
123 | #endif | 126 | #endif |