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;
@@ -598,25 +598,25 @@ namespace BlackCore
//! Write meta information into the application directory so other swift versions can display them //! Write meta information into the application directory so other swift versions can display them
void tagApplicationDataDirectory(); void tagApplicationDataDirectory();
QNetworkAccessManager *m_accessManager = nullptr; //!< single network access manager QNetworkAccessManager *m_accessManager = nullptr; //!< single network access manager
BlackMisc::CApplicationInfo m_applicationInfo; //!< Application if specified BlackMisc::CApplicationInfo m_applicationInfo; //!< Application if specified
QScopedPointer<CCoreFacade> m_coreFacade; //!< core facade if any QScopedPointer<CCoreFacade> m_coreFacade; //!< core facade if any
QScopedPointer<CSetupReader> m_setupReader; //!< setup reader QScopedPointer<CSetupReader> m_setupReader; //!< setup reader
QScopedPointer<CWebDataServices> m_webDataServices; //!< web data services QScopedPointer<CWebDataServices> m_webDataServices; //!< web data services
QScopedPointer<Db::CNetworkWatchdog> m_networkWatchDog; //!< checking DB/internet access QScopedPointer<Db::CNetworkWatchdog> m_networkWatchDog; //!< checking DB/internet access
QScopedPointer<BlackMisc::CFileLogger> m_fileLogger; //!< file logger QScopedPointer<BlackMisc::CFileLogger> m_fileLogger; //!< file logger
CCookieManager m_cookieManager; //!< single cookie manager for our access manager CCookieManager m_cookieManager; //!< single cookie manager for our access manager
const QString m_applicationName; //!< application name const QString m_applicationName; //!< application name
QReadWriteLock m_accessManagerLock; //!< lock to make access manager access threadsafe QReadWriteLock m_accessManagerLock; //!< lock to make access manager access threadsafe
CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any
CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used
Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching? Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching?
std::atomic<bool> m_shutdown { false }; //!< is being shutdown? std::atomic<bool> m_shutdown { false }; //!< is being shutdown?
bool m_useContexts = false; //!< use contexts bool m_useContexts = false; //!< use contexts
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();