1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 20:53:50 +00:00

Completed "abort save on close" feature

This commit is contained in:
graffy76 2013-03-02 09:22:44 -06:00
parent f85be6a744
commit a2e36594c9
3 changed files with 15 additions and 14 deletions

View file

@ -121,9 +121,9 @@ void CSVDoc::View::updateActions()
mVerify->setEnabled (!(mDocument->getState() & CSMDoc::State_Verifying));
}
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews) //, QMainWindow *viewParent)
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews)
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1),
mViewTotal (totalViews) //, QMainWindow (viewParent)
mViewTotal (totalViews)
{
setAttribute (Qt::WA_DeleteOnClose, true);
setDockOptions (QMainWindow::AllowNestedDocks);

View file

@ -67,7 +67,7 @@ namespace CSVDoc
public:
View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews); //, QMainWindow *viewParent);
View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews);
///< The ownership of \a document is not transferred to *this.
virtual ~View();

View file

@ -171,22 +171,22 @@ bool CSVDoc::ViewManager::showSaveInProgressMessageBox (View* view)
messageBox.setInformativeText("Do you want to abort the save?");
messageBox.setStandardButtons (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
bool retVal = false;
bool retVal = true;
switch (messageBox.exec())
{
case QMessageBox::Yes:
case QMessageBox::Yes: //immediate shutdown
mCloseMeOnSaveStateChange = 0;
view->abortOperation(CSMDoc::State_Saving);
// mCloseMeOnSaveStateChange = view;
break;
case QMessageBox::No: //shutdown after save completes
mCloseMeOnSaveStateChange = view;
retVal = false;
break;
case QMessageBox::No:
//mCloseMeOnSaveStateChange = view;
retVal = false;
break;
case QMessageBox::Cancel:
case QMessageBox::Cancel: //abort shutdown, allow save to complete
mCloseMeOnSaveStateChange = 0;
retVal = false;
break;
@ -207,13 +207,14 @@ void CSVDoc::ViewManager::documentStateChanged (int state, CSMDoc::Document *doc
qDebug() << "Last state was saving";
else
qDebug() << "Last state was something else";
/*
//mechanism to shutdown main window after saving operation completes
if (mCloseMeOnSaveStateChange && (mPreviousDocumentState & CSMDoc::State_Saving))
{
mCloseMeOnSaveStateChange->close();
mCloseMeOnSaveStateChange = 0;
}
*/
mPreviousDocumentState = state;
}