This commit is contained in:
Martin Rotter 2021-06-04 13:44:29 +02:00
parent ff5885abf6
commit 98e850e031
12 changed files with 149 additions and 39 deletions

View File

@ -30,7 +30,7 @@
<url type="donation">https://martinrotter.github.io/donate/</url>
<content_rating type="oars-1.1" />
<releases>
<release version="3.9.2" date="2021-06-03"/>
<release version="3.9.2" date="2021-06-04"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>

View File

@ -738,7 +738,7 @@
</action>
<action name="m_actionTabNewWebBrowser">
<property name="text">
<string>New web browser tab</string>
<string>New browser tab</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+T</string>
@ -795,7 +795,7 @@
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Show tree branches</string>
<string>&amp;Show tree expanders</string>
</property>
</action>
<action name="m_actionUpdateSelectedItemsWithCustomTimers">

View File

@ -16,6 +16,7 @@
#include "gui/settings/settingsgeneral.h"
#include "gui/settings/settingsgui.h"
#include "gui/settings/settingslocalization.h"
#include "gui/settings/settingsnotifications.h"
#include "gui/settings/settingsshortcuts.h"
FormSettings::FormSettings(QWidget& parent)
@ -33,14 +34,17 @@ FormSettings::FormSettings(QWidget& parent)
connect(m_ui.m_buttonBox, &QDialogButtonBox::accepted, this, &FormSettings::saveSettings);
connect(m_ui.m_buttonBox, &QDialogButtonBox::rejected, this, &FormSettings::cancelSettings);
connect(m_btnApply, &QPushButton::clicked, this, &FormSettings::applySettings);
addSettingsPanel(new SettingsGeneral(&m_settings, this));
addSettingsPanel(new SettingsDatabase(&m_settings, this));
addSettingsPanel(new SettingsGui(&m_settings, this));
addSettingsPanel(new SettingsNotifications(&m_settings, this));
addSettingsPanel(new SettingsLocalization(&m_settings, this));
addSettingsPanel(new SettingsShortcuts(&m_settings, this));
addSettingsPanel(new SettingsBrowserMail(&m_settings, this));
addSettingsPanel(new SettingsDownloads(&m_settings, this));
addSettingsPanel(new SettingsFeedsMessages(&m_settings, this));
m_ui.m_listSettings->setCurrentRow(0);
}

View File

@ -42,7 +42,6 @@ SettingsGui::SettingsGui(Settings* settings, QWidget* parent) : SettingsPanel(se
&SettingsGui::dirtifySettings);
connect(m_ui->m_treeSkins, &QTreeWidget::currentItemChanged, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_grpTray, &QGroupBox::toggled, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_checkEnableNotifications, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_checkHidden, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_checkMonochromeIcons, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_checkCountUnreadMessages, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
@ -95,9 +94,6 @@ void SettingsGui::loadSettings() {
m_ui->m_checkHidden->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::MainWindowStartsHidden)).toBool());
m_ui->m_checkHideWhenMinimized->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::HideMainWindowWhenMinimized)).toBool());
// Load fancy notification settings.
m_ui->m_checkEnableNotifications->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::EnableNotifications)).toBool());
// Load settings of icon theme.
const QString current_theme = qApp->icons()->currentIconTheme();
auto icons = qApp->icons()->installedIconThemes();
@ -227,9 +223,6 @@ void SettingsGui::saveSettings() {
// Make sure that number of unread messages is shown in tray icon as requested.
qApp->feedReader()->feedsModel()->notifyWithCounts();
// Save notifications.
settings()->setValue(GROUP(GUI), GUI::EnableNotifications, m_ui->m_checkEnableNotifications->isChecked());
// Save selected icon theme.
QString selected_icon_theme = m_ui->m_cmbIconTheme->itemData(m_ui->m_cmbIconTheme->currentIndex()).toString();
QString original_icon_theme = qApp->icons()->currentIconTheme();

View File

@ -121,6 +121,12 @@
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="m_grpTray">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Tray icon</string>
</property>
@ -131,27 +137,6 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="3" column="0">
<widget class="QCheckBox" name="m_checkHideWhenMinimized">
<property name="text">
<string>Hide main window when it is minimized</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkHidden">
<property name="text">
<string>Start application hidden</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="m_checkEnableNotifications">
<property name="text">
<string>Enable popup balloon tooltips</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="m_checkMonochromeIcons">
<property name="text">
@ -166,6 +151,20 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="m_checkHideWhenMinimized">
<property name="text">
<string>Hide main window when it is minimized</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkHidden">
<property name="text">
<string>Start application hidden</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -386,7 +385,6 @@
<tabstop>m_grpTray</tabstop>
<tabstop>m_checkMonochromeIcons</tabstop>
<tabstop>m_checkCountUnreadMessages</tabstop>
<tabstop>m_checkEnableNotifications</tabstop>
<tabstop>m_checkHideWhenMinimized</tabstop>
<tabstop>m_checkHidden</tabstop>
<tabstop>m_checkCloseTabsDoubleClick</tabstop>

View File

@ -0,0 +1,29 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#include "gui/settings/settingsnotifications.h"
#include "miscellaneous/settings.h"
SettingsNotifications::SettingsNotifications(Settings* settings, QWidget* parent) : SettingsPanel(settings, parent) {
m_ui.setupUi(this);
connect(m_ui.m_checkEnableNotifications, &QCheckBox::toggled, this, &SettingsNotifications::dirtifySettings);
}
void SettingsNotifications::loadSettings() {
onBeginLoadSettings();
// Load fancy notification settings.
m_ui.m_checkEnableNotifications->setChecked(settings()->value(GROUP(Notifications), SETTING(Notifications::EnableNotifications)).toBool());
onEndLoadSettings();
}
void SettingsNotifications::saveSettings() {
onBeginSaveSettings();
// Save notifications.
settings()->setValue(GROUP(Notifications), Notifications::EnableNotifications, m_ui.m_checkEnableNotifications->isChecked());
onEndSaveSettings();
}

View File

@ -0,0 +1,30 @@
// For license of this file, see <project-root-folder>/LICENSE.md.
#ifndef SETTINGSNOTIFICATIONS_H
#define SETTINGSNOTIFICATIONS_H
#include "gui/settings/settingspanel.h"
#include "ui_settingsnotifications.h"
class Settings;
class SettingsNotifications : public SettingsPanel {
Q_OBJECT
public:
explicit SettingsNotifications(Settings* settings, QWidget* parent = nullptr);
virtual QString title() const;
virtual void loadSettings();
virtual void saveSettings();
private:
Ui::SettingsNotifications m_ui;
};
inline QString SettingsNotifications::title() const {
return tr("Notifications");
}
#endif // SETTINGSNOTIFICATIONS_H

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsNotifications</class>
<widget class="QWidget" name="SettingsNotifications">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkEnableNotifications">
<property name="text">
<string>Enable popup balloon tooltips</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -69,7 +69,7 @@ bool SystemTrayIcon::isSystemTrayDesired() {
}
bool SystemTrayIcon::areNotificationsEnabled() {
return qApp->settings()->value(GROUP(GUI), SETTING(GUI::EnableNotifications)).toBool();
return qApp->settings()->value(GROUP(Notifications), SETTING(Notifications::EnableNotifications)).toBool();
}
void SystemTrayIcon::showPrivate() {

View File

@ -61,6 +61,7 @@ HEADERS += core/feeddownloader.h \
exceptions/networkexception.h \
exceptions/scriptexception.h \
gui/reusable/baselineedit.h \
gui/settings/settingsnotifications.h \
gui/toolbars/basetoolbar.h \
gui/reusable/comboboxwithstatus.h \
gui/reusable/colortoolbutton.h \
@ -242,6 +243,7 @@ SOURCES += core/feeddownloader.cpp \
exceptions/networkexception.cpp \
exceptions/scriptexception.cpp \
gui/reusable/baselineedit.cpp \
gui/settings/settingsnotifications.cpp \
gui/toolbars/basetoolbar.cpp \
gui/reusable/comboboxwithstatus.cpp \
gui/reusable/colortoolbutton.cpp \
@ -410,6 +412,7 @@ FORMS += gui/dialogs/formabout.ui \
gui/settings/settingsgeneral.ui \
gui/settings/settingsgui.ui \
gui/settings/settingslocalization.ui \
gui/settings/settingsnotifications.ui \
gui/settings/settingsshortcuts.ui \
gui/toolbars/toolbareditor.ui \
network-web/downloaditem.ui \

View File

@ -193,9 +193,6 @@ DVALUE(bool) GUI::UnreadNumbersInTrayIconDef = true;
DKEY GUI::UseTrayIcon = "use_tray_icon";
DVALUE(bool) GUI::UseTrayIconDef = true;
DKEY GUI::EnableNotifications = "enable_notifications";
DVALUE(bool) GUI::EnableNotificationsDef = true;
DKEY GUI::TabCloseMiddleClick = "tab_close_mid_button";
DVALUE(bool) GUI::TabCloseMiddleClickDef = true;
@ -315,6 +312,9 @@ DKEY Keyboard::ID = "keyboard";
// Notifications.
DKEY Notifications::ID = "notifications";
DKEY Notifications::EnableNotifications = "enable_notifications";
DVALUE(bool) Notifications::EnableNotificationsDef = true;
// Web browser.
DKEY Browser::ID = "browser";

View File

@ -207,9 +207,6 @@ namespace GUI {
KEY UnreadNumbersInTrayIcon;
VALUE(bool) UnreadNumbersInTrayIconDef;
KEY EnableNotifications;
VALUE(bool) EnableNotificationsDef;
KEY TabCloseMiddleClick;
VALUE(bool) TabCloseMiddleClickDef;
@ -363,6 +360,9 @@ namespace Keyboard {
// Notifications.
namespace Notifications {
KEY ID;
KEY EnableNotifications;
VALUE(bool) EnableNotificationsDef;
}
// Web browser.