author | sandman <sandman> | 2002-10-04 00:42:31 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-04 00:42:31 (UTC) |
commit | 4131d24ac051733b2d9ba323b18e6602ae396b85 (patch) (side-by-side diff) | |
tree | 928dd69609529096aa0825c4019022cb0659b46c | |
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 @@ -150,5 +150,5 @@ void Appearance::loadStyles ( QListBox *list ) void Appearance::loadDecos ( QListBox *list ) { - list-> insertItem ( new DecoListItem ( tr( "Default" ))); + list-> insertItem ( new DecoListItem ( "QPE" )); { @@ -209,5 +209,12 @@ QWidget *Appearance::createStyleTab ( QWidget *parent ) QString s = config. readEntry ( "Style", "Light" ); - m_style_list-> setCurrentItem ( m_style_list-> findItem ( s )); + + for ( uint i = 0; i < m_style_list-> count ( ); i++ ) { + if (((StyleListItem *) m_style_list-> item ( i ))-> key ( ) == s ) { + m_style_list-> setCurrentItem ( i ); + break; + } + } + m_original_style = m_style_list-> currentItem ( ); styleClicked ( m_original_style ); @@ -232,5 +239,12 @@ QWidget *Appearance::createDecoTab ( QWidget *parent ) QString s = config. readEntry ( "Decoration" ); - m_deco_list-> setCurrentItem ( m_deco_list-> findItem ( s )); + + for ( uint i = 0; i < m_deco_list-> count ( ); i++ ) { + if (((DecoListItem *) m_deco_list-> item ( i ))-> key ( ) == s ) { + m_deco_list-> setCurrentItem ( i ); + break; + } + } + m_original_deco = m_deco_list-> currentItem ( ); if ( m_deco_list-> currentItem ( ) < 0 ) @@ -387,4 +401,10 @@ void Appearance::accept ( ) config.writeEntry( "Style", item-> key ( )); } + + if ( m_deco_changed ) { + DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); + if ( item ) + config.writeEntry( "Decoration", item-> key ( )); + } if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) { @@ -470,4 +490,5 @@ void Appearance::decoClicked ( int index ) else m_sample-> setDecoration ( new DefaultWindowDecoration ( )); + m_sample-> repaint ( ); } m_deco_changed |= ( index != m_original_deco ); 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 @@ -32,7 +32,7 @@ #include <qlistbox.h> -class DecoListItem : public QListBoxText { +class DecoListItem : public QListBoxPixmap { public: - DecoListItem ( const QString &t ) : QListBoxText ( t ) + DecoListItem ( const QString &t ) : QListBoxPixmap ( QPixmap ( ), t ) { m_lib = 0; @@ -41,5 +41,5 @@ public: } - DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxText ( iface-> name ( )) + DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxPixmap ( iface-> icon ( ), iface-> name ( )) { m_lib = lib; @@ -86,6 +86,6 @@ public: QString key ( ) { - if ( m_window_if ) - return QString ( m_window_if-> name ( )); + if ( m_lib ) + return QFileInfo ( m_lib-> library ( )). fileName ( ); else return text ( ); 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 @@ -90,6 +90,7 @@ public: QString key ( ) { - if ( m_style_if ) - return QString ( m_style_if-> key ( )); + if ( m_lib ) + return QFileInfo ( m_lib-> library ( )). fileName ( ); + //return QString ( m_style_if-> key ( )); else return text ( ); |