![](https://seccdn.libravatar.org/avatar/d95f774280866d45941b1365718208ff.jpg?s=120&d=mm&r=g)
Author: kmachalkova Date: Thu Mar 19 15:26:16 2009 New Revision: 56241 URL: http://svn.opensuse.org/viewcvs/yast?rev=56241&view=rev Log: Backport of QSplitter into SLE11 SP1 - bnc#460739 & friends Modified: branches/tmp/SLE-11-SP1-Stash/qt/package/yast2-qt.changes branches/tmp/SLE-11-SP1-Stash/qt/src/YQMainWinDock.cc branches/tmp/SLE-11-SP1-Stash/qt/src/YQWizard.cc branches/tmp/SLE-11-SP1-Stash/qt/src/YQWizard.h Modified: branches/tmp/SLE-11-SP1-Stash/qt/package/yast2-qt.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/SLE-11-SP1-Stash/qt/package/yast2-qt.changes?rev=56241&r1=56240&r2=56241&view=diff ============================================================================== --- branches/tmp/SLE-11-SP1-Stash/qt/package/yast2-qt.changes (original) +++ branches/tmp/SLE-11-SP1-Stash/qt/package/yast2-qt.changes Thu Mar 19 15:26:16 2009 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Mar 19 14:57:45 CET 2009 - kmachalkova@suse.cz + +- Backported QSplitter-based Wizard widget, to make installation + steps panel collapsible (bnc#460739, bnc#445682 and others) + +------------------------------------------------------------------- Tue Jan 13 17:03:58 CET 2009 - tgoettlicher@suse.de - Fixed bnc #445951: Help dialog untranslated Modified: branches/tmp/SLE-11-SP1-Stash/qt/src/YQMainWinDock.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/SLE-11-SP1-Stash/qt/src/YQMainWinDock.cc?rev=56241&r1=56240&r2=56241&view=diff ============================================================================== --- branches/tmp/SLE-11-SP1-Stash/qt/src/YQMainWinDock.cc (original) +++ branches/tmp/SLE-11-SP1-Stash/qt/src/YQMainWinDock.cc Thu Mar 19 15:26:16 2009 @@ -93,9 +93,9 @@ if ( wizard && wizard->isSecondary() ) { if ( QApplication::isLeftToRight() ) - rect.setLeft( _sideBarWidth ); + rect.setLeft( 0 ); else - rect.setWidth( rect.width() - _sideBarWidth ); + rect.setWidth( rect.width() ); } if ( dialog->rect() != rect ) @@ -168,7 +168,8 @@ // untouched; only the right side (the work area) of that wizard is to be // activated or deactivated. - YQWizard * wizard = dialog->findWizard(); + // probably no longer needed, now the windows (even with steps) fully overlap ?? + /*YQWizard * wizard = dialog->findWizard(); if ( wizard && wizard->wizardMode() == YWizardMode_Steps ) { @@ -177,7 +178,7 @@ if ( wizardWorkArea ) widget = wizardWorkArea; // else -> stick with dialog->widgetRep() - } + }*/ if ( widget ) widget->setEnabled( active ); Modified: branches/tmp/SLE-11-SP1-Stash/qt/src/YQWizard.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/SLE-11-SP1-Stash/qt/src/YQWizard.cc?rev=56241&r1=56240&r2=56241&view=diff ============================================================================== --- branches/tmp/SLE-11-SP1-Stash/qt/src/YQWizard.cc (original) +++ branches/tmp/SLE-11-SP1-Stash/qt/src/YQWizard.cc Thu Mar 19 15:26:16 2009 @@ -81,7 +81,8 @@ const string & abortButtonLabel, const string & nextButtonLabel, YWizardMode wizardMode ) - : QFrame( (QWidget *) parent->widgetRep() ) + : QSplitter( Qt::Horizontal, (QWidget *) parent->widgetRep() ) + , YWizard( parent, backButtonLabel, abortButtonLabel, @@ -93,6 +94,7 @@ , _helpDlg ( NULL ) { setObjectName( "wizard" ); + setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); QHBoxLayout* layout = new QHBoxLayout( this ); layout->setSpacing( 0 ); @@ -100,7 +102,8 @@ setWidgetRep( this ); - _stepsEnabled = (wizardMode == YWizardMode_Steps); + //either main wizard with `opt(`stepsEnabled), or sub-wizard of steps-enabled wizard + _stepsEnabled = ( (wizardMode == YWizardMode_Steps) || main_wizard ); _treeEnabled = (wizardMode == YWizardMode_Tree); _stepsRegistered = false; @@ -138,6 +141,9 @@ layout->addLayout( layoutSideBar( this ) ); layout->addWidget( layoutWorkArea( this ) ); + setStretchFactor(indexOf(_sideBar),0); + setStretchFactor(indexOf(_workArea),1); + /* If steps are enabled, we want to delay the registering for after we have steps registered */ if ( !_stepsEnabled ) @@ -149,6 +155,7 @@ } else if ( main_wizard ) { + copySteps( main_wizard ); YQMainWinDock::mainWinDock()->resizeVisibleChild(); } @@ -159,7 +166,14 @@ { deleteSteps(); if ( this == main_wizard ) - main_wizard = 0; + { + main_wizard = 0; + } + else if ( main_wizard ) + { + //transfer the widget ratio to the main wizard + main_wizard->setSizes( sizes() ); + } delete _helpDlg; @@ -467,6 +481,37 @@ updateStepStates(); } +void YQWizard::copySteps( YQWizard *wizard) +{ + QList<Step*> _oldSteps = wizard->stepsList(); + + if (_oldSteps.empty()) + return; + + foreach( Step *oldStep, _oldSteps) + { + Step *newStep; + + if( !oldStep->isHeading() ) + newStep = new Step( oldStep->name()); + else + newStep = new StepHeading( oldStep->name()); + + foreach( QString oneId, oldStep->id()) + { + newStep->addID( oneId); + _stepsIDs.insert( oneId, newStep ); + } + + newStep->setEnabled( oldStep->isEnabled()); + _stepsList.append(newStep); + + } + + setCurrentStep( wizard->currentStep().toStdString() ); + setSizes( main_wizard->sizes()); +} + void YQWizard::deleteSteps() { Modified: branches/tmp/SLE-11-SP1-Stash/qt/src/YQWizard.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/SLE-11-SP1-Stash/qt/src/YQWizard.h?rev=56241&r1=56240&r2=56241&view=diff ============================================================================== --- branches/tmp/SLE-11-SP1-Stash/qt/src/YQWizard.h (original) +++ branches/tmp/SLE-11-SP1-Stash/qt/src/YQWizard.h Thu Mar 19 15:26:16 2009 @@ -27,6 +27,7 @@ #include <qstringlist.h> #include "QY2ListView.h" #include <QGridLayout> +#include <QSplitter> #include <qlabel.h> #include <QMenu> #include <qevent.h> @@ -37,6 +38,7 @@ class QGridLayout; class QFrame; +class QSplitter; class QLabel; class QMenuBar; class QPushButton; @@ -51,7 +53,7 @@ class QY2HelpDialog; -class YQWizard : public QFrame, public YWizard +class YQWizard : public QSplitter, public YWizard { Q_OBJECT @@ -167,6 +169,20 @@ virtual void addStepHeading( const string & text ); /** + * Return list of pointers to steps. + * Not needed outside copySteps() function + * + **/ + QList<YQWizard::Step*> stepsList() { return _stepsList; } + + /** + * Create a copy of given wizard's steps set (names & IDs) + * Populates _stepsList structure of current wizard + * + **/ + void copySteps( YQWizard *wizard); + + /** * Delete all steps and step headings from the internal lists. * The display is only updated upon calling updateSteps(). * @@ -182,6 +198,12 @@ virtual void setCurrentStep( const string & id ); /** + * Return QString ID of currently active step + * + **/ + QString currentStep() { return _currentStepID; }; + + /** * Update the steps display: Reflect the internal steps and heading lists * in the layout. * @@ -324,8 +346,8 @@ * This should not be needed outside of YQMainWinDock. **/ QWidget * workArea() const { return _workArea; } - - + + // // Geometry management // -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org