Author: sh-sh-sh
Date: Tue Jul 10 02:01:27 2007
New Revision: 39264
URL: http://svn.opensuse.org/viewcvs/yast?rev=39264&view=rev
Log:
(partially) ported wizard
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc
branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc
branches/tmp/sh/mod-ui/core/libyui/src/YWizard.cc
branches/tmp/sh/mod-ui/core/libyui/src/YWizard.h
branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc
branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.h
branches/tmp/sh/mod-ui/qt/src/YQUI.h
branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc
branches/tmp/sh/mod-ui/qt/src/YQWizard.cc
branches/tmp/sh/mod-ui/qt/src/YQWizard.h
branches/tmp/sh/mod-ui/qt/src/YQWizardButton.cc
branches/tmp/sh/mod-ui/qt/src/YQWizardButton.h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc?rev=39264&r1=39263&r2=39264&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc Tue Jul 10 02:01:27 2007
@@ -68,6 +68,7 @@
#include "YSquash.h"
#include "YTable.h"
#include "YTree.h"
+#include "YWizard.h"
using std::string;
@@ -3322,26 +3323,29 @@
// Parse options
+ YWizardMode wizardMode = YWizardMode_Standard;
+
for ( int o=0; o < optList->size(); o++ )
{
- if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_stepsEnabled ) opt.stepsEnabled.setValue( true );
- else if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_treeEnabled ) opt.treeEnabled.setValue( true );
+ if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_stepsEnabled ) wizardMode = YWizardMode_Steps;
+ else if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_treeEnabled ) wizardMode = YWizardMode_Tree;
else logUnknownOption( term, optList->value(o) );
}
- YCPValue backButtonId = parseIdTerm( term->value( argnr ) );
- YCPString backButtonLabel = term->value( argnr+1 )->asString();
+ YWidgetID * backButtonId = new YCPValueWidgetID( parseIdTerm( term->value( argnr ) ) );
+ string backButtonLabel = term->value( argnr+1 )->asString()->value();
- YCPValue abortButtonId = parseIdTerm( term->value( argnr+2 ) );
- YCPString abortButtonLabel = term->value( argnr+3 )->asString();
+ YWidgetID * abortButtonId = new YCPValueWidgetID( parseIdTerm( term->value( argnr+2 ) ) );
+ string abortButtonLabel = term->value( argnr+3 )->asString()->value();
- YCPValue nextButtonId = parseIdTerm( term->value( argnr+4 ) );
- YCPString nextButtonLabel = term->value( argnr+5 )->asString();
+ YWidgetID * nextButtonId = new YCPValueWidgetID( parseIdTerm( term->value( argnr+4 ) ) );
+ string nextButtonLabel = term->value( argnr+5 )->asString()->value();
- return YUI::ui()->createWizard( parent, opt,
- backButtonId, backButtonLabel,
- abortButtonId, abortButtonLabel,
- nextButtonId, nextButtonLabel );
+ return YUI::optionalWidgetFactory()->createWizard( parent,
+ backButtonId, backButtonLabel,
+ abortButtonId, abortButtonLabel,
+ nextButtonId, nextButtonLabel,
+ wizardMode );
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc?rev=39264&r1=39263&r2=39264&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc Tue Jul 10 02:01:27 2007
@@ -47,12 +47,31 @@
}
YWizard *
-YOptionalWidgetFactory::createWizard( YWidget * parent )
+YOptionalWidgetFactory::createWizard( YWidget * parent,
+ YWidgetID * backButtonId, const string & backButtonLabel,
+ YWidgetID * abortButtonId, const string & abortButtonLabel,
+ YWidgetID * nextButtonId, const string & nextButtonLabel,
+ YWizardMode wizardMode )
{
THROW_UNSUPPORTED( "YWizard" );
}
+YWizard *
+YOptionalWidgetFactory::createWizard( YWidget * parent,
+ const string & backButtonLabel,
+ const string & abortButtonLabel,
+ const string & nextButtonLabel,
+ YWizardMode wizardMode )
+{
+ return createWizard( parent,
+ 0, backButtonLabel,
+ 0, abortButtonLabel,
+ 0, nextButtonLabel,
+ wizardMode );
+}
+
+
bool YOptionalWidgetFactory::hasDumbTab()
{
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h?rev=39264&r1=39263&r2=39264&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h Tue Jul 10 02:01:27 2007
@@ -22,6 +22,8 @@
#include <string>
#include <list>
+#include "YWizard.h"
+
using std::string;
using std::list;
@@ -35,7 +37,6 @@
class YSlider;
class YTimeField;
class YWidget;
-class YWizard;
/**
@@ -54,7 +55,17 @@
//
virtual bool hasWizard();
- virtual YWizard * createWizard ( YWidget * parent );
+ YWizard * createWizard ( YWidget * parent,
+ const string & backButtonLabel,
+ const string & abortButtonLabel,
+ const string & nextButtonLabel,
+ YWizardMode wizardMode = YWizardMode_Standard );
+
+ virtual YWizard * createWizard ( YWidget * parent,
+ YWidgetID * backButtonId, const string & backButtonLabel,
+ YWidgetID * abortButtonId, const string & abortButtonLabel,
+ YWidgetID * nextButtonId, const string & nextButtonLabel,
+ YWizardMode wizardMode = YWizardMode_Standard );
virtual bool hasDumbTab();
virtual YDumbTab * createDumbTab ( YWidget * parent );
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI.h?rev=39264&r1=39263&r2=39264&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI.h Tue Jul 10 02:01:27 2007
@@ -575,21 +575,9 @@
virtual bool hasPartitionSplitter() { return false; }
- /**
- * Creates a Wizard frame.
- **/
- virtual YWidget *createWizard( YWidget *parent, YWidgetOpt & opt,
- const YCPValue & backButtonId, const YCPString & backButtonLabel,
- const YCPValue & abortButtonId, const YCPString & abortButtonLabel,
- const YCPValue & nextButtonId, const YCPString & nextButtonLabel );
-
- virtual bool hasWizard() { return false; }
-
+
protected:
-
-
-
/**
* UI-specific setLanguage() function.
* Returns YCPVoid() if OK and YCPNull() on error.
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc?rev=39264&r1=39263&r2=39264&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc Tue Jul 10 02:01:27 2007
@@ -92,7 +92,7 @@
else if ( symbol == YUISpecialWidget_PatternSelector ) hasWidget = fact->hasPatternSelector();
else if ( symbol == YUISpecialWidget_PartitionSplitter ) hasWidget = hasPartitionSplitter();
else if ( symbol == YUISpecialWidget_SimplePatchSelector ) hasWidget = fact->hasSimplePatchSelector();
- else if ( symbol == YUISpecialWidget_Wizard ) hasWidget = hasWizard();
+ else if ( symbol == YUISpecialWidget_Wizard ) hasWidget = fact->hasWizard();
else if ( symbol == YUISpecialWidget_Date ) hasWidget = hasDate();
else if ( symbol == YUISpecialWidget_Time ) hasWidget = hasTime();
else
@@ -1108,6 +1108,7 @@
* If the current UI does not provide a wizard widget, 'false' is returned.
* It is safe to call this even for UIs that don't provide a wizard widget. In
* this case, all calls to this builtin simply return 'false'.
+ *
* @param term wizardCommand
*
* @return boolean Returns true on success.
@@ -1115,7 +1116,7 @@
YCPValue YUI::evaluateWizardCommand( const YCPTerm & command )
{
- if ( ! hasWizard() )
+ if ( ! YUI::optionalWidgetFactory()->hasWizard() )
return YCPBoolean( false );
// A wizard widget always has ID `wizard
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc?rev=39264&r1=39263&r2=39264&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc Tue Jul 10 02:01:27 2007
@@ -144,16 +144,4 @@
}
-YWidget * YUI::createWizard( YWidget *parent, YWidgetOpt & opt,
- const YCPValue & backButtonId, const YCPString & backButtonLabel,
- const YCPValue & abortButtonId, const YCPString & abortButtonLabel,
- const YCPValue & nextButtonId, const YCPString & nextButtonLabel )
-{
- y2error( "Default createWizard() method called - "
- "forgot to call HasSpecialWidget()?" );
-
- return 0;
-}
-
-
// EOF
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YWizard.cc?rev=39264&r1=39263&r2=39264&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YWizard.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YWizard.cc Tue Jul 10 02:01:27 2007
@@ -24,25 +24,50 @@
#include "YWizard.h"
+struct YWizardPrivate
+{
+ YWizardPrivate( YWidgetID * backButtonId, const string & backButtonLabel,
+ YWidgetID * abortButtonId, const string & abortButtonLabel,
+ YWidgetID * nextButtonId, const string & nextButtonLabel,
+ YWizardMode wizardMode )
+ : backButtonLabel( backButtonLabel )
+ , abortButtonLabel( abortButtonLabel )
+ , nextButtonLabel( nextButtonLabel )
+ , backButtonId( backButtonId )
+ , abortButtonId( abortButtonId )
+ , nextButtonId( nextButtonId )
+ {}
+
+ string backButtonLabel;
+ string abortButtonLabel;
+ string nextButtonLabel;
+ YWidgetID * backButtonId;
+ YWidgetID * abortButtonId;
+ YWidgetID * nextButtonId;
+ YWizardMode wizardMode;
+};
+
-YWizard::YWizard( const YWidgetOpt & opt,
- const YCPValue & backButtonId, const YCPString & backButtonLabel,
- const YCPValue & abortButtonId, const YCPString & abortButtonLabel,
- const YCPValue & nextButtonId, const YCPString & nextButtonLabel )
- : YWidget( opt )
- , _backButtonId( backButtonId )
- , _backButtonLabel( backButtonLabel )
- , _abortButtonId( abortButtonId )
- , _abortButtonLabel( abortButtonLabel )
- , _nextButtonId( nextButtonId )
- , _nextButtonLabel( nextButtonLabel )
+
+YWizard::YWizard( YWidget * parent,
+ YWidgetID * backButtonId, const string & backButtonLabel,
+ YWidgetID * abortButtonId, const string & abortButtonLabel,
+ YWidgetID * nextButtonId, const string & nextButtonLabel,
+ YWizardMode wizardMode )
+ : YWidget( parent )
+ , priv( new YWizardPrivate( backButtonId, backButtonLabel,
+ abortButtonId, abortButtonLabel,
+ nextButtonId, nextButtonLabel,
+ wizardMode ) )
{
+ YUI_CHECK_NEW( priv );
+
// On the YWidget level, a Wizard has a content area and a couple of
// buttons as children, so simply subclassing from YSimpleChildManager
// won't do; a children manager that can handle more children is needed.
setChildrenManager( new YWidgetChildrenManager( this ) );
-
+
// All wizard widgets have a fixed ID `wizard
YWidget::setId( new YCPValueWidgetID( YCPSymbol( YWizardID ) ) );
@@ -51,6 +76,90 @@
}
+YWizard::~YWizard()
+{
+ // Intentionally not deleting the button IDs here: The wizard buttons
+ // assume responsibility for them. For YWidget derived wizard buttons, the
+ // YWidget destructor will delete the ID.
+}
+
+
+string YWizard::backButtonLabel() const
+{
+ return priv->backButtonLabel;
+}
+
+
+string YWizard::abortButtonLabel() const
+{
+ return priv->abortButtonLabel;
+}
+
+
+string YWizard::nextButtonLabel() const
+{
+ return priv->nextButtonLabel;
+}
+
+
+YWidgetID * YWizard::backButtonId() const
+{
+ return priv->backButtonId;
+}
+
+
+YWidgetID * YWizard::abortButtonId() const
+{
+ return priv->abortButtonId;
+}
+
+
+YWidgetID * YWizard::nextButtonId() const
+{
+ return priv->nextButtonId;
+}
+
+
+void YWizard::setBackButtonLabel ( const string & newLabel )
+{
+ priv->backButtonLabel = newLabel;
+}
+
+
+void YWizard::setAbortButtonLabel( const string & newLabel )
+{
+ priv->abortButtonLabel = newLabel;
+}
+
+
+void YWizard::setNextButtonLabel ( const string & newLabel )
+{
+ priv->nextButtonLabel = newLabel;
+}
+
+
+void YWizard::setBackButtonId ( YWidgetID * newId )
+{
+ priv->backButtonId = newId;
+}
+
+
+void YWizard::setAbortButtonId( YWidgetID * newId )
+{
+ priv->abortButtonId = newId;
+}
+
+
+void YWizard::setNextButtonId ( YWidgetID * newId )
+{
+ priv->nextButtonId = newId;
+}
+
+
+
+
+
+
YCPValue YWizard::command( const YCPTerm & command )
{
y2error( "YWizard::command() not reimplemented!" );
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YWizard.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YWizard.h?rev=39264&r1=39263&r2=39264&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YWizard.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YWizard.h Tue Jul 10 02:01:27 2007
@@ -24,22 +24,96 @@
#include