29 #include <arcs/arcsprocess.h>
30 #include <arcs/arcsappmode.h>
31 #include <arcs/arcscontrollercomponent.h>
36 ARCSProcess::ARCSProcess() : QObject()
39 currentSheetId = QString::null;
41 processFinished =
true;
48 ARCSProcess::~ARCSProcess()
64 if (event->type() == QEvent::ApplicationActivate ||
event->type() == ARCSAppEvent::eventType)
71 return QObject::event(event);
77 if (!sheets.contains(s))
79 std::cerr <<
"[Process] Sheet " << qPrintable(s) <<
" not found." << std::endl;
83 if (!currentSheetId.isEmpty())
85 ARCSSheet& current = sheets[currentSheetId];
92 processFinished =
true;
145 void ARCSProcess::setProcessMode()
147 if (applicationMode != 0)
148 delete applicationMode;
175 processFinished =
false;
179 std::cerr <<
"[Core] Process has not any controller" << std::endl;
183 QObject::connect(controller->
getStateMachine(), SIGNAL(sendSheet(QString)),
this, SLOT(
changeSheet(QString)),Qt::DirectConnection);
211 sh.setContext(context);
212 sheets.insert(s, sh);
218 if (currentSheetId.isEmpty())
221 if (!sheets.contains(currentSheetId))
223 std::cerr <<
"[Process] unknown sheet: " << qPrintable(currentSheetId) << std::endl;
226 ARCSSheet& sheet = sheets[currentSheetId];
237 if (applicationMode == NULL)
240 QThread* threadToWaitFor =
dynamic_cast<QThread*
>(applicationMode);
242 if (threadToWaitFor == NULL)
245 threadToWaitFor->wait();
250 if (!sheets.contains(oldName))
252 if ( sheets.contains(newName))
262 if (sheets.contains(s))
void changeSheet(QString s)
ARCSAppFlag
Flags to specify in which mode applications should start.
For applications running with Qt Widgets.
Threaded application handler.
virtual void startHook()=0
Hook for starting applications Subclasses should reimplement this.
void renameSheet(QString oldName, QString newName)
void removeSheet(QString s)
None of the application mode has been selected so far.
bool setController(QString s=QString::null)
For applications nested in a thread.
Defines a controller component.
Class handling the generic description of a component.
virtual void tokenHook()=0
Hook for handling tokens Subclasses should reimplement this.
ARCSStateMachine * getStateMachine()
Event-loop based GUI application handler.
ARCSAbstractComponent * getComponent(QString name)
Retrieves a component by its id.
Event-loop based application handler.
virtual bool event(QEvent *event)
For applications nested in a thread running with an event loop.
Threaded and event-loop based application handler.
For applications requiring event loops.
void setReferenceApplicationMode(ARCS::ARCSAppFlag flag)
Maintains connections between objects.
Basic application handler.
void addSheet(QString s, ARCSSheet sh)