Author: coolo
Date: Tue Dec 18 14:51:42 2007
New Revision: 43158
URL: http://svn.opensuse.org/viewcvs/yast?rev=43158&view=rev
Log:
adding another optional widget: timezone selector
So far it's only implemented in the Qt UI and provides
a graphical map interface
Added:
trunk/core/libyui/doc/examples/TimezoneSelector.ycp
- copied, changed from r43156, branches/tmp/coolo/zone/core/libyui/doc/examples/TimezoneSelector.ycp
trunk/core/libyui/src/YTimezoneSelector.cc
- copied unchanged from r43156, branches/tmp/coolo/zone/core/libyui/src/YTimezoneSelector.cc
trunk/core/libyui/src/YTimezoneSelector.h
- copied unchanged from r43156, branches/tmp/coolo/zone/core/libyui/src/YTimezoneSelector.h
Modified:
trunk/core/libyui/src/Makefile.am
trunk/core/libyui/src/YCPDialogParser.cc
trunk/core/libyui/src/YCPDialogParser.h
trunk/core/libyui/src/YOptionalWidgetFactory.cc
trunk/core/libyui/src/YOptionalWidgetFactory.h
trunk/core/libyui/src/YUISymbols.h
trunk/core/libyui/src/YUI_builtins.cc
Copied: trunk/core/libyui/doc/examples/TimezoneSelector.ycp (from r43156, branches/tmp/coolo/zone/core/libyui/doc/examples/TimezoneSelector.ycp)
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/doc/examples/TimezoneSelector.ycp?p2=trunk/core/libyui/doc/examples/TimezoneSelector.ycp&p1=branches/tmp/coolo/zone/core/libyui/doc/examples/TimezoneSelector.ycp&r1=43156&r2=43158&rev=43158&view=diff
==============================================================================
--- branches/tmp/coolo/zone/core/libyui/doc/examples/TimezoneSelector.ycp (original)
+++ trunk/core/libyui/doc/examples/TimezoneSelector.ycp Tue Dec 18 14:51:42 2007
@@ -1,4 +1,6 @@
{
+ import "Directory";
+
// Build a dialog with a "special" widget - one that may not be supported
// by all UIs.
@@ -53,7 +55,7 @@
// Only create a dialog with this kind of widget if it is supported
UI::OpenDialog(
`VBox(
- `TimezoneSelector(`id(`timezone), `opt(`notify), "/home/col/prod/yast2/core/libyui/doc/examples/earth_2400.jpg", examples),
+ `TimezoneSelector(`id(`timezone), `opt(`notify), Directory::themedir + "/current/worldmap/GLOBALeb10colshade.jpg", examples),
`PushButton(`id(`ok), `opt(`default), "&Close"),
`ComboBox(`id(`combozone), `opt(`notify),
"",
Modified: trunk/core/libyui/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Makefile.am?rev=43158&r1=43157&r2=43158&view=diff
==============================================================================
--- trunk/core/libyui/src/Makefile.am (original)
+++ trunk/core/libyui/src/Makefile.am Tue Dec 18 14:51:42 2007
@@ -87,6 +87,7 @@
YSquash.cc \
YTable.cc \
YTimeField.cc \
+ YTimezoneSelector.cc \
YTree.cc \
YWizard.cc \
\
@@ -187,6 +188,7 @@
YSquash.h \
YTable.h \
YTimeField.h \
+ YTimezoneSelector.h \
YTree.h \
YWizard.h \
\
Modified: trunk/core/libyui/src/YCPDialogParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YCPDialogParser.cc?rev=43158&r1=43157&r2=43158&view=diff
==============================================================================
--- trunk/core/libyui/src/YCPDialogParser.cc (original)
+++ trunk/core/libyui/src/YCPDialogParser.cc Tue Dec 18 14:51:42 2007
@@ -79,6 +79,7 @@
#include "YTimeField.h"
#include "YTree.h"
#include "YWizard.h"
+#include "YTimezoneSelector.h"
using std::string;
@@ -280,6 +281,7 @@
else if ( s == YUISpecialWidget_Time ) w = parseTimeField ( p, opt, term, ol, n );
else if ( s == YUISpecialWidget_TimeField ) w = parseTimeField ( p, opt, term, ol, n );
else if ( s == YUISpecialWidget_Wizard ) w = parseWizard ( p, opt, term, ol, n );
+ else if ( s == YUISpecialWidget_TimezoneSelector ) w = parseTimezoneSelector ( p, opt, term, ol, n );
else
{
YUI_THROW( YUIException( string( "Unknown widget type " ) + s.c_str() ) );
@@ -3259,6 +3261,51 @@
return wizard;
}
+/**
+ * @widgets TimezoneSelector
+ * @short Timezone selector map
+ * @class YTimezoneSelector
+ *
+ * @arg string pixmap path to a jpg or png of a world map - with 0°0° being the
+ * middle of the picture
+ * @arg map timezones a map of timezones. The map should be between e.g. Europe/London
+ * and the tooltip to be displayed ("United Kingdom")
+ *
+ * @usage if ( HasSpecialWidget( `TimezoneSelector ) {...
+ * `TimezoneSelector( "world.jpg", timezones )
+ *
+ * @description
+ * An graphical timezone selector map
+ *
+ * @note This is a "special" widget, i.e. not all UIs necessarily support it. Check
+ * for availability with <tt>HasSpecialWidget( `TimezoneSelector)</tt> before using it.
+ **/
+YWidget *
+YCPDialogParser::parseTimezoneSelector( YWidget * parent, YWidgetOpt & opt,
+ const YCPTerm & term, const YCPList & optList, int argnr )
+{
+
+ if ( term->size() - argnr != 2
+ || !term->value(argnr)->isString()
+ || !term->value(argnr+1)->isMap() )
+ {
+ y2error( "Invalid arguments for the TimezoneSelector widget: %s",
+ term->toString().c_str() );
+ return 0;
+ }
+
+ rejectAllOptions( term, optList );
+
+ string pixmap = term->value( argnr )->asString()->value();
+ map