29 #include <arcs/arcsappmode.h>
30 #include <arcs/arcsprocess.h>
31 #include <arcs/arcscontrollercomponent.h>
32 #include <arcs/arcslog.h>
34 #include <QCoreApplication>
42 parentProcess = parent ;
55 ARCSLog::logInformation(
"Application mode",
"base");
57 while(!parent()->hasFinished())
75 int ARCSAppEvent::eventType = QEvent::registerEventType();
82 void ARCSAppEvent::initHook()
85 const char* dargv[] = {
"ARCS"};
87 if (QCoreApplication::instance() == NULL)
88 new QCoreApplication(dargc, const_cast<char**>(dargv));
93 ARCSLog::logInformation(
"Application mode",
"event");
94 QCoreApplication* app = QCoreApplication::instance();
99 QObject::connect(parent(), SIGNAL(finished()), app, SLOT(quit()), Qt::QueuedConnection);
108 QCoreApplication::postEvent(parent(),
new QEvent((QEvent::Type)eventType));
128 ARCSLog::logInformation(
"Application mode",
"thread");
133 void ARCSAppThread::run()
138 while(!ARCSAppMode::parent()->hasFinished())
158 ARCSLog::logInformation(
"Application mode",
"thread event");
160 QThread::parent()->moveToThread(
this);
164 QObject::connect(QThread::parent(), SIGNAL(finished()),
this, SLOT(quit()), Qt::QueuedConnection);
170 QCoreApplication::postEvent(QThread::parent(),
171 new QEvent((QEvent::Type)ARCSAppEvent::eventType));
180 void ARCSAppThreadEvent::run()
182 QCoreApplication::postEvent(QThread::parent(),
new QEvent(QEvent::ApplicationActivate));
197 void ARCSAppGUI::initHook()
199 ARCSLog::logInformation(
"Application mode",
"GUI");
201 lib.setLoadHints(QLibrary::ResolveAllSymbolsHint|QLibrary::ExportExternalSymbolsHint);
202 lib.setFileName(
"arcsguiw");
207 start = (VoidProto)lib.resolve(
"start_gui_loop");
208 init = (VoidProto)lib.resolve(
"create_gui_application");
213 ARCSLog::logCritical(
"Application mode",
"cannot start GUI application.");
214 ARCSLog::logCritical(
"Application mode",lib.errorString());
219 ARCSLog::logCritical(
"Application mode",
"cannot load GUI library.");
220 ARCSLog::logCritical(
"Application mode",lib.errorString());
229 QCoreApplication* app = QCoreApplication::instance();
233 ARCSLog::logCritical(
"Application mode",
"GUI does not exist.");
237 if (app->inherits(
"QApplication"))
238 QObject::connect(parent(), SIGNAL(finished()), app, SLOT(closeAllWindows()));
239 QObject::connect(parent(), SIGNAL(finished()), app, SLOT(quit()));
242 QCoreApplication::postEvent(parent(),
new QEvent(QEvent::ApplicationActivate));
249 QCoreApplication::postEvent(parent(),
new QEvent((QEvent::Type)ARCSAppEvent::eventType));
virtual void startHook()
Hook for starting applications Subclasses should reimplement this.
This class is representing a process under ARCS.
virtual void startHook()
Hook for starting applications Subclasses should reimplement this.
virtual void stopHook()
Hook for stopping applications Subclasses should reimplement this.
virtual void startHook()
Hook for starting applications Subclasses should reimplement this.
virtual void startHook()
Hook for starting applications Subclasses should reimplement this.
virtual void startHook()
Hook for starting applications Subclasses should reimplement this.
ARCSStateMachine * getStateMachine()
Base class for launching and handling ARCS applications.
virtual void stopHook()
Hook for stopping applications Subclasses should reimplement this.
virtual void tokenHook()
Hook for handling tokens Subclasses should reimplement this.
virtual void stopHook()
Hook for stopping applications Subclasses should reimplement this.
virtual void stopHook()
Hook for stopping applications Subclasses should reimplement this.
Event-loop based application handler.
virtual void tokenHook()
Hook for handling tokens Subclasses should reimplement this.
ARCSControllerComponent * getController()
virtual void tokenHook()
Hook for handling tokens Subclasses should reimplement this.
virtual void tokenHook()
Hook for handling tokens Subclasses should reimplement this.
virtual void stopHook()
Hook for stopping applications Subclasses should reimplement this.
Basic application handler.