author | sandman <sandman> | 2002-12-17 19:23:17 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-17 19:23:17 (UTC) |
commit | 7459ea6f560b01290086a0919fc5808291973b33 (patch) (unidiff) | |
tree | fb74789d6229c61a0f629939a7402a31f734f7f7 | |
parent | f36c70938c8c2907a1b61637af3bd589262b4b5e (diff) | |
download | opie-7459ea6f560b01290086a0919fc5808291973b33.zip opie-7459ea6f560b01290086a0919fc5808291973b33.tar.gz opie-7459ea6f560b01290086a0919fc5808291973b33.tar.bz2 |
- small fix to reset the palette when changing styles
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 25 | ||||
-rw-r--r-- | noncore/settings/appearance2/sample.cpp | 4 | ||||
-rw-r--r-- | noncore/settings/appearance2/sample.h | 2 |
3 files changed, 18 insertions, 13 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 2f3ba74..e9e0ad9 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -231,496 +231,501 @@ QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) | |||
231 | 231 | ||
232 | QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | 232 | QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) |
233 | { | 233 | { |
234 | QWidget *tab = new QWidget( parent, "ColorTab" ); | 234 | QWidget *tab = new QWidget( parent, "ColorTab" ); |
235 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); | 235 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); |
236 | gridLayout->setRowStretch ( 3, 10 ); | 236 | gridLayout->setRowStretch ( 3, 10 ); |
237 | 237 | ||
238 | m_color_list = new QListBox ( tab ); | 238 | m_color_list = new QListBox ( tab ); |
239 | gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); | 239 | gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); |
240 | connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); | 240 | 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." ) ); | 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." ) ); |
242 | 242 | ||
243 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); | 243 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); |
244 | 244 | ||
245 | QString path = QPEApplication::qpeDir ( ); | 245 | QString path = QPEApplication::qpeDir ( ); |
246 | path.append( "/etc/colors/" ); | 246 | path.append( "/etc/colors/" ); |
247 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); | 247 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); |
248 | 248 | ||
249 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 249 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { |
250 | QString name = (*it). left ((*it). find ( ".scheme" )); | 250 | QString name = (*it). left ((*it). find ( ".scheme" )); |
251 | QString pathstr = path; | 251 | QString pathstr = path; |
252 | pathstr.append( *it ); | 252 | pathstr.append( *it ); |
253 | Config config ( pathstr, Config::File ); | 253 | Config config ( pathstr, Config::File ); |
254 | config. setGroup ( "Colors" ); | 254 | config. setGroup ( "Colors" ); |
255 | 255 | ||
256 | m_color_list-> insertItem ( new ColorListItem ( name, config )); | 256 | m_color_list-> insertItem ( new ColorListItem ( name, config )); |
257 | } | 257 | } |
258 | 258 | ||
259 | m_color_list-> setCurrentItem ( 0 ); | 259 | m_color_list-> setCurrentItem ( 0 ); |
260 | 260 | ||
261 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); | 261 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); |
262 | tempButton->setText( tr( "Edit..." ) ); | 262 | tempButton->setText( tr( "Edit..." ) ); |
263 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); | 263 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); |
264 | gridLayout->addWidget( tempButton, 0, 1 ); | 264 | gridLayout->addWidget( tempButton, 0, 1 ); |
265 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); | 265 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); |
266 | 266 | ||
267 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); | 267 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); |
268 | tempButton->setText( tr( "Delete" ) ); | 268 | tempButton->setText( tr( "Delete" ) ); |
269 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); | 269 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); |
270 | gridLayout->addWidget( tempButton, 1, 1 ); | 270 | gridLayout->addWidget( tempButton, 1, 1 ); |
271 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); | 271 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); |
272 | 272 | ||
273 | tempButton = new QPushButton( tab, "saveSchemeButton" ); | 273 | tempButton = new QPushButton( tab, "saveSchemeButton" ); |
274 | tempButton->setText( tr( "Save" ) ); | 274 | tempButton->setText( tr( "Save" ) ); |
275 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); | 275 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); |
276 | gridLayout->addWidget( tempButton, 2, 1 ); | 276 | gridLayout->addWidget( tempButton, 2, 1 ); |
277 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); | 277 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); |
278 | 278 | ||
279 | return tab; | 279 | return tab; |
280 | } | 280 | } |
281 | 281 | ||
282 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | 282 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) |
283 | { | 283 | { |
284 | QWidget *tab = new QWidget ( parent ); | 284 | QWidget *tab = new QWidget ( parent ); |
285 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 285 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
286 | 286 | ||
287 | QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 287 | QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
288 | 288 | ||
289 | m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); | 289 | m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); |
290 | m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); | 290 | m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); |
291 | lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); | 291 | 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." ) ); | 292 | QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); |
293 | 293 | ||
294 | QLabel *l = new QLabel ( tab ); | 294 | 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):" ))); | 295 | 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 ); | 296 | 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." ) ); | 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." ) ); |
298 | 298 | ||
299 | m_except = new QListView ( tab ); | 299 | m_except = new QListView ( tab ); |
300 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/style.png" ), "", 24 ); | 300 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/style.png" ), "", 24 ); |
301 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/font.png" ), "", 24 ); | 301 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/font.png" ), "", 24 ); |
302 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco.png" ), "", 24 ); | 302 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco.png" ), "", 24 ); |
303 | m_except-> addColumn ( tr( "Binary file(s)" )); | 303 | m_except-> addColumn ( tr( "Binary file(s)" )); |
304 | m_except-> setColumnAlignment ( 0, AlignCenter ); | 304 | m_except-> setColumnAlignment ( 0, AlignCenter ); |
305 | m_except-> setColumnAlignment ( 1, AlignCenter ); | 305 | m_except-> setColumnAlignment ( 1, AlignCenter ); |
306 | m_except-> setColumnAlignment ( 2, AlignCenter ); | 306 | m_except-> setColumnAlignment ( 2, AlignCenter ); |
307 | m_except-> setAllColumnsShowFocus ( true ); | 307 | m_except-> setAllColumnsShowFocus ( true ); |
308 | m_except-> setMinimumHeight ( 30 ); | 308 | m_except-> setMinimumHeight ( 30 ); |
309 | m_except-> header ( )-> setClickEnabled ( false ); | 309 | m_except-> header ( )-> setClickEnabled ( false ); |
310 | m_except-> header ( )-> setResizeEnabled ( false ); | 310 | m_except-> header ( )-> setResizeEnabled ( false ); |
311 | m_except-> header ( )-> setMovingEnabled ( false ); | 311 | m_except-> header ( )-> setMovingEnabled ( false ); |
312 | m_except-> setSorting ( -1 ); | 312 | m_except-> setSorting ( -1 ); |
313 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); | 313 | 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." ) ); | 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." ) ); |
315 | 315 | ||
316 | connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); | 316 | connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); |
317 | 317 | ||
318 | QToolButton *tb = new QToolButton ( tab ); | 318 | QToolButton *tb = new QToolButton ( tab ); |
319 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); | 319 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); |
320 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 320 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
321 | lay-> addWidget ( tb, 2, 1 ); | 321 | lay-> addWidget ( tb, 2, 1 ); |
322 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); | 322 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); |
323 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); | 323 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); |
324 | 324 | ||
325 | tb = new QToolButton ( tab ); | 325 | tb = new QToolButton ( tab ); |
326 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); | 326 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); |
327 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 327 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
328 | lay-> addWidget ( tb, 3, 1 ); | 328 | lay-> addWidget ( tb, 3, 1 ); |
329 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); | 329 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); |
330 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); | 330 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); |
331 | 331 | ||
332 | tb = new QToolButton ( tab ); | 332 | tb = new QToolButton ( tab ); |
333 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); | 333 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); |
334 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 334 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
335 | lay-> addWidget ( tb, 4, 1 ); | 335 | lay-> addWidget ( tb, 4, 1 ); |
336 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); | 336 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); |
337 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); | 337 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); |
338 | 338 | ||
339 | tb = new QToolButton ( tab ); | 339 | tb = new QToolButton ( tab ); |
340 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); | 340 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); |
341 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 341 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
342 | lay-> addWidget ( tb, 5, 1 ); | 342 | lay-> addWidget ( tb, 5, 1 ); |
343 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); | 343 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); |
344 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); | 344 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); |
345 | 345 | ||
346 | lay-> setRowStretch ( 6, 10 ); | 346 | lay-> setRowStretch ( 6, 10 ); |
347 | lay-> setColStretch ( 0, 10 ); | 347 | lay-> setColStretch ( 0, 10 ); |
348 | 348 | ||
349 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); | 349 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); |
350 | QListViewItem *lvit = 0; | 350 | QListViewItem *lvit = 0; |
351 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 351 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { |
352 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 352 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
353 | 353 | ||
354 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); | 354 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); |
355 | } | 355 | } |
356 | 356 | ||
357 | 357 | ||
358 | vertLayout-> addSpacing ( 3 ); | 358 | vertLayout-> addSpacing ( 3 ); |
359 | QFrame *f = new QFrame ( tab ); | 359 | QFrame *f = new QFrame ( tab ); |
360 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | 360 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); |
361 | vertLayout-> addWidget ( f ); | 361 | vertLayout-> addWidget ( f ); |
362 | vertLayout-> addSpacing ( 3 ); | 362 | vertLayout-> addSpacing ( 3 ); |
363 | 363 | ||
364 | 364 | ||
365 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 365 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
366 | 366 | ||
367 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; | 367 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; |
368 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); | 368 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); |
369 | 369 | ||
370 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); | 370 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); |
371 | gridLayout-> addWidget ( label, 0, 0 ); | 371 | 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" ) ); | 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" ) ); |
373 | 373 | ||
374 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); | 374 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); |
375 | btngrp-> hide ( ); | 375 | btngrp-> hide ( ); |
376 | btngrp-> setExclusive ( true ); | 376 | btngrp-> setExclusive ( true ); |
377 | 377 | ||
378 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); | 378 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); |
379 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); | 379 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); |
380 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); | 380 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); |
381 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); | 381 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); |
382 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); | 382 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); |
383 | m_tabstyle_list-> setCurrentItem ( style ); | 383 | m_tabstyle_list-> setCurrentItem ( style ); |
384 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 384 | 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" ) ); | 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" ) ); |
386 | 386 | ||
387 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); | 387 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); |
388 | btngrp-> insert ( m_tabstyle_top ); | 388 | btngrp-> insert ( m_tabstyle_top ); |
389 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); | 389 | 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." ) ); | 390 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); |
391 | 391 | ||
392 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); | 392 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); |
393 | btngrp-> insert ( m_tabstyle_bottom ); | 393 | btngrp-> insert ( m_tabstyle_bottom ); |
394 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); | 394 | 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." ) ); | 395 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); |
396 | 396 | ||
397 | m_tabstyle_top-> setChecked ( tabtop ); | 397 | m_tabstyle_top-> setChecked ( tabtop ); |
398 | m_tabstyle_bottom-> setChecked ( !tabtop ); | 398 | m_tabstyle_bottom-> setChecked ( !tabtop ); |
399 | 399 | ||
400 | m_original_tabstyle = style; | 400 | m_original_tabstyle = style; |
401 | m_original_tabpos = tabtop; | 401 | m_original_tabpos = tabtop; |
402 | 402 | ||
403 | return tab; | 403 | return tab; |
404 | } | 404 | } |
405 | 405 | ||
406 | 406 | ||
407 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 407 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
408 | : QDialog ( parent, name, true, WStyle_ContextHelp ) | 408 | : QDialog ( parent, name, true, WStyle_ContextHelp ) |
409 | { | 409 | { |
410 | setCaption( tr( "Appearance" ) ); | 410 | setCaption( tr( "Appearance" ) ); |
411 | 411 | ||
412 | Config config( "qpe" ); | 412 | Config config( "qpe" ); |
413 | config.setGroup( "Appearance" ); | 413 | config.setGroup( "Appearance" ); |
414 | 414 | ||
415 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); | 415 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); |
416 | 416 | ||
417 | m_sample = new SampleWindow ( this ); | 417 | m_sample = new SampleWindow ( this ); |
418 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 418 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
419 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 419 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
420 | 420 | ||
421 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 421 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
422 | QWidget *styletab; | 422 | QWidget *styletab; |
423 | 423 | ||
424 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance/style.png", tr( "Style" )); | 424 | m_color_list = 0; |
425 | tw-> addTab ( createFontTab ( tw, config ), "appearance/font.png", tr( "Font" )); | 425 | |
426 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color.png", tr( "Colors" ) ); | 426 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance/style", tr( "Style" )); |
427 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco.png", tr( "Windows" ) ); | 427 | tw-> addTab ( createFontTab ( tw, config ), "appearance/font", tr( "Font" )); |
428 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "appearance/advanced.png", tr( "Advanced" ) ); | 428 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); |
429 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); | ||
430 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "appearance/advanced", tr( "Advanced" ) ); | ||
429 | 431 | ||
430 | top-> addWidget ( tw, 10 ); | 432 | top-> addWidget ( tw, 10 ); |
431 | top-> addWidget ( m_sample, 1 ); | 433 | top-> addWidget ( m_sample, 1 ); |
432 | 434 | ||
433 | tw-> setCurrentTab ( styletab ); | 435 | tw-> setCurrentTab ( styletab ); |
434 | connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); | 436 | connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); |
435 | 437 | ||
436 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; | 438 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; |
437 | } | 439 | } |
438 | 440 | ||
439 | Appearance::~Appearance() | 441 | Appearance::~Appearance() |
440 | { | 442 | { |
441 | } | 443 | } |
442 | 444 | ||
443 | void Appearance::tabChanged ( QWidget *w ) | 445 | void Appearance::tabChanged ( QWidget *w ) |
444 | { | 446 | { |
445 | if ( w == m_advtab ) { | 447 | if ( w == m_advtab ) { |
446 | m_sample-> hide ( ); | 448 | m_sample-> hide ( ); |
447 | updateGeometry ( ); // shouldn't be necessary ... | 449 | updateGeometry ( ); // shouldn't be necessary ... |
448 | } | 450 | } |
449 | else | 451 | else |
450 | m_sample-> show ( ); | 452 | m_sample-> show ( ); |
451 | } | 453 | } |
452 | 454 | ||
453 | void Appearance::accept ( ) | 455 | void Appearance::accept ( ) |
454 | { | 456 | { |
455 | bool newtabpos = m_tabstyle_top-> isChecked ( ); | 457 | bool newtabpos = m_tabstyle_top-> isChecked ( ); |
456 | int newtabstyle = m_tabstyle_list-> currentItem ( ); | 458 | int newtabstyle = m_tabstyle_list-> currentItem ( ); |
457 | 459 | ||
458 | Config config ( "qpe" ); | 460 | Config config ( "qpe" ); |
459 | config. setGroup ( "Appearance" ); | 461 | config. setGroup ( "Appearance" ); |
460 | 462 | ||
461 | if ( m_style_changed ) { | 463 | if ( m_style_changed ) { |
462 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 464 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
463 | if ( item ) | 465 | if ( item ) |
464 | config.writeEntry( "Style", item-> key ( )); | 466 | config.writeEntry( "Style", item-> key ( )); |
465 | } | 467 | } |
466 | 468 | ||
467 | if ( m_deco_changed ) { | 469 | if ( m_deco_changed ) { |
468 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); | 470 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); |
469 | if ( item ) | 471 | if ( item ) |
470 | config.writeEntry( "Decoration", item-> key ( )); | 472 | config.writeEntry( "Decoration", item-> key ( )); |
471 | } | 473 | } |
472 | 474 | ||
473 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { | 475 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { |
474 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | 476 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); |
475 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); | 477 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); |
476 | } | 478 | } |
477 | 479 | ||
478 | if ( m_font_changed ) { | 480 | if ( m_font_changed ) { |
479 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); | 481 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); |
480 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); | 482 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); |
481 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); | 483 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); |
482 | } | 484 | } |
483 | 485 | ||
484 | 486 | ||
485 | if ( m_color_changed ) | 487 | if ( m_color_changed ) |
486 | { | 488 | { |
487 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 489 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
488 | 490 | ||
489 | if ( item ) | 491 | if ( item ) |
490 | item-> save ( config ); | 492 | item-> save ( config ); |
491 | } | 493 | } |
492 | 494 | ||
493 | 495 | ||
494 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated | 496 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated |
495 | 497 | ||
496 | QStringList sl; | 498 | QStringList sl; |
497 | QString exceptstr; | 499 | QString exceptstr; |
498 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { | 500 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) { |
499 | int fl = 0; | 501 | int fl = 0; |
500 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); | 502 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); |
501 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); | 503 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); |
502 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); | 504 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); |
503 | exceptstr = QString::number ( fl, 32 ); | 505 | exceptstr = QString::number ( fl, 32 ); |
504 | exceptstr.append( it-> pattern ( )); | 506 | exceptstr.append( it-> pattern ( )); |
505 | sl << exceptstr; | 507 | sl << exceptstr; |
506 | } | 508 | } |
507 | config. writeEntry ( "NoStyle", sl, ';' ); | 509 | config. writeEntry ( "NoStyle", sl, ';' ); |
508 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); | 510 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); |
509 | 511 | ||
510 | config. write ( ); // need to flush the config info first | 512 | config. write ( ); // need to flush the config info first |
511 | Global::applyStyle ( ); | 513 | Global::applyStyle ( ); |
512 | 514 | ||
513 | if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart %1 now?" ). arg ( ODevice::inst ( )-> system ( ) == System_Zaurus ? "Qtopia" : "Opie" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { | 515 | if ( QMessageBox::warning ( this, tr( "Restart" ), tr( "Do you want to restart %1 now?" ). arg ( ODevice::inst ( )-> system ( ) == System_Zaurus ? "Qtopia" : "Opie" ), tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) { |
514 | QCopEnvelope e( "QPE/System", "restart()" ); | 516 | QCopEnvelope e( "QPE/System", "restart()" ); |
515 | } | 517 | } |
516 | 518 | ||
517 | QDialog::accept ( ); | 519 | QDialog::accept ( ); |
518 | } | 520 | } |
519 | 521 | ||
520 | void Appearance::done ( int r ) | 522 | void Appearance::done ( int r ) |
521 | { | 523 | { |
522 | QDialog::done ( r ); | 524 | QDialog::done ( r ); |
523 | close ( ); | 525 | close ( ); |
524 | } | 526 | } |
525 | 527 | ||
526 | 528 | ||
527 | void Appearance::styleClicked ( int index ) | 529 | void Appearance::styleClicked ( int index ) |
528 | { | 530 | { |
529 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); | 531 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); |
530 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); | 532 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); |
531 | 533 | ||
532 | if ( m_sample && sli && sli-> style ( )) | 534 | if ( m_sample && sli && sli-> style ( )) { |
533 | m_sample-> setStyle2 ( sli-> style ( )); | 535 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; |
534 | 536 | ||
537 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); | ||
538 | } | ||
539 | |||
535 | m_style_changed |= ( index != m_original_style ); | 540 | m_style_changed |= ( index != m_original_style ); |
536 | } | 541 | } |
537 | 542 | ||
538 | void Appearance::styleSettingsClicked ( ) | 543 | void Appearance::styleSettingsClicked ( ) |
539 | { | 544 | { |
540 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 545 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
541 | 546 | ||
542 | if ( item && item-> hasSettings ( )) { | 547 | if ( item && item-> hasSettings ( )) { |
543 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); | 548 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); |
544 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); | 549 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); |
545 | 550 | ||
546 | QWidget *w = item-> settings ( d ); | 551 | QWidget *w = item-> settings ( d ); |
547 | 552 | ||
548 | if ( w ) { | 553 | if ( w ) { |
549 | vbox-> addWidget ( w ); | 554 | vbox-> addWidget ( w ); |
550 | 555 | ||
551 | d-> setCaption ( w-> caption ( )); | 556 | d-> setCaption ( w-> caption ( )); |
552 | 557 | ||
553 | d-> showMaximized ( ); | 558 | d-> showMaximized ( ); |
554 | bool accepted = ( d-> exec ( ) == QDialog::Accepted ); | 559 | bool accepted = ( d-> exec ( ) == QDialog::Accepted ); |
555 | 560 | ||
556 | if ( item-> setSettings ( accepted )) | 561 | if ( item-> setSettings ( accepted )) |
557 | m_style_changed = true; | 562 | m_style_changed = true; |
558 | } | 563 | } |
559 | delete d; | 564 | delete d; |
560 | } | 565 | } |
561 | } | 566 | } |
562 | 567 | ||
563 | void Appearance::decoClicked ( int index ) | 568 | void Appearance::decoClicked ( int index ) |
564 | { | 569 | { |
565 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); | 570 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); |
566 | 571 | ||
567 | if ( m_sample ) { | 572 | if ( m_sample ) { |
568 | if ( dli && dli-> interface ( )) | 573 | if ( dli && dli-> interface ( )) |
569 | m_sample-> setDecoration ( dli-> interface ( )); | 574 | m_sample-> setDecoration ( dli-> interface ( )); |
570 | else | 575 | else |
571 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 576 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
572 | m_sample-> repaint ( ); | 577 | m_sample-> repaint ( ); |
573 | } | 578 | } |
574 | m_deco_changed |= ( index != m_original_deco ); | 579 | m_deco_changed |= ( index != m_original_deco ); |
575 | } | 580 | } |
576 | 581 | ||
577 | void Appearance::fontClicked ( const QFont &f ) | 582 | void Appearance::fontClicked ( const QFont &f ) |
578 | { | 583 | { |
579 | m_font_changed |= ( f != m_sample-> font ( )); | 584 | m_font_changed |= ( f != m_sample-> font ( )); |
580 | m_sample-> setFont ( f ); | 585 | m_sample-> setFont ( f ); |
581 | } | 586 | } |
582 | 587 | ||
583 | void Appearance::colorClicked ( int index ) | 588 | void Appearance::colorClicked ( int index ) |
584 | { | 589 | { |
585 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); | 590 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); |
586 | 591 | ||
587 | if ( item ) | 592 | if ( item ) |
588 | m_sample-> setPalette ( item-> palette ( )); | 593 | m_sample-> setPalette ( item-> palette ( )); |
589 | 594 | ||
590 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); | 595 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); |
591 | } | 596 | } |
592 | 597 | ||
593 | 598 | ||
594 | void Appearance::editSchemeClicked ( ) | 599 | void Appearance::editSchemeClicked ( ) |
595 | { | 600 | { |
596 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 601 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
597 | 602 | ||
598 | int cnt = 0; | 603 | int cnt = 0; |
599 | QString labels [QColorGroup::NColorRoles]; | 604 | QString labels [QColorGroup::NColorRoles]; |
600 | QColor colors [QColorGroup::NColorRoles]; | 605 | QColor colors [QColorGroup::NColorRoles]; |
601 | 606 | ||
602 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { | 607 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { |
603 | QColor col = item-> color ( role ); | 608 | QColor col = item-> color ( role ); |
604 | 609 | ||
605 | if ( col. isValid ( )) { | 610 | if ( col. isValid ( )) { |
606 | labels [cnt] = item-> label ( role ); | 611 | labels [cnt] = item-> label ( role ); |
607 | colors [cnt] = col; | 612 | colors [cnt] = col; |
608 | 613 | ||
609 | cnt++; | 614 | cnt++; |
610 | } | 615 | } |
611 | } | 616 | } |
612 | 617 | ||
613 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); | 618 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); |
614 | editdlg-> showMaximized ( ); | 619 | editdlg-> showMaximized ( ); |
615 | if ( editdlg-> exec ( ) == QDialog::Accepted ) { | 620 | if ( editdlg-> exec ( ) == QDialog::Accepted ) { |
616 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); | 621 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); |
617 | cnt = 0; | 622 | cnt = 0; |
618 | 623 | ||
619 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { | 624 | for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) { |
620 | if ( item-> color ( role ). isValid ( )) { | 625 | if ( item-> color ( role ). isValid ( )) { |
621 | citem-> setColor ( role, colors [cnt] ); | 626 | citem-> setColor ( role, colors [cnt] ); |
622 | cnt++; | 627 | cnt++; |
623 | } | 628 | } |
624 | } | 629 | } |
625 | 630 | ||
626 | m_color_list-> setCurrentItem ( 0 ); | 631 | m_color_list-> setCurrentItem ( 0 ); |
627 | colorClicked ( 0 ); | 632 | colorClicked ( 0 ); |
628 | 633 | ||
629 | m_color_changed = true; | 634 | m_color_changed = true; |
630 | } | 635 | } |
631 | delete editdlg; | 636 | delete editdlg; |
632 | } | 637 | } |
633 | 638 | ||
634 | 639 | ||
635 | void Appearance::saveSchemeClicked() | 640 | void Appearance::saveSchemeClicked() |
636 | { | 641 | { |
637 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 642 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
638 | 643 | ||
639 | if ( !item ) | 644 | if ( !item ) |
640 | return; | 645 | return; |
641 | 646 | ||
642 | QDialog *d = new QDialog ( this, 0, true ); | 647 | QDialog *d = new QDialog ( this, 0, true ); |
643 | d-> setCaption ( tr( "Save Scheme" )); | 648 | d-> setCaption ( tr( "Save Scheme" )); |
644 | QLineEdit *ed = new QLineEdit ( d ); | 649 | QLineEdit *ed = new QLineEdit ( d ); |
645 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); | 650 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); |
646 | ed-> setFocus ( ); | 651 | ed-> setFocus ( ); |
647 | 652 | ||
648 | if ( d-> exec ( ) == QDialog::Accepted ) { | 653 | if ( d-> exec ( ) == QDialog::Accepted ) { |
649 | QString schemename = ed-> text ( ); | 654 | QString schemename = ed-> text ( ); |
650 | QString filestr = QPEApplication::qpeDir(); | 655 | QString filestr = QPEApplication::qpeDir(); |
651 | filestr.append( "/etc/colors/" ); | 656 | filestr.append( "/etc/colors/" ); |
652 | filestr.append( schemename ); | 657 | filestr.append( schemename ); |
653 | filestr.append( ".scheme" ); | 658 | filestr.append( ".scheme" ); |
654 | QFile file ( filestr ); | 659 | QFile file ( filestr ); |
655 | if ( !file. exists ( )) | 660 | if ( !file. exists ( )) |
656 | { | 661 | { |
657 | QPalette p = item-> palette ( ); | 662 | QPalette p = item-> palette ( ); |
658 | 663 | ||
659 | Config config ( file.name(), Config::File ); | 664 | Config config ( file.name(), Config::File ); |
660 | config. setGroup( "Colors" ); | 665 | config. setGroup( "Colors" ); |
661 | 666 | ||
662 | item-> save ( config ); | 667 | item-> save ( config ); |
663 | 668 | ||
664 | config. write ( ); // need to flush the config info first | 669 | config. write ( ); // need to flush the config info first |
665 | 670 | ||
666 | m_color_list-> insertItem ( new ColorListItem ( schemename, config )); | 671 | m_color_list-> insertItem ( new ColorListItem ( schemename, config )); |
667 | } | 672 | } |
668 | else | 673 | else |
669 | { | 674 | { |
670 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); | 675 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); |
671 | } | 676 | } |
672 | } | 677 | } |
673 | delete d; | 678 | delete d; |
674 | } | 679 | } |
675 | 680 | ||
676 | void Appearance::deleteSchemeClicked() | 681 | void Appearance::deleteSchemeClicked() |
677 | { | 682 | { |
678 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 683 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
679 | 684 | ||
680 | if ( !item ) | 685 | if ( !item ) |
681 | return; | 686 | return; |
682 | 687 | ||
683 | if ( m_color_list-> currentItem ( ) > 0 ) | 688 | if ( m_color_list-> currentItem ( ) > 0 ) |
684 | { | 689 | { |
685 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) | 690 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) |
686 | { | 691 | { |
687 | QString filestr = QPEApplication::qpeDir ( ); | 692 | QString filestr = QPEApplication::qpeDir ( ); |
688 | filestr.append( "/etc/colors/" ); | 693 | filestr.append( "/etc/colors/" ); |
689 | filestr.append( item-> text ( ) ); | 694 | filestr.append( item-> text ( ) ); |
690 | filestr.append( ".scheme" ); | 695 | filestr.append( ".scheme" ); |
691 | QFile::remove ( filestr ); | 696 | QFile::remove ( filestr ); |
692 | delete item; | 697 | delete item; |
693 | } | 698 | } |
694 | } | 699 | } |
695 | else | 700 | else |
696 | { | 701 | { |
697 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); | 702 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); |
698 | } | 703 | } |
699 | } | 704 | } |
700 | 705 | ||
701 | 706 | ||
702 | void Appearance::addExcept ( ) | 707 | void Appearance::addExcept ( ) |
703 | { | 708 | { |
704 | ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true ); | 709 | ExceptListItem *it = new ExceptListItem ( m_except, 0, tr( "<new>" ), true, true, true ); |
705 | m_except-> ensureItemVisible ( it ); | 710 | m_except-> ensureItemVisible ( it ); |
706 | m_except-> setSelected ( it, true ); | 711 | m_except-> setSelected ( it, true ); |
707 | } | 712 | } |
708 | 713 | ||
709 | void Appearance::delExcept ( ) | 714 | void Appearance::delExcept ( ) |
710 | { | 715 | { |
711 | if ( m_except-> selectedItem ( )) { | 716 | if ( m_except-> selectedItem ( )) { |
712 | m_except-> setFocus ( ); | 717 | m_except-> setFocus ( ); |
713 | delete m_except-> selectedItem ( ); | 718 | delete m_except-> selectedItem ( ); |
714 | } | 719 | } |
715 | } | 720 | } |
716 | 721 | ||
717 | void Appearance::upExcept ( ) | 722 | void Appearance::upExcept ( ) |
718 | { | 723 | { |
719 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); | 724 | ExceptListItem *it = (ExceptListItem *) m_except-> selectedItem ( ); |
720 | 725 | ||
721 | if ( it && it-> itemAbove ( )) | 726 | if ( it && it-> itemAbove ( )) |
722 | it-> itemAbove ( )-> moveItem ( it ); | 727 | it-> itemAbove ( )-> moveItem ( it ); |
723 | } | 728 | } |
724 | 729 | ||
725 | void Appearance::downExcept ( ) | 730 | void Appearance::downExcept ( ) |
726 | { | 731 | { |
diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp index 6bbed4b..b3a9d48 100644 --- a/noncore/settings/appearance2/sample.cpp +++ b/noncore/settings/appearance2/sample.cpp | |||
@@ -1,271 +1,271 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | 3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qvbox.h> | 29 | #include <qvbox.h> |
30 | #include <qpopupmenu.h> | 30 | #include <qpopupmenu.h> |
31 | #include <qpainter.h> | 31 | #include <qpainter.h> |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | #include <qscrollbar.h> | 35 | #include <qscrollbar.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qwhatsthis.h> | 37 | #include <qwhatsthis.h> |
38 | #include <qpixmapcache.h> | 38 | #include <qpixmapcache.h> |
39 | #include <qtimer.h> | 39 | #include <qtimer.h> |
40 | #include <qobjectlist.h> | 40 | #include <qobjectlist.h> |
41 | #include <qcommonstyle.h> | 41 | #include <qcommonstyle.h> |
42 | 42 | ||
43 | #include "sample.h" | 43 | #include "sample.h" |
44 | 44 | ||
45 | 45 | ||
46 | class SampleText : public QWidget | 46 | class SampleText : public QWidget |
47 | { | 47 | { |
48 | public: | 48 | public: |
49 | SampleText( const QString &t, bool h, QWidget *parent ) | 49 | SampleText( const QString &t, bool h, QWidget *parent ) |
50 | : QWidget( parent ), hl(h), text(t) | 50 | : QWidget( parent ), hl(h), text(t) |
51 | { | 51 | { |
52 | if ( hl ) | 52 | if ( hl ) |
53 | setBackgroundMode( PaletteHighlight ); | 53 | setBackgroundMode( PaletteHighlight ); |
54 | else | 54 | else |
55 | setBackgroundMode( PaletteBase ); | 55 | setBackgroundMode( PaletteBase ); |
56 | } | 56 | } |
57 | 57 | ||
58 | QSize sizeHint() const | 58 | QSize sizeHint() const |
59 | { | 59 | { |
60 | QFontMetrics fm(font()); | 60 | QFontMetrics fm(font()); |
61 | return QSize( fm.width(text)+10, fm.height()+4 ); | 61 | return QSize( fm.width(text)+10, fm.height()+4 ); |
62 | } | 62 | } |
63 | 63 | ||
64 | void paintEvent( QPaintEvent * ) | 64 | void paintEvent( QPaintEvent * ) |
65 | { | 65 | { |
66 | QPainter p(this); | 66 | QPainter p(this); |
67 | if ( hl ) | 67 | if ( hl ) |
68 | p.setPen( colorGroup().highlightedText() ); | 68 | p.setPen( colorGroup().highlightedText() ); |
69 | else | 69 | else |
70 | p.setPen( colorGroup().text() ); | 70 | p.setPen( colorGroup().text() ); |
71 | p.drawText( rect(), AlignCenter, text ); | 71 | p.drawText( rect(), AlignCenter, text ); |
72 | } | 72 | } |
73 | 73 | ||
74 | private: | 74 | private: |
75 | bool hl; | 75 | bool hl; |
76 | QString text; | 76 | QString text; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0) | 80 | SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0) |
81 | { | 81 | { |
82 | init(); | 82 | init(); |
83 | } | 83 | } |
84 | 84 | ||
85 | QSize SampleWindow::sizeHint() const | 85 | QSize SampleWindow::sizeHint() const |
86 | { | 86 | { |
87 | return container->sizeHint() + QSize( 10, 35 ); | 87 | return container->sizeHint() + QSize( 10, 35 ); |
88 | } | 88 | } |
89 | 89 | ||
90 | void SampleWindow::setFont( const QFont &f ) | 90 | void SampleWindow::setFont( const QFont &f ) |
91 | { | 91 | { |
92 | QWidget::setFont( f ); | 92 | QWidget::setFont( f ); |
93 | popup->setFont( f ); | 93 | popup->setFont( f ); |
94 | QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); | 94 | QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); |
95 | } | 95 | } |
96 | 96 | ||
97 | static void setStyleRecursive ( QWidget *w, QStyle *s ) | 97 | static void setStyleRecursive ( QWidget *w, QStyle *s ) |
98 | { | 98 | { |
99 | w->setStyle( s ); | 99 | w->setStyle( s ); |
100 | QObjectList *childObjects=(QObjectList*)w->children(); | 100 | QObjectList *childObjects=(QObjectList*)w->children(); |
101 | if ( childObjects ) { | 101 | if ( childObjects ) { |
102 | QObject * o; | 102 | QObject * o; |
103 | for(o=childObjects->first();o!=0;o=childObjects->next()) { | 103 | for(o=childObjects->first();o!=0;o=childObjects->next()) { |
104 | if( o->isWidgetType() ) { | 104 | if( o->isWidgetType() ) { |
105 | setStyleRecursive((QWidget *)o,s); | 105 | setStyleRecursive((QWidget *)o,s); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | void SampleWindow::setStyle2 ( QStyle *sty ) | 112 | void SampleWindow::setStyle2 ( QStyle *sty, const QPalette &pal ) |
113 | { | 113 | { |
114 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); | 114 | typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, QColorGroup &, bool, bool); |
115 | 115 | ||
116 | extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); | 116 | extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl); |
117 | 117 | ||
118 | QPixmapCache::clear ( ); | 118 | QPixmapCache::clear ( ); |
119 | QPalette p = palette ( ); | 119 | QPalette p = pal; // ette ( ); |
120 | sty-> polish ( p ); | 120 | sty-> polish ( p ); |
121 | qt_set_draw_menu_bar_impl ( 0 ); | 121 | qt_set_draw_menu_bar_impl ( 0 ); |
122 | setStyleRecursive ( this, sty ); | 122 | setStyleRecursive ( this, sty ); |
123 | setPalette ( p ); | 123 | setPalette ( p ); |
124 | QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); | 124 | QTimer::singleShot ( 0, this, SLOT( fixGeometry ( ))); |
125 | } | 125 | } |
126 | 126 | ||
127 | 127 | ||
128 | void SampleWindow::setDecoration( WindowDecorationInterface *i ) | 128 | void SampleWindow::setDecoration( WindowDecorationInterface *i ) |
129 | { | 129 | { |
130 | iface = i; | 130 | iface = i; |
131 | wd.rect = QRect( 0, 0, 150, 75 ); | 131 | wd.rect = QRect( 0, 0, 150, 75 ); |
132 | wd.caption = tr("Sample"); | 132 | wd.caption = tr("Sample"); |
133 | wd.palette = palette(); | 133 | wd.palette = palette(); |
134 | wd.flags = WindowDecorationInterface::WindowData::Dialog | | 134 | wd.flags = WindowDecorationInterface::WindowData::Dialog | |
135 | WindowDecorationInterface::WindowData::Active; | 135 | WindowDecorationInterface::WindowData::Active; |
136 | wd.reserved = 1; | 136 | wd.reserved = 1; |
137 | 137 | ||
138 | th = iface->metric(WindowDecorationInterface::TitleHeight, &wd); | 138 | th = iface->metric(WindowDecorationInterface::TitleHeight, &wd); |
139 | tb = iface->metric(WindowDecorationInterface::TopBorder, &wd); | 139 | tb = iface->metric(WindowDecorationInterface::TopBorder, &wd); |
140 | lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd); | 140 | lb = iface->metric(WindowDecorationInterface::LeftBorder, &wd); |
141 | rb = iface->metric(WindowDecorationInterface::RightBorder, &wd); | 141 | rb = iface->metric(WindowDecorationInterface::RightBorder, &wd); |
142 | bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd); | 142 | bb = iface->metric(WindowDecorationInterface::BottomBorder, &wd); |
143 | 143 | ||
144 | int yoff = th + tb; | 144 | int yoff = th + tb; |
145 | int xoff = lb; | 145 | int xoff = lb; |
146 | 146 | ||
147 | wd.rect.setX( 0 ); | 147 | wd.rect.setX( 0 ); |
148 | wd.rect.setWidth( width() - lb - rb ); | 148 | wd.rect.setWidth( width() - lb - rb ); |
149 | wd.rect.setY( 0 ); | 149 | wd.rect.setY( 0 ); |
150 | wd.rect.setHeight( height() - yoff - bb ); | 150 | wd.rect.setHeight( height() - yoff - bb ); |
151 | 151 | ||
152 | container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() ); | 152 | container->setGeometry( xoff, yoff, wd.rect.width(), wd.rect.height() ); |
153 | setMinimumSize( container->sizeHint().width()+lb+rb, | 153 | setMinimumSize( container->sizeHint().width()+lb+rb, |
154 | container->sizeHint().height()+tb+th+bb ); | 154 | container->sizeHint().height()+tb+th+bb ); |
155 | } | 155 | } |
156 | 156 | ||
157 | void SampleWindow::paintEvent( QPaintEvent * ) | 157 | void SampleWindow::paintEvent( QPaintEvent * ) |
158 | { | 158 | { |
159 | if ( !iface ) | 159 | if ( !iface ) |
160 | return; | 160 | return; |
161 | 161 | ||
162 | QPainter p( this ); | 162 | QPainter p( this ); |
163 | 163 | ||
164 | p.translate( lb, th+tb ); | 164 | p.translate( lb, th+tb ); |
165 | 165 | ||
166 | iface->drawArea(WindowDecorationInterface::Border, &p, &wd); | 166 | iface->drawArea(WindowDecorationInterface::Border, &p, &wd); |
167 | iface->drawArea(WindowDecorationInterface::Title, &p, &wd); | 167 | iface->drawArea(WindowDecorationInterface::Title, &p, &wd); |
168 | 168 | ||
169 | p.setPen(palette().active().color(QColorGroup::HighlightedText)); | 169 | p.setPen(palette().active().color(QColorGroup::HighlightedText)); |
170 | QFont f( font() ); | 170 | QFont f( font() ); |
171 | f.setWeight( QFont::Bold ); | 171 | f.setWeight( QFont::Bold ); |
172 | p.setFont(f); | 172 | p.setFont(f); |
173 | iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd); | 173 | iface->drawArea(WindowDecorationInterface::TitleText, &p, &wd); |
174 | 174 | ||
175 | QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th ); | 175 | QRect brect( 0, -th, iface->metric(WindowDecorationInterface::HelpWidth,&wd), th ); |
176 | iface->drawButton( WindowDecorationInterface::Help, &p, &wd, | 176 | iface->drawButton( WindowDecorationInterface::Help, &p, &wd, |
177 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); | 177 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); |
178 | brect.moveBy( wd.rect.width() - | 178 | brect.moveBy( wd.rect.width() - |
179 | iface->metric(WindowDecorationInterface::OKWidth,&wd) - | 179 | iface->metric(WindowDecorationInterface::OKWidth,&wd) - |
180 | iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); | 180 | iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); |
181 | iface->drawButton( WindowDecorationInterface::Close, &p, &wd, | 181 | iface->drawButton( WindowDecorationInterface::Close, &p, &wd, |
182 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); | 182 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); |
183 | brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); | 183 | brect.moveBy( iface->metric(WindowDecorationInterface::CloseWidth,&wd), 0 ); |
184 | iface->drawButton( WindowDecorationInterface::OK, &p, &wd, | 184 | iface->drawButton( WindowDecorationInterface::OK, &p, &wd, |
185 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); | 185 | brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)0 ); |
186 | } | 186 | } |
187 | 187 | ||
188 | void SampleWindow::init() | 188 | void SampleWindow::init() |
189 | { | 189 | { |
190 | container = new QVBox( this ); | 190 | container = new QVBox( this ); |
191 | popup = new QPopupMenu( this ); | 191 | popup = new QPopupMenu( this ); |
192 | popup->insertItem( tr("Normal Item"), 1 ); | 192 | popup->insertItem( tr("Normal Item"), 1 ); |
193 | popup->insertItem( tr("Disabled Item"), 2 ); | 193 | popup->insertItem( tr("Disabled Item"), 2 ); |
194 | popup->setItemEnabled(2, FALSE); | 194 | popup->setItemEnabled(2, FALSE); |
195 | QMenuBar *mb = new QMenuBar( container ); | 195 | QMenuBar *mb = new QMenuBar( container ); |
196 | mb->insertItem( tr("Menu"), popup ); | 196 | mb->insertItem( tr("Menu"), popup ); |
197 | QHBox *hb = new QHBox( container ); | 197 | QHBox *hb = new QHBox( container ); |
198 | QWidget *w = new QWidget( hb ); | 198 | QWidget *w = new QWidget( hb ); |
199 | (void)new QScrollBar( 0, 0, 0, 0, 0, Vertical, hb ); | 199 | (void)new QScrollBar( 0, 0, 0, 0, 0, Vertical, hb ); |
200 | 200 | ||
201 | QGridLayout *gl = new QGridLayout( w, 2, 2, 4 ); | 201 | QGridLayout *gl = new QGridLayout( w, 2, 2, 4 ); |
202 | SampleText *l = new SampleText( tr("Normal Text"), FALSE, w ); | 202 | SampleText *l = new SampleText( tr("Normal Text"), FALSE, w ); |
203 | gl->addWidget( l, 0, 0 ); | 203 | gl->addWidget( l, 0, 0 ); |
204 | 204 | ||
205 | l = new SampleText( tr("Highlighted Text"), TRUE, w ); | 205 | l = new SampleText( tr("Highlighted Text"), TRUE, w ); |
206 | gl->addWidget( l, 1, 0 ); | 206 | gl->addWidget( l, 1, 0 ); |
207 | 207 | ||
208 | QPushButton *pb = new QPushButton( tr("Button"), w ); | 208 | QPushButton *pb = new QPushButton( tr("Button"), w ); |
209 | gl->addWidget( pb, 0, 1 ); | 209 | gl->addWidget( pb, 0, 1 ); |
210 | pb->setFocusPolicy( NoFocus ); | 210 | pb->setFocusPolicy( NoFocus ); |
211 | 211 | ||
212 | QCheckBox *cb = new QCheckBox( tr("Check Box"), w ); | 212 | QCheckBox *cb = new QCheckBox( tr("Check Box"), w ); |
213 | gl->addWidget( cb, 1, 1 ); | 213 | gl->addWidget( cb, 1, 1 ); |
214 | cb->setFocusPolicy( NoFocus ); | 214 | cb->setFocusPolicy( NoFocus ); |
215 | cb->setChecked( TRUE ); | 215 | cb->setChecked( TRUE ); |
216 | 216 | ||
217 | QWhatsThis::add( this, tr("Sample window using the selected settings.") ); | 217 | QWhatsThis::add( this, tr("Sample window using the selected settings.") ); |
218 | } | 218 | } |
219 | 219 | ||
220 | bool SampleWindow::eventFilter( QObject *, QEvent *e ) | 220 | bool SampleWindow::eventFilter( QObject *, QEvent *e ) |
221 | { | 221 | { |
222 | switch ( e->type() ) { | 222 | switch ( e->type() ) { |
223 | case QEvent::MouseButtonPress: | 223 | case QEvent::MouseButtonPress: |
224 | case QEvent::MouseButtonRelease: | 224 | case QEvent::MouseButtonRelease: |
225 | case QEvent::MouseButtonDblClick: | 225 | case QEvent::MouseButtonDblClick: |
226 | case QEvent::MouseMove: | 226 | case QEvent::MouseMove: |
227 | case QEvent::KeyPress: | 227 | case QEvent::KeyPress: |
228 | case QEvent::KeyRelease: | 228 | case QEvent::KeyRelease: |
229 | return TRUE; | 229 | return TRUE; |
230 | default: | 230 | default: |
231 | break; | 231 | break; |
232 | } | 232 | } |
233 | 233 | ||
234 | return FALSE; | 234 | return FALSE; |
235 | } | 235 | } |
236 | 236 | ||
237 | void SampleWindow::paletteChange( const QPalette &old ) | 237 | void SampleWindow::paletteChange( const QPalette &old ) |
238 | { | 238 | { |
239 | QWidget::paletteChange ( old ); | 239 | QWidget::paletteChange ( old ); |
240 | wd. palette = palette ( ); | 240 | wd. palette = palette ( ); |
241 | popup-> setPalette ( palette ( )); | 241 | popup-> setPalette ( palette ( )); |
242 | } | 242 | } |
243 | 243 | ||
244 | 244 | ||
245 | void SampleWindow::setPalette ( const QPalette &pal ) | 245 | void SampleWindow::setPalette ( const QPalette &pal ) |
246 | { | 246 | { |
247 | QPixmapCache::clear ( ); | 247 | QPixmapCache::clear ( ); |
248 | QPalette p = pal; | 248 | QPalette p = pal; |
249 | style ( ). polish ( p ); | 249 | style ( ). polish ( p ); |
250 | QWidget::setPalette ( p ); | 250 | QWidget::setPalette ( p ); |
251 | } | 251 | } |
252 | 252 | ||
253 | void SampleWindow::resizeEvent( QResizeEvent *re ) | 253 | void SampleWindow::resizeEvent( QResizeEvent *re ) |
254 | { | 254 | { |
255 | wd.rect = QRect( 0, 0, 150, 75 ); | 255 | wd.rect = QRect( 0, 0, 150, 75 ); |
256 | 256 | ||
257 | wd.rect.setX( 0 ); | 257 | wd.rect.setX( 0 ); |
258 | wd.rect.setWidth( width() - lb - rb ); | 258 | wd.rect.setWidth( width() - lb - rb ); |
259 | wd.rect.setY( 0 ); | 259 | wd.rect.setY( 0 ); |
260 | wd.rect.setHeight( height() - th - tb - bb ); | 260 | wd.rect.setHeight( height() - th - tb - bb ); |
261 | 261 | ||
262 | container->setGeometry( lb, th+tb, wd.rect.width(), wd.rect.height() ); | 262 | container->setGeometry( lb, th+tb, wd.rect.width(), wd.rect.height() ); |
263 | QWidget::resizeEvent( re ); | 263 | QWidget::resizeEvent( re ); |
264 | } | 264 | } |
265 | 265 | ||
266 | void SampleWindow::fixGeometry() | 266 | void SampleWindow::fixGeometry() |
267 | { | 267 | { |
268 | setMinimumSize( container->sizeHint().width()+lb+rb, | 268 | setMinimumSize( container->sizeHint().width()+lb+rb, |
269 | container->sizeHint().height()+tb+th+bb ); | 269 | container->sizeHint().height()+tb+th+bb ); |
270 | } | 270 | } |
271 | 271 | ||
diff --git a/noncore/settings/appearance2/sample.h b/noncore/settings/appearance2/sample.h index c861228..27e6db5 100644 --- a/noncore/settings/appearance2/sample.h +++ b/noncore/settings/appearance2/sample.h | |||
@@ -1,77 +1,77 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | 3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef __PREVIEW_H__ | 29 | #ifndef __PREVIEW_H__ |
30 | #define __PREVIEW_H__ | 30 | #define __PREVIEW_H__ |
31 | 31 | ||
32 | #include <qwidget.h> | 32 | #include <qwidget.h> |
33 | 33 | ||
34 | #include <qpe/windowdecorationinterface.h> | 34 | #include <qpe/windowdecorationinterface.h> |
35 | 35 | ||
36 | class QVBox; | 36 | class QVBox; |
37 | class QPopupMenu; | 37 | class QPopupMenu; |
38 | class SampleText; | 38 | class SampleText; |
39 | 39 | ||
40 | class SampleWindow : public QWidget | 40 | class SampleWindow : public QWidget |
41 | { | 41 | { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | public: | 43 | public: |
44 | SampleWindow( QWidget *parent ); | 44 | SampleWindow( QWidget *parent ); |
45 | 45 | ||
46 | QSize sizeHint() const; | 46 | QSize sizeHint() const; |
47 | 47 | ||
48 | virtual void setFont( const QFont &f ); | 48 | virtual void setFont( const QFont &f ); |
49 | 49 | ||
50 | void setStyle2 ( QStyle *sty ); | 50 | void setStyle2 ( QStyle *sty, const QPalette &p ); |
51 | void setDecoration( WindowDecorationInterface *i ); | 51 | void setDecoration( WindowDecorationInterface *i ); |
52 | void setPalette ( const QPalette & ); | 52 | void setPalette ( const QPalette & ); |
53 | 53 | ||
54 | virtual void paintEvent( QPaintEvent * ); | 54 | virtual void paintEvent( QPaintEvent * ); |
55 | 55 | ||
56 | void init(); | 56 | void init(); |
57 | 57 | ||
58 | virtual bool eventFilter( QObject *, QEvent *e ); | 58 | virtual bool eventFilter( QObject *, QEvent *e ); |
59 | virtual void paletteChange( const QPalette &old ); | 59 | virtual void paletteChange( const QPalette &old ); |
60 | virtual void resizeEvent( QResizeEvent *re ); | 60 | virtual void resizeEvent( QResizeEvent *re ); |
61 | 61 | ||
62 | public slots: | 62 | public slots: |
63 | void fixGeometry(); | 63 | void fixGeometry(); |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | WindowDecorationInterface *iface; | 66 | WindowDecorationInterface *iface; |
67 | WindowDecorationInterface::WindowData wd; | 67 | WindowDecorationInterface::WindowData wd; |
68 | QVBox *container; | 68 | QVBox *container; |
69 | QPopupMenu *popup; | 69 | QPopupMenu *popup; |
70 | int th; | 70 | int th; |
71 | int tb; | 71 | int tb; |
72 | int lb; | 72 | int lb; |
73 | int rb; | 73 | int rb; |
74 | int bb; | 74 | int bb; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | #endif | 77 | #endif |