removed last remains of old verify implementation

actorid
Marc Zinnschlag 12 years ago
parent af9b48f4d3
commit 8b7f342641

@ -13,9 +13,6 @@ CSMDoc::Document::Document (const std::string& name)
// dummy implementation -> remove when proper save is implemented.
mSaveCount = 0;
connect (&mSaveTimer, SIGNAL(timeout()), this, SLOT (saving()));
// dummy implementation -> remove when proper verify is implemented.
mVerifyCount = 0;
}
QUndoStack& CSMDoc::Document::getUndoStack()
@ -33,8 +30,8 @@ int CSMDoc::Document::getState() const
if (mSaveCount)
state |= State_Locked | State_Saving | State_Operation;
if (mVerifyCount)
state |= State_Locked | State_Verifying | State_Operation;
if (int operations = mTools.getRunningOperations())
state |= State_Locked | State_Operation | operations;
return state;
}
@ -54,9 +51,8 @@ void CSMDoc::Document::save()
void CSMDoc::Document::verify()
{
mVerifyCount = 1;
emit stateChanged (getState(), this);
mTools.runVerifier();
emit stateChanged (getState(), this);
}
void CSMDoc::Document::abortOperation (int type)
@ -77,9 +73,6 @@ void CSMDoc::Document::modificationStateChanged (bool clean)
void CSMDoc::Document::operationDone (int type)
{
if (type==State_Verifying)
mVerifyCount = 0;
emit stateChanged (getState(), this);
}

@ -29,8 +29,6 @@ namespace CSMDoc
int mSaveCount; ///< dummy implementation -> remove when proper save is implemented.
QTimer mSaveTimer; ///< dummy implementation -> remove when proper save is implemented.
int mVerifyCount; ///< dummy implementation -> remove when proper verify is implemented.
// not implemented
Document (const Document&);
Document& operator= (const Document&);

@ -7,6 +7,21 @@
#include "../doc/state.hpp"
CSMTools::Operation *CSMTools::Tools::get (int type)
{
switch (type)
{
case CSMDoc::State_Verifying: return mVerifier;
}
return 0;
}
const CSMTools::Operation *CSMTools::Tools::get (int type) const
{
return const_cast<Tools *> (this)->get (type);
}
CSMTools::Verifier *CSMTools::Tools::getVerifier()
{
if (!mVerifier)
@ -37,7 +52,26 @@ void CSMTools::Tools::runVerifier()
void CSMTools::Tools::abortOperation (int type)
{
if (Operation *operation = get (type))
operation->abort();
}
int CSMTools::Tools::getRunningOperations() const
{
static const int sOperations[] =
{
CSMDoc::State_Verifying,
-1
};
int result = 0;
for (int i=0; sOperations[i]!=-1; ++i)
if (const Operation *operation = get (sOperations[i]))
if (operation->isRunning())
result |= sOperations[i];
return result;
}
void CSMTools::Tools::verifierDone()

@ -6,6 +6,7 @@
namespace CSMTools
{
class Verifier;
class Operation;
class Tools : public QObject
{
@ -19,6 +20,12 @@ namespace CSMTools
Verifier *getVerifier();
Operation *get (int type);
///< Returns a 0-pointer, if operation hasn't been used yet.
const Operation *get (int type) const;
///< Returns a 0-pointer, if operation hasn't been used yet.
public:
Tools();
@ -30,6 +37,8 @@ namespace CSMTools
void abortOperation (int type);
///< \attention The operation is not aborted immediately.
int getRunningOperations() const;
private slots:
void verifierDone();

Loading…
Cancel
Save