1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Preferences: Add preview button for notifications

This commit is contained in:
David Rosca 2017-01-21 18:38:19 +01:00
parent c8345df3fe
commit 97aeb45a76
3 changed files with 121 additions and 93 deletions

View File

@ -399,8 +399,7 @@ Preferences::Preferences(BrowserWindow* window)
ui->useOSDNotifications->setChecked(true); ui->useOSDNotifications->setChecked(true);
} }
connect(ui->useNativeSystemNotifications, SIGNAL(toggled(bool)), this, SLOT(setNotificationPreviewVisible(bool))); connect(ui->notificationPreview, &QPushButton::clicked, this, &Preferences::showNotificationPreview);
connect(ui->useOSDNotifications, SIGNAL(toggled(bool)), this, SLOT(setNotificationPreviewVisible(bool)));
ui->doNotUseNotifications->setChecked(!settings.value("Enabled", true).toBool()); ui->doNotUseNotifications->setChecked(!settings.value("Enabled", true).toBool());
m_notifPosition = settings.value("Position", QPoint(10, 10)).toPoint(); m_notifPosition = settings.value("Position", QPoint(10, 10)).toPoint();
@ -559,7 +558,10 @@ void Preferences::showStackedPage(QListWidgetItem* item)
ui->caption->setText("<b>" + item->text() + "</b>"); ui->caption->setText("<b>" + item->text() + "</b>");
ui->stackedWidget->setCurrentIndex(index); ui->stackedWidget->setCurrentIndex(index);
setNotificationPreviewVisible(index == 9); if (m_notification) {
m_notifPosition = m_notification.data()->pos();
delete m_notification.data();
}
if (index == 10) { if (index == 10) {
m_pluginsList->load(); m_pluginsList->load();
@ -572,14 +574,8 @@ void Preferences::showStackedPage(QListWidgetItem* item)
} }
} }
void Preferences::setNotificationPreviewVisible(bool state) void Preferences::showNotificationPreview()
{ {
if (!state && m_notification) {
m_notifPosition = m_notification.data()->pos();
delete m_notification.data();
}
if (state) {
if (ui->useOSDNotifications->isChecked()) { if (ui->useOSDNotifications->isChecked()) {
if (m_notification) { if (m_notification) {
m_notifPosition = m_notification.data()->pos(); m_notifPosition = m_notification.data()->pos();
@ -596,7 +592,6 @@ void Preferences::setNotificationPreviewVisible(bool state)
mApp->desktopNotifications()->nativeNotificationPreview(); mApp->desktopNotifications()->nativeNotificationPreview();
} }
} }
}
void Preferences::makeQupZillaDefault() void Preferences::makeQupZillaDefault()
{ {

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * QupZilla - Qt web browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com> * Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -86,7 +86,7 @@ private slots:
void setProgressBarColorIcon(QColor col = QColor()); void setProgressBarColorIcon(QColor col = QColor());
void selectCustomProgressBarColor(); void selectCustomProgressBarColor();
void setNotificationPreviewVisible(bool state); void showNotificationPreview();
void makeQupZillaDefault(); void makeQupZillaDefault();

View File

@ -2134,68 +2134,8 @@
</widget> </widget>
<widget class="QWidget" name="notificationsPage"> <widget class="QWidget" name="notificationsPage">
<layout class="QGridLayout" name="gridLayout_17"> <layout class="QGridLayout" name="gridLayout_17">
<item row="0" column="0" colspan="4"> <item row="2" column="6">
<widget class="QLabel" name="label_41"> <spacer name="horizontalSpacer_5">
<property name="text">
<string>&lt;b&gt;Notifications&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QRadioButton" name="useOSDNotifications">
<property name="text">
<string>Use OSD Notifications</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="3">
<widget class="QRadioButton" name="useNativeSystemNotifications">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Use Native System Notifications (Linux only)</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QRadioButton" name="doNotUseNotifications">
<property name="text">
<string>Do not use Notifications</string>
</property>
</widget>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer_4">
<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="1" column="0">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="4">
<spacer name="horizontalSpacer_17">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -2231,7 +2171,73 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="6" column="1" colspan="4"> <item row="4" column="4" colspan="3">
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_41">
<property name="text">
<string>&lt;b&gt;Notifications&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="8" column="1">
<spacer name="verticalSpacer_4">
<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="2" column="1" colspan="3">
<widget class="QRadioButton" name="useNativeSystemNotifications">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Use Native System Notifications (Linux only)</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QRadioButton" name="doNotUseNotifications">
<property name="text">
<string>Do not use Notifications</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="1" colspan="5">
<widget class="QLabel" name="label_43"> <widget class="QLabel" name="label_43">
<property name="text"> <property name="text">
<string>&lt;b&gt;Note: &lt;/b&gt;You can change position of OSD Notification by dragging it on the screen.</string> <string>&lt;b&gt;Note: &lt;/b&gt;You can change position of OSD Notification by dragging it on the screen.</string>
@ -2241,7 +2247,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="1">
<spacer name="verticalSpacer_5"> <spacer name="verticalSpacer_5">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -2257,6 +2263,33 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="1" colspan="3">
<widget class="QRadioButton" name="useOSDNotifications">
<property name="text">
<string>Use OSD Notifications</string>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QPushButton" name="notificationPreview">
<property name="text">
<string>Preview</string>
</property>
</widget>
</item>
<item row="2" column="4">
<spacer name="horizontalSpacer_27">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="extensionsPage"> <widget class="QWidget" name="extensionsPage">
@ -2381,8 +2414,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>96</width> <width>560</width>
<height>28</height> <height>70</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_14"> <layout class="QHBoxLayout" name="horizontalLayout_14">