Author: visnov
Date: Thu Aug 30 13:16:48 2007
New Revision: 40615
URL: http://svn.opensuse.org/viewcvs/yast?rev=40615&view=rev
Log:
Import Wt-based UI prototype
Added:
branches/research/web-wt/
branches/research/web-wt/MAINTAINER
branches/research/web-wt/Makefile.cvs
branches/research/web-wt/RPMNAME
branches/research/web-wt/SUBDIRS
branches/research/web-wt/VERSION
branches/research/web-wt/configure.in.in
branches/research/web-wt/doc/
branches/research/web-wt/doc/Makefile.am
branches/research/web-wt/doc/autodocs/
branches/research/web-wt/doc/autodocs/Makefile.am
branches/research/web-wt/package/
branches/research/web-wt/src/
branches/research/web-wt/src/Makefile.am
branches/research/web-wt/src/Y2CCWeb.cc
branches/research/web-wt/src/Y2CCWeb.h
branches/research/web-wt/src/YWebDialog.cc
branches/research/web-wt/src/YWebDialog.h
branches/research/web-wt/src/YWebLabel.cc
branches/research/web-wt/src/YWebLabel.h
branches/research/web-wt/src/YWebPushButton.cc
branches/research/web-wt/src/YWebPushButton.h
branches/research/web-wt/src/YWebSplit.cc
branches/research/web-wt/src/YWebSplit.h
branches/research/web-wt/src/YWebUI.h
branches/research/web-wt/src/YWebUIComponent.h
branches/research/web-wt/src/YWebUI_builtins.cc
branches/research/web-wt/src/YWebUI_core.cc
branches/research/web-wt/src/YWebUI_widgets.cc
branches/research/web-wt/src/YWebWidget.cc
branches/research/web-wt/src/YWebWidget.h
branches/research/web-wt/yast2-web.spec.in
Modified:
branches/research/CONTENTS
Modified: branches/research/CONTENTS
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/CONTENTS?rev=40615&r1=40614&r2=40615&view=diff
==============================================================================
--- branches/research/CONTENTS (original)
+++ branches/research/CONTENTS Thu Aug 30 13:16:48 2007
@@ -6,3 +6,5 @@
installer Experimental skeleton for YaST "software installer" modules.
Based on SLES9 yast2-devtools.
+
+web-wt YaST UI implementation using Wt library.
Added: branches/research/web-wt/MAINTAINER
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/MAINTAINER?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/MAINTAINER (added)
+++ branches/research/web-wt/MAINTAINER Thu Aug 30 13:16:48 2007
@@ -0,0 +1 @@
+Stanislav Visnovsky
Added: branches/research/web-wt/Makefile.cvs
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/Makefile.cvs?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/Makefile.cvs (added)
+++ branches/research/web-wt/Makefile.cvs Thu Aug 30 13:16:48 2007
@@ -0,0 +1,21 @@
+#
+# Makefile.cvs
+#
+
+LIB = $(shell y2tool get-lib)
+
+configure: all
+ ./configure --libdir=/usr/$(LIB) --with-qt-dir=/usr/lib/qt3 --with-qt-libdir=/usr/lib/qt3/$(LIB)
+
+all:
+ y2tool y2autoconf
+ y2tool y2automake
+ autoreconf --force --install
+
+install: configure
+ make
+ make install
+
+reconf: all
+ ./config.status --recheck
+ ./config.status
Added: branches/research/web-wt/RPMNAME
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/RPMNAME?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/RPMNAME (added)
+++ branches/research/web-wt/RPMNAME Thu Aug 30 13:16:48 2007
@@ -0,0 +1 @@
+yast2-web
Added: branches/research/web-wt/SUBDIRS
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/SUBDIRS?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/SUBDIRS (added)
+++ branches/research/web-wt/SUBDIRS Thu Aug 30 13:16:48 2007
@@ -0,0 +1 @@
+src doc
Added: branches/research/web-wt/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/VERSION?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/VERSION (added)
+++ branches/research/web-wt/VERSION Thu Aug 30 13:16:48 2007
@@ -0,0 +1 @@
+2.15.0
Added: branches/research/web-wt/configure.in.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/configure.in.in?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/configure.in.in (added)
+++ branches/research/web-wt/configure.in.in Thu Aug 30 13:16:48 2007
@@ -0,0 +1,15 @@
+## general configure.in.in
+
+## initialize
+@YAST2-INIT-COMMON@
+@YAST2-INIT-PROGRAM@
+
+## some common checks
+@YAST2-CHECKS-COMMON@
+@YAST2-CHECKS-PROGRAM@
+
+## special stuff
+PKG_CHECK_MODULES([ZYPP], [libzypp])
+
+## and generate the output
+@YAST2-OUTPUT@
Added: branches/research/web-wt/doc/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/doc/Makefile.am?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/doc/Makefile.am (added)
+++ branches/research/web-wt/doc/Makefile.am Thu Aug 30 13:16:48 2007
@@ -0,0 +1,11 @@
+#
+# Makefile.am for qt/doc
+#
+
+SUBDIRS = autodocs
+
+htmldir = $(docdir)
+
+html_DATA =
+
+EXTRA_DIST = $(html_DATA)
Added: branches/research/web-wt/doc/autodocs/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/doc/autodocs/Makefile.am?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/doc/autodocs/Makefile.am (added)
+++ branches/research/web-wt/doc/autodocs/Makefile.am Thu Aug 30 13:16:48 2007
@@ -0,0 +1,23 @@
+#
+# Makefile.am for qt/doc/autodocs
+#
+# Parameters:
+#
+# AUTODOCS_CC: Directories that the C++ autodocs is built from
+# Optional - the default is $(srcdir)/../../src
+# AUTODOCS_DEPS: dependencies of the docs, default is $(AUTODOCS_CC)/*.h
+# AUTODOCS_PARAMS: more params for ydoxygen
+#
+# see also mvidner's post on yast2-announce on 2006-02-21
+
+# AUTODOCS_CC = $(srcdir)/../../src/
+
+AUTODOCS_DEPS = $(srcdir)/../../src/include/*.h
+
+# Use this to enable generating autodocs:
+#
+# include $(top_srcdir)/autodocs-cc.ami
+#
+# and this to disable it:
+#
+include $(top_srcdir)/autodocs-cc-off.ami
Added: branches/research/web-wt/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/Makefile.am?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/Makefile.am (added)
+++ branches/research/web-wt/src/Makefile.am Thu Aug 30 13:16:48 2007
@@ -0,0 +1,90 @@
+#
+# Makefile.am for web/src
+#
+
+# SUBDIRS = pkg
+
+WTLIBDIR=/usr/local/lib/
+
+AM_CXXFLAGS = -DY2LOG=\"ui-web\" \
+ -DWTLIBDIR=\"$(WTLIBDIR)\"
+
+serversdir = $(execcompdir)/servers
+
+# plugin, libtool forces 'lib' prefix
+plugin_LTLIBRARIES = libpy2web.la
+libpy2web_la_LDFLAGS = -version-info 2:0
+
+# compile using internal wthttp daemon
+libpy2web_la_LIBADD = \
+ -L$(libdir) -lyui \
+ -lboost_thread-mt -lboost_signals -lboost_program_options -lxerces-c -lwt -lwthttp
+
+noinst_HEADERS = $(wildcard *.h)
+
+libpy2web_la_SOURCES = \
+ Y2CCWeb.cc \
+ YWebWidget.cc \
+ \
+ YWebDialog.cc \
+ YWebUI_core.cc \
+ YWebUI_widgets.cc \
+ YWebUI_builtins.cc \
+ YWebLabel.cc \
+ YWebPushButton.cc \
+ YWebSplit.cc
+
+
+# YQPackageSelectorPlugin.cc \
+# \
+# YQIconPool.cc \
+# \
+# YQAlignment.cc \
+# YQBarGraph.cc \
+# YQCheckBox.cc \
+# YQCheckBoxFrame.cc \
+# YQColoredLabel.cc \
+# YQComboBox.cc \
+# YQDate.cc \
+# YQDialog.cc \
+# YQDownloadProgress.cc \
+# YQDumbTab.cc \
+# YQEmpty.cc \
+# YQFrame.cc \
+# YQGenericButton.cc \
+# YQImage.cc \
+# YQIntField.cc \
+# YQLogView.cc \
+# YQMenuButton.cc \
+# YQMultiLineEdit.cc \
+# YQMultiProgressMeter.cc \
+# YQMultiSelectionBox.cc \
+# YQPartitionSplitter.cc \
+# YQProgressBar.cc \
+# YQPushButton.cc \
+# YQRadioButton.cc \
+# YQRadioButtonGroup.cc \
+# YQReplacePoint.cc \
+# YQRichText.cc \
+# YQSelectionBox.cc \
+# YQSlider.cc \
+# YQSpacing.cc \
+# YQSplit.cc \
+# YQSquash.cc \
+# YQTable.cc \
+# YQTextEntry.cc \
+# YQTime.cc \
+# YQTree.cc \
+# YQWizard.cc \
+# YQWizardButton.cc \
+# \
+# YFrameBuffer.cc \
+# QY2BarGraph.cc \
+# QY2ComboTabWidget.cc \
+# QY2DiskUsageList.cc \
+# QY2CharValidator.cc \
+# QY2ListView.cc \
+# QY2Settings.cc \
+# QY2LayoutUtils.cc
+
+INCLUDES = -I$(WTDIR)/include -I$(includedir) -I$(includedir)/yui
Added: branches/research/web-wt/src/Y2CCWeb.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/Y2CCWeb.cc?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/Y2CCWeb.cc (added)
+++ branches/research/web-wt/src/Y2CCWeb.cc Thu Aug 30 13:16:48 2007
@@ -0,0 +1,30 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: Y2CCWeb.cc
+
+ Author: Stanislav Visnovsky
+ Maintainer: Stanislav Visnovsky
+
+/-*/
+
+
+#include "Y2CCWeb.h"
+
+// This is very important: We create one global variable of
+// Y2CCWeb. Its constructor will register it automatically to
+// the Y2ComponentBroker, so that will be able to find it.
+// This all happens before main() is called!
+
+Y2CCWeb g_y2ccweb;
+
+
Added: branches/research/web-wt/src/Y2CCWeb.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/Y2CCWeb.h?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/Y2CCWeb.h (added)
+++ branches/research/web-wt/src/Y2CCWeb.h Thu Aug 30 13:16:48 2007
@@ -0,0 +1,63 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: Y2CCWeb.h
+
+ Author: Mathias Kettner
+ Maintainer: Stefan Hundhammer
+
+/-*/
+
+
+
+#ifndef _Y2CCWeb_h
+#define _Y2CCWeb_h
+
+#include "YWebUIComponent.h"
+
+/**
+ * @short Y2ComponentCreator that can create Wt user interfaces
+ * A Y2ComponentCreator is an object, that can create components.
+ * It is given a component name and - if it knows how to create
+ * such a component - returns a newly created component of this
+ * type. The Y2CCWeb can create components with the name "web".
+ */
+class Y2CCWeb : public Y2ComponentCreator
+{
+public:
+ /**
+ * Creates a Web component creator
+ */
+ Y2CCWeb() : Y2ComponentCreator(Y2ComponentBroker::BUILTIN) { };
+
+ /**
+ * Returns true, since the qt component is a
+ * YaST2 server.
+ */
+ bool isServerCreator() const { return true; };
+
+ /**
+ * Creates a new Qt UI component.
+ */
+ Y2Component *create(const char * name) const
+ {
+ if (!strcmp(name, "web") )
+ return new YWebUIComponent();
+ else
+ return 0;
+ }
+};
+
+#endif // ifndef _Y2CCWeb_h
+
+
+// EOF
Added: branches/research/web-wt/src/YWebDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebDialog.cc?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebDialog.cc (added)
+++ branches/research/web-wt/src/YWebDialog.cc Thu Aug 30 13:16:48 2007
@@ -0,0 +1,114 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebDialog.cc
+
+ Authors: Mathias Kettner
+ Stefan Hundhammer
+
+ Maintainer: Stefan Hundhammer
+
+ Textdomain "packages-qt"
+
+/-*/
+
+
+#define y2log_component "web-ui"
+#include
+
+#include "YWebUI.h"
+#include "YEvent.h"
+#include "YWebDialog.h"
+
+using namespace Wt;
+
+YWebDialog::YWebDialog( const YWidgetOpt & opt,
+ WContainerWidget * qt_parent)
+ : YDialog( opt )
+ , YWebWidget()
+{
+ _dialog = new WContainerWidget( qt_parent );
+
+ setWidgetRep( _dialog );
+
+ if ( hasWarnColor() || hasInfoColor() )
+ {
+ // FIXME
+ }
+}
+
+
+YWebDialog::~YWebDialog()
+{
+ // FIXME: memory leak of WContainerWidget
+}
+
+
+long YWebDialog::nicesize( YUIDimension dim )
+{
+ return YDialog::nicesize( dim );
+}
+
+
+long YWebDialog::decorationWidth( YUIDimension dim )
+{
+ return 0L;
+}
+
+
+void YWebDialog::setEnabling( bool enabled )
+{
+#if 0
+ QWidget::setEnabled( enabled );
+#endif
+}
+
+
+void YWebDialog::setSize( long newWidth, long newHeight )
+{
+ y2milestone( "Setting size for dialog" );
+ if ( numChildren() > 0 )
+ {
+ y2milestone( "setSize for child 0" );
+ YContainerWidget::child(0)->setSize(newWidth, newHeight );
+ }
+
+// FIXME resize( newWidth, newHeight );
+}
+
+
+
+void YWebDialog::activate( bool active )
+{
+ // FIXME?
+}
+
+void
+YWebDialog::childAdded( YWidget * child )
+{
+ // FIXME?
+}
+
+
+void
+YWebDialog::publish()
+{
+ // go through all widgets and call publish recursively
+ for( int i = 0 ; i < numChildren() ; i++ )
+ {
+ y2milestone( "Publishing dialog %d", i );
+ YWebWidget* w = dynamic_cast( child(i) );
+ if( w )
+ w->publish();
+ }
+}
+
Added: branches/research/web-wt/src/YWebDialog.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebDialog.h?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebDialog.h (added)
+++ branches/research/web-wt/src/YWebDialog.h Thu Aug 30 13:16:48 2007
@@ -0,0 +1,91 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebDialog.h
+
+ Author: Mathias Kettner
+ Maintainer: Stefan Hundhammer
+
+/-*/
+
+// -*- c++ -*-
+
+#ifndef YWebDialog_h
+#define YWebDialog_h
+
+#include <WContainerWidget>
+#include "YDialog.h"
+#include "YWebWidget.h"
+
+class YQGenericButton;
+class YQWizard;
+
+
+class YWebDialog : public YDialog, public YWebWidget
+{
+public:
+ /**
+ * Constructor: Constructor.
+ */
+ YWebDialog( const YWidgetOpt & opt,
+ Wt::WContainerWidget * qt_parent = 0);
+
+ /**
+ * Destructor: Cleans up.
+ */
+ ~YWebDialog();
+
+ /**
+ * Makes this dialog active or inactive
+ */
+ void activate( bool active );
+
+ /**
+ * Returns the nice size of this dialog ( may depend on -geometry )
+ */
+ long nicesize( YUIDimension dim );
+
+ /**
+ * Returns the size of ( artificial ) window manager decorations in
+ * the requested dimension ( YD_HORIZ or YD_VERT ), depending on the
+ * value of YDialog::isDecorated().
+ */
+ long decorationWidth( YUIDimension dim );
+
+ /**
+ * Inherited from YWidget: Sets the enabled state of the
+ * widget. All new widgets are enabled per definition. Only
+ * enabled widgets can take user input.
+ */
+ void setEnabling( bool enabled );
+
+ /**
+ * Sets the new size of the widget.
+ */
+ void setSize( long newWidth, long newHeight );
+
+ virtual void publish();
+protected:
+
+ /**
+ * Callback function that reports to the ui specific
+ * widget that a child has been added.
+ */
+ void childAdded( YWidget * child );
+
+private:
+ Wt::WContainerWidget *_dialog;
+};
+
+
+#endif // YWebDialog_h
+
Added: branches/research/web-wt/src/YWebLabel.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebLabel.cc?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebLabel.cc (added)
+++ branches/research/web-wt/src/YWebLabel.cc Thu Aug 30 13:16:48 2007
@@ -0,0 +1,137 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebLabel.cc
+
+ Author: Mathias Kettner
+ Maintainer: Stefan Hundhammer
+
+/-*/
+
+
+#define y2log_component "web-ui"
+#include
+
+#include <WLength>
+#include <WTableCell>
+#include <WLabel>
+
+#include "YWebUI.h"
+#include "YWebLabel.h"
+
+using namespace Wt;
+
+
+
+class YWebLabelImpl : public YWebWidget, public WLabel
+{
+public:
+ YWebLabelImpl( WString label, WContainerWidget* parent )
+ : YWebWidget()
+ , WLabel( label, parent )
+ , _width (0)
+ , _height (0)
+ {}
+
+ virtual ~YWebLabelImpl () {}
+
+ void moveTo( Wt::WTableCell* parent )
+ {
+ y2milestone( "Setting parent for %s", text().narrow().c_str() );
+ WLabel::setParent( parent );
+ // we need to adapt the spanning of the cells
+ parent->setColumnSpan(_width);
+ parent->setRowSpan(_height);
+ }
+
+ void resize( long width, long height )
+ {
+ y2milestone( "Setting size for %s", text().narrow().c_str() );
+ _width = width;
+ _height = height;
+ }
+
+private:
+ long _width;
+ long _height;
+};
+
+YWebLabel::YWebLabel( WContainerWidget *parent,
+ const YWidgetOpt & opt,
+ YCPString text )
+ : YLabel( opt, text )
+ , YWebWidget()
+{
+// setPositionScheme( Absolute );
+#if 0
+ setIndent(0);
+
+ if ( opt.isHeading.value() )
+ {
+ setFont( YQUI::ui()->headingFont() );
+
+ }
+ else
+ {
+ setFont( opt.boldFont.value() ?
+ YQUI::ui()->boldFont() :
+ YQUI::ui()->currentFont() );
+ }
+
+
+ if ( opt.isOutputField.value() )
+ {
+ setFrameStyle ( QFrame::Panel | QFrame::Sunken );
+ setLineWidth(2);
+ setMidLineWidth(2);
+ }
+
+ setMargin( YQWidgetMargin );
+ setAlignment( AlignLeft | AlignTop );
+#endif
+}
+
+
+void YWebLabel::setEnabling( bool enabled )
+{
+#if 0
+ WLabel::setEnabled( enabled );
+#endif
+}
+
+
+long YWebLabel::nicesize( YUIDimension dim )
+{
+ return dim == YD_HORIZ ? YLabel::getLabel()->value().length() : 1L;
+}
+
+
+void YWebLabel::setSize( long newWidth, long newHeight )
+{
+// _label->resize( newWidth, newHeight );
+// resize( WLength(newWidth, WLength::FontEx), WLength(newHeight, WLength::FontEm) );
+}
+
+
+void YWebLabel::setLabel( const YCPString & text )
+{
+ YLabel::setLabel( text );
+}
+
+void YWebLabel::publish()
+{
+ if( !widgetRep() )
+ {
+ WContainerWidget* parent = (WContainerWidget *)(yParent() ? yParent()->widgetRep() : 0L );
+ setWidgetRep( new YWebLabelImpl( getLabel()->value(), parent ) );
+ }
+}
Added: branches/research/web-wt/src/YWebLabel.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebLabel.h?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebLabel.h (added)
+++ branches/research/web-wt/src/YWebLabel.h Thu Aug 30 13:16:48 2007
@@ -0,0 +1,74 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YQLabel.h
+
+ Author: Mathias Kettner
+ Maintainer: Stefan Hundhammer
+
+/-*/
+
+// -*- c++ -*-
+
+#ifndef YWebLabel_h
+#define YWebLabel_h
+
+#include <WLabel>
+#include <WContainerWidget>
+#include
+
+#include "YLabel.h"
+#include "YWebWidget.h"
+
+class YWebLabelImpl;
+
+class YWebLabel : public YLabel, public YWebWidget
+{
+
+public:
+
+ /**
+ * Constructor.
+ */
+ YWebLabel( Wt::WContainerWidget * parent,
+ const YWidgetOpt & opt,
+ YCPString text );
+
+ /**
+ * Inherited from YWidget: Sets the enabled state of the
+ * widget. All new widgets are enabled per definition. Only
+ * enabled widgets can take user input.
+ */
+ void setEnabling( bool enabled );
+
+ /**
+ * Minimum size the widget should have to make it look and feel
+ * nice.
+ * @dim Dimension, either YD_HORIZ or YD_VERT
+ */
+ long nicesize( YUIDimension dim );
+
+ /**
+ * Sets the new size of the widget.
+ */
+ void setSize( long newWidth, long newHeight );
+
+ /**
+ * Change the label text.
+ */
+ void setLabel( const YCPString & label );
+
+ virtual void publish();
+};
+
+
+#endif // YWebLabel_h
Added: branches/research/web-wt/src/YWebPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebPushButton.cc?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebPushButton.cc (added)
+++ branches/research/web-wt/src/YWebPushButton.cc Thu Aug 30 13:16:48 2007
@@ -0,0 +1,102 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YQPushButton.cc
+
+ Author: Maintainer: Stefan Hundhammer
+
+/-*/
+
+
+#include <WPushButton>
+#include <WTableCell>
+
+#define y2log_component "web-ui"
+#include
+
+#include "YWebUI.h"
+#include "YEvent.h"
+#include "YWebPushButton.h"
+
+using namespace Wt;
+
+YWebPushButton::YWebPushButton( WContainerWidget * parent,
+ const YWidgetOpt & opt,
+ const YCPString & label )
+ : YPushButton( opt, label ), YWebWidget()
+{
+}
+
+
+YWebPushButton::~YWebPushButton()
+{
+}
+
+
+long YWebPushButton::nicesize( YUIDimension dim )
+{
+ return dim == YD_HORIZ ? getLabel()->value().length() : 1 ;
+}
+
+
+void YWebPushButton::setSize( long newWidth, long newHeight )
+{
+ y2milestone( "For button %s: %ldx%ld", getLabel()->value().c_str(), newWidth, newHeight );
+// _button->resize( newWidth, newHeight);
+// _button->resize( newWidth, newHeight);
+}
+
+
+void YWebPushButton::publish()
+{
+ if( ! widgetRep() ) {
+ WContainerWidget* parent = (WContainerWidget*)( yParent() ? yParent()->widgetRep() : 0L);
+
+ y2security( "Push button rep parrent: %p", parent );
+
+ setWidgetRep( new YWebPushButtonImpl(this, parent, getLabel()->value()) );
+ y2milestone( "Pushbutton %s created", label->value().c_str());
+ }
+
+ y2milestone( "Connecting push button" );
+ ((YWebPushButtonImpl*)widgetRep())->clicked.connect(SLOT( (YWebPushButtonImpl*)widgetRep(), YWebPushButtonImpl::hit));
+}
+
+YWebPushButtonImpl::YWebPushButtonImpl( YWidget* ywidget, WContainerWidget *parent, const YCPString & label )
+: YWebWidget()
+, WPushButton( label->value(), parent )
+, _ywidget( ywidget )
+{
+}
+
+void YWebPushButtonImpl::hit()
+{
+ y2milestone ("Push button hit");
+ YWebUI::ui()->sendEvent( new YWidgetEvent( _ywidget, YEvent::Activated ) );
+}
+
+
+void YWebPushButtonImpl::moveTo( Wt::WTableCell* parent )
+{
+ y2milestone ("Moving push button to %dx%d", parent->row(), parent->column());
+ WPushButton::setParent((Wt::WWidget*)parent);
+
+ // we need to adapt the spanning of the cells
+// parent->setColumnSpan(_width);
+// parent->setRowSpan(_height);
+}
+
+void YWebPushButtonImpl::resize( long width, long height )
+{
+ _width = width;
+ _height = height;
+}
Added: branches/research/web-wt/src/YWebPushButton.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebPushButton.h?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebPushButton.h (added)
+++ branches/research/web-wt/src/YWebPushButton.h Thu Aug 30 13:16:48 2007
@@ -0,0 +1,93 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YQPushButton.h
+
+ Author: Stefan Hundhammer
+
+/-*/
+
+// -*- c++ -*-
+
+#ifndef YQPushButton_h
+#define YQPushButton_h
+
+#include
+#include <WPushButton>
+#include
+
+#include "YWebWidget.h"
+
+class YWebDialog;
+class Wt::WTableCell;
+
+class YWebPushButtonImpl : public YWebWidget, public Wt::WPushButton
+{
+public:
+ YWebPushButtonImpl( YWidget* ywidget, Wt::WContainerWidget *parent, const YCPString & label );
+ virtual ~YWebPushButtonImpl() {}
+
+ void moveTo( Wt::WTableCell* parent );
+
+ void resize( long width, long height );
+
+public slots:
+
+ /**
+ * Triggered when the button is activated ( clicked or via keyboard ). Informs
+ * the ui about this.
+ */
+ void hit();
+private:
+ YWidget* _ywidget;
+
+ long _width;
+ long _height;
+};
+
+class YWebPushButton : public YPushButton, public YWebWidget
+{
+
+public:
+ /**
+ * Constructor.
+ */
+ YWebPushButton( Wt::WContainerWidget * parent,
+ const YWidgetOpt & opt,
+ const YCPString & label );
+
+ /**
+ * Destructor.
+ **/
+ virtual ~YWebPushButton();
+
+ /**
+ * Preferred size of the widget.
+ * Reimplemented from YWidget.
+ * @dim Dimension, either YD_HORIZ or YD_VERT
+ */
+ long nicesize( YUIDimension dim );
+
+ /**
+ * Sets the new size of the widget.
+ * Reimplemented from YWidget.
+ */
+ void setSize( long newWidth, long newHeight );
+
+ /**
+ * Set up the signal connections before publishing
+ * Reimplemented from YWebWidget
+ */
+ virtual void publish();
+};
+
+#endif // YWebPushButton_h
Added: branches/research/web-wt/src/YWebSplit.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebSplit.cc?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebSplit.cc (added)
+++ branches/research/web-wt/src/YWebSplit.cc Thu Aug 30 13:16:48 2007
@@ -0,0 +1,145 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebSplit.cc
+
+ Author: Mathias Kettner
+ Maintainer: Stefan Hundhammer
+
+/-*/
+
+
+#define y2log_component "web-ui"
+#include
+#include "YWebSplit.h"
+#include "YWebUI.h"
+#include "YWebPushButton.h"
+
+#include <WTableCell>
+
+using namespace Wt;
+
+class YWebSplitImpl : public WContainerWidget, public YWebWidget {
+public:
+ YWebSplitImpl( WContainerWidget * parent, YWebSplit* yparent )
+ : WContainerWidget( parent )
+ , YWebWidget ()
+ , _yparent (yparent)
+ {
+ setContentAlignment( AlignCenter );
+ }
+
+ virtual ~YWebSplitImpl() {}
+
+ virtual void moveTo( Wt::WTableCell* parent )
+ {
+ y2security( "MyContainer moveTo" );
+ _yparent->moveTo (parent);
+ }
+private:
+ YWebSplit* _yparent;
+};
+
+
+YWebSplit::YWebSplit( WContainerWidget * parent,
+ const YWidgetOpt & opt,
+ YUIDimension dimension )
+ : YSplit( opt, dimension )
+ , YWebWidget()
+ , _row (0)
+ , _column (0)
+{
+ y2milestone( "Creating YWebSplit" );
+ setWidgetRep( 0 ); // lazy initialization
+// _container = new MyContainer( parent, this );
+// setWidgetRep( _container );
+}
+
+
+void YWebSplit::setEnabling( bool enabled )
+{
+// FIXME QWidget::setEnabled( enabled );
+}
+
+
+void YWebSplit::setSize( long newWidth, long newHeight )
+{
+// _container->resize( newWidth, newHeight);
+ y2milestone( "Setting the size to %ldx%ld", newWidth, newHeight);
+ YSplit::setSize( newWidth, newHeight );
+}
+
+
+void YWebSplit::moveChild( YWidget * child, long newX, long newY )
+{
+ y2milestone( "Moving child %s (%p:%p) to %ldx%ld", child->widgetClass(), child, child->widgetRep(), newX, newY );
+
+ YWebWidget* w = dynamic_cast(child);
+
+ if( w )
+ {
+ y2milestone( "Calling moveTo" );
+
+// WTableCell* t = YWebUI::ui()->layout()->elementAt(_row + newY, _column + newX);
+
+// w->moveTo( t );
+ }
+
+// newX = newX * (X_UNIT + 2);
+// newY = newY * (Y_UNIT + 2);
+
+// qw->setOffset( WWidget::Left, WLength(newX, WLength::FontEx) );
+// qw->setOffset( WWidget::Top, WLength(newY, WLength::FontEm) );
+}
+
+
+void
+YWebSplit::publish()
+{
+ if( ! widgetRep() )
+ {
+ WContainerWidget* parent = yParent() ? (WContainerWidget*)yParent()->widgetRep() : 0L;
+ setWidgetRep( new YWebSplitImpl( parent, this ) );
+
+ y2security ("YWebSplit %p, rep %p", this, widgetRep() );
+ }
+
+ // go through all widgets and call publish recursively
+ for( int i = 0 ; i < numChildren() ; i++ )
+ {
+ YWebWidget* w = dynamic_cast( child(i) );
+ if( w )
+ w->publish();
+ }
+}
+
+
+void YWebSplit::childAdded( YWidget *child )
+{
+/* int numchilds = numChildren();
+ ((Wt::WWidget *)(child->widgetRep()))->setParent( _container->elementAt(
+ (primaryDimension() == YD_HORIZ) ? 0 : numchilds-1,
+ (primaryDimension() == YD_HORIZ) ? numchilds-1 : 0
+ ) );*/
+}
+
+void YWebSplit::childRemoved( YWidget *child )
+{
+
+}
+
+void YWebSplit::moveTo( Wt::WTableCell* parent )
+{
+ _row = parent->row();
+ _column = parent->column();
+ y2security( "YWebSplit moved row %d, columnt %d", _row, _column );
+}
Added: branches/research/web-wt/src/YWebSplit.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebSplit.h?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebSplit.h (added)
+++ branches/research/web-wt/src/YWebSplit.h Thu Aug 30 13:16:48 2007
@@ -0,0 +1,85 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebSplit.h
+
+ Author: Mathias Kettner
+ Maintainer: Stefan Hundhammer
+
+/-*/
+
+// -*- c++ -*-
+
+#ifndef YWebSplit_h
+#define YWebSplit_h
+
+#include <WContainerWidget>
+
+#include "YSplit.h"
+#include "YWebWidget.h"
+
+class YWebSplitImpl;
+
+class YWebSplit : public YSplit, public YWebWidget
+{
+
+public:
+
+ /**
+ * Constructor.
+ */
+ YWebSplit( Wt::WContainerWidget * parent, const YWidgetOpt & opt, YUIDimension splitDimension );
+
+ /**
+ * Inherited from YWidget: Sets the enabled state of the
+ * widget. All new widgets are enabled per definition. Only
+ * enabled widgets can take user input.
+ */
+ void setEnabling( bool enabled );
+
+ /**
+ * Inherited from YWidget. Sets the new size of the widget.
+ */
+ void setSize( long newWidth, long newHeight );
+
+ /**
+ * Inherited from YSplit. Moves a child to a new position
+ */
+ void moveChild( YWidget * child, long newX, long newY );
+
+ virtual void publish();
+
+ /**
+ * Call back function that reports to the ui specific
+ * widget that a child has been added.
+ * Reimplemented from YSplit
+ */
+ virtual void childAdded( YWidget *child );
+
+ /**
+ * Call back function that reports to the ui specific
+ * widget that a child has been removed.
+ * Reimplemented from YSplit
+ */
+ virtual void childRemoved( YWidget *child );
+
+ virtual void moveTo( Wt::WTableCell* parent );
+
+private:
+
+ // my position
+ int _row;
+ int _column;
+};
+
+
+#endif // YWebSplit_h
Added: branches/research/web-wt/src/YWebUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebUI.h?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebUI.h (added)
+++ branches/research/web-wt/src/YWebUI.h Thu Aug 30 13:16:48 2007
@@ -0,0 +1,624 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebUI.h
+
+ Authors: Mathias Kettner ,
+ Stefan Hundhammer
+
+ Maintainer: Stefan Hundhammer
+
+/-*/
+
+#ifndef YWebUI_h
+#define YWebUI_h
+
+#include <WApplication>
+#include <WTimer>
+#include <vector>
+#include <WTable>
+
+#include "YSimpleEventHandler.h"
+#include "YWebDialog.h"
+#include
+
+class YEvent;
+class Wt::WTimer;
+
+using std::string;
+using std::vector;
+
+class YWebUI: public Wt::WApplication, public YUI
+{
+public:
+
+ /**
+ * Constructor.
+ */
+ YWebUI( const Wt::WEnvironment& env,
+ bool with_threads,
+ const char * macro_file );
+
+ /**
+ * Destructor.
+ */
+ ~YWebUI();
+
+ /**
+ * Access the global Qt-UI.
+ **/
+ static YWebUI * ui() { return _ui; }
+
+ /**
+ * Widget event handlers (slots) call this when an event occured that
+ * should be the answer to a UserInput() / PollInput() (etc.) call.
+ *
+ * The UI assumes ownership of the event object that 'event' points to.
+ * In particular, it takes care to delete that object.
+ *
+ * It is an error to pass 0 for 'event'.
+ **/
+ void sendEvent( YEvent * event );
+
+ /**
+ * Returns 'true' if there is any event pending for the specified widget.
+ **/
+ bool eventPendingFor( YWidget * widget ) const
+ { return _event_handler.eventPendingFor( widget ); }
+
+ /**
+ * Returns the last event that isn't processed yet or 0 if there is none.
+ *
+ * The Qt UI keeps track of only one single (the last one) event.
+ **/
+ YEvent * pendingEvent() const { return _event_handler.pendingEvent(); }
+
+ /**
+ * Returns 'false" if the "--no-wm" was specified on the command line, i.e.
+ * we should assume no window manager is running.
+ */
+ bool haveWM() const { return _have_wm; }
+
+ /**
+ * Returns 'true' if defaultsize windows should use the full screen.
+ **/
+ bool fullscreen() const { return _fullscreen; }
+
+ /**
+ * Returns 'false' if toplevel (defaultsize) windows should not get window
+ * manager decorations, i.e. "--noborder" was specified on the command
+ * line.
+ **/
+ bool decorateToplevelWindow() const { return _decorate_toplevel_window; }
+
+ /**
+ * Returns 'true' if the UI had a fatal error that requires the application
+ * to abort.
+ **/
+ bool fatalError() const { return _fatal_error; }
+
+ /**
+ * Raise a fatal UI error. It will be delivered when it is safe to do so.
+ * The caller should make sure it can continue for some time until the
+ * error is delivered.
+ **/
+ void raiseFatalError() { _fatal_error = true; }
+
+ /**
+ * Returns size for `opt(`defaultsize) dialogs (in one dimension).
+ */
+ long defaultSize( YUIDimension dim ) const;
+
+ /**
+ * Toggle macro recording (activated by Ctrl-Shift-Alt-M):
+ * Stop macro recording if it is in progress,
+ * open a file selection box and ask for a macro file name to save to and
+ * start recording if no recording has been in progress.
+ */
+ void toggleRecordMacro();
+
+ /**
+ * Open file selection box and ask for a macro file to play
+ * (activated by Ctrl-Shift-Alt-P)
+ */
+ void askPlayMacro();
+
+ /**
+ * Issue an internal error: Open popup with that message and wait.
+ *
+ * Reimplemented from YUI.
+ */
+ void internalError( const char * msg );
+
+
+ /**
+ * Block WM_CLOSE events for the main window.
+ **/
+ void blockWmClose() { _wm_close_blocked = true; }
+
+ /**
+ * Unblock WM_CLOSE events for the main window.
+ **/
+ void unblockWmClose() { _wm_close_blocked = false; }
+
+ /**
+ * Check if dialogs are to be activated automatically
+ **/
+ bool autoActivateDialogs() const { return _auto_activate_dialogs; }
+
+ /**
+ * Block (or unblock) events. If events are blocked, any event sent
+ * should be ignored until events are unblocked again.
+ *
+ * Reimplemented from YUI.
+ **/
+ virtual void blockEvents( bool block = true )
+ { _event_handler.blockEvents( block ); }
+
+ /**
+ * Returns 'true' if events are currently blocked.
+ *
+ * Reimplemented from YUI.
+ **/
+ virtual bool eventsBlocked() const
+ { return _event_handler.eventsBlocked(); }
+
+ /**
+ * Returns the current product name
+ * ("SuSE Linux", "SuSE Linux Enterprise Server", "United Linux", etc.)
+ * as QString.
+ **/
+ std::string productName() const;
+
+ /**
+ * Beep - activate the system (X11) bell.
+ *
+ * Reimplemented from YUI.
+ */
+ void beep();
+
+ Wt::WTable* layout() const { return _layout; }
+
+public slots:
+
+ /**
+ * Show hourglass cursor.
+ *
+ * Reimplemented from YUI.
+ */
+ void busyCursor();
+
+ /**
+ * Show pointer cursor.
+ *
+ * Reimplemented from YUI.
+ */
+ void normalCursor();
+
+ /**
+ * Open file selection box and let the user Save y2logs to that location.
+ * (Shift-F8)
+ **/
+ void askSaveLogs();
+
+ /**
+ * Open dialog to configure logging.
+ * (Shift-F7)
+ **/
+ void askConfigureLogging();
+
+#if 0
+signals:
+ /**
+ * Emitted upon WM_CLOSE
+ **/
+ void wmClose();
+#endif
+
+protected:
+
+ /**
+ * Idle around until fd_ycp is readable and handle repaints.
+ * This is only used when a separate ui thread is running.
+ *
+ * Reimplemented from YUI.
+ */
+ void idleLoop( int fd_ycp );
+
+ /**
+ * Return a representation for the glyph symbol specified in UTF-8 encoding
+ * or an empty string to get a default textual representation.
+ *
+ * Reimplemented from YUI.
+ */
+ YCPString glyph( const YCPSymbol & glyphSymbol );
+
+ /**
+ * Go into event loop until next user input is available.
+ *
+ * Reimplemented from YUI.
+ */
+ YEvent * userInput( unsigned long timeout_millisec = 0 );
+
+ /**
+ * Check the event queue for user input. Don't wait.
+ *
+ * Reimplemented from YUI.
+ */
+ YEvent * pollInput();
+
+ /**
+ * Create a dialog.
+ *
+ * Reimplemented from YUI.
+ */
+ YDialog * createDialog( YWidgetOpt & opt );
+
+ /**
+ * Show and activate a dialog.
+ *
+ * Reimplemented from YUI.
+ */
+ void showDialog( YDialog * dialog );
+
+ /**
+ * Decativate and close a dialog. This does not delete the dialog yet.
+ *
+ * Reimplemented from YUI.
+ */
+ void closeDialog( YDialog * dialog );
+
+
+ /*** Widget creation methods, all reimplemented from YUI ***/
+
+ YContainerWidget * createAlignment ( YWidget * parent, YWidgetOpt & opt, YAlignmentType horAlign, YAlignmentType vertAlign );
+ YContainerWidget * createFrame ( YWidget * parent, YWidgetOpt & opt, const YCPString & label );
+ YContainerWidget * createCheckBoxFrame ( YWidget * parent, YWidgetOpt & opt, const YCPString & label, bool checked );
+ YContainerWidget * createRadioButtonGroup ( YWidget * parent, YWidgetOpt & opt);
+ YContainerWidget * createReplacePoint ( YWidget * parent, YWidgetOpt & opt);
+ YContainerWidget * createSplit ( YWidget * parent, YWidgetOpt & opt, YUIDimension dimension);
+ YContainerWidget * createSquash ( YWidget * parent, YWidgetOpt & opt, bool horSquash, bool vertSquash);
+ YContainerWidget * createWeight ( YWidget * parent, YWidgetOpt & opt, YUIDimension dim, long weight);
+
+ YWidget * createCheckBox ( YWidget * parent, YWidgetOpt & opt, const YCPString & label, bool checked);
+ YWidget * createComboBox ( YWidget * parent, YWidgetOpt & opt, const YCPString & label);
+ YWidget * createEmpty ( YWidget * parent, YWidgetOpt & opt);
+ YWidget * createImage ( YWidget * parent, YWidgetOpt & opt, YCPByteblock imageData, YCPString fallbackText );
+ YWidget * createImage ( YWidget * parent, YWidgetOpt & opt, YCPString fileName, YCPString fallbackText );
+ YWidget * createIntField ( YWidget * parent, YWidgetOpt & opt, const YCPString & label, int minValue, int maxValue, int initialValue);
+ YWidget * createLabel ( YWidget * parent, YWidgetOpt & opt, const YCPString & text);
+ YWidget * createLogView ( YWidget * parent, YWidgetOpt & opt, const YCPString & label, int visibleLines, int maxLines );
+ YWidget * createMultiLineEdit ( YWidget * parent, YWidgetOpt & opt, const YCPString & label, const YCPString & text);
+ YWidget * createProgressBar ( YWidget * parent, YWidgetOpt & opt, const YCPString & label, const YCPInteger & maxProgress, const YCPInteger & currentProgress );
+ YWidget * createPackageSelector ( YWidget * parent, YWidgetOpt & opt, const YCPString & floppyDevice );
+ YWidget * createPushButton ( YWidget * parent, YWidgetOpt & opt, const YCPString & label);
+ YWidget * createMenuButton ( YWidget * parent, YWidgetOpt & opt, const YCPString & label);
+ YWidget * createRadioButton ( YWidget * parent, YWidgetOpt & opt, YRadioButtonGroup * rbg, const YCPString & label, bool checked);
+ YWidget * createRichText ( YWidget * parent, YWidgetOpt & opt, const YCPString & text);
+ YWidget * createSelectionBox ( YWidget * parent, YWidgetOpt & opt, const YCPString & label);
+ YWidget * createMultiSelectionBox ( YWidget * parent, YWidgetOpt & opt, const YCPString & label);
+ YWidget * createSpacing ( YWidget * parent, YWidgetOpt & opt, float size, bool horizontal, bool vertical);
+ YWidget * createTable ( YWidget * parent, YWidgetOpt & opt, vector<string> header);
+ YWidget * createTextEntry ( YWidget * parent, YWidgetOpt & opt, const YCPString & label, const YCPString & text);
+ YWidget * createTree ( YWidget * parent, YWidgetOpt & opt, const YCPString & label);
+ YWidget * createPkgSpecial ( YWidget * parent, YWidgetOpt & opt, const YCPString & subwidget );
+
+
+ /*** Widget creation methods for optional widgets, all reimplemented from YUI ***/
+
+ bool hasBarGraph();
+ YWidget * createBarGraph ( YWidget * parent, YWidgetOpt & opt);
+
+
+ bool hasColoredLabel();
+ YWidget * createColoredLabel ( YWidget * parent,
+ YWidgetOpt & opt,
+ YCPString label,
+ YColor foreground,
+ YColor background,
+ int margin );
+
+ bool hasDate();
+ YWidget * createDate ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPString & date);
+
+ bool hasTime();
+ YWidget * createTime ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPString & time);
+
+ bool hasDownloadProgress();
+ YWidget * createDownloadProgress ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPString & filename,
+ int expectedSize );
+
+ bool hasDumbTab();
+ YWidget * createDumbTab ( YWidget * parent,
+ YWidgetOpt & opt );
+
+ bool hasMultiProgressMeter();
+ YWidget * createMultiProgressMeter( YWidget * parent,
+ YWidgetOpt & opt,
+ bool horizontal,
+ const YCPList & maxValues );
+
+ bool hasSlider();
+ YWidget * createSlider ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ int minValue,
+ int maxValue,
+ int initialValue );
+
+ bool hasPartitionSplitter();
+ YWidget * createPartitionSplitter( YWidget * parent,
+ YWidgetOpt & opt,
+ int usedSize,
+ int totalFreeSize,
+ int newPartSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const YCPString & usedLabel,
+ const YCPString & freeLabel,
+ const YCPString & newPartLabel,
+ const YCPString & freeFieldLabel,
+ const YCPString & newPartFieldLabel );
+
+ bool hasPatternSelector();
+ YWidget * createPatternSelector ( YWidget * parent,
+ YWidgetOpt & opt );
+
+ bool hasSimplePatchSelector();
+ YWidget * createSimplePatchSelector( YWidget * parent,
+ YWidgetOpt & opt );
+
+ bool hasWizard();
+ YWidget * createWizard ( YWidget * parent, YWidgetOpt & opt,
+ const YCPValue & backButtonId, const YCPString & backButtonLabel,
+ const YCPValue & abortButtonId, const YCPString & abortButtonLabel,
+ const YCPValue & nextButtonId, const YCPString & nextButtonLabel );
+
+
+
+ /*** END widget creation methods ***/
+
+
+public:
+
+ /**
+ *
+ * Open a directory selection box and prompt the user for an existing directory.
+ * [Reimplemented from YUI]
+ *
+ * 'startDir' is the initial directory that is displayed.
+ *
+ * 'headline' is an explanatory text for the directory selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected directory name
+ * or 'nil' (YCPVoid() ) if the user canceled the operation.
+ **/
+ YCPValue askForExistingDirectory ( const YCPString & startDir,
+ const YCPString & headline );
+
+ /**
+ * Open a file selection box and prompt the user for an existing file.
+ * [Reimplemented from YUI]
+ *
+ * 'startWith' is the initial directory or file.
+ *
+ * 'filter' is one or more blank-separated file patterns, e.g. "*.png *.jpg"
+ *
+ * 'headline' is an explanatory text for the file selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected file name
+ * or 'nil' (YCPVoid() ) if the user canceled the operation.
+ **/
+ YCPValue askForExistingFile ( const YCPString & startWith,
+ const YCPString & filter,
+ const YCPString & headline );
+
+ /**
+ * Open a file selection box and prompt the user for a file to save data to.
+ * Automatically asks for confirmation if the user selects an existing file.
+ * [Reimplemented from YUI]
+ *
+ * 'startWith' is the initial directory or file.
+ *
+ * 'filter' is one or more blank-separated file patterns, e.g. "*.png *.jpg"
+ *
+ * 'headline' is an explanatory text for the file selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected file name
+ * or 'nil' (YCPVoid() ) if the user canceled the operation.
+ **/
+ YCPValue askForSaveFileName ( const YCPString & startWith,
+ const YCPString & filter,
+ const YCPString & headline );
+
+ /**
+ * Lower-level version that works with QStrings and does not change
+ * the mouse cursor.
+ **/
+ std::string askForSaveFileName( const std::string & startWith,
+ const std::string & filter,
+ const std::string & headline );
+
+ /**
+ * main widget
+ */
+ Wt::WWidget* mainWidget();
+
+ int argc() const { return _argc; }
+
+ char ** argv() const { return _argv; }
+
+ static int _argc;
+
+ static char ** _argv;
+
+
+ void createTimer() ;
+
+protected:
+
+ /**
+ * Sets the X input method according to the locale.
+ * [Reimplemented from YUI]
+ */
+ YCPValue setLanguage( const YCPTerm & term );
+
+
+ /**
+ * Display capabilities.
+ * [Reimplemented from YUI]
+ * See UI builtin GetDisplayInfo() doc for details.
+ **/
+ bool textMode() { return false; }
+ bool hasImageSupport() { return true; }
+ bool hasLocalImageSupport() { return true; }
+ bool hasAnimationSupport() { return true; }
+ bool hasIconSupport() { return false; } // not yet
+ bool hasFullUtf8Support() { return true; }
+ bool richTextSupportsTable() { return true; }
+
+
+protected slots:
+
+ /**
+ * Application shutdown
+ **/
+ bool close();
+
+ /**
+ * Timeout during TimeoutUserInput() / WaitForEvent()
+ **/
+ void userInputTimeout();
+
+ /**
+ * Sets @ref #leave_idle_loop to true.
+ */
+ void leaveIdleLoop( int );
+
+
+ void createWebServerThread();
+
+ void triggeredTimer();
+
+protected:
+
+ /**
+ * Handle command line args
+ **/
+ void processCommandLineArgs( int argc, char **argv );
+
+
+ //
+ // Data members
+ //
+
+ /**
+ * Assume presence of a window manager
+ */
+ bool _have_wm;
+
+ /**
+ * Use the entire available screen
+ **/
+ bool _fullscreen;
+
+ /**
+ * Decorate the toplevel window
+ **/
+ bool _decorate_toplevel_window;
+
+ /**
+ * Container for the widget stack. QWidgetStack cannot handle a WFlags
+ * argument, so this needs to be embedded into something else - and a QVBox
+ * at least handles all the sizeHint and resize stuff.
+ **/
+ Wt::WContainerWidget * _main_win;
+
+#if 0
+ /**
+ * Stack for the Qt widgets inside the main window.
+ **/
+ QWidgetStack * _widget_stack;
+
+ /**
+ * Stack to keep track of the stacking order of popup dialogs.
+ **/
+ vector _popup_stack;
+#endif
+ /**
+ * Numeric ID for defaultsize dialogs for the widget stack
+ **/
+ int _main_dialog_id;
+
+ /**
+ * A flag used during the idle loop. If it is set to true,
+ * the idle loop is left. This happens, if the ycp-ui-communication
+ * pipe to the ui gets readable.
+ */
+ bool _leave_idle_loop;
+
+ /**
+ * This flag is set during @ref #userInput in order to tell
+ * @ref #returnNow to call exit_loop, which only may be called
+ * after enter_loop.
+ */
+ bool _do_exit_loop;
+
+ /**
+ * Window manager close events blocked?
+ **/
+ bool _wm_close_blocked;
+
+ /**
+ * Force new dialogs to the foreground and grab the keyboard focus?
+ * (Only if running without a window manager)
+ **/
+ bool _auto_activate_dialogs;
+
+ /**
+ * Global reference to the UI
+ **/
+ static YWebUI * _ui;
+
+ /**
+ * Indicate a fatal error that requires the UI to terminate
+ **/
+ bool _fatal_error;
+
+ /**
+ * The handler for the single pending event this UI keeps track of
+ **/
+ YSimpleEventHandler _event_handler;
+
+ pthread_t webserver_thread;
+
+ Wt::WTimer* _timer;
+
+ YWebDialog* _pending_dialog;
+
+ Wt::WTable* _layout;
+};
+
+
+#endif // YWebUI_h
Added: branches/research/web-wt/src/YWebUIComponent.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebUIComponent.h?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebUIComponent.h (added)
+++ branches/research/web-wt/src/YWebUIComponent.h Thu Aug 30 13:16:48 2007
@@ -0,0 +1,76 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebUIComponent.h
+
+ Authors: Stefan Hundhammer
+
+ Maintainer: Stefan Hundhammer
+
+/-*/
+
+#ifndef YWebUIComponent_h
+#define YWebUIComponent_h
+
+#include
+
+#include
+#include "YWebUI.h"
+
+extern void *start_webserver_thread( void * yui );
+
+class YWebUIComponent : public YUIComponent
+{
+public:
+
+ YWebUIComponent(): YUIComponent() {}
+
+ /**
+ * Create a web UI. This is called from within setServerOptions().
+ *
+ * Reimplemented from YUIComponent.
+ **/
+ virtual YUI * createUI( int argc, char **argv, bool with_threads, const char * macro_file )
+ {
+ YWebUI::_argc = argc;
+ YWebUI::_argv = argv;
+
+ pthread_t webserver_thread;
+ pthread_attr_t attr;
+ pthread_attr_init( & attr );
+
+ if( pthread_create( & webserver_thread, & attr, start_webserver_thread, 0 ) > 0 )
+ {
+ y2internal ("Could not create Web server thread, aborting");
+ abort();
+ }
+
+ y2milestone( "Server thread running");
+
+ while (! YWebUI::ui() )
+ {
+ sleep( 1 );
+ }
+ return YWebUI::ui(); // new YWebUI( argc, argv, with_threads, macro_file );
+ }
+
+ /**
+ * Returns the name of this YaST2 component.
+ *
+ * Reimplemented from YUIComponent.
+ */
+ virtual string name() const { return "web"; }
+
+};
+
+
+#endif // YWebUIComponent_h
Added: branches/research/web-wt/src/YWebUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebUI_builtins.cc?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebUI_builtins.cc (added)
+++ branches/research/web-wt/src/YWebUI_builtins.cc Thu Aug 30 13:16:48 2007
@@ -0,0 +1,338 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YUIQt_builtins.cc
+
+ Author: Stefan Hundhammer
+ Maintainer: Stefan Hundhammer
+
+ Textdomain "packages-qt"
+
+/-*/
+
+#include
+#include
+
+#include
+#define y2log_component "web-ui"
+#include
+
+#include <WMessageBox>
+
+#include "YWebUI.h"
+#include "YEvent.h"
+#include "YMacroRecorder.h"
+#include "YUISymbols.h"
+#include "YWebDialog.h"
+
+using namespace Wt;
+
+#define DEFAULT_MACRO_FILE_NAME "macro.ycp"
+
+
+
+YCPValue YWebUI::setLanguage( const YCPTerm & term)
+{
+ // FIXME
+ return YCPVoid(); // OK (YCPNull() would mean error)
+}
+
+
+YCPString
+YWebUI::glyph( const YCPSymbol & glyphSymbol )
+{
+ // FIXME
+ return YCPString( "" );
+}
+
+
+void YWebUI::askSaveLogs()
+{
+#if 0
+ std::string fileName = askForSaveFileName( "/tmp/y2logs.tgz", // startWith
+ "*.tgz *.tar.gz", // filter
+ "Save y2logs to..." ); // headline
+
+ if ( ! fileName.isEmpty() )
+ {
+ std::string saveLogsCommand = "/sbin/save_y2logs";
+
+ if ( access( saveLogsCommand.ascii(), X_OK ) == 0 )
+ {
+ saveLogsCommand += " '" + fileName + "'";
+ y2milestone( "Saving y2logs: %s", saveLogsCommand.ascii() );
+ int result = system( saveLogsCommand.ascii() );
+
+ if ( result != 0 )
+ {
+ y2error( "Error saving y2logs: \"%s\" exited with %d",
+ (const char *) saveLogsCommand, result );
+ WMessageBox::warning( 0, // parent
+ "Error", // caption
+ std::string( "Couldn't save y2logs to %1 - "
+ "exit code %2" ).arg( fileName ).arg( result ),
+ WMessageBox::Ok | WMessageBox::Default, // button0
+ WMessageBox::NoButton, // button1
+ WMessageBox::NoButton ); // button2
+ }
+ else
+ {
+ y2milestone( "y2logs saved to %s", (const char *) fileName );
+ }
+ }
+ else
+ {
+ y2error( "Error saving y2logs: Command %s not found",
+ saveLogsCommand.ascii() );
+
+ WMessageBox::warning( 0, // parent
+ "Error", // caption
+ std::string( "Couldn't save y2logs to %1:\n"
+ "Command %2 not found" ).arg( fileName ).arg( saveLogsCommand ),
+ WMessageBox::Ok | WMessageBox::Default, // button0
+ WMessageBox::NoButton, // button1
+ WMessageBox::NoButton ); // button2
+ }
+ }
+#endif
+}
+
+
+void YWebUI::askConfigureLogging()
+{
+#if 0
+ bool okButtonPressed = false;
+ std::stringList items;
+ items << "Debug logging off"
+ << "Debug logging on";
+
+ std::string result = QInputDialog::getItem( "YaST2 Logging", // caption
+ "Configure YaST2 Logging:", // label
+ items,
+ get_log_debug() ? 1 : 0,
+ false, // editable
+ &okButtonPressed,
+ _main_win ); // parent
+
+ if ( okButtonPressed )
+ {
+ set_log_debug( result.endsWith( "on" ) );
+ y2milestone( "Changing logging: %s - %s", (const char *) result,
+ get_log_debug() ? "y2debug on" : "y2debug off" );
+ }
+#endif
+}
+
+
+void YWebUI::toggleRecordMacro()
+{
+#if 0
+ if ( recordingMacro() )
+ {
+ stopRecordMacro();
+ normalCursor();
+
+ WMessageBox::information( 0, // parent
+ "YaST2 Macro Recorder", // caption
+ "Macro recording done.", // text
+ WMessageBox::Ok | WMessageBox::Default, // button0
+ WMessageBox::NoButton, // button1
+ WMessageBox::NoButton ); // button2
+ }
+ else
+ {
+ normalCursor();
+
+ std::string filename =
+ QFileDialog::getSaveFileName( DEFAULT_MACRO_FILE_NAME, // startWith
+ "*.ycp", // filter
+ 0, // parent
+ 0, // (widget) name
+ "Select Macro File to Record to" ); // caption
+
+ if ( ! filename.isEmpty() ) // file selection dialog has been cancelled
+ {
+ recordMacro( (const char *) filename );
+ }
+ }
+#endif
+}
+
+
+void YWebUI::askPlayMacro()
+{
+#if 0
+ normalCursor();
+
+ std::string filename =
+ QFileDialog::getOpenFileName( DEFAULT_MACRO_FILE_NAME, // startWith
+ "*.ycp", // filter
+ 0, // parent
+ 0, // (widget) name
+ "Select Macro File to Play" ); // caption
+ busyCursor();
+
+ if ( ! filename.isEmpty() ) // file selection dialog has been cancelled
+ {
+ playMacro( (const char *) filename );
+
+ // Do special magic to get out of any UserInput() loop right now
+ // without doing any harm - otherwise this would hang until the next
+ // mouse click on a PushButton etc.
+
+ sendEvent( new YEvent() );
+
+ if ( _do_exit_loop )
+ {
+ qApp->exit_loop();
+ }
+ }
+#endif
+}
+
+
+
+YCPValue YWebUI::askForExistingDirectory( const YCPString & startDir,
+ const YCPString & headline )
+{
+ return YCPVoid();
+#if 0
+ normalCursor();
+
+ std::string dir_name =
+ QFileDialog::getExistingDirectory( fromUTF8( startDir->value() ),
+ _main_win, // parent
+ "dir_selector", // name
+ fromUTF8( headline->value() ) ); // caption
+ busyCursor();
+
+ if ( dir_name.isEmpty() ) // this includes dir_name.isNull()
+ return YCPVoid(); // nothing selected -> return 'nil'
+
+ return YCPString( toUTF8( dir_name ) );
+#endif
+}
+
+
+YCPValue YWebUI::askForExistingFile( const YCPString & startWith,
+ const YCPString & filter,
+ const YCPString & headline )
+{
+ return YCPVoid();
+#if 0
+ normalCursor();
+
+ std::string file_name =
+ QFileDialog::getOpenFileName( fromUTF8( startWith->value() ),
+ fromUTF8( filter->value() ),
+ _main_win, // parent
+ "file_selector", // name
+ fromUTF8( headline->value() ) ); // caption
+ busyCursor();
+
+ if ( file_name.isEmpty() ) // this includes file_name.isNull()
+ return YCPVoid(); // nothing selected -> return 'nil'
+
+ return YCPString( toUTF8( file_name ) );
+#endif
+}
+
+
+YCPValue YWebUI::askForSaveFileName( const YCPString & startWith,
+ const YCPString & filter,
+ const YCPString & headline )
+{
+ return YCPVoid();
+#if 0
+ normalCursor();
+
+ std::string file_name = askForSaveFileName( fromUTF8( startWith->value() ),
+ fromUTF8( filter->value() ),
+ fromUTF8( headline->value() ) );
+ busyCursor();
+
+ if ( file_name.empty() ) // this includes file_name.isNull()
+ return YCPVoid(); // nothing selected -> return 'nil'
+
+ return YCPString( file_name );
+#endif
+}
+
+
+
+std::string YWebUI::askForSaveFileName( const std::string & startWith,
+ const std::string & filter,
+ const std::string & headline )
+{
+ std::string file_name;
+
+#if 0
+ bool try_again = false;
+
+ do
+ {
+ // Leave the mouse cursor alone - this function might be called from
+ // some other widget, not only from UI::AskForSaveFileName().
+
+ file_name = QFileDialog::getSaveFileName( startWith,
+ filter,
+ _main_win, // parent
+ "file_selector", // name
+ headline ); // caption
+
+ if ( file_name.isEmpty() ) // this includes file_name.isNull()
+ return std::string::null;
+
+
+ if ( access( (const char *) file_name, F_OK ) == 0 ) // file exists?
+ {
+ std::string msg;
+
+ if ( access( (const char *) file_name, W_OK ) == 0 )
+ {
+ // Confirm if the user wishes to overwrite an existing file
+ msg = ( _( "%1 exists! Really overwrite?" ) ).arg( file_name );
+ }
+ else
+ {
+ // Confirm if the user wishes to overwrite a write-protected file %1
+ msg = ( _( "%1 exists and is write-protected!\nReally overwrite?" ) ).arg( file_name );
+ }
+
+ int button_no = WMessageBox::information( _main_win,
+ // Window title for confirmation dialog
+ _( "Confirm" ),
+ msg,
+ _( "C&ontinue" ),
+ _( "&Cancel" ) );
+ try_again = ( button_no != 0 );
+ }
+
+ } while ( try_again );
+#endif
+ return file_name;
+}
+
+void YWebUI::beep()
+{
+}
+
+void YWebUI::busyCursor()
+{
+}
+
+void YWebUI::normalCursor()
+{
+}
+
+
+// EOF
Added: branches/research/web-wt/src/YWebUI_core.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebUI_core.cc?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebUI_core.cc (added)
+++ branches/research/web-wt/src/YWebUI_core.cc Thu Aug 30 13:16:48 2007
@@ -0,0 +1,516 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebUI_core.cc
+
+ Authors: Mathias Kettner
+ Stefan Hundhammer
+
+ Maintainer: Stefan Hundhammer
+
+/-*/
+
+#include // MAXHOSTNAMELEN
+#include
+
+
+#include
+#include
+
+#define y2log_component "web-ui"
+#include
+#include <WApplication>
+#include <WContainerWidget>
+#include <WMessageBox>
+#include <WText>
+#include <WLabel>
+#include <WPushButton>
+#include <WTable>
+#include <WTableCell>
+
+#include "YWebUI.h"
+#include "YEvent.h"
+#include "YUISymbols.h"
+
+#include "YWebDialog.h"
+
+using namespace Wt;
+
+YWebUI * YWebUI::_ui = 0;
+WApplication *_wapplication;
+bool _wtimer_work;
+
+int YWebUI::_argc = 0;
+
+char ** YWebUI::_argv = 0;
+
+extern YCPValue UIUserInput ();
+extern YCPValue UITimeoutUserInput( const YCPInteger& timeout );
+extern YCPValue UIWaitForEvent();
+extern YCPValue UIWaitForEventTimeout( const YCPInteger & timeout );
+
+
+YWebUI::YWebUI( const Wt::WEnvironment& env, bool with_threads, const char * macro_file )
+ : WApplication(env)
+ , YUI( true /*with_threads*/ )
+ , _main_win( NULL )
+ , _main_dialog_id(0)
+ , _do_exit_loop( false )
+ , _wm_close_blocked( false )
+ , _auto_activate_dialogs( true )
+ , _pending_dialog( NULL )
+{
+ _ui = this;
+ _fatal_error = false;
+ _have_wm = true;
+ _fullscreen = false;
+
+ processCommandLineArgs( _argc, _argv );
+
+
+ // Create main window for `opt(`defaultsize) dialogs.
+ //
+ // We have to use something else than QWidgetStack since QWidgetStack
+ // doesn't accept a WFlags arg which we badly need here.
+
+ // if we have a window already, delete it
+ if (_main_win)
+ delete _main_win;
+
+ _main_win = new WContainerWidget(); // no parent
+
+ _layout = new WTable(); // no parent
+ new WLabel( "Initializing...", _layout->elementAt(0,0) );
+
+
+// y2milestone( "Creating Web server" );
+// createWebServerThread();
+
+#if 0
+ _main_win->hide();
+
+ // Init other stuff
+
+ busyCursor();
+#endif
+
+ topmostConstructorHasFinished();
+}
+
+
+void YWebUI::processCommandLineArgs( int argc, char **argv )
+{
+ _argc = argc;
+ _argv = argv;
+
+ if ( argv )
+ {
+ for( int i=0; i < argc; i++ )
+ {
+ std::string opt = argv[i];
+
+ y2milestone ("Web argument: %s", argv[i]);
+
+ if ( opt == "--no-wm" ) _have_wm = false;
+ else if ( opt == "--fullscreen" ) _fullscreen = true;
+ else if ( opt == "--noborder" ) _decorate_toplevel_window = false;
+ // --macro is handled by YUI_component
+ else if ( opt == "--help" )
+ {
+ fprintf( stderr,
+ "Command line options for the YaST2 Qt UI:\n"
+ "\n"
+ "--nothreads run without additional UI threads\n"
+ "--no-wm assume no window manager is running\n"
+ "--fullscreen use full screen for `opt(`defaultsize) dialogs\n"
+ "--noborder no window manager border for `opt(`defaultsize) dialogs\n"
+ "--help this help text\n"
+ "\n"
+ "--macro <macro-file> play a macro right on startup\n"
+ "\n"
+ "-no-wm, -noborder etc. are accepted as well as --no-wm, --noborder\n"
+ "to maintain backwards compatibility.\n"
+ "\n"
+ );
+
+ raiseFatalError();
+ }
+ }
+ }
+}
+
+
+
+YWebUI::~YWebUI()
+{
+ y2debug("Closing down Qt UI.");
+
+ normalCursor();
+
+ // Intentionally NOT calling dlclose() to libqt-mt
+ // (see constructor for explanation)
+}
+
+
+
+
+void YWebUI::internalError( const char * msg )
+{
+ normalCursor();
+
+ Wt::WMessageBox::show( "YaST2 Internal Error", msg, 1); // 1 = OK button
+
+ abort();
+}
+
+
+void YWebUI::idleLoop( int fd_ycp )
+{
+ _leave_idle_loop = false;
+
+ // we have to reimplement uiMainThreadLopp here
+
+ while ( true )
+ {
+ // wait, if there is anything to do
+ if ( ! waitForYCPThread () )
+ continue;
+
+ if ( terminate_ui_thread )
+ return;
+
+ y2milestone( "Call comming");
+
+ if( _builtinCallData.function == UIUserInput )
+ {
+ y2milestone( "Handling outside of timer" );
+ _builtinCallData.result = YUI::callFunction( _builtinCallData.function,
+ _builtinCallData.argc,
+ _builtinCallData.argv );
+ }
+ else
+ {
+ y2milestone( "Preparing work for timer");
+ // trigger next WTimer wake
+ _wtimer_work = true;
+
+ // wait for WTimer to do its work
+ while (_wtimer_work != false)
+ {
+ sleep(1);
+ }
+ }
+
+ y2milestone( "Work done, signal YCP to continue" );
+
+ signalYCPThread();
+
+ }
+
+}
+
+
+void YWebUI::leaveIdleLoop( int )
+{
+ _leave_idle_loop = true;
+}
+
+
+void YWebUI::sendEvent( YEvent * event )
+{
+ if ( event )
+ {
+ _event_handler.sendEvent( event );
+ }
+}
+
+
+YEvent * YWebUI::userInput( unsigned long timeout_millisec )
+{
+ y2milestone( "userInput");
+ YEvent * event = 0;
+// YWebDialog * dialog = dynamic_cast ( currentDialog() );
+
+
+// if ( dialog )
+ {
+// dialog->activate( true );
+
+// normalCursor();
+// _do_exit_loop = true; // should exit_loop() be called in sendEvent()?
+
+ // FIXME: HACK HACK
+ while ( ! pendingEvent() )
+ {
+ sleep (1);
+ }
+
+// _do_exit_loop = false;
+ event = _event_handler.consumePendingEvent();
+// dialog->activate( false );
+
+ }
+ return event;
+}
+
+
+YEvent * YWebUI::pollInput()
+{
+ YEvent * event = 0;
+#if 0
+
+ if ( _user_input_timer.isActive() )
+ _user_input_timer.stop();
+
+ if ( ! pendingEvent() )
+ {
+ YWebDialog * dialog = dynamic_cast ( currentDialog() );
+
+ if ( dialog )
+ {
+ dialog->activate( true );
+ qApp->processEvents();
+ event = _event_handler.consumePendingEvent();
+ dialog->activate( false );
+ }
+ }
+
+ if ( pendingEvent() )
+ event = _event_handler.consumePendingEvent();
+#endif
+
+ return event;
+}
+
+
+void YWebUI::userInputTimeout()
+{
+#if 0
+ if ( ! pendingEvent() )
+ sendEvent( new YTimeoutEvent() );
+#endif
+}
+
+
+YDialog * YWebUI::createDialog( YWidgetOpt & opt )
+{
+ // wait for Web Application to appear (session is started)
+ while( ! _wapplication )
+ {
+ sleep(1);
+ }
+ y2milestone ("Create the dialog");
+
+ // Popup dialogs get the topmost other popup dialog as their parent since
+ // some window managers (e.g., fvwm2 as used in the inst-sys) otherwise
+ // tend to confuse the stacking order of popup dialogs.
+ //
+ // This _popup_stack handling would be better placed in showDialog(), but we
+ // need the parent here for QWidget creation. libyui guarantees that each
+ // createDialog() will be followed by showDialog() for the same dialog
+ // without any chance for other dialogs to get in between.
+
+// WApplication::UpdateLock lock = wApp->getUpdateLock();
+
+// y2milestone ("Got update lock");
+
+ _layout->clear ();
+
+ _pending_dialog = new YWebDialog( opt );
+
+ y2milestone( "Pending dialog prepared in %p", this );
+
+
+// _wtimer_work = true;
+
+// y2milestone ("Widget added");
+
+ // FIXME this might throw???
+// try {
+// wApp->triggerUpdate();
+// }
+// catch(...) {}
+
+ return _pending_dialog;
+}
+
+
+void YWebUI::showDialog( YDialog * dialog )
+{
+ y2milestone( "Publishing pending dialog" );
+ _pending_dialog->publish();
+
+ wApp->root()->clear();
+ wApp->root()->addWidget( (WWidget*)_pending_dialog->widgetRep() );
+
+#if 0
+ WWidget * qw = (WWidget *) dialog->widgetRep();
+
+ if ( ! qw )
+ {
+ y2error( "No widgetRep() for dialog" );
+ return;
+ }
+
+ // wait for Web Application to appear (session is started)
+ while( ! _wapplication )
+ {
+ sleep(1);
+ }
+
+ qw->show();
+#endif
+}
+
+
+void YWebUI::closeDialog( YDialog * /*dialog */)
+{
+#if 0
+ QWidget * qw = (QWidget *) dialog->widgetRep();
+
+ if ( ! qw )
+ {
+ y2error( "No widgetRep() for dialog" );
+ return;
+ }
+
+ if ( dialog->hasDefaultSize() )
+ {
+ _widget_stack->removeWidget( qw );
+
+ if ( --_main_dialog_id < 1 ) // nothing left on the stack
+ {
+ // y2milestone( "Hiding main window" );
+
+ _main_dialog_id = 0; // this should not be necessary - but better be safe than sorry
+ }
+ else
+ {
+ _widget_stack->raiseWidget( _main_dialog_id );
+ }
+ }
+ else // non-defaultsize dialog
+ {
+ qw->hide();
+
+ // Clean up the popup stack. libyui guarantees that a dialog will be
+ // deleted after closeDialog() so it is safe to pop that dialog from
+ // the popup stack here.
+
+ if ( ! _popup_stack.empty() && _popup_stack.back() == qw )
+ _popup_stack.pop_back();
+ else
+ y2error( "Popup dialog stack corrupted!" );
+ }
+#endif
+}
+
+
+std::string YWebUI::productName() const
+{
+ return YUI::productName();
+}
+
+WApplication *createApplication(const WEnvironment& env)
+{
+ // Instantiate the Wt application.
+ YWebUI *appl = new YWebUI( env, true, 0 );
+
+ // enable server-initiated updates
+ appl->enableUpdates ();
+
+ _wapplication = appl;
+
+ // Set window title
+
+ std::string title( "YaST2" );
+ char hostname[ MAXHOSTNAMELEN+1 ];
+
+ if ( gethostname( hostname, sizeof( hostname )-1 ) == 0 )
+ {
+ hostname[ sizeof( hostname ) -1 ] = '\0'; // make sure it's terminated
+
+ if ( strlen( hostname ) > 0 )
+ {
+ if ( ( strcmp( hostname, "(none)" ) != 0 &&
+ strcmp( hostname, "linux" ) != 0 )
+ )
+ {
+ title += "@";
+ title += hostname;
+ }
+ }
+ }
+
+ y2milestone( "Created WApplication (%p)", appl );
+
+ // Set application title
+ appl->setTitle(title);
+
+ // Set up a timer for handling YaST requests
+ appl->createTimer();
+
+ _wtimer_work = true;
+
+ return appl;
+}
+
+void *start_webserver_thread( void * yui )
+{
+ // FIXME: do the work
+ YWebUI* ui = (YWebUI*)yui;
+
+ WRun(ui->argc(), ui->argv(), &createApplication);
+
+ return 0;
+}
+
+void YWebUI::createWebServerThread()
+{
+ pthread_attr_t attr;
+ pthread_attr_init( & attr );
+
+ if( pthread_create( & webserver_thread, & attr, start_webserver_thread, this ) > 0 )
+ {
+ y2internal ("Could not create Web server thread, aborting");
+ abort();
+ }
+
+ y2milestone( "Server thread running");
+}
+
+void YWebUI::createTimer()
+{
+ _timer = new WTimer();
+
+ _timer->timeout.connect( SLOT(this, YWebUI::triggeredTimer ) );
+
+ _timer->start();
+}
+
+void YWebUI::triggeredTimer()
+{
+ y2debug ("Timer triggered");
+ if( _wtimer_work )
+ {
+
+ y2milestone("Work to do in %p", this);
+ // callFunction() checks for NULL function pointers
+
+ // (dynamic_cast(WObject::sender()))->stop ();
+
+ _builtinCallData.result = YUI::callFunction( _builtinCallData.function,
+ _builtinCallData.argc,
+ _builtinCallData.argv );
+ _wtimer_work = false;
+ }
+}
Added: branches/research/web-wt/src/YWebUI_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebUI_widgets.cc?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebUI_widgets.cc (added)
+++ branches/research/web-wt/src/YWebUI_widgets.cc Thu Aug 30 13:16:48 2007
@@ -0,0 +1,566 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YUIWeb_widgets.cc
+
+ Author: Stefan Hundhammer
+ Maintainer: Stefan Hundhammer
+
+/-*/
+
+#define y2log_component "web-ui"
+#include
+
+#include "YWebUI.h"
+
+#include "YWebDialog.h"
+#include "YWebLabel.h"
+#include "YWebPushButton.h"
+#include "YWebSplit.h"
+
+using namespace Wt;
+
+
+YContainerWidget * YWebUI::createReplacePoint( YWidget * parent,
+ YWidgetOpt & opt )
+{
+ return 0;
+// return new YQReplacePoint( ( (QWidget *)parent->widgetRep() ), opt );
+}
+
+YWidget * YWebUI::createEmpty ( YWidget * parent,
+ YWidgetOpt & opt )
+{
+ return 0;
+// return new YQEmpty( (QWidget *) parent->widgetRep(), opt );
+}
+
+YWidget * YWebUI::createSpacing ( YWidget * parent,
+ YWidgetOpt & opt,
+ float size,
+ bool horizontal,
+ bool vertical )
+{
+ return 0;
+// return new YQSpacing( (QWidget *) parent->widgetRep(), opt, size, horizontal, vertical);
+}
+
+YContainerWidget * YWebUI::createFrame ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label )
+{
+ return 0;
+// return new YQFrame ( ( (QWidget *) parent->widgetRep() ), opt, label );
+}
+
+YContainerWidget * YWebUI::createCheckBoxFrame ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ bool initialValue )
+{
+ return 0;
+// return new YQCheckBoxFrame ( ( (QWidget *) parent->widgetRep() ), opt, label, initialValue );
+}
+
+YContainerWidget * YWebUI::createSplit ( YWidget * parent,
+ YWidgetOpt & opt,
+ YUIDimension dimension )
+{
+ return new YWebSplit( ( (WContainerWidget *)parent->widgetRep() ), opt, dimension);
+}
+
+YContainerWidget * YWebUI::createAlignment( YWidget * parent,
+ YWidgetOpt & opt,
+ YAlignmentType halign,
+ YAlignmentType valign )
+{
+ return 0;
+// return new YQAlignment( ( (QWidget *)parent->widgetRep() ), opt, halign, valign);
+}
+
+YContainerWidget * YWebUI::createSquash ( YWidget * parent,
+ YWidgetOpt & opt,
+ bool hsquash,
+ bool vsquash )
+{
+ return 0;
+// return new YQSquash( ( (QWidget *)parent->widgetRep() ), opt, hsquash, vsquash);
+}
+
+YWidget * YWebUI::createLabel ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & text )
+{
+ return new YWebLabel( (WContainerWidget *) ( parent->widgetRep() ), opt, text);
+}
+
+
+bool YWebUI::hasDate()
+{
+ return true;
+}
+
+YWidget * YWebUI::createDate ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPString & date )
+{
+ return 0;
+// return new YQDate( (QWidget *) ( parent->widgetRep() ), opt, label, date);
+}
+
+
+bool YWebUI::hasTime()
+{
+ return true;
+}
+
+
+YWidget * YWebUI::createTime ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPString & time )
+{
+ return 0;
+// return new YQTime( (QWidget *) ( parent->widgetRep() ), opt, label, time);
+}
+
+
+YWidget * YWebUI::createLogView ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ int visibleLines,
+ int maxLines )
+{
+ return 0;
+// return new YQLogView( (QWidget *) ( parent->widgetRep() ), opt, label, visibleLines, maxLines);
+}
+
+YWidget * YWebUI::createRichText ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & text )
+{
+ return 0;
+// return new YQRichText( (QWidget *) ( parent->widgetRep() ), opt, text);
+}
+
+
+#if 0
+YQPackageSelectorPlugin * YWebUI::packageSelectorPlugin()
+{
+ return 0;
+ static YQPackageSelectorPlugin * plugin = 0;
+
+ if ( ! plugin )
+ {
+ plugin = new YQPackageSelectorPlugin();
+
+ // This is a deliberate memory leak: If an application requires a
+ // PackageSelector, it is a package selection application by
+ // definition. In this case, the qt_pkg plugin is intentionally kept
+ // open to avoid repeated start-up cost of the plugin and libzypp.
+ }
+
+ return plugin;
+}
+#endif
+
+
+YWidget * YWebUI::createPackageSelector ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & floppyDevice )
+{
+ return 0;
+#if 0
+ _auto_activate_dialogs = false;
+ YWidget * packageSelector = 0;
+
+ YQPackageSelectorPlugin * plugin = packageSelectorPlugin();
+
+ if ( plugin )
+ {
+ packageSelector = plugin->createPackageSelector( parent, opt );
+ }
+
+ return packageSelector;
+#endif
+}
+
+
+YWidget * YWebUI::createPkgSpecial ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & subwidget )
+{
+ y2error( "The Web UI does not support PkgSpecial subwidgets!" );
+ return 0;
+}
+
+
+YWidget * YWebUI::createPushButton ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label )
+{
+ return new YWebPushButton( (WContainerWidget *) ( parent->widgetRep()), opt, label);
+}
+
+YWidget * YWebUI::createMenuButton ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label )
+{
+ return 0;
+// return new YQMenuButton( (QWidget *) ( parent->widgetRep() ), opt, label);
+}
+
+YWidget * YWebUI::createCheckBox ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ bool checked )
+{
+ return 0;
+// return new YQCheckBox( (QWidget *) ( parent->widgetRep() ), opt, label, checked);
+}
+
+YWidget * YWebUI::createRadioButton ( YWidget * parent,
+ YWidgetOpt & opt,
+ YRadioButtonGroup * rbg,
+ const YCPString & label,
+ bool checked)
+{
+ return 0;
+// return new YQRadioButton( (QWidget *) ( parent->widgetRep() ), opt, rbg, label, checked);
+}
+
+YContainerWidget * YWebUI::createRadioButtonGroup( YWidget * parent,
+ YWidgetOpt & opt )
+{
+ return 0;
+// return new YQRadioButtonGroup( (QWidget *) ( parent->widgetRep() ), opt );
+}
+
+YWidget * YWebUI::createTextEntry ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPString & text )
+{
+ return 0;
+// return new YQTextEntry( (QWidget *) ( parent->widgetRep() ), opt, label, text);
+}
+
+YWidget * YWebUI::createMultiLineEdit ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPString & initialText )
+{
+ return 0;
+// return new YQMultiLineEdit( (QWidget *) ( parent->widgetRep() ), opt, label, initialText);
+}
+
+YWidget * YWebUI::createSelectionBox ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label )
+{
+ return 0;
+// return new YQSelectionBox( (QWidget *) ( parent->widgetRep() ), opt, label);
+}
+
+YWidget * YWebUI::createMultiSelectionBox( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label )
+{
+ return 0;
+// return new YQMultiSelectionBox( (QWidget *) ( parent->widgetRep() ), opt, label);
+}
+
+YWidget * YWebUI::createComboBox ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label )
+{
+ return 0;
+// return new YQComboBox( (QWidget *) ( parent->widgetRep() ), opt, label);
+}
+
+YWidget * YWebUI::createTree ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label )
+{
+ return 0;
+// return new YQTree( (QWidget *) ( parent->widgetRep() ), opt, label);
+}
+
+YWidget * YWebUI::createTable ( YWidget * parent,
+ YWidgetOpt & opt,
+ vector<string> header )
+{
+ return 0;
+// return new YQTable( (QWidget *) ( parent->widgetRep() ), opt, header);
+}
+
+YWidget * YWebUI::createProgressBar ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPInteger & maxProgress,
+ const YCPInteger & progress )
+{
+ return 0;
+// return new YQProgressBar( (QWidget *) ( parent->widgetRep() ), opt, label, maxProgress, progress );
+}
+
+
+YWidget * YWebUI::createImage ( YWidget * parent,
+ YWidgetOpt & opt,
+ YCPByteblock imagedata,
+ YCPString default_text )
+{
+ return 0;
+// return new YQImage( (QWidget *) ( parent->widgetRep() ), opt, imagedata );
+}
+
+YWidget * YWebUI::createImage ( YWidget * parent,
+ YWidgetOpt & opt,
+ YCPString file_name,
+ YCPString default_text )
+{
+ return 0;
+// return new YQImage( (QWidget *) ( parent->widgetRep() ), opt, file_name );
+}
+
+
+YWidget * YWebUI::createIntField ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ int minValue,
+ int maxValue,
+ int initialValue )
+{
+ return 0;
+// return new YQIntField( (QWidget *) ( parent->widgetRep() ),
+// opt,
+// label,
+// minValue,
+// maxValue,
+// initialValue );
+}
+
+
+
+//========= Optional widgets ========================================================
+
+
+bool YWebUI::hasBarGraph()
+{
+ return true;
+}
+
+YWidget * YWebUI::createBarGraph( YWidget * parent, YWidgetOpt & opt)
+{
+ return 0;
+// return new YQBarGraph( (QWidget *) ( parent->widgetRep() ), opt );
+}
+
+
+bool YWebUI::hasColoredLabel()
+{
+ return true;
+}
+
+YWidget * YWebUI::createColoredLabel ( YWidget * parent,
+ YWidgetOpt & opt,
+ YCPString label,
+ YColor foreground,
+ YColor background,
+ int margin )
+{
+// return new YQColoredLabel( (QWidget *) ( parent->widgetRep() ), opt,
+// label, foreground, background, margin );
+ return 0;
+}
+
+
+bool YWebUI::hasDownloadProgress()
+{
+ return true;
+}
+
+YWidget * YWebUI::createDownloadProgress ( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ const YCPString & filename,
+ int expectedSize)
+{
+ return 0;
+// return new YQDownloadProgress( (QWidget *) ( parent->widgetRep() ),
+// opt,
+// label,
+// filename,
+// expectedSize );
+}
+
+
+bool YWebUI::hasDumbTab()
+{
+ return true;
+}
+
+YWidget * YWebUI::createDumbTab ( YWidget * parent,
+ YWidgetOpt & opt )
+{
+ return 0;
+// return new YQDumbTab( (QWidget *) ( parent->widgetRep() ), opt );
+}
+
+
+bool YWebUI::hasMultiProgressMeter()
+{
+ return true;
+}
+
+
+YWidget * YWebUI::createMultiProgressMeter( YWidget * parent,
+ YWidgetOpt & opt,
+ bool horizontal,
+ const YCPList & maxValues )
+{
+ return 0;
+// return new YQMultiProgressMeter( (QWidget *) ( parent->widgetRep() ),
+// opt,
+// horizontal,
+// maxValues );
+}
+
+
+bool YWebUI::hasSlider()
+{
+ return true;
+}
+
+
+YWidget * YWebUI::createSlider( YWidget * parent,
+ YWidgetOpt & opt,
+ const YCPString & label,
+ int minValue,
+ int maxValue,
+ int initialValue )
+{
+ return 0;
+// return new YQSlider( (QWidget *) ( parent->widgetRep() ),
+// opt,
+// label,
+// minValue,
+// maxValue,
+// initialValue );
+}
+
+
+bool YWebUI::hasPartitionSplitter()
+{
+ return true;
+}
+
+YWidget * YWebUI::createPartitionSplitter( YWidget * parent,
+ YWidgetOpt & opt,
+ int usedSize,
+ int totalFreeSize,
+ int newPartSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const YCPString & usedLabel,
+ const YCPString & freeLabel,
+ const YCPString & newPartLabel,
+ const YCPString & freeFieldLabel,
+ const YCPString & newPartFieldLabel )
+{
+ return 0;
+// return new YQPartitionSplitter( (QWidget *) ( parent->widgetRep() ),
+// opt,
+// usedSize,
+// totalFreeSize,
+// newPartSize,
+// minNewPartSize,
+// minFreeSize,
+// usedLabel,
+// freeLabel,
+// newPartLabel,
+// freeFieldLabel,
+// newPartFieldLabel );
+}
+
+
+
+bool YWebUI::hasPatternSelector()
+{
+ return true;
+}
+
+
+YWidget * YWebUI::createPatternSelector( YWidget * parent,
+ YWidgetOpt & opt )
+{
+ return 0;
+#if 0
+ YWidget * patternSelector = 0;
+ YQPackageSelectorPlugin * plugin = packageSelectorPlugin();
+
+ if ( plugin )
+ {
+ patternSelector = plugin->createPatternSelector( parent, opt );
+ }
+
+ return patternSelector;
+#endif
+}
+
+
+bool YWebUI::hasSimplePatchSelector()
+{
+ return true;
+}
+
+
+YWidget * YWebUI::createSimplePatchSelector( YWidget * parent,
+ YWidgetOpt & opt )
+{
+ return 0;
+#if 0
+ YWidget * simplePatchSelector = 0;
+ YQPackageSelectorPlugin * plugin = packageSelectorPlugin();
+
+ if ( plugin )
+ {
+ simplePatchSelector = plugin->createSimplePatchSelector( parent, opt );
+ }
+
+ return simplePatchSelector;
+#endif
+}
+
+
+
+bool YWebUI::hasWizard()
+{
+ return true;
+}
+
+
+YWidget * YWebUI::createWizard( YWidget *parent, YWidgetOpt & opt,
+ const YCPValue & backButtonId, const YCPString & backButtonLabel,
+ const YCPValue & abortButtonId, const YCPString & abortButtonLabel,
+ const YCPValue & nextButtonId, const YCPString & nextButtonLabel )
+{
+ return 0;
+// return new YQWizard( (QWidget *) ( parent->widgetRep() ), opt,
+// backButtonId, backButtonLabel,
+// abortButtonId, abortButtonLabel,
+// nextButtonId, nextButtonLabel );
+}
+
+
+// EOF
Added: branches/research/web-wt/src/YWebWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebWidget.cc?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebWidget.cc (added)
+++ branches/research/web-wt/src/YWebWidget.cc Thu Aug 30 13:16:48 2007
@@ -0,0 +1,38 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebWidget.cc
+
+ Author: Stanislav Visnovsky
+
+/-*/
+
+#include "YWebWidget.h"
+
+#include
+
+YWebWidget::~YWebWidget()
+{}
+
+void YWebWidget::publish()
+{}
+
+void YWebWidget::moveTo( Wt::WTableCell* parent )
+{
+ y2milestone ("Hit abstract moveTo method");
+}
+
+void YWebWidget::resize( long width, long height )
+{
+ y2milestone ("Hit abstract setSize method");
+}
+
Added: branches/research/web-wt/src/YWebWidget.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/src/YWebWidget.h?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/src/YWebWidget.h (added)
+++ branches/research/web-wt/src/YWebWidget.h Thu Aug 30 13:16:48 2007
@@ -0,0 +1,43 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebWidget.h
+
+ Author: Stanislav Visnovsky
+
+/-*/
+
+// -*- c++ -*-
+
+#ifndef YWebWidget_h
+#define YWebWidget_h
+
+#include <WTableCell>
+
+class YWebWidget
+{
+
+public:
+ /**
+ * Destructor.
+ **/
+ virtual ~YWebWidget();
+
+ virtual void publish();
+
+ virtual void moveTo( Wt::WTableCell* parent );
+
+ virtual void resize( long width, long height );
+
+};
+
+#endif // YWebWidget_h
Added: branches/research/web-wt/yast2-web.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/research/web-wt/yast2-web.spec.in?rev=40615&view=auto
==============================================================================
--- branches/research/web-wt/yast2-web.spec.in (added)
+++ branches/research/web-wt/yast2-web.spec.in Thu Aug 30 13:16:48 2007
@@ -0,0 +1,52 @@
+@HEADER-COMMENT@
+
+
+@HEADER@
+BuildRequires: dbus-1-devel boost-devel libzypp-devel curl-devel docbook-xsl-stylesheets doxygen libdrm-devel libjpeg-devel libxcrypt-devel libxslt perl-XML-Writer qt3-devel rpm-devel sgml-skel update-desktop-files yast2-devtools yast2-core-devel hal-devel
+
+Summary: -
+BuildRequires: yast2-core-devel >= 2.15.6
+Requires: libzypp >= 2.13.0
+Provides: yast2_ui
+Provides: y2base:/var/lib/YaST2/servers/qt
+Provides: y2base:/usr/lib/YaST2/servers/qt
+Provides: y2base:/usr/lib/YaST2/plugin/libpy2qt.so.2
+Provides: yast2-ui-qt yast2-ui-qt-devel
+Obsoletes: yast2-ui-qt yast2-ui-qt-devel
+Provides: y2qt
+Obsoletes: y2qt
+
+%description
+-
+
+@PREP@
+
+@BUILD-QT@
+
+@INSTALL@
+rm -f $RPM_BUILD_ROOT/@plugindir@/libpy2qt.la
+rm -f $RPM_BUILD_ROOT/@plugindir@/libpy2qt_pkg.la
+
+
+@CLEAN@
+
+%if 0%{?suse_version} <= 1010
+%define _xorg7fonts /usr/X11R6/lib/X11/fonts
+%else
+%define _xorg7fonts /usr/share/fonts
+%endif
+
+%files
+%defattr (-, root, root)
+@plugindir@/libpy2qt.so.*
+@plugindir@/libpy2qt.so
+@plugindir@/libpy2qt_pkg.so.*
+@plugindir@/libpy2qt_pkg.so
+@imagedir@
+%dir %{_xorg7fonts}/uni
+%verify(not md5 size mtime) %{_xorg7fonts}/uni/fonts.dir
+%{_xorg7fonts}/uni/newunifont.pcf.gz
+%{_xorg7fonts}/uni/unifont.pcf.gz
+%dir @ydatadir@
+@ydatadir@/lang_fonts
+%doc @docdir@
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org