refactor: move CloseReminder setting to Settings
newkeyL gui/closeReminder <= General/showCloseReminder remove closeReminder from `AppConfig`
This commit is contained in:
@ -852,9 +852,9 @@ void MainWindow::showEvent(QShowEvent *event)
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (Settings::value(Settings::Gui::CloseToTray).toBool() && event->spontaneous()) {
|
||||
if (m_appConfig.showCloseReminder()) {
|
||||
if (Settings::value(Settings::Gui::CloseReminder).toBool()) {
|
||||
messages::showCloseReminder(this);
|
||||
m_appConfig.setShowCloseReminder(false);
|
||||
Settings::setValue(Settings::Gui::CloseReminder, false);
|
||||
}
|
||||
qDebug() << "hiding to tray";
|
||||
hide();
|
||||
|
||||
@ -73,7 +73,8 @@ QVariant Settings::defaultValue(const QString &key)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((key == Gui::CloseToTray) || (key == Gui::LogExpanded) || (key == Gui::SymbolicTrayIcon)) {
|
||||
if ((key == Gui::CloseToTray) || (key == Gui::LogExpanded) || (key == Gui::SymbolicTrayIcon)
|
||||
|| (key == Gui::CloseReminder)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ public:
|
||||
{
|
||||
inline static const auto Autohide = QStringLiteral("gui/autoHide");
|
||||
inline static const auto AutoUpdateCheck = QStringLiteral("gui/enableUpdateCheck");
|
||||
inline static const auto CloseReminder = QStringLiteral("gui/closeReminder");
|
||||
inline static const auto CloseToTray = QStringLiteral("gui/closeToTray");
|
||||
inline static const auto LogExpanded = QStringLiteral("gui/logExpanded");
|
||||
inline static const auto SymbolicTrayIcon = QStringLiteral("gui/symbolicTrayIcon");
|
||||
@ -78,6 +79,7 @@ private:
|
||||
, Core::StartedBefore
|
||||
, Gui::Autohide
|
||||
, Gui::AutoUpdateCheck
|
||||
, Gui::CloseReminder
|
||||
, Gui::CloseToTray
|
||||
, Gui::LogExpanded
|
||||
, Gui::SymbolicTrayIcon
|
||||
|
||||
@ -75,7 +75,7 @@ const char *const AppConfig::m_SettingsName[] = {
|
||||
"mainWindowSize",
|
||||
"mainWindowPosition",
|
||||
"", // 41 = Show dev thanks, obsolete
|
||||
"showCloseReminder",
|
||||
"", // 42 show Close Reminder moved to deskflow settings
|
||||
"", // 43 Moved to deskflow settings
|
||||
"", // 44, Moved to deskflow settings.
|
||||
"", // 45 Moved to deskflow settings
|
||||
@ -138,7 +138,6 @@ void AppConfig::recallFromCurrentScope()
|
||||
m_MainWindowPosition =
|
||||
getFromCurrentScope<QPoint>(kMainWindowPosition, [](const QVariant &v) { return v.toPoint(); });
|
||||
m_MainWindowSize = getFromCurrentScope<QSize>(kMainWindowSize, [](const QVariant &v) { return v.toSize(); });
|
||||
m_ShowCloseReminder = getFromCurrentScope(kShowCloseReminder, m_ShowCloseReminder).toBool();
|
||||
}
|
||||
|
||||
void AppConfig::recallScreenName()
|
||||
@ -189,7 +188,6 @@ void AppConfig::commit()
|
||||
setInCurrentScope(kEnableService, m_EnableService);
|
||||
setInCurrentScope(kMainWindowSize, m_MainWindowSize);
|
||||
setInCurrentScope(kMainWindowPosition, m_MainWindowPosition);
|
||||
setInCurrentScope(kShowCloseReminder, m_ShowCloseReminder);
|
||||
setInCurrentScope(kRequireClientCert, m_RequireClientCert);
|
||||
}
|
||||
|
||||
@ -537,11 +535,6 @@ std::optional<QPoint> AppConfig::mainWindowPosition() const
|
||||
return m_MainWindowPosition;
|
||||
}
|
||||
|
||||
bool AppConfig::showCloseReminder() const
|
||||
{
|
||||
return m_ShowCloseReminder;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// End getters
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -689,11 +682,6 @@ void AppConfig::setMainWindowPosition(const QPoint &position)
|
||||
m_MainWindowPosition = position;
|
||||
}
|
||||
|
||||
void AppConfig::setShowCloseReminder(bool value)
|
||||
{
|
||||
m_ShowCloseReminder = value;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// End setters
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -97,7 +97,7 @@ private:
|
||||
kMainWindowSize = 39,
|
||||
kMainWindowPosition = 40,
|
||||
// 41 = show dev thanks, obsolete
|
||||
kShowCloseReminder = 42,
|
||||
// 42, close reminder moved to deskflow settings
|
||||
// 43 = Enable Update Check,
|
||||
// 44 = LogExpanded, Moved to deskflow settings
|
||||
// 45 = Colorful Icon, Moved to deskflow settings
|
||||
@ -170,7 +170,6 @@ public:
|
||||
QString lastVersion() const;
|
||||
std::optional<QSize> mainWindowSize() const;
|
||||
std::optional<QPoint> mainWindowPosition() const;
|
||||
bool showCloseReminder() const;
|
||||
|
||||
//
|
||||
// Setters (overrides)
|
||||
@ -205,7 +204,6 @@ public:
|
||||
void setLastVersion(const QString &version);
|
||||
void setMainWindowSize(const QSize &size);
|
||||
void setMainWindowPosition(const QPoint &position);
|
||||
void setShowCloseReminder(bool show);
|
||||
|
||||
/// @brief Sets the user preference to load from SystemScope.
|
||||
/// @param [in] value
|
||||
@ -304,7 +302,6 @@ private:
|
||||
std::optional<QSize> m_MainWindowSize;
|
||||
std::optional<QPoint> m_MainWindowPosition;
|
||||
bool m_LoadFromSystemScope = false;
|
||||
bool m_ShowCloseReminder = true;
|
||||
bool m_RequireClientCert = true;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user