Author: visnov
Date: Mon Nov 12 15:55:00 2007
New Revision: 41974
URL: http://svn.opensuse.org/viewcvs/yast?rev=41974&view=rev
Log:
- create a listen thread to create sessions
- YWebUI inherits WApplication now
- removed not implemented methods for now
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_core.cc
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=41974&r1=41973&r2=41974&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/web-wt/src/YWebUI.h (original)
+++ branches/tmp/sh/mod-ui/web-wt/src/YWebUI.h Mon Nov 12 15:55:00 2007
@@ -23,6 +23,8 @@
#include "YSimpleEventHandler.h"
#include
+#include <WApplication>
+
class YEvent;
class YWebOptionalWidgetFactory;
class YWebWidgetFactory;
@@ -31,16 +33,14 @@
using std::vector;
-class YWebUI: public YUI
+class YWebUI: public Wt::WApplication, public YUI
{
public:
/**
* Constructor.
**/
- YWebUI( int argc,
- char ** argv,
- bool with_threads,
+ YWebUI( const Wt::WEnvironment& env,
const char * macro_file );
/**
@@ -310,25 +310,6 @@
const string & filter,
const string & headline );
- /**
- * 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 );
-
- /**
- * 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:
/**
@@ -336,12 +317,6 @@
* [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 false; }
@@ -414,6 +389,9 @@
**/
YSimpleEventHandler _event_handler;
+public:
+ static int _argc;
+ static char** _argv;
};
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=41974&r1=41973&r2=41974&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/web-wt/src/YWebUIComponent.h (original)
+++ branches/tmp/sh/mod-ui/web-wt/src/YWebUIComponent.h Mon Nov 12 15:55:00 2007
@@ -21,8 +21,13 @@
#define YWebUIComponent_h
#include
+
+#define y2log_component "web-ui"
+#include
+
#include "YWebUI.h"
+extern void *start_webserver_thread( void * yui );
class YWebUIComponent : public YUIComponent
{
@@ -37,7 +42,28 @@
**/
virtual YUI * createUI( int argc, char **argv, bool with_threads, const char * macro_file )
{
- return new YWebUI( argc, argv, with_threads, macro_file );
+ // save the arguments for the UI thread (http server args etc)
+ 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");
+
+ // wait until the UI thread is ready
+ while (! YWebUI::ui() )
+ {
+ sleep( 1 );
+ }
+ return YWebUI::ui();
}
/**
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=41974&r1=41973&r2=41974&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 Mon Nov 12 15:55:00 2007
@@ -27,24 +27,29 @@
#include
#include
+#include <WApplication>
+
#include "YWebUI.h"
#include "YWebWidgetFactory.h"
#include "YWebOptionalWidgetFactory.h"
#include "YEvent.h"
#include "YUISymbols.h"
+using namespace Wt;
+
YWebUI * YWebUI::_ui = 0;
-YWebUI::YWebUI( int argc, char **argv, bool with_threads, const char * macro_file )
- : YUI( with_threads )
+YWebUI::YWebUI( const Wt::WEnvironment& env, const char * macro_file )
+ : WApplication(env),
+ YUI( true /* with_threads */ )
, _main_dialog_id(0)
, _do_exit_loop( false )
{
_ui = this;
_fatal_error = false;
- processCommandLineArgs( argc, argv );
+// processCommandLineArgs( argc, argv );
topmostConstructorHasFinished();
}
@@ -232,5 +237,53 @@
}
+WApplication *createApplication(const WEnvironment& env)
+{
+ // Instantiate the Wt application.
+ YWebUI *appl = new YWebUI( env, 0 );
+
+ // 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);
+
+#if 0
+ // Set up a timer for handling YaST requests
+ appl->createTimer();
+
+ _wtimer_work = true;
+#endif
+
+ return appl;
+}
+void *start_webserver_thread( void * yui )
+{
+ // FIXME: do the work
+ YWebUI* ui = (YWebUI*)yui;
+ WRun(ui->_argc, ui->_argv, &createApplication);
+
+ return 0;
+}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org