-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 62 | ||||
-rw-r--r-- | noncore/settings/appearance2/appearance.h | 50 | ||||
-rw-r--r-- | noncore/settings/appearance2/colorlistitem.h | 28 | ||||
-rw-r--r-- | noncore/settings/appearance2/decolistitem.h | 27 | ||||
-rw-r--r-- | noncore/settings/appearance2/editScheme.cpp | 116 | ||||
-rw-r--r-- | noncore/settings/appearance2/editScheme.h | 73 | ||||
-rw-r--r-- | noncore/settings/appearance2/main.cpp | 46 | ||||
-rw-r--r-- | noncore/settings/appearance2/sample.cpp | 29 | ||||
-rw-r--r-- | noncore/settings/appearance2/sample.h | 29 | ||||
-rw-r--r-- | noncore/settings/appearance2/stylelistitem.h | 28 |
10 files changed, 318 insertions, 170 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 23630c5..66cf2c3 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -1,71 +1,75 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | =. This file is part of the OPIE Project |
3 | ** | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | ** This file is part of the Qtopia Environment. | 4 | .>+-= |
5 | ** | 5 | _;:, .> :=|. This library is free software; you can |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | ** packaging of this file. | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ** | 10 | ._= =} : or (at your option) any later version. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .%`+i> _;_. |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | ** | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | : .. .:, . . . without even the implied warranty of |
15 | ** | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ** not clear to you. | 17 | ..}^=.= = ; Library General Public License for more |
18 | ** | 18 | ++= -. .` .: details. |
19 | *********************************************************************** | 19 | : = ...= . :.=- |
20 | ** | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | ** Enhancements by: Dan Williams, <williamsdr@acm.org> | 21 | -_. . . )=. = Library General Public License along with |
22 | ** | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | **********************************************************************/ | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
24 | 28 | ||
25 | #include "appearance.h" | 29 | #include "appearance.h" |
26 | #include "editScheme.h" | 30 | #include "editScheme.h" |
27 | 31 | ||
28 | #include <opie/ofiledialog.h> | 32 | #include <opie/ofiledialog.h> |
29 | #include <opie/otabwidget.h> | 33 | #include <opie/otabwidget.h> |
30 | 34 | ||
31 | #include <qpe/applnk.h> | 35 | #include <qpe/applnk.h> |
32 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
33 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
34 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
35 | #include <qpe/qpeapplication.h> | 39 | #include <qpe/qpeapplication.h> |
36 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 40 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
37 | #include <qpe/qcopenvelope_qws.h> | 41 | #include <qpe/qcopenvelope_qws.h> |
38 | #endif | 42 | #endif |
39 | 43 | ||
40 | #include <qaction.h> | 44 | #include <qaction.h> |
41 | #include <qbuttongroup.h> | 45 | #include <qbuttongroup.h> |
42 | #include <qcheckbox.h> | 46 | #include <qcheckbox.h> |
43 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
44 | #include <qdialog.h> | 48 | #include <qdialog.h> |
45 | #include <qdir.h> | 49 | #include <qdir.h> |
46 | #include <qlabel.h> | 50 | #include <qlabel.h> |
47 | #include <qlayout.h> | 51 | #include <qlayout.h> |
48 | #include <qlineedit.h> | 52 | #include <qlineedit.h> |
49 | #include <qlistbox.h> | 53 | #include <qlistbox.h> |
50 | #include <qmessagebox.h> | 54 | #include <qmessagebox.h> |
51 | #include <qmultilineedit.h> | 55 | #include <qmultilineedit.h> |
52 | #include <qpopupmenu.h> | 56 | #include <qpopupmenu.h> |
53 | #include <qpushbutton.h> | 57 | #include <qpushbutton.h> |
54 | #include <qradiobutton.h> | 58 | #include <qradiobutton.h> |
55 | #if QT_VERSION >= 300 | 59 | #if QT_VERSION >= 300 |
56 | #include <qstylefactory.h> | 60 | #include <qstylefactory.h> |
57 | #else | 61 | #else |
58 | #include <qwindowsstyle.h> | 62 | #include <qwindowsstyle.h> |
59 | #include <qpe/qpestyle.h> | 63 | #include <qpe/qpestyle.h> |
60 | #include <qpe/lightstyle.h> | 64 | #include <qpe/lightstyle.h> |
61 | #include <qpe/qlibrary.h> | 65 | #include <qpe/qlibrary.h> |
62 | #include <qpe/styleinterface.h> | 66 | #include <qpe/styleinterface.h> |
63 | #endif | 67 | #endif |
64 | #include <qtabwidget.h> | 68 | #include <qtabwidget.h> |
65 | #include <qtoolbutton.h> | 69 | #include <qtoolbutton.h> |
66 | #include <qvgroupbox.h> | 70 | #include <qvgroupbox.h> |
67 | #include <qwidget.h> | 71 | #include <qwidget.h> |
68 | 72 | ||
69 | #include "stylelistitem.h" | 73 | #include "stylelistitem.h" |
70 | #include "decolistitem.h" | 74 | #include "decolistitem.h" |
71 | #include "colorlistitem.h" | 75 | #include "colorlistitem.h" |
@@ -445,119 +449,119 @@ void Appearance::styleSettingsClicked ( ) | |||
445 | 449 | ||
446 | d-> setCaption ( w-> caption ( )); | 450 | d-> setCaption ( w-> caption ( )); |
447 | 451 | ||
448 | d-> showMaximized ( ); | 452 | d-> showMaximized ( ); |
449 | bool accepted = ( d-> exec ( ) == QDialog::Accepted ); | 453 | bool accepted = ( d-> exec ( ) == QDialog::Accepted ); |
450 | 454 | ||
451 | if ( item-> setSettings ( accepted )) | 455 | if ( item-> setSettings ( accepted )) |
452 | m_style_changed = true; | 456 | m_style_changed = true; |
453 | } | 457 | } |
454 | delete d; | 458 | delete d; |
455 | } | 459 | } |
456 | } | 460 | } |
457 | 461 | ||
458 | void Appearance::decoClicked ( int index ) | 462 | void Appearance::decoClicked ( int index ) |
459 | { | 463 | { |
460 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); | 464 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); |
461 | 465 | ||
462 | if ( m_sample ) { | 466 | if ( m_sample ) { |
463 | if ( dli && dli-> interface ( )) | 467 | if ( dli && dli-> interface ( )) |
464 | m_sample-> setDecoration ( dli-> interface ( )); | 468 | m_sample-> setDecoration ( dli-> interface ( )); |
465 | else | 469 | else |
466 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 470 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
467 | } | 471 | } |
468 | m_deco_changed |= ( index != m_original_deco ); | 472 | m_deco_changed |= ( index != m_original_deco ); |
469 | } | 473 | } |
470 | 474 | ||
471 | void Appearance::fontClicked ( const QFont &f ) | 475 | void Appearance::fontClicked ( const QFont &f ) |
472 | { | 476 | { |
473 | m_font_changed |= ( f != m_sample-> font ( )); | 477 | m_font_changed |= ( f != m_sample-> font ( )); |
474 | m_sample-> setFont ( f ); | 478 | m_sample-> setFont ( f ); |
475 | } | 479 | } |
476 | 480 | ||
477 | void Appearance::colorClicked ( int index ) | 481 | void Appearance::colorClicked ( int index ) |
478 | { | 482 | { |
479 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); | 483 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); |
480 | 484 | ||
481 | if ( item ) | 485 | if ( item ) |
482 | m_sample-> setPalette ( item-> palette ( )); | 486 | m_sample-> setPalette ( item-> palette ( )); |
483 | 487 | ||
484 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); | 488 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); |
485 | } | 489 | } |
486 | 490 | ||
487 | 491 | ||
488 | void Appearance::editSchemeClicked ( ) | 492 | void Appearance::editSchemeClicked ( ) |
489 | { | 493 | { |
490 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 494 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
491 | 495 | ||
492 | int cnt = 0; | 496 | int cnt = 0; |
493 | QString controlLabel [QColorGroup::NColorRoles]; | 497 | QString labels [QColorGroup::NColorRoles]; |
494 | QString controlColor [QColorGroup::NColorRoles]; | 498 | QColor colors [QColorGroup::NColorRoles]; |
495 | 499 | ||
496 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { | 500 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { |
497 | QColor col = item-> color ( role ); | 501 | QColor col = item-> color ( role ); |
498 | 502 | ||
499 | if ( col. isValid ( )) { | 503 | if ( col. isValid ( )) { |
500 | controlLabel [cnt] = item-> label ( role ); | 504 | labels [cnt] = item-> label ( role ); |
501 | controlColor [cnt] = col. name ( ); | 505 | colors [cnt] = col; |
502 | 506 | ||
503 | cnt++; | 507 | cnt++; |
504 | } | 508 | } |
505 | } | 509 | } |
506 | 510 | ||
507 | EditScheme* editdlg = new EditScheme( this, "editScheme", true, 0, cnt, controlLabel, controlColor ); | 511 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); |
508 | editdlg-> showMaximized ( ); | 512 | editdlg-> showMaximized ( ); |
509 | if ( editdlg-> exec ( ) == QDialog::Accepted ) { | 513 | if ( editdlg-> exec ( ) == QDialog::Accepted ) { |
510 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); | 514 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); |
511 | cnt = 0; | 515 | cnt = 0; |
512 | 516 | ||
513 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { | 517 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { |
514 | if ( item-> color ( role ). isValid ( )) { | 518 | if ( item-> color ( role ). isValid ( )) { |
515 | citem-> setColor ( role, QColor ( controlColor [cnt] )); | 519 | citem-> setColor ( role, colors [cnt] ); |
516 | cnt++; | 520 | cnt++; |
517 | } | 521 | } |
518 | } | 522 | } |
519 | 523 | ||
520 | m_color_list-> setCurrentItem ( 0 ); | 524 | m_color_list-> setCurrentItem ( 0 ); |
521 | colorClicked ( 0 ); | 525 | colorClicked ( 0 ); |
522 | 526 | ||
523 | m_color_changed = true; | 527 | m_color_changed = true; |
524 | } | 528 | } |
525 | delete editdlg; | 529 | delete editdlg; |
526 | } | 530 | } |
527 | 531 | ||
528 | 532 | ||
529 | void Appearance::saveSchemeClicked() | 533 | void Appearance::saveSchemeClicked() |
530 | { | 534 | { |
531 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 535 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
532 | 536 | ||
533 | if ( !item ) | 537 | if ( !item ) |
534 | return; | 538 | return; |
535 | 539 | ||
536 | QDialog *d = new QDialog ( this, 0, true ); | 540 | QDialog *d = new QDialog ( this, 0, true ); |
537 | d-> setCaption ( tr( "Save Scheme" )); | 541 | d-> setCaption ( tr( "Save Scheme" )); |
538 | QLineEdit *ed = new QLineEdit ( this ); | 542 | QLineEdit *ed = new QLineEdit ( this ); |
539 | ( new QVBoxLayout ( d, 4, 4 ))-> addWidget ( ed ); | 543 | ( new QVBoxLayout ( d, 4, 4 ))-> addWidget ( ed ); |
540 | 544 | ||
541 | if ( d-> exec ( ) == QDialog::Accepted ) { | 545 | if ( d-> exec ( ) == QDialog::Accepted ) { |
542 | QString schemename = ed-> text ( ); | 546 | QString schemename = ed-> text ( ); |
543 | QFile file ( QPEApplication::qpeDir() + "/etc/colors/" + schemename + ".scheme" ); | 547 | QFile file ( QPEApplication::qpeDir() + "/etc/colors/" + schemename + ".scheme" ); |
544 | if ( !file. exists ( )) | 548 | if ( !file. exists ( )) |
545 | { | 549 | { |
546 | QPalette p = item-> palette ( ); | 550 | QPalette p = item-> palette ( ); |
547 | 551 | ||
548 | Config config ( file.name(), Config::File ); | 552 | Config config ( file.name(), Config::File ); |
549 | config. setGroup( "Colors" ); | 553 | config. setGroup( "Colors" ); |
550 | 554 | ||
551 | item-> save ( config ); | 555 | item-> save ( config ); |
552 | 556 | ||
553 | config. write ( ); // need to flush the config info first | 557 | config. write ( ); // need to flush the config info first |
554 | loadColors ( m_color_list ); | 558 | loadColors ( m_color_list ); |
555 | } | 559 | } |
556 | else | 560 | else |
557 | { | 561 | { |
558 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); | 562 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); |
559 | } | 563 | } |
560 | } | 564 | } |
561 | delete d; | 565 | delete d; |
562 | } | 566 | } |
563 | 567 | ||
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h index 4a86e57..ddf94f2 100644 --- a/noncore/settings/appearance2/appearance.h +++ b/noncore/settings/appearance2/appearance.h | |||
@@ -1,71 +1,75 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | =. This file is part of the OPIE Project |
3 | ** | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | ** This file is part of the Qtopia Environment. | 4 | .>+-= |
5 | ** | 5 | _;:, .> :=|. This library is free software; you can |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | ** packaging of this file. | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ** | 10 | ._= =} : or (at your option) any later version. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .%`+i> _;_. |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | ** | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | : .. .:, . . . without even the implied warranty of |
15 | ** | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ** not clear to you. | 17 | ..}^=.= = ; Library General Public License for more |
18 | ** | 18 | ++= -. .` .: details. |
19 | *********************************************************************** | 19 | : = ...= . :.=- |
20 | ** | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | ** Enhancements by: Dan Williams, <williamsdr@acm.org> | 21 | -_. . . )=. = Library General Public License along with |
22 | ** | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | **********************************************************************/ | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
24 | 28 | ||
25 | #ifndef APPEARANCESETTINGS_H | 29 | #ifndef APPEARANCESETTINGS_H |
26 | #define APPEARANCESETTINGS_H | 30 | #define APPEARANCESETTINGS_H |
27 | 31 | ||
28 | #include <qpe/fontdatabase.h> | 32 | #include <qpe/fontdatabase.h> |
29 | 33 | ||
30 | #include <qmainwindow.h> | 34 | #include <qmainwindow.h> |
31 | #include <qdialog.h> | 35 | #include <qdialog.h> |
32 | 36 | ||
33 | class QCheckBox; | 37 | class QCheckBox; |
34 | class QComboBox; | 38 | class QComboBox; |
35 | class QLabel; | 39 | class QLabel; |
36 | class QLineEdit; | 40 | class QLineEdit; |
37 | class QListBox; | 41 | class QListBox; |
38 | class QMultiLineEdit; | 42 | class QMultiLineEdit; |
39 | class QPushButton; | 43 | class QPushButton; |
40 | class QRadioButton; | 44 | class QRadioButton; |
41 | class QToolButton; | 45 | class QToolButton; |
42 | class SampleWindow; | 46 | class SampleWindow; |
43 | class OFontSelector; | 47 | class OFontSelector; |
44 | 48 | ||
45 | class Appearance : public QDialog | 49 | class Appearance : public QDialog |
46 | { | 50 | { |
47 | Q_OBJECT | 51 | Q_OBJECT |
48 | 52 | ||
49 | public: | 53 | public: |
50 | Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 54 | Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
51 | ~Appearance(); | 55 | ~Appearance(); |
52 | 56 | ||
53 | protected: | 57 | protected: |
54 | virtual void accept ( ); | 58 | virtual void accept ( ); |
55 | virtual void done ( int r ); | 59 | virtual void done ( int r ); |
56 | 60 | ||
57 | protected slots: | 61 | protected slots: |
58 | void styleClicked ( int ); | 62 | void styleClicked ( int ); |
59 | void styleSettingsClicked ( ); | 63 | void styleSettingsClicked ( ); |
60 | void decoClicked ( int ); | 64 | void decoClicked ( int ); |
61 | void fontClicked ( const QFont & ); | 65 | void fontClicked ( const QFont & ); |
62 | void colorClicked ( int ); | 66 | void colorClicked ( int ); |
63 | 67 | ||
64 | void editSchemeClicked(); | 68 | void editSchemeClicked(); |
65 | void saveSchemeClicked(); | 69 | void saveSchemeClicked(); |
66 | void deleteSchemeClicked(); | 70 | void deleteSchemeClicked(); |
67 | 71 | ||
68 | private: | 72 | private: |
69 | void loadStyles ( QListBox * ); | 73 | void loadStyles ( QListBox * ); |
70 | void loadDecos ( QListBox * ); | 74 | void loadDecos ( QListBox * ); |
71 | void loadColors ( QListBox * ); | 75 | void loadColors ( QListBox * ); |
diff --git a/noncore/settings/appearance2/colorlistitem.h b/noncore/settings/appearance2/colorlistitem.h index 1ff6ecc..1df541b 100644 --- a/noncore/settings/appearance2/colorlistitem.h +++ b/noncore/settings/appearance2/colorlistitem.h | |||
@@ -1,48 +1,76 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This library is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This library is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
1 | #ifndef COLORLISTITEM_H | 29 | #ifndef COLORLISTITEM_H |
2 | #define COLORLISTITEM_H | 30 | #define COLORLISTITEM_H |
3 | 31 | ||
4 | #include <qlistbox.h> | 32 | #include <qlistbox.h> |
5 | #include <qpalette.h> | 33 | #include <qpalette.h> |
6 | #include <qapplication.h> | 34 | #include <qapplication.h> |
7 | 35 | ||
8 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
9 | 37 | ||
10 | class Appearance; | 38 | class Appearance; |
11 | 39 | ||
12 | class ColorListItem : public QListBoxText { | 40 | class ColorListItem : public QListBoxText { |
13 | public: | 41 | public: |
14 | ColorListItem ( const QString &t, Config &cfg ) : QListBoxText ( t ) | 42 | ColorListItem ( const QString &t, Config &cfg ) : QListBoxText ( t ) |
15 | { | 43 | { |
16 | m_colors = new QColor [s_colorcount]; | 44 | m_colors = new QColor [s_colorcount]; |
17 | load ( cfg ); | 45 | load ( cfg ); |
18 | } | 46 | } |
19 | 47 | ||
20 | virtual ~ColorListItem ( ) | 48 | virtual ~ColorListItem ( ) |
21 | { | 49 | { |
22 | delete [] m_colors; | 50 | delete [] m_colors; |
23 | } | 51 | } |
24 | 52 | ||
25 | QPalette palette ( ) | 53 | QPalette palette ( ) |
26 | { | 54 | { |
27 | return m_palette; | 55 | return m_palette; |
28 | } | 56 | } |
29 | 57 | ||
30 | bool load ( Config &cfg ) | 58 | bool load ( Config &cfg ) |
31 | { | 59 | { |
32 | for ( int i = 0; i < s_colorcount; i++ ) | 60 | for ( int i = 0; i < s_colorcount; i++ ) |
33 | m_colors [i] = QColor ( cfg. readEntry ( s_colorlut [i]. m_key, s_colorlut [i]. m_def )); | 61 | m_colors [i] = QColor ( cfg. readEntry ( s_colorlut [i]. m_key, s_colorlut [i]. m_def )); |
34 | 62 | ||
35 | buildPalette ( ); | 63 | buildPalette ( ); |
36 | return true; | 64 | return true; |
37 | } | 65 | } |
38 | 66 | ||
39 | void buildPalette ( ) | 67 | void buildPalette ( ) |
40 | { | 68 | { |
41 | m_palette = QPalette ( m_colors [r2i(QColorGroup::Button)], m_colors [r2i(QColorGroup::Background)] ); | 69 | m_palette = QPalette ( m_colors [r2i(QColorGroup::Button)], m_colors [r2i(QColorGroup::Background)] ); |
42 | m_palette. setColor ( QColorGroup::Highlight, m_colors [r2i(QColorGroup::Highlight)] ); | 70 | m_palette. setColor ( QColorGroup::Highlight, m_colors [r2i(QColorGroup::Highlight)] ); |
43 | m_palette. setColor ( QColorGroup::HighlightedText, m_colors [r2i(QColorGroup::HighlightedText)] ); | 71 | m_palette. setColor ( QColorGroup::HighlightedText, m_colors [r2i(QColorGroup::HighlightedText)] ); |
44 | m_palette. setColor ( QColorGroup::Text, m_colors [r2i(QColorGroup::Text)] ); | 72 | m_palette. setColor ( QColorGroup::Text, m_colors [r2i(QColorGroup::Text)] ); |
45 | m_palette. setColor ( QPalette::Active, QColorGroup::ButtonText, m_colors [r2i(QColorGroup::ButtonText)] ); | 73 | m_palette. setColor ( QPalette::Active, QColorGroup::ButtonText, m_colors [r2i(QColorGroup::ButtonText)] ); |
46 | m_palette. setColor ( QColorGroup::Base, m_colors [r2i(QColorGroup::Base)] ); | 74 | m_palette. setColor ( QColorGroup::Base, m_colors [r2i(QColorGroup::Base)] ); |
47 | m_palette. setColor ( QPalette::Disabled, QColorGroup::Text, m_palette. color ( QPalette::Active, QColorGroup::Background ). dark ( )); | 75 | m_palette. setColor ( QPalette::Disabled, QColorGroup::Text, m_palette. color ( QPalette::Active, QColorGroup::Background ). dark ( )); |
48 | } | 76 | } |
diff --git a/noncore/settings/appearance2/decolistitem.h b/noncore/settings/appearance2/decolistitem.h index dfdce47..953a939 100644 --- a/noncore/settings/appearance2/decolistitem.h +++ b/noncore/settings/appearance2/decolistitem.h | |||
@@ -1,48 +1,75 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This library is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This library is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
1 | #ifndef DECOLISTITEM_H | 28 | #ifndef DECOLISTITEM_H |
2 | #define DECOLISTITEM_H | 29 | #define DECOLISTITEM_H |
3 | 30 | ||
4 | #include <qpe/windowdecorationinterface.h> | 31 | #include <qpe/windowdecorationinterface.h> |
5 | #include <qlistbox.h> | 32 | #include <qlistbox.h> |
6 | 33 | ||
7 | class DecoListItem : public QListBoxText { | 34 | class DecoListItem : public QListBoxText { |
8 | public: | 35 | public: |
9 | DecoListItem ( const QString &t ) : QListBoxText ( t ) | 36 | DecoListItem ( const QString &t ) : QListBoxText ( t ) |
10 | { | 37 | { |
11 | m_lib = 0; | 38 | m_lib = 0; |
12 | m_window_if = 0; | 39 | m_window_if = 0; |
13 | // m_settings_if = 0; | 40 | // m_settings_if = 0; |
14 | } | 41 | } |
15 | 42 | ||
16 | DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxText ( iface-> name ( )) | 43 | DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxText ( iface-> name ( )) |
17 | { | 44 | { |
18 | m_lib = lib; | 45 | m_lib = lib; |
19 | m_window_if = iface; | 46 | m_window_if = iface; |
20 | 47 | ||
21 | // iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if ); | 48 | // iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if ); |
22 | } | 49 | } |
23 | 50 | ||
24 | virtual ~DecoListItem ( ) | 51 | virtual ~DecoListItem ( ) |
25 | { | 52 | { |
26 | // if ( m_settings_if ) | 53 | // if ( m_settings_if ) |
27 | // m_settings_if-> release ( ); | 54 | // m_settings_if-> release ( ); |
28 | if ( m_window_if ) | 55 | if ( m_window_if ) |
29 | m_window_if-> release ( ); | 56 | m_window_if-> release ( ); |
30 | delete m_lib; | 57 | delete m_lib; |
31 | } | 58 | } |
32 | 59 | ||
33 | bool hasSettings ( ) const | 60 | bool hasSettings ( ) const |
34 | { | 61 | { |
35 | // return ( m_settings_if ); | 62 | // return ( m_settings_if ); |
36 | return false; | 63 | return false; |
37 | } | 64 | } |
38 | 65 | ||
39 | QWidget *settings ( QWidget * /*parent*/ ) | 66 | QWidget *settings ( QWidget * /*parent*/ ) |
40 | { | 67 | { |
41 | // return m_settings_if ? m_settings_if-> create ( parent ) : 0; | 68 | // return m_settings_if ? m_settings_if-> create ( parent ) : 0; |
42 | return 0; | 69 | return 0; |
43 | } | 70 | } |
44 | 71 | ||
45 | bool setSettings ( bool /*accepted*/ ) | 72 | bool setSettings ( bool /*accepted*/ ) |
46 | { | 73 | { |
47 | // if ( !m_settings_if ) | 74 | // if ( !m_settings_if ) |
48 | // return false; | 75 | // return false; |
diff --git a/noncore/settings/appearance2/editScheme.cpp b/noncore/settings/appearance2/editScheme.cpp index 4f2ac2c..8cb0f1c 100644 --- a/noncore/settings/appearance2/editScheme.cpp +++ b/noncore/settings/appearance2/editScheme.cpp | |||
@@ -1,87 +1,73 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** EditScheme | 2 | =. This file is part of the OPIE Project |
3 | ** | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | ** Dialog for editing color scheme | 4 | .>+-= |
5 | ** | 5 | _;:, .> :=|. This library is free software; you can |
6 | ** Copyright (C) 2002, Dan Williams | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | ** williamsdr@acm.org | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | ** http://draknor.net | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | ** | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ** This file may be distributed and/or modified under the terms of the | 10 | ._= =} : or (at your option) any later version. |
11 | ** GNU General Public License version 2 as published by the Free Software | 11 | .%`+i> _;_. |
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | ** packaging of this file. | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | ** | 14 | : .. .:, . . . without even the implied warranty of |
15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ** | 17 | ..}^=.= = ; Library General Public License for more |
18 | **********************************************************************/ | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
19 | 28 | ||
20 | #include "editScheme.h" | 29 | #include "editScheme.h" |
21 | 30 | ||
22 | #include "opie/colorpopupmenu.h" | 31 | #include <opie/ocolorbutton.h> |
23 | 32 | ||
24 | #include <qaction.h> | 33 | #include <qaction.h> |
25 | #include <qlabel.h> | 34 | #include <qlabel.h> |
26 | #include <qlayout.h> | 35 | #include <qlayout.h> |
27 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
28 | #include <qscrollview.h> | 37 | #include <qscrollview.h> |
29 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
30 | 39 | ||
31 | EditScheme::EditScheme( QWidget* parent, const char* name, bool modal, WFlags fl, | 40 | EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags fl ) |
32 | int max, QString *list, QString *colors ) | 41 | : QDialog ( parent, name, modal, fl ) |
33 | : QDialog( parent, name, modal, fl ) | ||
34 | { | 42 | { |
35 | setCaption( tr( "Edit scheme" ) ); | 43 | setCaption ( tr( "Edit scheme" ) ); |
36 | QGridLayout* layout = new QGridLayout( this ); | 44 | QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 ); |
37 | layout->setSpacing( 4 ); | ||
38 | layout->setMargin( 4 ); | ||
39 | |||
40 | 45 | ||
41 | maxCount = max; | 46 | m_count = cnt; |
42 | colorList = colors; | 47 | m_buttons = new OColorButton * [cnt]; |
43 | surfaceList = list; | 48 | m_colors = colors; |
44 | colorButtons = new QToolButton * [max]; | 49 | |
45 | int i; | 50 | for ( int i = 0; i < cnt; i++ ) |
46 | QLabel* label; | ||
47 | ColorPopupMenu* colorPopupMenu; | ||
48 | for ( i = 0; i < max; i++ ) | ||
49 | { | 51 | { |
50 | // colorList[i] = colors[i]; | 52 | QLabel *l = new QLabel ( labels [i], this ); |
51 | // surfaceList[i] = list[i]; | 53 | layout-> addWidget ( l, i, 0 ); |
52 | label = new QLabel( tr( surfaceList[i] ), this ); | 54 | |
53 | layout->addWidget( label, i, 0 ); | 55 | m_buttons [i] = new OColorButton ( this ); |
54 | colorButtons[i] = new QToolButton( this, list[i] ); | 56 | m_buttons [i]-> setColor ( colors [i] ); |
55 | colorButtons[i]->setPalette( QPalette( QColor( colors[i] ) ) ); | 57 | layout-> addWidget ( m_buttons [i], i, 1 ); |
56 | layout->addWidget( colorButtons[i], i, 1 ); | ||
57 | |||
58 | colorPopupMenu = new ColorPopupMenu( colors[i], 0, list[i] ); | ||
59 | colorButtons[i]->setPopup( colorPopupMenu ); | ||
60 | colorButtons[i]->setPopupDelay( 0 ); | ||
61 | connect( colorPopupMenu, SIGNAL( colorSelected( const QColor& ) ), this, SLOT( changeColor( const QColor& ) ) ); | ||
62 | } | 58 | } |
63 | } | 59 | } |
64 | 60 | ||
65 | EditScheme::~EditScheme() | 61 | EditScheme::~EditScheme ( ) |
66 | { | 62 | { |
67 | delete [] colorButtons; | 63 | delete [] m_buttons; |
68 | } | 64 | } |
69 | 65 | ||
70 | void EditScheme::changeColor( const QColor& color ) | 66 | void EditScheme::accept ( ) |
71 | { | 67 | { |
72 | QString name( sender()->name() ); | 68 | for ( int i = 0; i < m_count; i++ ) |
73 | int i; | 69 | m_colors [i] = m_buttons [i]-> color ( ); |
74 | 70 | ||
75 | for ( i = 0; i < maxCount; i++ ) | 71 | QDialog::accept ( ); |
76 | { | ||
77 | if ( name == colorButtons[i]->name() ) | ||
78 | { | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | if ( i < maxCount && name == colorButtons[i]->name() ) | ||
83 | { | ||
84 | colorList[i] = color.name(); | ||
85 | colorButtons[i]->setPalette( QPalette( QColor( colorList[i] ) ) ); | ||
86 | } | ||
87 | } | 72 | } |
73 | |||
diff --git a/noncore/settings/appearance2/editScheme.h b/noncore/settings/appearance2/editScheme.h index 583050f..0a025bd 100644 --- a/noncore/settings/appearance2/editScheme.h +++ b/noncore/settings/appearance2/editScheme.h | |||
@@ -1,48 +1,53 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** EditScheme | 2 | =. This file is part of the OPIE Project |
3 | ** | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | ** Dialog for editing color scheme | 4 | .>+-= |
5 | ** | 5 | _;:, .> :=|. This library is free software; you can |
6 | ** Copyright (C) 2002, Dan Williams | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | ** williamsdr@acm.org | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | ** http://draknor.net | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | ** | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ** This file may be distributed and/or modified under the terms of the | 10 | ._= =} : or (at your option) any later version. |
11 | ** GNU General Public License version 2 as published by the Free Software | 11 | .%`+i> _;_. |
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | ** packaging of this file. | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | ** | 14 | : .. .:, . . . without even the implied warranty of |
15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ** | 17 | ..}^=.= = ; Library General Public License for more |
18 | **********************************************************************/ | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
19 | 28 | ||
20 | #ifndef EDITSCHEME_H | 29 | #ifndef EDITSCHEME_H |
21 | #define EDITSCHEME_H | 30 | #define EDITSCHEME_H |
22 | 31 | ||
23 | #include <qdialog.h> | 32 | #include <qdialog.h> |
24 | #include <qtoolbutton.h> | ||
25 | 33 | ||
26 | class QColor; | 34 | class QColor; |
35 | class OColorButton; | ||
27 | 36 | ||
28 | class EditScheme : public QDialog | 37 | class EditScheme : public QDialog { |
29 | { | 38 | Q_OBJECT |
30 | Q_OBJECT | ||
31 | 39 | ||
32 | public: | 40 | public: |
33 | EditScheme( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, | 41 | EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
34 | int = 0, QString * = 0, QString * = 0 ); | 42 | virtual ~EditScheme ( ); |
35 | ~EditScheme(); | ||
36 | |||
37 | int maxCount; | ||
38 | QString * surfaceList; | ||
39 | QString * colorList; | ||
40 | |||
41 | |||
42 | QToolButton** colorButtons; | ||
43 | 43 | ||
44 | protected slots: | 44 | protected slots: |
45 | void changeColor( const QColor& ); | 45 | virtual void accept ( ); |
46 | |||
47 | private: | ||
48 | int m_count; | ||
49 | QColor *m_colors; | ||
50 | OColorButton **m_buttons; | ||
46 | }; | 51 | }; |
47 | 52 | ||
48 | #endif // EDITSCHEME_H | 53 | #endif |
diff --git a/noncore/settings/appearance2/main.cpp b/noncore/settings/appearance2/main.cpp index cfbab0b..3afec46 100644 --- a/noncore/settings/appearance2/main.cpp +++ b/noncore/settings/appearance2/main.cpp | |||
@@ -1,35 +1,43 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | =. This file is part of the OPIE Project |
3 | ** | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | ** This file is part of Qtopia Environment. | 4 | .>+-= |
5 | ** | 5 | _;:, .> :=|. This library is free software; you can |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | ** packaging of this file. | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ** | 10 | ._= =} : or (at your option) any later version. |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | .%`+i> _;_. |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | ** | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | : .. .:, . . . without even the implied warranty of |
15 | ** | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ** not clear to you. | 17 | ..}^=.= = ; Library General Public License for more |
18 | ** | 18 | ++= -. .` .: details. |
19 | **********************************************************************/ | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
20 | 28 | ||
21 | #include "appearance.h" | 29 | #include "appearance.h" |
22 | 30 | ||
23 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
24 | 32 | ||
25 | 33 | ||
26 | int main ( int argc, char **argv ) | 34 | int main ( int argc, char **argv ) |
27 | { | 35 | { |
28 | QPEApplication app ( argc, argv ); | 36 | QPEApplication app ( argc, argv ); |
29 | 37 | ||
30 | Appearance m; | 38 | Appearance m; |
31 | app. showMainDocumentWidget ( &m ); | 39 | app. showMainDocumentWidget ( &m ); |
32 | 40 | ||
33 | return app. exec ( ); | 41 | return app. exec ( ); |
34 | } | 42 | } |
35 | 43 | ||
diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp index e447002..0d8b003 100644 --- a/noncore/settings/appearance2/sample.cpp +++ b/noncore/settings/appearance2/sample.cpp | |||
@@ -1,48 +1,77 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | ||
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This library is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This library is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | |||
1 | #include <qvbox.h> | 30 | #include <qvbox.h> |
2 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
3 | #include <qpainter.h> | 32 | #include <qpainter.h> |
4 | #include <qmenubar.h> | 33 | #include <qmenubar.h> |
5 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
6 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
7 | #include <qscrollbar.h> | 36 | #include <qscrollbar.h> |
8 | #include <qlayout.h> | 37 | #include <qlayout.h> |
9 | #include <qwhatsthis.h> | 38 | #include <qwhatsthis.h> |
10 | #include <qpixmapcache.h> | 39 | #include <qpixmapcache.h> |
11 | #include <qtimer.h> | 40 | #include <qtimer.h> |
12 | #include <qobjectlist.h> | 41 | #include <qobjectlist.h> |
13 | #include <qcommonstyle.h> | 42 | #include <qcommonstyle.h> |
14 | 43 | ||
15 | #include "sample.h" | 44 | #include "sample.h" |
16 | 45 | ||
17 | 46 | ||
18 | class SampleText : public QWidget | 47 | class SampleText : public QWidget |
19 | { | 48 | { |
20 | public: | 49 | public: |
21 | SampleText( const QString &t, bool h, QWidget *parent ) | 50 | SampleText( const QString &t, bool h, QWidget *parent ) |
22 | : QWidget( parent ), hl(h), text(t) | 51 | : QWidget( parent ), hl(h), text(t) |
23 | { | 52 | { |
24 | if ( hl ) | 53 | if ( hl ) |
25 | setBackgroundMode( PaletteHighlight ); | 54 | setBackgroundMode( PaletteHighlight ); |
26 | else | 55 | else |
27 | setBackgroundMode( PaletteBase ); | 56 | setBackgroundMode( PaletteBase ); |
28 | } | 57 | } |
29 | 58 | ||
30 | QSize sizeHint() const | 59 | QSize sizeHint() const |
31 | { | 60 | { |
32 | QFontMetrics fm(font()); | 61 | QFontMetrics fm(font()); |
33 | return QSize( fm.width(text)+10, fm.height()+4 ); | 62 | return QSize( fm.width(text)+10, fm.height()+4 ); |
34 | } | 63 | } |
35 | 64 | ||
36 | void paintEvent( QPaintEvent * ) | 65 | void paintEvent( QPaintEvent * ) |
37 | { | 66 | { |
38 | QPainter p(this); | 67 | QPainter p(this); |
39 | if ( hl ) | 68 | if ( hl ) |
40 | p.setPen( colorGroup().highlightedText() ); | 69 | p.setPen( colorGroup().highlightedText() ); |
41 | else | 70 | else |
42 | p.setPen( colorGroup().text() ); | 71 | p.setPen( colorGroup().text() ); |
43 | p.drawText( rect(), AlignCenter, text ); | 72 | p.drawText( rect(), AlignCenter, text ); |
44 | } | 73 | } |
45 | 74 | ||
46 | private: | 75 | private: |
47 | bool hl; | 76 | bool hl; |
48 | QString text; | 77 | QString text; |
diff --git a/noncore/settings/appearance2/sample.h b/noncore/settings/appearance2/sample.h index c6f9b5a..a189f69 100644 --- a/noncore/settings/appearance2/sample.h +++ b/noncore/settings/appearance2/sample.h | |||
@@ -1,48 +1,77 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | ||
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This library is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This library is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
18 | ..}^=.= = ; Library General Public License for more | ||
19 | ++= -. .` .: details. | ||
20 | : = ...= . :.=- | ||
21 | -. .:....=;==+<; You should have received a copy of the GNU | ||
22 | -_. . . )=. = Library General Public License along with | ||
23 | -- :-=` this library; see the file COPYING.LIB. | ||
24 | If not, write to the Free Software Foundation, | ||
25 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | |||
1 | #ifndef __PREVIEW_H__ | 30 | #ifndef __PREVIEW_H__ |
2 | #define __PREVIEW_H__ | 31 | #define __PREVIEW_H__ |
3 | 32 | ||
4 | #include <qwidget.h> | 33 | #include <qwidget.h> |
5 | 34 | ||
6 | #include <qpe/windowdecorationinterface.h> | 35 | #include <qpe/windowdecorationinterface.h> |
7 | 36 | ||
8 | class QVBox; | 37 | class QVBox; |
9 | class QPopupMenu; | 38 | class QPopupMenu; |
10 | class SampleText; | 39 | class SampleText; |
11 | 40 | ||
12 | class SampleWindow : public QWidget | 41 | class SampleWindow : public QWidget |
13 | { | 42 | { |
14 | Q_OBJECT | 43 | Q_OBJECT |
15 | public: | 44 | public: |
16 | SampleWindow( QWidget *parent ); | 45 | SampleWindow( QWidget *parent ); |
17 | 46 | ||
18 | QSize sizeHint() const; | 47 | QSize sizeHint() const; |
19 | 48 | ||
20 | virtual void setFont( const QFont &f ); | 49 | virtual void setFont( const QFont &f ); |
21 | 50 | ||
22 | void setStyle2 ( QStyle *sty ); | 51 | void setStyle2 ( QStyle *sty ); |
23 | void setDecoration( WindowDecorationInterface *i ); | 52 | void setDecoration( WindowDecorationInterface *i ); |
24 | void setPalette ( const QPalette & ); | 53 | void setPalette ( const QPalette & ); |
25 | 54 | ||
26 | virtual void paintEvent( QPaintEvent * ); | 55 | virtual void paintEvent( QPaintEvent * ); |
27 | 56 | ||
28 | void init(); | 57 | void init(); |
29 | 58 | ||
30 | virtual bool eventFilter( QObject *, QEvent *e ); | 59 | virtual bool eventFilter( QObject *, QEvent *e ); |
31 | virtual void paletteChange( const QPalette &old ); | 60 | virtual void paletteChange( const QPalette &old ); |
32 | virtual void resizeEvent( QResizeEvent *re ); | 61 | virtual void resizeEvent( QResizeEvent *re ); |
33 | 62 | ||
34 | public slots: | 63 | public slots: |
35 | void fixGeometry(); | 64 | void fixGeometry(); |
36 | 65 | ||
37 | protected: | 66 | protected: |
38 | WindowDecorationInterface *iface; | 67 | WindowDecorationInterface *iface; |
39 | WindowDecorationInterface::WindowData wd; | 68 | WindowDecorationInterface::WindowData wd; |
40 | QVBox *container; | 69 | QVBox *container; |
41 | QPopupMenu *popup; | 70 | QPopupMenu *popup; |
42 | int th; | 71 | int th; |
43 | int tb; | 72 | int tb; |
44 | int lb; | 73 | int lb; |
45 | int rb; | 74 | int rb; |
46 | int bb; | 75 | int bb; |
47 | }; | 76 | }; |
48 | 77 | ||
diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h index 3cc63dc..bbfbd41 100644 --- a/noncore/settings/appearance2/stylelistitem.h +++ b/noncore/settings/appearance2/stylelistitem.h | |||
@@ -1,48 +1,76 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This library is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This library is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
1 | #ifndef STYLELISTITEM_H | 29 | #ifndef STYLELISTITEM_H |
2 | #define STYLELISTITEM_H | 30 | #define STYLELISTITEM_H |
3 | 31 | ||
4 | #include <qlistbox.h> | 32 | #include <qlistbox.h> |
5 | #include <qpe/styleinterface.h> | 33 | #include <qpe/styleinterface.h> |
6 | 34 | ||
7 | #include <stdio.h> | 35 | #include <stdio.h> |
8 | 36 | ||
9 | class StyleListItem : public QListBoxText { | 37 | class StyleListItem : public QListBoxText { |
10 | public: | 38 | public: |
11 | StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t ) | 39 | StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t ) |
12 | { | 40 | { |
13 | m_lib = 0; | 41 | m_lib = 0; |
14 | m_style_if = 0; | 42 | m_style_if = 0; |
15 | m_settings_if = 0; | 43 | m_settings_if = 0; |
16 | m_style = sty; | 44 | m_style = sty; |
17 | } | 45 | } |
18 | 46 | ||
19 | StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( )) | 47 | StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( )) |
20 | { | 48 | { |
21 | m_lib = lib; | 49 | m_lib = lib; |
22 | m_style_if = iface; | 50 | m_style_if = iface; |
23 | m_settings_if = 0; | 51 | m_settings_if = 0; |
24 | m_style = iface-> create ( ); | 52 | m_style = iface-> create ( ); |
25 | 53 | ||
26 | iface-> queryInterface ( IID_StyleSettings, (QUnknownInterface **) &m_settings_if ); | 54 | iface-> queryInterface ( IID_StyleSettings, (QUnknownInterface **) &m_settings_if ); |
27 | } | 55 | } |
28 | 56 | ||
29 | virtual ~StyleListItem ( ) | 57 | virtual ~StyleListItem ( ) |
30 | { | 58 | { |
31 | delete m_style; | 59 | delete m_style; |
32 | 60 | ||
33 | if ( m_settings_if ) | 61 | if ( m_settings_if ) |
34 | m_settings_if-> release ( ); | 62 | m_settings_if-> release ( ); |
35 | if ( m_style_if ) | 63 | if ( m_style_if ) |
36 | m_style_if-> release ( ); | 64 | m_style_if-> release ( ); |
37 | delete m_lib; | 65 | delete m_lib; |
38 | } | 66 | } |
39 | 67 | ||
40 | bool hasSettings ( ) const | 68 | bool hasSettings ( ) const |
41 | { | 69 | { |
42 | return ( m_settings_if ); | 70 | return ( m_settings_if ); |
43 | } | 71 | } |
44 | 72 | ||
45 | QWidget *settings ( QWidget *parent ) | 73 | QWidget *settings ( QWidget *parent ) |
46 | { | 74 | { |
47 | return m_settings_if ? m_settings_if-> create ( parent ) : 0; | 75 | return m_settings_if ? m_settings_if-> create ( parent ) : 0; |
48 | } | 76 | } |