Ref T228, some renamings

This commit is contained in:
Klaus Basan
2018-01-18 01:30:42 +01:00
parent 558f3c3e56
commit ee8ea8e599
4 changed files with 29 additions and 35 deletions

View File

@@ -523,9 +523,9 @@ namespace BlackCore
return !this->getUnsavedSettingsKeys().isEmpty(); return !this->getUnsavedSettingsKeys().isEmpty();
} }
void CApplication::setSettingsAutoSave(bool autoSave) void CApplication::saveSettingsOnShutdown(bool saveSettings)
{ {
m_autoSaveSettings = autoSave; m_saveSettingsOnShutdown = saveSettings;
} }
QStringList CApplication::getUnsavedSettingsKeys() const QStringList CApplication::getUnsavedSettingsKeys() const
@@ -948,18 +948,11 @@ namespace BlackCore
m_shutdown = true; m_shutdown = true;
// save settings (but only when application was really alive) // save settings (but only when application was really alive)
CStatusMessage m; if (m_parsed && m_saveSettingsOnShutdown)
if (m_parsed)
{ {
if (this->supportsContexts() && m_autoSaveSettings) const CStatusMessage m = this->supportsContexts() ?
{ this->getIContextApplication()->saveSettings() :
// this will eventually also call saveToStore CSettingsCache::instance()->saveToStore();
m = this->getIContextApplication()->saveSettings();
}
else
{
m = CSettingsCache::instance()->saveToStore();
}
CLogMessage(getLogCategories()).preformatted(m); CLogMessage(getLogCategories()).preformatted(m);
} }

View File

@@ -221,8 +221,8 @@ namespace BlackCore
//! Unsaved settings //! Unsaved settings
bool hasUnsavedSettings() const; bool hasUnsavedSettings() const;
//! Automatically and always save settings //! Save settings on shutdown
void setSettingsAutoSave(bool autoSave); void saveSettingsOnShutdown(bool saveSettings);
//! All unsaved settings //! All unsaved settings
QStringList getUnsavedSettingsKeys() const; QStringList getUnsavedSettingsKeys() const;
@@ -616,7 +616,7 @@ namespace BlackCore
bool m_useWebData = false; //!< use web data bool m_useWebData = false; //!< use web data
bool m_signalStartup = true; //!< signal startup automatically bool m_signalStartup = true; //!< signal startup automatically
bool m_devEnv = false; //!< dev. environment bool m_devEnv = false; //!< dev. environment
bool m_autoSaveSettings = true; //!< automatically saving all settings bool m_saveSettingsOnShutdown = true; //!< saving all settings on shutdown
// -------------- crashpad ----------------- // -------------- crashpad -----------------
BlackMisc::CStatusMessageList initCrashHandler(); BlackMisc::CStatusMessageList initCrashHandler();

View File

@@ -189,6 +189,7 @@ namespace BlackGui
virtual bool parseAndSynchronizeSetup(int timeoutMs = BlackMisc::Network::CNetworkUtils::getLongTimeoutMs()) override; virtual bool parseAndSynchronizeSetup(int timeoutMs = BlackMisc::Network::CNetworkUtils::getLongTimeoutMs()) override;
//! Show close dialog //! Show close dialog
//! \remark will modify CApplication::saveSettingsOnShutdown
QDialog::DialogCode showCloseDialog(QMainWindow *mainWindow, QCloseEvent *closeEvent); QDialog::DialogCode showCloseDialog(QMainWindow *mainWindow, QCloseEvent *closeEvent);
//! Trigger new version check //! Trigger new version check

View File

@@ -73,7 +73,7 @@ void CSwiftData::closeEvent(QCloseEvent *event)
{ {
if (sGui) if (sGui)
{ {
// save settings // save settings?
if (sGui->showCloseDialog(this, event) == QDialog::Rejected) { return; } if (sGui->showCloseDialog(this, event) == QDialog::Rejected) { return; }
} }
this->performGracefulShutdown(); this->performGracefulShutdown();