Fixed #328.
This commit is contained in:
parent
5eac7b6f2a
commit
70bbaa5ca7
7 changed files with 33 additions and 31 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "gui/settings/settingsgui.h"
|
#include "gui/settings/settingsgui.h"
|
||||||
|
|
||||||
|
#include "core/feedsmodel.h"
|
||||||
#include "gui/dialogs/formmain.h"
|
#include "gui/dialogs/formmain.h"
|
||||||
#include "gui/feedmessageviewer.h"
|
#include "gui/feedmessageviewer.h"
|
||||||
#include "gui/feedstoolbar.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_checkEnableNotifications, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
|
||||||
connect(m_ui->m_checkHidden, &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_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_checkHideWhenMinimized, &QCheckBox::toggled, this, &SettingsGui::dirtifySettings);
|
||||||
connect(m_ui->m_checkHideTabBarIfOneTabVisible, &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);
|
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_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.
|
// Mark active theme.
|
||||||
if (current_theme == QL1S(APP_NO_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::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::MainWindowStartsHidden, m_ui->m_checkHidden->isChecked());
|
||||||
settings()->setValue(GROUP(GUI), GUI::HideMainWindowWhenMinimized, m_ui->m_checkHideWhenMinimized->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.
|
// Save notifications.
|
||||||
settings()->setValue(GROUP(GUI), GUI::EnableNotifications, m_ui->m_checkEnableNotifications->isChecked());
|
settings()->setValue(GROUP(GUI), GUI::EnableNotifications, m_ui->m_checkEnableNotifications->isChecked());
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<enum>QTabWidget::North</enum>
|
<enum>QTabWidget::North</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="m_tabIconSkin">
|
<widget class="QWidget" name="m_tabIconSkin">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -171,21 +171,21 @@
|
||||||
<property name="fieldGrowthPolicy">
|
<property name="fieldGrowthPolicy">
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
</property>
|
</property>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="m_checkHideWhenMinimized">
|
<widget class="QCheckBox" name="m_checkHideWhenMinimized">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Hide main window when it is minimized</string>
|
<string>Hide main window when it is minimized</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="m_checkHidden">
|
<widget class="QCheckBox" name="m_checkHidden">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Start application hidden</string>
|
<string>Start application hidden</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QCheckBox" name="m_checkEnableNotifications">
|
<widget class="QCheckBox" name="m_checkEnableNotifications">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enable popup balloon tooltips</string>
|
<string>Enable popup balloon tooltips</string>
|
||||||
|
@ -199,6 +199,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -393,6 +400,7 @@
|
||||||
<tabstop>m_treeSkins</tabstop>
|
<tabstop>m_treeSkins</tabstop>
|
||||||
<tabstop>m_grpTray</tabstop>
|
<tabstop>m_grpTray</tabstop>
|
||||||
<tabstop>m_checkMonochromeIcons</tabstop>
|
<tabstop>m_checkMonochromeIcons</tabstop>
|
||||||
|
<tabstop>m_checkCountUnreadMessages</tabstop>
|
||||||
<tabstop>m_checkEnableNotifications</tabstop>
|
<tabstop>m_checkEnableNotifications</tabstop>
|
||||||
<tabstop>m_checkHideWhenMinimized</tabstop>
|
<tabstop>m_checkHideWhenMinimized</tabstop>
|
||||||
<tabstop>m_checkHidden</tabstop>
|
<tabstop>m_checkHidden</tabstop>
|
||||||
|
|
|
@ -100,7 +100,8 @@ void SystemTrayIcon::show() {
|
||||||
void SystemTrayIcon::setNumber(int number, bool any_new_message) {
|
void SystemTrayIcon::setNumber(int number, bool any_new_message) {
|
||||||
Q_UNUSED(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));
|
setToolTip(QSL(APP_LONG_NAME));
|
||||||
QSystemTrayIcon::setIcon(QIcon(m_normalIcon));
|
QSystemTrayIcon::setIcon(QIcon(m_normalIcon));
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,9 @@ DVALUE(bool) GUI::HideMainWindowWhenMinimizedDef = false;
|
||||||
DKEY GUI::MonochromeTrayIcon = "monochrome_tray_icon";
|
DKEY GUI::MonochromeTrayIcon = "monochrome_tray_icon";
|
||||||
DVALUE(bool) GUI::MonochromeTrayIconDef = false;
|
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";
|
DKEY GUI::UseTrayIcon = "use_tray_icon";
|
||||||
DVALUE(bool) GUI::UseTrayIconDef = true;
|
DVALUE(bool) GUI::UseTrayIconDef = true;
|
||||||
|
|
||||||
|
|
|
@ -185,6 +185,9 @@ namespace GUI {
|
||||||
KEY MonochromeTrayIcon;
|
KEY MonochromeTrayIcon;
|
||||||
VALUE(bool) MonochromeTrayIconDef;
|
VALUE(bool) MonochromeTrayIconDef;
|
||||||
|
|
||||||
|
KEY UnreadNumbersInTrayIcon;
|
||||||
|
VALUE(bool) UnreadNumbersInTrayIconDef;
|
||||||
|
|
||||||
KEY EnableNotifications;
|
KEY EnableNotifications;
|
||||||
VALUE(bool) EnableNotificationsDef;
|
VALUE(bool) EnableNotificationsDef;
|
||||||
|
|
||||||
|
|
|
@ -111,18 +111,12 @@ void FormEditOwnCloudAccount::performTest() {
|
||||||
else if (result.isLoaded()) {
|
else if (result.isLoaded()) {
|
||||||
if (!SystemFactory::isVersionEqualOrNewer(result.version(), OWNCLOUD_MIN_VERSION)) {
|
if (!SystemFactory::isVersionEqualOrNewer(result.version(), OWNCLOUD_MIN_VERSION)) {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr(
|
tr("Installed version: %1, required at least: %2.").arg(result.version(), OWNCLOUD_MIN_VERSION),
|
||||||
"Selected Nextcloud News server is running unsupported version %1. At least version %2 is required.").arg(
|
|
||||||
result.version(),
|
|
||||||
OWNCLOUD_MIN_VERSION),
|
|
||||||
tr("Selected Nextcloud News server is running unsupported version."));
|
tr("Selected Nextcloud News server is running unsupported version."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
|
||||||
tr(
|
tr("Installed version: %1, required at least: %2.").arg(result.version(), OWNCLOUD_MIN_VERSION),
|
||||||
"Nextcloud News server is okay, running with version %1, while at least version %2 is required.").arg(
|
|
||||||
result.version(),
|
|
||||||
OWNCLOUD_MIN_VERSION),
|
|
||||||
tr("Nextcloud News server is okay."));
|
tr("Nextcloud News server is okay."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,28 +134,14 @@ void FormEditTtRssAccount::performTest() {
|
||||||
}
|
}
|
||||||
else if (result.apiLevel() < TTRSS_MINIMAL_API_LEVEL) {
|
else if (result.apiLevel() < TTRSS_MINIMAL_API_LEVEL) {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
|
||||||
tr(
|
tr("Installed version: %1, required at least: %2.").arg(QString::number(result.apiLevel()),
|
||||||
"Selected Tiny Tiny RSS server is running unsupported version of API (%1). At least API level %2 is required.").arg(
|
QString::number(TTRSS_MINIMAL_API_LEVEL)),
|
||||||
QString::number(
|
|
||||||
result
|
|
||||||
.
|
|
||||||
apiLevel()),
|
|
||||||
QString
|
|
||||||
::
|
|
||||||
number(TTRSS_MINIMAL_API_LEVEL)),
|
|
||||||
tr("Selected Tiny Tiny RSS server is running unsupported version of API."));
|
tr("Selected Tiny Tiny RSS server is running unsupported version of API."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
|
m_ui->m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
|
||||||
tr(
|
tr("Installed version: %1, required at least: %2.").arg(QString::number(result.apiLevel()),
|
||||||
"Tiny Tiny RSS server is okay, running with API level %1, while at least API level %2 is required.").arg(
|
QString::number(TTRSS_MINIMAL_API_LEVEL)),
|
||||||
QString::number(
|
|
||||||
result
|
|
||||||
.
|
|
||||||
apiLevel()),
|
|
||||||
QString
|
|
||||||
::
|
|
||||||
number(TTRSS_MINIMAL_API_LEVEL)),
|
|
||||||
tr("Tiny Tiny RSS server is okay."));
|
tr("Tiny Tiny RSS server is okay."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue