Fixed #128.
This commit is contained in:
parent
3cb27e0cf8
commit
51f6edd33a
9 changed files with 76 additions and 26 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
Fixed:
|
||||
<ul>
|
||||
<li>Added ability to completely disable notifications (bug #128).</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>Improved popup informing about changes in newly installed version.</li>
|
||||
|
|
|
@ -732,6 +732,7 @@ void FormSettings::loadInterface() {
|
|||
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->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.
|
||||
QString current_theme = qApp->icons()->currentIconTheme();
|
||||
|
@ -834,6 +835,7 @@ void FormSettings::saveInterface() {
|
|||
|
||||
// Save notifications.
|
||||
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()));
|
||||
|
||||
// Save selected icon theme.
|
||||
|
|
3
src/gui/dialogs/formsettings.h
Normal file → Executable file
3
src/gui/dialogs/formsettings.h
Normal file → Executable file
|
@ -48,10 +48,9 @@ class FormSettings : public QDialog {
|
|||
protected:
|
||||
// Does check of controls before dialog can be submitted.
|
||||
bool doSaveCheck();
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *e);
|
||||
|
||||
protected slots:
|
||||
private slots:
|
||||
// Displays "restart" dialog if some critical settings changed.
|
||||
void promptForRestart();
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="m_stackedSettings">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_pageGeneral">
|
||||
<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>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_tabIconSkin">
|
||||
<attribute name="title">
|
||||
|
@ -636,24 +636,39 @@ Authors of this application are NOT responsible for lost data.</string>
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="m_grpNotifications">
|
||||
<widget class="QGroupBox" name="m_grpBaseNotifications">
|
||||
<property name="title">
|
||||
<string>Fancy && 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 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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="m_grpNotifications">
|
||||
<property name="title">
|
||||
<string>Fancy && modern popup notifications (This uses OS native notifications via D-Bus if available.)</string>
|
||||
</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>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="m_cmbNotificationPosition"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1765,5 +1780,21 @@ Authors of this application are NOT responsible for lost data.</string>
|
|||
</hint>
|
||||
</hints>
|
||||
</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>
|
||||
</ui>
|
||||
|
|
|
@ -66,10 +66,14 @@ Notification::~Notification() {
|
|||
qDebug("Destroying Notification instance.");
|
||||
}
|
||||
|
||||
bool Notification::areNotificationsActivated() {
|
||||
bool Notification::areFancyNotificationsEnabled() {
|
||||
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,
|
||||
QObject *invokation_target, const char *invokation_slot) {
|
||||
cancel();
|
||||
|
|
3
src/gui/notifications/notification.h
Normal file → Executable file
3
src/gui/notifications/notification.h
Normal file → Executable file
|
@ -35,7 +35,8 @@ class Notification : public QWidget {
|
|||
explicit Notification();
|
||||
virtual ~Notification();
|
||||
|
||||
static bool areNotificationsActivated();
|
||||
static bool areFancyNotificationsEnabled();
|
||||
static bool areNotificationsEnabled();
|
||||
|
||||
public slots:
|
||||
// Main methods for using the netofication.
|
||||
|
|
|
@ -198,19 +198,25 @@ void Application::showGuiMessage(const QString &title, const QString &message,
|
|||
QSystemTrayIcon::MessageIcon message_type, QWidget *parent,
|
||||
bool show_at_least_msgbox, const QIcon &custom_icon,
|
||||
QObject *invokation_target, const char *invokation_slot) {
|
||||
if (Notification::areNotificationsActivated()) {
|
||||
// Show OSD instead if tray icon bubble, depending on settings.
|
||||
if (custom_icon.isNull()) {
|
||||
notification()->notify(message, title, message_type, invokation_target, invokation_slot);
|
||||
if (Notification::areNotificationsEnabled()) {
|
||||
if (Notification::areFancyNotificationsEnabled()) {
|
||||
// Show OSD instead if tray icon bubble, depending on settings.
|
||||
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 {
|
||||
notification()->notify(message, title, custom_icon, invokation_target, invokation_slot);
|
||||
else if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
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);
|
||||
}
|
||||
else if (show_at_least_msgbox) {
|
||||
|
||||
if (show_at_least_msgbox) {
|
||||
// Tray icon or OSD is not available, display simple text box.
|
||||
MessageBox::show(parent, (QMessageBox::Icon) message_type, title, message);
|
||||
}
|
||||
|
|
|
@ -111,6 +111,9 @@ DVALUE(bool) GUI::HideMainWindowWhenMinimizedDef = false;
|
|||
DKEY GUI::UseTrayIcon = "use_tray_icon";
|
||||
DVALUE(bool) GUI::UseTrayIconDef = true;
|
||||
|
||||
DKEY GUI::EnableNotifications = "enable_notifications";
|
||||
DVALUE(bool) GUI::EnableNotificationsDef = true;
|
||||
|
||||
DKEY GUI::UseFancyNotifications = "use_fancy_notifications";
|
||||
DVALUE(bool) GUI::UseFancyNotificationsDef = true;
|
||||
|
||||
|
|
|
@ -126,6 +126,9 @@ namespace GUI {
|
|||
KEY UseTrayIcon;
|
||||
VALUE(bool) UseTrayIconDef;
|
||||
|
||||
KEY EnableNotifications;
|
||||
VALUE(bool) EnableNotificationsDef;
|
||||
|
||||
KEY UseFancyNotifications;
|
||||
VALUE(bool) UseFancyNotificationsDef;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue