This commit is contained in:
Martin Rotter 2015-11-25 10:51:42 +01:00
parent 3cb27e0cf8
commit 51f6edd33a
9 changed files with 76 additions and 26 deletions

View file

@ -21,6 +21,7 @@
Fixed: Fixed:
<ul> <ul>
<li>Added ability to completely disable notifications (bug #128).</li>
<li>Better info in popup notification when many feeds are updated.</li> <li>Better info in popup notification when many feeds are updated.</li>
<li>Fixed obtaining of contents in RSS 2.0 feed entries. (bug #130)</li> <li>Fixed obtaining of contents in RSS 2.0 feed entries. (bug #130)</li>
<li>Improved popup informing about changes in newly installed version.</li> <li>Improved popup informing about changes in newly installed version.</li>

View file

@ -732,6 +732,7 @@ void FormSettings::loadInterface() {
m_ui->m_cmbNotificationPosition->addItem(tr("Bottom-right corner"), Qt::BottomRightCorner); m_ui->m_cmbNotificationPosition->addItem(tr("Bottom-right corner"), Qt::BottomRightCorner);
m_ui->m_cmbNotificationPosition->addItem(tr("Top-right corner"), Qt::TopRightCorner); m_ui->m_cmbNotificationPosition->addItem(tr("Top-right corner"), Qt::TopRightCorner);
m_ui->m_cmbNotificationPosition->setCurrentIndex(m_ui->m_cmbNotificationPosition->findData(static_cast<Qt::Corner>(settings->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt()))); m_ui->m_cmbNotificationPosition->setCurrentIndex(m_ui->m_cmbNotificationPosition->findData(static_cast<Qt::Corner>(settings->value(GROUP(GUI), SETTING(GUI::FancyNotificationsPosition)).toInt())));
m_ui->m_grpBaseNotifications->setChecked(settings->value(GROUP(GUI), SETTING(GUI::EnableNotifications)).toBool());
// Load settings of icon theme. // Load settings of icon theme.
QString current_theme = qApp->icons()->currentIconTheme(); QString current_theme = qApp->icons()->currentIconTheme();
@ -834,6 +835,7 @@ void FormSettings::saveInterface() {
// Save notifications. // Save notifications.
settings->setValue(GROUP(GUI), GUI::UseFancyNotifications, m_ui->m_grpNotifications->isChecked()); settings->setValue(GROUP(GUI), GUI::UseFancyNotifications, m_ui->m_grpNotifications->isChecked());
settings->setValue(GROUP(GUI), GUI::EnableNotifications, m_ui->m_grpBaseNotifications->isChecked());
settings->setValue(GROUP(GUI), GUI::FancyNotificationsPosition, static_cast<Qt::Corner>(m_ui->m_cmbNotificationPosition->itemData(m_ui->m_cmbNotificationPosition->currentIndex()).toInt())); settings->setValue(GROUP(GUI), GUI::FancyNotificationsPosition, static_cast<Qt::Corner>(m_ui->m_cmbNotificationPosition->itemData(m_ui->m_cmbNotificationPosition->currentIndex()).toInt()));
// Save selected icon theme. // Save selected icon theme.

3
src/gui/dialogs/formsettings.h Normal file → Executable file
View file

@ -48,10 +48,9 @@ class FormSettings : public QDialog {
protected: protected:
// Does check of controls before dialog can be submitted. // Does check of controls before dialog can be submitted.
bool doSaveCheck(); bool doSaveCheck();
bool eventFilter(QObject *obj, QEvent *e); bool eventFilter(QObject *obj, QEvent *e);
protected slots: private slots:
// Displays "restart" dialog if some critical settings changed. // Displays "restart" dialog if some critical settings changed.
void promptForRestart(); void promptForRestart();

View file

@ -88,7 +88,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="QStackedWidget" name="m_stackedSettings"> <widget class="QStackedWidget" name="m_stackedSettings">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="m_pageGeneral"> <widget class="QWidget" name="m_pageGeneral">
<layout class="QFormLayout" name="formLayout_5"> <layout class="QFormLayout" name="formLayout_5">
@ -463,7 +463,7 @@ Authors of this application are NOT responsible for lost data.</string>
<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">
@ -636,24 +636,39 @@ Authors of this application are NOT responsible for lost data.</string>
</widget> </widget>
</item> </item>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="m_grpNotifications"> <widget class="QGroupBox" name="m_grpBaseNotifications">
<property name="title"> <property name="title">
<string>Fancy &amp;&amp; modern popup notifications (This uses OS native notifications via D-Bus if available.)</string> <string>Enable notifications</string>
</property>
<property name="flat">
<bool>false</bool>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QFormLayout" name="formLayout_23"> <layout class="QHBoxLayout" name="horizontalLayout_16">
<item row="0" column="0"> <item>
<widget class="QLabel" name="m_lblNotificationPosition"> <widget class="QGroupBox" name="m_grpNotifications">
<property name="text"> <property name="title">
<string>Notification position</string> <string>Fancy &amp;&amp; modern popup notifications (This uses OS native notifications via D-Bus if available.)</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout_23">
<item row="0" column="0">
<widget class="QLabel" name="m_lblNotificationPosition">
<property name="text">
<string>Notification position</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="m_cmbNotificationPosition"/>
</item>
</layout>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QComboBox" name="m_cmbNotificationPosition"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -1765,5 +1780,21 @@ Authors of this application are NOT responsible for lost data.</string>
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>m_grpBaseNotifications</sender>
<signal>toggled(bool)</signal>
<receiver>m_grpNotifications</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>624</x>
<y>82</y>
</hint>
<hint type="destinationlabel">
<x>624</x>
<y>89</y>
</hint>
</hints>
</connection>
</connections> </connections>
</ui> </ui>

View file

@ -66,10 +66,14 @@ Notification::~Notification() {
qDebug("Destroying Notification instance."); qDebug("Destroying Notification instance.");
} }
bool Notification::areNotificationsActivated() { bool Notification::areFancyNotificationsEnabled() {
return qApp->settings()->value(GROUP(GUI), SETTING(GUI::UseFancyNotifications)).toBool(); return qApp->settings()->value(GROUP(GUI), SETTING(GUI::UseFancyNotifications)).toBool();
} }
bool Notification::areNotificationsEnabled() {
return qApp->settings()->value(GROUP(GUI), SETTING(GUI::EnableNotifications)).toBool();
}
void Notification::notify(const QString &text, const QString &title, const QIcon &icon, void Notification::notify(const QString &text, const QString &title, const QIcon &icon,
QObject *invokation_target, const char *invokation_slot) { QObject *invokation_target, const char *invokation_slot) {
cancel(); cancel();

3
src/gui/notifications/notification.h Normal file → Executable file
View file

@ -35,7 +35,8 @@ class Notification : public QWidget {
explicit Notification(); explicit Notification();
virtual ~Notification(); virtual ~Notification();
static bool areNotificationsActivated(); static bool areFancyNotificationsEnabled();
static bool areNotificationsEnabled();
public slots: public slots:
// Main methods for using the netofication. // Main methods for using the netofication.

View file

@ -198,19 +198,25 @@ void Application::showGuiMessage(const QString &title, const QString &message,
QSystemTrayIcon::MessageIcon message_type, QWidget *parent, QSystemTrayIcon::MessageIcon message_type, QWidget *parent,
bool show_at_least_msgbox, const QIcon &custom_icon, bool show_at_least_msgbox, const QIcon &custom_icon,
QObject *invokation_target, const char *invokation_slot) { QObject *invokation_target, const char *invokation_slot) {
if (Notification::areNotificationsActivated()) { if (Notification::areNotificationsEnabled()) {
// Show OSD instead if tray icon bubble, depending on settings. if (Notification::areFancyNotificationsEnabled()) {
if (custom_icon.isNull()) { // Show OSD instead if tray icon bubble, depending on settings.
notification()->notify(message, title, message_type, invokation_target, invokation_slot); if (custom_icon.isNull()) {
notification()->notify(message, title, message_type, invokation_target, invokation_slot);
}
else {
notification()->notify(message, title, custom_icon, invokation_target, invokation_slot);
}
return;
} }
else { else if (SystemTrayIcon::isSystemTrayActivated()) {
notification()->notify(message, title, custom_icon, invokation_target, invokation_slot); trayIcon()->showMessage(title, message, message_type, TRAY_ICON_BUBBLE_TIMEOUT, invokation_target, invokation_slot);
return;
} }
} }
else if (SystemTrayIcon::isSystemTrayActivated()) {
trayIcon()->showMessage(title, message, message_type, TRAY_ICON_BUBBLE_TIMEOUT, invokation_target, invokation_slot); if (show_at_least_msgbox) {
}
else if (show_at_least_msgbox) {
// Tray icon or OSD is not available, display simple text box. // Tray icon or OSD is not available, display simple text box.
MessageBox::show(parent, (QMessageBox::Icon) message_type, title, message); MessageBox::show(parent, (QMessageBox::Icon) message_type, title, message);
} }

View file

@ -111,6 +111,9 @@ DVALUE(bool) GUI::HideMainWindowWhenMinimizedDef = false;
DKEY GUI::UseTrayIcon = "use_tray_icon"; DKEY GUI::UseTrayIcon = "use_tray_icon";
DVALUE(bool) GUI::UseTrayIconDef = true; DVALUE(bool) GUI::UseTrayIconDef = true;
DKEY GUI::EnableNotifications = "enable_notifications";
DVALUE(bool) GUI::EnableNotificationsDef = true;
DKEY GUI::UseFancyNotifications = "use_fancy_notifications"; DKEY GUI::UseFancyNotifications = "use_fancy_notifications";
DVALUE(bool) GUI::UseFancyNotificationsDef = true; DVALUE(bool) GUI::UseFancyNotificationsDef = true;

View file

@ -126,6 +126,9 @@ namespace GUI {
KEY UseTrayIcon; KEY UseTrayIcon;
VALUE(bool) UseTrayIconDef; VALUE(bool) UseTrayIconDef;
KEY EnableNotifications;
VALUE(bool) EnableNotificationsDef;
KEY UseFancyNotifications; KEY UseFancyNotifications;
VALUE(bool) UseFancyNotificationsDef; VALUE(bool) UseFancyNotificationsDef;