Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libyui for openSUSE:Factory checked in at 2022-02-11 23:07:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libyui (Old) and /work/SRC/openSUSE:Factory/.libyui.new.1956 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libyui" Fri Feb 11 23:07:09 2022 rev:75 rq:953121 version:4.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/libyui/libyui.changes 2022-02-06 23:53:15.747228259 +0100 +++ /work/SRC/openSUSE:Factory/.libyui.new.1956/libyui.changes 2022-02-11 23:08:18.870756639 +0100 @@ -1,0 +2,10 @@ +Wed Feb 9 13:23:54 UTC 2022 - Stefan Hundhammer <shundham...@suse.com> + +- Made widget style sheet (theme) switching discoverable in the Qt UI: + Added an icon button to YQWizard + (jsc#SLE-20564, bsc#1195730) + More info + screenshots: https://github.com/libyui/libyui/pull/65 +- Fixed Qt warning in y2log: QFrame '' already has a layout +- 4.3.1 + +------------------------------------------------------------------- Old: ---- libyui-4.3.0.tar.bz2 New: ---- libyui-4.3.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libyui-bindings.spec ++++++ --- /var/tmp/diff_new_pack.ZKBkl4/_old 2022-02-11 23:08:19.534758483 +0100 +++ /var/tmp/diff_new_pack.ZKBkl4/_new 2022-02-11 23:08:19.542758506 +0100 @@ -20,7 +20,7 @@ Name: libyui-bindings # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 Summary: Bindings for libyui License: LGPL-2.1-only OR LGPL-3.0-only ++++++ libyui-ncurses-pkg.spec ++++++ --- /var/tmp/diff_new_pack.ZKBkl4/_old 2022-02-11 23:08:19.566758571 +0100 +++ /var/tmp/diff_new_pack.ZKBkl4/_new 2022-02-11 23:08:19.574758594 +0100 @@ -19,7 +19,7 @@ Name: libyui-ncurses-pkg # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 libyui-ncurses-rest-api.spec: same change libyui-ncurses.spec: same change ++++++ libyui-qt-graph.spec ++++++ --- /var/tmp/diff_new_pack.ZKBkl4/_old 2022-02-11 23:08:19.686758905 +0100 +++ /var/tmp/diff_new_pack.ZKBkl4/_new 2022-02-11 23:08:19.690758916 +0100 @@ -19,7 +19,7 @@ Name: libyui-qt-graph # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 ++++++ libyui-qt-pkg.spec ++++++ --- /var/tmp/diff_new_pack.ZKBkl4/_old 2022-02-11 23:08:19.714758982 +0100 +++ /var/tmp/diff_new_pack.ZKBkl4/_new 2022-02-11 23:08:19.722759005 +0100 @@ -19,7 +19,7 @@ Name: libyui-qt-pkg # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 libyui-qt-rest-api.spec: same change libyui-qt.spec: same change libyui-rest-api.spec: same change libyui.spec: same change ++++++ libyui-4.3.0.tar.bz2 -> libyui-4.3.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/VERSION.cmake new/libyui-4.3.1/VERSION.cmake --- old/libyui-4.3.0/VERSION.cmake 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/VERSION.cmake 2022-02-10 11:08:08.000000000 +0100 @@ -1,6 +1,6 @@ SET( VERSION_MAJOR "4") SET( VERSION_MINOR "3" ) -SET( VERSION_PATCH "0" ) +SET( VERSION_PATCH "1" ) SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" ) SET( SONAME_MAJOR "16" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/libyui-qt/src/YQApplication.cc new/libyui-4.3.1/libyui-qt/src/YQApplication.cc --- old/libyui-4.3.0/libyui-qt/src/YQApplication.cc 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/libyui-qt/src/YQApplication.cc 2022-02-10 11:08:08.000000000 +0100 @@ -528,7 +528,7 @@ dialog->setOptions( QFileDialog::DontUseNativeDialog ); QString fileName; - if( dialog->exec() == QDialog::Accepted ) + if ( dialog->exec() == QDialog::Accepted ) fileName = dialog->selectedFiles().value( 0 ); delete dialog; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/libyui-qt/src/YQItemSelector.cc new/libyui-4.3.1/libyui-qt/src/YQItemSelector.cc --- old/libyui-4.3.0/libyui-qt/src/YQItemSelector.cc 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/libyui-qt/src/YQItemSelector.cc 2022-02-10 11:08:08.000000000 +0100 @@ -294,7 +294,7 @@ void YQItemSelector::activateItem( YItem * item ) { - if( notify() ) + if ( notify() ) YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ValueChanged ) ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/libyui-qt/src/YQMultiProgressMeter.cc new/libyui-4.3.1/libyui-qt/src/YQMultiProgressMeter.cc --- old/libyui-4.3.0/libyui-qt/src/YQMultiProgressMeter.cc 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/libyui-qt/src/YQMultiProgressMeter.cc 2022-02-10 11:08:08.000000000 +0100 @@ -98,7 +98,7 @@ float totalSum = 0.0; - for( int i=0; i < segments(); i++ ) + for ( int i=0; i < segments(); i++ ) totalSum += maxValue( i ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/libyui-qt/src/YQUI.cc new/libyui-4.3.1/libyui-qt/src/YQUI.cc --- old/libyui-4.3.0/libyui-qt/src/YQUI.cc 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/libyui-qt/src/YQUI.cc 2022-02-10 11:08:08.000000000 +0100 @@ -244,7 +244,7 @@ { if ( argv ) { - for( int i=0; i < argc; i++ ) + for ( int i=0; i < argc; i++ ) { QString opt = argv[i]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/libyui-qt/src/YQWizard.cc new/libyui-4.3.1/libyui-qt/src/YQWizard.cc --- old/libyui-4.3.0/libyui-qt/src/YQWizard.cc 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/libyui-qt/src/YQWizard.cc 2022-02-10 11:08:08.000000000 +0100 @@ -1,5 +1,6 @@ /* Copyright (C) 2000-2012 Novell, Inc + Copyright (C) 2022 SUSE LLC This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the @@ -43,11 +44,13 @@ #include <QMenuBar> #include <QPixmap> #include <QStackedWidget> +#include <QToolButton> #include "QY2HelpDialog.h" #include "QY2ListView.h" #include "QY2RelNotesDialog.h" #include "QY2Styler.h" +#include "QY2StyleSheetSelector.h" #include "utf8.h" #include "YQAlignment.h" @@ -90,6 +93,7 @@ , _helpDialog( NULL ) , _hotkeysDialog( NULL ) , _relNotesDialog( NULL ) + , _styleButtonPos( NoStyleButton ) { setObjectName( "wizard" ); setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); @@ -116,6 +120,8 @@ _releaseNotesButton = 0; _treePanel = 0; _tree = 0; + _styleButton = 0; + _styleButton2 = 0; _workArea = 0; _clientArea = 0; _menuBar = 0; @@ -128,13 +134,21 @@ _abortButton = 0; _nextButton = 0; _sendButtonEvents = true; + _forceBanner = false; + _forceTitleLeft = false; _contentsReplacePoint = 0; _previousWindowIcon = topLevelWidget()->windowIcon(); YQUI::setTextdomain( TEXTDOMAIN ); - if( topLevelWidget()->windowTitle().isEmpty() ) + if ( getenv( "Y2_FORCE_BANNER" ) ) + _forceBanner = true; // for layout debugging + + if ( getenv( "Y2_FORCE_TITLE_LEFT" ) ) + _forceTitleLeft = true; // for layout debugging + + if ( topLevelWidget()->windowTitle().isEmpty() ) { topLevelWidget()->setWindowTitle ( YQUI::ui()->applicationTitle() ); QString icon_name = QFileInfo( YUI::app()->applicationIcon().c_str() ).baseName(); @@ -144,7 +158,7 @@ layout->addLayout( layoutSideBar( this ) ); layout->addWidget( layoutWorkArea( this ) ); - setStretchFactor( indexOf( _sideBar ), 0 ); + setStretchFactor( indexOf( _sideBar ), 0 ); setStretchFactor( indexOf( _workArea ), 1 ); setCollapsible( indexOf( _sideBar ), false ); @@ -165,7 +179,6 @@ if ( YQUI::ui()->fullscreen() ) topLevelWidget()->activateWindow(); - } @@ -243,7 +256,7 @@ _sideBar->setObjectName( QString( "_sideBar-%1" ).arg( long( this ) ) ); _sideBar->installEventFilter( this ); - QVBoxLayout *vbox = new QVBoxLayout( ); + QVBoxLayout *vbox = new QVBoxLayout(); vbox->addWidget( _sideBar ); if ( _treeEnabled ) @@ -335,7 +348,7 @@ QVBoxLayout *_stepsVBox = new QVBoxLayout( _stepsPanel ); - QGridLayout *_stepsGrid = new QGridLayout( ); + QGridLayout *_stepsGrid = new QGridLayout(); _stepsGrid->setObjectName( QString( "_stepsGrid_%1" ).arg( long( this ) ) ); YUI_CHECK_NEW( _stepsGrid ); _stepsVBox->addLayout( _stepsGrid ); @@ -485,16 +498,16 @@ if (_oldSteps.empty()) return; - foreach( Step *oldStep, _oldSteps) + foreach ( Step *oldStep, _oldSteps) { Step *newStep; - if( !oldStep->isHeading() ) + if ( !oldStep->isHeading() ) newStep = new Step( oldStep->name()); else newStep = new StepHeading( oldStep->name()); - foreach( QString oneId, oldStep->id()) + foreach ( QString oneId, oldStep->id()) { newStep->addID( oneId); _stepsIDs.insert( oneId, newStep ); @@ -676,34 +689,45 @@ -QWidget *YQWizard::layoutWorkArea( QWidget * parent ) +QWidget * YQWizard::layoutWorkArea( QWidget * parent ) { _workArea = new QFrame( parent ); + YUI_CHECK_NEW( _workArea ); + _workArea->setObjectName( "WorkArea" ); - QVBoxLayout *vbox = new QVBoxLayout( _workArea ); - YUI_CHECK_NEW( vbox ); + QVBoxLayout * workAreaVBox = new QVBoxLayout( _workArea ); + YUI_CHECK_NEW( workAreaVBox ); - // Add the logo at the top - - if (YUI::application()->showProductLogo()) + if ( useBanner() ) { + // + // Banner area at the top + // with a product logo on the left and an optional banner text on the right + // (the machine name/type for s/390) + // + QWidget * logoWidget = new QWidget; logoWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); // hor/vert - logoWidget->setObjectName("LogoHBox"); - vbox->addWidget( logoWidget ); + logoWidget->setObjectName( "LogoHBox" ); + workAreaVBox->addWidget( logoWidget ); - QHBoxLayout * logoHBox = new QHBoxLayout(logoWidget); + QHBoxLayout * logoHBox = new QHBoxLayout( logoWidget ); YUI_CHECK_NEW( logoHBox ); + // + // Add the logo at the top + // + _dialogLogo = new QLabel( _workArea ); YUI_CHECK_NEW( _dialogLogo ); + logoHBox->addWidget( _dialogLogo ); _dialogLogo->setObjectName( "DialogLogo" ); _dialogLogo->setAlignment( Qt::AlignLeft ); QY2Styler::styler()->registerChildWidget( this, _dialogLogo ); _dialogLogo->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert - _dialogLogo->setMinimumHeight(59); // FIXME: control size via stylesheet, did not find how - _dialogLogo->setMinimumWidth(100); + _dialogLogo->setMinimumHeight( 59 ); // FIXME: control size via stylesheet, did not find how + _dialogLogo->setMinimumWidth( 100 ); logoHBox->addStretch(); @@ -714,60 +738,92 @@ _dialogBanner->setObjectName( "DialogBanner" ); _dialogBanner->setAlignment( Qt::AlignCenter ); QY2Styler::styler()->registerChildWidget( this, _dialogBanner ); + + if ( titleIsOnTheLeft() && ! _styleButton ) + { + // "Change Widget Style" button + // + // If the wizard title is on the left, e.g. in the SLE installation + // theme, we need a different place for the "Change Widget Style" + // button. + // + // If there is a banner at the top, let's put it at the very right + // of that banner; but beware that in some scenarios (e.g. s/390) + // there is the machine type also in the top right of the banner + // area, so we need to maintain some distance from it. + // + // https://documentation.suse.com/sles/15-SP3/html/SLES-all/cha-install.html#sec-yast-install-s390-part + + logoHBox->addSpacing( 10 ); + + _styleButton = addStyleButton( _workArea ); + logoHBox->addWidget( _styleButton ); + _styleButtonPos = StyleButtonInLogoBanner; + } } + + // + // Wizard menu bar + // (not to be confused with the newer YMenuBar used e.g. in the partitioner) // - // Menu bar + // This is rarely used these days; only (?) in the AutoYaST config module. // _menuBar = new QMenuBar( _workArea ); YUI_CHECK_NEW( _menuBar ); _menuBar->hide(); // will be made visible when menus are added - vbox->addWidget( _menuBar ); + workAreaVBox->addWidget( _menuBar ); + - QWidget * dialog_inner_area = new QWidget (_workArea); - dialog_inner_area->setObjectName( "work_area" ); + // + // Inner dialog area / client area + // - QY2Styler::styler()->registerChildWidget( this, dialog_inner_area ); - QVBoxLayout * inner_vbox = new QVBoxLayout(dialog_inner_area); - YUI_CHECK_NEW( inner_vbox ); - vbox->addWidget (dialog_inner_area); + QWidget * dialogInnerArea = new QWidget( _workArea ); + dialogInnerArea->setObjectName( "work_area" ); - QVBoxLayout *innerbox = new QVBoxLayout( _workArea ); - QVBoxLayout *leftInnerBox = innerbox; - QVBoxLayout *rightInnerBox = innerbox; - YUI_CHECK_NEW( innerbox ); + QY2Styler::styler()->registerChildWidget( this, dialogInnerArea ); + QVBoxLayout * innerAreaVBox = new QVBoxLayout( dialogInnerArea ); + YUI_CHECK_NEW( innerAreaVBox ); + workAreaVBox->addWidget( dialogInnerArea ); - innerbox->setMargin ( YQWidgetMargin ); + QVBoxLayout * innerVBox = new QVBoxLayout(); + YUI_CHECK_NEW( innerVBox ); - inner_vbox->addLayout(innerbox); - vbox->setMargin( 0 ); + QVBoxLayout * leftInnerVBox = innerVBox; + QVBoxLayout * rightInnerVBox = innerVBox; + + innerVBox->setMargin( YQWidgetMargin ); + innerAreaVBox->addLayout( innerVBox ); + workAreaVBox->setMargin( 0 ); // // Dialog icon and heading + // at the left or at the top // if ( titleIsOnTheLeft() ) { - QHBoxLayout *bigHBox = new QHBoxLayout(); - innerbox->addLayout( bigHBox ); + QHBoxLayout * bigHBox = new QHBoxLayout(); + innerVBox->addLayout( bigHBox ); - leftInnerBox = new QVBoxLayout(); - leftInnerBox->setObjectName( "LeftInnerBox" ); - bigHBox->addLayout( leftInnerBox ); - bigHBox->setStretchFactor( leftInnerBox, 1 ); - - rightInnerBox = new QVBoxLayout(); - rightInnerBox->setObjectName( "RightInnerBox" ); - bigHBox->addLayout( rightInnerBox ); - bigHBox->setStretchFactor( rightInnerBox, 2 ); + leftInnerVBox = new QVBoxLayout(); + leftInnerVBox->setObjectName( "LeftInnerBox" ); + bigHBox->addLayout( leftInnerVBox ); + bigHBox->setStretchFactor( leftInnerVBox, 1 ); + + rightInnerVBox = new QVBoxLayout(); + rightInnerVBox->setObjectName( "RightInnerBox" ); + bigHBox->addLayout( rightInnerVBox ); + bigHBox->setStretchFactor( rightInnerVBox, 2 ); } QHBoxLayout * headingHBox = new QHBoxLayout(); YUI_CHECK_NEW( headingHBox ); - leftInnerBox->addLayout( headingHBox ); + leftInnerVBox->addLayout( headingHBox ); _dialogIcon = new QLabel( _workArea ); YUI_CHECK_NEW( _dialogIcon ); @@ -784,19 +840,50 @@ _dialogHeading->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); // hor/vert _dialogHeading->setObjectName( titleIsOnTheLeft() ? "DialogHeadingLeft" : "DialogHeadingTop" ) ; + if ( ! titleIsOnTheLeft() && ! _styleButton ) + { + // "Change Widget Style" button + // + // In most cases we want the "Change Style" button in the top right + // corner of the wizard. If we don't already have one, let's use the + // rightmost part of that row where the dialog (wizard) icon and title + // are; there is empty space anyway. + // + // Exception: The SLE installation theme where the dialog title is in + // very large font in the left third of the wizard dialog. That would + // put the "Change Style" button in the center of the screen where it + // would be very much misplaced. + // + // Since the SLE installation theme also has a big banner at the top + // with a SUSE logo and name on the left and optionally (on s/390) a + // machine type on the right, that is the preferred location for this + // button. In that case, it's already created and _styleButton is + // non-null. + // + // If that also didn't work out because there is no banner at the top, + // the button will go to the right of the [Help] button in the button + // box at the bottom of the wizard. + + _styleButton = addStyleButton( _workArea ); + headingHBox->addWidget( _styleButton ); + _styleButtonPos = StyleButtonRightOfDialogHeading; + } + + // // Client area (the part that belongs to the YCP application) // layoutClientArea( _workArea ); - rightInnerBox->addWidget( _clientArea ); + rightInnerVBox->addWidget( _clientArea ); + // // Button box // - QLayout *bb = layoutButtonBox( _workArea ); - innerbox->addLayout( bb ); + QLayout * buttonBox = layoutButtonBox( _workArea ); + innerVBox->addLayout( buttonBox ); return _workArea; } @@ -807,7 +894,7 @@ { _clientArea = new QFrame( parent ); YUI_CHECK_NEW( _clientArea ); - _clientArea->setObjectName("_clientArea"); + _clientArea->setObjectName( "_clientArea" ); QVBoxLayout *layout = new QVBoxLayout( _clientArea ); layout->setMargin( 0 ); @@ -837,18 +924,16 @@ YUI::widgetFactory()->createEmpty( _contentsReplacePoint ); _contentsReplacePoint->showChild(); - } - QLayout *YQWizard::layoutButtonBox( QWidget * parent ) { // // QHBoxLayout for the buttons // - QHBoxLayout * hbox = new QHBoxLayout(); // parent, spacing + QHBoxLayout * hbox = new QHBoxLayout(); YUI_CHECK_NEW( hbox ); hbox->setSpacing( 0 ); @@ -878,7 +963,7 @@ addAction( _hotkeysAction ); connect( _hotkeysAction, &pclass( _hotkeysAction )::triggered, - this, &pclass( this )::showHotkeys ); + this, &pclass( this )::showHotkeys ); hbox->addSpacing( 10 ); @@ -891,21 +976,63 @@ _releaseNotesButton = new YQWizardButton( this, parent, _( "&Release Notes" ).toStdString ()); YUI_CHECK_NEW( _releaseNotesButton ); hbox->addWidget( (QWidget *) _releaseNotesButton->widgetRep() ); - connect( _releaseNotesButton, &pclass(_releaseNotesButton)::clicked, - this, &pclass(this)::showReleaseNotes ); + connect( _releaseNotesButton, &pclass( _releaseNotesButton )::clicked, + this, &pclass( this )::showReleaseNotes ); if (_releaseNotesButtonId == "") { - _releaseNotesButton->hide(); // hidden until showReleaseNotesButton() is called + _releaseNotesButton->hide(); // hidden until showReleaseNotesButton() is called } else { showReleaseNotesButton( _releaseNotesButtonLabel, _releaseNotesButtonId ); } + + if ( ! _styleButton ) // if not already created + { + // "Change Widget Style" button + // + // This is the last-ditch effort to place the "Change Widget Style" + // button somewhere: There was no digalog title (wizard title) at the + // top, and despite a dialog title on the left (i.e. the SLE + // installation theme), there was no banner at the top. So let's put it + // here, next to the [Help] and (if present) [Release Notes] button. + // + // While this place is not ideal, here it doesn't get in the way of dialog + // content. + + hbox->addSpacing( 10 ); + _styleButton = addStyleButton( parent ); + hbox->addWidget( _styleButton ); + _styleButtonPos = StyleButtonRightOfHelpButton; + } + else if ( _styleButtonPos == StyleButtonRightOfDialogHeading ) + { + // If we already have a "Change Widget Style" button, but it is to the + // right of the dialog heading, create an alternate (but hidden) one to + // the right of the [Help] button: If during the wizard steps the one + // at the top is hidden because the dialog title is hidden, this one + // will be shown instead. + // + // As soon as there is a dialog title again, the primary one is shown + // again and this alternate one is hidden again, so there is always + // exactly one "Change Widget Style" button visible. + // + // This is relevant for menu-driven wizard dialogs like the partitioner + // and others with large table widgets that need a lot of screen space. + + hbox->addSpacing( 10 ); + _styleButton2 = addStyleButton( parent ); + hbox->addWidget( _styleButton2 ); + _styleButton2->hide(); + } + hbox->addStretch( 10 ); + + // // "Abort" button // @@ -950,12 +1077,55 @@ } -bool YQWizard::titleIsOnTheLeft() +QToolButton * YQWizard::addStyleButton( QWidget * parent ) +{ + QString styleSheet( "QToolButton#styleButton { border: 0px }" ); + + QToolButton * button = new QToolButton( parent ); + YUI_CHECK_NEW( button ); + + button->setObjectName( "styleButton" ); + button->setIcon( QIcon::fromTheme( ":day-night-mode" ) ); + button->setIconSize( QSize( 28, 28 ) ); + button->setAutoRaise( true ); + button->setStyleSheet( styleSheet ); + button->setToolTip( _( "Change the widget theme (Shift-F3)" ) ); + + connect( button, &pclass( button )::clicked, + this, &pclass( this )::askForWidgetStyle ); + + return button; +} + + +void YQWizard::askForWidgetStyle() +{ + // not using YQUI::yqApp()->askForWidgetStyle() to avoid busy cursor issues + + QY2StyleSheetSelector dialog( this ); + dialog.exec(); + // The return code doesn't matter because the dialog applies any changes instantly. +} + + +bool YQWizard::titleIsOnTheLeft() const { + if ( _forceTitleLeft ) // env Y2_FORCE_TITLE_LEFT + return true; + return wizardMode() == YWizardMode_TitleOnLeft; } +bool YQWizard::useBanner() const +{ + if ( _forceBanner ) // env Y2_FORCE_BANNER + return true; + + return YUI::application()->showProductLogo(); +} + + void YQWizard::destroyButtons() { delete _backButton; @@ -1050,12 +1220,33 @@ _dialogHeading->hide(); _dialogHeading->clear(); } + + if ( _styleButton && _styleButtonPos == StyleButtonRightOfDialogHeading ) + { + // If we have a "Change Widget Style" button and it's to the right + // of the dialog heading, make sure it's shown or hidden along with + // the dialog heading. It's better to not have a style button in + // one or two wizard steps than artificially adding a lot of empty + // space at the top of the wizard content; for example in + // menu-driven wizard steps (e.g. the partitioner) that have a menu + // bar at the top, but no wizard heading to save space. + + _styleButton->setVisible( _dialogHeading->isVisible() ); + + // Make sure we have exactly one "Change Widget Style" button + // visible. If we just made the one to the right of the dialog + // heading invisible, make the alternate one to the right of the + // "Help" button visible instead; and vice versa. + + if ( _styleButton2 ) + _styleButton2->setVisible( ! _styleButton->isVisible() ); + } } } string YQWizard::getDialogHeading() { - if (_dialogHeading) + if ( _dialogHeading ) return toUTF8(_dialogHeading->text()); else return ""; @@ -1142,6 +1333,8 @@ "<dt>Print Screen</dt>" "<dd>Take and save a screenshot. May not be available when YaST is running under " "some desktop environments.</dd>" + "<dt>Shift-F3</dt>" + "<dd>Select a widget style (color theme).</dd>" "<dt>Shift-F4</dt>" "<dd>Enable/disable the color palette optimized for vision impaired users.</dd>" "<dt>Shift-F7</dt>" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/libyui-qt/src/YQWizard.h new/libyui-4.3.1/libyui-qt/src/YQWizard.h --- old/libyui-4.3.0/libyui-qt/src/YQWizard.h 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/libyui-qt/src/YQWizard.h 2022-02-10 11:08:08.000000000 +0100 @@ -30,7 +30,7 @@ #include <string> -#include <qstringlist.h> +#include <QStringList> #include <QSplitter> #include "QY2ListView.h" @@ -43,6 +43,7 @@ class QMenuBar; class QPushButton; class QStackedWidget; +class QToolButton; class QTreeWidgetItem; class QY2HelpDialog; class QY2RelNotesDialog; @@ -50,6 +51,15 @@ class YReplacePoint; +enum YQStyleButtonPos +{ + NoStyleButton, + StyleButtonInLogoBanner, + StyleButtonRightOfDialogHeading, + StyleButtonRightOfHelpButton +}; + + class YQWizard : public QSplitter, public YWizard { Q_OBJECT @@ -488,6 +498,13 @@ **/ void sendMenuEvent( QAction *action ); + /** + * Open a pop-up to let the user choose from any of the available QSS + * widget style sheets of the theme directory. + **/ + void askForWidgetStyle(); + + protected: // Layout functions @@ -500,7 +517,9 @@ QWidget *layoutWorkArea ( QWidget * parent ); void layoutClientArea ( QWidget * parent ); QLayout *layoutButtonBox ( QWidget * parent ); - bool titleIsOnTheLeft(); + QToolButton *addStyleButton ( QWidget * parent ); + bool titleIsOnTheLeft() const; + bool useBanner() const; /** * Destroy the button box's buttons @@ -573,6 +592,8 @@ bool _protectNextButton; bool _stepsDirty; bool _sendButtonEvents; + bool _forceBanner; // env Y2_FORCE_BANNER + bool _forceTitleLeft; // env Y2_FORCE_TITLE_LEFT Direction _direction; QString _currentStepID; @@ -595,13 +616,16 @@ QPushButton * _treeButton; QFrame * _treePanel; QY2ListView * _tree; + YQStyleButtonPos _styleButtonPos; + QToolButton * _styleButton; + QToolButton * _styleButton2; QFrame * _workArea; QWidget * _clientArea; QMenuBar * _menuBar; QLabel * _dialogIcon; QLabel * _dialogLogo; - QLabel * _dialogBanner; + QLabel * _dialogBanner; QLabel * _dialogHeading; YQAlignment * _contents; YQWizardButton * _backButton; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/libyui-qt/src/icons/day-night-mode.svg new/libyui-4.3.1/libyui-qt/src/icons/day-night-mode.svg --- old/libyui-4.3.0/libyui-qt/src/icons/day-night-mode.svg 1970-01-01 01:00:00.000000000 +0100 +++ new/libyui-4.3.1/libyui-qt/src/icons/day-night-mode.svg 2022-02-10 11:08:08.000000000 +0100 @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + viewBox="0 0 48 31" + version="1.1" + id="svg4592" + sodipodi:docname="day-night-mode-bw.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)" + width="48" + height="31"> + <metadata + id="metadata4598"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs4596" /> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1835" + inkscape:window-height="1122" + id="namedview4594" + showgrid="false" + inkscape:zoom="19.666667" + inkscape:cx="20.04574" + inkscape:cy="14.01707" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="svg4592" /> + <path + style="fill:#f0f0f0;fill-opacity:1;stroke-width:1.09090912" + inkscape:connector-curvature="0" + id="path4588" + d="m 15,10.545455 c -3.010909,0 -5.454546,2.443636 -5.454546,5.454545 0,3.010909 2.443637,5.454545 5.454546,5.454545 3.010909,0 5.454545,-2.443636 5.454545,-5.454545 0,-3.010909 -2.443636,-5.454545 -5.454545,-5.454545 z M 4.0909091,17.090909 h 2.1818182 c 0.6,0 1.0909091,-0.490909 1.0909091,-1.090909 0,-0.6 -0.4909091,-1.090909 -1.0909091,-1.090909 H 4.0909091 C 3.4909091,14.909091 3,15.4 3,16 c 0,0.6 0.4909091,1.090909 1.0909091,1.090909 z m 19.6363639,0 h 2.181818 C 26.509091,17.090909 27,16.6 27,16 27,15.4 26.509091,14.909091 25.909091,14.909091 h -2.181818 c -0.6,0 -1.090909,0.490909 -1.090909,1.090909 0,0.6 0.490909,1.090909 1.090909,1.090909 z M 13.909091,5.0909095 v 2.1818182 c 0,0.6 0.490909,1.0909087 1.090909,1.0909087 0.6,0 1.090909,-0.4909087 1.090909,-1.0909087 V 5.0909095 c 0,-0.6 -0.490909,-1.0909091 -1.090909,-1.0909091 -0.6,0 -1.090909,0.4909091 -1.090909,1.0909091 z m 0,19.6363635 v 2.181818 C 13.909091,27.509091 14.4,28 15,28 c 0.6,0 1.090909,-0.490909 1.09090 9,-1.090909 v -2.181818 c 0,-0.6 -0.490909,-1.090909 -1.090909,-1.090909 -0.6,0 -1.090909,0.490909 -1.090909,1.090909 z M 8.4436364,7.9054549 C 8.0181818,7.4800004 7.32,7.4800004 6.9054545,7.9054549 6.48,8.3309094 6.48,9.0290914 6.9054545,9.4436364 L 8.0618182,10.6 C 8.4872727,11.025455 9.185454,11.025455 9.6,10.6 10.014545,10.174545 10.025454,9.4763644 9.6,9.0618184 Z M 21.938182,21.4 c -0.425455,-0.425455 -1.123637,-0.425455 -1.538182,0 -0.425455,0.425455 -0.425455,1.123636 0,1.538182 l 1.156364,1.156363 c 0.425454,0.425455 1.123636,0.425455 1.538181,0 0.425455,-0.425454 0.425455,-1.123636 0,-1.538181 z M 23.094545,9.4436364 c 0.425455,-0.425454 0.425455,-1.123636 0,-1.5381815 -0.425454,-0.4254545 -1.123636,-0.4254545 -1.538181,0 L 20.4,9.0618184 c -0.425455,0.425455 -0.425455,1.1236366 0,1.5381816 0.425455,0.414545 1.123636,0.425455 1.538182,0 z M 9.6,22.938182 C 10.025454,22.512727 10.025454,21.814545 9.6,21.4 9.174545,20.974545 8.4763636,20.974545 8.0618182,21.4 L 6.9054545,22. 556364 C 6.48,22.981818 6.48,23.68 6.9054545,24.094545 c 0.4254546,0.414546 1.1236364,0.425455 1.5381819,0 z" /> + <g + transform="matrix(1.2,0,0,1.2,19.6,1.6)" + style="fill:#000000" + id="g5191" + inkscape:transform-center-x="1.3423729" + inkscape:transform-center-y="-0.1220339"> + <path + inkscape:connector-curvature="0" + d="m 9.5,2 c -1.82,0 -3.53,0.5 -5,1.35 2.99,1.73 5,4.95 5,8.65 0,3.7 -2.01,6.92 -5,8.65 1.47,0.85 3.18,1.35 5,1.35 5.52,0 10,-4.48 10,-10 0,-5.52 -4.48,-10 -10,-10 z" + id="path5189" /> + </g> +</svg> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/libyui-qt/src/qt_icons.qrc new/libyui-4.3.1/libyui-qt/src/qt_icons.qrc --- old/libyui-4.3.0/libyui-qt/src/qt_icons.qrc 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/libyui-qt/src/qt_icons.qrc 2022-02-10 11:08:08.000000000 +0100 @@ -6,6 +6,7 @@ <file alias="checkbox-auto-selected">icons/checkbox-auto-selected.png</file> <file alias="computer">icons/computer.svg</file> <file alias="configure">icons/configure.svg</file> + <file alias="day-night-mode">icons/day-night-mode.svg</file> <file alias="dialog-error">icons/dialog-error.svg</file> <file alias="dialog-information">icons/dialog-information.svg</file> <file alias="dialog-question">icons/dialog-question.svg</file> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui-bindings.spec new/libyui-4.3.1/package/libyui-bindings.spec --- old/libyui-4.3.0/package/libyui-bindings.spec 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui-bindings.spec 2022-02-10 11:08:08.000000000 +0100 @@ -20,7 +20,7 @@ Name: libyui-bindings # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 Summary: Bindings for libyui License: LGPL-2.1-only OR LGPL-3.0-only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui-ncurses-pkg.spec new/libyui-4.3.1/package/libyui-ncurses-pkg.spec --- old/libyui-4.3.0/package/libyui-ncurses-pkg.spec 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui-ncurses-pkg.spec 2022-02-10 11:08:08.000000000 +0100 @@ -19,7 +19,7 @@ Name: libyui-ncurses-pkg # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui-ncurses-rest-api.spec new/libyui-4.3.1/package/libyui-ncurses-rest-api.spec --- old/libyui-4.3.0/package/libyui-ncurses-rest-api.spec 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui-ncurses-rest-api.spec 2022-02-10 11:08:08.000000000 +0100 @@ -19,7 +19,7 @@ Name: libyui-ncurses-rest-api # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui-ncurses.spec new/libyui-4.3.1/package/libyui-ncurses.spec --- old/libyui-4.3.0/package/libyui-ncurses.spec 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui-ncurses.spec 2022-02-10 11:08:08.000000000 +0100 @@ -19,7 +19,7 @@ Name: libyui-ncurses # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui-qt-graph.spec new/libyui-4.3.1/package/libyui-qt-graph.spec --- old/libyui-4.3.0/package/libyui-qt-graph.spec 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui-qt-graph.spec 2022-02-10 11:08:08.000000000 +0100 @@ -19,7 +19,7 @@ Name: libyui-qt-graph # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui-qt-pkg.spec new/libyui-4.3.1/package/libyui-qt-pkg.spec --- old/libyui-4.3.0/package/libyui-qt-pkg.spec 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui-qt-pkg.spec 2022-02-10 11:08:08.000000000 +0100 @@ -19,7 +19,7 @@ Name: libyui-qt-pkg # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui-qt-rest-api.spec new/libyui-4.3.1/package/libyui-qt-rest-api.spec --- old/libyui-4.3.0/package/libyui-qt-rest-api.spec 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui-qt-rest-api.spec 2022-02-10 11:08:08.000000000 +0100 @@ -19,7 +19,7 @@ Name: libyui-qt-rest-api # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui-qt.spec new/libyui-4.3.1/package/libyui-qt.spec --- old/libyui-4.3.0/package/libyui-qt.spec 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui-qt.spec 2022-02-10 11:08:08.000000000 +0100 @@ -19,7 +19,7 @@ Name: libyui-qt # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui-rest-api.spec new/libyui-4.3.1/package/libyui-rest-api.spec --- old/libyui-4.3.0/package/libyui-rest-api.spec 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui-rest-api.spec 2022-02-10 11:08:08.000000000 +0100 @@ -19,7 +19,7 @@ Name: libyui-rest-api # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui.changes new/libyui-4.3.1/package/libyui.changes --- old/libyui-4.3.0/package/libyui.changes 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui.changes 2022-02-10 11:08:08.000000000 +0100 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Wed Feb 9 13:23:54 UTC 2022 - Stefan Hundhammer <shundham...@suse.com> + +- Made widget style sheet (theme) switching discoverable in the Qt UI: + Added an icon button to YQWizard + (jsc#SLE-20564, bsc#1195730) + More info + screenshots: https://github.com/libyui/libyui/pull/65 +- Fixed Qt warning in y2log: QFrame '' already has a layout +- 4.3.1 + +------------------------------------------------------------------- Tue Feb 1 15:18:26 UTC 2022 - Stefan Hundhammer <shundham...@suse.com> - Added widget style sheet (theme) switching to Qt UI (jsc#SLE-20564) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libyui-4.3.0/package/libyui.spec new/libyui-4.3.1/package/libyui.spec --- old/libyui-4.3.0/package/libyui.spec 2022-02-02 09:51:25.000000000 +0100 +++ new/libyui-4.3.1/package/libyui.spec 2022-02-10 11:08:08.000000000 +0100 @@ -19,7 +19,7 @@ Name: libyui # DO NOT manually bump the version here; instead, use rake version:bump -Version: 4.3.0 +Version: 4.3.1 Release: 0 %define so_version 16