aboutsummaryrefslogtreecommitdiff
path: root/src/qt/optionsmodel.cpp
diff options
context:
space:
mode:
authorTyler Hardin <th020394@gmail.com>2016-05-11 22:28:02 -0400
committerTyler Hardin <th020394@gmail.com>2016-05-11 22:28:02 -0400
commit8b0e4970281de15472a93a529302f3de15163943 (patch)
tree26f55cc6d7e35cd5597ee1caefc1f503dd9aee5d /src/qt/optionsmodel.cpp
parent42a67533828fe419f021d586495f8266db71b659 (diff)
downloadbitcoin-8b0e4970281de15472a93a529302f3de15163943.tar.xz
Qt: Add option to hide the system tray icon
My changes leave all tray icon and menu creation/initialization logic untouched. It only shows or hides the icon according to the setting. A new checkbox was added to the OptionsDialog under the Window tab. A bool option named "hideTrayIcon" was added to OptionsModel. This checkbox was mapped like other all options to the OptionsModel. A signal was added to the OptionsModel for broadcasting changes the the hideTrayIcon option. This signal was connected to a new slot added to BitcoinGUI named setTrayIconVisible(bool). The slot simply hides or shows the trayIcon in BitcoinGUI according to the parameter recieved.
Diffstat (limited to 'src/qt/optionsmodel.cpp')
-rw-r--r--src/qt/optionsmodel.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index d091bb9e61..cc2cbc0e66 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -51,9 +51,14 @@ void OptionsModel::Init(bool resetSettings)
// These are Qt-only settings:
// Window
+ if (!settings.contains("fHideTrayIcon"))
+ settings.setValue("fHideTrayIcon", false);
+ fHideTrayIcon = settings.value("fHideTrayIcon").toBool();
+ Q_EMIT hideTrayIconChanged(fHideTrayIcon);
+
if (!settings.contains("fMinimizeToTray"))
settings.setValue("fMinimizeToTray", false);
- fMinimizeToTray = settings.value("fMinimizeToTray").toBool();
+ fMinimizeToTray = settings.value("fMinimizeToTray").toBool() && !fHideTrayIcon;
if (!settings.contains("fMinimizeOnClose"))
settings.setValue("fMinimizeOnClose", false);
@@ -166,6 +171,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
{
case StartAtStartup:
return GUIUtil::GetStartOnSystemStartup();
+ case HideTrayIcon:
+ return fHideTrayIcon;
case MinimizeToTray:
return fMinimizeToTray;
case MapPortUPnP:
@@ -242,6 +249,11 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
case StartAtStartup:
successful = GUIUtil::SetStartOnSystemStartup(value.toBool());
break;
+ case HideTrayIcon:
+ fHideTrayIcon = value.toBool();
+ settings.setValue("fHideTrayIcon", fHideTrayIcon);
+ Q_EMIT hideTrayIconChanged(fHideTrayIcon);
+ break;
case MinimizeToTray:
fMinimizeToTray = value.toBool();
settings.setValue("fMinimizeToTray", fMinimizeToTray);