author | zecke <zecke> | 2005-02-08 22:59:18 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-02-08 22:59:18 (UTC) |
commit | f24d8318de30b47ec8f877293fd175deaa0b914c (patch) (unidiff) | |
tree | 980c18e803b7b85573e1ab11a9ade2b281273d3e /noncore | |
parent | 7cff42233a2e0e2761f54fea89db785c7b519c94 (diff) | |
download | opie-f24d8318de30b47ec8f877293fd175deaa0b914c.zip opie-f24d8318de30b47ec8f877293fd175deaa0b914c.tar.gz opie-f24d8318de30b47ec8f877293fd175deaa0b914c.tar.bz2 |
-Kill the need to compile Opie against a patched version of Qt/E
Remove the setStyle and setFont overrides
as a result remove settings from the buildsystem and the Apperance GUI
We do this as we won't run NeoCal or TKC Apps on a GCC3 (now default compiler)
libqpe, to run these applications one can use oz-compat
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 210 | ||||
-rw-r--r-- | noncore/settings/appearance2/appearance.h | 8 |
2 files changed, 5 insertions, 213 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 088171c..d649ed6 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -272,127 +272,48 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | |||
272 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); | 272 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); |
273 | gridLayout->addWidget( tempButton, 0, 1 ); | 273 | gridLayout->addWidget( tempButton, 0, 1 ); |
274 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); | 274 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); |
275 | 275 | ||
276 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); | 276 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); |
277 | tempButton->setText( tr( "Delete" ) ); | 277 | tempButton->setText( tr( "Delete" ) ); |
278 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); | 278 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); |
279 | gridLayout->addWidget( tempButton, 1, 1 ); | 279 | gridLayout->addWidget( tempButton, 1, 1 ); |
280 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); | 280 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); |
281 | 281 | ||
282 | tempButton = new QPushButton( tab, "saveSchemeButton" ); | 282 | tempButton = new QPushButton( tab, "saveSchemeButton" ); |
283 | tempButton->setText( tr( "Save" ) ); | 283 | tempButton->setText( tr( "Save" ) ); |
284 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); | 284 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); |
285 | gridLayout->addWidget( tempButton, 2, 1 ); | 285 | gridLayout->addWidget( tempButton, 2, 1 ); |
286 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); | 286 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); |
287 | 287 | ||
288 | return tab; | 288 | return tab; |
289 | } | 289 | } |
290 | 290 | ||
291 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | 291 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) |
292 | { | 292 | { |
293 | QWidget *tab = new QWidget ( parent ); | 293 | QWidget *tab = new QWidget ( parent ); |
294 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 294 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
295 | 295 | ||
296 | QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | ||
297 | |||
298 | m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); | ||
299 | m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); | ||
300 | lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); | ||
301 | QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); | ||
302 | |||
303 | QLabel *l = new QLabel ( tab ); | ||
304 | l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); | ||
305 | lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); | ||
306 | QWhatsThis::add( l, 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." ) ); | ||
307 | |||
308 | m_except = new QListView ( tab ); | ||
309 | m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); | ||
310 | m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); | ||
311 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); | ||
312 | m_except-> addColumn ( tr( "Binary file(s)" )); | ||
313 | m_except-> setColumnAlignment ( 0, AlignCenter ); | ||
314 | m_except-> setColumnAlignment ( 1, AlignCenter ); | ||
315 | m_except-> setColumnAlignment ( 2, AlignCenter ); | ||
316 | m_except-> setAllColumnsShowFocus ( true ); | ||
317 | m_except-> setMinimumHeight ( 30 ); | ||
318 | m_except-> header ( )-> setClickEnabled ( false ); | ||
319 | m_except-> header ( )-> setResizeEnabled ( false ); | ||
320 | m_except-> header ( )-> setMovingEnabled ( false ); | ||
321 | m_except-> setSorting ( -1 ); | ||
322 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); | ||
323 | 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." ) ); | ||
324 | |||
325 | connect ( m_except, SIGNAL( clicked(QListViewItem*,const QPoint&,int)), this, SLOT( clickedExcept(QListViewItem*,const QPoint&,int))); | ||
326 | |||
327 | QToolButton *tb = new QToolButton ( tab ); | ||
328 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); | ||
329 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | ||
330 | lay-> addWidget ( tb, 2, 1 ); | ||
331 | connect ( tb, SIGNAL( clicked()), this, SLOT( addExcept())); | ||
332 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); | ||
333 | |||
334 | tb = new QToolButton ( tab ); | ||
335 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); | ||
336 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | ||
337 | lay-> addWidget ( tb, 3, 1 ); | ||
338 | connect ( tb, SIGNAL( clicked()), this, SLOT( delExcept())); | ||
339 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); | ||
340 | |||
341 | tb = new QToolButton ( tab ); | ||
342 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); | ||
343 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | ||
344 | lay-> addWidget ( tb, 4, 1 ); | ||
345 | connect ( tb, SIGNAL( clicked()), this, SLOT( upExcept())); | ||
346 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); | ||
347 | |||
348 | tb = new QToolButton ( tab ); | ||
349 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); | ||
350 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | ||
351 | lay-> addWidget ( tb, 5, 1 ); | ||
352 | connect ( tb, SIGNAL( clicked()), this, SLOT( downExcept())); | ||
353 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); | ||
354 | |||
355 | lay-> setRowStretch ( 6, 10 ); | ||
356 | lay-> setColStretch ( 0, 10 ); | ||
357 | |||
358 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); | ||
359 | QListViewItem *lvit = 0; | ||
360 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | ||
361 | { | ||
362 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); | ||
363 | |||
364 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); | ||
365 | } | ||
366 | |||
367 | |||
368 | vertLayout-> addSpacing ( 3 ); | ||
369 | QFrame *f = new QFrame ( tab ); | ||
370 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | ||
371 | vertLayout-> addWidget ( f ); | ||
372 | vertLayout-> addSpacing ( 3 ); | ||
373 | |||
374 | |||
375 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 296 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
376 | 297 | ||
377 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; | 298 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; |
378 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); | 299 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); |
379 | 300 | ||
380 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); | 301 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); |
381 | gridLayout-> addWidget ( label, 0, 0 ); | 302 | gridLayout-> addWidget ( label, 0, 0 ); |
382 | 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" ) ); | 303 | 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" ) ); |
383 | 304 | ||
384 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); | 305 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); |
385 | btngrp-> hide ( ); | 306 | btngrp-> hide ( ); |
386 | btngrp-> setExclusive ( true ); | 307 | btngrp-> setExclusive ( true ); |
387 | 308 | ||
388 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); | 309 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); |
389 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); | 310 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); |
390 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); | 311 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); |
391 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); | 312 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); |
392 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); | 313 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); |
393 | m_tabstyle_list-> setCurrentItem ( style ); | 314 | m_tabstyle_list-> setCurrentItem ( style ); |
394 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 315 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); |
395 | 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" ) ); | 316 | 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" ) ); |
396 | 317 | ||
397 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); | 318 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); |
398 | btngrp-> insert ( m_tabstyle_top ); | 319 | btngrp-> insert ( m_tabstyle_top ); |
@@ -434,48 +355,53 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
434 | m_rotdir_ccw-> setPixmap( ccw1 ); | 355 | m_rotdir_ccw-> setPixmap( ccw1 ); |
435 | m_rotdir_flip-> setPixmap( flip1 ); | 356 | m_rotdir_flip-> setPixmap( flip1 ); |
436 | 357 | ||
437 | rotLay-> addWidget ( rotlabel, 0 ); | 358 | rotLay-> addWidget ( rotlabel, 0 ); |
438 | rotLay-> addWidget ( m_rotdir_cw, 0 ); | 359 | rotLay-> addWidget ( m_rotdir_cw, 0 ); |
439 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); | 360 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); |
440 | rotLay-> addWidget ( m_rotdir_flip, 0 ); | 361 | rotLay-> addWidget ( m_rotdir_flip, 0 ); |
441 | 362 | ||
442 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 363 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
443 | ODirection rot = CW; | 364 | ODirection rot = CW; |
444 | 365 | ||
445 | if (rotDirection == -1) | 366 | if (rotDirection == -1) |
446 | { | 367 | { |
447 | rot = ODevice::inst ( )-> direction ( ); | 368 | rot = ODevice::inst ( )-> direction ( ); |
448 | } | 369 | } |
449 | else | 370 | else |
450 | { | 371 | { |
451 | rot = (ODirection)rotDirection; | 372 | rot = (ODirection)rotDirection; |
452 | } | 373 | } |
453 | 374 | ||
454 | m_rotdir_cw-> setChecked ( rot == CW ); | 375 | m_rotdir_cw-> setChecked ( rot == CW ); |
455 | m_rotdir_ccw-> setChecked ( rot == CCW ); | 376 | m_rotdir_ccw-> setChecked ( rot == CCW ); |
456 | m_rotdir_flip-> setChecked ( rot == Flip ); | 377 | m_rotdir_flip-> setChecked ( rot == Flip ); |
457 | 378 | ||
379 | |||
380 | /* | ||
381 | * add a spacing | ||
382 | */ | ||
383 | vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); | ||
458 | return tab; | 384 | return tab; |
459 | } | 385 | } |
460 | 386 | ||
461 | 387 | ||
462 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 388 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
463 | : QDialog ( parent, name, true, WStyle_ContextHelp ) | 389 | : QDialog ( parent, name, true, WStyle_ContextHelp ) |
464 | { | 390 | { |
465 | setCaption( tr( "Appearance Settings" ) ); | 391 | setCaption( tr( "Appearance Settings" ) ); |
466 | 392 | ||
467 | Config config( "qpe" ); | 393 | Config config( "qpe" ); |
468 | config.setGroup( "Appearance" ); | 394 | config.setGroup( "Appearance" ); |
469 | 395 | ||
470 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); | 396 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); |
471 | 397 | ||
472 | m_sample = new SampleWindow ( this ); | 398 | m_sample = new SampleWindow ( this ); |
473 | 399 | ||
474 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); | 400 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); |
475 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 401 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
476 | 402 | ||
477 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 403 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
478 | QWidget *styletab; | 404 | QWidget *styletab; |
479 | 405 | ||
480 | m_color_list = 0; | 406 | m_color_list = 0; |
481 | 407 | ||
@@ -546,65 +472,48 @@ void Appearance::accept ( ) | |||
546 | 472 | ||
547 | if ( m_color_changed ) | 473 | if ( m_color_changed ) |
548 | { | 474 | { |
549 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 475 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
550 | 476 | ||
551 | if ( item ) | 477 | if ( item ) |
552 | item-> save ( config ); | 478 | item-> save ( config ); |
553 | } | 479 | } |
554 | 480 | ||
555 | ODirection rot; | 481 | ODirection rot; |
556 | if (m_rotdir_ccw-> isChecked ( )) | 482 | if (m_rotdir_ccw-> isChecked ( )) |
557 | { | 483 | { |
558 | rot = CCW; | 484 | rot = CCW; |
559 | } | 485 | } |
560 | else if (m_rotdir_cw-> isChecked ( )) | 486 | else if (m_rotdir_cw-> isChecked ( )) |
561 | { | 487 | { |
562 | rot = CW; | 488 | rot = CW; |
563 | } | 489 | } |
564 | else | 490 | else |
565 | { | 491 | { |
566 | rot = Flip; | 492 | rot = Flip; |
567 | } | 493 | } |
568 | config. writeEntry ( "rotatedir", (int)rot ); | 494 | config. writeEntry ( "rotatedir", (int)rot ); |
569 | 495 | ||
570 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated | ||
571 | |||
572 | QStringList sl; | ||
573 | QString exceptstr; | ||
574 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) | ||
575 | { | ||
576 | int fl = 0; | ||
577 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); | ||
578 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); | ||
579 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); | ||
580 | exceptstr = QString::number ( fl, 32 ); | ||
581 | exceptstr.append( it-> pattern ( )); | ||
582 | sl << exceptstr; | ||
583 | } | ||
584 | config. writeEntry ( "NoStyle", sl, ';' ); | ||
585 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); | ||
586 | |||
587 | config. write ( ); // need to flush the config info first | 496 | config. write ( ); // need to flush the config info first |
588 | Global::applyStyle ( ); | 497 | Global::applyStyle ( ); |
589 | 498 | ||
590 | QDialog::accept ( ); | 499 | QDialog::accept ( ); |
591 | } | 500 | } |
592 | 501 | ||
593 | void Appearance::done ( int r ) | 502 | void Appearance::done ( int r ) |
594 | { | 503 | { |
595 | QDialog::done ( r ); | 504 | QDialog::done ( r ); |
596 | close ( ); | 505 | close ( ); |
597 | } | 506 | } |
598 | 507 | ||
599 | 508 | ||
600 | void Appearance::styleClicked ( int index ) | 509 | void Appearance::styleClicked ( int index ) |
601 | { | 510 | { |
602 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); | 511 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); |
603 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); | 512 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); |
604 | 513 | ||
605 | if ( m_sample && sli && sli-> style ( )) | 514 | if ( m_sample && sli && sli-> style ( )) |
606 | { | 515 | { |
607 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; | 516 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; |
608 | 517 | ||
609 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); | 518 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); |
610 | } | 519 | } |
@@ -760,133 +669,24 @@ void Appearance::saveSchemeClicked() | |||
760 | void Appearance::deleteSchemeClicked() | 669 | void Appearance::deleteSchemeClicked() |
761 | { | 670 | { |
762 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 671 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
763 | 672 | ||
764 | if ( !item ) | 673 | if ( !item ) |
765 | return; | 674 | return; |
766 | 675 | ||
767 | if ( m_color_list-> currentItem ( ) > 0 ) | 676 | if ( m_color_list-> currentItem ( ) > 0 ) |
768 | { | 677 | { |
769 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) | 678 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) |
770 | { | 679 | { |
771 | QString filestr = QPEApplication::qpeDir ( ); | 680 | QString filestr = QPEApplication::qpeDir ( ); |
772 | filestr.append( "/etc/colors/" ); | 681 | filestr.append( "/etc/colors/" ); |
773 | filestr.append( item-> text ( ) ); | 682 | filestr.append( item-> text ( ) ); |
774 | filestr.append( ".scheme" ); | 683 | filestr.append( ".scheme" ); |
775 | QFile::remove ( filestr ); | 684 | QFile::remove ( filestr ); |
776 | delete item; | 685 | delete item; |
777 | } | 686 | } |
778 | } | 687 | } |
779 | else | 688 | else |
780 | { | 689 | { |
781 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); | 690 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); |
782 | } | 691 | } |
783 | } | 692 | } |
784 | |||
785 | |||
786 | void Appearance::addExcept ( ) | ||
787 | { | ||
788 | ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true ); | ||
789 | m_except-> ensureItemVisible ( it ); | ||
790 | m_except-> setSelected ( it, true ); | ||
791 | } | ||
792 | |||
793 | void Appearance::delExcept ( ) | ||
794 | { | ||
795 | if ( m_except-> selectedItem ( )) | ||
796 | { | ||
797 | m_except-> setFocus ( ); | ||
798 | delete m_except-> selectedItem ( ); | ||
799 | } | ||
800 | } | ||
801 | |||
802 | void Appearance::upExcept ( ) | ||
803 | { | ||
804 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); | ||
805 | |||
806 | if ( it && it-> itemAbove ( )) | ||
807 | it-> itemAbove ( )-> moveItem ( it ); | ||
808 | } | ||
809 | |||
810 | void Appearance::downExcept ( ) | ||
811 | { | ||
812 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); | ||
813 | |||
814 | if ( it && it-> itemBelow ( )) | ||
815 | it-> moveItem ( it-> itemBelow ( )); | ||
816 | } | ||
817 | |||
818 | class ExEdit : public QLineEdit | ||
819 | { | ||
820 | public: | ||
821 | ExEdit ( ExceptListItem *item ) | ||
822 | : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item ) | ||
823 | { | ||
824 | setFrame ( false ); | ||
825 | |||
826 | QRect r = it-> listView ( )-> itemRect ( it ); | ||
827 | |||
828 | int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1; | ||
829 | int y = r. y ( ); | ||
830 | int w = it-> listView ( )-> viewport ( )-> width ( ) - x; | ||
831 | int h = r. height ( ); // + 2; | ||
832 | |||
833 | setText ( it-> pattern ( )); | ||
834 | setGeometry ( x, y, w, h ); | ||
835 | |||
836 | odebug << "ExEdit: [" << it->text(2).latin1() << "] at " | ||
837 | << x << "," << y << " " << w << "," << h << oendl; | ||
838 | |||
839 | m_out = true; | ||
840 | |||
841 | show ( ); | ||
842 | setFocus ( ); | ||
843 | selectAll ( ); | ||
844 | end ( true ); | ||
845 | } | ||
846 | |||
847 | virtual void focusOutEvent ( QFocusEvent * ) | ||
848 | { | ||
849 | hide ( ); | ||
850 | if ( m_out ) | ||
851 | it-> setPattern ( text ( )); | ||
852 | delete this; | ||
853 | } | ||
854 | |||
855 | virtual void keyPressEvent ( QKeyEvent *e ) | ||
856 | { | ||
857 | if ( e-> key ( ) == Key_Return ) | ||
858 | it-> listView ( )-> setFocus ( ); | ||
859 | else if ( e-> key ( ) == Key_Escape ) | ||
860 | { | ||
861 | m_out = false; | ||
862 | it-> listView ( )-> setFocus ( ); | ||
863 | } | ||
864 | else | ||
865 | QLineEdit::keyPressEvent ( e ); | ||
866 | } | ||
867 | |||
868 | private: | ||
869 | ExceptListItem *it; | ||
870 | bool m_out; | ||
871 | }; | ||
872 | |||
873 | void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c ) | ||
874 | { | ||
875 | if ( !item || c < 0 || c > 3 ) | ||
876 | return; | ||
877 | |||
878 | ExceptListItem *it = (ExceptListItem *) item; | ||
879 | |||
880 | if ( c == 0 ) | ||
881 | it-> setNoStyle ( !it-> noStyle ( )); | ||
882 | else if ( c == 1 ) | ||
883 | it-> setNoFont ( !it-> noFont ( )); | ||
884 | else if ( c == 2 ) | ||
885 | it-> setNoDeco ( !it-> noDeco ( )); | ||
886 | else if ( c == 3 ) | ||
887 | { | ||
888 | m_except-> ensureItemVisible ( it ); | ||
889 | new ExEdit ( it ); | ||
890 | } | ||
891 | } | ||
892 | |||
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h index 134a918..de2f1ab 100644 --- a/noncore/settings/appearance2/appearance.h +++ b/noncore/settings/appearance2/appearance.h | |||
@@ -57,76 +57,68 @@ class Appearance : public QDialog | |||
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | 58 | ||
59 | public: | 59 | public: |
60 | Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 60 | Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
61 | ~Appearance(); | 61 | ~Appearance(); |
62 | static QString appName() { return QString::fromLatin1("appearance"); } | 62 | static QString appName() { return QString::fromLatin1("appearance"); } |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual void accept ( ); | 65 | virtual void accept ( ); |
66 | virtual void done ( int r ); | 66 | virtual void done ( int r ); |
67 | 67 | ||
68 | protected slots: | 68 | protected slots: |
69 | void styleClicked ( int ); | 69 | void styleClicked ( int ); |
70 | void styleSettingsClicked ( ); | 70 | void styleSettingsClicked ( ); |
71 | void decoClicked ( int ); | 71 | void decoClicked ( int ); |
72 | void fontClicked ( const QFont & ); | 72 | void fontClicked ( const QFont & ); |
73 | void colorClicked ( int ); | 73 | void colorClicked ( int ); |
74 | 74 | ||
75 | void editSchemeClicked(); | 75 | void editSchemeClicked(); |
76 | void saveSchemeClicked(); | 76 | void saveSchemeClicked(); |
77 | void deleteSchemeClicked(); | 77 | void deleteSchemeClicked(); |
78 | 78 | ||
79 | void tabChanged ( QWidget * ); | 79 | void tabChanged ( QWidget * ); |
80 | 80 | ||
81 | void addExcept ( ); | ||
82 | void delExcept ( ); | ||
83 | void upExcept ( ); | ||
84 | void downExcept ( ); | ||
85 | void clickedExcept ( QListViewItem *, const QPoint &, int ); | ||
86 | |||
87 | private: | 81 | private: |
88 | void changeText(); | 82 | void changeText(); |
89 | 83 | ||
90 | QWidget *createStyleTab ( QWidget *parent, Config &cfg ); | 84 | QWidget *createStyleTab ( QWidget *parent, Config &cfg ); |
91 | QWidget *createDecoTab ( QWidget *parent, Config &cfg ); | 85 | QWidget *createDecoTab ( QWidget *parent, Config &cfg ); |
92 | QWidget *createFontTab ( QWidget *parent, Config &cfg ); | 86 | QWidget *createFontTab ( QWidget *parent, Config &cfg ); |
93 | QWidget *createColorTab ( QWidget *parent, Config &cfg ); | 87 | QWidget *createColorTab ( QWidget *parent, Config &cfg ); |
94 | QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); | 88 | QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); |
95 | 89 | ||
96 | private: | 90 | private: |
97 | bool m_style_changed; | 91 | bool m_style_changed; |
98 | bool m_font_changed; | 92 | bool m_font_changed; |
99 | bool m_scheme_changed; | 93 | bool m_scheme_changed; |
100 | bool m_deco_changed; | 94 | bool m_deco_changed; |
101 | bool m_color_changed; | 95 | bool m_color_changed; |
102 | 96 | ||
103 | int m_original_style; | 97 | int m_original_style; |
104 | int m_original_deco; | 98 | int m_original_deco; |
105 | int m_original_tabstyle; | 99 | int m_original_tabstyle; |
106 | bool m_original_tabpos; | 100 | bool m_original_tabpos; |
107 | 101 | ||
108 | QListBox * m_style_list; | 102 | QListBox * m_style_list; |
109 | QPushButton * m_style_settings; | 103 | QPushButton * m_style_settings; |
110 | 104 | ||
111 | QListBox * m_deco_list; | 105 | QListBox * m_deco_list; |
112 | 106 | ||
113 | QListBox * m_color_list; | 107 | QListBox * m_color_list; |
114 | 108 | ||
115 | Opie::Ui::OFontSelector *m_fontselect; | 109 | Opie::Ui::OFontSelector *m_fontselect; |
116 | 110 | ||
117 | SampleWindow *m_sample; | 111 | SampleWindow *m_sample; |
118 | 112 | ||
119 | QComboBox * m_tabstyle_list; | 113 | QComboBox * m_tabstyle_list; |
120 | QRadioButton *m_tabstyle_top; | 114 | QRadioButton *m_tabstyle_top; |
121 | QRadioButton *m_tabstyle_bottom; | 115 | QRadioButton *m_tabstyle_bottom; |
122 | 116 | ||
123 | QRadioButton *m_rotdir_cw; | 117 | QRadioButton *m_rotdir_cw; |
124 | QRadioButton *m_rotdir_ccw; | 118 | QRadioButton *m_rotdir_ccw; |
125 | QRadioButton *m_rotdir_flip; | 119 | QRadioButton *m_rotdir_flip; |
126 | 120 | ||
127 | QWidget * m_advtab; | 121 | QWidget * m_advtab; |
128 | QListView * m_except; | ||
129 | QCheckBox * m_force; | ||
130 | }; | 122 | }; |
131 | 123 | ||
132 | #endif | 124 | #endif |