Index: sources/gui/GuiController.cpp =================================================================== diff -u -r741b1c70f851810f2c265cdd38dfa158b7ee0c37 -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/gui/GuiController.cpp (.../GuiController.cpp) (revision 741b1c70f851810f2c265cdd38dfa158b7ee0c37) +++ sources/gui/GuiController.cpp (.../GuiController.cpp) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,15 +1,15 @@ /*! - * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * + * Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * \file GuiController.cpp - * \author (last) Peter Lucia - * \date (last) 15-Oct-2020 - * \author (original) Behrouz NematiPour - * \date (original) 26-Aug-2020 + * \file GuiController.cpp + * \author (last) Behrouz NematiPour + * \date (last) 10-Feb-2023 + * \author (original) Behrouz NematiPour + * \date (original) 26-Aug-2020 * */ #include "GuiController.h" @@ -56,11 +56,11 @@ */ void GuiController::quit() { - // coco begin validated: Application termination is not correctly done in coco!!! + // disabled coco begin validated: Application termination is not correctly done in coco!!! // it has been tested and works perfectly fine in normal run. quitThread(); // validated } -// coco end +// disabled coco end /*! * \brief GuiController::initConnections @@ -80,19 +80,34 @@ this , SLOT( onUSBDriveMount ())); connect(&_ApplicationController, SIGNAL(didUSBDriveRemove()), this , SLOT( onUSBDriveRemove())); + connect(&_ApplicationController, SIGNAL(didUSBSpaceChange(bool, qint64, qint64, quint8)), + this , SLOT( onUSBSpaceChange(bool, qint64, qint64, quint8))); // SD card connect(&_ApplicationController, SIGNAL(didSDCardStateChange(bool,bool)), this , SLOT( onSDCardStateChange(bool,bool))); + connect(&_ApplicationController, SIGNAL(didSDCardSpaceChange(bool, qint64, qint64, quint8)), + this , SLOT( onSDCardSpaceChange(bool, qint64, qint64, quint8))); + connect(&_ApplicationController, SIGNAL(didSDCardSpaceTooLow(quint8)), + this , SLOT( onSDCardSpaceTooLow(quint8))); // Export connect(&_ApplicationController, SIGNAL(didExport()), this , SLOT( onExport())); + connect(&_ApplicationController, SIGNAL(didExportStat (quint32, const QString &, quint8)), + this , SLOT( onExportStat (quint32, const QString &, quint8))); // transmission fail connect(&_ApplicationController, SIGNAL(didFailedTransmit(Sequence)), this , SLOT( onFailedTransmit(Sequence))); + // POST result + connect(&_ApplicationController, SIGNAL(didPOSTPass(bool)), + this , SLOT( onPOSTPass(bool))); + + // Device Signal/Slots + DEVICE_GUI_INIT_CONNECTIONS_LIST + // ---- Signal/Slots ACTION_RECEIVE_MODEL_BRIDGE_CONNECTIONS(_ApplicationController) } @@ -106,7 +121,7 @@ */ void GuiController::initThread(QThread &vThread) { - // coco begin validated: Application termination is not correctly done in coco!!! + // disabled coco begin validated: Application termination is not correctly done in coco!!! // it has been tested and works perfectly fine in normal run. // runs in main thread Q_ASSERT_X(QThread::currentThread() == qApp->thread() , __func__, "The Class initialization must be done in Main Thread" ); @@ -116,23 +131,23 @@ _thread->start(); moveToThread(_thread); } -// coco end +// disabled coco end /*! * \brief GuiController::quitThread - * \details Moves this object to main thread to be handled by QApplicaiton + * \details Moves this object to main thread to be handled by QApplication * And to be destroyed there. */ void GuiController::quitThread() { - // coco begin validated: Application termination is not correctly done in coco!!! + // disabled coco begin validated: Application termination is not correctly done in coco!!! // it has been tested and works perfectly fine in normal run. if ( ! _thread ) return; // runs in thread moveToThread(qApp->thread()); // validated } -// coco end +// disabled coco end /*! * \brief GuiController initializer @@ -144,7 +159,7 @@ initConnections(); - LOG_EVENT("UI," + tr("%1 Initialized").arg(metaObject()->className())); + LOG_DEBUG(tr("%1 Initialized").arg(metaObject()->className())); return true; } @@ -161,10 +176,10 @@ */ void GuiController::doActionTransmit(GuiActionType vAction, const QVariantList &vData) { - // coco begin validated: This is a sample code and currently does nothing + // disabled coco begin validated: This is a sample code and currently does nothing // The handleTransmit is a place holder and currently has not been used. if (! handleTransmit(vAction, vData)) { - // coco end + // disabled coco end emit didActionTransmit(vAction, vData); } } @@ -180,7 +195,7 @@ */ bool GuiController::handleTransmit(GuiActionType vAction, const QVariantList &vData) { - // coco begin validated: This is a sample code and currently does nothing + // disabled coco begin validated: This is a sample code and currently does nothing Q_UNUSED(vAction) Q_UNUSED(vData) @@ -200,7 +215,7 @@ //} break; - //case Another_Command_Which_Doesn't_Require_HD_Approval: + //case Another_Command_Which_does not_Require_HD_Approval: //return true; //break; default: @@ -209,7 +224,7 @@ } return false; } -// coco end +// disabled coco end /*! * \brief Action commanded by HD @@ -232,11 +247,11 @@ */ void GuiController::onUSBDriveMount() { - // coco begin validated: This needs user interaction to plug-in USB device + // disabled coco begin validated: This needs user interaction to plug-in USB device // has been tested manually emit didUSBDriveMount(); } -// coco end +// disabled coco end /*! * \brief GuiController::doUSBDriveUmount @@ -245,11 +260,11 @@ */ void GuiController::doUSBDriveUmount() { - // coco begin validated: This needs user interaction to plug-out the USB device + // disabled coco begin validated: This needs user interaction to plug-out the USB device // has been tested manually emit didUSBDriveUmount(); } -// coco end +// disabled coco end /*! * \brief GuiController::onUSBDriveRemove @@ -258,12 +273,15 @@ */ void GuiController::onUSBDriveRemove() { - // coco begin validated: This needs user interaction to plug-out the USB device - // has been tested manually emit didUSBDriveRemove(); } -// coco end +void GuiController::onUSBSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent) +{ + //DEBUG:0: qDebug() << "GuiController::onUSBSpaceChange" << vReady << vTotal << vAvailable << vPercent; + emit didUSBSpaceChange(vReady, vTotal, vAvailable, vPercent); +} + /*! * \brief GuiController::onSDCardStateChange * \details emits didSDCardStateChange signal to notify other classes (GuiView) @@ -273,39 +291,76 @@ */ void GuiController::onSDCardStateChange(bool vIsReady, bool vIsReadOnly) { - // coco begin validated: This needs user interaction to plug-out the SD Card - // has been tested manually + //DEBUG:0: qDebug() << " ***** GuiController " << Storage::SDCard_Base_Path_Name << vIsReady << vIsReadOnly << gDisableSDCFailLogStop; emit didSDCardStateChange(vIsReady, vIsReadOnly); } -// coco end +void GuiController::onSDCardSpaceChange(bool vReady, qint64 vTotal, qint64 vAvailable, quint8 vPercent) +{ + emit didSDCardSpaceChange(vReady, vTotal, vAvailable, vPercent); +} + + /*! + * \brief GuiController::onSDCardSpaceTooLow + * \details The handler slot for the didSDCardSpaceTooLow signal comes form ApplicationController. + * \param vAvailablePercent - the minimum limit of available storage space + */ +void GuiController::onSDCardSpaceTooLow(quint8 vAvailablePercent) +{ + // disabled coco begin validated: This needs to fill up the SD-Card and test with human interactions. + // has been tested manually + emit didSDCardSpaceTooLow(vAvailablePercent); +} +// disabled coco end + +/*! * \brief GuiController::onExport * \details The slot which will be called to notify the export is done * by emitting the didExport signal. */ void GuiController::onExport() { - // coco begin validated: This needs user interaction to export to USB device - // has been tested manually emit didExport(); } -// coco end +void GuiController::onExportStat(quint32 vIndex, const QString &vFileName, quint8 vPercent) +{ + //DEBUG: qDebug() << "2" << vIndex << vFileName << vPercent; + emit didExportStat(vIndex, vFileName, vPercent); +} + /*! * \brief GuiController::doExportLog * \details emits didExportLog signal to notify other classes (ApplicationController) * , the User requested to export the log. */ -void GuiController::doExportLog() +void GuiController::doExportLog(const GuiStringIndexMap &vExportList) { - // coco begin validated: This needs user interaction to export to USB device - // has been tested manually - emit didExportLog(); + emit didExportLog(vExportList); } -// coco end /*! + * \brief GuiController::doExportService + * \details emits didExportService signal to notify other classes (ApplicationController) + * , the User requested to export the log. + */ +void GuiController::doExportService(const GuiStringIndexMap &vExportList) +{ + emit didExportService(vExportList); +} + +/*! + * \brief GuiController::doExportTreatment + * \details emits didExportTreatment signal to notify other classes (ApplicationController) + * , the User requested to export the log. + */ +void GuiController::doExportTreatment(const GuiStringIndexMap &vExportList) +{ + emit didExportTreatment(vExportList); +} + +/*! * \brief GuiController::didFailedTransmit * \details Raises an HD communication timeout alarm if communication with HD is lost. * \param seq - Sequence that failed to transmit @@ -316,3 +371,22 @@ AlarmStatusData data = AlarmGenerator::ALARM_ID_HD_COMM_TIMEOUT(); emit didActionReceive(data); } + +/*! + * \brief GuiController::onPOSTPass + * \details Passes on the Post status + * \param vPass - True if passed + */ +void GuiController::onPOSTPass(bool vPass) +{ + emit didPOSTPass(vPass); +} + +/*! + * \brief GuiController::doQuitApplication + * \details emit the didQuitApplication signal to ask ApplicationController to Quit the application gracefully. + */ +void GuiController::doQuitApplication() +{ + emit didQuitApplication(); +}