forked from mirror/openmw-tes3mp
removed last remains of old verify implementation
This commit is contained in:
parent
af9b48f4d3
commit
8b7f342641
4 changed files with 46 additions and 12 deletions
|
@ -13,9 +13,6 @@ CSMDoc::Document::Document (const std::string& name)
|
||||||
// dummy implementation -> remove when proper save is implemented.
|
// dummy implementation -> remove when proper save is implemented.
|
||||||
mSaveCount = 0;
|
mSaveCount = 0;
|
||||||
connect (&mSaveTimer, SIGNAL(timeout()), this, SLOT (saving()));
|
connect (&mSaveTimer, SIGNAL(timeout()), this, SLOT (saving()));
|
||||||
|
|
||||||
// dummy implementation -> remove when proper verify is implemented.
|
|
||||||
mVerifyCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QUndoStack& CSMDoc::Document::getUndoStack()
|
QUndoStack& CSMDoc::Document::getUndoStack()
|
||||||
|
@ -33,8 +30,8 @@ int CSMDoc::Document::getState() const
|
||||||
if (mSaveCount)
|
if (mSaveCount)
|
||||||
state |= State_Locked | State_Saving | State_Operation;
|
state |= State_Locked | State_Saving | State_Operation;
|
||||||
|
|
||||||
if (mVerifyCount)
|
if (int operations = mTools.getRunningOperations())
|
||||||
state |= State_Locked | State_Verifying | State_Operation;
|
state |= State_Locked | State_Operation | operations;
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -54,9 +51,8 @@ void CSMDoc::Document::save()
|
||||||
|
|
||||||
void CSMDoc::Document::verify()
|
void CSMDoc::Document::verify()
|
||||||
{
|
{
|
||||||
mVerifyCount = 1;
|
|
||||||
emit stateChanged (getState(), this);
|
|
||||||
mTools.runVerifier();
|
mTools.runVerifier();
|
||||||
|
emit stateChanged (getState(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMDoc::Document::abortOperation (int type)
|
void CSMDoc::Document::abortOperation (int type)
|
||||||
|
@ -77,9 +73,6 @@ void CSMDoc::Document::modificationStateChanged (bool clean)
|
||||||
|
|
||||||
void CSMDoc::Document::operationDone (int type)
|
void CSMDoc::Document::operationDone (int type)
|
||||||
{
|
{
|
||||||
if (type==State_Verifying)
|
|
||||||
mVerifyCount = 0;
|
|
||||||
|
|
||||||
emit stateChanged (getState(), this);
|
emit stateChanged (getState(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,6 @@ namespace CSMDoc
|
||||||
int mSaveCount; ///< dummy implementation -> remove when proper save is implemented.
|
int mSaveCount; ///< dummy implementation -> remove when proper save is implemented.
|
||||||
QTimer mSaveTimer; ///< 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
|
// not implemented
|
||||||
Document (const Document&);
|
Document (const Document&);
|
||||||
Document& operator= (const Document&);
|
Document& operator= (const Document&);
|
||||||
|
|
|
@ -7,6 +7,21 @@
|
||||||
|
|
||||||
#include "../doc/state.hpp"
|
#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()
|
CSMTools::Verifier *CSMTools::Tools::getVerifier()
|
||||||
{
|
{
|
||||||
if (!mVerifier)
|
if (!mVerifier)
|
||||||
|
@ -37,7 +52,26 @@ void CSMTools::Tools::runVerifier()
|
||||||
|
|
||||||
void CSMTools::Tools::abortOperation (int type)
|
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()
|
void CSMTools::Tools::verifierDone()
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
namespace CSMTools
|
namespace CSMTools
|
||||||
{
|
{
|
||||||
class Verifier;
|
class Verifier;
|
||||||
|
class Operation;
|
||||||
|
|
||||||
class Tools : public QObject
|
class Tools : public QObject
|
||||||
{
|
{
|
||||||
|
@ -19,6 +20,12 @@ namespace CSMTools
|
||||||
|
|
||||||
Verifier *getVerifier();
|
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:
|
public:
|
||||||
|
|
||||||
Tools();
|
Tools();
|
||||||
|
@ -30,6 +37,8 @@ namespace CSMTools
|
||||||
void abortOperation (int type);
|
void abortOperation (int type);
|
||||||
///< \attention The operation is not aborted immediately.
|
///< \attention The operation is not aborted immediately.
|
||||||
|
|
||||||
|
int getRunningOperations() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void verifierDone();
|
void verifierDone();
|
||||||
|
|
Loading…
Reference in a new issue