Index: sources/gui/GuiView.cpp =================================================================== diff -u -r265ce7409a0ea99a4ae059f5ce7978c9cdb10631 -r7823da721f8041d6d39c37cd040e162ea9d35e7f --- sources/gui/GuiView.cpp (.../GuiView.cpp) (revision 265ce7409a0ea99a4ae059f5ce7978c9cdb10631) +++ sources/gui/GuiView.cpp (.../GuiView.cpp) (revision 7823da721f8041d6d39c37cd040e162ea9d35e7f) @@ -67,14 +67,16 @@ this , SLOT( onSDCardSpaceChange(bool, qint64, qint64, quint8))); connect(&_GuiController , SIGNAL(didExport()), this , SLOT( onExport())); + connect(&_GuiController , SIGNAL(didExportStat (quint32, const QString &, quint8)), + this , SLOT( onExportStat (quint32, const QString &, quint8))); // From UI : Export Log - connect(this , SIGNAL(didExportLog ()), - &_GuiController, SLOT( doExportLog ())); - connect(this , SIGNAL(didExportService ()), - &_GuiController, SLOT( doExportService ())); - connect(this , SIGNAL(didExportTreatment ()), - &_GuiController, SLOT( doExportTreatment ())); + connect(this , SIGNAL(didExportLog (const GuiStringIndexMap &)), + &_GuiController, SLOT( doExportLog (const GuiStringIndexMap &))); + connect(this , SIGNAL(didExportService (const GuiStringIndexMap &)), + &_GuiController, SLOT( doExportService (const GuiStringIndexMap &))); + connect(this , SIGNAL(didExportTreatment (const GuiStringIndexMap &)), + &_GuiController, SLOT( doExportTreatment (const GuiStringIndexMap &))); } /*! @@ -213,21 +215,110 @@ */ void GuiView::onExport() { + doExportListRemove(); exportRunning(false); emit didExport(); //DEBUG:0: qDebug() << " ~~~~~ " << "GuiView::onExport" << _exportRunning; } +/*! + * \brief GuiView::onExportStat + * \details handler slot of the signal didExportStat, which is emitted when a state of the selected item is changed. + * \param vIndex - selected item index + * \param vFileName - selected item file name + * \param vPercent - selected item export percentage. + */ +void GuiView::onExportStat(quint32 vIndex, const QString &vFileName, quint8 vPercent) +{ + //DEBUG: qDebug() << "3" << vIndex << vFileName << vPercent; + _exportListPercent [vIndex] = vPercent; + exportIndex (vIndex ); + exportFile (vFileName ); + exportPercent (vPercent ); + if ( vPercent == 100 ) + doExportListDelete(vIndex); + emit didExportStat (vIndex, vFileName, vPercent); +} + /*! + * \brief GuiView::doExportListInsert + * \details invocable slot from UI to insert an item in the selection list. + * \param vIndex - selected item index + * \param vFileName - selected item file name + */ +void GuiView::doExportListInsert(quint32 vIndex, const QString &vFilename) +{ + _exportList [vIndex] = vFilename ; + _exportListPercent [vIndex] = 100 ; + exportIndex ( vIndex ); + exportFile ( vFilename ); + exportCount ( _exportList.count() ); + emit exportListChanged (_exportList ); +} + +/*! + * \brief GuiView::doExportListDelete + * \details invocable slot from UI to delete a selected item from the list. + * \param vIndex - deselected item index + */ +void GuiView::doExportListDelete(quint32 vIndex) +{ + _exportList.remove (vIndex); + _exportListPercent [vIndex] = 0 ; + exportIndex ( vIndex ); + exportFile ( "" ); + exportCount ( _exportList.count() ); + emit exportListChanged (_exportList ); +} + +/*! + * \brief GuiView::doExportListSelect + * \details invocable slot from UI to identify if the item with the index vIndex is selected. + * \param vIndex - item index + * \return true if the item with index vIndex is selected. + */ +bool GuiView::doExportListSelect(quint32 vIndex) +{ + bool contains = _exportList.contains(vIndex);; + return contains; +} + +/*! + * \brief GuiView::doExportListPercent + * \details invocable slot from UI to get the exported/copied percent of the item with the index vIndex. + * \param vIndex - item index + * \return the exported/copied percent + */ +quint8 GuiView::doExportListPercent(quint32 vIndex) +{ + exportIndex ( vIndex ); + return _exportListPercent[vIndex]; +} + +/*! + * \brief GuiView::doExportListRemove + * \details invocable slot from UI to clear the selection list, and reset related values/properties.. + */ +void GuiView::doExportListRemove() +{ + exportIndex ( 0 ); + exportFile ( "" ); + exportPercent ( 0 ); + exportCount ( 0 ); + _exportList.clear ( ); + emit exportListChanged (_exportList); +} + +/*! * \brief GuiView::doExportLog * \details emits didExportLog signal to notify other classes (GuiController) * , the User requested to export the log. */ void GuiView::doExportLog() { exportRunning(true); - emit didExportLog(); + emit didExportLog(_exportList); } /*! @@ -238,7 +329,7 @@ void GuiView::doExportService() { exportRunning(true); - emit didExportService(); + emit didExportService(_exportList); } /*! @@ -249,7 +340,7 @@ void GuiView::doExportTreatment() { exportRunning(true); - emit didExportTreatment(); + emit didExportTreatment(_exportList); } /*!