summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp62
-rw-r--r--noncore/settings/appearance2/appearance.h50
-rw-r--r--noncore/settings/appearance2/colorlistitem.h28
-rw-r--r--noncore/settings/appearance2/decolistitem.h27
-rw-r--r--noncore/settings/appearance2/editScheme.cpp116
-rw-r--r--noncore/settings/appearance2/editScheme.h73
-rw-r--r--noncore/settings/appearance2/main.cpp46
-rw-r--r--noncore/settings/appearance2/sample.cpp29
-rw-r--r--noncore/settings/appearance2/sample.h29
-rw-r--r--noncore/settings/appearance2/stylelistitem.h28
10 files changed, 318 insertions, 170 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 23630c5..66cf2c3 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -1,215 +1,219 @@
1/********************************************************************** 1/*
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2               =. This file is part of the OPIE Project
3** 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4** This file is part of the Qtopia Environment. 4           .>+-=
5** 5 _;:,     .>    :=|. This library is free software; you can
6** This file may be distributed and/or modified under the terms of the 6.> <`_,   >  .   <= redistribute it and/or modify it under
7** GNU General Public License version 2 as published by the Free Software 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8** Foundation and appearing in the file LICENSE.GPL included in the 8.="- .-=="i,     .._ License as published by the Free Software
9** packaging of this file. 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10** 10     ._= =}       : or (at your option) any later version.
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11    .%`+i>       _;_.
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12    .i_,=:_.      -<s. This library is distributed in the hope that
13** 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14    : ..    .:,     . . . without even the implied warranty of
15** 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16** Contact info@trolltech.com if any conditions of this licensing are 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17** not clear to you. 17..}^=.=       =       ; Library General Public License for more
18** 18++=   -.     .`     .: details.
19*********************************************************************** 19 :     =  ...= . :.=-
20** 20 -.   .:....=;==+<; You should have received a copy of the GNU
21** Enhancements by: Dan Williams, <williamsdr@acm.org> 21  -_. . .   )=.  = Library General Public License along with
22** 22    --        :-=` this library; see the file COPYING.LIB.
23**********************************************************************/ 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
24 28
25#include "appearance.h" 29#include "appearance.h"
26#include "editScheme.h" 30#include "editScheme.h"
27 31
28#include <opie/ofiledialog.h> 32#include <opie/ofiledialog.h>
29#include <opie/otabwidget.h> 33#include <opie/otabwidget.h>
30 34
31#include <qpe/applnk.h> 35#include <qpe/applnk.h>
32#include <qpe/config.h> 36#include <qpe/config.h>
33#include <qpe/global.h> 37#include <qpe/global.h>
34#include <qpe/resource.h> 38#include <qpe/resource.h>
35#include <qpe/qpeapplication.h> 39#include <qpe/qpeapplication.h>
36#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 40#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
37#include <qpe/qcopenvelope_qws.h> 41#include <qpe/qcopenvelope_qws.h>
38#endif 42#endif
39 43
40#include <qaction.h> 44#include <qaction.h>
41#include <qbuttongroup.h> 45#include <qbuttongroup.h>
42#include <qcheckbox.h> 46#include <qcheckbox.h>
43#include <qcombobox.h> 47#include <qcombobox.h>
44#include <qdialog.h> 48#include <qdialog.h>
45#include <qdir.h> 49#include <qdir.h>
46#include <qlabel.h> 50#include <qlabel.h>
47#include <qlayout.h> 51#include <qlayout.h>
48#include <qlineedit.h> 52#include <qlineedit.h>
49#include <qlistbox.h> 53#include <qlistbox.h>
50#include <qmessagebox.h> 54#include <qmessagebox.h>
51#include <qmultilineedit.h> 55#include <qmultilineedit.h>
52#include <qpopupmenu.h> 56#include <qpopupmenu.h>
53#include <qpushbutton.h> 57#include <qpushbutton.h>
54#include <qradiobutton.h> 58#include <qradiobutton.h>
55#if QT_VERSION >= 300 59#if QT_VERSION >= 300
56#include <qstylefactory.h> 60#include <qstylefactory.h>
57#else 61#else
58#include <qwindowsstyle.h> 62#include <qwindowsstyle.h>
59#include <qpe/qpestyle.h> 63#include <qpe/qpestyle.h>
60#include <qpe/lightstyle.h> 64#include <qpe/lightstyle.h>
61#include <qpe/qlibrary.h> 65#include <qpe/qlibrary.h>
62#include <qpe/styleinterface.h> 66#include <qpe/styleinterface.h>
63#endif 67#endif
64#include <qtabwidget.h> 68#include <qtabwidget.h>
65#include <qtoolbutton.h> 69#include <qtoolbutton.h>
66#include <qvgroupbox.h> 70#include <qvgroupbox.h>
67#include <qwidget.h> 71#include <qwidget.h>
68 72
69#include "stylelistitem.h" 73#include "stylelistitem.h"
70#include "decolistitem.h" 74#include "decolistitem.h"
71#include "colorlistitem.h" 75#include "colorlistitem.h"
72 76
73#include "sample.h" 77#include "sample.h"
74 78
75#include <opie/ofontselector.h> 79#include <opie/ofontselector.h>
76 80
77 81
78class DefaultWindowDecoration : public WindowDecorationInterface 82class DefaultWindowDecoration : public WindowDecorationInterface
79{ 83{
80public: 84public:
81 DefaultWindowDecoration() : ref(0) {} 85 DefaultWindowDecoration() : ref(0) {}
82 QString name() const { 86 QString name() const {
83 return "Default"; 87 return "Default";
84 } 88 }
85 QPixmap icon() const { 89 QPixmap icon() const {
86 return QPixmap(); 90 return QPixmap();
87 } 91 }
88 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 92 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
89 *iface = 0; 93 *iface = 0;
90 if ( uuid == IID_QUnknown ) 94 if ( uuid == IID_QUnknown )
91 *iface = this; 95 *iface = this;
92 else if ( uuid == IID_WindowDecoration ) 96 else if ( uuid == IID_WindowDecoration )
93 *iface = this; 97 *iface = this;
94 98
95 if ( *iface ) 99 if ( *iface )
96 (*iface)->addRef(); 100 (*iface)->addRef();
97 return QS_OK; 101 return QS_OK;
98 } 102 }
99 Q_REFCOUNT 103 Q_REFCOUNT
100 104
101private: 105private:
102 ulong ref; 106 ulong ref;
103}; 107};
104 108
105 109
106 110
107void Appearance::loadStyles ( QListBox *list ) 111void Appearance::loadStyles ( QListBox *list )
108{ 112{
109#if QT_VERSION >= 300 113#if QT_VERSION >= 300
110 list->insertStringList(QStyleFactory::styles()); 114 list->insertStringList(QStyleFactory::styles());
111#else 115#else
112 list->insertItem( new StyleListItem ( "Windows", new QWindowsStyle ( ))); 116 list->insertItem( new StyleListItem ( "Windows", new QWindowsStyle ( )));
113 list->insertItem( new StyleListItem ( "Light", new LightStyle ( ))); 117 list->insertItem( new StyleListItem ( "Light", new LightStyle ( )));
114#ifndef QT_NO_STYLE_MOTIF 118#ifndef QT_NO_STYLE_MOTIF
115 list->insertItem( new StyleListItem ( "Motif", new QMotifStyle ( ))); 119 list->insertItem( new StyleListItem ( "Motif", new QMotifStyle ( )));
116#endif 120#endif
117#ifndef QT_NO_STYLE_MOTIFPLUS 121#ifndef QT_NO_STYLE_MOTIFPLUS
118 list->insertItem( new StyleListItem ( "MotifPlus", new QMotifPlusStyle ( ))); 122 list->insertItem( new StyleListItem ( "MotifPlus", new QMotifPlusStyle ( )));
119#endif 123#endif
120#ifndef QT_NO_STYLE_PLATINUM 124#ifndef QT_NO_STYLE_PLATINUM
121 list->insertItem( new StyleListItem ( "Platinum", new QPlatinumStyle ( ))); 125 list->insertItem( new StyleListItem ( "Platinum", new QPlatinumStyle ( )));
122#endif 126#endif
123#endif 127#endif
124 list->insertItem( new StyleListItem ( "QPE", new QPEStyle ( ))); 128 list->insertItem( new StyleListItem ( "QPE", new QPEStyle ( )));
125 129
126#if QT_VERSION < 300 130#if QT_VERSION < 300
127 { 131 {
128 QString path = QPEApplication::qpeDir() + "/plugins/styles/"; 132 QString path = QPEApplication::qpeDir() + "/plugins/styles/";
129 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 133 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
130 134
131 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 135 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
132 QLibrary *lib = new QLibrary ( path + "/" + *it ); 136 QLibrary *lib = new QLibrary ( path + "/" + *it );
133 StyleInterface *iface; 137 StyleInterface *iface;
134 138
135 if ( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) 139 if ( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK )
136 list-> insertItem ( new StyleListItem ( lib, iface )); 140 list-> insertItem ( new StyleListItem ( lib, iface ));
137 else 141 else
138 delete lib; 142 delete lib;
139 } 143 }
140 } 144 }
141 145
142#endif 146#endif
143} 147}
144 148
145void Appearance::loadDecos ( QListBox *list ) 149void Appearance::loadDecos ( QListBox *list )
146{ 150{
147 list-> insertItem ( new DecoListItem ( tr( "Default" ))); 151 list-> insertItem ( new DecoListItem ( tr( "Default" )));
148 152
149 { 153 {
150 QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; 154 QString path = QPEApplication::qpeDir() + "/plugins/decorations/";
151 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 155 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
152 156
153 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 157 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
154 QLibrary *lib = new QLibrary ( path + "/" + *it ); 158 QLibrary *lib = new QLibrary ( path + "/" + *it );
155 WindowDecorationInterface *iface; 159 WindowDecorationInterface *iface;
156 160
157 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) 161 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK )
158 list-> insertItem ( new DecoListItem ( lib, iface )); 162 list-> insertItem ( new DecoListItem ( lib, iface ));
159 else 163 else
160 delete lib; 164 delete lib;
161 } 165 }
162 } 166 }
163} 167}
164 168
165void Appearance::loadColors ( QListBox *list ) 169void Appearance::loadColors ( QListBox *list )
166{ 170{
167 list-> clear ( ); 171 list-> clear ( );
168 { 172 {
169 Config config ( "qpe" ); 173 Config config ( "qpe" );
170 config. setGroup ( "Appearance" ); 174 config. setGroup ( "Appearance" );
171 175
172 list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), config )); 176 list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), config ));
173 } 177 }
174 178
175 QString path = QPEApplication::qpeDir ( ) + "/etc/colors/"; 179 QString path = QPEApplication::qpeDir ( ) + "/etc/colors/";
176 QStringList sl = QDir ( path ). entryList ( "*.scheme" ); 180 QStringList sl = QDir ( path ). entryList ( "*.scheme" );
177 181
178 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 182 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
179 QString name = (*it). left ((*it). find ( ".scheme" )); 183 QString name = (*it). left ((*it). find ( ".scheme" ));
180 Config config ( path + *it, Config::File ); 184 Config config ( path + *it, Config::File );
181 config. setGroup ( "Colors" ); 185 config. setGroup ( "Colors" );
182 186
183 list-> insertItem ( new ColorListItem ( name, config )); 187 list-> insertItem ( new ColorListItem ( name, config ));
184 } 188 }
185} 189}
186 190
187 191
188QWidget *Appearance::createStyleTab ( QWidget *parent ) 192QWidget *Appearance::createStyleTab ( QWidget *parent )
189{ 193{
190 Config config ( "qpe" ); 194 Config config ( "qpe" );
191 config. setGroup ( "Appearance" ); 195 config. setGroup ( "Appearance" );
192 196
193 QWidget* tab = new QWidget( parent, "StyleTab" ); 197 QWidget* tab = new QWidget( parent, "StyleTab" );
194 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 ); 198 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 );
195 199
196 m_style_list = new QListBox( tab, "m_style_list" ); 200 m_style_list = new QListBox( tab, "m_style_list" );
197 vertLayout->addWidget( m_style_list ); 201 vertLayout->addWidget( m_style_list );
198 202
199 m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); 203 m_style_settings = new QPushButton ( tr( "Settings..." ), tab );
200 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( ))); 204 connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( )));
201 vertLayout-> addWidget ( m_style_settings ); 205 vertLayout-> addWidget ( m_style_settings );
202 206
203 loadStyles ( m_style_list ); 207 loadStyles ( m_style_list );
204 208
205 QString s = config. readEntry ( "Style", "Light" ); 209 QString s = config. readEntry ( "Style", "Light" );
206 m_style_list-> setCurrentItem ( m_style_list-> findItem ( s )); 210 m_style_list-> setCurrentItem ( m_style_list-> findItem ( s ));
207 m_original_style = m_style_list-> currentItem ( ); 211 m_original_style = m_style_list-> currentItem ( );
208 styleClicked ( m_original_style ); 212 styleClicked ( m_original_style );
209 213
210 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); 214 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) );
211 215
212 return tab; 216 return tab;
213} 217}
214 218
215QWidget *Appearance::createDecoTab ( QWidget *parent ) 219QWidget *Appearance::createDecoTab ( QWidget *parent )
@@ -301,284 +305,284 @@ QWidget *Appearance::createGuiTab ( QWidget *parent )
301 QGridLayout* gridLayout = new QGridLayout ( vertLayout ); 305 QGridLayout* gridLayout = new QGridLayout ( vertLayout );
302 306
303 int style = config. readNumEntry ( "TabStyle", 2 ) - 1; 307 int style = config. readNumEntry ( "TabStyle", 2 ) - 1;
304 bool tabtop = ( config. readEntry ( "TabPosition", "Top" ) == "Top" ); 308 bool tabtop = ( config. readEntry ( "TabPosition", "Top" ) == "Top" );
305 309
306 QLabel* label = new QLabel( tr( "Tab style:" ), tab ); 310 QLabel* label = new QLabel( tr( "Tab style:" ), tab );
307 gridLayout-> addWidget ( label, 0, 0 ); 311 gridLayout-> addWidget ( label, 0, 0 );
308 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); 312 QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" );
309 btngrp-> hide ( ); 313 btngrp-> hide ( );
310 btngrp-> setExclusive ( true ); 314 btngrp-> setExclusive ( true );
311 315
312 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); 316 m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" );
313 m_tabstyle_list-> insertItem ( tr( "Tabs" )); 317 m_tabstyle_list-> insertItem ( tr( "Tabs" ));
314 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); 318 m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" ));
315 m_tabstyle_list-> insertItem ( tr( "Drop down list" )); 319 m_tabstyle_list-> insertItem ( tr( "Drop down list" ));
316 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); 320 m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" ));
317 m_tabstyle_list-> setCurrentItem ( style ); 321 m_tabstyle_list-> setCurrentItem ( style );
318 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); 322 gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 );
319 323
320 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); 324 m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" );
321 btngrp-> insert ( m_tabstyle_top ); 325 btngrp-> insert ( m_tabstyle_top );
322 gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); 326 gridLayout-> addWidget( m_tabstyle_top, 1, 1 );
323 327
324 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); 328 m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" );
325 btngrp-> insert ( m_tabstyle_bottom ); 329 btngrp-> insert ( m_tabstyle_bottom );
326 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); 330 gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 );
327 331
328 m_tabstyle_top-> setChecked ( tabtop ); 332 m_tabstyle_top-> setChecked ( tabtop );
329 m_tabstyle_bottom-> setChecked ( !tabtop ); 333 m_tabstyle_bottom-> setChecked ( !tabtop );
330 334
331 m_original_tabstyle = style; 335 m_original_tabstyle = style;
332 m_original_tabpos = tabtop; 336 m_original_tabpos = tabtop;
333 337
334 return tab; 338 return tab;
335} 339}
336 340
337 341
338Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 342Appearance::Appearance( QWidget* parent, const char* name, WFlags )
339 : QDialog ( parent, name, true ) 343 : QDialog ( parent, name, true )
340{ 344{
341 setCaption( tr( "Appearance" ) ); 345 setCaption( tr( "Appearance" ) );
342 346
343 Config config( "qpe" ); 347 Config config( "qpe" );
344 config.setGroup( "Appearance" ); 348 config.setGroup( "Appearance" );
345 349
346 QVBoxLayout *top = new QVBoxLayout ( this, 4, 4 ); 350 QVBoxLayout *top = new QVBoxLayout ( this, 4, 4 );
347 351
348 m_sample = new SampleWindow ( this ); 352 m_sample = new SampleWindow ( this );
349 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 353 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
350 354
351 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 355 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
352 QWidget *styletab; 356 QWidget *styletab;
353 357
354 tw-> addTab ( styletab = createStyleTab ( tw ), "appearance/styletabicon.png", tr( "Style" )); 358 tw-> addTab ( styletab = createStyleTab ( tw ), "appearance/styletabicon.png", tr( "Style" ));
355 tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" )); 359 tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" ));
356 tw-> addTab ( createColorTab ( tw ), "appearance/colorstabicon.png", tr( "Colors" ) ); 360 tw-> addTab ( createColorTab ( tw ), "appearance/colorstabicon.png", tr( "Colors" ) );
357 tw-> addTab ( createDecoTab ( tw ), "appearance/styletabicon.png", tr( "Windows" ) ); 361 tw-> addTab ( createDecoTab ( tw ), "appearance/styletabicon.png", tr( "Windows" ) );
358 tw-> addTab ( createGuiTab ( tw ), "appearance/backgroundtabicon.png", tr( "Gui" ) ); 362 tw-> addTab ( createGuiTab ( tw ), "appearance/backgroundtabicon.png", tr( "Gui" ) );
359 363
360 top-> addWidget ( tw, 10 ); 364 top-> addWidget ( tw, 10 );
361 top-> addWidget ( m_sample, 1 ); 365 top-> addWidget ( m_sample, 1 );
362 366
363 tw-> setCurrentTab ( styletab ); 367 tw-> setCurrentTab ( styletab );
364} 368}
365 369
366Appearance::~Appearance() 370Appearance::~Appearance()
367{ 371{
368} 372}
369 373
370void Appearance::accept ( ) 374void Appearance::accept ( )
371{ 375{
372 Config config("qpe"); 376 Config config("qpe");
373 config.setGroup( "Appearance" ); 377 config.setGroup( "Appearance" );
374 378
375 int newtabstyle = m_tabstyle_list-> currentItem ( ); 379 int newtabstyle = m_tabstyle_list-> currentItem ( );
376 bool newtabpos = m_tabstyle_top-> isChecked ( ); 380 bool newtabpos = m_tabstyle_top-> isChecked ( );
377 381
378 382
379 if ( m_style_changed ) { 383 if ( m_style_changed ) {
380 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 384 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
381 if ( item ) 385 if ( item )
382 config.writeEntry( "Style", item-> key ( )); 386 config.writeEntry( "Style", item-> key ( ));
383 } 387 }
384 388
385 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { 389 if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) {
386 config. writeEntry ( "TabStyle", newtabstyle + 1 ); 390 config. writeEntry ( "TabStyle", newtabstyle + 1 );
387 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); 391 config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" );
388 } 392 }
389 393
390 if ( m_font_changed ) { 394 if ( m_font_changed ) {
391 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); 395 config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( ));
392 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); 396 config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( ));
393 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); 397 config. writeEntry ( "FontSize", m_fontselect-> fontSize ( ));
394 } 398 }
395 399
396 400
397 if ( m_color_changed ) 401 if ( m_color_changed )
398 { 402 {
399 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 403 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
400 404
401 if ( item ) 405 if ( item )
402 item-> save ( config ); 406 item-> save ( config );
403 } 407 }
404 408
405 config. write ( ); // need to flush the config info first 409 config. write ( ); // need to flush the config info first
406 Global::applyStyle ( ); 410 Global::applyStyle ( );
407 411
408 if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart Opie now?" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { 412 if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart Opie now?" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
409 QCopEnvelope e( "QPE/System", "restart()" ); 413 QCopEnvelope e( "QPE/System", "restart()" );
410 } 414 }
411 415
412 QDialog::accept ( ); 416 QDialog::accept ( );
413} 417}
414 418
415void Appearance::done ( int r ) 419void Appearance::done ( int r )
416{ 420{
417 QDialog::done ( r ); 421 QDialog::done ( r );
418 close ( ); 422 close ( );
419} 423}
420 424
421 425
422void Appearance::styleClicked ( int index ) 426void Appearance::styleClicked ( int index )
423{ 427{
424 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); 428 StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index );
425 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); 429 m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false );
426 430
427 if ( m_sample && sli && sli-> style ( )) 431 if ( m_sample && sli && sli-> style ( ))
428 m_sample-> setStyle2 ( sli-> style ( )); 432 m_sample-> setStyle2 ( sli-> style ( ));
429 433
430 m_style_changed |= ( index != m_original_style ); 434 m_style_changed |= ( index != m_original_style );
431} 435}
432 436
433void Appearance::styleSettingsClicked ( ) 437void Appearance::styleSettingsClicked ( )
434{ 438{
435 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); 439 StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
436 440
437 if ( item && item-> hasSettings ( )) { 441 if ( item && item-> hasSettings ( )) {
438 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); 442 QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
439 QVBoxLayout *vbox = new QVBoxLayout ( d, 4, 0 ); 443 QVBoxLayout *vbox = new QVBoxLayout ( d, 4, 0 );
440 444
441 QWidget *w = item-> settings ( d ); 445 QWidget *w = item-> settings ( d );
442 446
443 if ( w ) { 447 if ( w ) {
444 vbox-> addWidget ( w ); 448 vbox-> addWidget ( w );
445 449
446 d-> setCaption ( w-> caption ( )); 450 d-> setCaption ( w-> caption ( ));
447 451
448 d-> showMaximized ( ); 452 d-> showMaximized ( );
449 bool accepted = ( d-> exec ( ) == QDialog::Accepted ); 453 bool accepted = ( d-> exec ( ) == QDialog::Accepted );
450 454
451 if ( item-> setSettings ( accepted )) 455 if ( item-> setSettings ( accepted ))
452 m_style_changed = true; 456 m_style_changed = true;
453 } 457 }
454 delete d; 458 delete d;
455 } 459 }
456} 460}
457 461
458void Appearance::decoClicked ( int index ) 462void Appearance::decoClicked ( int index )
459{ 463{
460 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); 464 DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index );
461 465
462 if ( m_sample ) { 466 if ( m_sample ) {
463 if ( dli && dli-> interface ( )) 467 if ( dli && dli-> interface ( ))
464 m_sample-> setDecoration ( dli-> interface ( )); 468 m_sample-> setDecoration ( dli-> interface ( ));
465 else 469 else
466 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 470 m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
467 } 471 }
468 m_deco_changed |= ( index != m_original_deco ); 472 m_deco_changed |= ( index != m_original_deco );
469} 473}
470 474
471void Appearance::fontClicked ( const QFont &f ) 475void Appearance::fontClicked ( const QFont &f )
472{ 476{
473 m_font_changed |= ( f != m_sample-> font ( )); 477 m_font_changed |= ( f != m_sample-> font ( ));
474 m_sample-> setFont ( f ); 478 m_sample-> setFont ( f );
475} 479}
476 480
477void Appearance::colorClicked ( int index ) 481void Appearance::colorClicked ( int index )
478{ 482{
479 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); 483 ColorListItem *item = (ColorListItem *) m_color_list-> item ( index );
480 484
481 if ( item ) 485 if ( item )
482 m_sample-> setPalette ( item-> palette ( )); 486 m_sample-> setPalette ( item-> palette ( ));
483 487
484 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); 488 m_color_changed |= ( item-> palette ( ) != qApp-> palette ( ));
485} 489}
486 490
487 491
488void Appearance::editSchemeClicked ( ) 492void Appearance::editSchemeClicked ( )
489{ 493{
490 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 494 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
491 495
492 int cnt = 0; 496 int cnt = 0;
493 QString controlLabel [QColorGroup::NColorRoles]; 497 QString labels [QColorGroup::NColorRoles];
494 QString controlColor [QColorGroup::NColorRoles]; 498 QColor colors [QColorGroup::NColorRoles];
495 499
496 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { 500 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
497 QColor col = item-> color ( role ); 501 QColor col = item-> color ( role );
498 502
499 if ( col. isValid ( )) { 503 if ( col. isValid ( )) {
500 controlLabel [cnt] = item-> label ( role ); 504 labels [cnt] = item-> label ( role );
501 controlColor [cnt] = col. name ( ); 505 colors [cnt] = col;
502 506
503 cnt++; 507 cnt++;
504 } 508 }
505 } 509 }
506 510
507 EditScheme* editdlg = new EditScheme( this, "editScheme", true, 0, cnt, controlLabel, controlColor ); 511 EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true );
508 editdlg-> showMaximized ( ); 512 editdlg-> showMaximized ( );
509 if ( editdlg-> exec ( ) == QDialog::Accepted ) { 513 if ( editdlg-> exec ( ) == QDialog::Accepted ) {
510 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); 514 ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 );
511 cnt = 0; 515 cnt = 0;
512 516
513 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { 517 for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
514 if ( item-> color ( role ). isValid ( )) { 518 if ( item-> color ( role ). isValid ( )) {
515 citem-> setColor ( role, QColor ( controlColor [cnt] )); 519 citem-> setColor ( role, colors [cnt] );
516 cnt++; 520 cnt++;
517 } 521 }
518 } 522 }
519 523
520 m_color_list-> setCurrentItem ( 0 ); 524 m_color_list-> setCurrentItem ( 0 );
521 colorClicked ( 0 ); 525 colorClicked ( 0 );
522 526
523 m_color_changed = true; 527 m_color_changed = true;
524 } 528 }
525 delete editdlg; 529 delete editdlg;
526} 530}
527 531
528 532
529void Appearance::saveSchemeClicked() 533void Appearance::saveSchemeClicked()
530{ 534{
531 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 535 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
532 536
533 if ( !item ) 537 if ( !item )
534 return; 538 return;
535 539
536 QDialog *d = new QDialog ( this, 0, true ); 540 QDialog *d = new QDialog ( this, 0, true );
537 d-> setCaption ( tr( "Save Scheme" )); 541 d-> setCaption ( tr( "Save Scheme" ));
538 QLineEdit *ed = new QLineEdit ( this ); 542 QLineEdit *ed = new QLineEdit ( this );
539 ( new QVBoxLayout ( d, 4, 4 ))-> addWidget ( ed ); 543 ( new QVBoxLayout ( d, 4, 4 ))-> addWidget ( ed );
540 544
541 if ( d-> exec ( ) == QDialog::Accepted ) { 545 if ( d-> exec ( ) == QDialog::Accepted ) {
542 QString schemename = ed-> text ( ); 546 QString schemename = ed-> text ( );
543 QFile file ( QPEApplication::qpeDir() + "/etc/colors/" + schemename + ".scheme" ); 547 QFile file ( QPEApplication::qpeDir() + "/etc/colors/" + schemename + ".scheme" );
544 if ( !file. exists ( )) 548 if ( !file. exists ( ))
545 { 549 {
546 QPalette p = item-> palette ( ); 550 QPalette p = item-> palette ( );
547 551
548 Config config ( file.name(), Config::File ); 552 Config config ( file.name(), Config::File );
549 config. setGroup( "Colors" ); 553 config. setGroup( "Colors" );
550 554
551 item-> save ( config ); 555 item-> save ( config );
552 556
553 config. write ( ); // need to flush the config info first 557 config. write ( ); // need to flush the config info first
554 loadColors ( m_color_list ); 558 loadColors ( m_color_list );
555 } 559 }
556 else 560 else
557 { 561 {
558 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); 562 QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." ));
559 } 563 }
560 } 564 }
561 delete d; 565 delete d;
562} 566}
563 567
564void Appearance::deleteSchemeClicked() 568void Appearance::deleteSchemeClicked()
565{ 569{
566 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); 570 ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
567 571
568 if ( !item ) 572 if ( !item )
569 return; 573 return;
570 574
571 if ( m_color_list-> currentItem ( ) > 0 ) 575 if ( m_color_list-> currentItem ( ) > 0 )
572 { 576 {
573 if ( QMessageBox::warning ( this, tr( "Delete scheme" ), tr( "Do you really want to delete\n" ) + item-> text ( ) + "?", 577 if ( QMessageBox::warning ( this, tr( "Delete scheme" ), tr( "Do you really want to delete\n" ) + item-> text ( ) + "?",
574 tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { 578 tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
575 QFile::remove ( QPEApplication::qpeDir ( ) + "/etc/colors/" + item-> text ( ) + ".scheme" ); 579 QFile::remove ( QPEApplication::qpeDir ( ) + "/etc/colors/" + item-> text ( ) + ".scheme" );
576 loadColors ( m_color_list ); 580 loadColors ( m_color_list );
577 } 581 }
578 } 582 }
579 else 583 else
580 { 584 {
581 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); 585 QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." ));
582 } 586 }
583} 587}
584 588
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h
index 4a86e57..ddf94f2 100644
--- a/noncore/settings/appearance2/appearance.h
+++ b/noncore/settings/appearance2/appearance.h
@@ -1,109 +1,113 @@
1/********************************************************************** 1/*
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2               =. This file is part of the OPIE Project
3** 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4** This file is part of the Qtopia Environment. 4           .>+-=
5** 5 _;:,     .>    :=|. This library is free software; you can
6** This file may be distributed and/or modified under the terms of the 6.> <`_,   >  .   <= redistribute it and/or modify it under
7** GNU General Public License version 2 as published by the Free Software 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8** Foundation and appearing in the file LICENSE.GPL included in the 8.="- .-=="i,     .._ License as published by the Free Software
9** packaging of this file. 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10** 10     ._= =}       : or (at your option) any later version.
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11    .%`+i>       _;_.
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12    .i_,=:_.      -<s. This library is distributed in the hope that
13** 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14    : ..    .:,     . . . without even the implied warranty of
15** 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16** Contact info@trolltech.com if any conditions of this licensing are 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17** not clear to you. 17..}^=.=       =       ; Library General Public License for more
18** 18++=   -.     .`     .: details.
19*********************************************************************** 19 :     =  ...= . :.=-
20** 20 -.   .:....=;==+<; You should have received a copy of the GNU
21** Enhancements by: Dan Williams, <williamsdr@acm.org> 21  -_. . .   )=.  = Library General Public License along with
22** 22    --        :-=` this library; see the file COPYING.LIB.
23**********************************************************************/ 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
24 28
25#ifndef APPEARANCESETTINGS_H 29#ifndef APPEARANCESETTINGS_H
26#define APPEARANCESETTINGS_H 30#define APPEARANCESETTINGS_H
27 31
28#include <qpe/fontdatabase.h> 32#include <qpe/fontdatabase.h>
29 33
30#include <qmainwindow.h> 34#include <qmainwindow.h>
31#include <qdialog.h> 35#include <qdialog.h>
32 36
33class QCheckBox; 37class QCheckBox;
34class QComboBox; 38class QComboBox;
35class QLabel; 39class QLabel;
36class QLineEdit; 40class QLineEdit;
37class QListBox; 41class QListBox;
38class QMultiLineEdit; 42class QMultiLineEdit;
39class QPushButton; 43class QPushButton;
40class QRadioButton; 44class QRadioButton;
41class QToolButton; 45class QToolButton;
42class SampleWindow; 46class SampleWindow;
43class OFontSelector; 47class OFontSelector;
44 48
45class Appearance : public QDialog 49class Appearance : public QDialog
46{ 50{
47 Q_OBJECT 51 Q_OBJECT
48 52
49public: 53public:
50 Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 54 Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
51 ~Appearance(); 55 ~Appearance();
52 56
53protected: 57protected:
54 virtual void accept ( ); 58 virtual void accept ( );
55 virtual void done ( int r ); 59 virtual void done ( int r );
56 60
57protected slots: 61protected slots:
58 void styleClicked ( int ); 62 void styleClicked ( int );
59 void styleSettingsClicked ( ); 63 void styleSettingsClicked ( );
60 void decoClicked ( int ); 64 void decoClicked ( int );
61 void fontClicked ( const QFont & ); 65 void fontClicked ( const QFont & );
62 void colorClicked ( int ); 66 void colorClicked ( int );
63 67
64 void editSchemeClicked(); 68 void editSchemeClicked();
65 void saveSchemeClicked(); 69 void saveSchemeClicked();
66 void deleteSchemeClicked(); 70 void deleteSchemeClicked();
67 71
68private: 72private:
69 void loadStyles ( QListBox * ); 73 void loadStyles ( QListBox * );
70 void loadDecos ( QListBox * ); 74 void loadDecos ( QListBox * );
71 void loadColors ( QListBox * ); 75 void loadColors ( QListBox * );
72 76
73 void changeText(); 77 void changeText();
74 78
75 QWidget *createStyleTab ( QWidget *parent ); 79 QWidget *createStyleTab ( QWidget *parent );
76 QWidget *createDecoTab ( QWidget *parent ); 80 QWidget *createDecoTab ( QWidget *parent );
77 QWidget *createFontTab ( QWidget *parent ); 81 QWidget *createFontTab ( QWidget *parent );
78 QWidget *createColorTab ( QWidget *parent ); 82 QWidget *createColorTab ( QWidget *parent );
79 QWidget *createGuiTab ( QWidget *parent ); 83 QWidget *createGuiTab ( QWidget *parent );
80 84
81private: 85private:
82 bool m_style_changed; 86 bool m_style_changed;
83 bool m_font_changed; 87 bool m_font_changed;
84 bool m_scheme_changed; 88 bool m_scheme_changed;
85 bool m_deco_changed; 89 bool m_deco_changed;
86 bool m_color_changed; 90 bool m_color_changed;
87 91
88 int m_original_style; 92 int m_original_style;
89 int m_original_deco; 93 int m_original_deco;
90 int m_original_tabstyle; 94 int m_original_tabstyle;
91 bool m_original_tabpos; 95 bool m_original_tabpos;
92 96
93 QListBox * m_style_list; 97 QListBox * m_style_list;
94 QPushButton * m_style_settings; 98 QPushButton * m_style_settings;
95 99
96 QListBox * m_deco_list; 100 QListBox * m_deco_list;
97 101
98 QListBox * m_color_list; 102 QListBox * m_color_list;
99 103
100 OFontSelector *m_fontselect; 104 OFontSelector *m_fontselect;
101 105
102 SampleWindow *m_sample; 106 SampleWindow *m_sample;
103 107
104 QComboBox * m_tabstyle_list; 108 QComboBox * m_tabstyle_list;
105 QRadioButton *m_tabstyle_top; 109 QRadioButton *m_tabstyle_top;
106 QRadioButton *m_tabstyle_bottom; 110 QRadioButton *m_tabstyle_bottom;
107}; 111};
108 112
109#endif 113#endif
diff --git a/noncore/settings/appearance2/colorlistitem.h b/noncore/settings/appearance2/colorlistitem.h
index 1ff6ecc..1df541b 100644
--- a/noncore/settings/appearance2/colorlistitem.h
+++ b/noncore/settings/appearance2/colorlistitem.h
@@ -1,113 +1,141 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
1#ifndef COLORLISTITEM_H 29#ifndef COLORLISTITEM_H
2#define COLORLISTITEM_H 30#define COLORLISTITEM_H
3 31
4#include <qlistbox.h> 32#include <qlistbox.h>
5#include <qpalette.h> 33#include <qpalette.h>
6#include <qapplication.h> 34#include <qapplication.h>
7 35
8#include <qpe/config.h> 36#include <qpe/config.h>
9 37
10class Appearance; 38class Appearance;
11 39
12class ColorListItem : public QListBoxText { 40class ColorListItem : public QListBoxText {
13public: 41public:
14 ColorListItem ( const QString &t, Config &cfg ) : QListBoxText ( t ) 42 ColorListItem ( const QString &t, Config &cfg ) : QListBoxText ( t )
15 { 43 {
16 m_colors = new QColor [s_colorcount]; 44 m_colors = new QColor [s_colorcount];
17 load ( cfg ); 45 load ( cfg );
18 } 46 }
19 47
20 virtual ~ColorListItem ( ) 48 virtual ~ColorListItem ( )
21 { 49 {
22 delete [] m_colors; 50 delete [] m_colors;
23 } 51 }
24 52
25 QPalette palette ( ) 53 QPalette palette ( )
26 { 54 {
27 return m_palette; 55 return m_palette;
28 } 56 }
29 57
30 bool load ( Config &cfg ) 58 bool load ( Config &cfg )
31 { 59 {
32 for ( int i = 0; i < s_colorcount; i++ ) 60 for ( int i = 0; i < s_colorcount; i++ )
33 m_colors [i] = QColor ( cfg. readEntry ( s_colorlut [i]. m_key, s_colorlut [i]. m_def )); 61 m_colors [i] = QColor ( cfg. readEntry ( s_colorlut [i]. m_key, s_colorlut [i]. m_def ));
34 62
35 buildPalette ( ); 63 buildPalette ( );
36 return true; 64 return true;
37 } 65 }
38 66
39 void buildPalette ( ) 67 void buildPalette ( )
40 { 68 {
41 m_palette = QPalette ( m_colors [r2i(QColorGroup::Button)], m_colors [r2i(QColorGroup::Background)] ); 69 m_palette = QPalette ( m_colors [r2i(QColorGroup::Button)], m_colors [r2i(QColorGroup::Background)] );
42 m_palette. setColor ( QColorGroup::Highlight, m_colors [r2i(QColorGroup::Highlight)] ); 70 m_palette. setColor ( QColorGroup::Highlight, m_colors [r2i(QColorGroup::Highlight)] );
43 m_palette. setColor ( QColorGroup::HighlightedText, m_colors [r2i(QColorGroup::HighlightedText)] ); 71 m_palette. setColor ( QColorGroup::HighlightedText, m_colors [r2i(QColorGroup::HighlightedText)] );
44 m_palette. setColor ( QColorGroup::Text, m_colors [r2i(QColorGroup::Text)] ); 72 m_palette. setColor ( QColorGroup::Text, m_colors [r2i(QColorGroup::Text)] );
45 m_palette. setColor ( QPalette::Active, QColorGroup::ButtonText, m_colors [r2i(QColorGroup::ButtonText)] ); 73 m_palette. setColor ( QPalette::Active, QColorGroup::ButtonText, m_colors [r2i(QColorGroup::ButtonText)] );
46 m_palette. setColor ( QColorGroup::Base, m_colors [r2i(QColorGroup::Base)] ); 74 m_palette. setColor ( QColorGroup::Base, m_colors [r2i(QColorGroup::Base)] );
47 m_palette. setColor ( QPalette::Disabled, QColorGroup::Text, m_palette. color ( QPalette::Active, QColorGroup::Background ). dark ( )); 75 m_palette. setColor ( QPalette::Disabled, QColorGroup::Text, m_palette. color ( QPalette::Active, QColorGroup::Background ). dark ( ));
48 } 76 }
49 77
50 bool save ( Config &cfg ) 78 bool save ( Config &cfg )
51 { 79 {
52 for ( int i = 0; i < s_colorcount; i++ ) 80 for ( int i = 0; i < s_colorcount; i++ )
53 cfg. writeEntry ( s_colorlut [i]. m_key, m_colors [i]. name ( )); 81 cfg. writeEntry ( s_colorlut [i]. m_key, m_colors [i]. name ( ));
54 return true; 82 return true;
55 } 83 }
56 84
57 QColor color ( QColorGroup::ColorRole role ) 85 QColor color ( QColorGroup::ColorRole role )
58 { 86 {
59 int i = r2i ( role ); 87 int i = r2i ( role );
60 return i >= 0 ? m_colors [i] : QColor ( ); 88 return i >= 0 ? m_colors [i] : QColor ( );
61 } 89 }
62 90
63 void setColor ( QColorGroup::ColorRole role, QColor c ) 91 void setColor ( QColorGroup::ColorRole role, QColor c )
64 { 92 {
65 int i = r2i ( role ); 93 int i = r2i ( role );
66 if ( i >= 0 ) { 94 if ( i >= 0 ) {
67 m_colors [i] = c; 95 m_colors [i] = c;
68 buildPalette ( ); 96 buildPalette ( );
69 } 97 }
70 } 98 }
71 99
72 QString label ( QColorGroup::ColorRole role ) 100 QString label ( QColorGroup::ColorRole role )
73 { 101 {
74 int i = r2i ( role ); 102 int i = r2i ( role );
75 return i >= 0 ? qApp-> translate ( "Appearance", s_colorlut [i]. m_label ) : QString::null; 103 return i >= 0 ? qApp-> translate ( "Appearance", s_colorlut [i]. m_label ) : QString::null;
76 } 104 }
77 105
78private: 106private:
79 QPalette m_palette; 107 QPalette m_palette;
80 QColor *m_colors; 108 QColor *m_colors;
81 109
82 static struct colorlut { 110 static struct colorlut {
83 QColorGroup::ColorRole m_role; 111 QColorGroup::ColorRole m_role;
84 const char * m_key; 112 const char * m_key;
85 const char * m_def; 113 const char * m_def;
86 const char * m_label; 114 const char * m_label;
87 } const s_colorlut []; 115 } const s_colorlut [];
88 static const int s_colorcount; 116 static const int s_colorcount;
89 117
90 static int r2i ( QColorGroup::ColorRole role ) 118 static int r2i ( QColorGroup::ColorRole role )
91 { 119 {
92 for ( int i = 0; i < s_colorcount; i++ ) { 120 for ( int i = 0; i < s_colorcount; i++ ) {
93 if ( s_colorlut [i]. m_role == role ) 121 if ( s_colorlut [i]. m_role == role )
94 return i; 122 return i;
95 } 123 }
96 return -1; 124 return -1;
97 } 125 }
98}; 126};
99 127
100const ColorListItem::colorlut ColorListItem::s_colorlut [] = { 128const ColorListItem::colorlut ColorListItem::s_colorlut [] = {
101 { QColorGroup::Base, "Base", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Base" ) }, 129 { QColorGroup::Base, "Base", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Base" ) },
102 { QColorGroup::Background, "Background", "#E5E1D5", QT_TRANSLATE_NOOP( "Appearance", "Background" ) }, 130 { QColorGroup::Background, "Background", "#E5E1D5", QT_TRANSLATE_NOOP( "Appearance", "Background" ) },
103 { QColorGroup::Button, "Button", "#D6CDBB", QT_TRANSLATE_NOOP( "Appearance", "Button" ) }, 131 { QColorGroup::Button, "Button", "#D6CDBB", QT_TRANSLATE_NOOP( "Appearance", "Button" ) },
104 { QColorGroup::ButtonText, "ButtonText", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Button Text" ) }, 132 { QColorGroup::ButtonText, "ButtonText", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Button Text" ) },
105 { QColorGroup::Highlight, "Highlight", "#800000", QT_TRANSLATE_NOOP( "Appearance", "Highlight" ) }, 133 { QColorGroup::Highlight, "Highlight", "#800000", QT_TRANSLATE_NOOP( "Appearance", "Highlight" ) },
106 { QColorGroup::HighlightedText, "HighlightedText", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Highlighted Text" ) }, 134 { QColorGroup::HighlightedText, "HighlightedText", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Highlighted Text" ) },
107 { QColorGroup::Text, "Text", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Text" ) } 135 { QColorGroup::Text, "Text", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Text" ) }
108}; 136};
109 137
110const int ColorListItem::s_colorcount = sizeof( s_colorlut ) / sizeof ( s_colorlut [0] ); 138const int ColorListItem::s_colorcount = sizeof( s_colorlut ) / sizeof ( s_colorlut [0] );
111 139
112 140
113#endif 141#endif
diff --git a/noncore/settings/appearance2/decolistitem.h b/noncore/settings/appearance2/decolistitem.h
index dfdce47..953a939 100644
--- a/noncore/settings/appearance2/decolistitem.h
+++ b/noncore/settings/appearance2/decolistitem.h
@@ -1,79 +1,106 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
1#ifndef DECOLISTITEM_H 28#ifndef DECOLISTITEM_H
2#define DECOLISTITEM_H 29#define DECOLISTITEM_H
3 30
4#include <qpe/windowdecorationinterface.h> 31#include <qpe/windowdecorationinterface.h>
5#include <qlistbox.h> 32#include <qlistbox.h>
6 33
7class DecoListItem : public QListBoxText { 34class DecoListItem : public QListBoxText {
8public: 35public:
9 DecoListItem ( const QString &t ) : QListBoxText ( t ) 36 DecoListItem ( const QString &t ) : QListBoxText ( t )
10 { 37 {
11 m_lib = 0; 38 m_lib = 0;
12 m_window_if = 0; 39 m_window_if = 0;
13 // m_settings_if = 0; 40 // m_settings_if = 0;
14 } 41 }
15 42
16 DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxText ( iface-> name ( )) 43 DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxText ( iface-> name ( ))
17 { 44 {
18 m_lib = lib; 45 m_lib = lib;
19 m_window_if = iface; 46 m_window_if = iface;
20 47
21 // iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if ); 48 // iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if );
22 } 49 }
23 50
24 virtual ~DecoListItem ( ) 51 virtual ~DecoListItem ( )
25 { 52 {
26 // if ( m_settings_if ) 53 // if ( m_settings_if )
27 // m_settings_if-> release ( ); 54 // m_settings_if-> release ( );
28 if ( m_window_if ) 55 if ( m_window_if )
29 m_window_if-> release ( ); 56 m_window_if-> release ( );
30 delete m_lib; 57 delete m_lib;
31 } 58 }
32 59
33 bool hasSettings ( ) const 60 bool hasSettings ( ) const
34 { 61 {
35 // return ( m_settings_if ); 62 // return ( m_settings_if );
36 return false; 63 return false;
37 } 64 }
38 65
39 QWidget *settings ( QWidget * /*parent*/ ) 66 QWidget *settings ( QWidget * /*parent*/ )
40 { 67 {
41 // return m_settings_if ? m_settings_if-> create ( parent ) : 0; 68 // return m_settings_if ? m_settings_if-> create ( parent ) : 0;
42 return 0; 69 return 0;
43 } 70 }
44 71
45 bool setSettings ( bool /*accepted*/ ) 72 bool setSettings ( bool /*accepted*/ )
46 { 73 {
47 // if ( !m_settings_if ) 74 // if ( !m_settings_if )
48 // return false; 75 // return false;
49 76
50 // if ( accepted ) 77 // if ( accepted )
51 // return m_settings_if-> accept ( ); 78 // return m_settings_if-> accept ( );
52 // else { 79 // else {
53 // m_settings_if-> reject ( ); 80 // m_settings_if-> reject ( );
54 // return false; 81 // return false;
55 // } 82 // }
56 return false; 83 return false;
57 } 84 }
58 85
59 QString key ( ) 86 QString key ( )
60 { 87 {
61 if ( m_window_if ) 88 if ( m_window_if )
62 return QString ( m_window_if-> name ( )); 89 return QString ( m_window_if-> name ( ));
63 else 90 else
64 return text ( ); 91 return text ( );
65 } 92 }
66 93
67 WindowDecorationInterface *interface ( ) 94 WindowDecorationInterface *interface ( )
68 { 95 {
69 return m_window_if; 96 return m_window_if;
70 } 97 }
71 98
72private: 99private:
73 QLibrary *m_lib; 100 QLibrary *m_lib;
74 WindowDecorationInterface *m_window_if; 101 WindowDecorationInterface *m_window_if;
75 //WindowDecorationSettingsInterface *m_settings_if; 102 //WindowDecorationSettingsInterface *m_settings_if;
76 103
77}; 104};
78 105
79#endif \ No newline at end of file 106#endif \ No newline at end of file
diff --git a/noncore/settings/appearance2/editScheme.cpp b/noncore/settings/appearance2/editScheme.cpp
index 4f2ac2c..8cb0f1c 100644
--- a/noncore/settings/appearance2/editScheme.cpp
+++ b/noncore/settings/appearance2/editScheme.cpp
@@ -1,87 +1,73 @@
1/********************************************************************** 1/*
2** EditScheme 2               =. This file is part of the OPIE Project
3** 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4** Dialog for editing color scheme 4           .>+-=
5** 5 _;:,     .>    :=|. This library is free software; you can
6** Copyright (C) 2002, Dan Williams 6.> <`_,   >  .   <= redistribute it and/or modify it under
7** williamsdr@acm.org 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8** http://draknor.net 8.="- .-=="i,     .._ License as published by the Free Software
9** 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10** This file may be distributed and/or modified under the terms of the 10     ._= =}       : or (at your option) any later version.
11** GNU General Public License version 2 as published by the Free Software 11    .%`+i>       _;_.
12** Foundation and appearing in the file LICENSE.GPL included in the 12    .i_,=:_.      -<s. This library is distributed in the hope that
13** packaging of this file. 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14** 14    : ..    .:,     . . . without even the implied warranty of
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17** 17..}^=.=       =       ; Library General Public License for more
18**********************************************************************/ 18++=   -.     .`     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
19 28
20#include "editScheme.h" 29#include "editScheme.h"
21 30
22#include "opie/colorpopupmenu.h" 31#include <opie/ocolorbutton.h>
23 32
24#include <qaction.h> 33#include <qaction.h>
25#include <qlabel.h> 34#include <qlabel.h>
26#include <qlayout.h> 35#include <qlayout.h>
27#include <qpopupmenu.h> 36#include <qpopupmenu.h>
28#include <qscrollview.h> 37#include <qscrollview.h>
29#include <qtoolbutton.h> 38#include <qtoolbutton.h>
30 39
31EditScheme::EditScheme( QWidget* parent, const char* name, bool modal, WFlags fl, 40EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags fl )
32 int max, QString *list, QString *colors ) 41 : QDialog ( parent, name, modal, fl )
33 : QDialog( parent, name, modal, fl )
34{ 42{
35 setCaption( tr( "Edit scheme" ) ); 43 setCaption ( tr( "Edit scheme" ) );
36 QGridLayout* layout = new QGridLayout( this ); 44 QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 );
37 layout->setSpacing( 4 );
38 layout->setMargin( 4 );
39
40 45
41 maxCount = max; 46 m_count = cnt;
42 colorList = colors; 47 m_buttons = new OColorButton * [cnt];
43 surfaceList = list; 48 m_colors = colors;
44 colorButtons = new QToolButton * [max]; 49
45 int i; 50 for ( int i = 0; i < cnt; i++ )
46 QLabel* label;
47 ColorPopupMenu* colorPopupMenu;
48 for ( i = 0; i < max; i++ )
49 { 51 {
50// colorList[i] = colors[i]; 52 QLabel *l = new QLabel ( labels [i], this );
51// surfaceList[i] = list[i]; 53 layout-> addWidget ( l, i, 0 );
52 label = new QLabel( tr( surfaceList[i] ), this ); 54
53 layout->addWidget( label, i, 0 ); 55 m_buttons [i] = new OColorButton ( this );
54 colorButtons[i] = new QToolButton( this, list[i] ); 56 m_buttons [i]-> setColor ( colors [i] );
55 colorButtons[i]->setPalette( QPalette( QColor( colors[i] ) ) ); 57 layout-> addWidget ( m_buttons [i], i, 1 );
56 layout->addWidget( colorButtons[i], i, 1 );
57
58 colorPopupMenu = new ColorPopupMenu( colors[i], 0, list[i] );
59 colorButtons[i]->setPopup( colorPopupMenu );
60 colorButtons[i]->setPopupDelay( 0 );
61 connect( colorPopupMenu, SIGNAL( colorSelected( const QColor& ) ), this, SLOT( changeColor( const QColor& ) ) );
62 } 58 }
63} 59}
64 60
65EditScheme::~EditScheme() 61EditScheme::~EditScheme ( )
66{ 62{
67 delete [] colorButtons; 63 delete [] m_buttons;
68} 64}
69 65
70void EditScheme::changeColor( const QColor& color ) 66void EditScheme::accept ( )
71{ 67{
72 QString name( sender()->name() ); 68 for ( int i = 0; i < m_count; i++ )
73 int i; 69 m_colors [i] = m_buttons [i]-> color ( );
74 70
75 for ( i = 0; i < maxCount; i++ ) 71 QDialog::accept ( );
76 {
77 if ( name == colorButtons[i]->name() )
78 {
79 break;
80 }
81 }
82 if ( i < maxCount && name == colorButtons[i]->name() )
83 {
84 colorList[i] = color.name();
85 colorButtons[i]->setPalette( QPalette( QColor( colorList[i] ) ) );
86 }
87} 72}
73
diff --git a/noncore/settings/appearance2/editScheme.h b/noncore/settings/appearance2/editScheme.h
index 583050f..0a025bd 100644
--- a/noncore/settings/appearance2/editScheme.h
+++ b/noncore/settings/appearance2/editScheme.h
@@ -1,48 +1,53 @@
1/********************************************************************** 1/*
2** EditScheme 2               =. This file is part of the OPIE Project
3** 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4** Dialog for editing color scheme 4           .>+-=
5** 5 _;:,     .>    :=|. This library is free software; you can
6** Copyright (C) 2002, Dan Williams 6.> <`_,   >  .   <= redistribute it and/or modify it under
7** williamsdr@acm.org 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8** http://draknor.net 8.="- .-=="i,     .._ License as published by the Free Software
9** 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10** This file may be distributed and/or modified under the terms of the 10     ._= =}       : or (at your option) any later version.
11** GNU General Public License version 2 as published by the Free Software 11    .%`+i>       _;_.
12** Foundation and appearing in the file LICENSE.GPL included in the 12    .i_,=:_.      -<s. This library is distributed in the hope that
13** packaging of this file. 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14** 14    : ..    .:,     . . . without even the implied warranty of
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17** 17..}^=.=       =       ; Library General Public License for more
18**********************************************************************/ 18++=   -.     .`     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
19 28
20#ifndef EDITSCHEME_H 29#ifndef EDITSCHEME_H
21#define EDITSCHEME_H 30#define EDITSCHEME_H
22 31
23#include <qdialog.h> 32#include <qdialog.h>
24#include <qtoolbutton.h>
25 33
26class QColor; 34class QColor;
35class OColorButton;
27 36
28class EditScheme : public QDialog 37class EditScheme : public QDialog {
29{ 38 Q_OBJECT
30 Q_OBJECT
31 39
32public: 40public:
33 EditScheme( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, 41 EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
34 int = 0, QString * = 0, QString * = 0 ); 42 virtual ~EditScheme ( );
35 ~EditScheme();
36
37 int maxCount;
38 QString * surfaceList;
39 QString * colorList;
40
41
42 QToolButton** colorButtons;
43 43
44protected slots: 44protected slots:
45 void changeColor( const QColor& ); 45 virtual void accept ( );
46
47private:
48 int m_count;
49 QColor *m_colors;
50 OColorButton **m_buttons;
46}; 51};
47 52
48#endif // EDITSCHEME_H 53#endif
diff --git a/noncore/settings/appearance2/main.cpp b/noncore/settings/appearance2/main.cpp
index cfbab0b..3afec46 100644
--- a/noncore/settings/appearance2/main.cpp
+++ b/noncore/settings/appearance2/main.cpp
@@ -1,35 +1,43 @@
1/********************************************************************** 1/*
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2               =. This file is part of the OPIE Project
3** 3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4** This file is part of Qtopia Environment. 4           .>+-=
5** 5 _;:,     .>    :=|. This library is free software; you can
6** This file may be distributed and/or modified under the terms of the 6.> <`_,   >  .   <= redistribute it and/or modify it under
7** GNU General Public License version 2 as published by the Free Software 7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8** Foundation and appearing in the file LICENSE.GPL included in the 8.="- .-=="i,     .._ License as published by the Free Software
9** packaging of this file. 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10** 10     ._= =}       : or (at your option) any later version.
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11    .%`+i>       _;_.
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12    .i_,=:_.      -<s. This library is distributed in the hope that
13** 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14    : ..    .:,     . . . without even the implied warranty of
15** 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16** Contact info@trolltech.com if any conditions of this licensing are 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17** not clear to you. 17..}^=.=       =       ; Library General Public License for more
18** 18++=   -.     .`     .: details.
19**********************************************************************/ 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
20 28
21#include "appearance.h" 29#include "appearance.h"
22 30
23#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
24 32
25 33
26int main ( int argc, char **argv ) 34int main ( int argc, char **argv )
27{ 35{
28 QPEApplication app ( argc, argv ); 36 QPEApplication app ( argc, argv );
29 37
30 Appearance m; 38 Appearance m;
31 app. showMainDocumentWidget ( &m ); 39 app. showMainDocumentWidget ( &m );
32 40
33 return app. exec ( ); 41 return app. exec ( );
34} 42}
35 43
diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp
index e447002..0d8b003 100644
--- a/noncore/settings/appearance2/sample.cpp
+++ b/noncore/settings/appearance2/sample.cpp
@@ -1,192 +1,221 @@
1/*
2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-=
6 _;:,     .>    :=|. This library is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This library is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details.
20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27
28*/
29
1#include <qvbox.h> 30#include <qvbox.h>
2#include <qpopupmenu.h> 31#include <qpopupmenu.h>
3#include <qpainter.h> 32#include <qpainter.h>
4#include <qmenubar.h> 33#include <qmenubar.h>
5#include <qcheckbox.h> 34#include <qcheckbox.h>
6#include <qpushbutton.h> 35#include <qpushbutton.h>
7#include <qscrollbar.h> 36#include <qscrollbar.h>
8#include <qlayout.h> 37#include <qlayout.h>
9#include <qwhatsthis.h> 38#include <qwhatsthis.h>
10#include <qpixmapcache.h> 39#include <qpixmapcache.h>
11#include <qtimer.h> 40#include <qtimer.h>
12#include <qobjectlist.h> 41#include <qobjectlist.h>
13#include <qcommonstyle.h> 42#include <qcommonstyle.h>
14 43
15#include "sample.h" 44#include "sample.h"
16 45
17 46
18class SampleText : public QWidget 47class SampleText : public QWidget
19{ 48{
20public: 49public:
21 SampleText( const QString &t, bool h, QWidget *parent ) 50 SampleText( const QString &t, bool h, QWidget *parent )
22 : QWidget( parent ), hl(h), text(t) 51 : QWidget( parent ), hl(h), text(t)
23 { 52 {
24 if ( hl ) 53 if ( hl )
25 setBackgroundMode( PaletteHighlight ); 54 setBackgroundMode( PaletteHighlight );
26 else 55 else
27 setBackgroundMode( PaletteBase ); 56 setBackgroundMode( PaletteBase );
28 } 57 }
29 58
30 QSize sizeHint() const 59 QSize sizeHint() const
31 { 60 {
32 QFontMetrics fm(font()); 61 QFontMetrics fm(font());
33 return QSize( fm.width(text)+10, fm.height()+4 ); 62 return QSize( fm.width(text)+10, fm.height()+4 );
34 } 63 }
35 64
36 void paintEvent( QPaintEvent * ) 65 void paintEvent( QPaintEvent * )
37 { 66 {
38 QPainter p(this); 67 QPainter p(this);
39 if ( hl ) 68 if ( hl )
40 p.setPen( colorGroup().highlightedText() ); 69 p.setPen( colorGroup().highlightedText() );
41 else 70 else
42 p.setPen( colorGroup().text() ); 71 p.setPen( colorGroup().text() );
43 p.drawText( rect(), AlignCenter, text ); 72 p.drawText( rect(), AlignCenter, text );
44 } 73 }
45 74
46private: 75private:
47 bool hl; 76 bool hl;
48 QString text; 77 QString text;
49}; 78};
50 79
51 80
52SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0) 81SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0)
53{ 82{
54 init(); 83 init();
55} 84}
56 85
57QSize SampleWindow::sizeHint() const 86QSize SampleWindow::sizeHint() const
58{ 87{
59 return container->sizeHint() + QSize( 10, 35 ); 88 return container->sizeHint() + QSize( 10, 35 );
60} 89}
61 90
62void SampleWindow::setFont( const QFont &f ) 91void SampleWindow::setFont( const QFont &f )
63{ 92{
64 QWidget::setFont( f ); 93 QWidget::setFont( f );
65 popup->setFont( f ); 94 popup->setFont( f );
66 QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); 95 QTimer::singleShot ( 0, this, SLOT( fixGeometry ( )));
67} 96}
68 97
69static void setStyleRecursive ( QWidget *w, QStyle *s ) 98static void setStyleRecursive ( QWidget *w, QStyle *s )
70{ 99{
71 w->setStyle( s ); 100 w->setStyle( s );
72 QObjectList *childObjects=(QObjectList*)w->children(); 101 QObjectList *childObjects=(QObjectList*)w->children();
73 if ( childObjects ) { 102 if ( childObjects ) {
74 QObject * o; 103 QObject * o;
75 for(o=childObjects->first();o!=0;o=childObjects->next()) { 104 for(o=childObjects->first();o!=0;o=childObjects->next()) {
76 if( o->isWidgetType() ) { 105 if( o->isWidgetType() ) {
77 setStyleRecursive((QWidget *)o,s); 106 setStyleRecursive((QWidget *)o,s);
78 } 107 }
79 } 108 }
80 } 109 }
81} 110}
82 111
83 112
84void SampleWindow::setStyle2 ( QStyle *sty ) 113void SampleWindow::setStyle2 ( QStyle *sty )
85{ 114{
86 typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); 115 typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool);
87 116
88 extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); 117 extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl);
89 118
90 QPixmapCache::clear ( ); 119 QPixmapCache::clear ( );
91 QPalette p = palette ( ); 120 QPalette p = palette ( );
92 sty-> polish ( p ); 121 sty-> polish ( p );
93 qt_set_draw_menu_bar_impl ( 0 ); 122 qt_set_draw_menu_bar_impl ( 0 );
94 setStyleRecursive ( this, sty ); 123 setStyleRecursive ( this, sty );
95 setPalette ( p ); 124 setPalette ( p );
96 QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); 125 QTimer::singleShot ( 0, this, SLOT( fixGeometry ( )));
97} 126}
98 127
99 128
100void SampleWindow::setDecoration( WindowDecorationInterface *i ) 129void SampleWindow::setDecoration( WindowDecorationInterface *i )
101{ 130{
102 iface = i; 131 iface = i;
103 wd.rect = QRect( 0, 0, 150, 75 ); 132 wd.rect = QRect( 0, 0, 150, 75 );
104 wd.caption = tr("Sample"); 133 wd.caption = tr("Sample");
105 wd.palette = palette(); 134 wd.palette = palette();
106 wd.flags = WindowDecorationInterface::WindowData::Dialog | 135 wd.flags = WindowDecorationInterface::WindowData::Dialog |
107 WindowDecorationInterface::WindowData::Active; 136 WindowDecorationInterface::WindowData::Active;
108 wd.reserved = 1; 137 wd.reserved = 1;
109 138
110 th = iface->metric(WindowDecorationInterface::TitleHeight, &wd); 139 th = iface->metric(WindowDecorationInterface::TitleHeight, &wd);
111 tb = iface->metric(WindowDecorationInterface::TopBorder, &wd); 140 tb = iface->metric(WindowDecorationInterface::TopBorder, &wd);
112 lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd); 141 lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd);
113 rb = iface->metric(WindowDecorationInterface::RightBorder, &wd); 142 rb = iface->metric(WindowDecorationInterface::RightBorder, &wd);
114 bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd); 143 bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd);
115 144
116 int yoff = th + tb; 145 int yoff = th + tb;
117 int xoff = lb; 146 int xoff = lb;
118 147
119 wd.rect.setX( 0 ); 148 wd.rect.setX( 0 );
120 wd.rect.setWidth( width() - lb - rb ); 149 wd.rect.setWidth( width() - lb - rb );
121 wd.rect.setY( 0 ); 150 wd.rect.setY( 0 );
122 wd.rect.setHeight( height() - yoff - bb ); 151 wd.rect.setHeight( height() - yoff - bb );
123 152
124 container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() ); 153 container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() );
125 setMinimumSize( container->sizeHint().width()+lb+rb, 154 setMinimumSize( container->sizeHint().width()+lb+rb,
126 container->sizeHint().height()+tb+th+bb ); 155 container->sizeHint().height()+tb+th+bb );
127} 156}
128 157
129void SampleWindow::paintEvent( QPaintEvent * ) 158void SampleWindow::paintEvent( QPaintEvent * )
130{ 159{
131 if ( !iface ) 160 if ( !iface )
132 return; 161 return;
133 162
134 QPainter p( this ); 163 QPainter p( this );
135 164
136 p.translate( lb, th+tb ); 165 p.translate( lb, th+tb );
137 166
138 iface->drawArea(WindowDecorationInterface::Border, &p, &wd); 167 iface->drawArea(WindowDecorationInterface::Border, &p, &wd);
139 iface->drawArea(WindowDecorationInterface::Title, &p, &wd); 168 iface->drawArea(WindowDecorationInterface::Title, &p, &wd);
140 169
141 p.setPen(palette().active().color(QColorGroup::HighlightedText)); 170 p.setPen(palette().active().color(QColorGroup::HighlightedText));
142 QFont f( font() ); 171 QFont f( font() );
143 f.setWeight( QFont::Bold ); 172 f.setWeight( QFont::Bold );
144 p.setFont(f); 173 p.setFont(f);
145 iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd); 174 iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd);
146 175
147 QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th ); 176 QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th );
148 iface->drawButton( WindowDecorationInterface::Help, &p, &wd, 177 iface->drawButton( WindowDecorationInterface::Help, &p, &wd,
149 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); 178 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
150 brect.moveBy( wd.rect.width() - 179 brect.moveBy( wd.rect.width() -
151 iface->metric(WindowDecorationInterface::OKWidth,&wd) - 180 iface->metric(WindowDecorationInterface::OKWidth,&wd) -
152 iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); 181 iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 );
153 iface->drawButton( WindowDecorationInterface::Close, &p, &wd, 182 iface->drawButton( WindowDecorationInterface::Close, &p, &wd,
154 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); 183 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
155 brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); 184 brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 );
156 iface->drawButton( WindowDecorationInterface::OK, &p, &wd, 185 iface->drawButton( WindowDecorationInterface::OK, &p, &wd,
157 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); 186 brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 );
158} 187}
159 188
160void SampleWindow::init() 189void SampleWindow::init()
161{ 190{
162 container = new QVBox( this ); 191 container = new QVBox( this );
163 popup = new QPopupMenu( this ); 192 popup = new QPopupMenu( this );
164 popup->insertItem( tr("Normal Item"), 1 ); 193 popup->insertItem( tr("Normal Item"), 1 );
165 popup->insertItem( tr("Disabled Item"), 2 ); 194 popup->insertItem( tr("Disabled Item"), 2 );
166 popup->setItemEnabled(2, FALSE); 195 popup->setItemEnabled(2, FALSE);
167 QMenuBar *mb = new QMenuBar( container ); 196 QMenuBar *mb = new QMenuBar( container );
168 mb->insertItem( tr("Menu"), popup ); 197 mb->insertItem( tr("Menu"), popup );
169 QHBox *hb = new QHBox( container ); 198 QHBox *hb = new QHBox( container );
170 QWidget *w = new QWidget( hb ); 199 QWidget *w = new QWidget( hb );
171 (void)new QScrollBar( 0, 0, 0, 0, 0, Vertical, hb ); 200 (void)new QScrollBar( 0, 0, 0, 0, 0, Vertical, hb );
172 201
173 QGridLayout *gl = new QGridLayout( w, 2, 2, 4 ); 202 QGridLayout *gl = new QGridLayout( w, 2, 2, 4 );
174 SampleText *l = new SampleText( tr("Normal Text"), FALSE, w ); 203 SampleText *l = new SampleText( tr("Normal Text"), FALSE, w );
175 gl->addWidget( l, 0, 0 ); 204 gl->addWidget( l, 0, 0 );
176 205
177 l = new SampleText( tr("Highlighted Text"), TRUE, w ); 206 l = new SampleText( tr("Highlighted Text"), TRUE, w );
178 gl->addWidget( l, 1, 0 ); 207 gl->addWidget( l, 1, 0 );
179 208
180 QPushButton *pb = new QPushButton( tr("Button"), w ); 209 QPushButton *pb = new QPushButton( tr("Button"), w );
181 gl->addWidget( pb, 0, 1 ); 210 gl->addWidget( pb, 0, 1 );
182 pb->setFocusPolicy( NoFocus ); 211 pb->setFocusPolicy( NoFocus );
183 212
184 QCheckBox *cb = new QCheckBox( tr("Check Box"), w ); 213 QCheckBox *cb = new QCheckBox( tr("Check Box"), w );
185 gl->addWidget( cb, 1, 1 ); 214 gl->addWidget( cb, 1, 1 );
186 cb->setFocusPolicy( NoFocus ); 215 cb->setFocusPolicy( NoFocus );
187 cb->setChecked( TRUE ); 216 cb->setChecked( TRUE );
188 217
189 QWhatsThis::add( this, tr("Sample window using the selected settings.") ); 218 QWhatsThis::add( this, tr("Sample window using the selected settings.") );
190} 219}
191 220
192bool SampleWindow::eventFilter( QObject *, QEvent *e ) 221bool SampleWindow::eventFilter( QObject *, QEvent *e )
diff --git a/noncore/settings/appearance2/sample.h b/noncore/settings/appearance2/sample.h
index c6f9b5a..a189f69 100644
--- a/noncore/settings/appearance2/sample.h
+++ b/noncore/settings/appearance2/sample.h
@@ -1,49 +1,78 @@
1/*
2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-=
6 _;:,     .>    :=|. This library is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This library is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details.
20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27
28*/
29
1#ifndef __PREVIEW_H__ 30#ifndef __PREVIEW_H__
2#define __PREVIEW_H__ 31#define __PREVIEW_H__
3 32
4#include <qwidget.h> 33#include <qwidget.h>
5 34
6#include <qpe/windowdecorationinterface.h> 35#include <qpe/windowdecorationinterface.h>
7 36
8class QVBox; 37class QVBox;
9class QPopupMenu; 38class QPopupMenu;
10class SampleText; 39class SampleText;
11 40
12class SampleWindow : public QWidget 41class SampleWindow : public QWidget
13{ 42{
14 Q_OBJECT 43 Q_OBJECT
15public: 44public:
16 SampleWindow( QWidget *parent ); 45 SampleWindow( QWidget *parent );
17 46
18 QSize sizeHint() const; 47 QSize sizeHint() const;
19 48
20 virtual void setFont( const QFont &f ); 49 virtual void setFont( const QFont &f );
21 50
22 void setStyle2 ( QStyle *sty ); 51 void setStyle2 ( QStyle *sty );
23 void setDecoration( WindowDecorationInterface *i ); 52 void setDecoration( WindowDecorationInterface *i );
24 void setPalette ( const QPalette & ); 53 void setPalette ( const QPalette & );
25 54
26 virtual void paintEvent( QPaintEvent * ); 55 virtual void paintEvent( QPaintEvent * );
27 56
28 void init(); 57 void init();
29 58
30 virtual bool eventFilter( QObject *, QEvent *e ); 59 virtual bool eventFilter( QObject *, QEvent *e );
31 virtual void paletteChange( const QPalette &old ); 60 virtual void paletteChange( const QPalette &old );
32 virtual void resizeEvent( QResizeEvent *re ); 61 virtual void resizeEvent( QResizeEvent *re );
33 62
34public slots: 63public slots:
35 void fixGeometry(); 64 void fixGeometry();
36 65
37protected: 66protected:
38 WindowDecorationInterface *iface; 67 WindowDecorationInterface *iface;
39 WindowDecorationInterface::WindowData wd; 68 WindowDecorationInterface::WindowData wd;
40 QVBox *container; 69 QVBox *container;
41 QPopupMenu *popup; 70 QPopupMenu *popup;
42 int th; 71 int th;
43 int tb; 72 int tb;
44 int lb; 73 int lb;
45 int rb; 74 int rb;
46 int bb; 75 int bb;
47}; 76};
48 77
49#endif 78#endif
diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h
index 3cc63dc..bbfbd41 100644
--- a/noncore/settings/appearance2/stylelistitem.h
+++ b/noncore/settings/appearance2/stylelistitem.h
@@ -1,85 +1,113 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
1#ifndef STYLELISTITEM_H 29#ifndef STYLELISTITEM_H
2#define STYLELISTITEM_H 30#define STYLELISTITEM_H
3 31
4#include <qlistbox.h> 32#include <qlistbox.h>
5#include <qpe/styleinterface.h> 33#include <qpe/styleinterface.h>
6 34
7#include <stdio.h> 35#include <stdio.h>
8 36
9class StyleListItem : public QListBoxText { 37class StyleListItem : public QListBoxText {
10public: 38public:
11 StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t ) 39 StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t )
12 { 40 {
13 m_lib = 0; 41 m_lib = 0;
14 m_style_if = 0; 42 m_style_if = 0;
15 m_settings_if = 0; 43 m_settings_if = 0;
16 m_style = sty; 44 m_style = sty;
17 } 45 }
18 46
19 StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( )) 47 StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( ))
20 { 48 {
21 m_lib = lib; 49 m_lib = lib;
22 m_style_if = iface; 50 m_style_if = iface;
23 m_settings_if = 0; 51 m_settings_if = 0;
24 m_style = iface-> create ( ); 52 m_style = iface-> create ( );
25 53
26 iface-> queryInterface ( IID_StyleSettings, (QUnknownInterface **) &m_settings_if ); 54 iface-> queryInterface ( IID_StyleSettings, (QUnknownInterface **) &m_settings_if );
27 } 55 }
28 56
29 virtual ~StyleListItem ( ) 57 virtual ~StyleListItem ( )
30 { 58 {
31 delete m_style; 59 delete m_style;
32 60
33 if ( m_settings_if ) 61 if ( m_settings_if )
34 m_settings_if-> release ( ); 62 m_settings_if-> release ( );
35 if ( m_style_if ) 63 if ( m_style_if )
36 m_style_if-> release ( ); 64 m_style_if-> release ( );
37 delete m_lib; 65 delete m_lib;
38 } 66 }
39 67
40 bool hasSettings ( ) const 68 bool hasSettings ( ) const
41 { 69 {
42 return ( m_settings_if ); 70 return ( m_settings_if );
43 } 71 }
44 72
45 QWidget *settings ( QWidget *parent ) 73 QWidget *settings ( QWidget *parent )
46 { 74 {
47 return m_settings_if ? m_settings_if-> create ( parent ) : 0; 75 return m_settings_if ? m_settings_if-> create ( parent ) : 0;
48 } 76 }
49 77
50 bool setSettings ( bool accepted ) 78 bool setSettings ( bool accepted )
51 { 79 {
52 if ( !m_settings_if ) 80 if ( !m_settings_if )
53 return false; 81 return false;
54 82
55 if ( accepted ) 83 if ( accepted )
56 return m_settings_if-> accept ( ); 84 return m_settings_if-> accept ( );
57 else { 85 else {
58 m_settings_if-> reject ( ); 86 m_settings_if-> reject ( );
59 return false; 87 return false;
60 } 88 }
61 } 89 }
62 90
63 QString key ( ) 91 QString key ( )
64 { 92 {
65 if ( m_style_if ) 93 if ( m_style_if )
66 return QString ( m_style_if-> key ( )); 94 return QString ( m_style_if-> key ( ));
67 else 95 else
68 return text ( ); 96 return text ( );
69 } 97 }
70 98
71 QStyle *style ( ) 99 QStyle *style ( )
72 { 100 {
73 return m_style; 101 return m_style;
74 } 102 }
75 103
76private: 104private:
77 QLibrary *m_lib; 105 QLibrary *m_lib;
78 QStyle *m_style; 106 QStyle *m_style;
79 StyleInterface *m_style_if; 107 StyleInterface *m_style_if;
80 StyleSettingsInterface *m_settings_if; 108 StyleSettingsInterface *m_settings_if;
81 109
82}; 110};
83 111
84 112
85#endif 113#endif