refactor: move CloseReminder setting to Settings

newkeyL gui/closeReminder <= General/showCloseReminder
remove closeReminder from `AppConfig`
This commit is contained in:
sithlord48
2025-03-05 00:11:41 -05:00
committed by Nick Bolton
parent 54ecdad101
commit 1e46bd2727
5 changed files with 8 additions and 20 deletions

View File

@ -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();

View File

@ -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;
}

View File

@ -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

View File

@ -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
///////////////////////////////////////////////////////////////////////////////

View File

@ -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;
/**