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);
|
setWindowModified(state);
|
||||||
not patternReadOnly ? ui->actionSave->setEnabled(state): ui->actionSave->setEnabled(false);
|
not patternReadOnly ? ui->actionSave->setEnabled(state): ui->actionSave->setEnabled(false);
|
||||||
isLayoutStale = true;
|
isLayoutStale = true;
|
||||||
|
isNeedAutosave = not saved;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3725,13 +3726,14 @@ bool MainWindow::SavePattern(const QString &fileName, QString &error)
|
||||||
*/
|
*/
|
||||||
void MainWindow::AutoSavePattern()
|
void MainWindow::AutoSavePattern()
|
||||||
{
|
{
|
||||||
qCDebug(vMainWindow, "Autosaving pattern.");
|
if (not qApp->GetPatternPath().isEmpty() && isWindowModified() && isNeedAutosave)
|
||||||
|
|
||||||
if (qApp->GetPatternPath().isEmpty() == false && this->isWindowModified() == true)
|
|
||||||
{
|
{
|
||||||
QString autofile = qApp->GetPatternPath() + *autosavePrefix;
|
qCDebug(vMainWindow, "Autosaving pattern.");
|
||||||
QString error;
|
QString error;
|
||||||
SavePattern(autofile, error);
|
if (SavePattern(qApp->GetPatternPath() + *autosavePrefix, error))
|
||||||
|
{
|
||||||
|
isNeedAutosave = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,7 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
||||||
actionDockWidgetGroups(nullptr),
|
actionDockWidgetGroups(nullptr),
|
||||||
isNoScaling(false),
|
isNoScaling(false),
|
||||||
isLayoutStale(true),
|
isLayoutStale(true),
|
||||||
|
isNeedAutosave(false),
|
||||||
ignorePrinterFields(false),
|
ignorePrinterFields(false),
|
||||||
margins(),
|
margins(),
|
||||||
paperSize(),
|
paperSize(),
|
||||||
|
|
|
@ -91,6 +91,7 @@ protected:
|
||||||
|
|
||||||
bool isNoScaling;
|
bool isNoScaling;
|
||||||
bool isLayoutStale;
|
bool isLayoutStale;
|
||||||
|
bool isNeedAutosave;
|
||||||
bool ignorePrinterFields;
|
bool ignorePrinterFields;
|
||||||
QMarginsF margins;
|
QMarginsF margins;
|
||||||
QSizeF paperSize;
|
QSizeF paperSize;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user