Author: tgoettlicher Date: Wed Dec 17 16:16:48 2008 New Revision: 54242 URL: http://svn.opensuse.org/viewcvs/yast?rev=54242&view=rev Log: - Added stylesheet editor - V 2.18.2 Modified: trunk/qt/VERSION.cmake trunk/qt/package/yast2-qt.changes trunk/qt/src/CMakeLists.txt trunk/qt/src/QY2Styler.cc trunk/qt/src/QY2Styler.h trunk/qt/src/YQDialog.cc trunk/qt/src/YQDialog.h Modified: trunk/qt/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/VERSION.cmake?rev=54242&r1=54241&r2=54242&view=diff ============================================================================== --- trunk/qt/VERSION.cmake (original) +++ trunk/qt/VERSION.cmake Wed Dec 17 16:16:48 2008 @@ -1,3 +1,3 @@ SET(VERSION_MAJOR "2") SET(VERSION_MINOR "18") -SET(VERSION_PATCH "1") +SET(VERSION_PATCH "2") Modified: trunk/qt/package/yast2-qt.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/package/yast2-qt.changes?rev=54242&r1=54241&r2=54242&view=diff ============================================================================== --- trunk/qt/package/yast2-qt.changes (original) +++ trunk/qt/package/yast2-qt.changes Wed Dec 17 16:16:48 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Dec 17 15:56:32 CET 2008 - tgoettlicher@suse.de + +- Added stylesheet editor +- V 2.18.2 + +------------------------------------------------------------------- Thu Dec 11 11:26:24 CET 2008 - tgoettlicher@suse.de - Fixed bnc #438861: Wizard layout problems for Arabic and Hebrew Modified: trunk/qt/src/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/CMakeLists.txt?rev=54242&r1=54241&r2=54242&view=diff ============================================================================== --- trunk/qt/src/CMakeLists.txt (original) +++ trunk/qt/src/CMakeLists.txt Wed Dec 17 16:16:48 2008 @@ -74,6 +74,7 @@ YQWidgetFactory.cc YQWizard.cc YQWizardButton.cc + QY2StyleEditor.cc ) SET( yast_qt_HEADERS @@ -136,13 +137,14 @@ YQWidgetFactory.h YQWizard.h YQWizardButton.h + QY2StyleEditor.h ) INSTALL( FILES ${yast_qt_HEADERS} DESTINATION "${LIBYUI_INCLUDE_DIR}/../yast2-qt" ) QT4_AUTOMOC(${qt_yast_plugin_SRCS}) -QT4_WRAP_UI(qt_yast_plugin_SRCS QHelpDialog.ui) +QT4_WRAP_UI(qt_yast_plugin_SRCS QHelpDialog.ui QStyleEditor.ui ) INCLUDE_DIRECTORIES( ${QT_INCLUDES} ) INCLUDE_DIRECTORIES( ${LIBYUI_INCLUDE_DIR} ) Modified: trunk/qt/src/QY2Styler.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/QY2Styler.cc?rev=54242&r1=54241&r2=54242&view=diff ============================================================================== --- trunk/qt/src/QY2Styler.cc (original) +++ trunk/qt/src/QY2Styler.cc Wed Dec 17 16:16:48 2008 @@ -65,29 +65,43 @@ QString style = getenv("Y2STYLE"); if ( ! style.isEmpty() ) - styler->setStyleSheet( style ); + styler->loadStyleSheet( style ); else - styler->setStyleSheet( "style.qss" ); + styler->loadStyleSheet( "style.qss" ); } return styler; } -void QY2Styler::setStyleSheet( const QString & filename ) +void QY2Styler::loadStyleSheet( const QString & filename ) { QFile file( themeDir() + filename ); if ( file.open( QIODevice::ReadOnly ) ) { - yuiMilestone() << "Using style sheet \"" << file.fileName() << "\"" << endl; - _style = file.readAll(); - processUrls( _style ); + yuiMilestone() << "Using style sheet \"" << file.fileName() << "\"" << endl; + QString text = file.readAll(); + setStyleSheet( text ); } else { yuiMilestone() << "Couldn't open style sheet \"" << file.fileName() << "\"" << endl; } + +} + +void QY2Styler::setStyleSheet( const QString & text ) +{ + _style = text; + processUrls( _style ); + + QWidget *child; + QList< QWidget* > childlist; + + foreach( childlist, _children ) + foreach( child, childlist ) + child->setStyleSheet( _style ); } @@ -99,6 +113,8 @@ QRegExp backgroundRegex( "^ */\\* *Background: *([^ ]*) *([^ ]*) *\\*/$" ); QRegExp richTextRegex( "^ */\\* *Richtext: *([^ ]*) *\\*/$" ); + _backgrounds.clear(); + for ( QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it ) { QString line = *it; @@ -207,6 +223,9 @@ { // yuiDebug() << "Rendering " << wid << endl; QString name = wid->objectName(); + + // TODO + wid->setPalette( QApplication::palette() ); // if the parent does not have a background, this does not make sense if ( _backgrounds[name].pix.isNull() ) @@ -228,7 +247,8 @@ QPainter pain( &back ); QWidget *child; - + + foreach( child, _children[wid] ) { // yuiDebug() << "foreach " << child << " " << wid << endl; @@ -272,9 +292,6 @@ QString name = wid->objectName(); - if ( !_backgrounds.contains( name ) ) - return false; - if (! wid->isVisible() || !wid->updatesEnabled() ) return false; Modified: trunk/qt/src/QY2Styler.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/QY2Styler.h?rev=54242&r1=54241&r2=54242&view=diff ============================================================================== --- trunk/qt/src/QY2Styler.h (original) +++ trunk/qt/src/QY2Styler.h Wed Dec 17 16:16:48 2008 @@ -43,7 +43,8 @@ static QY2Styler * styler(); - void setStyleSheet( const QString &file ); + void loadStyleSheet( const QString &file ); // reads style sheet form a file + void setStyleSheet( const QString & text ); QString themeDir() const; void registerWidget( QWidget *widget ); void unregisterWidget( QWidget *widget ); Modified: trunk/qt/src/YQDialog.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQDialog.cc?rev=54242&r1=54241&r2=54242&view=diff ============================================================================== --- trunk/qt/src/YQDialog.cc (original) +++ trunk/qt/src/YQDialog.cc Wed Dec 17 16:16:48 2008 @@ -35,6 +35,8 @@ #include "YQWizard.h" #include "YQMainWinDock.h" #include "YDialogSpy.h" +#include "QY2Styler.h" +#include "QY2StyleEditor.h" // Include low-level X headers AFTER Qt headers: // X.h pollutes the global namespace (!!!) with pretty useless #defines @@ -60,6 +62,7 @@ _focusButton = 0; _defaultButton = 0; _highlightedChild = 0; + _styleEditor = 0; setFocusPolicy( Qt::StrongFocus ); setAutoFillBackground( true ); @@ -121,6 +124,9 @@ if ( _focusButton ) _focusButton->forgetDialog(); + + if ( _styleEditor ) + delete _styleEditor; } @@ -673,6 +679,16 @@ system( "/usr/bin/xterm &" ); return; } + else if ( event->key() == Qt::Key_S ) + { + yuiMilestone() << "Opening style editor" << endl; + _styleEditor = new QY2StyleEditor(this); + _styleEditor->show(); + _styleEditor->raise(); + _styleEditor->activateWindow(); + return; + } + } } Modified: trunk/qt/src/YQDialog.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQDialog.h?rev=54242&r1=54241&r2=54242&view=diff ============================================================================== --- trunk/qt/src/YQDialog.h (original) +++ trunk/qt/src/YQDialog.h Wed Dec 17 16:16:48 2008 @@ -30,6 +30,7 @@ class YQWizard; class QEventLoop; class QTimer; +class QY2StyleEditor; class YQDialog : public QWidget, public YDialog @@ -290,6 +291,8 @@ YWidget * _highlightedChild; QPalette _preHighlightPalette; bool _preHighlightAutoFill; + QY2StyleEditor* _styleEditor; + }; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org