diff --git a/apps/opencs/model/tools/operation.cpp b/apps/opencs/model/tools/operation.cpp index 12c4a8108..b68f79ca4 100644 --- a/apps/opencs/model/tools/operation.cpp +++ b/apps/opencs/model/tools/operation.cpp @@ -1,6 +1,9 @@ #include "operation.hpp" +#include +#include + #include #include "../doc/state.hpp" @@ -54,6 +57,8 @@ void CSMTools::Operation::abort() void CSMTools::Operation::verify() { + std::vector messages; + while (mCurrentStage!=mStages.end()) { if (mCurrentStep>=mCurrentStage->second) @@ -63,7 +68,7 @@ void CSMTools::Operation::verify() } else { - mCurrentStage->first->perform (mCurrentStep++); + mCurrentStage->first->perform (mCurrentStep++, messages); ++mCurrentStepTotal; break; } @@ -71,6 +76,9 @@ void CSMTools::Operation::verify() emit progress (mCurrentStepTotal, mTotalSteps ? mTotalSteps : 1, mType); + for (std::vector::const_iterator iter (messages.begin()); iter!=messages.end(); ++iter) + emit reportMessage (iter->c_str(), mType); + if (mCurrentStage==mStages.end()) exit(); } \ No newline at end of file diff --git a/apps/opencs/model/tools/operation.hpp b/apps/opencs/model/tools/operation.hpp index 72419e00a..4731c58fa 100644 --- a/apps/opencs/model/tools/operation.hpp +++ b/apps/opencs/model/tools/operation.hpp @@ -39,6 +39,8 @@ namespace CSMTools void progress (int current, int max, int type); + void reportMessage (const QString& message, int type); + public slots: void abort(); diff --git a/apps/opencs/model/tools/stage.hpp b/apps/opencs/model/tools/stage.hpp index 912559410..1ad61960a 100644 --- a/apps/opencs/model/tools/stage.hpp +++ b/apps/opencs/model/tools/stage.hpp @@ -1,6 +1,9 @@ #ifndef CSM_TOOLS_STAGE_H #define CSM_TOOLS_STAGE_H +#include +#include + namespace CSMTools { class Stage @@ -12,7 +15,8 @@ namespace CSMTools virtual int setup() = 0; ///< \return number of steps - virtual void perform (int stage) = 0; + virtual void perform (int stage, std::vector& messages) = 0; + ///< Messages resulting from this tage will be appended to \a messages. }; } diff --git a/apps/opencs/model/tools/tools.cpp b/apps/opencs/model/tools/tools.cpp index 608244a3c..8293b7291 100644 --- a/apps/opencs/model/tools/tools.cpp +++ b/apps/opencs/model/tools/tools.cpp @@ -30,6 +30,8 @@ CSMTools::Verifier *CSMTools::Tools::getVerifier() connect (mVerifier, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int))); connect (mVerifier, SIGNAL (finished()), this, SLOT (verifierDone())); + connect (mVerifier, SIGNAL (reportMessage (const QString&, int)), + this, SLOT (verifierMessage (const QString&, int))); } return mVerifier; @@ -77,4 +79,12 @@ int CSMTools::Tools::getRunningOperations() const void CSMTools::Tools::verifierDone() { emit done (CSMDoc::State_Verifying); +} + +#include +void CSMTools::Tools::verifierMessage (const QString& message, int type) +{ + /// \todo store it in a result model instead + + std::cout << message.toStdString() << std::endl; } \ No newline at end of file diff --git a/apps/opencs/model/tools/tools.hpp b/apps/opencs/model/tools/tools.hpp index ab1863738..04140bb91 100644 --- a/apps/opencs/model/tools/tools.hpp +++ b/apps/opencs/model/tools/tools.hpp @@ -43,6 +43,8 @@ namespace CSMTools void verifierDone(); + void verifierMessage (const QString& message, int type); + signals: void progress (int current, int max, int type);