mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
added progress tracking
This commit is contained in:
parent
931eb08114
commit
03aacd3263
6 changed files with 28 additions and 2 deletions
|
@ -23,7 +23,7 @@ int CSMDoc::Document::getState() const
|
|||
state |= State_Modified;
|
||||
|
||||
if (mSaveCount)
|
||||
state |= State_Locked | State_Saving;
|
||||
state |= State_Locked | State_Saving | State_Progress;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ void CSMDoc::Document::save()
|
|||
mSaveCount = 1;
|
||||
mSaveTimer.start (500);
|
||||
emit stateChanged (getState(), this);
|
||||
emit progress (1, 16, this);
|
||||
}
|
||||
|
||||
void CSMDoc::Document::abortSave()
|
||||
|
@ -50,6 +51,8 @@ void CSMDoc::Document::saving()
|
|||
{
|
||||
++mSaveCount;
|
||||
|
||||
emit progress (mSaveCount, 16, this);
|
||||
|
||||
if (mSaveCount>15)
|
||||
{
|
||||
mSaveCount = 0;
|
||||
|
|
|
@ -17,7 +17,8 @@ namespace CSMDoc
|
|||
{
|
||||
State_Modified = 1,
|
||||
State_Locked = 2,
|
||||
State_Saving = 4
|
||||
State_Saving = 4,
|
||||
State_Progress = 8
|
||||
};
|
||||
|
||||
QUndoStack mUndoStack;
|
||||
|
@ -45,6 +46,8 @@ namespace CSMDoc
|
|||
|
||||
void stateChanged (int state, CSMDoc::Document *document);
|
||||
|
||||
void progress (int current, int max, CSMDoc::Document *document);
|
||||
|
||||
private slots:
|
||||
|
||||
void modificationStateChanged (bool clean);
|
||||
|
|
|
@ -121,6 +121,11 @@ void CSVDoc::View::updateDocumentState()
|
|||
updateActions();
|
||||
}
|
||||
|
||||
void CSVDoc::View::updateProgress (int current, int max)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CSVDoc::View::newView()
|
||||
{
|
||||
mViewManager.addView (mDocument);
|
||||
|
|
|
@ -61,6 +61,8 @@ namespace CSVDoc
|
|||
|
||||
void updateDocumentState();
|
||||
|
||||
void updateProgress (int current, int max);
|
||||
|
||||
private slots:
|
||||
|
||||
void newView();
|
||||
|
|
|
@ -48,6 +48,9 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document)
|
|||
// new document
|
||||
connect (document, SIGNAL (stateChanged (int, CSMDoc::Document *)),
|
||||
this, SLOT (documentStateChanged (int, CSMDoc::Document *)));
|
||||
|
||||
connect (document, SIGNAL (progress (int, int, CSMDoc::Document *)),
|
||||
this, SLOT (progress (int, int, CSMDoc::Document *)));
|
||||
}
|
||||
|
||||
View *view = new View (*this, document, countViews (document)+1);
|
||||
|
@ -80,6 +83,7 @@ bool CSVDoc::ViewManager::closeRequest (View *view)
|
|||
{
|
||||
bool last = countViews (view->getDocument())<=1;
|
||||
|
||||
/// \todo check if save is in progress -> warn user about possible data loss
|
||||
/// \todo check if document has not been saved -> return false and start close dialogue
|
||||
|
||||
mViews.erase (iter);
|
||||
|
@ -100,3 +104,10 @@ void CSVDoc::ViewManager::documentStateChanged (int state, CSMDoc::Document *doc
|
|||
if ((*iter)->getDocument()==document)
|
||||
(*iter)->updateDocumentState();
|
||||
}
|
||||
|
||||
void CSVDoc::ViewManager::progress (int current, int max, CSMDoc::Document *document)
|
||||
{
|
||||
for (std::vector<View *>::const_iterator iter (mViews.begin()); iter!=mViews.end(); ++iter)
|
||||
if ((*iter)->getDocument()==document)
|
||||
(*iter)->updateProgress (current, max);
|
||||
}
|
|
@ -46,6 +46,8 @@ namespace CSVDoc
|
|||
private slots:
|
||||
|
||||
void documentStateChanged (int state, CSMDoc::Document *document);
|
||||
|
||||
void progress (int current, int max, CSMDoc::Document *document);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue