Optimizing calling autosave. It should be called only for new unsaved changes.
--HG-- branch : develop
This commit is contained in:
parent
cf3be706c2
commit
9c2cdad1a8
|
@ -3450,6 +3450,7 @@ void MainWindow::PatternChangesWereSaved(bool saved)
|
|||
setWindowModified(state);
|
||||
not patternReadOnly ? ui->actionSave->setEnabled(state): ui->actionSave->setEnabled(false);
|
||||
isLayoutStale = true;
|
||||
isNeedAutosave = not saved;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3725,13 +3726,14 @@ bool MainWindow::SavePattern(const QString &fileName, QString &error)
|
|||
*/
|
||||
void MainWindow::AutoSavePattern()
|
||||
{
|
||||
qCDebug(vMainWindow, "Autosaving pattern.");
|
||||
|
||||
if (qApp->GetPatternPath().isEmpty() == false && this->isWindowModified() == true)
|
||||
if (not qApp->GetPatternPath().isEmpty() && isWindowModified() && isNeedAutosave)
|
||||
{
|
||||
QString autofile = qApp->GetPatternPath() + *autosavePrefix;
|
||||
qCDebug(vMainWindow, "Autosaving pattern.");
|
||||
QString error;
|
||||
SavePattern(autofile, error);
|
||||
if (SavePattern(qApp->GetPatternPath() + *autosavePrefix, error))
|
||||
{
|
||||
isNeedAutosave = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
|||
actionDockWidgetGroups(nullptr),
|
||||
isNoScaling(false),
|
||||
isLayoutStale(true),
|
||||
isNeedAutosave(false),
|
||||
ignorePrinterFields(false),
|
||||
margins(),
|
||||
paperSize(),
|
||||
|
|
|
@ -91,6 +91,7 @@ protected:
|
|||
|
||||
bool isNoScaling;
|
||||
bool isLayoutStale;
|
||||
bool isNeedAutosave;
|
||||
bool ignorePrinterFields;
|
||||
QMarginsF margins;
|
||||
QSizeF paperSize;
|
||||
|
|
Loading…
Reference in New Issue
Block a user