summaryrefslogtreecommitdiff
path: root/noncore
authorsandman <sandman>2002-10-04 00:42:31 (UTC)
committer sandman <sandman>2002-10-04 00:42:31 (UTC)
commit4131d24ac051733b2d9ba323b18e6602ae396b85 (patch) (unidiff)
tree928dd69609529096aa0825c4019022cb0659b46c /noncore
parent41e252c02eb10dcaa4622341f706b7817d6a70b2 (diff)
downloadopie-4131d24ac051733b2d9ba323b18e6602ae396b85.zip
opie-4131d24ac051733b2d9ba323b18e6602ae396b85.tar.gz
opie-4131d24ac051733b2d9ba323b18e6602ae396b85.tar.bz2
- some changes to get dynamic window decorations working
- new format for style config
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp27
-rw-r--r--noncore/settings/appearance2/decolistitem.h10
-rw-r--r--noncore/settings/appearance2/stylelistitem.h5
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
@@ -149,7 +149,7 @@ void Appearance::loadStyles ( QListBox *list )
149 149
150void Appearance::loadDecos ( QListBox *list ) 150void 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/";
@@ -208,7 +208,14 @@ QWidget *Appearance::createStyleTab ( QWidget *parent )
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
@@ -231,7 +238,14 @@ QWidget *Appearance::createDecoTab ( QWidget *parent )
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 );
@@ -386,6 +400,12 @@ void Appearance::accept ( )
386 if ( item ) 400 if ( item )
387 config.writeEntry( "Style", item-> key ( )); 401 config.writeEntry( "Style", item-> key ( ));
388 } 402 }
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 }
389 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 );
@@ -469,6 +489,7 @@ void Appearance::decoClicked ( int index )
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}
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
@@ -31,16 +31,16 @@
31#include <qpe/windowdecorationinterface.h> 31#include <qpe/windowdecorationinterface.h>
32#include <qlistbox.h> 32#include <qlistbox.h>
33 33
34class DecoListItem : public QListBoxText { 34class DecoListItem : public QListBoxPixmap {
35public: 35public:
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;
@@ -85,8 +85,8 @@ public:
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 }
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
@@ -89,8 +89,9 @@ public:
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 }