/*! * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * \copyright \n * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n * IN PART OR IN WHOLE, \n * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n * * \file guiview.cpp * \date 2019/09/30 * \author Behrouz NematiPour * */ #include "guiview.h" // Project #include "guicontroller.h" // namespace using namespace Gui; /*! * \brief GuiView::GuiView * \param parent */ GuiView::GuiView(QQuickItem *parent) { Q_UNUSED(parent) connection(); } void GuiView::connection() { 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); }