Diffstat (limited to 'noncore/settings/appearance2/appearance.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 162 |
1 files changed, 98 insertions, 64 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 9e5eede..ba12e55 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -29,2 +29,26 @@ | |||
29 | 29 | ||
30 | #include "appearance.h" | ||
31 | #include "editScheme.h" | ||
32 | #include "stylelistitem.h" | ||
33 | #include "decolistitem.h" | ||
34 | #include "colorlistitem.h" | ||
35 | #include "exceptlistitem.h" | ||
36 | #include "sample.h" | ||
37 | |||
38 | /* OPIE */ | ||
39 | #include <opie/ofontselector.h> | ||
40 | #include <opie/odevice.h> | ||
41 | #include <opie/ofiledialog.h> | ||
42 | #include <opie/otabwidget.h> | ||
43 | |||
44 | #include <qpe/config.h> | ||
45 | #include <qpe/global.h> | ||
46 | #include <qpe/qpeapplication.h> | ||
47 | #include <qpe/qpemessagebox.h> | ||
48 | #include <qpe/qcopenvelope_qws.h> | ||
49 | #include <qpe/qpestyle.h> | ||
50 | #include <qpe/lightstyle.h> | ||
51 | #include <qpe/styleinterface.h> | ||
52 | |||
53 | /* QT */ | ||
30 | #include <qbuttongroup.h> | 54 | #include <qbuttongroup.h> |
@@ -51,27 +75,2 @@ | |||
51 | 75 | ||
52 | #include <qpe/config.h> | ||
53 | #include <qpe/global.h> | ||
54 | #include <qpe/resource.h> | ||
55 | #include <qpe/qpeapplication.h> | ||
56 | #include <qpe/qpemessagebox.h> | ||
57 | #include <qpe/qcopenvelope_qws.h> | ||
58 | #include <qpe/qpestyle.h> | ||
59 | #include <qpe/lightstyle.h> | ||
60 | #include <qpe/qlibrary.h> | ||
61 | #include <qpe/styleinterface.h> | ||
62 | |||
63 | #include <opie/ofontselector.h> | ||
64 | #include <opie/odevice.h> | ||
65 | #include <opie/ofiledialog.h> | ||
66 | #include <opie/otabwidget.h> | ||
67 | |||
68 | #include "appearance.h" | ||
69 | #include "editScheme.h" | ||
70 | #include "stylelistitem.h" | ||
71 | #include "decolistitem.h" | ||
72 | #include "colorlistitem.h" | ||
73 | #include "exceptlistitem.h" | ||
74 | #include "sample.h" | ||
75 | |||
76 | |||
77 | using namespace Opie; | 76 | using namespace Opie; |
@@ -83,9 +82,12 @@ public: | |||
83 | DefaultWindowDecoration() : ref(0) {} | 82 | DefaultWindowDecoration() : ref(0) {} |
84 | QString name() const { | 83 | QString name() const |
84 | { | ||
85 | return "Default"; | 85 | return "Default"; |
86 | } | 86 | } |
87 | QPixmap icon() const { | 87 | QPixmap icon() const |
88 | { | ||
88 | return QPixmap(); | 89 | return QPixmap(); |
89 | } | 90 | } |
90 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | 91 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
92 | { | ||
91 | *iface = 0; | 93 | *iface = 0; |
@@ -136,2 +138,3 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) | |||
136 | #endif | 138 | #endif |
139 | |||
137 | { | 140 | { |
@@ -141,3 +144,4 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) | |||
141 | 144 | ||
142 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 145 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
146 | { | ||
143 | QString libstr = path; | 147 | QString libstr = path; |
@@ -148,3 +152,4 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) | |||
148 | 152 | ||
149 | if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) { | 153 | if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) |
154 | { | ||
150 | StyleListItem *slit = new StyleListItem ( lib, iface ); | 155 | StyleListItem *slit = new StyleListItem ( lib, iface ); |
@@ -186,3 +191,4 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) | |||
186 | 191 | ||
187 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 192 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
193 | { | ||
188 | QString libstr = path; | 194 | QString libstr = path; |
@@ -193,3 +199,4 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) | |||
193 | 199 | ||
194 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) { | 200 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) |
201 | { | ||
195 | DecoListItem *dlit = new DecoListItem ( lib, iface ); | 202 | DecoListItem *dlit = new DecoListItem ( lib, iface ); |
@@ -248,3 +255,4 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | |||
248 | 255 | ||
249 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 256 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
257 | { | ||
250 | QString name = (*it). left ((*it). find ( ".scheme" )); | 258 | QString name = (*it). left ((*it). find ( ".scheme" )); |
@@ -350,3 +358,4 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
350 | QListViewItem *lvit = 0; | 358 | QListViewItem *lvit = 0; |
351 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 359 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
360 | { | ||
352 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 361 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
@@ -434,5 +443,8 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
434 | 443 | ||
435 | if (rotDirection == -1) { | 444 | if (rotDirection == -1) |
445 | { | ||
436 | rot = ODevice::inst ( )-> direction ( ); | 446 | rot = ODevice::inst ( )-> direction ( ); |
437 | } else { | 447 | } |
448 | else | ||
449 | { | ||
438 | rot = (ODirection)rotDirection; | 450 | rot = (ODirection)rotDirection; |
@@ -484,4 +496,3 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | |||
484 | Appearance::~Appearance() | 496 | Appearance::~Appearance() |
485 | { | 497 | {} |
486 | } | ||
487 | 498 | ||
@@ -489,3 +500,4 @@ void Appearance::tabChanged ( QWidget *w ) | |||
489 | { | 500 | { |
490 | if ( w == m_advtab ) { | 501 | if ( w == m_advtab ) |
502 | { | ||
491 | m_sample-> hide ( ); | 503 | m_sample-> hide ( ); |
@@ -505,3 +517,4 @@ void Appearance::accept ( ) | |||
505 | 517 | ||
506 | if ( m_style_changed ) { | 518 | if ( m_style_changed ) |
519 | { | ||
507 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 520 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
@@ -511,3 +524,4 @@ void Appearance::accept ( ) | |||
511 | 524 | ||
512 | if ( m_deco_changed ) { | 525 | if ( m_deco_changed ) |
526 | { | ||
513 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); | 527 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); |
@@ -517,3 +531,4 @@ void Appearance::accept ( ) | |||
517 | 531 | ||
518 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { | 532 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) |
533 | { | ||
519 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | 534 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); |
@@ -522,3 +537,4 @@ void Appearance::accept ( ) | |||
522 | 537 | ||
523 | if ( m_font_changed ) { | 538 | if ( m_font_changed ) |
539 | { | ||
524 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); | 540 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); |
@@ -538,7 +554,12 @@ void Appearance::accept ( ) | |||
538 | ODirection rot; | 554 | ODirection rot; |
539 | if (m_rotdir_ccw-> isChecked ( )) { | 555 | if (m_rotdir_ccw-> isChecked ( )) |
556 | { | ||
540 | rot = CCW; | 557 | rot = CCW; |
541 | } else if (m_rotdir_cw-> isChecked ( )) { | 558 | } |
559 | else if (m_rotdir_cw-> isChecked ( )) | ||
560 | { | ||
542 | rot = CW; | 561 | rot = CW; |
543 | } else { | 562 | } |
563 | else | ||
564 | { | ||
544 | rot = Flip; | 565 | rot = Flip; |
@@ -551,3 +572,4 @@ void Appearance::accept ( ) | |||
551 | QString exceptstr; | 572 | QString exceptstr; |
552 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { | 573 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) |
574 | { | ||
553 | int fl = 0; | 575 | int fl = 0; |
@@ -581,3 +603,4 @@ void Appearance::styleClicked ( int index ) | |||
581 | 603 | ||
582 | if ( m_sample && sli && sli-> style ( )) { | 604 | if ( m_sample && sli && sli-> style ( )) |
605 | { | ||
583 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; | 606 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; |
@@ -594,3 +617,4 @@ void Appearance::styleSettingsClicked ( ) | |||
594 | 617 | ||
595 | if ( item && item-> hasSettings ( )) { | 618 | if ( item && item-> hasSettings ( )) |
619 | { | ||
596 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); | 620 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); |
@@ -600,3 +624,4 @@ void Appearance::styleSettingsClicked ( ) | |||
600 | 624 | ||
601 | if ( w ) { | 625 | if ( w ) |
626 | { | ||
602 | vbox-> addWidget ( w ); | 627 | vbox-> addWidget ( w ); |
@@ -605,4 +630,3 @@ void Appearance::styleSettingsClicked ( ) | |||
605 | 630 | ||
606 | d-> showMaximized ( ); | 631 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); |
607 | bool accepted = ( d-> exec ( ) == QDialog::Accepted ); | ||
608 | 632 | ||
@@ -619,3 +643,4 @@ void Appearance::decoClicked ( int index ) | |||
619 | 643 | ||
620 | if ( m_sample ) { | 644 | if ( m_sample ) |
645 | { | ||
621 | if ( dli && dli-> interface ( )) | 646 | if ( dli && dli-> interface ( )) |
@@ -654,6 +679,8 @@ void Appearance::editSchemeClicked ( ) | |||
654 | 679 | ||
655 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { | 680 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) |
681 | { | ||
656 | QColor col = item-> color ( role ); | 682 | QColor col = item-> color ( role ); |
657 | 683 | ||
658 | if ( col. isValid ( )) { | 684 | if ( col. isValid ( )) |
685 | { | ||
659 | labels [cnt] = item-> label ( role ); | 686 | labels [cnt] = item-> label ( role ); |
@@ -666,4 +693,4 @@ void Appearance::editSchemeClicked ( ) | |||
666 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); | 693 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); |
667 | editdlg-> showMaximized ( ); | 694 | if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) |
668 | if ( editdlg-> exec ( ) == QDialog::Accepted ) { | 695 | { |
669 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); | 696 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); |
@@ -671,4 +698,6 @@ void Appearance::editSchemeClicked ( ) | |||
671 | 698 | ||
672 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { | 699 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) |
673 | if ( item-> color ( role ). isValid ( )) { | 700 | { |
701 | if ( item-> color ( role ). isValid ( )) | ||
702 | { | ||
674 | citem-> setColor ( role, colors [cnt] ); | 703 | citem-> setColor ( role, colors [cnt] ); |
@@ -700,3 +729,4 @@ void Appearance::saveSchemeClicked() | |||
700 | 729 | ||
701 | if ( d-> exec ( ) == QDialog::Accepted ) { | 730 | if ( d-> exec ( ) == QDialog::Accepted ) |
731 | { | ||
702 | QString schemename = ed-> text ( ); | 732 | QString schemename = ed-> text ( ); |
@@ -763,3 +793,4 @@ void Appearance::delExcept ( ) | |||
763 | { | 793 | { |
764 | if ( m_except-> selectedItem ( )) { | 794 | if ( m_except-> selectedItem ( )) |
795 | { | ||
765 | m_except-> setFocus ( ); | 796 | m_except-> setFocus ( ); |
@@ -785,3 +816,4 @@ void Appearance::downExcept ( ) | |||
785 | 816 | ||
786 | class ExEdit : public QLineEdit { | 817 | class ExEdit : public QLineEdit |
818 | { | ||
787 | public: | 819 | public: |
@@ -824,3 +856,4 @@ public: | |||
824 | it-> listView ( )-> setFocus ( ); | 856 | it-> listView ( )-> setFocus ( ); |
825 | else if ( e-> key ( ) == Key_Escape ) { | 857 | else if ( e-> key ( ) == Key_Escape ) |
858 | { | ||
826 | m_out = false; | 859 | m_out = false; |
@@ -850,3 +883,4 @@ void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c ) | |||
850 | it-> setNoDeco ( !it-> noDeco ( )); | 883 | it-> setNoDeco ( !it-> noDeco ( )); |
851 | else if ( c == 3 ) { | 884 | else if ( c == 3 ) |
885 | { | ||
852 | m_except-> ensureItemVisible ( it ); | 886 | m_except-> ensureItemVisible ( it ); |