Author: sh-sh-sh Date: Fri Sep 21 15:00:52 2007 New Revision: 41021 URL: http://svn.opensuse.org/viewcvs/yast?rev=41021&view=rev Log: back-ported tgoettlicher's wizard changes to mod-ui Modified: branches/tmp/sh/mod-ui/qt/src/YQWizard.cc branches/tmp/sh/mod-ui/qt/src/YQWizard.h Modified: branches/tmp/sh/mod-ui/qt/src/YQWizard.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQWizard.cc?rev=41021&r1=41020&r2=41021&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/YQWizard.cc (original) +++ branches/tmp/sh/mod-ui/qt/src/YQWizard.cc Fri Sep 21 15:00:52 2007 @@ -87,13 +87,10 @@ #define TEXTDOMAIN "packages-qt" #define ENABLE_GRADIENTS 1 -#define ENABLE_TITLEBAR 0 #define USE_SEPARATOR 1 -#if ! ENABLE_TITLEBAR -# define WORK_AREA_TOP_MARGIN 10 -#endif +#define WORK_AREA_TOP_MARGIN 10 #if ENABLE_GRADIENTS # define WORK_AREA_BOTTOM_MARGIN 8 @@ -119,11 +116,11 @@ #define USE_ICON_ON_HELP_BUTTON 0 -YQWizard::YQWizard( YWidget * parent, - YWidgetID * backButtonId, const string & backButtonLabel, - YWidgetID * abortButtonId, const string & abortButtonLabel, - YWidgetID * nextButtonId, const string & nextButtonLabel, - YWizardMode wizardMode ) +YQWizard::YQWizard( YWidget * parent, + YWidgetID * backButtonId, const string & backButtonLabel, + YWidgetID * abortButtonId, const string & abortButtonLabel, + YWidgetID * nextButtonId, const string & nextButtonLabel, + YWizardMode wizardMode ) : QVBox( (QWidget *) parent->widgetRep() ) , YWizard( parent, backButtonId, backButtonLabel, @@ -187,16 +184,20 @@ // Create widgets // -#if ENABLE_TITLEBAR - layoutTitleBar( this ); -#else - QWidget * spacer = addVSpacing( this, WORK_AREA_TOP_MARGIN ); - YUI_CHECK_NEW( spacer ); -# if ENABLE_GRADIENTS - spacer->setPaletteBackgroundColor( _gradientCenterColor ); -# endif -#endif + if ( ! _titleBarGradientPixmap.isNull() ) + { + layoutTitleBar( this ); + } + else + { + QWidget * spacer = addVSpacing( this, WORK_AREA_TOP_MARGIN ); + CHECK_PTR( spacer ); + +# if ENABLE_GRADIENTS + spacer->setPaletteBackgroundColor( _gradientTopColor ); +# endif + } QHBox * hBox = new QHBox( this ); YUI_CHECK_NEW( hBox ); @@ -311,15 +312,14 @@ #if ENABLE_GRADIENTS -# if ENABLE_TITLEBAR - - // Top gradient - - QLabel * topGradient = new QLabel( _stepsPanel ); - YUI_CHECK_NEW( topGradient ); - setGradient( topGradient, _topGradientPixmap ); + if ( ! _titleBarGradientPixmap.isNull() ) + { + // Top gradient -# endif + QLabel * topGradient = new QLabel( _stepsPanel ); + CHECK_PTR( topGradient ); + setGradient( topGradient, _topGradientPixmap ); + } #endif @@ -691,6 +691,13 @@ _helpBrowser->setMargin( 4 ); _helpBrowser->setResizePolicy( QScrollView::Manual ); + + // Set help browser text color + QPixmap fgPixmap = QPixmap( PIXMAP_DIR "help-text-color.png" ); + if (! fgPixmap.isNull() ) + _helpBrowser->setPaletteForegroundColor( pixelColor( fgPixmap, 0, 0, paletteForegroundColor() ) ); + + if ( highColorDisplay() ) { // Set fancy help browser background pixmap @@ -921,7 +928,7 @@ if ( item ) { YQSignalBlocker sigBlocker( _tree ); - + _tree->setSelected( item, true ); _tree->ensureItemVisible( item ); } @@ -1086,7 +1093,7 @@ YUI_CHECK_NEW( _contents ); _contents->setStretchable( YD_HORIZ, true ); - _contents->setStretchable( YD_VERT, true ); + _contents->setStretchable( YD_VERT, true ); _contents->installEventFilter( this ); _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); // hor/vert @@ -1224,7 +1231,8 @@ _topGradientPixmap = QPixmap( PIXMAP_DIR "top-gradient.png" ); _bottomGradientPixmap = QPixmap( PIXMAP_DIR "bottom-gradient.png" ); _titleBarGradientPixmap = QPixmap( PIXMAP_DIR "title-bar-gradient.png" ); - _gradientCenterColor = pixelColor( _bottomGradientPixmap, 0, 0 ); + _gradientCenterColor = pixelColor( _bottomGradientPixmap, 0, 0, paletteBackgroundColor() ); + _gradientTopColor = pixelColor( _topGradientPixmap, 0, 0 , paletteBackgroundColor() ); } else // 8 bit display or worse - don't use gradients { @@ -1234,6 +1242,7 @@ // Use deault widget background (some shade of grey) for the center // stretchable part of the side bar. _gradientCenterColor = paletteBackgroundColor(); + _gradientTopColor = paletteBackgroundColor(); } #endif } @@ -1247,15 +1256,15 @@ if ( highColorDisplay() ) { - _stepCurrentColor = pixelColor( QPixmap( PIXMAP_DIR "color-step-current.png" ), 0, 0 ); - _stepToDoColor = pixelColor( QPixmap( PIXMAP_DIR "color-step-todo.png" ), 0, 0 ); - _stepDoneColor = pixelColor( QPixmap( PIXMAP_DIR "color-step-done.png" ), 0, 0 ); + _stepCurrentColor = pixelColor( QPixmap( PIXMAP_DIR "color-step-current.png" ), 0, 0, paletteForegroundColor() ); + _stepToDoColor = pixelColor( QPixmap( PIXMAP_DIR "color-step-todo.png" ), 0, 0, paletteForegroundColor() ); + _stepDoneColor = pixelColor( QPixmap( PIXMAP_DIR "color-step-done.png" ), 0, 0, paletteForegroundColor() ); } else { - _stepCurrentColor = paletteForegroundColor(); - _stepToDoColor = paletteForegroundColor(); - _stepDoneColor = paletteForegroundColor(); + _stepCurrentColor = paletteForegroundColor(); + _stepToDoColor = paletteForegroundColor(); + _stepDoneColor = paletteForegroundColor(); } } @@ -1308,8 +1317,11 @@ -QColor YQWizard::pixelColor( const QPixmap & pixmap, int x, int y ) +QColor YQWizard::pixelColor( const QPixmap & pixmap, int x, int y, const QColor & defaultColor ) { + if ( pixmap.isNull() ) + return defaultColor; + // QPixmap doesn't allow direct access to pixel values (which makes some // sense since this requires a round-trip to the X server - pixmaps are X // server resources), so we need to convert the QPixmap to a QImage to get @@ -1318,6 +1330,7 @@ // cut out a tiny portion of the original pixmap and convert only that tiny // portion. + QPixmap tiny( 1, 1 ); bitBlt( &tiny, 0, 0, // dest, dest_x, dest_y Modified: branches/tmp/sh/mod-ui/qt/src/YQWizard.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQWizard.h?rev=41021&r1=41020&r2=41021&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/YQWizard.h (original) +++ branches/tmp/sh/mod-ui/qt/src/YQWizard.h Fri Sep 21 15:00:52 2007 @@ -331,9 +331,10 @@ /** * Return the color of pixel( x, y ) of a pixmap. + * If pixmap is null defaultColor is returned. * This is a _very_ expensive operation! **/ - static QColor pixelColor( const QPixmap & pixmap, int x, int y ); + static QColor pixelColor( const QPixmap & pixmap, int x, int y, const QColor & defaultColor ); protected slots: @@ -576,6 +577,7 @@ QPixmap _titleBarGradientPixmap; QPixmap _topGradientPixmap; QColor _gradientCenterColor; + QColor _gradientTopColor; QPixmap _bottomGradientPixmap; QPixmap _stepCurrentIcon; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org