mirror of
https://github.com/feather-wallet/feather.git
synced 2025-04-23 20:58:13 +00:00
settings: add option to minimize to tray
This commit is contained in:
parent
e55afe9429
commit
bb1015731f
7 changed files with 68 additions and 25 deletions
|
@ -1255,6 +1255,9 @@ void MainWindow::changeEvent(QEvent* event)
|
|||
if (conf()->get(Config::lockOnMinimize).toBool()) {
|
||||
this->lockWallet();
|
||||
}
|
||||
if (conf()->get(Config::showTrayIcon).toBool() && conf()->get(Config::minimizeToTray).toBool()) {
|
||||
this->hide();
|
||||
}
|
||||
} else {
|
||||
QMainWindow::changeEvent(event);
|
||||
}
|
||||
|
|
|
@ -286,13 +286,6 @@ void Settings::setupDisplayTab() {
|
|||
conf()->set(Config::hideNotifications, toggled);
|
||||
});
|
||||
|
||||
// [Hide tray icon]
|
||||
ui->checkBox_hideTrayIcon->setChecked(conf()->get(Config::hideTrayIcon).toBool());
|
||||
connect(ui->checkBox_hideTrayIcon, &QCheckBox::toggled, [this](bool toggled) {
|
||||
conf()->set(Config::hideTrayIcon, toggled);
|
||||
emit hideTrayIcon(toggled);
|
||||
});
|
||||
|
||||
// [Warn before opening external link]
|
||||
ui->checkBox_warnOnExternalLink->setChecked(conf()->get(Config::warnOnExternalLink).toBool());
|
||||
connect(ui->checkBox_warnOnExternalLink, &QCheckBox::clicked, this, [this]{
|
||||
|
@ -315,6 +308,21 @@ void Settings::setupDisplayTab() {
|
|||
connect(ui->checkBox_lockOnMinimize, &QCheckBox::toggled, [](bool toggled){
|
||||
conf()->set(Config::lockOnMinimize, toggled);
|
||||
});
|
||||
|
||||
// [Show tray icon]
|
||||
ui->checkBox_showTrayIcon->setChecked(conf()->get(Config::showTrayIcon).toBool());
|
||||
connect(ui->checkBox_showTrayIcon, &QCheckBox::toggled, [this](bool toggled) {
|
||||
conf()->set(Config::showTrayIcon, toggled);
|
||||
ui->checkBox_minimizeToTray->setEnabled(toggled);
|
||||
emit showTrayIcon(toggled);
|
||||
});
|
||||
|
||||
// [Hide window to system tray when minimized]
|
||||
ui->checkBox_minimizeToTray->setEnabled(ui->checkBox_showTrayIcon->isChecked());
|
||||
ui->checkBox_minimizeToTray->setChecked(conf()->get(Config::minimizeToTray).toBool());
|
||||
connect(ui->checkBox_minimizeToTray, &QCheckBox::toggled, [this](bool toggled) {
|
||||
conf()->set(Config::minimizeToTray, toggled);
|
||||
});
|
||||
}
|
||||
|
||||
void Settings::setupMemoryTab() {
|
||||
|
|
|
@ -36,7 +36,7 @@ signals:
|
|||
void preferredFiatCurrencyChanged(QString currency);
|
||||
void skinChanged(QString skinName);
|
||||
void hideUpdateNotifications(bool hidden);
|
||||
void hideTrayIcon(bool hidden);
|
||||
void showTrayIcon(bool visible);
|
||||
void websocketStatusChanged(bool enabled);
|
||||
void proxySettingsChanged();
|
||||
void updateBalance();
|
||||
|
|
|
@ -671,7 +671,7 @@
|
|||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_19" stretch="1,1,1,0,1,1,1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_19" stretch="1,1,1,1,1,0,0,0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
|
@ -723,17 +723,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_hideTrayIcon">
|
||||
<property name="text">
|
||||
<string>Hide tray icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
|
@ -808,6 +797,47 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_showTrayIcon">
|
||||
<property name="text">
|
||||
<string>Show tray icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_minimizeToTray">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hide window to system tray when minimized</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -45,7 +45,7 @@ WindowManager::WindowManager(QObject *parent)
|
|||
m_tray = new QSystemTrayIcon(icons()->icon("appicons/64x64.png"));
|
||||
m_tray->setToolTip("Feather Wallet");
|
||||
this->buildTrayMenu();
|
||||
m_tray->setVisible(!conf()->get(Config::hideTrayIcon).toBool());
|
||||
m_tray->setVisible(conf()->get(Config::showTrayIcon).toBool());
|
||||
|
||||
this->initSkins();
|
||||
this->patchMacStylesheet();
|
||||
|
@ -194,8 +194,8 @@ void WindowManager::showSettings(Nodes *nodes, QWidget *parent, bool showProxyTa
|
|||
window->onHideUpdateNotifications(hidden);
|
||||
}
|
||||
});
|
||||
connect(&settings, &Settings::hideTrayIcon, [this](bool hidden) {
|
||||
m_tray->setVisible(!hidden);
|
||||
connect(&settings, &Settings::showTrayIcon, [this](bool visible) {
|
||||
m_tray->setVisible(visible);
|
||||
});
|
||||
connect(&settings, &Settings::pluginConfigured, [this](const QString &id) {
|
||||
emit pluginConfigured(id);
|
||||
|
|
|
@ -84,6 +84,8 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
|||
{Config::inactivityLockEnabled, {QS("inactivityLockEnabled"), false}},
|
||||
{Config::inactivityLockTimeout, {QS("inactivityLockTimeout"), 10}},
|
||||
{Config::lockOnMinimize, {QS("lockOnMinimize"), false}},
|
||||
{Config::showTrayIcon, {QS("showTrayIcon"), true}},
|
||||
{Config::minimizeToTray, {QS("minimizeToTray"), false}},
|
||||
{Config::disableWebsocket, {QS("disableWebsocket"), false}},
|
||||
{Config::offlineMode, {QS("offlineMode"), false}},
|
||||
|
||||
|
@ -98,7 +100,6 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
|||
{Config::hideBalance, {QS("hideBalance"), false}},
|
||||
{Config::hideNotifications, {QS("hideNotifications"), false}},
|
||||
{Config::hideUpdateNotifications, {QS("hideUpdateNotifications"), false}},
|
||||
{Config::hideTrayIcon, {QS("hideTrayIcon"), false}},
|
||||
{Config::disableLogging, {QS("disableLogging"), true}},
|
||||
{Config::writeStackTraceToDisk, {QS("writeStackTraceToDisk"), true}},
|
||||
{Config::writeRecentlyOpenedWallets, {QS("writeRecentlyOpenedWallets"), true}},
|
||||
|
|
|
@ -113,11 +113,12 @@ public:
|
|||
hideBalance,
|
||||
hideUpdateNotifications,
|
||||
hideNotifications,
|
||||
hideTrayIcon,
|
||||
warnOnExternalLink,
|
||||
inactivityLockEnabled,
|
||||
inactivityLockTimeout,
|
||||
lockOnMinimize,
|
||||
showTrayIcon,
|
||||
minimizeToTray,
|
||||
|
||||
// Transactions
|
||||
multiBroadcast,
|
||||
|
|
Loading…
Reference in a new issue