author | sandman <sandman> | 2002-10-04 00:42:31 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-04 00:42:31 (UTC) |
commit | 4131d24ac051733b2d9ba323b18e6602ae396b85 (patch) (unidiff) | |
tree | 928dd69609529096aa0825c4019022cb0659b46c /noncore | |
parent | 41e252c02eb10dcaa4622341f706b7817d6a70b2 (diff) | |
download | opie-4131d24ac051733b2d9ba323b18e6602ae396b85.zip opie-4131d24ac051733b2d9ba323b18e6602ae396b85.tar.gz opie-4131d24ac051733b2d9ba323b18e6602ae396b85.tar.bz2 |
- some changes to get dynamic window decorations working
- new format for style config
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 27 | ||||
-rw-r--r-- | noncore/settings/appearance2/decolistitem.h | 10 | ||||
-rw-r--r-- | noncore/settings/appearance2/stylelistitem.h | 5 |
3 files changed, 32 insertions, 10 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 43ff24c..8cd54a2 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -146,13 +146,13 @@ void Appearance::loadStyles ( QListBox *list ) | |||
146 | 146 | ||
147 | #endif | 147 | #endif |
148 | } | 148 | } |
149 | 149 | ||
150 | void Appearance::loadDecos ( QListBox *list ) | 150 | void Appearance::loadDecos ( QListBox *list ) |
151 | { | 151 | { |
152 | list-> insertItem ( new DecoListItem ( tr( "Default" ))); | 152 | list-> insertItem ( new DecoListItem ( "QPE" )); |
153 | 153 | ||
154 | { | 154 | { |
155 | QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; | 155 | QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; |
156 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); | 156 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); |
157 | 157 | ||
158 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { | 158 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) { |
@@ -205,13 +205,20 @@ QWidget *Appearance::createStyleTab ( QWidget *parent ) | |||
205 | connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( ))); | 205 | connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( ))); |
206 | vertLayout-> addWidget ( m_style_settings ); | 206 | vertLayout-> addWidget ( m_style_settings ); |
207 | 207 | ||
208 | loadStyles ( m_style_list ); | 208 | loadStyles ( m_style_list ); |
209 | 209 | ||
210 | QString s = config. readEntry ( "Style", "Light" ); | 210 | QString s = config. readEntry ( "Style", "Light" ); |
211 | m_style_list-> setCurrentItem ( m_style_list-> findItem ( s )); | 211 | |
212 | for ( uint i = 0; i < m_style_list-> count ( ); i++ ) { | ||
213 | if (((StyleListItem *) m_style_list-> item ( i ))-> key ( ) == s ) { | ||
214 | m_style_list-> setCurrentItem ( i ); | ||
215 | break; | ||
216 | } | ||
217 | } | ||
218 | |||
212 | m_original_style = m_style_list-> currentItem ( ); | 219 | m_original_style = m_style_list-> currentItem ( ); |
213 | styleClicked ( m_original_style ); | 220 | styleClicked ( m_original_style ); |
214 | 221 | ||
215 | connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); | 222 | connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); |
216 | 223 | ||
217 | return tab; | 224 | return tab; |
@@ -228,13 +235,20 @@ QWidget *Appearance::createDecoTab ( QWidget *parent ) | |||
228 | m_deco_list = new QListBox( tab, "m_deco_list" ); | 235 | m_deco_list = new QListBox( tab, "m_deco_list" ); |
229 | vertLayout->addWidget( m_deco_list ); | 236 | vertLayout->addWidget( m_deco_list ); |
230 | 237 | ||
231 | loadDecos ( m_deco_list ); | 238 | loadDecos ( m_deco_list ); |
232 | 239 | ||
233 | QString s = config. readEntry ( "Decoration" ); | 240 | QString s = config. readEntry ( "Decoration" ); |
234 | m_deco_list-> setCurrentItem ( m_deco_list-> findItem ( s )); | 241 | |
242 | for ( uint i = 0; i < m_deco_list-> count ( ); i++ ) { | ||
243 | if (((DecoListItem *) m_deco_list-> item ( i ))-> key ( ) == s ) { | ||
244 | m_deco_list-> setCurrentItem ( i ); | ||
245 | break; | ||
246 | } | ||
247 | } | ||
248 | |||
235 | m_original_deco = m_deco_list-> currentItem ( ); | 249 | m_original_deco = m_deco_list-> currentItem ( ); |
236 | if ( m_deco_list-> currentItem ( ) < 0 ) | 250 | if ( m_deco_list-> currentItem ( ) < 0 ) |
237 | m_deco_list-> setCurrentItem ( 0 ); | 251 | m_deco_list-> setCurrentItem ( 0 ); |
238 | decoClicked ( m_original_deco ); | 252 | decoClicked ( m_original_deco ); |
239 | 253 | ||
240 | connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); | 254 | connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); |
@@ -384,12 +398,18 @@ void Appearance::accept ( ) | |||
384 | if ( m_style_changed ) { | 398 | if ( m_style_changed ) { |
385 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 399 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
386 | if ( item ) | 400 | if ( item ) |
387 | config.writeEntry( "Style", item-> key ( )); | 401 | config.writeEntry( "Style", item-> key ( )); |
388 | } | 402 | } |
389 | 403 | ||
404 | if ( m_deco_changed ) { | ||
405 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); | ||
406 | if ( item ) | ||
407 | config.writeEntry( "Decoration", item-> key ( )); | ||
408 | } | ||
409 | |||
390 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { | 410 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { |
391 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | 411 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); |
392 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); | 412 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); |
393 | } | 413 | } |
394 | 414 | ||
395 | if ( m_font_changed ) { | 415 | if ( m_font_changed ) { |
@@ -466,12 +486,13 @@ void Appearance::decoClicked ( int index ) | |||
466 | 486 | ||
467 | if ( m_sample ) { | 487 | if ( m_sample ) { |
468 | if ( dli && dli-> interface ( )) | 488 | if ( dli && dli-> interface ( )) |
469 | m_sample-> setDecoration ( dli-> interface ( )); | 489 | m_sample-> setDecoration ( dli-> interface ( )); |
470 | else | 490 | else |
471 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 491 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
492 | m_sample-> repaint ( ); | ||
472 | } | 493 | } |
473 | m_deco_changed |= ( index != m_original_deco ); | 494 | m_deco_changed |= ( index != m_original_deco ); |
474 | } | 495 | } |
475 | 496 | ||
476 | void Appearance::fontClicked ( const QFont &f ) | 497 | void Appearance::fontClicked ( const QFont &f ) |
477 | { | 498 | { |
diff --git a/noncore/settings/appearance2/decolistitem.h b/noncore/settings/appearance2/decolistitem.h index 23261b1..d190ceb 100644 --- a/noncore/settings/appearance2/decolistitem.h +++ b/noncore/settings/appearance2/decolistitem.h | |||
@@ -28,22 +28,22 @@ | |||
28 | #ifndef DECOLISTITEM_H | 28 | #ifndef DECOLISTITEM_H |
29 | #define DECOLISTITEM_H | 29 | #define DECOLISTITEM_H |
30 | 30 | ||
31 | #include <qpe/windowdecorationinterface.h> | 31 | #include <qpe/windowdecorationinterface.h> |
32 | #include <qlistbox.h> | 32 | #include <qlistbox.h> |
33 | 33 | ||
34 | class DecoListItem : public QListBoxText { | 34 | class DecoListItem : public QListBoxPixmap { |
35 | public: | 35 | public: |
36 | DecoListItem ( const QString &t ) : QListBoxText ( t ) | 36 | DecoListItem ( const QString &t ) : QListBoxPixmap ( QPixmap ( ), t ) |
37 | { | 37 | { |
38 | m_lib = 0; | 38 | m_lib = 0; |
39 | m_window_if = 0; | 39 | m_window_if = 0; |
40 | // m_settings_if = 0; | 40 | // m_settings_if = 0; |
41 | } | 41 | } |
42 | 42 | ||
43 | DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxText ( iface-> name ( )) | 43 | DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxPixmap ( iface-> icon ( ), iface-> name ( )) |
44 | { | 44 | { |
45 | m_lib = lib; | 45 | m_lib = lib; |
46 | m_window_if = iface; | 46 | m_window_if = iface; |
47 | 47 | ||
48 | // iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if ); | 48 | // iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if ); |
49 | } | 49 | } |
@@ -82,14 +82,14 @@ public: | |||
82 | // } | 82 | // } |
83 | return false; | 83 | return false; |
84 | } | 84 | } |
85 | 85 | ||
86 | QString key ( ) | 86 | QString key ( ) |
87 | { | 87 | { |
88 | if ( m_window_if ) | 88 | if ( m_lib ) |
89 | return QString ( m_window_if-> name ( )); | 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 | { |
diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h index c0258e0..e261511 100644 --- a/noncore/settings/appearance2/stylelistitem.h +++ b/noncore/settings/appearance2/stylelistitem.h | |||
@@ -86,14 +86,15 @@ public: | |||
86 | return false; | 86 | return false; |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | QString key ( ) | 90 | QString key ( ) |
91 | { | 91 | { |
92 | if ( m_style_if ) | 92 | if ( m_lib ) |
93 | return QString ( m_style_if-> key ( )); | 93 | return QFileInfo ( m_lib-> library ( )). fileName ( ); |
94 | //return QString ( m_style_if-> key ( )); | ||
94 | else | 95 | else |
95 | return text ( ); | 96 | return text ( ); |
96 | } | 97 | } |
97 | 98 | ||
98 | QStyle *style ( ) | 99 | QStyle *style ( ) |
99 | { | 100 | { |