summaryrefslogtreecommitdiff
path: root/noncore/settings/appearance2
authorkergoth <kergoth>2003-08-09 17:14:54 (UTC)
committer kergoth <kergoth>2003-08-09 17:14:54 (UTC)
commita7e015198a8c5ad3b6e144a9032b059086253e00 (patch) (unidiff)
treeb712b6f11310d88744fe393a92b3160b741a7efe /noncore/settings/appearance2
parentbeba0e73306815337bf04dee39502233595e9739 (diff)
downloadopie-a7e015198a8c5ad3b6e144a9032b059086253e00.zip
opie-a7e015198a8c5ad3b6e144a9032b059086253e00.tar.gz
opie-a7e015198a8c5ad3b6e144a9032b059086253e00.tar.bz2
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/settings/appearance2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp13
-rw-r--r--noncore/settings/appearance2/colorlistitem.h7
-rw-r--r--noncore/settings/appearance2/decolistitem.h3
3 files changed, 13 insertions, 10 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index c376ec7..00128d3 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -63,49 +63,49 @@
63#include <opie/ofontselector.h> 63#include <opie/ofontselector.h>
64#include <opie/odevice.h> 64#include <opie/odevice.h>
65#include <opie/ofiledialog.h> 65#include <opie/ofiledialog.h>
66#include <opie/otabwidget.h> 66#include <opie/otabwidget.h>
67 67
68#include "appearance.h" 68#include "appearance.h"
69#include "editScheme.h" 69#include "editScheme.h"
70#include "stylelistitem.h" 70#include "stylelistitem.h"
71#include "decolistitem.h" 71#include "decolistitem.h"
72#include "colorlistitem.h" 72#include "colorlistitem.h"
73#include "exceptlistitem.h" 73#include "exceptlistitem.h"
74#include "sample.h" 74#include "sample.h"
75 75
76 76
77using namespace Opie; 77using namespace Opie;
78 78
79 79
80class DefaultWindowDecoration : public WindowDecorationInterface 80class DefaultWindowDecoration : public WindowDecorationInterface
81{ 81{
82public: 82public:
83 DefaultWindowDecoration() : ref(0) {} 83 DefaultWindowDecoration() : ref(0) {}
84 QString name() const { 84 QString name() const {
85 return "Default"; 85 return "Default";
86 } 86 }
87 QPixmap icon() const { 87QPixmap icon() const {
88 return QPixmap(); 88 return QPixmap();
89 } 89 }
90 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 90 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
91 *iface = 0; 91 *iface = 0;
92 if ( uuid == IID_QUnknown ) 92 if ( uuid == IID_QUnknown )
93 *iface = this; 93 *iface = this;
94 else if ( uuid == IID_WindowDecoration ) 94 else if ( uuid == IID_WindowDecoration )
95 *iface = this; 95 *iface = this;
96 96
97 if ( *iface ) 97 if ( *iface )
98 (*iface)->addRef(); 98 (*iface)->addRef();
99 return QS_OK; 99 return QS_OK;
100 } 100 }
101 Q_REFCOUNT 101 Q_REFCOUNT
102 102
103private: 103private:
104 ulong ref; 104 ulong ref;
105}; 105};
106 106
107 107
108 108
109 109
110 110
111 111
@@ -154,49 +154,49 @@ QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg )
154 m_style_list-> setCurrentItem ( slit ); 154 m_style_list-> setCurrentItem ( slit );
155 } 155 }
156 else 156 else
157 delete lib; 157 delete lib;
158 } 158 }
159 } 159 }
160 160
161 m_original_style = m_style_list-> currentItem ( ); 161 m_original_style = m_style_list-> currentItem ( );
162 styleClicked ( m_original_style ); 162 styleClicked ( m_original_style );
163 163
164 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); 164 connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) );
165 165
166 return tab; 166 return tab;
167} 167}
168 168
169QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) 169QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
170{ 170{
171 QWidget* tab = new QWidget( parent, "DecoTab" ); 171 QWidget* tab = new QWidget( parent, "DecoTab" );
172 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); 172 QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 );
173 173
174 m_deco_list = new QListBox( tab, "m_deco_list" ); 174 m_deco_list = new QListBox( tab, "m_deco_list" );
175 vertLayout->addWidget( m_deco_list ); 175 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." ) ); 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." ) );
177 177
178 QString s = cfg. readEntry ( "Decoration" ); 178 QString s = cfg. readEntry ( "Decoration", "libflat.so" );
179 179
180 m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); 180 m_deco_list-> insertItem ( new DecoListItem ( "QPE" ));
181 181
182 { 182 {
183 QString path = QPEApplication::qpeDir(); 183 QString path = QPEApplication::qpeDir();
184 path.append( "/plugins/decorations/" ); 184 path.append( "/plugins/decorations/" );
185 QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); 185 QStringList sl = QDir ( path, "lib*.so" ). entryList ( );
186 186
187 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { 187 for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) {
188 QString libstr = path; 188 QString libstr = path;
189 libstr.append( "/" ); 189 libstr.append( "/" );
190 libstr.append( *it ); 190 libstr.append( *it );
191 QLibrary *lib = new QLibrary ( libstr ); 191 QLibrary *lib = new QLibrary ( libstr );
192 WindowDecorationInterface *iface; 192 WindowDecorationInterface *iface;
193 193
194 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) { 194 if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) {
195 DecoListItem *dlit = new DecoListItem ( lib, iface ); 195 DecoListItem *dlit = new DecoListItem ( lib, iface );
196 m_deco_list-> insertItem ( dlit ); 196 m_deco_list-> insertItem ( dlit );
197 197
198 if ( dlit-> key ( ) == s ) 198 if ( dlit-> key ( ) == s )
199 m_deco_list-> setCurrentItem ( dlit ); 199 m_deco_list-> setCurrentItem ( dlit );
200 } 200 }
201 else 201 else
202 delete lib; 202 delete lib;
@@ -381,104 +381,105 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
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 vertLayout-> addSpacing ( 3 ); 403 vertLayout-> addSpacing ( 3 );
404 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); 404 QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
405 405
406 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); 406 QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
407 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); 407 m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" );
408 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); 408 QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( );
409 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); 409 m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" );
410 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); 410 QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 );
411 QPixmap ccw1; 411 QPixmap ccw1;
412 m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); 412 m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" );
413 QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); 413 QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( );
414 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); 414 QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" );
415 415
416 rotbtngrp-> hide ( ); 416 rotbtngrp-> hide ( );
417 rotbtngrp-> setExclusive ( true ); 417 rotbtngrp-> setExclusive ( true );
418 rotbtngrp-> insert ( m_rotdir_cw ); 418 rotbtngrp-> insert ( m_rotdir_cw );
419 rotbtngrp-> insert ( m_rotdir_ccw ); 419 rotbtngrp-> insert ( m_rotdir_ccw );
420 rotbtngrp-> insert ( m_rotdir_flip ); 420 rotbtngrp-> insert ( m_rotdir_flip );
421 421
422 ccw1. convertFromImage( ccwImage ); 422 ccw1. convertFromImage( ccwImage );
423 m_rotdir_cw-> setPixmap( cw1 ); 423 m_rotdir_cw-> setPixmap( cw1 );
424 m_rotdir_ccw-> setPixmap( ccw1 ); 424 m_rotdir_ccw-> setPixmap( ccw1 );
425 m_rotdir_flip-> setPixmap( flip1 ); 425 m_rotdir_flip-> setPixmap( flip1 );
426 426
427 rotLay-> addWidget ( rotlabel, 0 ); 427 rotLay-> addWidget ( rotlabel, 0 );
428 rotLay-> addWidget ( m_rotdir_cw, 0 ); 428 rotLay-> addWidget ( m_rotdir_cw, 0 );
429 rotLay-> addWidget ( m_rotdir_ccw, 0 ); 429 rotLay-> addWidget ( m_rotdir_ccw, 0 );
430 rotLay-> addWidget ( m_rotdir_flip, 0 ); 430 rotLay-> addWidget ( m_rotdir_flip, 0 );
431 431
432 int rotDirection = cfg.readNumEntry( "rotatedir" ); 432 int rotDirection = cfg.readNumEntry( "rotatedir" );
433 ODirection rot = CW; 433 ODirection rot = CW;
434 434
435 if (rotDirection == -1) { 435 if (rotDirection == -1) {
436 rot = ODevice::inst ( )-> direction ( ); 436 rot = ODevice::inst ( )-> direction ( );
437 } else { 437 } else {
438 rot = (ODirection)rotDirection; 438 rot = (ODirection)rotDirection;
439 } 439 }
440 440
441 m_rotdir_cw-> setChecked ( rot == CW ); 441 m_rotdir_cw-> setChecked ( rot == CW );
442 m_rotdir_ccw-> setChecked ( rot == CCW ); 442 m_rotdir_ccw-> setChecked ( rot == CCW );
443 m_rotdir_flip-> setChecked ( rot == Flip ); 443 m_rotdir_flip-> setChecked ( rot == Flip );
444 444
445 return tab; 445 return tab;
446} 446}
447 447
448 448
449Appearance::Appearance( QWidget* parent, const char* name, WFlags ) 449Appearance::Appearance( QWidget* parent, const char* name, WFlags )
450 : QDialog ( parent, name, true, WStyle_ContextHelp ) 450 : QDialog ( parent, name, true, WStyle_ContextHelp )
451{ 451{
452 setCaption( tr( "Appearance Settings" ) ); 452 setCaption( tr( "Appearance Settings" ) );
453 453
454 Config config( "qpe" ); 454 Config config( "qpe" );
455 config.setGroup( "Appearance" ); 455 config.setGroup( "Appearance" );
456 456
457 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); 457 QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
458 458
459 m_sample = new SampleWindow ( this ); 459 m_sample = new SampleWindow ( this );
460 m_sample-> setDecoration ( new DefaultWindowDecoration ( )); 460
461 m_sample-> setDecoration ( new DefaultWindowDecoration ( ) );
461 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); 462 QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
462 463
463 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 464 OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
464 QWidget *styletab; 465 QWidget *styletab;
465 466
466 m_color_list = 0; 467 m_color_list = 0;
467 468
468 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); 469 tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" ));
469 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); 470 tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" ));
470 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); 471 tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) );
471 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); 472 tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) );
472 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); 473 tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) );
473 474
474 top-> addWidget ( tw, 10 ); 475 top-> addWidget ( tw, 10 );
475 top-> addWidget ( m_sample, 1 ); 476 top-> addWidget ( m_sample, 1 );
476 477
477 tw-> setCurrentTab ( styletab ); 478 tw-> setCurrentTab ( styletab );
478 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); 479 connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * )));
479 480
480 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; 481 m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false;
481} 482}
482 483
483Appearance::~Appearance() 484Appearance::~Appearance()
484{ 485{
diff --git a/noncore/settings/appearance2/colorlistitem.h b/noncore/settings/appearance2/colorlistitem.h
index 10e4468..f8d5c45 100644
--- a/noncore/settings/appearance2/colorlistitem.h
+++ b/noncore/settings/appearance2/colorlistitem.h
@@ -103,38 +103,39 @@ public:
103 } 103 }
104 104
105private: 105private:
106 QPalette m_palette; 106 QPalette m_palette;
107 QColor *m_colors; 107 QColor *m_colors;
108 108
109 static struct colorlut { 109 static struct colorlut {
110 QColorGroup::ColorRole m_role; 110 QColorGroup::ColorRole m_role;
111 const char * m_key; 111 const char * m_key;
112 const char * m_def; 112 const char * m_def;
113 const char * m_label; 113 const char * m_label;
114 } const s_colorlut []; 114 } const s_colorlut [];
115 static const int s_colorcount; 115 static const int s_colorcount;
116 116
117 static int r2i ( QColorGroup::ColorRole role ) 117 static int r2i ( QColorGroup::ColorRole role )
118 { 118 {
119 for ( int i = 0; i < s_colorcount; i++ ) { 119 for ( int i = 0; i < s_colorcount; i++ ) {
120 if ( s_colorlut [i]. m_role == role ) 120 if ( s_colorlut [i]. m_role == role )
121 return i; 121 return i;
122 } 122 }
123 return -1; 123 return -1;
124 } 124 }
125}; 125};
126 126
127// from etc/colors/Liquid.scheme
127const ColorListItem::colorlut ColorListItem::s_colorlut [] = { 128const ColorListItem::colorlut ColorListItem::s_colorlut [] = {
128 { QColorGroup::Base, "Base", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Base" ) }, 129 { QColorGroup::Base, "Base", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Base" ) },
129 { QColorGroup::Background, "Background", "#E5E1D5", QT_TRANSLATE_NOOP( "Appearance", "Background" ) }, 130 { QColorGroup::Background, "Background", "#E0E0E0", QT_TRANSLATE_NOOP( "Appearance", "Background" ) },
130 { QColorGroup::Button, "Button", "#D6CDBB", QT_TRANSLATE_NOOP( "Appearance", "Button" ) }, 131 { QColorGroup::Button, "Button", "#96c8fa", QT_TRANSLATE_NOOP( "Appearance", "Button" ) },
131 { QColorGroup::ButtonText, "ButtonText", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Button Text" ) }, 132 { QColorGroup::ButtonText, "ButtonText", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Button Text" ) },
132 { QColorGroup::Highlight, "Highlight", "#800000", QT_TRANSLATE_NOOP( "Appearance", "Highlight" ) }, 133 { QColorGroup::Highlight, "Highlight", "#73adef", QT_TRANSLATE_NOOP( "Appearance", "Highlight" ) },
133 { QColorGroup::HighlightedText, "HighlightedText", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Highlighted Text" ) }, 134 { QColorGroup::HighlightedText, "HighlightedText", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Highlighted Text" ) },
134 { QColorGroup::Text, "Text", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Text" ) } 135 { QColorGroup::Text, "Text", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Text" ) }
135}; 136};
136 137
137const int ColorListItem::s_colorcount = sizeof( s_colorlut ) / sizeof ( s_colorlut [0] ); 138const int ColorListItem::s_colorcount = sizeof( s_colorlut ) / sizeof ( s_colorlut [0] );
138 139
139 140
140#endif 141#endif
diff --git a/noncore/settings/appearance2/decolistitem.h b/noncore/settings/appearance2/decolistitem.h
index d190ceb..da7924c 100644
--- a/noncore/settings/appearance2/decolistitem.h
+++ b/noncore/settings/appearance2/decolistitem.h
@@ -82,25 +82,26 @@ public:
82 // } 82 // }
83 return false; 83 return false;
84 } 84 }
85 85
86 QString key ( ) 86 QString key ( )
87 { 87 {
88 if ( m_lib ) 88 if ( m_lib )
89 return QFileInfo ( m_lib-> library ( )). fileName ( ); 89 return QFileInfo ( m_lib-> library ( )). fileName ( );
90 else 90 else
91 return text ( ); 91 return text ( );
92 } 92 }
93 93
94 WindowDecorationInterface *interface ( ) 94 WindowDecorationInterface *interface ( )
95 { 95 {
96 return m_window_if; 96 return m_window_if;
97 } 97 }
98 98
99private: 99private:
100 QLibrary *m_lib; 100 QLibrary *m_lib;
101 WindowDecorationInterface *m_window_if; 101 WindowDecorationInterface *m_window_if;
102 //WindowDecorationSettingsInterface *m_settings_if; 102 //WindowDecorationSettingsInterface *m_settings_if;
103 103
104}; 104};
105 105
106#endif \ No newline at end of file 106#endif
107