-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 51 | ||||
-rw-r--r-- | noncore/settings/appearance2/appearance.h | 51 | ||||
-rw-r--r-- | noncore/settings/appearance2/colorlistitem.h | 49 | ||||
-rw-r--r-- | noncore/settings/appearance2/decolistitem.h | 49 | ||||
-rw-r--r-- | noncore/settings/appearance2/editScheme.cpp | 51 | ||||
-rw-r--r-- | noncore/settings/appearance2/editScheme.h | 51 | ||||
-rw-r--r-- | noncore/settings/appearance2/exceptlistitem.h | 49 | ||||
-rw-r--r-- | noncore/settings/appearance2/main.cpp | 49 | ||||
-rw-r--r-- | noncore/settings/appearance2/sample.cpp | 51 | ||||
-rw-r--r-- | noncore/settings/appearance2/sample.h | 51 | ||||
-rw-r--r-- | noncore/settings/appearance2/stylelistitem.h | 49 |
11 files changed, 292 insertions, 259 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 1aa91bb..93e28fa 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -1,709 +1,712 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | |||
3 | Copyright (c) 2002 Trolltech AS <info@trolltech.com> | 4 | Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
4 | =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 5 | Copyright (c) 2002 Dan Williams <drw@handhelds.org> |
5 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 6 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
6 | .>+-= | 7 | =. |
7 | _;:, .> :=|. This file is free software; you can | 8 | .=l. |
8 | .> <`_, > . <= redistribute it and/or modify it under | 9 | Â Â Â Â Â Â .>+-= |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 10 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
10 | .="- .-=="i, .._ License as published by the Free Software | 11 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
12 | ._= =} : or (at your option) any later version. | 13 | .="- .-=="i, Â Â .._ License as published by the Free Software |
13 | .%`+i> _;_. | 14 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 15 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | Â Â .%`+i> Â Â Â _;_. |
16 | : .. .:, . . . without even the implied warranty of | 17 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 19 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
19 | ..}^=.= = ; Public License for more details. | 20 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | ++= -. .` .: | 21 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
21 | : = ...= . :.=- You should have received a copy of the GNU | 22 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
22 | -. .:....=;==+<; General Public License along with this file; | 23 | ++= Â -. Â Â .` Â Â .: details. |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 24 | : Â Â = Â ...= . :.=- |
24 | -- :-=` Free Software Foundation, Inc., | 25 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
25 | 59 Temple Place - Suite 330, | 26 | Â -_. . . Â )=. Â = Library General Public License along with |
27 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
27 | |||
28 | */ | 31 | */ |
29 | 32 | ||
30 | #include "appearance.h" | 33 | #include "appearance.h" |
31 | #include "editScheme.h" | 34 | #include "editScheme.h" |
32 | #include "stylelistitem.h" | 35 | #include "stylelistitem.h" |
33 | #include "decolistitem.h" | 36 | #include "decolistitem.h" |
34 | #include "colorlistitem.h" | 37 | #include "colorlistitem.h" |
35 | #include "exceptlistitem.h" | 38 | #include "exceptlistitem.h" |
36 | #include "sample.h" | 39 | #include "sample.h" |
37 | 40 | ||
38 | /* OPIE */ | 41 | /* OPIE */ |
39 | #include <opie2/odevice.h> | 42 | #include <opie2/odevice.h> |
40 | #include <opie2/ofiledialog.h> | 43 | #include <opie2/ofiledialog.h> |
41 | #include <opie2/otabwidget.h> | 44 | #include <opie2/otabwidget.h> |
42 | #include <opie2/odebug.h> | 45 | #include <opie2/odebug.h> |
43 | 46 | ||
44 | #include <qpe/config.h> | 47 | #include <qpe/config.h> |
45 | #include <qpe/global.h> | 48 | #include <qpe/global.h> |
46 | #include <qpe/qpeapplication.h> | 49 | #include <qpe/qpeapplication.h> |
47 | #include <qpe/qpemessagebox.h> | 50 | #include <qpe/qpemessagebox.h> |
48 | #include <qpe/qcopenvelope_qws.h> | 51 | #include <qpe/qcopenvelope_qws.h> |
49 | #include <qpe/qpestyle.h> | 52 | #include <qpe/qpestyle.h> |
50 | #include <qpe/lightstyle.h> | 53 | #include <qpe/lightstyle.h> |
51 | #include <qpe/styleinterface.h> | 54 | #include <qpe/styleinterface.h> |
52 | 55 | ||
53 | /* QT */ | 56 | /* QT */ |
54 | #include <qbuttongroup.h> | 57 | #include <qbuttongroup.h> |
55 | #include <qcheckbox.h> | 58 | #include <qcheckbox.h> |
56 | #include <qcombobox.h> | 59 | #include <qcombobox.h> |
57 | #include <qdialog.h> | 60 | #include <qdialog.h> |
58 | #include <qdir.h> | 61 | #include <qdir.h> |
59 | #include <qlabel.h> | 62 | #include <qlabel.h> |
60 | #include <qlayout.h> | 63 | #include <qlayout.h> |
61 | #include <qlineedit.h> | 64 | #include <qlineedit.h> |
62 | #include <qlistbox.h> | 65 | #include <qlistbox.h> |
63 | #include <qmessagebox.h> | 66 | #include <qmessagebox.h> |
64 | #include <qpushbutton.h> | 67 | #include <qpushbutton.h> |
65 | #include <qradiobutton.h> | 68 | #include <qradiobutton.h> |
66 | #if QT_VERSION >= 0x030000 | 69 | #if QT_VERSION >= 0x030000 |
67 | #include <qstylefactory.h> | 70 | #include <qstylefactory.h> |
68 | #endif | 71 | #endif |
69 | #include <qtoolbutton.h> | 72 | #include <qtoolbutton.h> |
70 | #include <qwindowsstyle.h> | 73 | #include <qwindowsstyle.h> |
71 | #include <qlistview.h> | 74 | #include <qlistview.h> |
72 | #include <qheader.h> | 75 | #include <qheader.h> |
73 | #include <qvbox.h> | 76 | #include <qvbox.h> |
74 | #include <qwhatsthis.h> | 77 | #include <qwhatsthis.h> |
75 | 78 | ||
76 | using namespace Opie; | 79 | using namespace Opie; |
77 | using namespace Opie::Ui; | 80 | using namespace Opie::Ui; |
78 | using namespace Opie::Core; | 81 | using namespace Opie::Core; |
79 | 82 | ||
80 | class DefaultWindowDecoration : public WindowDecorationInterface | 83 | class DefaultWindowDecoration : public WindowDecorationInterface |
81 | { | 84 | { |
82 | public: | 85 | public: |
83 | DefaultWindowDecoration() : ref(0) {} | 86 | DefaultWindowDecoration() : ref(0) {} |
84 | QString name() const | 87 | QString name() const |
85 | { | 88 | { |
86 | return "Default"; | 89 | return "Default"; |
87 | } | 90 | } |
88 | QPixmap icon() const | 91 | QPixmap icon() const |
89 | { | 92 | { |
90 | return QPixmap(); | 93 | return QPixmap(); |
91 | } | 94 | } |
92 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 95 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
93 | { | 96 | { |
94 | *iface = 0; | 97 | *iface = 0; |
95 | if ( uuid == IID_QUnknown ) | 98 | if ( uuid == IID_QUnknown ) |
96 | *iface = this; | 99 | *iface = this; |
97 | else if ( uuid == IID_WindowDecoration ) | 100 | else if ( uuid == IID_WindowDecoration ) |
98 | *iface = this; | 101 | *iface = this; |
99 | 102 | ||
100 | if ( *iface ) | 103 | if ( *iface ) |
101 | (*iface)->addRef(); | 104 | (*iface)->addRef(); |
102 | return QS_OK; | 105 | return QS_OK; |
103 | } | 106 | } |
104 | Q_REFCOUNT | 107 | Q_REFCOUNT |
105 | 108 | ||
106 | private: | 109 | private: |
107 | ulong ref; | 110 | ulong ref; |
108 | }; | 111 | }; |
109 | 112 | ||
110 | 113 | ||
111 | 114 | ||
112 | 115 | ||
113 | 116 | ||
114 | 117 | ||
115 | 118 | ||
116 | QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) | 119 | QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) |
117 | { | 120 | { |
118 | QWidget* tab = new QWidget( parent, "StyleTab" ); | 121 | QWidget* tab = new QWidget( parent, "StyleTab" ); |
119 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); | 122 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); |
120 | 123 | ||
121 | m_style_list = new QListBox( tab, "m_style_list" ); | 124 | m_style_list = new QListBox( tab, "m_style_list" ); |
122 | vertLayout->addWidget( m_style_list ); | 125 | vertLayout->addWidget( m_style_list ); |
123 | QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) ); | 126 | QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) ); |
124 | 127 | ||
125 | m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); | 128 | m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); |
126 | connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked())); | 129 | connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked())); |
127 | vertLayout-> addWidget ( m_style_settings ); | 130 | vertLayout-> addWidget ( m_style_settings ); |
128 | QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); | 131 | QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); |
129 | 132 | ||
130 | QString s = cfg. readEntry ( "Style", "Light" ); | 133 | QString s = cfg. readEntry ( "Style", "Light" ); |
131 | 134 | ||
132 | 135 | ||
133 | #if QT_VERSION >= 0x030000 | 136 | #if QT_VERSION >= 0x030000 |
134 | m_style_list->insertStringList(QStyleFactory::styles()); | 137 | m_style_list->insertStringList(QStyleFactory::styles()); |
135 | #else | 138 | #else |
136 | m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); | 139 | m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); |
137 | m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); | 140 | m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); |
138 | m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); | 141 | m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); |
139 | #endif | 142 | #endif |
140 | 143 | ||
141 | { | 144 | { |
142 | QString path = QPEApplication::qpeDir ( ); | 145 | QString path = QPEApplication::qpeDir ( ); |
143 | path.append( "/plugins/styles/" ); | 146 | path.append( "/plugins/styles/" ); |
144 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); | 147 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); |
145 | 148 | ||
146 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 149 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
147 | { | 150 | { |
148 | QString libstr = path; | 151 | QString libstr = path; |
149 | libstr.append( "/" ); | 152 | libstr.append( "/" ); |
150 | libstr.append( *it ); | 153 | libstr.append( *it ); |
151 | QLibrary *lib = new QLibrary ( libstr ); | 154 | QLibrary *lib = new QLibrary ( libstr ); |
152 | StyleInterface *iface; | 155 | StyleInterface *iface; |
153 | 156 | ||
154 | if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) | 157 | if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) |
155 | { | 158 | { |
156 | StyleListItem *slit = new StyleListItem ( lib, iface ); | 159 | StyleListItem *slit = new StyleListItem ( lib, iface ); |
157 | m_style_list-> insertItem ( slit ); | 160 | m_style_list-> insertItem ( slit ); |
158 | 161 | ||
159 | if ( slit-> key ( ) == s ) | 162 | if ( slit-> key ( ) == s ) |
160 | m_style_list-> setCurrentItem ( slit ); | 163 | m_style_list-> setCurrentItem ( slit ); |
161 | } | 164 | } |
162 | else | 165 | else |
163 | delete lib; | 166 | delete lib; |
164 | } | 167 | } |
165 | } | 168 | } |
166 | 169 | ||
167 | m_original_style = m_style_list-> currentItem ( ); | 170 | m_original_style = m_style_list-> currentItem ( ); |
168 | styleClicked ( m_original_style ); | 171 | styleClicked ( m_original_style ); |
169 | 172 | ||
170 | connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) ); | 173 | connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) ); |
171 | 174 | ||
172 | return tab; | 175 | return tab; |
173 | } | 176 | } |
174 | 177 | ||
175 | QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) | 178 | QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) |
176 | { | 179 | { |
177 | QWidget* tab = new QWidget( parent, "DecoTab" ); | 180 | QWidget* tab = new QWidget( parent, "DecoTab" ); |
178 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); | 181 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); |
179 | 182 | ||
180 | m_deco_list = new QListBox( tab, "m_deco_list" ); | 183 | m_deco_list = new QListBox( tab, "m_deco_list" ); |
181 | vertLayout->addWidget( m_deco_list ); | 184 | vertLayout->addWidget( m_deco_list ); |
182 | QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) ); | 185 | QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) ); |
183 | 186 | ||
184 | QString s = cfg. readEntry ( "Decoration", "libflat.so" ); | 187 | QString s = cfg. readEntry ( "Decoration", "libflat.so" ); |
185 | 188 | ||
186 | m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); | 189 | m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); |
187 | 190 | ||
188 | { | 191 | { |
189 | QString path = QPEApplication::qpeDir(); | 192 | QString path = QPEApplication::qpeDir(); |
190 | path.append( "/plugins/decorations/" ); | 193 | path.append( "/plugins/decorations/" ); |
191 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); | 194 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); |
192 | 195 | ||
193 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 196 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
194 | { | 197 | { |
195 | QString libstr = path; | 198 | QString libstr = path; |
196 | libstr.append( "/" ); | 199 | libstr.append( "/" ); |
197 | libstr.append( *it ); | 200 | libstr.append( *it ); |
198 | QLibrary *lib = new QLibrary ( libstr ); | 201 | QLibrary *lib = new QLibrary ( libstr ); |
199 | WindowDecorationInterface *iface; | 202 | WindowDecorationInterface *iface; |
200 | 203 | ||
201 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) | 204 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) |
202 | { | 205 | { |
203 | DecoListItem *dlit = new DecoListItem ( lib, iface ); | 206 | DecoListItem *dlit = new DecoListItem ( lib, iface ); |
204 | m_deco_list-> insertItem ( dlit ); | 207 | m_deco_list-> insertItem ( dlit ); |
205 | 208 | ||
206 | if ( dlit-> key ( ) == s ) | 209 | if ( dlit-> key ( ) == s ) |
207 | m_deco_list-> setCurrentItem ( dlit ); | 210 | m_deco_list-> setCurrentItem ( dlit ); |
208 | } | 211 | } |
209 | else | 212 | else |
210 | delete lib; | 213 | delete lib; |
211 | } | 214 | } |
212 | } | 215 | } |
213 | 216 | ||
214 | m_original_deco = m_deco_list-> currentItem ( ); | 217 | m_original_deco = m_deco_list-> currentItem ( ); |
215 | if ( m_deco_list-> currentItem ( ) < 0 ) | 218 | if ( m_deco_list-> currentItem ( ) < 0 ) |
216 | m_deco_list-> setCurrentItem ( 0 ); | 219 | m_deco_list-> setCurrentItem ( 0 ); |
217 | decoClicked ( m_original_deco ); | 220 | decoClicked ( m_original_deco ); |
218 | 221 | ||
219 | connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) ); | 222 | connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) ); |
220 | 223 | ||
221 | return tab; | 224 | return tab; |
222 | } | 225 | } |
223 | 226 | ||
224 | QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) | 227 | QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) |
225 | { | 228 | { |
226 | QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); | 229 | QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); |
227 | QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); | 230 | QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); |
228 | int size = cfg. readNumEntry ( "FontSize", 10 ); | 231 | int size = cfg. readNumEntry ( "FontSize", 10 ); |
229 | 232 | ||
230 | m_fontselect = new OFontSelector ( false, parent, "FontTab" ); | 233 | m_fontselect = new OFontSelector ( false, parent, "FontTab" ); |
231 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); | 234 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); |
232 | QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); | 235 | QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); |
233 | 236 | ||
234 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), | 237 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), |
235 | this, SLOT( fontClicked(const QFont&))); | 238 | this, SLOT( fontClicked(const QFont&))); |
236 | 239 | ||
237 | return m_fontselect; | 240 | return m_fontselect; |
238 | } | 241 | } |
239 | 242 | ||
240 | QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | 243 | QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) |
241 | { | 244 | { |
242 | QWidget *tab = new QWidget( parent, "ColorTab" ); | 245 | QWidget *tab = new QWidget( parent, "ColorTab" ); |
243 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); | 246 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); |
244 | gridLayout->setRowStretch ( 3, 10 ); | 247 | gridLayout->setRowStretch ( 3, 10 ); |
245 | 248 | ||
246 | m_color_list = new QListBox ( tab ); | 249 | m_color_list = new QListBox ( tab ); |
247 | gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); | 250 | gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); |
248 | connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) ); | 251 | connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) ); |
249 | QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); | 252 | QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); |
250 | 253 | ||
251 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); | 254 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); |
252 | 255 | ||
253 | QString path = QPEApplication::qpeDir ( ); | 256 | QString path = QPEApplication::qpeDir ( ); |
254 | path.append( "/etc/colors/" ); | 257 | path.append( "/etc/colors/" ); |
255 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); | 258 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); |
256 | 259 | ||
257 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 260 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
258 | { | 261 | { |
259 | QString name = (*it). left ((*it). find ( ".scheme" )); | 262 | QString name = (*it). left ((*it). find ( ".scheme" )); |
260 | QString pathstr = path; | 263 | QString pathstr = path; |
261 | pathstr.append( *it ); | 264 | pathstr.append( *it ); |
262 | Config config ( pathstr, Config::File ); | 265 | Config config ( pathstr, Config::File ); |
263 | config. setGroup ( "Colors" ); | 266 | config. setGroup ( "Colors" ); |
264 | 267 | ||
265 | m_color_list-> insertItem ( new ColorListItem ( name, config )); | 268 | m_color_list-> insertItem ( new ColorListItem ( name, config )); |
266 | } | 269 | } |
267 | 270 | ||
268 | m_color_list-> setCurrentItem ( 0 ); | 271 | m_color_list-> setCurrentItem ( 0 ); |
269 | 272 | ||
270 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); | 273 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); |
271 | tempButton->setText( tr( "Edit..." ) ); | 274 | tempButton->setText( tr( "Edit..." ) ); |
272 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); | 275 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); |
273 | gridLayout->addWidget( tempButton, 0, 1 ); | 276 | gridLayout->addWidget( tempButton, 0, 1 ); |
274 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); | 277 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); |
275 | 278 | ||
276 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); | 279 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); |
277 | tempButton->setText( tr( "Delete" ) ); | 280 | tempButton->setText( tr( "Delete" ) ); |
278 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); | 281 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); |
279 | gridLayout->addWidget( tempButton, 1, 1 ); | 282 | gridLayout->addWidget( tempButton, 1, 1 ); |
280 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); | 283 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); |
281 | 284 | ||
282 | tempButton = new QPushButton( tab, "saveSchemeButton" ); | 285 | tempButton = new QPushButton( tab, "saveSchemeButton" ); |
283 | tempButton->setText( tr( "Save" ) ); | 286 | tempButton->setText( tr( "Save" ) ); |
284 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); | 287 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); |
285 | gridLayout->addWidget( tempButton, 2, 1 ); | 288 | gridLayout->addWidget( tempButton, 2, 1 ); |
286 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); | 289 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); |
287 | 290 | ||
288 | return tab; | 291 | return tab; |
289 | } | 292 | } |
290 | 293 | ||
291 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | 294 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) |
292 | { | 295 | { |
293 | QWidget *tab = new QWidget ( parent ); | 296 | QWidget *tab = new QWidget ( parent ); |
294 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 297 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
295 | 298 | ||
296 | /* | 299 | /* |
297 | * show scrollbars on the left? | 300 | * show scrollbars on the left? |
298 | */ | 301 | */ |
299 | m_leftHand = new QCheckBox( tr("Show Scrollbars on the left"), tab ); | 302 | m_leftHand = new QCheckBox( tr("Show Scrollbars on the left"), tab ); |
300 | m_leftHand->setChecked( cfg.readBoolEntry( "LeftHand", false ) ); | 303 | m_leftHand->setChecked( cfg.readBoolEntry( "LeftHand", false ) ); |
301 | QWhatsThis::add( m_leftHand, tr( "Click here to display scrollbars on the left side instead of the right." ) ); | 304 | QWhatsThis::add( m_leftHand, tr( "Click here to display scrollbars on the left side instead of the right." ) ); |
302 | vertLayout->addWidget( m_leftHand ); | 305 | vertLayout->addWidget( m_leftHand ); |
303 | 306 | ||
304 | QFrame *f = new QFrame ( tab ); | 307 | QFrame *f = new QFrame ( tab ); |
305 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | 308 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); |
306 | vertLayout-> addWidget ( f ); | 309 | vertLayout-> addWidget ( f ); |
307 | vertLayout-> addSpacing ( 3 ); | 310 | vertLayout-> addSpacing ( 3 ); |
308 | 311 | ||
309 | 312 | ||
310 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 313 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
311 | 314 | ||
312 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; | 315 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; |
313 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); | 316 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); |
314 | 317 | ||
315 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); | 318 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); |
316 | gridLayout-> addWidget ( label, 0, 0 ); | 319 | gridLayout-> addWidget ( label, 0, 0 ); |
317 | 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" ) ); | 320 | 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" ) ); |
318 | 321 | ||
319 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); | 322 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); |
320 | btngrp-> hide ( ); | 323 | btngrp-> hide ( ); |
321 | btngrp-> setExclusive ( true ); | 324 | btngrp-> setExclusive ( true ); |
322 | 325 | ||
323 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); | 326 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); |
324 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); | 327 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); |
325 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); | 328 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); |
326 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); | 329 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); |
327 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); | 330 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); |
328 | m_tabstyle_list-> setCurrentItem ( style ); | 331 | m_tabstyle_list-> setCurrentItem ( style ); |
329 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 332 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); |
330 | 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" ) ); | 333 | 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" ) ); |
331 | 334 | ||
332 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); | 335 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); |
333 | btngrp-> insert ( m_tabstyle_top ); | 336 | btngrp-> insert ( m_tabstyle_top ); |
334 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); | 337 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); |
335 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); | 338 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); |
336 | 339 | ||
337 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); | 340 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); |
338 | btngrp-> insert ( m_tabstyle_bottom ); | 341 | btngrp-> insert ( m_tabstyle_bottom ); |
339 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); | 342 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); |
340 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); | 343 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); |
341 | 344 | ||
342 | m_tabstyle_top-> setChecked ( tabtop ); | 345 | m_tabstyle_top-> setChecked ( tabtop ); |
343 | m_tabstyle_bottom-> setChecked ( !tabtop ); | 346 | m_tabstyle_bottom-> setChecked ( !tabtop ); |
344 | 347 | ||
345 | m_original_tabstyle = style; | 348 | m_original_tabstyle = style; |
346 | m_original_tabpos = tabtop; | 349 | m_original_tabpos = tabtop; |
347 | 350 | ||
348 | vertLayout-> addSpacing ( 3 ); | 351 | vertLayout-> addSpacing ( 3 ); |
349 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); | 352 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); |
350 | 353 | ||
351 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); | 354 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); |
352 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); | 355 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); |
353 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); | 356 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); |
354 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); | 357 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); |
355 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); | 358 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); |
356 | 359 | ||
357 | rotbtngrp-> hide ( ); | 360 | rotbtngrp-> hide ( ); |
358 | rotbtngrp-> setExclusive ( true ); | 361 | rotbtngrp-> setExclusive ( true ); |
359 | rotbtngrp-> insert ( m_rotdir_cw ); | 362 | rotbtngrp-> insert ( m_rotdir_cw ); |
360 | rotbtngrp-> insert ( m_rotdir_ccw ); | 363 | rotbtngrp-> insert ( m_rotdir_ccw ); |
361 | rotbtngrp-> insert ( m_rotdir_flip ); | 364 | rotbtngrp-> insert ( m_rotdir_flip ); |
362 | 365 | ||
363 | QImage ccwImage = Resource::loadImage( "redo" ); | 366 | QImage ccwImage = Resource::loadImage( "redo" ); |
364 | QPixmap cw, ccw, flip; | 367 | QPixmap cw, ccw, flip; |
365 | cw.convertFromImage( ccwImage.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 368 | cw.convertFromImage( ccwImage.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
366 | ccw.convertFromImage( ccwImage.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ).mirror( 1, 0 ) ); | 369 | ccw.convertFromImage( ccwImage.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ).mirror( 1, 0 ) ); |
367 | flip.convertFromImage( Resource::loadImage( "pass" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 370 | flip.convertFromImage( Resource::loadImage( "pass" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
368 | 371 | ||
369 | m_rotdir_cw-> setPixmap( cw ); | 372 | m_rotdir_cw-> setPixmap( cw ); |
370 | m_rotdir_ccw-> setPixmap( ccw ); | 373 | m_rotdir_ccw-> setPixmap( ccw ); |
371 | m_rotdir_flip-> setPixmap( flip ); | 374 | m_rotdir_flip-> setPixmap( flip ); |
372 | 375 | ||
373 | rotLay-> addWidget ( rotlabel, 0 ); | 376 | rotLay-> addWidget ( rotlabel, 0 ); |
374 | rotLay-> addWidget ( m_rotdir_cw, 0 ); | 377 | rotLay-> addWidget ( m_rotdir_cw, 0 ); |
375 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); | 378 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); |
376 | rotLay-> addWidget ( m_rotdir_flip, 0 ); | 379 | rotLay-> addWidget ( m_rotdir_flip, 0 ); |
377 | 380 | ||
378 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 381 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
379 | ODirection rot = CW; | 382 | ODirection rot = CW; |
380 | 383 | ||
381 | if (rotDirection == -1) | 384 | if (rotDirection == -1) |
382 | { | 385 | { |
383 | rot = ODevice::inst ( )-> direction ( ); | 386 | rot = ODevice::inst ( )-> direction ( ); |
384 | } | 387 | } |
385 | else | 388 | else |
386 | { | 389 | { |
387 | rot = (ODirection)rotDirection; | 390 | rot = (ODirection)rotDirection; |
388 | } | 391 | } |
389 | 392 | ||
390 | m_rotdir_cw-> setChecked ( rot == CW ); | 393 | m_rotdir_cw-> setChecked ( rot == CW ); |
391 | m_rotdir_ccw-> setChecked ( rot == CCW ); | 394 | m_rotdir_ccw-> setChecked ( rot == CCW ); |
392 | m_rotdir_flip-> setChecked ( rot == Flip ); | 395 | m_rotdir_flip-> setChecked ( rot == Flip ); |
393 | 396 | ||
394 | 397 | ||
395 | /* | 398 | /* |
396 | * add a spacing | 399 | * add a spacing |
397 | */ | 400 | */ |
398 | vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); | 401 | vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); |
399 | return tab; | 402 | return tab; |
400 | } | 403 | } |
401 | 404 | ||
402 | 405 | ||
403 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 406 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
404 | : QDialog ( parent, name, true, WStyle_ContextHelp ) | 407 | : QDialog ( parent, name, true, WStyle_ContextHelp ) |
405 | { | 408 | { |
406 | setCaption( tr( "Appearance Settings" ) ); | 409 | setCaption( tr( "Appearance Settings" ) ); |
407 | 410 | ||
408 | Config config( "qpe" ); | 411 | Config config( "qpe" ); |
409 | config.setGroup( "Appearance" ); | 412 | config.setGroup( "Appearance" ); |
410 | 413 | ||
411 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); | 414 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); |
412 | 415 | ||
413 | m_sample = new SampleWindow ( this ); | 416 | m_sample = new SampleWindow ( this ); |
414 | 417 | ||
415 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); | 418 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); |
416 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 419 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
417 | 420 | ||
418 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 421 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
419 | QWidget *styletab; | 422 | QWidget *styletab; |
420 | 423 | ||
421 | m_color_list = 0; | 424 | m_color_list = 0; |
422 | 425 | ||
423 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); | 426 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); |
424 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); | 427 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); |
425 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); | 428 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); |
426 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); | 429 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); |
427 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); | 430 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); |
428 | 431 | ||
429 | top-> addWidget ( tw, 10 ); | 432 | top-> addWidget ( tw, 10 ); |
430 | top-> addWidget ( m_sample, 1 ); | 433 | top-> addWidget ( m_sample, 1 ); |
431 | 434 | ||
432 | tw-> setCurrentTab ( styletab ); | 435 | tw-> setCurrentTab ( styletab ); |
433 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); | 436 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); |
434 | 437 | ||
435 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; | 438 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; |
436 | } | 439 | } |
437 | 440 | ||
438 | Appearance::~Appearance() | 441 | Appearance::~Appearance() |
439 | {} | 442 | {} |
440 | 443 | ||
441 | void Appearance::tabChanged ( QWidget *w ) | 444 | void Appearance::tabChanged ( QWidget *w ) |
442 | { | 445 | { |
443 | if ( w == m_advtab ) | 446 | if ( w == m_advtab ) |
444 | { | 447 | { |
445 | m_sample-> hide ( ); | 448 | m_sample-> hide ( ); |
446 | updateGeometry ( ); // shouldn't be necessary ... | 449 | updateGeometry ( ); // shouldn't be necessary ... |
447 | } | 450 | } |
448 | else | 451 | else |
449 | m_sample-> show ( ); | 452 | m_sample-> show ( ); |
450 | } | 453 | } |
451 | 454 | ||
452 | void Appearance::accept ( ) | 455 | void Appearance::accept ( ) |
453 | { | 456 | { |
454 | bool newtabpos = m_tabstyle_top-> isChecked ( ); | 457 | bool newtabpos = m_tabstyle_top-> isChecked ( ); |
455 | int newtabstyle = m_tabstyle_list-> currentItem ( ); | 458 | int newtabstyle = m_tabstyle_list-> currentItem ( ); |
456 | 459 | ||
457 | Config config ( "qpe" ); | 460 | Config config ( "qpe" ); |
458 | config. setGroup ( "Appearance" ); | 461 | config. setGroup ( "Appearance" ); |
459 | 462 | ||
460 | if ( m_style_changed ) | 463 | if ( m_style_changed ) |
461 | { | 464 | { |
462 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 465 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
463 | if ( item ) | 466 | if ( item ) |
464 | config.writeEntry( "Style", item-> key ( )); | 467 | config.writeEntry( "Style", item-> key ( )); |
465 | } | 468 | } |
466 | 469 | ||
467 | if ( m_deco_changed ) | 470 | if ( m_deco_changed ) |
468 | { | 471 | { |
469 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); | 472 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); |
470 | if ( item ) | 473 | if ( item ) |
471 | config.writeEntry( "Decoration", item-> key ( )); | 474 | config.writeEntry( "Decoration", item-> key ( )); |
472 | } | 475 | } |
473 | 476 | ||
474 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) | 477 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) |
475 | { | 478 | { |
476 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | 479 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); |
477 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); | 480 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); |
478 | } | 481 | } |
479 | 482 | ||
480 | if ( m_font_changed ) | 483 | if ( m_font_changed ) |
481 | { | 484 | { |
482 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); | 485 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); |
483 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); | 486 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); |
484 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); | 487 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); |
485 | } | 488 | } |
486 | 489 | ||
487 | 490 | ||
488 | if ( m_color_changed ) | 491 | if ( m_color_changed ) |
489 | { | 492 | { |
490 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 493 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
491 | 494 | ||
492 | if ( item ) | 495 | if ( item ) |
493 | item-> save ( config ); | 496 | item-> save ( config ); |
494 | } | 497 | } |
495 | 498 | ||
496 | ODirection rot; | 499 | ODirection rot; |
497 | if (m_rotdir_ccw-> isChecked ( )) | 500 | if (m_rotdir_ccw-> isChecked ( )) |
498 | { | 501 | { |
499 | rot = CCW; | 502 | rot = CCW; |
500 | } | 503 | } |
501 | else if (m_rotdir_cw-> isChecked ( )) | 504 | else if (m_rotdir_cw-> isChecked ( )) |
502 | { | 505 | { |
503 | rot = CW; | 506 | rot = CW; |
504 | } | 507 | } |
505 | else | 508 | else |
506 | { | 509 | { |
507 | rot = Flip; | 510 | rot = Flip; |
508 | } | 511 | } |
509 | config. writeEntry ( "rotatedir", (int)rot ); | 512 | config. writeEntry ( "rotatedir", (int)rot ); |
510 | 513 | ||
511 | config. writeEntry( "LeftHand", m_leftHand->isChecked() ); | 514 | config. writeEntry( "LeftHand", m_leftHand->isChecked() ); |
512 | 515 | ||
513 | config. write ( ); // need to flush the config info first | 516 | config. write ( ); // need to flush the config info first |
514 | Global::applyStyle ( ); | 517 | Global::applyStyle ( ); |
515 | 518 | ||
516 | QDialog::accept ( ); | 519 | QDialog::accept ( ); |
517 | } | 520 | } |
518 | 521 | ||
519 | void Appearance::done ( int r ) | 522 | void Appearance::done ( int r ) |
520 | { | 523 | { |
521 | QDialog::done ( r ); | 524 | QDialog::done ( r ); |
522 | close ( ); | 525 | close ( ); |
523 | } | 526 | } |
524 | 527 | ||
525 | 528 | ||
526 | void Appearance::styleClicked ( int index ) | 529 | void Appearance::styleClicked ( int index ) |
527 | { | 530 | { |
528 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); | 531 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); |
529 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); | 532 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); |
530 | 533 | ||
531 | if ( m_sample && sli && sli-> style ( )) | 534 | if ( m_sample && sli && sli-> style ( )) |
532 | { | 535 | { |
533 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; | 536 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; |
534 | 537 | ||
535 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); | 538 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); |
536 | } | 539 | } |
537 | 540 | ||
538 | m_style_changed |= ( index != m_original_style ); | 541 | m_style_changed |= ( index != m_original_style ); |
539 | } | 542 | } |
540 | 543 | ||
541 | void Appearance::styleSettingsClicked ( ) | 544 | void Appearance::styleSettingsClicked ( ) |
542 | { | 545 | { |
543 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 546 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
544 | 547 | ||
545 | if ( item && item-> hasSettings ( )) | 548 | if ( item && item-> hasSettings ( )) |
546 | { | 549 | { |
547 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); | 550 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); |
548 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); | 551 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); |
549 | 552 | ||
550 | QWidget *w = item-> settings ( d ); | 553 | QWidget *w = item-> settings ( d ); |
551 | 554 | ||
552 | if ( w ) | 555 | if ( w ) |
553 | { | 556 | { |
554 | vbox-> addWidget ( w ); | 557 | vbox-> addWidget ( w ); |
555 | 558 | ||
556 | d-> setCaption ( w-> caption ( )); | 559 | d-> setCaption ( w-> caption ( )); |
557 | 560 | ||
558 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); | 561 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); |
559 | 562 | ||
560 | if ( item-> setSettings ( accepted )) | 563 | if ( item-> setSettings ( accepted )) |
561 | m_style_changed = true; | 564 | m_style_changed = true; |
562 | } | 565 | } |
563 | delete d; | 566 | delete d; |
564 | } | 567 | } |
565 | } | 568 | } |
566 | 569 | ||
567 | void Appearance::decoClicked ( int index ) | 570 | void Appearance::decoClicked ( int index ) |
568 | { | 571 | { |
569 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); | 572 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); |
570 | 573 | ||
571 | if ( m_sample ) | 574 | if ( m_sample ) |
572 | { | 575 | { |
573 | if ( dli && dli-> interface ( )) | 576 | if ( dli && dli-> interface ( )) |
574 | m_sample-> setDecoration ( dli-> interface ( )); | 577 | m_sample-> setDecoration ( dli-> interface ( )); |
575 | else | 578 | else |
576 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 579 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
577 | m_sample-> repaint ( ); | 580 | m_sample-> repaint ( ); |
578 | } | 581 | } |
579 | m_deco_changed |= ( index != m_original_deco ); | 582 | m_deco_changed |= ( index != m_original_deco ); |
580 | } | 583 | } |
581 | 584 | ||
582 | void Appearance::fontClicked ( const QFont &f ) | 585 | void Appearance::fontClicked ( const QFont &f ) |
583 | { | 586 | { |
584 | m_font_changed |= ( f != m_sample-> font ( )); | 587 | m_font_changed |= ( f != m_sample-> font ( )); |
585 | m_sample-> setFont ( f ); | 588 | m_sample-> setFont ( f ); |
586 | } | 589 | } |
587 | 590 | ||
588 | void Appearance::colorClicked ( int index ) | 591 | void Appearance::colorClicked ( int index ) |
589 | { | 592 | { |
590 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); | 593 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); |
591 | 594 | ||
592 | if ( item ) | 595 | if ( item ) |
593 | m_sample-> setPalette ( item-> palette ( )); | 596 | m_sample-> setPalette ( item-> palette ( )); |
594 | 597 | ||
595 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); | 598 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); |
596 | } | 599 | } |
597 | 600 | ||
598 | 601 | ||
599 | void Appearance::editSchemeClicked ( ) | 602 | void Appearance::editSchemeClicked ( ) |
600 | { | 603 | { |
601 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 604 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
602 | 605 | ||
603 | int cnt = 0; | 606 | int cnt = 0; |
604 | QString labels [QColorGroup::NColorRoles]; | 607 | QString labels [QColorGroup::NColorRoles]; |
605 | QColor colors [QColorGroup::NColorRoles]; | 608 | QColor colors [QColorGroup::NColorRoles]; |
606 | 609 | ||
607 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) | 610 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) |
608 | { | 611 | { |
609 | QColor col = item->color( static_cast<QColorGroup::ColorRole>( role ) ); | 612 | QColor col = item->color( static_cast<QColorGroup::ColorRole>( role ) ); |
610 | 613 | ||
611 | if ( col. isValid ( )) | 614 | if ( col. isValid ( )) |
612 | { | 615 | { |
613 | labels[cnt] = item->label( static_cast<QColorGroup::ColorRole>( role ) ); | 616 | labels[cnt] = item->label( static_cast<QColorGroup::ColorRole>( role ) ); |
614 | colors[cnt] = col; | 617 | colors[cnt] = col; |
615 | 618 | ||
616 | cnt++; | 619 | cnt++; |
617 | } | 620 | } |
618 | } | 621 | } |
619 | 622 | ||
620 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); | 623 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); |
621 | if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) | 624 | if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) |
622 | { | 625 | { |
623 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); | 626 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); |
624 | cnt = 0; | 627 | cnt = 0; |
625 | 628 | ||
626 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) | 629 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) |
627 | { | 630 | { |
628 | if ( item->color( static_cast<QColorGroup::ColorRole>( role ) ).isValid() ) | 631 | if ( item->color( static_cast<QColorGroup::ColorRole>( role ) ).isValid() ) |
629 | { | 632 | { |
630 | citem->setColor( static_cast<QColorGroup::ColorRole>( role ), colors[cnt] ); | 633 | citem->setColor( static_cast<QColorGroup::ColorRole>( role ), colors[cnt] ); |
631 | cnt++; | 634 | cnt++; |
632 | } | 635 | } |
633 | } | 636 | } |
634 | 637 | ||
635 | m_color_list-> setCurrentItem ( 0 ); | 638 | m_color_list-> setCurrentItem ( 0 ); |
636 | colorClicked ( 0 ); | 639 | colorClicked ( 0 ); |
637 | 640 | ||
638 | m_color_changed = true; | 641 | m_color_changed = true; |
639 | } | 642 | } |
640 | delete editdlg; | 643 | delete editdlg; |
641 | } | 644 | } |
642 | 645 | ||
643 | 646 | ||
644 | void Appearance::saveSchemeClicked() | 647 | void Appearance::saveSchemeClicked() |
645 | { | 648 | { |
646 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 649 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
647 | 650 | ||
648 | if ( !item ) | 651 | if ( !item ) |
649 | return; | 652 | return; |
650 | 653 | ||
651 | QDialog *d = new QDialog ( this, 0, true ); | 654 | QDialog *d = new QDialog ( this, 0, true ); |
652 | d-> setCaption ( tr( "Save Scheme" )); | 655 | d-> setCaption ( tr( "Save Scheme" )); |
653 | QLineEdit *ed = new QLineEdit ( d ); | 656 | QLineEdit *ed = new QLineEdit ( d ); |
654 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); | 657 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); |
655 | ed-> setFocus ( ); | 658 | ed-> setFocus ( ); |
656 | 659 | ||
657 | if ( d-> exec ( ) == QDialog::Accepted ) | 660 | if ( d-> exec ( ) == QDialog::Accepted ) |
658 | { | 661 | { |
659 | QString schemename = ed-> text ( ); | 662 | QString schemename = ed-> text ( ); |
660 | QString filestr = QPEApplication::qpeDir(); | 663 | QString filestr = QPEApplication::qpeDir(); |
661 | filestr.append( "/etc/colors/" ); | 664 | filestr.append( "/etc/colors/" ); |
662 | filestr.append( schemename ); | 665 | filestr.append( schemename ); |
663 | filestr.append( ".scheme" ); | 666 | filestr.append( ".scheme" ); |
664 | QFile file ( filestr ); | 667 | QFile file ( filestr ); |
665 | if ( !file. exists ( )) | 668 | if ( !file. exists ( )) |
666 | { | 669 | { |
667 | QPalette p = item-> palette ( ); | 670 | QPalette p = item-> palette ( ); |
668 | 671 | ||
669 | Config config ( file.name(), Config::File ); | 672 | Config config ( file.name(), Config::File ); |
670 | config. setGroup( "Colors" ); | 673 | config. setGroup( "Colors" ); |
671 | 674 | ||
672 | item-> save ( config ); | 675 | item-> save ( config ); |
673 | 676 | ||
674 | config. write ( ); // need to flush the config info first | 677 | config. write ( ); // need to flush the config info first |
675 | 678 | ||
676 | m_color_list-> insertItem ( new ColorListItem ( schemename, config )); | 679 | m_color_list-> insertItem ( new ColorListItem ( schemename, config )); |
677 | } | 680 | } |
678 | else | 681 | else |
679 | { | 682 | { |
680 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); | 683 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); |
681 | } | 684 | } |
682 | } | 685 | } |
683 | delete d; | 686 | delete d; |
684 | } | 687 | } |
685 | 688 | ||
686 | void Appearance::deleteSchemeClicked() | 689 | void Appearance::deleteSchemeClicked() |
687 | { | 690 | { |
688 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 691 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
689 | 692 | ||
690 | if ( !item ) | 693 | if ( !item ) |
691 | return; | 694 | return; |
692 | 695 | ||
693 | if ( m_color_list-> currentItem ( ) > 0 ) | 696 | if ( m_color_list-> currentItem ( ) > 0 ) |
694 | { | 697 | { |
695 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) | 698 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) |
696 | { | 699 | { |
697 | QString filestr = QPEApplication::qpeDir ( ); | 700 | QString filestr = QPEApplication::qpeDir ( ); |
698 | filestr.append( "/etc/colors/" ); | 701 | filestr.append( "/etc/colors/" ); |
699 | filestr.append( item-> text ( ) ); | 702 | filestr.append( item-> text ( ) ); |
700 | filestr.append( ".scheme" ); | 703 | filestr.append( ".scheme" ); |
701 | QFile::remove ( filestr ); | 704 | QFile::remove ( filestr ); |
702 | delete item; | 705 | delete item; |
703 | } | 706 | } |
704 | } | 707 | } |
705 | else | 708 | else |
706 | { | 709 | { |
707 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); | 710 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); |
708 | } | 711 | } |
709 | } | 712 | } |
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h index 287f9f7..ef7e874 100644 --- a/noncore/settings/appearance2/appearance.h +++ b/noncore/settings/appearance2/appearance.h | |||
@@ -1,125 +1,128 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 3 | |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | Copyright (c) 2002 Dan Williams <drw@handhelds.org> |
5 | .>+-= | 5 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
6 | _;:, .> :=|. This file is free software; you can | 6 | =. |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .=l. |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | Â Â Â Â Â Â .>+-= |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
11 | ._= =} : or (at your option) any later version. | 11 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
12 | .%`+i> _;_. | 12 | .="- .-=="i, Â Â .._ License as published by the Free Software |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
15 | : .. .:, . . . without even the implied warranty of | 15 | Â Â .%`+i> Â Â Â _;_. |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
18 | ..}^=.= = ; Public License for more details. | 18 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
19 | ++= -. .` .: | 19 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | ++= Â -. Â Â .` Â Â .: details. |
23 | -- :-=` Free Software Foundation, Inc., | 23 | : Â Â = Â ...= . :.=- |
24 | 59 Temple Place - Suite 330, | 24 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
25 | Â -_. . . Â )=. Â = Library General Public License along with | ||
26 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
26 | |||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #ifndef APPEARANCESETTINGS_H | 32 | #ifndef APPEARANCESETTINGS_H |
30 | #define APPEARANCESETTINGS_H | 33 | #define APPEARANCESETTINGS_H |
31 | 34 | ||
32 | #include <opie2/ofontselector.h> | 35 | #include <opie2/ofontselector.h> |
33 | 36 | ||
34 | #include <qpe/fontdatabase.h> | 37 | #include <qpe/fontdatabase.h> |
35 | 38 | ||
36 | #include <qdialog.h> | 39 | #include <qdialog.h> |
37 | 40 | ||
38 | using Opie::Ui::OFontSelector; | 41 | using Opie::Ui::OFontSelector; |
39 | 42 | ||
40 | class QCheckBox; | 43 | class QCheckBox; |
41 | class QComboBox; | 44 | class QComboBox; |
42 | class QLabel; | 45 | class QLabel; |
43 | class QLineEdit; | 46 | class QLineEdit; |
44 | class QListBox; | 47 | class QListBox; |
45 | class QMultiLineEdit; | 48 | class QMultiLineEdit; |
46 | class QPushButton; | 49 | class QPushButton; |
47 | class QRadioButton; | 50 | class QRadioButton; |
48 | class QToolButton; | 51 | class QToolButton; |
49 | class SampleWindow; | 52 | class SampleWindow; |
50 | namespace Opie {namespace Ui {class OFontSelector;}} | 53 | namespace Opie {namespace Ui {class OFontSelector;}} |
51 | class QListView; | 54 | class QListView; |
52 | class QListViewItem; | 55 | class QListViewItem; |
53 | class Config; | 56 | class Config; |
54 | 57 | ||
55 | class Appearance : public QDialog | 58 | class Appearance : public QDialog |
56 | { | 59 | { |
57 | Q_OBJECT | 60 | Q_OBJECT |
58 | 61 | ||
59 | public: | 62 | public: |
60 | Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 63 | Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
61 | ~Appearance(); | 64 | ~Appearance(); |
62 | static QString appName() { return QString::fromLatin1("appearance"); } | 65 | static QString appName() { return QString::fromLatin1("appearance"); } |
63 | 66 | ||
64 | protected: | 67 | protected: |
65 | virtual void accept ( ); | 68 | virtual void accept ( ); |
66 | virtual void done ( int r ); | 69 | virtual void done ( int r ); |
67 | 70 | ||
68 | protected slots: | 71 | protected slots: |
69 | void styleClicked ( int ); | 72 | void styleClicked ( int ); |
70 | void styleSettingsClicked ( ); | 73 | void styleSettingsClicked ( ); |
71 | void decoClicked ( int ); | 74 | void decoClicked ( int ); |
72 | void fontClicked ( const QFont & ); | 75 | void fontClicked ( const QFont & ); |
73 | void colorClicked ( int ); | 76 | void colorClicked ( int ); |
74 | 77 | ||
75 | void editSchemeClicked(); | 78 | void editSchemeClicked(); |
76 | void saveSchemeClicked(); | 79 | void saveSchemeClicked(); |
77 | void deleteSchemeClicked(); | 80 | void deleteSchemeClicked(); |
78 | 81 | ||
79 | void tabChanged ( QWidget * ); | 82 | void tabChanged ( QWidget * ); |
80 | 83 | ||
81 | private: | 84 | private: |
82 | void changeText(); | 85 | void changeText(); |
83 | 86 | ||
84 | QWidget *createStyleTab ( QWidget *parent, Config &cfg ); | 87 | QWidget *createStyleTab ( QWidget *parent, Config &cfg ); |
85 | QWidget *createDecoTab ( QWidget *parent, Config &cfg ); | 88 | QWidget *createDecoTab ( QWidget *parent, Config &cfg ); |
86 | QWidget *createFontTab ( QWidget *parent, Config &cfg ); | 89 | QWidget *createFontTab ( QWidget *parent, Config &cfg ); |
87 | QWidget *createColorTab ( QWidget *parent, Config &cfg ); | 90 | QWidget *createColorTab ( QWidget *parent, Config &cfg ); |
88 | QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); | 91 | QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); |
89 | 92 | ||
90 | private: | 93 | private: |
91 | bool m_style_changed; | 94 | bool m_style_changed; |
92 | bool m_font_changed; | 95 | bool m_font_changed; |
93 | bool m_scheme_changed; | 96 | bool m_scheme_changed; |
94 | bool m_deco_changed; | 97 | bool m_deco_changed; |
95 | bool m_color_changed; | 98 | bool m_color_changed; |
96 | 99 | ||
97 | int m_original_style; | 100 | int m_original_style; |
98 | int m_original_deco; | 101 | int m_original_deco; |
99 | int m_original_tabstyle; | 102 | int m_original_tabstyle; |
100 | bool m_original_tabpos; | 103 | bool m_original_tabpos; |
101 | 104 | ||
102 | QListBox * m_style_list; | 105 | QListBox * m_style_list; |
103 | QPushButton * m_style_settings; | 106 | QPushButton * m_style_settings; |
104 | 107 | ||
105 | QListBox * m_deco_list; | 108 | QListBox * m_deco_list; |
106 | 109 | ||
107 | QListBox * m_color_list; | 110 | QListBox * m_color_list; |
108 | 111 | ||
109 | Opie::Ui::OFontSelector *m_fontselect; | 112 | Opie::Ui::OFontSelector *m_fontselect; |
110 | 113 | ||
111 | SampleWindow *m_sample; | 114 | SampleWindow *m_sample; |
112 | 115 | ||
113 | QComboBox * m_tabstyle_list; | 116 | QComboBox * m_tabstyle_list; |
114 | QRadioButton *m_tabstyle_top; | 117 | QRadioButton *m_tabstyle_top; |
115 | QRadioButton *m_tabstyle_bottom; | 118 | QRadioButton *m_tabstyle_bottom; |
116 | 119 | ||
117 | QRadioButton *m_rotdir_cw; | 120 | QRadioButton *m_rotdir_cw; |
118 | QRadioButton *m_rotdir_ccw; | 121 | QRadioButton *m_rotdir_ccw; |
119 | QRadioButton *m_rotdir_flip; | 122 | QRadioButton *m_rotdir_flip; |
120 | 123 | ||
121 | QWidget * m_advtab; | 124 | QWidget * m_advtab; |
122 | QCheckBox *m_leftHand; | 125 | QCheckBox *m_leftHand; |
123 | }; | 126 | }; |
124 | 127 | ||
125 | #endif | 128 | #endif |
diff --git a/noncore/settings/appearance2/colorlistitem.h b/noncore/settings/appearance2/colorlistitem.h index f8d5c45..7f6014c 100644 --- a/noncore/settings/appearance2/colorlistitem.h +++ b/noncore/settings/appearance2/colorlistitem.h | |||
@@ -1,141 +1,144 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU 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 file 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 General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | 3 | ||
4 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | Â Â Â Â Â Â .>+-= | ||
8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | ||
9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, Â Â .._ License as published by the Free Software | ||
12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | ||
13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | ||
14 | Â Â .%`+i> Â Â Â _;_. | ||
15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | ||
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
26 | */ | 29 | */ |
27 | 30 | ||
28 | #ifndef COLORLISTITEM_H | 31 | #ifndef COLORLISTITEM_H |
29 | #define COLORLISTITEM_H | 32 | #define COLORLISTITEM_H |
30 | 33 | ||
31 | #include <qlistbox.h> | 34 | #include <qlistbox.h> |
32 | #include <qpalette.h> | 35 | #include <qpalette.h> |
33 | #include <qapplication.h> | 36 | #include <qapplication.h> |
34 | 37 | ||
35 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
36 | 39 | ||
37 | class Appearance; | 40 | class Appearance; |
38 | 41 | ||
39 | class ColorListItem : public QListBoxText { | 42 | class ColorListItem : public QListBoxText { |
40 | public: | 43 | public: |
41 | ColorListItem ( const QString &t, Config &cfg ) : QListBoxText ( t ) | 44 | ColorListItem ( const QString &t, Config &cfg ) : QListBoxText ( t ) |
42 | { | 45 | { |
43 | m_colors = new QColor [s_colorcount]; | 46 | m_colors = new QColor [s_colorcount]; |
44 | load ( cfg ); | 47 | load ( cfg ); |
45 | } | 48 | } |
46 | 49 | ||
47 | virtual ~ColorListItem ( ) | 50 | virtual ~ColorListItem ( ) |
48 | { | 51 | { |
49 | delete [] m_colors; | 52 | delete [] m_colors; |
50 | } | 53 | } |
51 | 54 | ||
52 | QPalette palette ( ) | 55 | QPalette palette ( ) |
53 | { | 56 | { |
54 | return m_palette; | 57 | return m_palette; |
55 | } | 58 | } |
56 | 59 | ||
57 | bool load ( Config &cfg ) | 60 | bool load ( Config &cfg ) |
58 | { | 61 | { |
59 | for ( int i = 0; i < s_colorcount; i++ ) | 62 | for ( int i = 0; i < s_colorcount; i++ ) |
60 | m_colors [i] = QColor ( cfg. readEntry ( s_colorlut [i]. m_key, s_colorlut [i]. m_def )); | 63 | m_colors [i] = QColor ( cfg. readEntry ( s_colorlut [i]. m_key, s_colorlut [i]. m_def )); |
61 | 64 | ||
62 | buildPalette ( ); | 65 | buildPalette ( ); |
63 | return true; | 66 | return true; |
64 | } | 67 | } |
65 | 68 | ||
66 | void buildPalette ( ) | 69 | void buildPalette ( ) |
67 | { | 70 | { |
68 | m_palette = QPalette ( m_colors [r2i(QColorGroup::Button)], m_colors [r2i(QColorGroup::Background)] ); | 71 | m_palette = QPalette ( m_colors [r2i(QColorGroup::Button)], m_colors [r2i(QColorGroup::Background)] ); |
69 | m_palette. setColor ( QColorGroup::Highlight, m_colors [r2i(QColorGroup::Highlight)] ); | 72 | m_palette. setColor ( QColorGroup::Highlight, m_colors [r2i(QColorGroup::Highlight)] ); |
70 | m_palette. setColor ( QColorGroup::HighlightedText, m_colors [r2i(QColorGroup::HighlightedText)] ); | 73 | m_palette. setColor ( QColorGroup::HighlightedText, m_colors [r2i(QColorGroup::HighlightedText)] ); |
71 | m_palette. setColor ( QColorGroup::Text, m_colors [r2i(QColorGroup::Text)] ); | 74 | m_palette. setColor ( QColorGroup::Text, m_colors [r2i(QColorGroup::Text)] ); |
72 | m_palette. setColor ( QPalette::Active, QColorGroup::ButtonText, m_colors [r2i(QColorGroup::ButtonText)] ); | 75 | m_palette. setColor ( QPalette::Active, QColorGroup::ButtonText, m_colors [r2i(QColorGroup::ButtonText)] ); |
73 | m_palette. setColor ( QColorGroup::Base, m_colors [r2i(QColorGroup::Base)] ); | 76 | m_palette. setColor ( QColorGroup::Base, m_colors [r2i(QColorGroup::Base)] ); |
74 | m_palette. setColor ( QPalette::Disabled, QColorGroup::Text, m_palette. color ( QPalette::Active, QColorGroup::Background ). dark ( )); | 77 | m_palette. setColor ( QPalette::Disabled, QColorGroup::Text, m_palette. color ( QPalette::Active, QColorGroup::Background ). dark ( )); |
75 | } | 78 | } |
76 | 79 | ||
77 | bool save ( Config &cfg ) | 80 | bool save ( Config &cfg ) |
78 | { | 81 | { |
79 | for ( int i = 0; i < s_colorcount; i++ ) | 82 | for ( int i = 0; i < s_colorcount; i++ ) |
80 | cfg. writeEntry ( s_colorlut [i]. m_key, m_colors [i]. name ( )); | 83 | cfg. writeEntry ( s_colorlut [i]. m_key, m_colors [i]. name ( )); |
81 | return true; | 84 | return true; |
82 | } | 85 | } |
83 | 86 | ||
84 | QColor color ( QColorGroup::ColorRole role ) | 87 | QColor color ( QColorGroup::ColorRole role ) |
85 | { | 88 | { |
86 | int i = r2i ( role ); | 89 | int i = r2i ( role ); |
87 | return i >= 0 ? m_colors [i] : QColor ( ); | 90 | return i >= 0 ? m_colors [i] : QColor ( ); |
88 | } | 91 | } |
89 | 92 | ||
90 | void setColor ( QColorGroup::ColorRole role, QColor c ) | 93 | void setColor ( QColorGroup::ColorRole role, QColor c ) |
91 | { | 94 | { |
92 | int i = r2i ( role ); | 95 | int i = r2i ( role ); |
93 | if ( i >= 0 ) { | 96 | if ( i >= 0 ) { |
94 | m_colors [i] = c; | 97 | m_colors [i] = c; |
95 | buildPalette ( ); | 98 | buildPalette ( ); |
96 | } | 99 | } |
97 | } | 100 | } |
98 | 101 | ||
99 | QString label ( QColorGroup::ColorRole role ) | 102 | QString label ( QColorGroup::ColorRole role ) |
100 | { | 103 | { |
101 | int i = r2i ( role ); | 104 | int i = r2i ( role ); |
102 | return i >= 0 ? qApp-> translate ( "Appearance", s_colorlut [i]. m_label ) : QString::null; | 105 | return i >= 0 ? qApp-> translate ( "Appearance", s_colorlut [i]. m_label ) : QString::null; |
103 | } | 106 | } |
104 | 107 | ||
105 | private: | 108 | private: |
106 | QPalette m_palette; | 109 | QPalette m_palette; |
107 | QColor *m_colors; | 110 | QColor *m_colors; |
108 | 111 | ||
109 | static struct colorlut { | 112 | static struct colorlut { |
110 | QColorGroup::ColorRole m_role; | 113 | QColorGroup::ColorRole m_role; |
111 | const char * m_key; | 114 | const char * m_key; |
112 | const char * m_def; | 115 | const char * m_def; |
113 | const char * m_label; | 116 | const char * m_label; |
114 | } const s_colorlut []; | 117 | } const s_colorlut []; |
115 | static const int s_colorcount; | 118 | static const int s_colorcount; |
116 | 119 | ||
117 | static int r2i ( QColorGroup::ColorRole role ) | 120 | static int r2i ( QColorGroup::ColorRole role ) |
118 | { | 121 | { |
119 | for ( int i = 0; i < s_colorcount; i++ ) { | 122 | for ( int i = 0; i < s_colorcount; i++ ) { |
120 | if ( s_colorlut [i]. m_role == role ) | 123 | if ( s_colorlut [i]. m_role == role ) |
121 | return i; | 124 | return i; |
122 | } | 125 | } |
123 | return -1; | 126 | return -1; |
124 | } | 127 | } |
125 | }; | 128 | }; |
126 | 129 | ||
127 | // from etc/colors/Liquid.scheme | 130 | // from etc/colors/Liquid.scheme |
128 | const ColorListItem::colorlut ColorListItem::s_colorlut [] = { | 131 | const ColorListItem::colorlut ColorListItem::s_colorlut [] = { |
129 | { QColorGroup::Base, "Base", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Base" ) }, | 132 | { QColorGroup::Base, "Base", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Base" ) }, |
130 | { QColorGroup::Background, "Background", "#E0E0E0", QT_TRANSLATE_NOOP( "Appearance", "Background" ) }, | 133 | { QColorGroup::Background, "Background", "#E0E0E0", QT_TRANSLATE_NOOP( "Appearance", "Background" ) }, |
131 | { QColorGroup::Button, "Button", "#96c8fa", QT_TRANSLATE_NOOP( "Appearance", "Button" ) }, | 134 | { QColorGroup::Button, "Button", "#96c8fa", QT_TRANSLATE_NOOP( "Appearance", "Button" ) }, |
132 | { QColorGroup::ButtonText, "ButtonText", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Button Text" ) }, | 135 | { QColorGroup::ButtonText, "ButtonText", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Button Text" ) }, |
133 | { QColorGroup::Highlight, "Highlight", "#73adef", QT_TRANSLATE_NOOP( "Appearance", "Highlight" ) }, | 136 | { QColorGroup::Highlight, "Highlight", "#73adef", QT_TRANSLATE_NOOP( "Appearance", "Highlight" ) }, |
134 | { QColorGroup::HighlightedText, "HighlightedText", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Highlighted Text" ) }, | 137 | { QColorGroup::HighlightedText, "HighlightedText", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Highlighted Text" ) }, |
135 | { QColorGroup::Text, "Text", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Text" ) } | 138 | { QColorGroup::Text, "Text", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Text" ) } |
136 | }; | 139 | }; |
137 | 140 | ||
138 | const int ColorListItem::s_colorcount = sizeof( s_colorlut ) / sizeof ( s_colorlut [0] ); | 141 | const int ColorListItem::s_colorcount = sizeof( s_colorlut ) / sizeof ( s_colorlut [0] ); |
139 | 142 | ||
140 | 143 | ||
141 | #endif | 144 | #endif |
diff --git a/noncore/settings/appearance2/decolistitem.h b/noncore/settings/appearance2/decolistitem.h index da7924c..8dce455 100644 --- a/noncore/settings/appearance2/decolistitem.h +++ b/noncore/settings/appearance2/decolistitem.h | |||
@@ -1,107 +1,110 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU 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 file 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 General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | 3 | ||
4 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | Â Â Â Â Â Â .>+-= | ||
8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | ||
9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, Â Â .._ License as published by the Free Software | ||
12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | ||
13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | ||
14 | Â Â .%`+i> Â Â Â _;_. | ||
15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | ||
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
26 | */ | 29 | */ |
27 | 30 | ||
28 | #ifndef DECOLISTITEM_H | 31 | #ifndef DECOLISTITEM_H |
29 | #define DECOLISTITEM_H | 32 | #define DECOLISTITEM_H |
30 | 33 | ||
31 | #include <qpe/windowdecorationinterface.h> | 34 | #include <qpe/windowdecorationinterface.h> |
32 | #include <qlistbox.h> | 35 | #include <qlistbox.h> |
33 | 36 | ||
34 | class DecoListItem : public QListBoxPixmap { | 37 | class DecoListItem : public QListBoxPixmap { |
35 | public: | 38 | public: |
36 | DecoListItem ( const QString &t ) : QListBoxPixmap ( QPixmap ( ), t ) | 39 | DecoListItem ( const QString &t ) : QListBoxPixmap ( QPixmap ( ), t ) |
37 | { | 40 | { |
38 | m_lib = 0; | 41 | m_lib = 0; |
39 | m_window_if = 0; | 42 | m_window_if = 0; |
40 | // m_settings_if = 0; | 43 | // m_settings_if = 0; |
41 | } | 44 | } |
42 | 45 | ||
43 | DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxPixmap ( iface-> icon ( ), iface-> name ( )) | 46 | DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxPixmap ( iface-> icon ( ), iface-> name ( )) |
44 | { | 47 | { |
45 | m_lib = lib; | 48 | m_lib = lib; |
46 | m_window_if = iface; | 49 | m_window_if = iface; |
47 | 50 | ||
48 | // iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if ); | 51 | // iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if ); |
49 | } | 52 | } |
50 | 53 | ||
51 | virtual ~DecoListItem ( ) | 54 | virtual ~DecoListItem ( ) |
52 | { | 55 | { |
53 | // if ( m_settings_if ) | 56 | // if ( m_settings_if ) |
54 | // m_settings_if-> release ( ); | 57 | // m_settings_if-> release ( ); |
55 | if ( m_window_if ) | 58 | if ( m_window_if ) |
56 | m_window_if-> release ( ); | 59 | m_window_if-> release ( ); |
57 | delete m_lib; | 60 | delete m_lib; |
58 | } | 61 | } |
59 | 62 | ||
60 | bool hasSettings ( ) const | 63 | bool hasSettings ( ) const |
61 | { | 64 | { |
62 | // return ( m_settings_if ); | 65 | // return ( m_settings_if ); |
63 | return false; | 66 | return false; |
64 | } | 67 | } |
65 | 68 | ||
66 | QWidget *settings ( QWidget * /*parent*/ ) | 69 | QWidget *settings ( QWidget * /*parent*/ ) |
67 | { | 70 | { |
68 | // return m_settings_if ? m_settings_if-> create ( parent ) : 0; | 71 | // return m_settings_if ? m_settings_if-> create ( parent ) : 0; |
69 | return 0; | 72 | return 0; |
70 | } | 73 | } |
71 | 74 | ||
72 | bool setSettings ( bool /*accepted*/ ) | 75 | bool setSettings ( bool /*accepted*/ ) |
73 | { | 76 | { |
74 | // if ( !m_settings_if ) | 77 | // if ( !m_settings_if ) |
75 | // return false; | 78 | // return false; |
76 | 79 | ||
77 | // if ( accepted ) | 80 | // if ( accepted ) |
78 | // return m_settings_if-> accept ( ); | 81 | // return m_settings_if-> accept ( ); |
79 | // else { | 82 | // else { |
80 | // m_settings_if-> reject ( ); | 83 | // m_settings_if-> reject ( ); |
81 | // return false; | 84 | // return false; |
82 | // } | 85 | // } |
83 | return false; | 86 | return false; |
84 | } | 87 | } |
85 | 88 | ||
86 | QString key ( ) | 89 | QString key ( ) |
87 | { | 90 | { |
88 | if ( m_lib ) | 91 | if ( m_lib ) |
89 | return QFileInfo ( m_lib-> library ( )). fileName ( ); | 92 | return QFileInfo ( m_lib-> library ( )). fileName ( ); |
90 | else | 93 | else |
91 | return text ( ); | 94 | return text ( ); |
92 | } | 95 | } |
93 | 96 | ||
94 | WindowDecorationInterface *interface ( ) | 97 | WindowDecorationInterface *interface ( ) |
95 | { | 98 | { |
96 | return m_window_if; | 99 | return m_window_if; |
97 | } | 100 | } |
98 | 101 | ||
99 | private: | 102 | private: |
100 | QLibrary *m_lib; | 103 | QLibrary *m_lib; |
101 | WindowDecorationInterface *m_window_if; | 104 | WindowDecorationInterface *m_window_if; |
102 | //WindowDecorationSettingsInterface *m_settings_if; | 105 | //WindowDecorationSettingsInterface *m_settings_if; |
103 | 106 | ||
104 | }; | 107 | }; |
105 | 108 | ||
106 | #endif | 109 | #endif |
107 | 110 | ||
diff --git a/noncore/settings/appearance2/editScheme.cpp b/noncore/settings/appearance2/editScheme.cpp index 18c69a5..2645833 100644 --- a/noncore/settings/appearance2/editScheme.cpp +++ b/noncore/settings/appearance2/editScheme.cpp | |||
@@ -1,74 +1,77 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | ||
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU 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 file 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 General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | 3 | ||
4 | Copyright (c) 2002 Dan Williams <drw@handhelds.org> | ||
5 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
6 | =. | ||
7 | .=l. | ||
8 | Â Â Â Â Â Â .>+-= | ||
9 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | ||
10 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | ||
12 | .="- .-=="i, Â Â .._ License as published by the Free Software | ||
13 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | ||
14 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | ||
15 | Â Â .%`+i> Â Â Â _;_. | ||
16 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | ||
17 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
19 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
22 | ++= Â -. Â Â .` Â Â .: details. | ||
23 | : Â Â = Â ...= . :.=- | ||
24 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
25 | Â -_. . . Â )=. Â = Library General Public License along with | ||
26 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #include "editScheme.h" | 32 | #include "editScheme.h" |
30 | 33 | ||
31 | #include <qaction.h> | 34 | #include <qaction.h> |
32 | #include <qlabel.h> | 35 | #include <qlabel.h> |
33 | #include <qlayout.h> | 36 | #include <qlayout.h> |
34 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
35 | #include <qscrollview.h> | 38 | #include <qscrollview.h> |
36 | #include <qtoolbutton.h> | 39 | #include <qtoolbutton.h> |
37 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
38 | 41 | ||
39 | using namespace Opie::Ui; | 42 | using namespace Opie::Ui; |
40 | EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags ) | 43 | EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags ) |
41 | : QDialog ( parent, name, modal, WStyle_ContextHelp ) | 44 | : QDialog ( parent, name, modal, WStyle_ContextHelp ) |
42 | { | 45 | { |
43 | setCaption ( tr( "Edit scheme" ) ); | 46 | setCaption ( tr( "Edit scheme" ) ); |
44 | QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 ); | 47 | QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 ); |
45 | 48 | ||
46 | m_count = cnt; | 49 | m_count = cnt; |
47 | m_buttons = new Opie::OColorButton * [cnt]; | 50 | m_buttons = new Opie::OColorButton * [cnt]; |
48 | m_colors = colors; | 51 | m_colors = colors; |
49 | 52 | ||
50 | for ( int i = 0; i < cnt; i++ ) | 53 | for ( int i = 0; i < cnt; i++ ) |
51 | { | 54 | { |
52 | QLabel *l = new QLabel ( labels [i], this ); | 55 | QLabel *l = new QLabel ( labels [i], this ); |
53 | layout-> addWidget ( l, i, 0 ); | 56 | layout-> addWidget ( l, i, 0 ); |
54 | QWhatsThis::add( l, tr( "Click here to select a color for: " ).arg( labels [i] ) ); | 57 | QWhatsThis::add( l, tr( "Click here to select a color for: " ).arg( labels [i] ) ); |
55 | 58 | ||
56 | m_buttons [i] = new Opie::OColorButton ( this, colors [i] ); | 59 | m_buttons [i] = new Opie::OColorButton ( this, colors [i] ); |
57 | layout-> addWidget ( m_buttons [i], i, 1 ); | 60 | layout-> addWidget ( m_buttons [i], i, 1 ); |
58 | QWhatsThis::add( m_buttons [i], tr( "Click here to select a color for: " ).arg( labels [i] ) ); | 61 | QWhatsThis::add( m_buttons [i], tr( "Click here to select a color for: " ).arg( labels [i] ) ); |
59 | } | 62 | } |
60 | } | 63 | } |
61 | 64 | ||
62 | EditScheme::~EditScheme ( ) | 65 | EditScheme::~EditScheme ( ) |
63 | { | 66 | { |
64 | delete [] m_buttons; | 67 | delete [] m_buttons; |
65 | } | 68 | } |
66 | 69 | ||
67 | void EditScheme::accept ( ) | 70 | void EditScheme::accept ( ) |
68 | { | 71 | { |
69 | for ( int i = 0; i < m_count; i++ ) | 72 | for ( int i = 0; i < m_count; i++ ) |
70 | m_colors [i] = m_buttons [i]-> color ( ); | 73 | m_colors [i] = m_buttons [i]-> color ( ); |
71 | 74 | ||
72 | QDialog::accept ( ); | 75 | QDialog::accept ( ); |
73 | } | 76 | } |
74 | 77 | ||
diff --git a/noncore/settings/appearance2/editScheme.h b/noncore/settings/appearance2/editScheme.h index 302652c..55897c4 100644 --- a/noncore/settings/appearance2/editScheme.h +++ b/noncore/settings/appearance2/editScheme.h | |||
@@ -1,55 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 3 | |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | Copyright (c) 2002 Dan Williams <drw@handhelds.org> |
5 | .>+-= | 5 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
6 | _;:, .> :=|. This file is free software; you can | 6 | =. |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .=l. |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | Â Â Â Â Â Â .>+-= |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
11 | ._= =} : or (at your option) any later version. | 11 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
12 | .%`+i> _;_. | 12 | .="- .-=="i, Â Â .._ License as published by the Free Software |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
15 | : .. .:, . . . without even the implied warranty of | 15 | Â Â .%`+i> Â Â Â _;_. |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
18 | ..}^=.= = ; Public License for more details. | 18 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
19 | ++= -. .` .: | 19 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | ++= Â -. Â Â .` Â Â .: details. |
23 | -- :-=` Free Software Foundation, Inc., | 23 | : Â Â = Â ...= . :.=- |
24 | 59 Temple Place - Suite 330, | 24 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
25 | Â -_. . . Â )=. Â = Library General Public License along with | ||
26 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
26 | |||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #ifndef EDITSCHEME_H | 32 | #ifndef EDITSCHEME_H |
30 | #define EDITSCHEME_H | 33 | #define EDITSCHEME_H |
31 | 34 | ||
32 | #include <opie2/ocolorbutton.h> | 35 | #include <opie2/ocolorbutton.h> |
33 | 36 | ||
34 | #include <qdialog.h> | 37 | #include <qdialog.h> |
35 | 38 | ||
36 | class QColor; | 39 | class QColor; |
37 | namespace Opie {namespace Ui {class OColor;}} | 40 | namespace Opie {namespace Ui {class OColor;}} |
38 | 41 | ||
39 | class EditScheme : public QDialog { | 42 | class EditScheme : public QDialog { |
40 | Q_OBJECT | 43 | Q_OBJECT |
41 | 44 | ||
42 | public: | 45 | public: |
43 | EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 46 | EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
44 | virtual ~EditScheme ( ); | 47 | virtual ~EditScheme ( ); |
45 | 48 | ||
46 | protected slots: | 49 | protected slots: |
47 | virtual void accept ( ); | 50 | virtual void accept ( ); |
48 | 51 | ||
49 | private: | 52 | private: |
50 | int m_count; | 53 | int m_count; |
51 | QColor *m_colors; | 54 | QColor *m_colors; |
52 | Opie::OColorButton **m_buttons; | 55 | Opie::OColorButton **m_buttons; |
53 | }; | 56 | }; |
54 | 57 | ||
55 | #endif | 58 | #endif |
diff --git a/noncore/settings/appearance2/exceptlistitem.h b/noncore/settings/appearance2/exceptlistitem.h index 7b4fa48..365fa90 100644 --- a/noncore/settings/appearance2/exceptlistitem.h +++ b/noncore/settings/appearance2/exceptlistitem.h | |||
@@ -1,199 +1,202 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | |
4 | .>+-= | 4 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | _;:, .> :=|. This file is free software; you can | 5 | =. |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .=l. |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | Â Â Â Â Â Â .>+-= |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
10 | ._= =} : or (at your option) any later version. | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
11 | .%`+i> _;_. | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
14 | : .. .:, . . . without even the implied warranty of | 14 | Â Â .%`+i> Â Â Â _;_. |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
17 | ..}^=.= = ; Public License for more details. | 17 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
18 | ++= -. .` .: | 18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | ++= Â -. Â Â .` Â Â .: details. |
22 | -- :-=` Free Software Foundation, Inc., | 22 | : Â Â = Â ...= . :.=- |
23 | 59 Temple Place - Suite 330, | 23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
25 | |||
26 | */ | 29 | */ |
27 | 30 | ||
28 | #ifndef EXCEPTLISTITEM_H | 31 | #ifndef EXCEPTLISTITEM_H |
29 | #define EXCEPTLISTITEM_H | 32 | #define EXCEPTLISTITEM_H |
30 | 33 | ||
31 | #include <qlistview.h> | 34 | #include <qlistview.h> |
32 | #include <qpixmap.h> | 35 | #include <qpixmap.h> |
33 | #include <qimage.h> | 36 | #include <qimage.h> |
34 | #include <qpainter.h> | 37 | #include <qpainter.h> |
35 | 38 | ||
36 | class ExceptListItem : public QListViewItem { | 39 | class ExceptListItem : public QListViewItem { |
37 | public: | 40 | public: |
38 | ExceptListItem ( QListView *lv, QListViewItem *after, const QString &t, bool nostyle = true, bool nofont = true, bool nodeco = true ) : QListViewItem ( lv, after ) | 41 | ExceptListItem ( QListView *lv, QListViewItem *after, const QString &t, bool nostyle = true, bool nofont = true, bool nodeco = true ) : QListViewItem ( lv, after ) |
39 | { | 42 | { |
40 | m_text = t; | 43 | m_text = t; |
41 | 44 | ||
42 | m_nofont = nofont; | 45 | m_nofont = nofont; |
43 | m_nostyle = nostyle; | 46 | m_nostyle = nostyle; |
44 | m_nodeco = nodeco; | 47 | m_nodeco = nodeco; |
45 | 48 | ||
46 | init ( ); | 49 | init ( ); |
47 | } | 50 | } |
48 | 51 | ||
49 | virtual ~ExceptListItem ( ) | 52 | virtual ~ExceptListItem ( ) |
50 | { | 53 | { |
51 | } | 54 | } |
52 | 55 | ||
53 | static void overlay ( QImage &img, const QImage &ovl ) | 56 | static void overlay ( QImage &img, const QImage &ovl ) |
54 | { | 57 | { |
55 | if (( img. size ( ) != ovl. size ( )) || | 58 | if (( img. size ( ) != ovl. size ( )) || |
56 | ( img. depth ( ) != ovl. depth ( ))) | 59 | ( img. depth ( ) != ovl. depth ( ))) |
57 | return; | 60 | return; |
58 | 61 | ||
59 | for ( int y = 0; y != img. height ( ); y++ ) { | 62 | for ( int y = 0; y != img. height ( ); y++ ) { |
60 | QRgb *iline = (QRgb *) img. scanLine ( y ); | 63 | QRgb *iline = (QRgb *) img. scanLine ( y ); |
61 | QRgb *oline = (QRgb *) ovl. scanLine ( y ); | 64 | QRgb *oline = (QRgb *) ovl. scanLine ( y ); |
62 | 65 | ||
63 | for ( int x = 0; x != img. width ( ); x++ ) { | 66 | for ( int x = 0; x != img. width ( ); x++ ) { |
64 | QRgb i = *iline; | 67 | QRgb i = *iline; |
65 | QRgb o = *oline; | 68 | QRgb o = *oline; |
66 | 69 | ||
67 | *iline = qRgba (( qRed ( i ) + qRed ( o )) / 2, | 70 | *iline = qRgba (( qRed ( i ) + qRed ( o )) / 2, |
68 | ( qGreen ( i ) + qGreen ( o )) / 2, | 71 | ( qGreen ( i ) + qGreen ( o )) / 2, |
69 | ( qBlue ( i ) + qBlue ( o )) / 2, | 72 | ( qBlue ( i ) + qBlue ( o )) / 2, |
70 | ( qAlpha ( i ) + qAlpha ( o )) / 2 ); | 73 | ( qAlpha ( i ) + qAlpha ( o )) / 2 ); |
71 | iline++; | 74 | iline++; |
72 | oline++; | 75 | oline++; |
73 | } | 76 | } |
74 | } | 77 | } |
75 | } | 78 | } |
76 | 79 | ||
77 | static void init ( ) | 80 | static void init ( ) |
78 | { | 81 | { |
79 | static bool init = false; | 82 | static bool init = false; |
80 | 83 | ||
81 | if ( init ) | 84 | if ( init ) |
82 | return; | 85 | return; |
83 | 86 | ||
84 | QImage noimg = Resource::loadImage ( "appearance/no.png" ); | 87 | QImage noimg = Resource::loadImage ( "appearance/no.png" ); |
85 | QImage fontimg = Resource::loadImage ( "appearance/font.png" ); | 88 | QImage fontimg = Resource::loadImage ( "appearance/font.png" ); |
86 | QImage styleimg = Resource::loadImage ( "appearance/style.png" ); | 89 | QImage styleimg = Resource::loadImage ( "appearance/style.png" ); |
87 | QImage decoimg = Resource::loadImage ( "appearance/deco.png" ); | 90 | QImage decoimg = Resource::loadImage ( "appearance/deco.png" ); |
88 | 91 | ||
89 | s_fontpix [0] = new QPixmap ( ); | 92 | s_fontpix [0] = new QPixmap ( ); |
90 | s_fontpix [0]-> convertFromImage ( fontimg ); | 93 | s_fontpix [0]-> convertFromImage ( fontimg ); |
91 | overlay ( fontimg, noimg ); | 94 | overlay ( fontimg, noimg ); |
92 | s_fontpix [1] = new QPixmap ( ); | 95 | s_fontpix [1] = new QPixmap ( ); |
93 | s_fontpix [1]-> convertFromImage ( fontimg ); | 96 | s_fontpix [1]-> convertFromImage ( fontimg ); |
94 | 97 | ||
95 | s_stylepix [0] = new QPixmap ( ); | 98 | s_stylepix [0] = new QPixmap ( ); |
96 | s_stylepix [0]-> convertFromImage ( styleimg ); | 99 | s_stylepix [0]-> convertFromImage ( styleimg ); |
97 | overlay ( styleimg, noimg ); | 100 | overlay ( styleimg, noimg ); |
98 | s_stylepix [1] = new QPixmap ( ); | 101 | s_stylepix [1] = new QPixmap ( ); |
99 | s_stylepix [1]-> convertFromImage ( styleimg ); | 102 | s_stylepix [1]-> convertFromImage ( styleimg ); |
100 | 103 | ||
101 | s_decopix [0] = new QPixmap ( ); | 104 | s_decopix [0] = new QPixmap ( ); |
102 | s_decopix [0]-> convertFromImage ( decoimg ); | 105 | s_decopix [0]-> convertFromImage ( decoimg ); |
103 | overlay ( decoimg, noimg ); | 106 | overlay ( decoimg, noimg ); |
104 | s_decopix [1] = new QPixmap ( ); | 107 | s_decopix [1] = new QPixmap ( ); |
105 | s_decopix [1]-> convertFromImage ( decoimg ); | 108 | s_decopix [1]-> convertFromImage ( decoimg ); |
106 | 109 | ||
107 | init = true; | 110 | init = true; |
108 | } | 111 | } |
109 | 112 | ||
110 | bool noFont ( ) const | 113 | bool noFont ( ) const |
111 | { | 114 | { |
112 | return m_nofont; | 115 | return m_nofont; |
113 | } | 116 | } |
114 | 117 | ||
115 | bool noStyle ( ) const | 118 | bool noStyle ( ) const |
116 | { | 119 | { |
117 | return m_nostyle; | 120 | return m_nostyle; |
118 | } | 121 | } |
119 | 122 | ||
120 | bool noDeco ( ) const | 123 | bool noDeco ( ) const |
121 | { | 124 | { |
122 | return m_nodeco; | 125 | return m_nodeco; |
123 | } | 126 | } |
124 | 127 | ||
125 | void setNoDeco ( bool b ) | 128 | void setNoDeco ( bool b ) |
126 | { | 129 | { |
127 | if ( b != m_nodeco ) { | 130 | if ( b != m_nodeco ) { |
128 | m_nodeco = b; | 131 | m_nodeco = b; |
129 | repaint ( ); | 132 | repaint ( ); |
130 | } | 133 | } |
131 | } | 134 | } |
132 | 135 | ||
133 | void setNoStyle ( bool b ) | 136 | void setNoStyle ( bool b ) |
134 | { | 137 | { |
135 | if ( b != m_nostyle ) { | 138 | if ( b != m_nostyle ) { |
136 | m_nostyle = b; | 139 | m_nostyle = b; |
137 | repaint ( ); | 140 | repaint ( ); |
138 | } | 141 | } |
139 | } | 142 | } |
140 | 143 | ||
141 | void setNoFont ( bool b ) | 144 | void setNoFont ( bool b ) |
142 | { | 145 | { |
143 | if ( b != m_nofont ) { | 146 | if ( b != m_nofont ) { |
144 | m_nofont = b; | 147 | m_nofont = b; |
145 | repaint ( ); | 148 | repaint ( ); |
146 | } | 149 | } |
147 | } | 150 | } |
148 | 151 | ||
149 | QString pattern ( ) const | 152 | QString pattern ( ) const |
150 | { | 153 | { |
151 | return m_text; | 154 | return m_text; |
152 | } | 155 | } |
153 | 156 | ||
154 | void setPattern ( const QString &s ) | 157 | void setPattern ( const QString &s ) |
155 | { | 158 | { |
156 | if ( s != m_text ) { | 159 | if ( s != m_text ) { |
157 | m_text = s; | 160 | m_text = s; |
158 | widthChanged ( 3 ); | 161 | widthChanged ( 3 ); |
159 | repaint ( ); | 162 | repaint ( ); |
160 | } | 163 | } |
161 | } | 164 | } |
162 | 165 | ||
163 | QString text ( int i ) const | 166 | QString text ( int i ) const |
164 | { | 167 | { |
165 | if ( i == 3 ) | 168 | if ( i == 3 ) |
166 | return m_text; | 169 | return m_text; |
167 | else | 170 | else |
168 | return QString::null; | 171 | return QString::null; |
169 | 172 | ||
170 | } | 173 | } |
171 | 174 | ||
172 | const QPixmap *pixmap ( int i ) const | 175 | const QPixmap *pixmap ( int i ) const |
173 | { | 176 | { |
174 | if ( i == 0 ) | 177 | if ( i == 0 ) |
175 | return (const QPixmap *) s_stylepix [m_nostyle ? 1 : 0]; | 178 | return (const QPixmap *) s_stylepix [m_nostyle ? 1 : 0]; |
176 | else if ( i == 1 ) | 179 | else if ( i == 1 ) |
177 | return (const QPixmap *) s_fontpix [m_nofont ? 1 : 0]; | 180 | return (const QPixmap *) s_fontpix [m_nofont ? 1 : 0]; |
178 | else if ( i == 2 ) | 181 | else if ( i == 2 ) |
179 | return (const QPixmap *) s_decopix [m_nodeco ? 1 : 0]; | 182 | return (const QPixmap *) s_decopix [m_nodeco ? 1 : 0]; |
180 | else | 183 | else |
181 | return 0; | 184 | return 0; |
182 | } | 185 | } |
183 | 186 | ||
184 | private: | 187 | private: |
185 | QString m_text; | 188 | QString m_text; |
186 | bool m_nofont; | 189 | bool m_nofont; |
187 | bool m_nostyle; | 190 | bool m_nostyle; |
188 | bool m_nodeco; | 191 | bool m_nodeco; |
189 | 192 | ||
190 | static QPixmap *s_stylepix [2]; | 193 | static QPixmap *s_stylepix [2]; |
191 | static QPixmap *s_fontpix [2]; | 194 | static QPixmap *s_fontpix [2]; |
192 | static QPixmap *s_decopix [2]; | 195 | static QPixmap *s_decopix [2]; |
193 | }; | 196 | }; |
194 | 197 | ||
195 | QPixmap *ExceptListItem::s_stylepix [2] = { 0, 0 }; | 198 | QPixmap *ExceptListItem::s_stylepix [2] = { 0, 0 }; |
196 | QPixmap *ExceptListItem::s_fontpix [2] = { 0, 0 }; | 199 | QPixmap *ExceptListItem::s_fontpix [2] = { 0, 0 }; |
197 | QPixmap *ExceptListItem::s_decopix [2] = { 0, 0 }; | 200 | QPixmap *ExceptListItem::s_decopix [2] = { 0, 0 }; |
198 | 201 | ||
199 | #endif | 202 | #endif |
diff --git a/noncore/settings/appearance2/main.cpp b/noncore/settings/appearance2/main.cpp index 87061e3..5c0f302 100644 --- a/noncore/settings/appearance2/main.cpp +++ b/noncore/settings/appearance2/main.cpp | |||
@@ -1,34 +1,37 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU 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 file 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 General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | 3 | ||
4 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | Â Â Â Â Â Â .>+-= | ||
8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | ||
9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, Â Â .._ License as published by the Free Software | ||
12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | ||
13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | ||
14 | Â Â .%`+i> Â Â Â _;_. | ||
15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | ||
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
26 | */ | 29 | */ |
27 | 30 | ||
28 | #include "appearance.h" | 31 | #include "appearance.h" |
29 | 32 | ||
30 | #include <opie2/oapplicationfactory.h> | 33 | #include <opie2/oapplicationfactory.h> |
31 | 34 | ||
32 | 35 | ||
33 | using namespace Opie::Core; | 36 | using namespace Opie::Core; |
34 | OPIE_EXPORT_APP( OApplicationFactory<Appearance> ) | 37 | OPIE_EXPORT_APP( OApplicationFactory<Appearance> ) |
diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp index f6c4dca..557a23e 100644 --- a/noncore/settings/appearance2/sample.cpp +++ b/noncore/settings/appearance2/sample.cpp | |||
@@ -1,271 +1,274 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | 3 | |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
5 | .>+-= | 5 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
6 | _;:, .> :=|. This file is free software; you can | 6 | =. |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .=l. |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | Â Â Â Â Â Â .>+-= |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
11 | ._= =} : or (at your option) any later version. | 11 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
12 | .%`+i> _;_. | 12 | .="- .-=="i, Â Â .._ License as published by the Free Software |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
15 | : .. .:, . . . without even the implied warranty of | 15 | Â Â .%`+i> Â Â Â _;_. |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
18 | ..}^=.= = ; Public License for more details. | 18 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
19 | ++= -. .` .: | 19 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | ++= Â -. Â Â .` Â Â .: details. |
23 | -- :-=` Free Software Foundation, Inc., | 23 | : Â Â = Â ...= . :.=- |
24 | 59 Temple Place - Suite 330, | 24 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
25 | Â -_. . . Â )=. Â = Library General Public License along with | ||
26 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
26 | |||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #include <qvbox.h> | 32 | #include <qvbox.h> |
30 | #include <qpopupmenu.h> | 33 | #include <qpopupmenu.h> |
31 | #include <qpainter.h> | 34 | #include <qpainter.h> |
32 | #include <qmenubar.h> | 35 | #include <qmenubar.h> |
33 | #include <qcheckbox.h> | 36 | #include <qcheckbox.h> |
34 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
35 | #include <qscrollbar.h> | 38 | #include <qscrollbar.h> |
36 | #include <qlayout.h> | 39 | #include <qlayout.h> |
37 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
38 | #include <qpixmapcache.h> | 41 | #include <qpixmapcache.h> |
39 | #include <qtimer.h> | 42 | #include <qtimer.h> |
40 | #include <qobjectlist.h> | 43 | #include <qobjectlist.h> |
41 | #include <qcommonstyle.h> | 44 | #include <qcommonstyle.h> |
42 | 45 | ||
43 | #include "sample.h" | 46 | #include "sample.h" |
44 | 47 | ||
45 | 48 | ||
46 | class SampleText : public QWidget | 49 | class SampleText : public QWidget |
47 | { | 50 | { |
48 | public: | 51 | public: |
49 | SampleText( const QString &t, bool h, QWidget *parent ) | 52 | SampleText( const QString &t, bool h, QWidget *parent ) |
50 | : QWidget( parent ), hl(h), text(t) | 53 | : QWidget( parent ), hl(h), text(t) |
51 | { | 54 | { |
52 | if ( hl ) | 55 | if ( hl ) |
53 | setBackgroundMode( PaletteHighlight ); | 56 | setBackgroundMode( PaletteHighlight ); |
54 | else | 57 | else |
55 | setBackgroundMode( PaletteBase ); | 58 | setBackgroundMode( PaletteBase ); |
56 | } | 59 | } |
57 | 60 | ||
58 | QSize sizeHint() const | 61 | QSize sizeHint() const |
59 | { | 62 | { |
60 | QFontMetrics fm(font()); | 63 | QFontMetrics fm(font()); |
61 | return QSize( fm.width(text)+10, fm.height()+4 ); | 64 | return QSize( fm.width(text)+10, fm.height()+4 ); |
62 | } | 65 | } |
63 | 66 | ||
64 | void paintEvent( QPaintEvent * ) | 67 | void paintEvent( QPaintEvent * ) |
65 | { | 68 | { |
66 | QPainter p(this); | 69 | QPainter p(this); |
67 | if ( hl ) | 70 | if ( hl ) |
68 | p.setPen( colorGroup().highlightedText() ); | 71 | p.setPen( colorGroup().highlightedText() ); |
69 | else | 72 | else |
70 | p.setPen( colorGroup().text() ); | 73 | p.setPen( colorGroup().text() ); |
71 | p.drawText( rect(), AlignCenter, text ); | 74 | p.drawText( rect(), AlignCenter, text ); |
72 | } | 75 | } |
73 | 76 | ||
74 | private: | 77 | private: |
75 | bool hl; | 78 | bool hl; |
76 | QString text; | 79 | QString text; |
77 | }; | 80 | }; |
78 | 81 | ||
79 | 82 | ||
80 | SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0) | 83 | SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0) |
81 | { | 84 | { |
82 | init(); | 85 | init(); |
83 | } | 86 | } |
84 | 87 | ||
85 | QSize SampleWindow::sizeHint() const | 88 | QSize SampleWindow::sizeHint() const |
86 | { | 89 | { |
87 | return container->sizeHint() + QSize( 10, 35 ); | 90 | return container->sizeHint() + QSize( 10, 35 ); |
88 | } | 91 | } |
89 | 92 | ||
90 | void SampleWindow::setFont( const QFont &f ) | 93 | void SampleWindow::setFont( const QFont &f ) |
91 | { | 94 | { |
92 | QWidget::setFont( f ); | 95 | QWidget::setFont( f ); |
93 | popup->setFont( f ); | 96 | popup->setFont( f ); |
94 | QTimer::singleShot ( 0, this, SLOT( fixGeometry())); | 97 | QTimer::singleShot ( 0, this, SLOT( fixGeometry())); |
95 | } | 98 | } |
96 | 99 | ||
97 | static void setStyleRecursive ( QWidget *w, QStyle *s ) | 100 | static void setStyleRecursive ( QWidget *w, QStyle *s ) |
98 | { | 101 | { |
99 | w->setStyle( s ); | 102 | w->setStyle( s ); |
100 | QObjectList *childObjects=(QObjectList*)w->children(); | 103 | QObjectList *childObjects=(QObjectList*)w->children(); |
101 | if ( childObjects ) { | 104 | if ( childObjects ) { |
102 | QObject * o; | 105 | QObject * o; |
103 | for(o=childObjects->first();o!=0;o=childObjects->next()) { | 106 | for(o=childObjects->first();o!=0;o=childObjects->next()) { |
104 | if( o->isWidgetType() ) { | 107 | if( o->isWidgetType() ) { |
105 | setStyleRecursive((QWidget *)o,s); | 108 | setStyleRecursive((QWidget *)o,s); |
106 | } | 109 | } |
107 | } | 110 | } |
108 | } | 111 | } |
109 | } | 112 | } |
110 | 113 | ||
111 | 114 | ||
112 | void SampleWindow::setStyle2 ( QStyle *sty, const QPalette &pal ) | 115 | void SampleWindow::setStyle2 ( QStyle *sty, const QPalette &pal ) |
113 | { | 116 | { |
114 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); | 117 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); |
115 | 118 | ||
116 | extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); | 119 | extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); |
117 | 120 | ||
118 | QPixmapCache::clear ( ); | 121 | QPixmapCache::clear ( ); |
119 | QPalette p = pal; // ette ( ); | 122 | QPalette p = pal; // ette ( ); |
120 | sty-> polish ( p ); | 123 | sty-> polish ( p ); |
121 | qt_set_draw_menu_bar_impl ( 0 ); | 124 | qt_set_draw_menu_bar_impl ( 0 ); |
122 | setStyleRecursive ( this, sty ); | 125 | setStyleRecursive ( this, sty ); |
123 | setPalette ( p ); | 126 | setPalette ( p ); |
124 | QTimer::singleShot ( 0, this, SLOT( fixGeometry())); | 127 | QTimer::singleShot ( 0, this, SLOT( fixGeometry())); |
125 | } | 128 | } |
126 | 129 | ||
127 | 130 | ||
128 | void SampleWindow::setDecoration( WindowDecorationInterface *i ) | 131 | void SampleWindow::setDecoration( WindowDecorationInterface *i ) |
129 | { | 132 | { |
130 | iface = i; | 133 | iface = i; |
131 | wd.rect = QRect( 0, 0, 150, 75 ); | 134 | wd.rect = QRect( 0, 0, 150, 75 ); |
132 | wd.caption = tr("Sample"); | 135 | wd.caption = tr("Sample"); |
133 | wd.palette = palette(); | 136 | wd.palette = palette(); |
134 | wd.flags = WindowDecorationInterface::WindowData::Dialog | | 137 | wd.flags = WindowDecorationInterface::WindowData::Dialog | |
135 | WindowDecorationInterface::WindowData::Active; | 138 | WindowDecorationInterface::WindowData::Active; |
136 | wd.reserved = 1; | 139 | wd.reserved = 1; |
137 | 140 | ||
138 | th = iface->metric(WindowDecorationInterface::TitleHeight, &wd); | 141 | th = iface->metric(WindowDecorationInterface::TitleHeight, &wd); |
139 | tb = iface->metric(WindowDecorationInterface::TopBorder, &wd); | 142 | tb = iface->metric(WindowDecorationInterface::TopBorder, &wd); |
140 | lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd); | 143 | lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd); |
141 | rb = iface->metric(WindowDecorationInterface::RightBorder, &wd); | 144 | rb = iface->metric(WindowDecorationInterface::RightBorder, &wd); |
142 | bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd); | 145 | bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd); |
143 | 146 | ||
144 | int yoff = th + tb; | 147 | int yoff = th + tb; |
145 | int xoff = lb; | 148 | int xoff = lb; |
146 | 149 | ||
147 | wd.rect.setX( 0 ); | 150 | wd.rect.setX( 0 ); |
148 | wd.rect.setWidth( width() - lb - rb ); | 151 | wd.rect.setWidth( width() - lb - rb ); |
149 | wd.rect.setY( 0 ); | 152 | wd.rect.setY( 0 ); |
150 | wd.rect.setHeight( height() - yoff - bb ); | 153 | wd.rect.setHeight( height() - yoff - bb ); |
151 | 154 | ||
152 | container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() ); | 155 | container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() ); |
153 | setMinimumSize( container->sizeHint().width()+lb+rb, | 156 | setMinimumSize( container->sizeHint().width()+lb+rb, |
154 | container->sizeHint().height()+tb+th+bb ); | 157 | container->sizeHint().height()+tb+th+bb ); |
155 | } | 158 | } |
156 | 159 | ||
157 | void SampleWindow::paintEvent( QPaintEvent * ) | 160 | void SampleWindow::paintEvent( QPaintEvent * ) |
158 | { | 161 | { |
159 | if ( !iface ) | 162 | if ( !iface ) |
160 | return; | 163 | return; |
161 | 164 | ||
162 | QPainter p( this ); | 165 | QPainter p( this ); |
163 | 166 | ||
164 | p.translate( lb, th+tb ); | 167 | p.translate( lb, th+tb ); |
165 | 168 | ||
166 | iface->drawArea(WindowDecorationInterface::Border, &p, &wd); | 169 | iface->drawArea(WindowDecorationInterface::Border, &p, &wd); |
167 | iface->drawArea(WindowDecorationInterface::Title, &p, &wd); | 170 | iface->drawArea(WindowDecorationInterface::Title, &p, &wd); |
168 | 171 | ||
169 | p.setPen(palette().active().color(QColorGroup::HighlightedText)); | 172 | p.setPen(palette().active().color(QColorGroup::HighlightedText)); |
170 | QFont f( font() ); | 173 | QFont f( font() ); |
171 | f.setWeight( QFont::Bold ); | 174 | f.setWeight( QFont::Bold ); |
172 | p.setFont(f); | 175 | p.setFont(f); |
173 | iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd); | 176 | iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd); |
174 | 177 | ||
175 | QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th ); | 178 | QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th ); |
176 | iface->drawButton( WindowDecorationInterface::Help, &p, &wd, | 179 | iface->drawButton( WindowDecorationInterface::Help, &p, &wd, |
177 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); | 180 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); |
178 | brect.moveBy( wd.rect.width() - | 181 | brect.moveBy( wd.rect.width() - |
179 | iface->metric(WindowDecorationInterface::OKWidth,&wd) - | 182 | iface->metric(WindowDecorationInterface::OKWidth,&wd) - |
180 | iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); | 183 | iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); |
181 | iface->drawButton( WindowDecorationInterface::Close, &p, &wd, | 184 | iface->drawButton( WindowDecorationInterface::Close, &p, &wd, |
182 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); | 185 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); |
183 | brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); | 186 | brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); |
184 | iface->drawButton( WindowDecorationInterface::OK, &p, &wd, | 187 | iface->drawButton( WindowDecorationInterface::OK, &p, &wd, |
185 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); | 188 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); |
186 | } | 189 | } |
187 | 190 | ||
188 | void SampleWindow::init() | 191 | void SampleWindow::init() |
189 | { | 192 | { |
190 | container = new QVBox( this ); | 193 | container = new QVBox( this ); |
191 | popup = new QPopupMenu( this ); | 194 | popup = new QPopupMenu( this ); |
192 | popup->insertItem( tr("Normal Item"), 1 ); | 195 | popup->insertItem( tr("Normal Item"), 1 ); |
193 | popup->insertItem( tr("Disabled Item"), 2 ); | 196 | popup->insertItem( tr("Disabled Item"), 2 ); |
194 | popup->setItemEnabled(2, FALSE); | 197 | popup->setItemEnabled(2, FALSE); |
195 | QMenuBar *mb = new QMenuBar( container ); | 198 | QMenuBar *mb = new QMenuBar( container ); |
196 | mb->insertItem( tr("Menu"), popup ); | 199 | mb->insertItem( tr("Menu"), popup ); |
197 | QHBox *hb = new QHBox( container ); | 200 | QHBox *hb = new QHBox( container ); |
198 | QWidget *w = new QWidget( hb ); | 201 | QWidget *w = new QWidget( hb ); |
199 | (void)new QScrollBar( 0, 0, 0, 0, 0, Vertical, hb ); | 202 | (void)new QScrollBar( 0, 0, 0, 0, 0, Vertical, hb ); |
200 | 203 | ||
201 | QGridLayout *gl = new QGridLayout( w, 2, 2, 4 ); | 204 | QGridLayout *gl = new QGridLayout( w, 2, 2, 4 ); |
202 | SampleText *l = new SampleText( tr("Normal Text"), FALSE, w ); | 205 | SampleText *l = new SampleText( tr("Normal Text"), FALSE, w ); |
203 | gl->addWidget( l, 0, 0 ); | 206 | gl->addWidget( l, 0, 0 ); |
204 | 207 | ||
205 | l = new SampleText( tr("Highlighted Text"), TRUE, w ); | 208 | l = new SampleText( tr("Highlighted Text"), TRUE, w ); |
206 | gl->addWidget( l, 1, 0 ); | 209 | gl->addWidget( l, 1, 0 ); |
207 | 210 | ||
208 | QPushButton *pb = new QPushButton( tr("Button"), w ); | 211 | QPushButton *pb = new QPushButton( tr("Button"), w ); |
209 | gl->addWidget( pb, 0, 1 ); | 212 | gl->addWidget( pb, 0, 1 ); |
210 | pb->setFocusPolicy( NoFocus ); | 213 | pb->setFocusPolicy( NoFocus ); |
211 | 214 | ||
212 | QCheckBox *cb = new QCheckBox( tr("Check Box"), w ); | 215 | QCheckBox *cb = new QCheckBox( tr("Check Box"), w ); |
213 | gl->addWidget( cb, 1, 1 ); | 216 | gl->addWidget( cb, 1, 1 ); |
214 | cb->setFocusPolicy( NoFocus ); | 217 | cb->setFocusPolicy( NoFocus ); |
215 | cb->setChecked( TRUE ); | 218 | cb->setChecked( TRUE ); |
216 | 219 | ||
217 | QWhatsThis::add( this, tr("Sample window using the selected settings.") ); | 220 | QWhatsThis::add( this, tr("Sample window using the selected settings.") ); |
218 | } | 221 | } |
219 | 222 | ||
220 | bool SampleWindow::eventFilter( QObject *, QEvent *e ) | 223 | bool SampleWindow::eventFilter( QObject *, QEvent *e ) |
221 | { | 224 | { |
222 | switch ( e->type() ) { | 225 | switch ( e->type() ) { |
223 | case QEvent::MouseButtonPress: | 226 | case QEvent::MouseButtonPress: |
224 | case QEvent::MouseButtonRelease: | 227 | case QEvent::MouseButtonRelease: |
225 | case QEvent::MouseButtonDblClick: | 228 | case QEvent::MouseButtonDblClick: |
226 | case QEvent::MouseMove: | 229 | case QEvent::MouseMove: |
227 | case QEvent::KeyPress: | 230 | case QEvent::KeyPress: |
228 | case QEvent::KeyRelease: | 231 | case QEvent::KeyRelease: |
229 | return TRUE; | 232 | return TRUE; |
230 | default: | 233 | default: |
231 | break; | 234 | break; |
232 | } | 235 | } |
233 | 236 | ||
234 | return FALSE; | 237 | return FALSE; |
235 | } | 238 | } |
236 | 239 | ||
237 | void SampleWindow::paletteChange( const QPalette &old ) | 240 | void SampleWindow::paletteChange( const QPalette &old ) |
238 | { | 241 | { |
239 | QWidget::paletteChange ( old ); | 242 | QWidget::paletteChange ( old ); |
240 | wd. palette = palette ( ); | 243 | wd. palette = palette ( ); |
241 | popup-> setPalette ( palette ( )); | 244 | popup-> setPalette ( palette ( )); |
242 | } | 245 | } |
243 | 246 | ||
244 | 247 | ||
245 | void SampleWindow::setPalette ( const QPalette &pal ) | 248 | void SampleWindow::setPalette ( const QPalette &pal ) |
246 | { | 249 | { |
247 | QPixmapCache::clear ( ); | 250 | QPixmapCache::clear ( ); |
248 | QPalette p = pal; | 251 | QPalette p = pal; |
249 | style ( ). polish ( p ); | 252 | style ( ). polish ( p ); |
250 | QWidget::setPalette ( p ); | 253 | QWidget::setPalette ( p ); |
251 | } | 254 | } |
252 | 255 | ||
253 | void SampleWindow::resizeEvent( QResizeEvent *re ) | 256 | void SampleWindow::resizeEvent( QResizeEvent *re ) |
254 | { | 257 | { |
255 | wd.rect = QRect( 0, 0, 150, 75 ); | 258 | wd.rect = QRect( 0, 0, 150, 75 ); |
256 | 259 | ||
257 | wd.rect.setX( 0 ); | 260 | wd.rect.setX( 0 ); |
258 | wd.rect.setWidth( width() - lb - rb ); | 261 | wd.rect.setWidth( width() - lb - rb ); |
259 | wd.rect.setY( 0 ); | 262 | wd.rect.setY( 0 ); |
260 | wd.rect.setHeight( height() - th - tb - bb ); | 263 | wd.rect.setHeight( height() - th - tb - bb ); |
261 | 264 | ||
262 | container->setGeometry( lb, th+tb, wd.rect.width(), wd.rect.height() ); | 265 | container->setGeometry( lb, th+tb, wd.rect.width(), wd.rect.height() ); |
263 | QWidget::resizeEvent( re ); | 266 | QWidget::resizeEvent( re ); |
264 | } | 267 | } |
265 | 268 | ||
266 | void SampleWindow::fixGeometry() | 269 | void SampleWindow::fixGeometry() |
267 | { | 270 | { |
268 | setMinimumSize( container->sizeHint().width()+lb+rb, | 271 | setMinimumSize( container->sizeHint().width()+lb+rb, |
269 | container->sizeHint().height()+tb+th+bb ); | 272 | container->sizeHint().height()+tb+th+bb ); |
270 | } | 273 | } |
271 | 274 | ||
diff --git a/noncore/settings/appearance2/sample.h b/noncore/settings/appearance2/sample.h index 27e6db5..ba18038 100644 --- a/noncore/settings/appearance2/sample.h +++ b/noncore/settings/appearance2/sample.h | |||
@@ -1,77 +1,80 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 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 file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU 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 file 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 General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | 3 | ||
4 | Copyright (c) 2002 Trolltech AS <info@trolltech.com> | ||
5 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
6 | =. | ||
7 | .=l. | ||
8 | Â Â Â Â Â Â .>+-= | ||
9 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | ||
10 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | ||
12 | .="- .-=="i, Â Â .._ License as published by the Free Software | ||
13 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | ||
14 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | ||
15 | Â Â .%`+i> Â Â Â _;_. | ||
16 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | ||
17 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
19 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
22 | ++= Â -. Â Â .` Â Â .: details. | ||
23 | : Â Â = Â ...= . :.=- | ||
24 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
25 | Â -_. . . Â )=. Â = Library General Public License along with | ||
26 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #ifndef __PREVIEW_H__ | 32 | #ifndef __PREVIEW_H__ |
30 | #define __PREVIEW_H__ | 33 | #define __PREVIEW_H__ |
31 | 34 | ||
32 | #include <qwidget.h> | 35 | #include <qwidget.h> |
33 | 36 | ||
34 | #include <qpe/windowdecorationinterface.h> | 37 | #include <qpe/windowdecorationinterface.h> |
35 | 38 | ||
36 | class QVBox; | 39 | class QVBox; |
37 | class QPopupMenu; | 40 | class QPopupMenu; |
38 | class SampleText; | 41 | class SampleText; |
39 | 42 | ||
40 | class SampleWindow : public QWidget | 43 | class SampleWindow : public QWidget |
41 | { | 44 | { |
42 | Q_OBJECT | 45 | Q_OBJECT |
43 | public: | 46 | public: |
44 | SampleWindow( QWidget *parent ); | 47 | SampleWindow( QWidget *parent ); |
45 | 48 | ||
46 | QSize sizeHint() const; | 49 | QSize sizeHint() const; |
47 | 50 | ||
48 | virtual void setFont( const QFont &f ); | 51 | virtual void setFont( const QFont &f ); |
49 | 52 | ||
50 | void setStyle2 ( QStyle *sty, const QPalette &p ); | 53 | void setStyle2 ( QStyle *sty, const QPalette &p ); |
51 | void setDecoration( WindowDecorationInterface *i ); | 54 | void setDecoration( WindowDecorationInterface *i ); |
52 | void setPalette ( const QPalette & ); | 55 | void setPalette ( const QPalette & ); |
53 | 56 | ||
54 | virtual void paintEvent( QPaintEvent * ); | 57 | virtual void paintEvent( QPaintEvent * ); |
55 | 58 | ||
56 | void init(); | 59 | void init(); |
57 | 60 | ||
58 | virtual bool eventFilter( QObject *, QEvent *e ); | 61 | virtual bool eventFilter( QObject *, QEvent *e ); |
59 | virtual void paletteChange( const QPalette &old ); | 62 | virtual void paletteChange( const QPalette &old ); |
60 | virtual void resizeEvent( QResizeEvent *re ); | 63 | virtual void resizeEvent( QResizeEvent *re ); |
61 | 64 | ||
62 | public slots: | 65 | public slots: |
63 | void fixGeometry(); | 66 | void fixGeometry(); |
64 | 67 | ||
65 | protected: | 68 | protected: |
66 | WindowDecorationInterface *iface; | 69 | WindowDecorationInterface *iface; |
67 | WindowDecorationInterface::WindowData wd; | 70 | WindowDecorationInterface::WindowData wd; |
68 | QVBox *container; | 71 | QVBox *container; |
69 | QPopupMenu *popup; | 72 | QPopupMenu *popup; |
70 | int th; | 73 | int th; |
71 | int tb; | 74 | int tb; |
72 | int lb; | 75 | int lb; |
73 | int rb; | 76 | int rb; |
74 | int bb; | 77 | int bb; |
75 | }; | 78 | }; |
76 | 79 | ||
77 | #endif | 80 | #endif |
diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h index b6c72c3..613fa71 100644 --- a/noncore/settings/appearance2/stylelistitem.h +++ b/noncore/settings/appearance2/stylelistitem.h | |||
@@ -1,118 +1,121 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU 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 file 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 General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | 3 | ||
4 | Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | =. | ||
6 | .=l. | ||
7 | Â Â Â Â Â Â .>+-= | ||
8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can | ||
9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, Â Â .._ License as published by the Free Software | ||
12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, | ||
13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. | ||
14 | Â Â .%`+i> Â Â Â _;_. | ||
15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that | ||
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
26 | */ | 29 | */ |
27 | 30 | ||
28 | #ifndef STYLELISTITEM_H | 31 | #ifndef STYLELISTITEM_H |
29 | #define STYLELISTITEM_H | 32 | #define STYLELISTITEM_H |
30 | 33 | ||
31 | /* OPIE */ | 34 | /* OPIE */ |
32 | #include <qpe/styleinterface.h> | 35 | #include <qpe/styleinterface.h> |
33 | #include <qpe/qlibrary.h> | 36 | #include <qpe/qlibrary.h> |
34 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
35 | 38 | ||
36 | /* QT */ | 39 | /* QT */ |
37 | #include <qlistbox.h> | 40 | #include <qlistbox.h> |
38 | #include <qfileinfo.h> | 41 | #include <qfileinfo.h> |
39 | 42 | ||
40 | #include <stdio.h> | 43 | #include <stdio.h> |
41 | 44 | ||
42 | class StyleListItem : public QListBoxText { | 45 | class StyleListItem : public QListBoxText { |
43 | public: | 46 | public: |
44 | StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t ) | 47 | StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t ) |
45 | { | 48 | { |
46 | m_lib = 0; | 49 | m_lib = 0; |
47 | m_style_if = 0; | 50 | m_style_if = 0; |
48 | m_settings_if = 0; | 51 | m_settings_if = 0; |
49 | m_style = sty; | 52 | m_style = sty; |
50 | } | 53 | } |
51 | 54 | ||
52 | StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( )) | 55 | StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( )) |
53 | { | 56 | { |
54 | m_lib = lib; | 57 | m_lib = lib; |
55 | m_style_if = iface; | 58 | m_style_if = iface; |
56 | m_settings_if = 0; | 59 | m_settings_if = 0; |
57 | m_style = iface-> style ( ); | 60 | m_style = iface-> style ( ); |
58 | 61 | ||
59 | iface-> queryInterface ( IID_StyleExtended, (QUnknownInterface **) &m_settings_if ); | 62 | iface-> queryInterface ( IID_StyleExtended, (QUnknownInterface **) &m_settings_if ); |
60 | } | 63 | } |
61 | 64 | ||
62 | virtual ~StyleListItem ( ) | 65 | virtual ~StyleListItem ( ) |
63 | { | 66 | { |
64 | delete m_style; | 67 | delete m_style; |
65 | 68 | ||
66 | if ( m_settings_if ) | 69 | if ( m_settings_if ) |
67 | m_settings_if-> release ( ); | 70 | m_settings_if-> release ( ); |
68 | if ( m_style_if ) | 71 | if ( m_style_if ) |
69 | m_style_if-> release ( ); | 72 | m_style_if-> release ( ); |
70 | delete m_lib; | 73 | delete m_lib; |
71 | } | 74 | } |
72 | 75 | ||
73 | bool hasSettings ( ) const | 76 | bool hasSettings ( ) const |
74 | { | 77 | { |
75 | return m_settings_if ? m_settings_if-> hasSettings ( ) : false; | 78 | return m_settings_if ? m_settings_if-> hasSettings ( ) : false; |
76 | } | 79 | } |
77 | 80 | ||
78 | QWidget *settings ( QWidget *parent ) | 81 | QWidget *settings ( QWidget *parent ) |
79 | { | 82 | { |
80 | return m_settings_if ? m_settings_if-> create ( parent ) : 0; | 83 | return m_settings_if ? m_settings_if-> create ( parent ) : 0; |
81 | } | 84 | } |
82 | 85 | ||
83 | bool setSettings ( bool accepted ) | 86 | bool setSettings ( bool accepted ) |
84 | { | 87 | { |
85 | if ( !m_settings_if ) | 88 | if ( !m_settings_if ) |
86 | return false; | 89 | return false; |
87 | 90 | ||
88 | if ( accepted ) | 91 | if ( accepted ) |
89 | return m_settings_if-> accept ( ); | 92 | return m_settings_if-> accept ( ); |
90 | else { | 93 | else { |
91 | m_settings_if-> reject ( ); | 94 | m_settings_if-> reject ( ); |
92 | return false; | 95 | return false; |
93 | } | 96 | } |
94 | } | 97 | } |
95 | 98 | ||
96 | QString key ( ) | 99 | QString key ( ) |
97 | { | 100 | { |
98 | if ( m_lib ) | 101 | if ( m_lib ) |
99 | return QFileInfo ( m_lib-> library ( )). fileName ( ); | 102 | return QFileInfo ( m_lib-> library ( )). fileName ( ); |
100 | else | 103 | else |
101 | return text ( ); | 104 | return text ( ); |
102 | } | 105 | } |
103 | 106 | ||
104 | QStyle *style ( ) | 107 | QStyle *style ( ) |
105 | { | 108 | { |
106 | return m_style; | 109 | return m_style; |
107 | } | 110 | } |
108 | 111 | ||
109 | private: | 112 | private: |
110 | QLibrary *m_lib; | 113 | QLibrary *m_lib; |
111 | QStyle *m_style; | 114 | QStyle *m_style; |
112 | StyleInterface *m_style_if; | 115 | StyleInterface *m_style_if; |
113 | StyleExtendedInterface *m_settings_if; | 116 | StyleExtendedInterface *m_settings_if; |
114 | 117 | ||
115 | }; | 118 | }; |
116 | 119 | ||
117 | 120 | ||
118 | #endif | 121 | #endif |