Index: sources/gui/guiview.cpp =================================================================== diff -u -r5194f3afffb28dac90a7ca4153b6a0ca2f239387 -r9a3ee027dbc33f39ee7df2a9dc5a7897c6b1854d --- sources/gui/guiview.cpp (.../guiview.cpp) (revision 5194f3afffb28dac90a7ca4153b6a0ca2f239387) +++ sources/gui/guiview.cpp (.../guiview.cpp) (revision 9a3ee027dbc33f39ee7df2a9dc5a7897c6b1854d) @@ -16,18 +16,58 @@ // Project #include "guicontroller.h" +// namespace using namespace Gui; -// We don't have access to view object since it has been created in the GUI -// So here connect to the controller which we have access to. -// Also here emit the controller signal since for the same reason. +/*! + * \brief GuiView::GuiView + * \param parent + */ GuiView::GuiView(QQuickItem *parent) { Q_UNUSED(parent) - connect(GuiController::I(), &GuiController::actionEvaluated, this, &GuiView::actionEvaluated); + connection(); } -void GuiView::notifyActionRequest(GuiAction vAction) +void GuiView::connection() { - emit GuiController::I()->actionRequested(vAction); + connect(_GuiController, SIGNAL(didActionConfirm(GuiActionType, GuiActionInfo)), + this , SLOT( onActionConfirm(GuiActionType, GuiActionInfo))); + + connect(_GuiController, SIGNAL(didActionCommand(GuiActionType )), + this , SLOT( onActionCommand(GuiActionType ))); + + // since we don't have access to GuiView object because it is created in Qml. + // Connection to the GuiController made here + // It should be defined in the class which wants to connect to signal. + connect(this , SIGNAL(didActionRequest(GuiActionType)), + _GuiController, SLOT( doActionRequest(GuiActionType))); + + connect(this , SIGNAL(didActionPerform(GuiActionType,GuiActionInfo)), + _GuiController, SLOT( doActionPerform(GuiActionType,GuiActionInfo))); } + +void GuiView::onActionConfirm(GuiActionType vAction, GuiActionInfo vInfo) +{ + // process the evaluation and notify GUI + // process ... + emit didActionConfirm(vAction, vInfo); +} + +void GuiView::onActionCommand(GuiActionType vAction) +{ + // process the commanded action and notify GUI + // process ... + emit didActionCommand(vAction); + +} + +void GuiView::doActionRequest(GuiActionType vAction) +{ + emit didActionRequest(vAction); +} + +void GuiView::doActionPerform(GuiActionType vAction, GuiActionInfo vInfo) +{ + emit didActionPerform(vAction, vInfo); +}