mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 02:09:41 +00:00
preparations for multiple parallel progress-type operations
This commit is contained in:
parent
04158d03b0
commit
eaa58e0530
6 changed files with 18 additions and 17 deletions
|
@ -23,7 +23,7 @@ int CSMDoc::Document::getState() const
|
|||
state |= State_Modified;
|
||||
|
||||
if (mSaveCount)
|
||||
state |= State_Locked | State_Saving | State_Progress;
|
||||
state |= State_Locked | State_Saving;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ void CSMDoc::Document::save()
|
|||
mSaveCount = 1;
|
||||
mSaveTimer.start (500);
|
||||
emit stateChanged (getState(), this);
|
||||
emit progress (1, 16, this);
|
||||
emit progress (1, 16, State_Saving, this);
|
||||
}
|
||||
|
||||
void CSMDoc::Document::abortSave()
|
||||
|
@ -51,7 +51,7 @@ void CSMDoc::Document::saving()
|
|||
{
|
||||
++mSaveCount;
|
||||
|
||||
emit progress (mSaveCount, 16, this);
|
||||
emit progress (mSaveCount, 16, State_Saving, this);
|
||||
|
||||
if (mSaveCount>15)
|
||||
{
|
||||
|
|
|
@ -17,8 +17,7 @@ namespace CSMDoc
|
|||
{
|
||||
State_Modified = 1,
|
||||
State_Locked = 2,
|
||||
State_Saving = 4,
|
||||
State_Progress = 8
|
||||
State_Saving = 4
|
||||
};
|
||||
|
||||
QUndoStack mUndoStack;
|
||||
|
@ -46,7 +45,7 @@ namespace CSMDoc
|
|||
|
||||
void stateChanged (int state, CSMDoc::Document *document);
|
||||
|
||||
void progress (int current, int max, CSMDoc::Document *document);
|
||||
void progress (int current, int max, int type, CSMDoc::Document *document);
|
||||
|
||||
private slots:
|
||||
|
||||
|
|
|
@ -20,10 +20,9 @@ void CSVDoc::View::setupFileMenu()
|
|||
{
|
||||
QMenu *file = menuBar()->addMenu (tr ("&File"));
|
||||
|
||||
QAction *save = new QAction (tr ("&Save"), this);
|
||||
connect (save, SIGNAL (triggered()), this, SLOT (save()));
|
||||
file->addAction (save);
|
||||
mEditingActions.push_back (save);
|
||||
mSave = new QAction (tr ("&Save"), this);
|
||||
connect (mSave, SIGNAL (triggered()), this, SLOT (save()));
|
||||
file->addAction (mSave);
|
||||
}
|
||||
|
||||
void CSVDoc::View::setupEditMenu()
|
||||
|
@ -85,6 +84,8 @@ void CSVDoc::View::updateActions()
|
|||
|
||||
mUndo->setEnabled (editing & mDocument->getUndoStack().canUndo());
|
||||
mRedo->setEnabled (editing & mDocument->getUndoStack().canRedo());
|
||||
|
||||
mSave->setEnabled (!(mDocument->getState() & CSMDoc::Document::State_Saving));
|
||||
}
|
||||
|
||||
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews)
|
||||
|
@ -121,7 +122,7 @@ void CSVDoc::View::updateDocumentState()
|
|||
updateActions();
|
||||
}
|
||||
|
||||
void CSVDoc::View::updateProgress (int current, int max)
|
||||
void CSVDoc::View::updateProgress (int current, int max, int type)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace CSVDoc
|
|||
int mViewTotal;
|
||||
QAction *mUndo;
|
||||
QAction *mRedo;
|
||||
QAction *mSave;
|
||||
std::vector<QAction *> mEditingActions;
|
||||
|
||||
// not implemented
|
||||
|
@ -61,7 +62,7 @@ namespace CSVDoc
|
|||
|
||||
void updateDocumentState();
|
||||
|
||||
void updateProgress (int current, int max);
|
||||
void updateProgress (int current, int max, int type);
|
||||
|
||||
private slots:
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *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 *)));
|
||||
connect (document, SIGNAL (progress (int, int, int, CSMDoc::Document *)),
|
||||
this, SLOT (progress (int, int, int, CSMDoc::Document *)));
|
||||
}
|
||||
|
||||
View *view = new View (*this, document, countViews (document)+1);
|
||||
|
@ -102,9 +102,9 @@ void CSVDoc::ViewManager::documentStateChanged (int state, CSMDoc::Document *doc
|
|||
(*iter)->updateDocumentState();
|
||||
}
|
||||
|
||||
void CSVDoc::ViewManager::progress (int current, int max, CSMDoc::Document *document)
|
||||
void CSVDoc::ViewManager::progress (int current, int max, int type, CSMDoc::Document *document)
|
||||
{
|
||||
for (std::vector<View *>::const_iterator iter (mViews.begin()); iter!=mViews.end(); ++iter)
|
||||
if ((*iter)->getDocument()==document)
|
||||
(*iter)->updateProgress (current, max);
|
||||
(*iter)->updateProgress (current, max, type);
|
||||
}
|
|
@ -46,7 +46,7 @@ namespace CSVDoc
|
|||
|
||||
void documentStateChanged (int state, CSMDoc::Document *document);
|
||||
|
||||
void progress (int current, int max, CSMDoc::Document *document);
|
||||
void progress (int current, int max, int type, CSMDoc::Document *document);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue