Index: sources/gui/guicontroller.cpp =================================================================== diff -u -rde2f87e15fa05b1c45581cfedd8f1af0c47c2b48 -rc933552983a659ca4cc351ff4d43d07319adab1e --- sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision de2f87e15fa05b1c45581cfedd8f1af0c47c2b48) +++ sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision c933552983a659ca4cc351ff4d43d07319adab1e) @@ -34,94 +34,72 @@ /*! * \brief GuiController connections definition */ -void GuiController::connection() +void GuiController::initConnections() { // From HD/DG - connect(_ApplicationController, SIGNAL(didActionCommand(GuiActionType)), - this , SLOT( onActionCommand(GuiActionType))); - // From HD/DG - connect(_ApplicationController, SIGNAL(didActionConfirm(GuiActionType, GuiActionInfo)), - this , SLOT( onActionConfirm(GuiActionType, GuiActionInfo))); - + connect(_ApplicationController, SIGNAL(didActionReceive (GuiActionType, const QVariantList &)), + this , SLOT( onActionReceive (GuiActionType, const QVariantList &))); } - /*! * \brief GuiController initializer */ void GuiController::init() { - connection(); + initConnections(); } /*! - * \brief GuiController::onActionRequest - * This method Confirmed that if the action is accepted or not,\n + * \brief An Action has been requested + * \details This method Confirmed that if the action is accepted or not,\n * Regarding the current state and the action.\n * These actions are only user actions and there is only one user interaction,\n * So no need to capture from which screen this action comes since we have the current state.\n * Sometimes GuiController requires to investigate with the ApplicationController to get approval from HD device.\n * \param vAction - User requested Action */ -void GuiController::doActionRequest(GuiActionType vAction) +void GuiController::doActionTransmit(GuiActionType vAction, const QVariantList &vData) { + if (! handleTransmit(vAction, vData)) { + emit didActionTransmit(vAction, vData); + } +} + +bool GuiController::handleTransmit(GuiActionType, const QVariantList &) +{ + // This is an example implementation of how to handle + // which does not require HD approval in GuiController + /* // Process the GuiView Request. - // If can be processed in GuiController take action and notify GuiView - //qDebug() << "GuiController.actionRequested : " << vAction; - GuiActionInfo mInfo = GuiActionInfo::Accepted; - Q_UNUSED(mInfo) + // It can be processed in GuiController take action and notify GuiView switch (vAction) { - // TODO : Test Code case GuiActionType::PowerOff: - emit didActionConfirm(vAction, mInfo); + // GUI Controller decides (loop back) + if (vData == GuiActionData::NoData){ + // PowerOff noData is a request + emit didActionReceive (vAction, GuiActionData::Accepted); + return true; + } break; + //case Another_Command_Which_Doesn't_Require_HD_Approval: + //return true; + //break; default: - // If it requires to be Confirmed by HD/DG send the request to ApplicationController - emit didActionRequest(vAction); break; } + */ + return false; } /*! - * \brief Process the performed action - * \details An action which has been commanded by HD has been performed by Gui.\n - * Gui notifies that the action has been performed - * \param vAction - * \param vInfo - */ -void GuiController::doActionPerform(GuiActionType vAction, GuiActionInfo vInfo) -{ - // qDebug() << "GuiController.actionPerformed : " << vAction << vInfo; - // Process the performed action by Gui - // Process ... - emit didActionPerform(vAction, vInfo); -} - -/*! * \brief Action commanded by HD * \details An action has been commanded by HD, * Gui requires to be notified to perform the action. * \param vAction */ -void GuiController::onActionCommand(GuiActionType vAction) +void GuiController::onActionReceive (GuiActionType vAction, const QVariantList &vData) { - // qDebug() << "GuiController.actionCommanded : " << vAction; // Process the command and notify GuiView // Process ... - emit didActionCommand(vAction); + emit didActionReceive (vAction, vData); } - -/*! - * \brief An action has been confirmed - * \details Gui requested an action. - * In response HD confirmed the action. - * \param vAction - * \param vInfo - */ -void GuiController::onActionConfirm(GuiActionType vAction, GuiActionInfo vInfo) -{ - // qDebug() << "GuiController.actionConfirmed : " << vAction; - // Process the command and notify GuiView - // Process ... - emit didActionConfirm(vAction, vInfo); -}