This commit is contained in:
Martin Rotter 2020-12-23 19:40:24 +01:00
parent 5eac7b6f2a
commit 70bbaa5ca7
7 changed files with 33 additions and 31 deletions

View File

@ -2,6 +2,7 @@
#include "gui/settings/settingsgui.h"
#include "core/feedsmodel.h"
#include "gui/dialogs/formmain.h"
#include "gui/feedmessageviewer.h"
#include "gui/feedstoolbar.h"
@ -43,6 +44,7 @@ SettingsGui::SettingsGui(Settings* settings, QWidget* parent) : SettingsPanel(se
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);
connect(m_ui->m_checkHideWhenMinimized, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_checkHideTabBarIfOneTabVisible, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
connect(m_ui->m_checkCloseTabsDoubleClick, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
@ -117,6 +119,7 @@ void SettingsGui::loadSettings() {
}
m_ui->m_checkMonochromeIcons->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::MonochromeTrayIcon)).toBool());
m_ui->m_checkCountUnreadMessages->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::UnreadNumbersInTrayIcon)).toBool());
// Mark active theme.
if (current_theme == QL1S(APP_NO_THEME)) {
@ -215,9 +218,13 @@ void SettingsGui::saveSettings() {
settings()->setValue(GROUP(GUI), GUI::MonochromeTrayIcon, m_ui->m_checkMonochromeIcons->isChecked());
}
settings()->setValue(GROUP(GUI), GUI::UnreadNumbersInTrayIcon, m_ui->m_checkCountUnreadMessages->isChecked());
settings()->setValue(GROUP(GUI), GUI::MainWindowStartsHidden, m_ui->m_checkHidden->isChecked());
settings()->setValue(GROUP(GUI), GUI::HideMainWindowWhenMinimized, m_ui->m_checkHideWhenMinimized->isChecked());
// 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());

View File

@ -29,7 +29,7 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="m_tabIconSkin">
<attribute name="title">
@ -171,21 +171,21 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="2" column="0">
<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="3" column="0" colspan="2">
<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="1" column="0">
<item row="2" column="0">
<widget class="QCheckBox" name="m_checkEnableNotifications">
<property name="text">
<string>Enable popup balloon tooltips</string>
@ -199,6 +199,13 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_checkCountUnreadMessages">
<property name="text">
<string>Display count of unread messages</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -393,6 +400,7 @@
<tabstop>m_treeSkins</tabstop>
<tabstop>m_grpTray</tabstop>
<tabstop>m_checkMonochromeIcons</tabstop>
<tabstop>m_checkCountUnreadMessages</tabstop>
<tabstop>m_checkEnableNotifications</tabstop>
<tabstop>m_checkHideWhenMinimized</tabstop>
<tabstop>m_checkHidden</tabstop>

View File

@ -100,7 +100,8 @@ void SystemTrayIcon::show() {
void SystemTrayIcon::setNumber(int number, bool any_new_message) {
Q_UNUSED(any_new_message)
if (number <= 0) {
if (number <= 0 || !qApp->settings()->value(GROUP(GUI), SETTING(GUI::UnreadNumbersInTrayIcon)).toBool()) {
// Either no unread messages or numbers in tray icon are disabled.
setToolTip(QSL(APP_LONG_NAME));
QSystemTrayIcon::setIcon(QIcon(m_normalIcon));
}

View File

@ -166,6 +166,9 @@ DVALUE(bool) GUI::HideMainWindowWhenMinimizedDef = false;
DKEY GUI::MonochromeTrayIcon = "monochrome_tray_icon";
DVALUE(bool) GUI::MonochromeTrayIconDef = false;
DKEY GUI::UnreadNumbersInTrayIcon = "show_unread_numbers_in_tray_icon";
DVALUE(bool) GUI::UnreadNumbersInTrayIconDef = true;
DKEY GUI::UseTrayIcon = "use_tray_icon";
DVALUE(bool) GUI::UseTrayIconDef = true;

View File

@ -185,6 +185,9 @@ namespace GUI {
KEY MonochromeTrayIcon;
VALUE(bool) MonochromeTrayIconDef;
KEY UnreadNumbersInTrayIcon;
VALUE(bool) UnreadNumbersInTrayIconDef;
KEY EnableNotifications;
VALUE(bool) EnableNotificationsDef;

View File

@ -111,18 +111,12 @@ void FormEditOwnCloudAccount::performTest() {
else if (result.isLoaded()) {
if (!SystemFactory::isVersionEqualOrNewer(result.version(), OWNCLOUD_MIN_VERSION)) {
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
tr(
"Selected Nextcloud News server is running unsupported version %1. At least version %2 is required.").arg(
result.version(),
OWNCLOUD_MIN_VERSION),
tr("Installed version: %1, required at least: %2.").arg(result.version(), OWNCLOUD_MIN_VERSION),
tr("Selected Nextcloud News server is running unsupported version."));
}
else {
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
tr(
"Nextcloud News server is okay, running with version %1, while at least version %2 is required.").arg(
result.version(),
OWNCLOUD_MIN_VERSION),
tr("Installed version: %1, required at least: %2.").arg(result.version(), OWNCLOUD_MIN_VERSION),
tr("Nextcloud News server is okay."));
}
}

View File

@ -134,28 +134,14 @@ void FormEditTtRssAccount::performTest() {
}
else if (result.apiLevel() < TTRSS_MINIMAL_API_LEVEL) {
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
tr(
"Selected Tiny Tiny RSS server is running unsupported version of API (%1). At least API level %2 is required.").arg(
QString::number(
result
.
apiLevel()),
QString
::
number(TTRSS_MINIMAL_API_LEVEL)),
tr("Installed version: %1, required at least: %2.").arg(QString::number(result.apiLevel()),
QString::number(TTRSS_MINIMAL_API_LEVEL)),
tr("Selected Tiny Tiny RSS server is running unsupported version of API."));
}
else {
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
tr(
"Tiny Tiny RSS server is okay, running with API level %1, while at least API level %2 is required.").arg(
QString::number(
result
.
apiLevel()),
QString
::
number(TTRSS_MINIMAL_API_LEVEL)),
tr("Installed version: %1, required at least: %2.").arg(QString::number(result.apiLevel()),
QString::number(TTRSS_MINIMAL_API_LEVEL)),
tr("Tiny Tiny RSS server is okay."));
}
}