Diffstat (limited to 'noncore/settings/appearance2/appearance.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 174 |
1 files changed, 25 insertions, 149 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index cf3069e..23630c5 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -59,38 +59,30 @@ | |||
59 | #include <qpe/qpestyle.h> | 59 | #include <qpe/qpestyle.h> |
60 | #include <qpe/lightstyle.h> | 60 | #include <qpe/lightstyle.h> |
61 | #include <qpe/qlibrary.h> | 61 | #include <qpe/qlibrary.h> |
62 | #include <qpe/styleinterface.h> | 62 | #include <qpe/styleinterface.h> |
63 | #endif | 63 | #endif |
64 | #include <qtabwidget.h> | 64 | #include <qtabwidget.h> |
65 | #include <qtoolbutton.h> | 65 | #include <qtoolbutton.h> |
66 | #include <qvgroupbox.h> | 66 | #include <qvgroupbox.h> |
67 | #include <qwidget.h> | 67 | #include <qwidget.h> |
68 | 68 | ||
69 | #include "stylelistitem.h" | 69 | #include "stylelistitem.h" |
70 | #include "decolistitem.h" | 70 | #include "decolistitem.h" |
71 | #include "fontlistitem.h" | ||
72 | #include "colorlistitem.h" | 71 | #include "colorlistitem.h" |
73 | 72 | ||
74 | #include "sample.h" | 73 | #include "sample.h" |
75 | 74 | ||
75 | #include <opie/ofontselector.h> | ||
76 | 76 | ||
77 | static int findItemCB ( QComboBox *box, const QString &str ) | ||
78 | { | ||
79 | for ( int i = 0; i < box-> count ( ); i++ ) { | ||
80 | if ( box-> text ( i ) == str ) | ||
81 | return i; | ||
82 | } | ||
83 | return -1; | ||
84 | } | ||
85 | 77 | ||
86 | class DefaultWindowDecoration : public WindowDecorationInterface | 78 | class DefaultWindowDecoration : public WindowDecorationInterface |
87 | { | 79 | { |
88 | public: | 80 | public: |
89 | DefaultWindowDecoration() : ref(0) {} | 81 | DefaultWindowDecoration() : ref(0) {} |
90 | QString name() const { | 82 | QString name() const { |
91 | return "Default"; | 83 | return "Default"; |
92 | } | 84 | } |
93 | QPixmap icon() const { | 85 | QPixmap icon() const { |
94 | return QPixmap(); | 86 | return QPixmap(); |
95 | } | 87 | } |
96 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | 88 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { |
@@ -183,33 +175,24 @@ void Appearance::loadColors ( QListBox *list ) | |||
183 | QString path = QPEApplication::qpeDir ( ) + "/etc/colors/"; | 175 | QString path = QPEApplication::qpeDir ( ) + "/etc/colors/"; |
184 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); | 176 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); |
185 | 177 | ||
186 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 178 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { |
187 | QString name = (*it). left ((*it). find ( ".scheme" )); | 179 | QString name = (*it). left ((*it). find ( ".scheme" )); |
188 | Config config ( path + *it, Config::File ); | 180 | Config config ( path + *it, Config::File ); |
189 | config. setGroup ( "Colors" ); | 181 | config. setGroup ( "Colors" ); |
190 | 182 | ||
191 | list-> insertItem ( new ColorListItem ( name, config )); | 183 | list-> insertItem ( new ColorListItem ( name, config )); |
192 | } | 184 | } |
193 | } | 185 | } |
194 | 186 | ||
195 | void Appearance::loadFonts ( QListBox *list ) | ||
196 | { | ||
197 | FontDatabase fd; | ||
198 | QStringList f = fd. families ( ); | ||
199 | |||
200 | for ( QStringList::ConstIterator it = f. begin ( ); it != f. end ( ); ++it ) | ||
201 | list-> insertItem ( new FontListItem ( *it, fd. styles ( *it ), fd. pointSizes ( *it ))); | ||
202 | } | ||
203 | |||
204 | 187 | ||
205 | QWidget *Appearance::createStyleTab ( QWidget *parent ) | 188 | QWidget *Appearance::createStyleTab ( QWidget *parent ) |
206 | { | 189 | { |
207 | Config config ( "qpe" ); | 190 | Config config ( "qpe" ); |
208 | config. setGroup ( "Appearance" ); | 191 | config. setGroup ( "Appearance" ); |
209 | 192 | ||
210 | QWidget* tab = new QWidget( parent, "StyleTab" ); | 193 | QWidget* tab = new QWidget( parent, "StyleTab" ); |
211 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 ); | 194 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 4, 4 ); |
212 | 195 | ||
213 | m_style_list = new QListBox( tab, "m_style_list" ); | 196 | m_style_list = new QListBox( tab, "m_style_list" ); |
214 | vertLayout->addWidget( m_style_list ); | 197 | vertLayout->addWidget( m_style_list ); |
215 | 198 | ||
@@ -250,70 +233,35 @@ QWidget *Appearance::createDecoTab ( QWidget *parent ) | |||
250 | decoClicked ( m_original_deco ); | 233 | decoClicked ( m_original_deco ); |
251 | 234 | ||
252 | connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); | 235 | connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); |
253 | 236 | ||
254 | return tab; | 237 | return tab; |
255 | } | 238 | } |
256 | 239 | ||
257 | QWidget *Appearance::createFontTab ( QWidget *parent ) | 240 | QWidget *Appearance::createFontTab ( QWidget *parent ) |
258 | { | 241 | { |
259 | Config config ( "qpe" ); | 242 | Config config ( "qpe" ); |
260 | config. setGroup ( "Appearance" ); | 243 | config. setGroup ( "Appearance" ); |
261 | 244 | ||
262 | |||
263 | QWidget *tab = new QWidget( parent, "FontTab" ); | ||
264 | QGridLayout *gridLayout = new QGridLayout ( tab, 0, 0, 4, 4 ); | ||
265 | gridLayout->setRowStretch ( 4, 10 ); | ||
266 | |||
267 | m_font_family_list = new QListBox( tab, "FontListBox" ); | ||
268 | gridLayout->addMultiCellWidget( m_font_family_list, 0, 4, 0, 0 ); | ||
269 | connect( m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); | ||
270 | |||
271 | QLabel *label = new QLabel( tr( "Style" ), tab ); | ||
272 | gridLayout->addWidget( label, 0, 1 ); | ||
273 | |||
274 | m_font_style_list = new QComboBox( tab, "StyleListBox" ); | ||
275 | connect( m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); | ||
276 | gridLayout->addWidget( m_font_style_list, 1, 1 ); | ||
277 | |||
278 | label = new QLabel( tr( "Size" ), tab ); | ||
279 | gridLayout->addWidget( label, 2, 1 ); | ||
280 | |||
281 | m_font_size_list = new QComboBox( tab, "SizeListBox" ); | ||
282 | connect( m_font_size_list, SIGNAL( activated( int ) ), | ||
283 | this, SLOT( fontSizeClicked( int ) ) ); | ||
284 | gridLayout->addWidget( m_font_size_list, 3, 1 ); | ||
285 | |||
286 | loadFonts ( m_font_family_list ); | ||
287 | |||
288 | QString familyStr = config.readEntry( "FontFamily", "Helvetica" ); | 245 | QString familyStr = config.readEntry( "FontFamily", "Helvetica" ); |
289 | QString styleStr = config.readEntry( "FontStyle", "Regular" ); | 246 | QString styleStr = config.readEntry( "FontStyle", "Regular" ); |
290 | QString sizeStr = config.readEntry( "FontSize", "10" ); | 247 | int size = config.readNumEntry( "FontSize", 10 ); |
291 | 248 | ||
292 | m_font_family_list-> setCurrentItem ( m_font_family_list-> findItem ( familyStr )); | 249 | m_fontselect = new OFontSelector ( parent, "FontTab" ); |
293 | m_original_fontfamily = m_font_family_list-> currentItem ( ); | 250 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); |
294 | if ( m_font_family_list-> currentItem ( ) < 0 ) | ||
295 | m_font_family_list-> setCurrentItem ( 0 ); | ||
296 | 251 | ||
297 | fontFamilyClicked ( m_original_fontfamily ); | 252 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), |
253 | this, SLOT( fontClicked ( const QFont & ))); | ||
298 | 254 | ||
299 | m_font_style_list-> setCurrentItem ( findItemCB ( m_font_style_list, styleStr )); | 255 | return m_fontselect; |
300 | m_original_fontstyle = m_font_style_list-> currentItem ( ); | ||
301 | fontStyleClicked ( m_original_fontstyle ); | ||
302 | |||
303 | m_font_size_list-> setCurrentItem ( findItemCB ( m_font_size_list, sizeStr )); | ||
304 | m_original_fontsize = m_font_size_list-> currentItem ( ); | ||
305 | fontSizeClicked ( m_original_fontsize ); | ||
306 | |||
307 | return tab; | ||
308 | } | 256 | } |
309 | 257 | ||
310 | QWidget *Appearance::createColorTab ( QWidget *parent ) | 258 | QWidget *Appearance::createColorTab ( QWidget *parent ) |
311 | { | 259 | { |
312 | Config config ( "qpe" ); | 260 | Config config ( "qpe" ); |
313 | config. setGroup ( "Appearance" ); | 261 | config. setGroup ( "Appearance" ); |
314 | 262 | ||
315 | 263 | ||
316 | QWidget *tab = new QWidget( parent, "ColorTab" ); | 264 | QWidget *tab = new QWidget( parent, "ColorTab" ); |
317 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 4, 4 ); | 265 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 4, 4 ); |
318 | gridLayout->setRowStretch ( 3, 10 ); | 266 | gridLayout->setRowStretch ( 3, 10 ); |
319 | 267 | ||
@@ -343,53 +291,54 @@ QWidget *Appearance::createColorTab ( QWidget *parent ) | |||
343 | } | 291 | } |
344 | 292 | ||
345 | QWidget *Appearance::createGuiTab ( QWidget *parent ) | 293 | QWidget *Appearance::createGuiTab ( QWidget *parent ) |
346 | { | 294 | { |
347 | Config config ( "qpe" ); | 295 | Config config ( "qpe" ); |
348 | config. setGroup ( "Appearance" ); | 296 | config. setGroup ( "Appearance" ); |
349 | 297 | ||
350 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); | 298 | QWidget *tab = new QWidget( parent, "AdvancedTab" ); |
351 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); | 299 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 ); |
352 | 300 | ||
353 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 301 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
354 | 302 | ||
355 | int style = config. readNumEntry ( "TabStyle", 2 ); | 303 | int style = config. readNumEntry ( "TabStyle", 2 ) - 1; |
304 | bool tabtop = ( config. readEntry ( "TabPosition", "Top" ) == "Top" ); | ||
356 | 305 | ||
357 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); | 306 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); |
358 | gridLayout-> addWidget ( label, 0, 0 ); | 307 | gridLayout-> addWidget ( label, 0, 0 ); |
359 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); | 308 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); |
360 | btngrp-> hide ( ); | 309 | btngrp-> hide ( ); |
361 | btngrp-> setExclusive ( true ); | 310 | btngrp-> setExclusive ( true ); |
362 | 311 | ||
363 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); | 312 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); |
364 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); | 313 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); |
365 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); | 314 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); |
366 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); | 315 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); |
367 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); | 316 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); |
368 | m_tabstyle_list-> setCurrentItem ( style & 0xff ); | 317 | m_tabstyle_list-> setCurrentItem ( style ); |
369 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 318 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); |
370 | 319 | ||
371 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); | 320 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); |
372 | btngrp-> insert ( m_tabstyle_top ); | 321 | btngrp-> insert ( m_tabstyle_top ); |
373 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); | 322 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); |
374 | 323 | ||
375 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); | 324 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); |
376 | btngrp-> insert ( m_tabstyle_top ); | 325 | btngrp-> insert ( m_tabstyle_bottom ); |
377 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); | 326 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); |
378 | 327 | ||
379 | bool tabtop = ( style & 0xff00 ) == 0; | ||
380 | m_tabstyle_top-> setChecked ( tabtop ); | 328 | m_tabstyle_top-> setChecked ( tabtop ); |
381 | m_tabstyle_bottom-> setChecked ( !tabtop ); | 329 | m_tabstyle_bottom-> setChecked ( !tabtop ); |
382 | 330 | ||
383 | m_original_tabstyle = style; | 331 | m_original_tabstyle = style; |
332 | m_original_tabpos = tabtop; | ||
384 | 333 | ||
385 | return tab; | 334 | return tab; |
386 | } | 335 | } |
387 | 336 | ||
388 | 337 | ||
389 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 338 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
390 | : QDialog ( parent, name, true ) | 339 | : QDialog ( parent, name, true ) |
391 | { | 340 | { |
392 | setCaption( tr( "Appearance" ) ); | 341 | setCaption( tr( "Appearance" ) ); |
393 | 342 | ||
394 | Config config( "qpe" ); | 343 | Config config( "qpe" ); |
395 | config.setGroup( "Appearance" ); | 344 | config.setGroup( "Appearance" ); |
@@ -414,45 +363,43 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | |||
414 | tw-> setCurrentTab ( styletab ); | 363 | tw-> setCurrentTab ( styletab ); |
415 | } | 364 | } |
416 | 365 | ||
417 | Appearance::~Appearance() | 366 | Appearance::~Appearance() |
418 | { | 367 | { |
419 | } | 368 | } |
420 | 369 | ||
421 | void Appearance::accept ( ) | 370 | void Appearance::accept ( ) |
422 | { | 371 | { |
423 | Config config("qpe"); | 372 | Config config("qpe"); |
424 | config.setGroup( "Appearance" ); | 373 | config.setGroup( "Appearance" ); |
425 | 374 | ||
426 | int newstyle = m_style_list-> currentItem ( ); | 375 | int newtabstyle = m_tabstyle_list-> currentItem ( ); |
427 | int newtabstyle = ( m_tabstyle_list-> currentItem ( ) & 0xff ) | \ | 376 | bool newtabpos = m_tabstyle_top-> isChecked ( ); |
428 | ( m_tabstyle_top-> isChecked ( ) ? 0x000 : 0x100 ); | ||
429 | int newfontfamily = m_font_family_list-> currentItem ( ); | ||
430 | int newfontstyle = m_font_style_list-> currentItem ( ); | ||
431 | int newfontsize = m_font_size_list-> currentItem ( ); | ||
432 | 377 | ||
433 | 378 | ||
434 | if ( m_style_changed ) { | 379 | if ( m_style_changed ) { |
435 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( newstyle ); | 380 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
436 | if ( item ) | 381 | if ( item ) |
437 | config.writeEntry( "Style", item-> key ( )); | 382 | config.writeEntry( "Style", item-> key ( )); |
438 | } | 383 | } |
439 | if ( newtabstyle != m_original_tabstyle ) { | 384 | |
440 | config. writeEntry ( "TabStyle", newtabstyle ); | 385 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { |
386 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | ||
387 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); | ||
441 | } | 388 | } |
442 | 389 | ||
443 | if ( m_font_changed ) { | 390 | if ( m_font_changed ) { |
444 | config.writeEntry( "FontFamily", m_font_family_list-> text ( newfontfamily )); | 391 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); |
445 | config.writeEntry( "FontStyle", m_font_style_list-> text ( newfontstyle )); | 392 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); |
446 | config.writeEntry( "FontSize", m_font_size_list-> text ( newfontsize )); | 393 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); |
447 | } | 394 | } |
448 | 395 | ||
449 | 396 | ||
450 | if ( m_color_changed ) | 397 | if ( m_color_changed ) |
451 | { | 398 | { |
452 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 399 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
453 | 400 | ||
454 | if ( item ) | 401 | if ( item ) |
455 | item-> save ( config ); | 402 | item-> save ( config ); |
456 | } | 403 | } |
457 | 404 | ||
458 | config. write ( ); // need to flush the config info first | 405 | config. write ( ); // need to flush the config info first |
@@ -512,99 +459,28 @@ void Appearance::decoClicked ( int index ) | |||
512 | { | 459 | { |
513 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); | 460 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); |
514 | 461 | ||
515 | if ( m_sample ) { | 462 | if ( m_sample ) { |
516 | if ( dli && dli-> interface ( )) | 463 | if ( dli && dli-> interface ( )) |
517 | m_sample-> setDecoration ( dli-> interface ( )); | 464 | m_sample-> setDecoration ( dli-> interface ( )); |
518 | else | 465 | else |
519 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 466 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
520 | } | 467 | } |
521 | m_deco_changed |= ( index != m_original_deco ); | 468 | m_deco_changed |= ( index != m_original_deco ); |
522 | } | 469 | } |
523 | 470 | ||
524 | void Appearance::fontFamilyClicked ( int index ) | 471 | void Appearance::fontClicked ( const QFont &f ) |
525 | { | 472 | { |
526 | QString oldstyle = m_font_style_list-> currentText ( ); | 473 | m_font_changed |= ( f != m_sample-> font ( )); |
527 | QString oldsize = m_font_size_list-> currentText ( ); | 474 | m_sample-> setFont ( f ); |
528 | |||
529 | FontListItem *fli = (FontListItem *) m_font_family_list-> item ( index ); | ||
530 | |||
531 | m_font_style_list-> clear ( ); | ||
532 | m_font_style_list-> insertStringList ( fli-> styles ( )); | ||
533 | m_font_style_list-> setEnabled ( !fli-> styles ( ). isEmpty ( )); | ||
534 | |||
535 | int i; | ||
536 | |||
537 | i = findItemCB ( m_font_style_list, oldstyle ); | ||
538 | if ( i < 0 ) | ||
539 | i = findItemCB ( m_font_style_list, "Regular" ); | ||
540 | if (( i < 0 ) && ( m_font_style_list-> count ( ) > 0 )) | ||
541 | i = 0; | ||
542 | |||
543 | if ( i >= 0 ) { | ||
544 | m_font_style_list-> setCurrentItem ( i ); | ||
545 | fontStyleClicked ( i ); | ||
546 | } | ||
547 | |||
548 | m_font_size_list-> clear ( ); | ||
549 | QValueList<int> sl = fli-> sizes ( ); | ||
550 | |||
551 | for ( QValueList<int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | ||
552 | m_font_size_list-> insertItem ( QString::number ( *it )); | ||
553 | |||
554 | i = findItemCB ( m_font_size_list, oldsize ); | ||
555 | if ( i < 0 ) | ||
556 | i = findItemCB ( m_font_size_list, "10" ); | ||
557 | if (( i < 0 ) && ( m_font_size_list-> count ( ) > 0 )) | ||
558 | i = 0; | ||
559 | |||
560 | if ( i >= 0 ) { | ||
561 | m_font_size_list-> setCurrentItem ( i ); | ||
562 | fontSizeClicked ( i ); | ||
563 | } | ||
564 | changeText ( ); | ||
565 | |||
566 | m_font_changed |= ( index != m_original_fontfamily ); | ||
567 | } | ||
568 | |||
569 | void Appearance::fontStyleClicked ( int index ) | ||
570 | { | ||
571 | changeText ( ); | ||
572 | |||
573 | m_font_changed |= ( index != m_original_fontstyle ); | ||
574 | } | ||
575 | |||
576 | void Appearance::fontSizeClicked ( int index ) | ||
577 | { | ||
578 | changeText ( ); | ||
579 | |||
580 | m_font_changed |= ( index != m_original_fontsize ); | ||
581 | } | ||
582 | |||
583 | void Appearance::changeText ( ) | ||
584 | { | ||
585 | int ffa = m_font_family_list-> currentItem ( ); | ||
586 | int fst = m_font_style_list-> currentItem ( ); | ||
587 | int fsi = m_font_size_list-> currentItem ( ); | ||
588 | |||
589 | FontListItem *fli = (FontListItem *) m_font_family_list-> item ( ffa ); | ||
590 | |||
591 | if ( fli ) { | ||
592 | FontDatabase fdb; | ||
593 | |||
594 | m_sample-> setFont ( fdb. font ( fli-> family ( ), \ | ||
595 | fst >= 0 ? fli-> styles ( ) [fst] : QString::null, \ | ||
596 | fsi >= 0 ? fli-> sizes ( ) [fsi] : 10, \ | ||
597 | fdb. charSets ( fli-> family ( )) [0] )); | ||
598 | } | ||
599 | } | 475 | } |
600 | 476 | ||
601 | void Appearance::colorClicked ( int index ) | 477 | void Appearance::colorClicked ( int index ) |
602 | { | 478 | { |
603 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); | 479 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); |
604 | 480 | ||
605 | if ( item ) | 481 | if ( item ) |
606 | m_sample-> setPalette ( item-> palette ( )); | 482 | m_sample-> setPalette ( item-> palette ( )); |
607 | 483 | ||
608 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); | 484 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); |
609 | } | 485 | } |
610 | 486 | ||