Author: visnov
Date: Thu Nov 8 09:04:13 2007
New Revision: 41872
URL: http://svn.opensuse.org/viewcvs/yast?rev=41872&view=rev
Log:
compiles, does not work, just a skeleton
Added:
branches/tmp/sh/mod-ui/web-wt/src/YWebOptionalWidgetFactory.h
branches/tmp/sh/mod-ui/web-wt/src/YWebWidgetFactory.cc
branches/tmp/sh/mod-ui/web-wt/src/YWebWidgetFactory.h
Removed:
branches/tmp/sh/mod-ui/web-wt/src/YWebDialog.cc
branches/tmp/sh/mod-ui/web-wt/src/YWebDialog.h
branches/tmp/sh/mod-ui/web-wt/src/YWebLabel.cc
branches/tmp/sh/mod-ui/web-wt/src/YWebLabel.h
branches/tmp/sh/mod-ui/web-wt/src/YWebPushButton.cc
branches/tmp/sh/mod-ui/web-wt/src/YWebPushButton.h
branches/tmp/sh/mod-ui/web-wt/src/YWebSplit.cc
branches/tmp/sh/mod-ui/web-wt/src/YWebSplit.h
branches/tmp/sh/mod-ui/web-wt/src/YWebWidget.cc
branches/tmp/sh/mod-ui/web-wt/src/YWebWidget.h
Modified:
branches/tmp/sh/mod-ui/web-wt/src/YWebUI.h
branches/tmp/sh/mod-ui/web-wt/src/YWebUIComponent.h
branches/tmp/sh/mod-ui/web-wt/src/YWebUI_builtins.cc
branches/tmp/sh/mod-ui/web-wt/src/YWebUI_core.cc
branches/tmp/sh/mod-ui/web-wt/src/YWebUI_widgets.cc
Added: branches/tmp/sh/mod-ui/web-wt/src/YWebOptionalWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/web-wt/src/YWebOptionalWidgetFactory.h?rev=41872&view=auto
==============================================================================
--- branches/tmp/sh/mod-ui/web-wt/src/YWebOptionalWidgetFactory.h (added)
+++ branches/tmp/sh/mod-ui/web-wt/src/YWebOptionalWidgetFactory.h Thu Nov 8 09:04:13 2007
@@ -0,0 +1,135 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebOptionalWidgetFactory.h
+
+ Author: Stanislav Visnovsky
+
+/-*/
+
+#ifndef YWebOptionalWidgetFactory_h
+#define YWebOptionalWidgetFactory_h
+
+#include <string>
+#include <vector>
+
+#include
+
+using std::string;
+using std::vector;
+
+class YBarGraph;
+class YDateField;
+class YDownloadProgress;
+class YDumbTab;
+class YDummySpecialWidget;
+class YMultiProgressMeter;
+class YPartitionSplitter;
+class YSlider;
+class YTimeField;
+class YWidget;
+class YWizard;
+
+
+/**
+ * Abstract widget factory for optional ("special") widgets.
+ *
+ * Remember to always check with the corresponding "has..()" method if the
+ * current UI actually provides the requested widget. Otherwise the
+ * "create...()" method will throw an exception.
+ **/
+class YWebOptionalWidgetFactory: public YOptionalWidgetFactory
+{
+public:
+
+ //
+ // Optional Widgets
+ //
+
+ virtual bool hasWizard();
+ 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 );
+
+ virtual bool hasSlider();
+ virtual YSlider * createSlider ( YWidget * parent,
+ const string & label,
+ int minVal,
+ int maxVal,
+ int initialVal );
+
+ virtual bool hasDateField();
+ virtual YDateField * createDateField ( YWidget * parent, const string & label );
+
+ virtual bool hasTimeField();
+ virtual YTimeField * createTimeField ( YWidget * parent, const string & label );
+
+ virtual bool hasBarGraph();
+ virtual YBarGraph * createBarGraph ( YWidget * parent, const vector<int> & values, const vector<string> & labels );
+
+ virtual bool hasPatternSelector();
+ virtual YWidget * createPatternSelector ( YWidget * parent, long modeFlags = 0 );
+
+ virtual bool hasSimplePatchSelector();
+ virtual YWidget * createSimplePatchSelector( YWidget * parent, long modeFlags = 0 );
+
+ virtual bool hasMultiProgressMeter();
+ YMultiProgressMeter * createHMultiProgressMeter( YWidget * parent, const vector<float> & maxValues );
+ YMultiProgressMeter * createVMultiProgressMeter( YWidget * parent, const vector<float> & maxValues );
+ virtual YMultiProgressMeter * createMultiProgressMeter ( YWidget * parent, YUIDimension dim, const vector<float> & maxValues );
+
+ virtual bool hasPartitionSplitter();
+ virtual YPartitionSplitter * createPartitionSplitter ( YWidget * parent );
+
+ virtual bool hasDownloadProgress();
+ virtual YDownloadProgress * createDownloadProgress ( YWidget * parent,
+ const string & label,
+ const string & filename,
+ long expectedFileSize );
+
+ bool hasDummySpecialWidget();
+ YWidget * createDummySpecialWidget( YWidget * parent );
+
+
+
+protected:
+
+ friend class YWebUI;
+
+ /**
+ * Constructor.
+ *
+ * Use YUI::optionalWidgetFactory() to get the singleton for this class.
+ **/
+ YWebOptionalWidgetFactory();
+
+ /**
+ * Destructor.
+ **/
+ virtual ~YWebOptionalWidgetFactory();
+
+}; // class YWebOptionalWidgetFactory
+
+
+
+#endif // YOptionalWidgetFactory_h
Modified: branches/tmp/sh/mod-ui/web-wt/src/YWebUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/web-wt/src/YWebUI.h?rev=41872&r1=41871&r2=41872&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/web-wt/src/YWebUI.h (original)
+++ branches/tmp/sh/mod-ui/web-wt/src/YWebUI.h Thu Nov 8 09:04:13 2007
@@ -12,45 +12,40 @@
File: YWebUI.h
- Authors: Mathias Kettner ,
- Stefan Hundhammer
-
- Maintainer: Stefan Hundhammer
+ Author: Stefan Hundhammer
+ Stanislav Visnovsky
/-*/
#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;
+class YWebOptionalWidgetFactory;
+class YWebWidgetFactory;
using std::string;
using std::vector;
-class YWebUI: public Wt::WApplication, public YUI
+
+class YWebUI: public YUI
{
public:
/**
* Constructor.
- */
- YWebUI( const Wt::WEnvironment& env,
+ **/
+ YWebUI( int argc,
+ char ** argv,
bool with_threads,
const char * macro_file );
/**
* Destructor.
- */
+ **/
~YWebUI();
/**
@@ -58,6 +53,34 @@
**/
static YWebUI * ui() { return _ui; }
+
+protected:
+ /**
+ * Create the widget factory that provides all the createXY() methods for
+ * standard (mandatory, i.e. non-optional) widgets.
+ *
+ * Reimplemented from YUI.
+ **/
+ virtual YWidgetFactory * createWidgetFactory();
+
+ /**
+ * Create the widget factory that provides all the createXY() methods for
+ * optional ("special") widgets and the corresponding hasXYWidget()
+ * methods.
+ *
+ * Reimplemented from YUI.
+ **/
+ virtual YOptionalWidgetFactory * createOptionalWidgetFactory();
+
+ /*
+ * Create the YApplication object that provides global methods.
+ *
+ * Reimplemented from YUI.
+ **/
+ virtual YApplication * createApplication();
+
+public:
+
/**
* Widget event handlers (slots) call this when an event occured that
* should be the answer to a UserInput() / PollInput() (etc.) call.
@@ -83,24 +106,6 @@
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.
**/
@@ -114,46 +119,20 @@
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.
+ * UI-specific runPkgSeleciton method: Start the package selection.
+ * This implementation does the same as UserInput().
*
* Reimplemented from YUI.
- */
- void internalError( const char * msg );
-
-
- /**
- * Block WM_CLOSE events for the main window.
**/
- void blockWmClose() { _wm_close_blocked = true; }
+ YCPValue runPkgSelection( YWidget * packageSelector );
/**
- * Unblock WM_CLOSE events for the main window.
+ * Issue an internal error: Open popup with that message and wait.
+ *
+ * Reimplemented from YUI.
**/
- void unblockWmClose() { _wm_close_blocked = false; }
+ void internalError( const char * msg );
- /**
- * 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
@@ -172,58 +151,6 @@
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:
/**
@@ -231,7 +158,7 @@
* This is only used when a separate ui thread is running.
*
* Reimplemented from YUI.
- */
+ **/
void idleLoop( int fd_ycp );
/**
@@ -239,106 +166,50 @@
* 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,
@@ -350,12 +221,6 @@
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,
@@ -378,21 +243,6 @@
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 ***/
@@ -456,71 +306,57 @@
* 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() ;
+ string askForSaveFileName( const string & startWith,
+ const string & filter,
+ const string & headline );
-protected:
+ /**
+ * Convert logical layout spacing units into device dependent units.
+ * A default size dialog is assumed to be 80x25 layout spacing units
+ * and 640x480 device dependent spacing units.
+ *
+ * Reimplemented from YUI.
+ **/
+ virtual int deviceUnits( YUIDimension dim, float layout_units );
/**
- * Sets the X input method according to the locale.
- * [Reimplemented from YUI]
- */
- YCPValue setLanguage( const YCPTerm & term );
+ * Convert device dependent units into logical layout spacing units.
+ * A default size dialog is assumed to be 80x25 layout spacing units
+ * and 640x480 device dependent spacing units.
+ *
+ * Reimplemented from YUI.
+ **/
+ virtual float layoutUnits( YUIDimension dim, int device_units );
+
+protected:
/**
* Display capabilities.
* [Reimplemented from YUI]
* See UI builtin GetDisplayInfo() doc for details.
**/
+ int getDisplayWidth();
+ int getDisplayHeight();
+ int getDisplayDepth();
+ long getDisplayColors();
+ int getDefaultWidth();
+ int getDefaultHeight();
bool textMode() { return false; }
bool hasImageSupport() { return true; }
- bool hasLocalImageSupport() { return true; }
+ bool hasLocalImageSupport() { return false; }
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:
/**
@@ -528,44 +364,21 @@
**/
void processCommandLineArgs( int argc, char **argv );
-
- //
- // Data members
- //
-
/**
- * Assume presence of a window manager
- */
- bool _have_wm;
-
- /**
- * Use the entire available screen
+ * Calculate size of `opt(`defaultsize) dialogs
**/
- bool _fullscreen;
+ void calcDefaultSize();
- /**
- * 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;
+ //
+ // Data members
+ //
/**
* Stack to keep track of the stacking order of popup dialogs.
**/
- vector _popup_stack;
-#endif
+ // FIXME: vector _popup_stack;
+
/**
* Numeric ID for defaultsize dialogs for the widget stack
**/
@@ -575,26 +388,16 @@
* 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;
+ bool _do_exit_loop;
- /**
- * 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
@@ -611,13 +414,6 @@
**/
YSimpleEventHandler _event_handler;
- pthread_t webserver_thread;
-
- Wt::WTimer* _timer;
-
- YWebDialog* _pending_dialog;
-
- Wt::WTable* _layout;
};
Modified: branches/tmp/sh/mod-ui/web-wt/src/YWebUIComponent.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/web-wt/src/YWebUIComponent.h?rev=41872&r1=41871&r2=41872&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/web-wt/src/YWebUIComponent.h (original)
+++ branches/tmp/sh/mod-ui/web-wt/src/YWebUIComponent.h Thu Nov 8 09:04:13 2007
@@ -10,23 +10,19 @@
| (C) SuSE GmbH |
\----------------------------------------------------------------------/
- File: YWebUIComponent.h
+ File: YQUIComponent.h
- Authors: Stefan Hundhammer
-
- Maintainer: Stefan Hundhammer
+ Author: Stefan Hundhammer
+ Stanislav Visnovsky
/-*/
#ifndef YWebUIComponent_h
#define YWebUIComponent_h
-#include
-
#include
#include "YWebUI.h"
-extern void *start_webserver_thread( void * yui );
class YWebUIComponent : public YUIComponent
{
@@ -35,39 +31,20 @@
YWebUIComponent(): YUIComponent() {}
/**
- * Create a web UI. This is called from within setServerOptions().
+ * 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 );
+ return new YWebUI( argc, argv, with_threads, macro_file );
}
/**
* Returns the name of this YaST2 component.
*
* Reimplemented from YUIComponent.
- */
+ **/
virtual string name() const { return "web"; }
};
Modified: branches/tmp/sh/mod-ui/web-wt/src/YWebUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/web-wt/src/YWebUI_builtins.cc?rev=41872&r1=41871&r2=41872&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/web-wt/src/YWebUI_builtins.cc (original)
+++ branches/tmp/sh/mod-ui/web-wt/src/YWebUI_builtins.cc Thu Nov 8 09:04:13 2007
@@ -10,12 +10,10 @@
| (C) SuSE GmbH |
\----------------------------------------------------------------------/
- File: YUIQt_builtins.cc
+ File: YWebUI_builtins.cc
Author: Stefan Hundhammer
- Maintainer: Stefan Hundhammer
-
- Textdomain "packages-qt"
+ Stanislav Visnovsky
/-*/
@@ -26,189 +24,84 @@
#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( "" );
-}
+ string sym = glyphSymbol->symbol();
+
+ return YCPString( sym );
+
+ // FIXME:
+#if 0
+ QChar unicodeChar;
+ // Hint: Use 'xfd' to view characters available in the Unicode font.
-void YWebUI::askSaveLogs()
-{
-#if 0
- std::string fileName = askForSaveFileName( "/tmp/y2logs.tgz", // startWith
- "*.tgz *.tar.gz", // filter
- "Save y2logs to..." ); // headline
+ if ( sym == YUIGlyph_ArrowLeft ) unicodeChar = QChar( 0x2190 );
+ else if ( sym == YUIGlyph_ArrowRight ) unicodeChar = QChar( 0x2192 );
+ else if ( sym == YUIGlyph_ArrowUp ) unicodeChar = QChar( 0x2191 );
+ else if ( sym == YUIGlyph_ArrowDown ) unicodeChar = QChar( 0x2193 );
+ else if ( sym == YUIGlyph_CheckMark ) unicodeChar = QChar( 0x2714 );
+ else if ( sym == YUIGlyph_BulletArrowRight ) unicodeChar = QChar( 0x279c );
+ else if ( sym == YUIGlyph_BulletCircle ) unicodeChar = QChar( 0x274d );
+ else if ( sym == YUIGlyph_BulletSquare ) unicodeChar = QChar( 0x274f );
+ else return YCPString( "" );
- if ( ! fileName.isEmpty() )
- {
- std::string saveLogsCommand = "/sbin/save_y2logs";
+ QString qstr( unicodeChar );
- 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
- }
- }
+ return YCPString( toUTF8( qstr ) );
#endif
}
-void YWebUI::askConfigureLogging()
+YCPValue YWebUI::runPkgSelection( YWidget * packageSelector )
{
+
+ y2milestone( "Running package selection..." );
+ return YCPVoid();
#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
+ _wm_close_blocked = true;
+ _auto_activate_dialogs = false;
- if ( okButtonPressed )
+ YCPValue input = YCPVoid();
+
+ try
{
- set_log_debug( result.endsWith( "on" ) );
- y2milestone( "Changing logging: %s - %s", (const char *) result,
- get_log_debug() ? "y2debug on" : "y2debug off" );
+ input = evaluateUserInput();
}
-#endif
-}
-
-
-void YWebUI::toggleRecordMacro()
-{
-#if 0
- if ( recordingMacro() )
+ catch (const std::exception & e)
{
- 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
+ y2error( "Caught std::exception: %s", e.what() );
+ y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
}
- else
+ catch (...)
{
- 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 );
- }
+ y2error( "Caught unspecified exception." );
+ y2error( "This is a libzypp problem. Do not file a bug against the UI!" );
}
-#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 );
+ _auto_activate_dialogs = true;
+ _wm_close_blocked = false;
+ y2milestone( "Package selection done - returning %s", input->toString().c_str() );
- // 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();
- }
- }
+ return input;
#endif
}
-
YCPValue YWebUI::askForExistingDirectory( const YCPString & startDir,
const YCPString & headline )
{
return YCPVoid();
+
#if 0
normalCursor();
- std::string dir_name =
+ QString dir_name =
QFileDialog::getExistingDirectory( fromUTF8( startDir->value() ),
_main_win, // parent
"dir_selector", // name
@@ -227,11 +120,11 @@
const YCPString & filter,
const YCPString & headline )
{
- return YCPVoid();
+ return YCPVoid ();
#if 0
normalCursor();
- std::string file_name =
+ QString file_name =
QFileDialog::getOpenFileName( fromUTF8( startWith->value() ),
fromUTF8( filter->value() ),
_main_win, // parent
@@ -255,84 +148,19 @@
#if 0
normalCursor();
- std::string file_name = askForSaveFileName( fromUTF8( startWith->value() ),
+ QString file_name = askForSaveFileName( fromUTF8( startWith->value() ),
fromUTF8( filter->value() ),
fromUTF8( headline->value() ) );
busyCursor();
- if ( file_name.empty() ) // this includes file_name.isNull()
+ if ( file_name.isEmpty() ) // 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 );
+ return YCPString( toUTF8( file_name ) );
#endif
- return file_name;
}
-void YWebUI::beep()
-{
-}
-void YWebUI::busyCursor()
-{
-}
-
-void YWebUI::normalCursor()
-{
-}
// EOF
Modified: branches/tmp/sh/mod-ui/web-wt/src/YWebUI_core.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/web-wt/src/YWebUI_core.cc?rev=41872&r1=41871&r2=41872&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/web-wt/src/YWebUI_core.cc (original)
+++ branches/tmp/sh/mod-ui/web-wt/src/YWebUI_core.cc Thu Nov 8 09:04:13 2007
@@ -12,96 +12,39 @@
File: YWebUI_core.cc
- Authors: Mathias Kettner
- Stefan Hundhammer
-
- Maintainer: Stefan Hundhammer
+ Author: Stefan Hundhammer
+ Stanislav Visnovsky
/-*/
#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
#include "YWebUI.h"
+#include "YWebWidgetFactory.h"
+#include "YWebOptionalWidgetFactory.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;
+YWebUI * YWebUI::_ui = 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 )
+YWebUI::YWebUI( int argc, char **argv, bool with_threads, const char * macro_file )
+ : YUI( with_threads )
, _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
+ processCommandLineArgs( argc, argv );
topmostConstructorHasFinished();
}
@@ -109,41 +52,14 @@
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];
+ 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();
- }
}
}
}
@@ -152,75 +68,60 @@
YWebUI::~YWebUI()
{
- y2debug("Closing down Qt UI.");
+ y2debug("Closing down Web UI.");
+}
+
- normalCursor();
- // Intentionally NOT calling dlclose() to libqt-mt
- // (see constructor for explanation)
+YWidgetFactory *
+YWebUI::createWidgetFactory()
+{
+ YWebWidgetFactory * factory = new YWebWidgetFactory();
+ YUI_CHECK_NEW( factory );
+
+ return factory;
}
+YOptionalWidgetFactory *
+YWebUI::createOptionalWidgetFactory()
+{
+ YWebOptionalWidgetFactory * factory = new YWebOptionalWidgetFactory();
+ YUI_CHECK_NEW( factory );
-void YWebUI::internalError( const char * msg )
+ return factory;
+}
+
+
+YApplication *
+YWebUI::createApplication()
{
- normalCursor();
+// YApplication * app = new YApplication();
+// YUI_CHECK_NEW( app );
+// FIXME
+ return 0L;
+}
- Wt::WMessageBox::show( "YaST2 Internal Error", msg, 1); // 1 = OK button
+
+void YWebUI::internalError( const char * msg )
+{
+ raiseFatalError();
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();
-
- }
-
+ // FIXME
+ _leave_idle_loop = true;
}
void YWebUI::leaveIdleLoop( int )
{
+ // FIXME
_leave_idle_loop = true;
}
@@ -230,35 +131,55 @@
if ( event )
{
_event_handler.sendEvent( event );
+
+ if ( _do_exit_loop ) {
+ // FIXME:
+ }
}
}
YEvent * YWebUI::userInput( unsigned long timeout_millisec )
{
- y2milestone( "userInput");
YEvent * event = 0;
-// YWebDialog * dialog = dynamic_cast ( currentDialog() );
+#if 0
+ YQDialog * dialog = dynamic_cast ( YDialog::currentDialog( false ) );
+ if ( _user_input_timer.isActive() )
+ _user_input_timer.stop();
-// if ( dialog )
+ if ( dialog )
{
-// dialog->activate( true );
+ if ( timeout_millisec > 0 )
+ _user_input_timer.start( timeout_millisec, true ); // single shot
+
+ dialog->activate( true );
-// normalCursor();
-// _do_exit_loop = true; // should exit_loop() be called in sendEvent()?
+ if ( qApp->focusWidget() )
+ qApp->focusWidget()->setFocus();
+
+ normalCursor();
+ _do_exit_loop = true; // should exit_loop() be called in sendEvent()?
- // FIXME: HACK HACK
while ( ! pendingEvent() )
{
- sleep (1);
+ qApp->enter_loop();
}
-// _do_exit_loop = false;
+ _do_exit_loop = false;
event = _event_handler.consumePendingEvent();
-// dialog->activate( false );
+ dialog->activate( false );
+
+ // Display a busy cursor, but only if there is no other activity within
+ // BUSY_CURSOR_TIMEOUT milliseconds (avoid cursor flicker)
+ _busy_cursor_timer.start( BUSY_CURSOR_TIMEOUT, true ); // single shot
}
+
+ if ( _user_input_timer.isActive() )
+ _user_input_timer.stop();
+
+#endif
return event;
}
@@ -266,14 +187,14 @@
YEvent * YWebUI::pollInput()
{
YEvent * event = 0;
-#if 0
+#if 0
if ( _user_input_timer.isActive() )
_user_input_timer.stop();
if ( ! pendingEvent() )
{
- YWebDialog * dialog = dynamic_cast ( currentDialog() );
+ YQDialog * dialog = dynamic_cast ( YDialog::currentDialog( false ) );
if ( dialog )
{
@@ -287,230 +208,29 @@
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;
+ // FIXME
+ return 0L;
}
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;
+ // FIXME
+ // event loop in Qt is here
}
-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()
+void YWebUI::closeDialog( YDialog * dialog )
{
- 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");
+ // FIXME
}
-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;
- }
-}
Modified: branches/tmp/sh/mod-ui/web-wt/src/YWebUI_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/web-wt/src/YWebUI_widgets.cc?rev=41872&r1=41871&r2=41872&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/web-wt/src/YWebUI_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/web-wt/src/YWebUI_widgets.cc Thu Nov 8 09:04:13 2007
@@ -10,10 +10,10 @@
| (C) SuSE GmbH |
\----------------------------------------------------------------------/
- File: YUIWeb_widgets.cc
+ File: YWebUI_widgets.cc
Author: Stefan Hundhammer
- Maintainer: Stefan Hundhammer
+ Stanislav Visnovsky
/-*/
@@ -22,372 +22,24 @@
#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;
+ return false;
}
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;
+ return 0L; //new YQBarGraph( (QWidget *) ( parent->widgetRep() ), opt );
}
bool YWebUI::hasDownloadProgress()
{
- return true;
+ return false;
}
YWidget * YWebUI::createDownloadProgress ( YWidget * parent,
@@ -396,50 +48,29 @@
const YCPString & filename,
int expectedSize)
{
- return 0;
-// return new YQDownloadProgress( (QWidget *) ( parent->widgetRep() ),
-// opt,
-// label,
-// filename,
-// expectedSize );
+ return 0L; //new YQDownloadProgress( (QWidget *) ( parent->widgetRep() ),
+ // opt,
+ // label,
+ // filename,
+ // expectedSize );
}
bool YWebUI::hasDumbTab()
{
- return true;
+ return false;
}
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 );
+ return 0L; //new YQDumbTab( (QWidget *) ( parent->widgetRep() ), opt );
}
bool YWebUI::hasSlider()
{
- return true;
+ return false;
}
@@ -450,19 +81,18 @@
int maxValue,
int initialValue )
{
- return 0;
-// return new YQSlider( (QWidget *) ( parent->widgetRep() ),
-// opt,
-// label,
-// minValue,
-// maxValue,
-// initialValue );
+ return 0L; // new YQSlider( (QWidget *) ( parent->widgetRep() ),
+ // opt,
+ // label,
+ // minValue,
+ // maxValue,
+ // initialValue );
}
bool YWebUI::hasPartitionSplitter()
{
- return true;
+ return false;
}
YWidget * YWebUI::createPartitionSplitter( YWidget * parent,
@@ -478,89 +108,20 @@
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;
+ return 0L; //new YQPartitionSplitter( (QWidget *) ( parent->widgetRep() ),
+ // opt,
+ // usedSize,
+ // totalFreeSize,
+ // newPartSize,
+ // minNewPartSize,
+ // minFreeSize,
+ // usedLabel,
+ // freeLabel,
+ // newPartLabel,
+ // freeFieldLabel,
+ // newPartFieldLabel );
}
-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/tmp/sh/mod-ui/web-wt/src/YWebWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/web-wt/src/YWebWidgetFactory.cc?rev=41872&view=auto
==============================================================================
--- branches/tmp/sh/mod-ui/web-wt/src/YWebWidgetFactory.cc (added)
+++ branches/tmp/sh/mod-ui/web-wt/src/YWebWidgetFactory.cc Thu Nov 8 09:04:13 2007
@@ -0,0 +1,150 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebWidgetFactory.cc
+
+ Author: Stanislav Visnovsky
+
+/-*/
+
+#include "YWebWidgetFactory.h"
+
+#include <string>
+
+#include "YTypes.h"
+
+using std::string;
+
+class YWidget;
+class YAlignment;
+class YCheckBox;
+class YCheckBoxFrame;
+class YComboBox;
+class YDialog;
+class YEmpty;
+class YFrame;
+class YImage;
+class YInputField;
+class YIntField;
+class YLabel;
+class YLayoutBox;
+class YLogView;
+class YMenuButton;
+class YMultiLineEdit;
+class YMultiSelectionBox;
+class YPackageSelector;
+class YProgressBar;
+class YPushButton;
+class YRadioButton;
+class YRadioButtonGroup;
+class YReplacePoint;
+class YRichText;
+class YSelectionBox;
+class YSpacing;
+class YSquash;
+class YTable;
+class YTableHeader;
+class YTimeField;
+class YTree;
+
+
+
+/**
+ * Abstract widget factory for mandatory widgets.
+ * Use YOptionalWidgetFactory for optional ("special") widgets.
+ *
+ * Refer to the respective widget's documentation (in the header file) for
+ * documentation about the function parameters.
+ **/
+
+ //
+ // Dialogs
+ //
+
+ YDialog * YWebWidgetFactory::createMainDialog() {}
+ YDialog * YWebWidgetFactory::createPopupDialog() {}
+
+ //
+ // Layout Boxes
+ //
+
+ YLayoutBox * YWebWidgetFactory::createVBox ( YWidget * parent ){}
+ YLayoutBox * YWebWidgetFactory::createHBox ( YWidget * parent ){}
+ YLayoutBox * YWebWidgetFactory::createLayoutBox ( YWidget * parent, YUIDimension dimension ) {}
+
+ //
+ // Common Leaf Widgets
+ //
+
+ YPushButton * YWebWidgetFactory::createPushButton ( YWidget * parent, const string & label ) {}
+ YLabel * YWebWidgetFactory::createLabel ( YWidget * parent, const string & text, bool isHeading, bool isOutputField ) {}
+ YInputField * YWebWidgetFactory::createInputField ( YWidget * parent, const string & label, bool passwordMode ) {}
+ YCheckBox * YWebWidgetFactory::createCheckBox ( YWidget * parent, const string & label, bool isChecked ) {}
+ YRadioButton * YWebWidgetFactory::createRadioButton ( YWidget * parent, const string & label, bool isChecked ) {}
+ YComboBox * YWebWidgetFactory::createComboBox ( YWidget * parent, const string & label, bool editable ) {}
+ YSelectionBox * YWebWidgetFactory::createSelectionBox ( YWidget * parent, const string & label ) {}
+ YTree * YWebWidgetFactory::createTree ( YWidget * parent, const string & label ) {}
+ YTable * YWebWidgetFactory::createTable ( YWidget * parent, YTableHeader * header ) {}
+ YProgressBar * YWebWidgetFactory::createProgressBar ( YWidget * parent, const string & label, int maxValue ) {}
+ YRichText * YWebWidgetFactory::createRichText ( YWidget * parent, const string & text, bool plainTextMode ) {}
+
+ //
+ // Less Common Leaf Widgets
+ //
+
+ YIntField * YWebWidgetFactory::createIntField ( YWidget * parent, const string & label, int minVal, int maxVal, int initialVal ) {}
+
+ YMenuButton * YWebWidgetFactory::createMenuButton ( YWidget * parent, const string & label ) {}
+ YMultiLineEdit * YWebWidgetFactory::createMultiLineEdit ( YWidget * parent, const string & label ) {}
+ YImage * YWebWidgetFactory::createImage ( YWidget * parent, const string & imageFileName, bool animated ) {}
+ YLogView * YWebWidgetFactory::createLogView ( YWidget * parent, const string & label, int visibleLines, int storedLines ) {}
+ YMultiSelectionBox *YWebWidgetFactory::createMultiSelectionBox ( YWidget * parent, const string & label ) {}
+
+ YPackageSelector * YWebWidgetFactory::createPackageSelector( YWidget * parent, long ModeFlags ) {}
+ YWidget * YWebWidgetFactory::createPkgSpecial ( YWidget * parent, const string & subwidgetName ) {} // NCurses only
+
+ //
+ // Layout Helpers
+ //
+
+ YSpacing * YWebWidgetFactory::createSpacing ( YWidget * parent, YUIDimension dim, bool stretchable, YLayoutSize_t size ) {}
+ YEmpty * YWebWidgetFactory::createEmpty ( YWidget * parent ) {}
+
+ YSquash * YWebWidgetFactory::createSquash ( YWidget * parent, bool horSquash, bool vertSquash ) {}
+
+ //
+ // Visual Grouping
+ //
+
+ YFrame * YWebWidgetFactory::createFrame ( YWidget * parent, const string & label ) {}
+ YCheckBoxFrame * YWebWidgetFactory::createCheckBoxFrame ( YWidget * parent, const string & label, bool checked ) {}
+
+ //
+ // Logical Grouping
+ //
+
+ YRadioButtonGroup * YWebWidgetFactory::createRadioButtonGroup ( YWidget * parent ) {}
+ YReplacePoint * YWebWidgetFactory::createReplacePoint ( YWidget * parent ) {}
+
+
+ /**
+ * Constructor.
+ *
+ * Use YUI::widgetFactory() to get the singleton for this class.
+ **/
+ YWebWidgetFactory::YWebWidgetFactory(){}
+
+ /**
+ * Destructory.
+ **/
+ YWebWidgetFactory::~YWebWidgetFactory(){}
+
Added: branches/tmp/sh/mod-ui/web-wt/src/YWebWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/web-wt/src/YWebWidgetFactory.h?rev=41872&view=auto
==============================================================================
--- branches/tmp/sh/mod-ui/web-wt/src/YWebWidgetFactory.h (added)
+++ branches/tmp/sh/mod-ui/web-wt/src/YWebWidgetFactory.h Thu Nov 8 09:04:13 2007
@@ -0,0 +1,170 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YWebWidgetFactory.h
+
+ Author: Stefan Hundhammer
+ Stanislav Visnovsky
+
+/-*/
+
+#ifndef YWebWidgetFactory_h
+#define YWebWidgetFactory_h
+
+#include
+
+#include <string>
+
+#include "YTypes.h"
+
+using std::string;
+
+class YWidget;
+class YAlignment;
+class YCheckBox;
+class YCheckBoxFrame;
+class YComboBox;
+class YDialog;
+class YEmpty;
+class YFrame;
+class YImage;
+class YInputField;
+class YIntField;
+class YLabel;
+class YLayoutBox;
+class YLogView;
+class YMenuButton;
+class YMultiLineEdit;
+class YMultiSelectionBox;
+class YPackageSelector;
+class YProgressBar;
+class YPushButton;
+class YRadioButton;
+class YRadioButtonGroup;
+class YReplacePoint;
+class YRichText;
+class YSelectionBox;
+class YSpacing;
+class YSquash;
+class YTable;
+class YTableHeader;
+class YTimeField;
+class YTree;
+
+
+
+/**
+ * Abstract widget factory for mandatory widgets.
+ * Use YOptionalWidgetFactory for optional ("special") widgets.
+ *
+ * Refer to the respective widget's documentation (in the header file) for
+ * documentation about the function parameters.
+ **/
+class YWebWidgetFactory: public YWidgetFactory
+{
+public:
+
+ //
+ // Dialogs
+ //
+
+ virtual YDialog * createMainDialog() ;
+ virtual YDialog * createPopupDialog() ;
+
+ //
+ // Layout Boxes
+ //
+
+ YLayoutBox * createVBox ( YWidget * parent );
+ YLayoutBox * createHBox ( YWidget * parent );
+ virtual YLayoutBox * createLayoutBox ( YWidget * parent, YUIDimension dimension ) ;
+
+ virtual YAlignment * createAlignment ( YWidget * parent, YAlignmentType horAlignment, YAlignmentType vertAlignment ) ;
+ //
+ // Common Leaf Widgets
+ //
+
+ virtual YPushButton * createPushButton ( YWidget * parent, const string & label ) ;
+ virtual YLabel * createLabel ( YWidget * parent, const string & text, bool isHeading = false, bool isOutputField = false ) ;
+ virtual YInputField * createInputField ( YWidget * parent, const string & label, bool passwordMode = false ) ;
+ virtual YCheckBox * createCheckBox ( YWidget * parent, const string & label, bool isChecked = false ) ;
+ virtual YRadioButton * createRadioButton ( YWidget * parent, const string & label, bool isChecked = false ) ;
+ virtual YComboBox * createComboBox ( YWidget * parent, const string & label, bool editable = false ) ;
+ virtual YSelectionBox * createSelectionBox ( YWidget * parent, const string & label ) ;
+ virtual YTree * createTree ( YWidget * parent, const string & label ) ;
+ virtual YTable * createTable ( YWidget * parent, YTableHeader * header ) ;
+ virtual YProgressBar * createProgressBar ( YWidget * parent, const string & label, int maxValue = 100 ) ;
+ virtual YRichText * createRichText ( YWidget * parent, const string & text, bool plainTextMode = false ) ;
+
+ //
+ // Less Common Leaf Widgets
+ //
+
+ virtual YIntField * createIntField ( YWidget * parent, const string & label, int minVal, int maxVal, int initialVal ) ;
+
+ virtual YMenuButton * createMenuButton ( YWidget * parent, const string & label ) ;
+ virtual YMultiLineEdit * createMultiLineEdit ( YWidget * parent, const string & label ) ;
+ virtual YImage * createImage ( YWidget * parent, const string & imageFileName, bool animated = false ) ;
+ virtual YLogView * createLogView ( YWidget * parent, const string & label, int visibleLines, int storedLines = 0 ) ;
+ virtual YMultiSelectionBox *createMultiSelectionBox ( YWidget * parent, const string & label ) ;
+
+ virtual YPackageSelector * createPackageSelector ( YWidget * parent, long ModeFlags = 0 ) ;
+ virtual YWidget * createPkgSpecial ( YWidget * parent, const string & subwidgetName ) ; // NCurses only
+
+ //
+ // Layout Helpers
+ //
+
+ YSpacing * createHStretch ( YWidget * parent );
+ YSpacing * createVStretch ( YWidget * parent );
+ YSpacing * createHSpacing ( YWidget * parent, YLayoutSize_t size = 1.0 );
+ YSpacing * createVSpacing ( YWidget * parent, YLayoutSize_t size = 1.0 );
+ virtual YSpacing * createSpacing ( YWidget * parent, YUIDimension dim, bool stretchable = false, YLayoutSize_t size = 0.0 ) ;
+ virtual YEmpty * createEmpty ( YWidget * parent ) ;
+
+ virtual YSquash * createSquash ( YWidget * parent, bool horSquash, bool vertSquash ) ;
+
+ //
+ // Visual Grouping
+ //
+
+ virtual YFrame * createFrame ( YWidget * parent, const string & label ) ;
+ virtual YCheckBoxFrame * createCheckBoxFrame ( YWidget * parent, const string & label, bool checked ) ;
+
+ //
+ // Logical Grouping
+ //
+
+ virtual YRadioButtonGroup * createRadioButtonGroup ( YWidget * parent ) ;
+ virtual YReplacePoint * createReplacePoint ( YWidget * parent ) ;
+
+
+protected:
+
+ friend class YWebUI;
+
+ /**
+ * Constructor.
+ *
+ * Use YUI::widgetFactory() to get the singleton for this class.
+ **/
+ YWebWidgetFactory();
+
+ /**
+ * Destructory.
+ **/
+ virtual ~YWebWidgetFactory();
+
+}; // class YWebWidgetFactory
+
+
+#endif // YWebWidgetFactory_h
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org