Diffstat (limited to 'noncore/settings/appearance2') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 968 | ||||
-rw-r--r-- | noncore/settings/appearance2/stylelistitem.h | 12 |
2 files changed, 510 insertions, 470 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 9e5eede..ba12e55 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -29,2 +29,26 @@ | |||
29 | 29 | ||
30 | #include "appearance.h" | ||
31 | #include "editScheme.h" | ||
32 | #include "stylelistitem.h" | ||
33 | #include "decolistitem.h" | ||
34 | #include "colorlistitem.h" | ||
35 | #include "exceptlistitem.h" | ||
36 | #include "sample.h" | ||
37 | |||
38 | /* OPIE */ | ||
39 | #include <opie/ofontselector.h> | ||
40 | #include <opie/odevice.h> | ||
41 | #include <opie/ofiledialog.h> | ||
42 | #include <opie/otabwidget.h> | ||
43 | |||
44 | #include <qpe/config.h> | ||
45 | #include <qpe/global.h> | ||
46 | #include <qpe/qpeapplication.h> | ||
47 | #include <qpe/qpemessagebox.h> | ||
48 | #include <qpe/qcopenvelope_qws.h> | ||
49 | #include <qpe/qpestyle.h> | ||
50 | #include <qpe/lightstyle.h> | ||
51 | #include <qpe/styleinterface.h> | ||
52 | |||
53 | /* QT */ | ||
30 | #include <qbuttongroup.h> | 54 | #include <qbuttongroup.h> |
@@ -51,27 +75,2 @@ | |||
51 | 75 | ||
52 | #include <qpe/config.h> | ||
53 | #include <qpe/global.h> | ||
54 | #include <qpe/resource.h> | ||
55 | #include <qpe/qpeapplication.h> | ||
56 | #include <qpe/qpemessagebox.h> | ||
57 | #include <qpe/qcopenvelope_qws.h> | ||
58 | #include <qpe/qpestyle.h> | ||
59 | #include <qpe/lightstyle.h> | ||
60 | #include <qpe/qlibrary.h> | ||
61 | #include <qpe/styleinterface.h> | ||
62 | |||
63 | #include <opie/ofontselector.h> | ||
64 | #include <opie/odevice.h> | ||
65 | #include <opie/ofiledialog.h> | ||
66 | #include <opie/otabwidget.h> | ||
67 | |||
68 | #include "appearance.h" | ||
69 | #include "editScheme.h" | ||
70 | #include "stylelistitem.h" | ||
71 | #include "decolistitem.h" | ||
72 | #include "colorlistitem.h" | ||
73 | #include "exceptlistitem.h" | ||
74 | #include "sample.h" | ||
75 | |||
76 | |||
77 | using namespace Opie; | 76 | using namespace Opie; |
@@ -83,18 +82,21 @@ public: | |||
83 | DefaultWindowDecoration() : ref(0) {} | 82 | DefaultWindowDecoration() : ref(0) {} |
84 | QString name() const { | 83 | QString name() const |
85 | return "Default"; | 84 | { |
85 | return "Default"; | ||
86 | } | 86 | } |
87 | QPixmap icon() const { | 87 | QPixmap icon() const |
88 | return QPixmap(); | 88 | { |
89 | return QPixmap(); | ||
89 | } | 90 | } |
90 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | 91 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
91 | *iface = 0; | 92 | { |
92 | if ( uuid == IID_QUnknown ) | 93 | *iface = 0; |
93 | *iface = this; | 94 | if ( uuid == IID_QUnknown ) |
94 | else if ( uuid == IID_WindowDecoration ) | 95 | *iface = this; |
95 | *iface = this; | 96 | else if ( uuid == IID_WindowDecoration ) |
96 | 97 | *iface = this; | |
97 | if ( *iface ) | 98 | |
98 | (*iface)->addRef(); | 99 | if ( *iface ) |
99 | return QS_OK; | 100 | (*iface)->addRef(); |
101 | return QS_OK; | ||
100 | } | 102 | } |
@@ -103,3 +105,3 @@ QPixmap icon() const { | |||
103 | private: | 105 | private: |
104 | ulong ref; | 106 | ulong ref; |
105 | }; | 107 | }; |
@@ -119,3 +121,3 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) | |||
119 | vertLayout->addWidget( m_style_list ); | 121 | vertLayout->addWidget( m_style_list ); |
120 | 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." ) ); | 122 | 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." ) ); |
121 | 123 | ||
@@ -124,3 +126,3 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) | |||
124 | vertLayout-> addWidget ( m_style_settings ); | 126 | vertLayout-> addWidget ( m_style_settings ); |
125 | QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); | 127 | QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); |
126 | 128 | ||
@@ -136,25 +138,28 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) | |||
136 | #endif | 138 | #endif |
137 | { | 139 | |
138 | QString path = QPEApplication::qpeDir ( ); | 140 | { |
139 | path.append( "/plugins/styles/" ); | 141 | QString path = QPEApplication::qpeDir ( ); |
140 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); | 142 | path.append( "/plugins/styles/" ); |
141 | 143 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); | |
142 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 144 | |
143 | QString libstr = path; | 145 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
144 | libstr.append( "/" ); | 146 | { |
145 | libstr.append( *it ); | 147 | QString libstr = path; |
146 | QLibrary *lib = new QLibrary ( libstr ); | 148 | libstr.append( "/" ); |
147 | StyleInterface *iface; | 149 | libstr.append( *it ); |
148 | 150 | QLibrary *lib = new QLibrary ( libstr ); | |
149 | if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) { | 151 | StyleInterface *iface; |
150 | StyleListItem *slit = new StyleListItem ( lib, iface ); | 152 | |
151 | m_style_list-> insertItem ( slit ); | 153 | if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) |
152 | 154 | { | |
153 | if ( slit-> key ( ) == s ) | 155 | StyleListItem *slit = new StyleListItem ( lib, iface ); |
154 | m_style_list-> setCurrentItem ( slit ); | 156 | m_style_list-> insertItem ( slit ); |
155 | } | 157 | |
156 | else | 158 | if ( slit-> key ( ) == s ) |
157 | delete lib; | 159 | m_style_list-> setCurrentItem ( slit ); |
158 | } | 160 | } |
159 | } | 161 | else |
162 | delete lib; | ||
163 | } | ||
164 | } | ||
160 | 165 | ||
@@ -165,3 +170,3 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) | |||
165 | 170 | ||
166 | return tab; | 171 | return tab; |
167 | } | 172 | } |
@@ -175,3 +180,3 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) | |||
175 | vertLayout->addWidget( m_deco_list ); | 180 | vertLayout->addWidget( m_deco_list ); |
176 | 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." ) ); | 181 | 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." ) ); |
177 | 182 | ||
@@ -181,25 +186,27 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) | |||
181 | 186 | ||
182 | { | 187 | { |
183 | QString path = QPEApplication::qpeDir(); | 188 | QString path = QPEApplication::qpeDir(); |
184 | path.append( "/plugins/decorations/" ); | 189 | path.append( "/plugins/decorations/" ); |
185 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); | 190 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); |
186 | 191 | ||
187 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 192 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
188 | QString libstr = path; | 193 | { |
189 | libstr.append( "/" ); | 194 | QString libstr = path; |
190 | libstr.append( *it ); | 195 | libstr.append( "/" ); |
191 | QLibrary *lib = new QLibrary ( libstr ); | 196 | libstr.append( *it ); |
192 | WindowDecorationInterface *iface; | 197 | QLibrary *lib = new QLibrary ( libstr ); |
193 | 198 | WindowDecorationInterface *iface; | |
194 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) { | 199 | |
195 | DecoListItem *dlit = new DecoListItem ( lib, iface ); | 200 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) |
196 | m_deco_list-> insertItem ( dlit ); | 201 | { |
197 | 202 | DecoListItem *dlit = new DecoListItem ( lib, iface ); | |
198 | if ( dlit-> key ( ) == s ) | 203 | m_deco_list-> insertItem ( dlit ); |
199 | m_deco_list-> setCurrentItem ( dlit ); | 204 | |
200 | } | 205 | if ( dlit-> key ( ) == s ) |
201 | else | 206 | m_deco_list-> setCurrentItem ( dlit ); |
202 | delete lib; | 207 | } |
203 | } | 208 | else |
204 | } | 209 | delete lib; |
210 | } | ||
211 | } | ||
205 | 212 | ||
@@ -207,3 +214,3 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) | |||
207 | if ( m_deco_list-> currentItem ( ) < 0 ) | 214 | if ( m_deco_list-> currentItem ( ) < 0 ) |
208 | m_deco_list-> setCurrentItem ( 0 ); | 215 | m_deco_list-> setCurrentItem ( 0 ); |
209 | decoClicked ( m_original_deco ); | 216 | decoClicked ( m_original_deco ); |
@@ -212,3 +219,3 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) | |||
212 | 219 | ||
213 | return tab; | 220 | return tab; |
214 | } | 221 | } |
@@ -223,3 +230,3 @@ QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) | |||
223 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); | 230 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); |
224 | QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); | 231 | QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); |
225 | 232 | ||
@@ -240,19 +247,20 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | |||
240 | connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); | 247 | connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); |
241 | 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." ) ); | 248 | 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." ) ); |
242 | 249 | ||
243 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); | 250 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); |
244 | 251 | ||
245 | QString path = QPEApplication::qpeDir ( ); | 252 | QString path = QPEApplication::qpeDir ( ); |
246 | path.append( "/etc/colors/" ); | 253 | path.append( "/etc/colors/" ); |
247 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); | 254 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); |
248 | 255 | ||
249 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 256 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
250 | QString name = (*it). left ((*it). find ( ".scheme" )); | 257 | { |
251 | QString pathstr = path; | 258 | QString name = (*it). left ((*it). find ( ".scheme" )); |
252 | pathstr.append( *it ); | 259 | QString pathstr = path; |
253 | Config config ( pathstr, Config::File ); | 260 | pathstr.append( *it ); |
254 | config. setGroup ( "Colors" ); | 261 | Config config ( pathstr, Config::File ); |
262 | config. setGroup ( "Colors" ); | ||
255 | 263 | ||
256 | m_color_list-> insertItem ( new ColorListItem ( name, config )); | 264 | m_color_list-> insertItem ( new ColorListItem ( name, config )); |
257 | } | 265 | } |
258 | 266 | ||
@@ -264,3 +272,3 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | |||
264 | gridLayout->addWidget( tempButton, 0, 1 ); | 272 | gridLayout->addWidget( tempButton, 0, 1 ); |
265 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); | 273 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); |
266 | 274 | ||
@@ -270,3 +278,3 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | |||
270 | gridLayout->addWidget( tempButton, 1, 1 ); | 278 | gridLayout->addWidget( tempButton, 1, 1 ); |
271 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); | 279 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); |
272 | 280 | ||
@@ -276,3 +284,3 @@ QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | |||
276 | gridLayout->addWidget( tempButton, 2, 1 ); | 284 | gridLayout->addWidget( tempButton, 2, 1 ); |
277 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); | 285 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); |
278 | 286 | ||
@@ -286,78 +294,79 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
286 | 294 | ||
287 | QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 295 | QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
288 | 296 | ||
289 | m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); | 297 | m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); |
290 | m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); | 298 | m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); |
291 | lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); | 299 | lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); |
292 | QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); | 300 | QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); |
293 | 301 | ||
294 | QLabel *l = new QLabel ( tab ); | 302 | QLabel *l = new QLabel ( tab ); |
295 | l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); | 303 | l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); |
296 | lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); | 304 | lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); |
297 | QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); | 305 | QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); |
298 | 306 | ||
299 | m_except = new QListView ( tab ); | 307 | m_except = new QListView ( tab ); |
300 | m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); | 308 | m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); |
301 | m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); | 309 | m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); |
302 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); | 310 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); |
303 | m_except-> addColumn ( tr( "Binary file(s)" )); | 311 | m_except-> addColumn ( tr( "Binary file(s)" )); |
304 | m_except-> setColumnAlignment ( 0, AlignCenter ); | 312 | m_except-> setColumnAlignment ( 0, AlignCenter ); |
305 | m_except-> setColumnAlignment ( 1, AlignCenter ); | 313 | m_except-> setColumnAlignment ( 1, AlignCenter ); |
306 | m_except-> setColumnAlignment ( 2, AlignCenter ); | 314 | m_except-> setColumnAlignment ( 2, AlignCenter ); |
307 | m_except-> setAllColumnsShowFocus ( true ); | 315 | m_except-> setAllColumnsShowFocus ( true ); |
308 | m_except-> setMinimumHeight ( 30 ); | 316 | m_except-> setMinimumHeight ( 30 ); |
309 | m_except-> header ( )-> setClickEnabled ( false ); | 317 | m_except-> header ( )-> setClickEnabled ( false ); |
310 | m_except-> header ( )-> setResizeEnabled ( false ); | 318 | m_except-> header ( )-> setResizeEnabled ( false ); |
311 | m_except-> header ( )-> setMovingEnabled ( false ); | 319 | m_except-> header ( )-> setMovingEnabled ( false ); |
312 | m_except-> setSorting ( -1 ); | 320 | m_except-> setSorting ( -1 ); |
313 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); | 321 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); |
314 | QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); | 322 | QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); |
315 | 323 | ||
316 | connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); | 324 | connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); |
317 | 325 | ||
318 | QToolButton *tb = new QToolButton ( tab ); | 326 | QToolButton *tb = new QToolButton ( tab ); |
319 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); | 327 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); |
320 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 328 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
321 | lay-> addWidget ( tb, 2, 1 ); | 329 | lay-> addWidget ( tb, 2, 1 ); |
322 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); | 330 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); |
323 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); | 331 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); |
324 | 332 | ||
325 | tb = new QToolButton ( tab ); | 333 | tb = new QToolButton ( tab ); |
326 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); | 334 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); |
327 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 335 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
328 | lay-> addWidget ( tb, 3, 1 ); | 336 | lay-> addWidget ( tb, 3, 1 ); |
329 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); | 337 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); |
330 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); | 338 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); |
331 | 339 | ||
332 | tb = new QToolButton ( tab ); | 340 | tb = new QToolButton ( tab ); |
333 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); | 341 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); |
334 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 342 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
335 | lay-> addWidget ( tb, 4, 1 ); | 343 | lay-> addWidget ( tb, 4, 1 ); |
336 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); | 344 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); |
337 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); | 345 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); |
338 | 346 | ||
339 | tb = new QToolButton ( tab ); | 347 | tb = new QToolButton ( tab ); |
340 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); | 348 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); |
341 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 349 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
342 | lay-> addWidget ( tb, 5, 1 ); | 350 | lay-> addWidget ( tb, 5, 1 ); |
343 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); | 351 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); |
344 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); | 352 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); |
345 | 353 | ||
346 | lay-> setRowStretch ( 6, 10 ); | 354 | lay-> setRowStretch ( 6, 10 ); |
347 | lay-> setColStretch ( 0, 10 ); | 355 | lay-> setColStretch ( 0, 10 ); |
348 | 356 | ||
349 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); | 357 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); |
350 | QListViewItem *lvit = 0; | 358 | QListViewItem *lvit = 0; |
351 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 359 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
352 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 360 | { |
353 | 361 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); | |
354 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); | 362 | |
355 | } | 363 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); |
356 | 364 | } | |
357 | 365 | ||
358 | vertLayout-> addSpacing ( 3 ); | 366 | |
359 | QFrame *f = new QFrame ( tab ); | 367 | vertLayout-> addSpacing ( 3 ); |
360 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | 368 | QFrame *f = new QFrame ( tab ); |
361 | vertLayout-> addWidget ( f ); | 369 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); |
362 | vertLayout-> addSpacing ( 3 ); | 370 | vertLayout-> addWidget ( f ); |
371 | vertLayout-> addSpacing ( 3 ); | ||
363 | 372 | ||
@@ -366,4 +375,4 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
366 | 375 | ||
367 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; | 376 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; |
368 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); | 377 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); |
369 | 378 | ||
@@ -371,3 +380,3 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
371 | gridLayout-> addWidget ( label, 0, 0 ); | 380 | gridLayout-> addWidget ( label, 0, 0 ); |
372 | 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" ) ); | 381 | 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" ) ); |
373 | 382 | ||
@@ -384,3 +393,3 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
384 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 393 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); |
385 | 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" ) ); | 394 | 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" ) ); |
386 | 395 | ||
@@ -389,3 +398,3 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
389 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); | 398 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); |
390 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); | 399 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); |
391 | 400 | ||
@@ -394,3 +403,3 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
394 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); | 403 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); |
395 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); | 404 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); |
396 | 405 | ||
@@ -399,48 +408,51 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
399 | 408 | ||
400 | m_original_tabstyle = style; | 409 | m_original_tabstyle = style; |
401 | m_original_tabpos = tabtop; | 410 | m_original_tabpos = tabtop; |
402 | 411 | ||
403 | vertLayout-> addSpacing ( 3 ); | 412 | vertLayout-> addSpacing ( 3 ); |
404 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); | 413 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); |
405 | 414 | ||
406 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); | 415 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); |
407 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); | 416 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); |
408 | QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); | 417 | QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); |
409 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); | 418 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); |
410 | QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); | 419 | QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); |
411 | QPixmap ccw1; | 420 | QPixmap ccw1; |
412 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); | 421 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); |
413 | QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); | 422 | QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); |
414 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); | 423 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); |
415 | 424 | ||
416 | rotbtngrp-> hide ( ); | 425 | rotbtngrp-> hide ( ); |
417 | rotbtngrp-> setExclusive ( true ); | 426 | rotbtngrp-> setExclusive ( true ); |
418 | rotbtngrp-> insert ( m_rotdir_cw ); | 427 | rotbtngrp-> insert ( m_rotdir_cw ); |
419 | rotbtngrp-> insert ( m_rotdir_ccw ); | 428 | rotbtngrp-> insert ( m_rotdir_ccw ); |
420 | rotbtngrp-> insert ( m_rotdir_flip ); | 429 | rotbtngrp-> insert ( m_rotdir_flip ); |
421 | 430 | ||
422 | ccw1. convertFromImage( ccwImage ); | 431 | ccw1. convertFromImage( ccwImage ); |
423 | m_rotdir_cw-> setPixmap( cw1 ); | 432 | m_rotdir_cw-> setPixmap( cw1 ); |
424 | m_rotdir_ccw-> setPixmap( ccw1 ); | 433 | m_rotdir_ccw-> setPixmap( ccw1 ); |
425 | m_rotdir_flip-> setPixmap( flip1 ); | 434 | m_rotdir_flip-> setPixmap( flip1 ); |
426 | 435 | ||
427 | rotLay-> addWidget ( rotlabel, 0 ); | 436 | rotLay-> addWidget ( rotlabel, 0 ); |
428 | rotLay-> addWidget ( m_rotdir_cw, 0 ); | 437 | rotLay-> addWidget ( m_rotdir_cw, 0 ); |
429 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); | 438 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); |
430 | rotLay-> addWidget ( m_rotdir_flip, 0 ); | 439 | rotLay-> addWidget ( m_rotdir_flip, 0 ); |
431 | 440 | ||
432 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 441 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
433 | ODirection rot = CW; | 442 | ODirection rot = CW; |
434 | 443 | ||
435 | if (rotDirection == -1) { | 444 | if (rotDirection == -1) |
436 | rot = ODevice::inst ( )-> direction ( ); | 445 | { |
437 | } else { | 446 | rot = ODevice::inst ( )-> direction ( ); |
438 | rot = (ODirection)rotDirection; | 447 | } |
439 | } | 448 | else |
440 | 449 | { | |
441 | m_rotdir_cw-> setChecked ( rot == CW ); | 450 | rot = (ODirection)rotDirection; |
442 | m_rotdir_ccw-> setChecked ( rot == CCW ); | 451 | } |
443 | m_rotdir_flip-> setChecked ( rot == Flip ); | 452 | |
444 | 453 | m_rotdir_cw-> setChecked ( rot == CW ); | |
445 | return tab; | 454 | m_rotdir_ccw-> setChecked ( rot == CCW ); |
455 | m_rotdir_flip-> setChecked ( rot == Flip ); | ||
456 | |||
457 | return tab; | ||
446 | } | 458 | } |
@@ -449,3 +461,3 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | |||
449 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 461 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
450 | : QDialog ( parent, name, true, WStyle_ContextHelp ) | 462 | : QDialog ( parent, name, true, WStyle_ContextHelp ) |
451 | { | 463 | { |
@@ -458,13 +470,13 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | |||
458 | 470 | ||
459 | m_sample = new SampleWindow ( this ); | 471 | m_sample = new SampleWindow ( this ); |
460 | 472 | ||
461 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); | 473 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); |
462 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 474 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
463 | 475 | ||
464 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 476 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
465 | QWidget *styletab; | 477 | QWidget *styletab; |
466 | 478 | ||
467 | m_color_list = 0; | 479 | m_color_list = 0; |
468 | 480 | ||
469 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); | 481 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); |
470 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); | 482 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); |
@@ -472,9 +484,9 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | |||
472 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); | 484 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); |
473 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); | 485 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); |
474 | 486 | ||
475 | top-> addWidget ( tw, 10 ); | 487 | top-> addWidget ( tw, 10 ); |
476 | top-> addWidget ( m_sample, 1 ); | 488 | top-> addWidget ( m_sample, 1 ); |
477 | 489 | ||
478 | tw-> setCurrentTab ( styletab ); | 490 | tw-> setCurrentTab ( styletab ); |
479 | connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); | 491 | connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); |
480 | 492 | ||
@@ -484,4 +496,3 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | |||
484 | Appearance::~Appearance() | 496 | Appearance::~Appearance() |
485 | { | 497 | {} |
486 | } | ||
487 | 498 | ||
@@ -489,8 +500,9 @@ void Appearance::tabChanged ( QWidget *w ) | |||
489 | { | 500 | { |
490 | if ( w == m_advtab ) { | 501 | if ( w == m_advtab ) |
491 | m_sample-> hide ( ); | 502 | { |
492 | updateGeometry ( ); // shouldn't be necessary ... | 503 | m_sample-> hide ( ); |
493 | } | 504 | updateGeometry ( ); // shouldn't be necessary ... |
494 | else | 505 | } |
495 | m_sample-> show ( ); | 506 | else |
507 | m_sample-> show ( ); | ||
496 | } | 508 | } |
@@ -499,4 +511,4 @@ void Appearance::accept ( ) | |||
499 | { | 511 | { |
500 | bool newtabpos = m_tabstyle_top-> isChecked ( ); | 512 | bool newtabpos = m_tabstyle_top-> isChecked ( ); |
501 | int newtabstyle = m_tabstyle_list-> currentItem ( ); | 513 | int newtabstyle = m_tabstyle_list-> currentItem ( ); |
502 | 514 | ||
@@ -505,20 +517,24 @@ void Appearance::accept ( ) | |||
505 | 517 | ||
506 | if ( m_style_changed ) { | 518 | if ( m_style_changed ) |
507 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 519 | { |
508 | if ( item ) | 520 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
521 | if ( item ) | ||
509 | config.writeEntry( "Style", item-> key ( )); | 522 | config.writeEntry( "Style", item-> key ( )); |
510 | } | 523 | } |
511 | 524 | ||
512 | if ( m_deco_changed ) { | 525 | if ( m_deco_changed ) |
513 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); | 526 | { |
514 | if ( item ) | 527 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); |
528 | if ( item ) | ||
515 | config.writeEntry( "Decoration", item-> key ( )); | 529 | config.writeEntry( "Decoration", item-> key ( )); |
516 | } | 530 | } |
517 | 531 | ||
518 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { | 532 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) |
519 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | 533 | { |
520 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); | 534 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); |
521 | } | 535 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); |
536 | } | ||
522 | 537 | ||
523 | if ( m_font_changed ) { | 538 | if ( m_font_changed ) |
539 | { | ||
524 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); | 540 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); |
@@ -531,38 +547,44 @@ void Appearance::accept ( ) | |||
531 | { | 547 | { |
532 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 548 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
533 | 549 | ||
534 | if ( item ) | 550 | if ( item ) |
535 | item-> save ( config ); | 551 | item-> save ( config ); |
536 | } | 552 | } |
537 | 553 | ||
538 | ODirection rot; | 554 | ODirection rot; |
539 | if (m_rotdir_ccw-> isChecked ( )) { | 555 | if (m_rotdir_ccw-> isChecked ( )) |
540 | rot = CCW; | 556 | { |
541 | } else if (m_rotdir_cw-> isChecked ( )) { | 557 | rot = CCW; |
542 | rot = CW; | 558 | } |
543 | } else { | 559 | else if (m_rotdir_cw-> isChecked ( )) |
544 | rot = Flip; | 560 | { |
545 | } | 561 | rot = CW; |
546 | config. writeEntry ( "rotatedir", (int)rot ); | 562 | } |
547 | 563 | else | |
548 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated | 564 | { |
549 | 565 | rot = Flip; | |
550 | QStringList sl; | 566 | } |
551 | QString exceptstr; | 567 | config. writeEntry ( "rotatedir", (int)rot ); |
552 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { | 568 | |
553 | int fl = 0; | 569 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated |
554 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); | 570 | |
555 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); | 571 | QStringList sl; |
556 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); | 572 | QString exceptstr; |
557 | exceptstr = QString::number ( fl, 32 ); | 573 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) |
558 | exceptstr.append( it-> pattern ( )); | 574 | { |
559 | sl << exceptstr; | 575 | int fl = 0; |
560 | } | 576 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); |
561 | config. writeEntry ( "NoStyle", sl, ';' ); | 577 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); |
562 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); | 578 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); |
563 | 579 | exceptstr = QString::number ( fl, 32 ); | |
564 | config. write ( ); // need to flush the config info first | 580 | exceptstr.append( it-> pattern ( )); |
565 | Global::applyStyle ( ); | 581 | sl << exceptstr; |
566 | 582 | } | |
567 | QDialog::accept ( ); | 583 | config. writeEntry ( "NoStyle", sl, ';' ); |
584 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); | ||
585 | |||
586 | config. write ( ); // need to flush the config info first | ||
587 | Global::applyStyle ( ); | ||
588 | |||
589 | QDialog::accept ( ); | ||
568 | } | 590 | } |
@@ -571,4 +593,4 @@ void Appearance::done ( int r ) | |||
571 | { | 593 | { |
572 | QDialog::done ( r ); | 594 | QDialog::done ( r ); |
573 | close ( ); | 595 | close ( ); |
574 | } | 596 | } |
@@ -579,11 +601,12 @@ void Appearance::styleClicked ( int index ) | |||
579 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); | 601 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); |
580 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); | 602 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); |
581 | 603 | ||
582 | if ( m_sample && sli && sli-> style ( )) { | 604 | if ( m_sample && sli && sli-> style ( )) |
583 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; | 605 | { |
606 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; | ||
584 | 607 | ||
585 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); | 608 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); |
586 | } | 609 | } |
587 | 610 | ||
588 | m_style_changed |= ( index != m_original_style ); | 611 | m_style_changed |= ( index != m_original_style ); |
589 | } | 612 | } |
@@ -592,23 +615,24 @@ void Appearance::styleSettingsClicked ( ) | |||
592 | { | 615 | { |
593 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 616 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
594 | 617 | ||
595 | if ( item && item-> hasSettings ( )) { | 618 | if ( item && item-> hasSettings ( )) |
596 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); | 619 | { |
597 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); | 620 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); |
621 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); | ||
598 | 622 | ||
599 | QWidget *w = item-> settings ( d ); | 623 | QWidget *w = item-> settings ( d ); |
600 | 624 | ||
601 | if ( w ) { | 625 | if ( w ) |
602 | vbox-> addWidget ( w ); | 626 | { |
627 | vbox-> addWidget ( w ); | ||
603 | 628 | ||
604 | d-> setCaption ( w-> caption ( )); | 629 | d-> setCaption ( w-> caption ( )); |
605 | 630 | ||
606 | d-> showMaximized ( ); | 631 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); |
607 | bool accepted = ( d-> exec ( ) == QDialog::Accepted ); | ||
608 | 632 | ||
609 | if ( item-> setSettings ( accepted )) | 633 | if ( item-> setSettings ( accepted )) |
610 | m_style_changed = true; | 634 | m_style_changed = true; |
611 | } | 635 | } |
612 | delete d; | 636 | delete d; |
613 | } | 637 | } |
614 | } | 638 | } |
@@ -619,10 +643,11 @@ void Appearance::decoClicked ( int index ) | |||
619 | 643 | ||
620 | if ( m_sample ) { | 644 | if ( m_sample ) |
621 | if ( dli && dli-> interface ( )) | 645 | { |
622 | m_sample-> setDecoration ( dli-> interface ( )); | 646 | if ( dli && dli-> interface ( )) |
623 | else | 647 | m_sample-> setDecoration ( dli-> interface ( )); |
624 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 648 | else |
625 | m_sample-> repaint ( ); | 649 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
626 | } | 650 | m_sample-> repaint ( ); |
627 | m_deco_changed |= ( index != m_original_deco ); | 651 | } |
652 | m_deco_changed |= ( index != m_original_deco ); | ||
628 | } | 653 | } |
@@ -631,4 +656,4 @@ void Appearance::fontClicked ( const QFont &f ) | |||
631 | { | 656 | { |
632 | m_font_changed |= ( f != m_sample-> font ( )); | 657 | m_font_changed |= ( f != m_sample-> font ( )); |
633 | m_sample-> setFont ( f ); | 658 | m_sample-> setFont ( f ); |
634 | } | 659 | } |
@@ -637,8 +662,8 @@ void Appearance::colorClicked ( int index ) | |||
637 | { | 662 | { |
638 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); | 663 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); |
639 | 664 | ||
640 | if ( item ) | 665 | if ( item ) |
641 | m_sample-> setPalette ( item-> palette ( )); | 666 | m_sample-> setPalette ( item-> palette ( )); |
642 | 667 | ||
643 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); | 668 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); |
644 | } | 669 | } |
@@ -648,30 +673,34 @@ void Appearance::editSchemeClicked ( ) | |||
648 | { | 673 | { |
649 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 674 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
650 | 675 | ||
651 | int cnt = 0; | 676 | int cnt = 0; |
652 | QString labels [QColorGroup::NColorRoles]; | 677 | QString labels [QColorGroup::NColorRoles]; |
653 | QColor colors [QColorGroup::NColorRoles]; | 678 | QColor colors [QColorGroup::NColorRoles]; |
654 | 679 | ||
655 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { | 680 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) |
656 | QColor col = item-> color ( role ); | 681 | { |
682 | QColor col = item-> color ( role ); | ||
657 | 683 | ||
658 | if ( col. isValid ( )) { | 684 | if ( col. isValid ( )) |
659 | labels [cnt] = item-> label ( role ); | 685 | { |
660 | colors [cnt] = col; | 686 | labels [cnt] = item-> label ( role ); |
687 | colors [cnt] = col; | ||
661 | 688 | ||
662 | cnt++; | 689 | cnt++; |
663 | } | 690 | } |
664 | } | 691 | } |
665 | 692 | ||
666 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); | 693 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); |
667 | editdlg-> showMaximized ( ); | 694 | if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) |
668 | if ( editdlg-> exec ( ) == QDialog::Accepted ) { | 695 | { |
669 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); | 696 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); |
670 | cnt = 0; | 697 | cnt = 0; |
671 | 698 | ||
672 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { | 699 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) |
673 | if ( item-> color ( role ). isValid ( )) { | 700 | { |
674 | citem-> setColor ( role, colors [cnt] ); | 701 | if ( item-> color ( role ). isValid ( )) |
675 | cnt++; | 702 | { |
676 | } | 703 | citem-> setColor ( role, colors [cnt] ); |
704 | cnt++; | ||
705 | } | ||
677 | } | 706 | } |
@@ -689,19 +718,20 @@ void Appearance::saveSchemeClicked() | |||
689 | { | 718 | { |
690 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 719 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
691 | 720 | ||
692 | if ( !item ) | 721 | if ( !item ) |
693 | return; | 722 | return; |
694 | 723 | ||
695 | QDialog *d = new QDialog ( this, 0, true ); | 724 | QDialog *d = new QDialog ( this, 0, true ); |
696 | d-> setCaption ( tr( "Save Scheme" )); | 725 | d-> setCaption ( tr( "Save Scheme" )); |
697 | QLineEdit *ed = new QLineEdit ( d ); | 726 | QLineEdit *ed = new QLineEdit ( d ); |
698 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); | 727 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); |
699 | ed-> setFocus ( ); | 728 | ed-> setFocus ( ); |
700 | 729 | ||
701 | if ( d-> exec ( ) == QDialog::Accepted ) { | 730 | if ( d-> exec ( ) == QDialog::Accepted ) |
731 | { | ||
702 | QString schemename = ed-> text ( ); | 732 | QString schemename = ed-> text ( ); |
703 | QString filestr = QPEApplication::qpeDir(); | 733 | QString filestr = QPEApplication::qpeDir(); |
704 | filestr.append( "/etc/colors/" ); | 734 | filestr.append( "/etc/colors/" ); |
705 | filestr.append( schemename ); | 735 | filestr.append( schemename ); |
706 | filestr.append( ".scheme" ); | 736 | filestr.append( ".scheme" ); |
707 | QFile file ( filestr ); | 737 | QFile file ( filestr ); |
@@ -709,3 +739,3 @@ void Appearance::saveSchemeClicked() | |||
709 | { | 739 | { |
710 | QPalette p = item-> palette ( ); | 740 | QPalette p = item-> palette ( ); |
711 | 741 | ||
@@ -714,3 +744,3 @@ void Appearance::saveSchemeClicked() | |||
714 | 744 | ||
715 | item-> save ( config ); | 745 | item-> save ( config ); |
716 | 746 | ||
@@ -722,3 +752,3 @@ void Appearance::saveSchemeClicked() | |||
722 | { | 752 | { |
723 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); | 753 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); |
724 | } | 754 | } |
@@ -730,6 +760,6 @@ void Appearance::deleteSchemeClicked() | |||
730 | { | 760 | { |
731 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 761 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
732 | 762 | ||
733 | if ( !item ) | 763 | if ( !item ) |
734 | return; | 764 | return; |
735 | 765 | ||
@@ -737,10 +767,10 @@ void Appearance::deleteSchemeClicked() | |||
737 | { | 767 | { |
738 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) | 768 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) |
739 | { | 769 | { |
740 | QString filestr = QPEApplication::qpeDir ( ); | 770 | QString filestr = QPEApplication::qpeDir ( ); |
741 | filestr.append( "/etc/colors/" ); | 771 | filestr.append( "/etc/colors/" ); |
742 | filestr.append( item-> text ( ) ); | 772 | filestr.append( item-> text ( ) ); |
743 | filestr.append( ".scheme" ); | 773 | filestr.append( ".scheme" ); |
744 | QFile::remove ( filestr ); | 774 | QFile::remove ( filestr ); |
745 | delete item; | 775 | delete item; |
746 | } | 776 | } |
@@ -756,5 +786,5 @@ void Appearance::addExcept ( ) | |||
756 | { | 786 | { |
757 | ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true ); | 787 | ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true ); |
758 | m_except-> ensureItemVisible ( it ); | 788 | m_except-> ensureItemVisible ( it ); |
759 | m_except-> setSelected ( it, true ); | 789 | m_except-> setSelected ( it, true ); |
760 | } | 790 | } |
@@ -763,6 +793,7 @@ void Appearance::delExcept ( ) | |||
763 | { | 793 | { |
764 | if ( m_except-> selectedItem ( )) { | 794 | if ( m_except-> selectedItem ( )) |
765 | m_except-> setFocus ( ); | 795 | { |
766 | delete m_except-> selectedItem ( ); | 796 | m_except-> setFocus ( ); |
767 | } | 797 | delete m_except-> selectedItem ( ); |
798 | } | ||
768 | } | 799 | } |
@@ -771,6 +802,6 @@ void Appearance::upExcept ( ) | |||
771 | { | 802 | { |
772 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); | 803 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); |
773 | 804 | ||
774 | if ( it && it-> itemAbove ( )) | 805 | if ( it && it-> itemAbove ( )) |
775 | it-> itemAbove ( )-> moveItem ( it ); | 806 | it-> itemAbove ( )-> moveItem ( it ); |
776 | } | 807 | } |
@@ -779,58 +810,60 @@ void Appearance::downExcept ( ) | |||
779 | { | 810 | { |
780 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); | 811 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); |
781 | 812 | ||
782 | if ( it && it-> itemBelow ( )) | 813 | if ( it && it-> itemBelow ( )) |
783 | it-> moveItem ( it-> itemBelow ( )); | 814 | it-> moveItem ( it-> itemBelow ( )); |
784 | } | 815 | } |
785 | 816 | ||
786 | class ExEdit : public QLineEdit { | 817 | class ExEdit : public QLineEdit |
818 | { | ||
787 | public: | 819 | public: |
788 | ExEdit ( ExceptListItem *item ) | 820 | ExEdit ( ExceptListItem *item ) |
789 | : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item ) | 821 | : QLineEdit ( item-> listView ( )-> viewport ( ), "exedit" ), it ( item ) |
790 | { | 822 | { |
791 | setFrame ( false ); | 823 | setFrame ( false ); |
792 | 824 | ||
793 | QRect r = it-> listView ( )-> itemRect ( it ); | 825 | QRect r = it-> listView ( )-> itemRect ( it ); |
794 | 826 | ||
795 | int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1; | 827 | int x = it-> listView ( )-> header ( )-> cellPos ( 3 ) - 1; |
796 | int y = r. y ( ); | 828 | int y = r. y ( ); |
797 | int w = it-> listView ( )-> viewport ( )-> width ( ) - x; | 829 | int w = it-> listView ( )-> viewport ( )-> width ( ) - x; |
798 | int h = r. height ( ); // + 2; | 830 | int h = r. height ( ); // + 2; |
799 | 831 | ||
800 | setText ( it-> pattern ( )); | 832 | setText ( it-> pattern ( )); |
801 | setGeometry ( x, y, w, h ); | 833 | setGeometry ( x, y, w, h ); |
802 | 834 | ||
803 | qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h); | 835 | qDebug ( "ExEdit: [%s] at %d,%d %d,%d", it->text(2).latin1(),x,y,w,h); |
804 | 836 | ||
805 | m_out = true; | 837 | m_out = true; |
806 | 838 | ||
807 | show ( ); | 839 | show ( ); |
808 | setFocus ( ); | 840 | setFocus ( ); |
809 | selectAll ( ); | 841 | selectAll ( ); |
810 | end ( true ); | 842 | end ( true ); |
811 | } | 843 | } |
812 | 844 | ||
813 | virtual void focusOutEvent ( QFocusEvent * ) | 845 | virtual void focusOutEvent ( QFocusEvent * ) |
814 | { | 846 | { |
815 | hide ( ); | 847 | hide ( ); |
816 | if ( m_out ) | 848 | if ( m_out ) |
817 | it-> setPattern ( text ( )); | 849 | it-> setPattern ( text ( )); |
818 | delete this; | 850 | delete this; |
819 | } | 851 | } |
820 | 852 | ||
821 | virtual void keyPressEvent ( QKeyEvent *e ) | 853 | virtual void keyPressEvent ( QKeyEvent *e ) |
822 | { | 854 | { |
823 | if ( e-> key ( ) == Key_Return ) | 855 | if ( e-> key ( ) == Key_Return ) |
824 | it-> listView ( )-> setFocus ( ); | 856 | it-> listView ( )-> setFocus ( ); |
825 | else if ( e-> key ( ) == Key_Escape ) { | 857 | else if ( e-> key ( ) == Key_Escape ) |
826 | m_out = false; | 858 | { |
827 | it-> listView ( )-> setFocus ( ); | 859 | m_out = false; |
828 | } | 860 | it-> listView ( )-> setFocus ( ); |
829 | else | 861 | } |
830 | QLineEdit::keyPressEvent ( e ); | 862 | else |
831 | } | 863 | QLineEdit::keyPressEvent ( e ); |
864 | } | ||
832 | 865 | ||
833 | private: | 866 | private: |
834 | ExceptListItem *it; | 867 | ExceptListItem *it; |
835 | bool m_out; | 868 | bool m_out; |
836 | }; | 869 | }; |
@@ -839,17 +872,18 @@ void Appearance::clickedExcept ( QListViewItem *item, const QPoint &, int c ) | |||
839 | { | 872 | { |
840 | if ( !item || c < 0 || c > 3 ) | 873 | if ( !item || c < 0 || c > 3 ) |
841 | return; | 874 | return; |
842 | 875 | ||
843 | ExceptListItem *it = (ExceptListItem *) item; | 876 | ExceptListItem *it = (ExceptListItem *) item; |
844 | 877 | ||
845 | if ( c == 0 ) | 878 | if ( c == 0 ) |
846 | it-> setNoStyle ( !it-> noStyle ( )); | 879 | it-> setNoStyle ( !it-> noStyle ( )); |
847 | else if ( c == 1 ) | 880 | else if ( c == 1 ) |
848 | it-> setNoFont ( !it-> noFont ( )); | 881 | it-> setNoFont ( !it-> noFont ( )); |
849 | else if ( c == 2 ) | 882 | else if ( c == 2 ) |
850 | it-> setNoDeco ( !it-> noDeco ( )); | 883 | it-> setNoDeco ( !it-> noDeco ( )); |
851 | else if ( c == 3 ) { | 884 | else if ( c == 3 ) |
852 | m_except-> ensureItemVisible ( it ); | 885 | { |
853 | new ExEdit ( it ); | 886 | m_except-> ensureItemVisible ( it ); |
854 | } | 887 | new ExEdit ( it ); |
888 | } | ||
855 | } | 889 | } |
diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h index caefad8..b6c72c3 100644 --- a/noncore/settings/appearance2/stylelistitem.h +++ b/noncore/settings/appearance2/stylelistitem.h | |||
@@ -30,4 +30,10 @@ | |||
30 | 30 | ||
31 | #include <qlistbox.h> | 31 | /* OPIE */ |
32 | #include <qpe/styleinterface.h> | 32 | #include <qpe/styleinterface.h> |
33 | #include <qpe/qlibrary.h> | ||
34 | #include <qpe/resource.h> | ||
35 | |||
36 | /* QT */ | ||
37 | #include <qlistbox.h> | ||
38 | #include <qfileinfo.h> | ||
33 | 39 | ||
@@ -37,4 +43,4 @@ class StyleListItem : public QListBoxText { | |||
37 | public: | 43 | public: |
38 | StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t ) | 44 | StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t ) |
39 | { | 45 | { |
40 | m_lib = 0; | 46 | m_lib = 0; |