Author: coolo
Date: Sun Apr 13 18:37:05 2008
New Revision: 46490
URL: http://svn.opensuse.org/viewcvs/yast?rev=46490&view=rev
Log:
implenting secondary wizards - hopefully correct, can't
test outside of test cases
Modified:
trunk/qt/src/YQDialog.h
trunk/qt/src/YQMainWinDock.cc
trunk/qt/src/YQMainWinDock.h
trunk/qt/src/YQWizard.cc
trunk/qt/src/YQWizard.h
Modified: trunk/qt/src/YQDialog.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQDialog.h?rev=46490&r1=46489&r2=46490&view=diff
==============================================================================
--- trunk/qt/src/YQDialog.h (original)
+++ trunk/qt/src/YQDialog.h Sun Apr 13 18:37:05 2008
@@ -175,7 +175,7 @@
* currently accepts child dialogs) or 0.
**/
static QWidget * chooseParent( YDialogType dialogType );
-
+
/**
* Return the (first) default button between 'begin' and 'end'
* or 0 if there is none.
@@ -198,7 +198,7 @@
**/
YQWizard * ensureOnlyOneDefaultButton( YWidgetListConstIterator begin,
YWidgetListConstIterator end );
-
+
/**
* Internal open() method, called exactly once during the life
* time of the dialog in open().
@@ -213,7 +213,7 @@
* Implemented from YDialog.
**/
virtual YEvent * waitForEventInternal( int timeout_millisec );
-
+
/**
* Check if a user event is pending. If there is one, return it.
* If there is none, do not wait for one - return 0.
@@ -224,12 +224,12 @@
/**
* Activate this dialog: Make sure that it is shown as the topmost dialog
- * of this application and that it can receive input.
+ * of this application and that it can receive input.
*
* Implemented from YDialog.
**/
virtual void activate();
-
+
/**
* Qt event handlers.
*
Modified: trunk/qt/src/YQMainWinDock.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQMainWinDock.cc?rev=46490&r1=46489&r2=46490&view=diff
==============================================================================
--- trunk/qt/src/YQMainWinDock.cc (original)
+++ trunk/qt/src/YQMainWinDock.cc Sun Apr 13 18:37:05 2008
@@ -21,12 +21,13 @@
#include "YUILog.h"
#include <QTimer>
#include <QResizeEvent>
-#include
+#include "YQDialog.h"
#include
#include
+#include "YQWizard.h"
#include "YQMainWinDock.h"
-#define VERBOSE_RESIZE 0
+#define VERBOSE_RESIZE 1
YQMainWinDock *
@@ -78,18 +79,26 @@
void
YQMainWinDock::resizeVisibleChild()
{
- if ( ! _widgetStack.empty() )
+ for ( YQWidgetStack::reverse_iterator it = _widgetStack.rbegin(); it != _widgetStack.rend(); it++ )
{
- QWidget * dialog = _widgetStack.back();
+ YQDialog * dialog = *it;
+
+ QRect rect = QRect( QPoint( 0, 0 ), size() );
- if ( dialog->size() != size() )
+ YQWizard *wizard = dialog->findWizard();
+ if ( wizard )
+ yuiDebug() << "wizard " << wizard << " " << wizard->isSecondary() << endl;
+ if ( wizard && wizard->isSecondary() )
+ rect.setLeft( _sideBarWidth );
+
+ if ( dialog->rect() != rect )
{
#if VERBOSE_RESIZE
yuiDebug() << "Resizing child dialog " << hex << ( (void *) dialog ) << dec
- << " to " << size().width() << " x " << size().height()
+ << " to " << rect.width() << " x " << rect.height()
<< endl;
#endif
- dialog->resize( size() );
+ dialog->setGeometry( rect );
}
}
}
@@ -110,12 +119,14 @@
void
-YQMainWinDock::add( QWidget * dialog )
+YQMainWinDock::add( YQDialog * dialog )
{
YUI_CHECK_PTR( dialog );
+#if 0
if ( !_widgetStack.empty() )
_widgetStack.back()->hide();
+#endif
dialog->raise();
dialog->show();
@@ -123,7 +134,7 @@
yuiDebug() << "Adding dialog " << hex << (void *) dialog << dec
<< " to mainWinDock"
<< endl;
-
+
_widgetStack.push_back( dialog );
resizeVisibleChild();
@@ -145,7 +156,7 @@
void
-YQMainWinDock::remove( QWidget * dialog )
+YQMainWinDock::remove( YQDialog * dialog )
{
if ( _widgetStack.empty() )
return;
@@ -192,7 +203,7 @@
YQMainWinDock::YQWidgetStack::iterator
-YQMainWinDock::findInStack( QWidget * dialog )
+YQMainWinDock::findInStack( YQDialog * dialog )
{
for ( YQMainWinDock::YQWidgetStack::iterator it = _widgetStack.begin();
it != _widgetStack.end();
@@ -206,7 +217,7 @@
}
-QWidget *
+YQDialog *
YQMainWinDock::topmostDialog() const
{
if ( _widgetStack.empty() )
@@ -252,4 +263,14 @@
}
+void
+YQMainWinDock::setSideBarWidth( int width )
+{
+ if ( _sideBarWidth == width )
+ return;
+ _sideBarWidth = width;
+ resizeVisibleChild();
+}
+
+
#include "YQMainWinDock.moc"
Modified: trunk/qt/src/YQMainWinDock.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQMainWinDock.h?rev=46490&r1=46489&r2=46490&view=diff
==============================================================================
--- trunk/qt/src/YQMainWinDock.h (original)
+++ trunk/qt/src/YQMainWinDock.h Sun Apr 13 18:37:05 2008
@@ -44,6 +44,8 @@
**/
class YQMainWinDock : public QWidget
{
+ friend class YQWizard;
+
Q_OBJECT
public:
@@ -62,7 +64,7 @@
*
* If the MainWinDock is not visible yet, this operation makes it visible.
**/
- void add( QWidget * dialog );
+ void add( YQDialog * dialog );
/**
* Remove a dialog from the MainWinDock (if it belongs to the
@@ -75,13 +77,13 @@
* If that was the last main dialog in the MainWinDock, the MainWinDock
* will be hidden (until another main dialog is added).
**/
- void remove( QWidget * dialog = 0 );
+ void remove( YQDialog * dialog = 0 );
/**
* Return the current topmost dialog (the widgetRep() of a YQDialog)
* or 0 if there is none.
**/
- QWidget * topmostDialog() const;
+ YQDialog * topmostDialog() const;
/**
* Return 'true' if the next main dialog could be docked,
@@ -140,6 +142,10 @@
**/
void resizeVisibleChild();
+ /**
+ * For secondary wizards
+ **/
+ void setSideBarWidth( int width );
protected slots:
@@ -151,16 +157,18 @@
private:
- typedef std::deque YQWidgetStack;
+ typedef std::deque YQWidgetStack;
/**
* Return an iterator to the specified dialog in the internal
* widgetstack or _widgetStack::end() if not found.
**/
- YQWidgetStack::iterator findInStack( QWidget * dialog );
+ YQWidgetStack::iterator findInStack( YQDialog * dialog );
YQWidgetStack _widgetStack;
+
+ int _sideBarWidth;
};
Modified: trunk/qt/src/YQWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQWizard.cc?rev=46490&r1=46489&r2=46490&view=diff
==============================================================================
--- trunk/qt/src/YQWizard.cc (original)
+++ trunk/qt/src/YQWizard.cc Sun Apr 13 18:37:05 2008
@@ -62,7 +62,8 @@
#include "YQIconPool.h"
#include "YQWidgetFactory.h"
#include "YQSignalBlocker.h"
-#include "YEvent.h"
+#include
+#include "YQMainWinDock.h"
using std::string;
@@ -89,6 +90,7 @@
, _backButtonLabel( backButtonLabel )
, _abortButtonLabel( abortButtonLabel )
, _nextButtonLabel( nextButtonLabel )
+ , _secondary( false )
{
setObjectName( "wizard" );
@@ -98,7 +100,6 @@
setWidgetRep( this );
-
_stepsEnabled = (wizardMode == YWizardMode_Steps);
_treeEnabled = (wizardMode == YWizardMode_Tree);
@@ -136,6 +137,12 @@
the registering for after we have steps registered */
if ( !_stepsEnabled )
QY2Styler::self()->registerWidget( this );
+
+ if ( !_stepsEnabled && !_treeEnabled )
+ {
+ _secondary = true;
+ YQMainWinDock::mainWinDock()->resizeVisibleChild();
+ }
}
@@ -187,9 +194,10 @@
{
_sideBar = new QStackedWidget( parent );
YUI_CHECK_NEW( _sideBar );
- _sideBar->setMinimumWidth( YQUI::ui()->defaultSize( YD_HORIZ ) / 5 );
+ // _sideBar->setMinimumWidth( YQUI::ui()->defaultSize( YD_HORIZ ) / 5 );
_sideBar->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) ); // hor/vert
_sideBar->setObjectName( QString( "_sideBar-%1" ).arg( long( this ) ) );
+ _sideBar->installEventFilter( this );
QVBoxLayout *vbox = new QVBoxLayout( );
vbox->addWidget( _sideBar );
@@ -203,8 +211,9 @@
{
layoutStepsPanel();
showSteps();
- } else
+ } else {
_sideBar->hide();
+ }
return vbox;
}
@@ -214,8 +223,8 @@
// Steps
_stepsPanel = new QFrame( _sideBar );
_sideBar->addWidget( _stepsPanel );
- _sideBar->setObjectName( "steps" );
- QY2Styler::self()->registerChildWidget( this, _sideBar );
+ _stepsPanel->setObjectName( "steps" );
+ QY2Styler::self()->registerChildWidget( this, _stepsPanel );
_stepsPanel->setProperty( "class", "steps QFrame" );
// Steps panel bottom buttons ("Help", "Release Notes")
@@ -1074,6 +1083,12 @@
return true; // Event handled
}
+ if ( ev->type() == QEvent::Resize && obj == _sideBar )
+ {
+ YQMainWinDock::mainWinDock()->setSideBarWidth( _sideBar->width() );
+ return true; // Event handled
+ }
+
return QWidget::eventFilter( obj, ev );
}
Modified: trunk/qt/src/YQWizard.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQWizard.h?rev=46490&r1=46489&r2=46490&view=diff
==============================================================================
--- trunk/qt/src/YQWizard.h (original)
+++ trunk/qt/src/YQWizard.h Sun Apr 13 18:37:05 2008
@@ -334,6 +334,10 @@
**/
virtual void setSize( int newWidth, int newHeight );
+ /**
+ * Returns true if the wizard should follow the first wizard with steps
+ **/
+ bool isSecondary() const { return _secondary; }
signals:
@@ -430,7 +434,6 @@
**/
void sendMenuEvent( int numID );
-
protected:
// Layout functions
@@ -515,6 +518,7 @@
bool _protectNextButton;
bool _stepsDirty;
bool _sendButtonEvents;
+ bool _secondary;
Direction _direction;
QString _currentStepID;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org