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:
parent
c8345df3fe
commit
97aeb45a76
@ -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,29 +574,22 @@ void Preferences::showStackedPage(QListWidgetItem* item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::setNotificationPreviewVisible(bool state)
|
void Preferences::showNotificationPreview()
|
||||||
{
|
{
|
||||||
if (!state && m_notification) {
|
if (ui->useOSDNotifications->isChecked()) {
|
||||||
m_notifPosition = m_notification.data()->pos();
|
if (m_notification) {
|
||||||
delete m_notification.data();
|
m_notifPosition = m_notification.data()->pos();
|
||||||
|
delete m_notification.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_notification = new DesktopNotification(true);
|
||||||
|
m_notification.data()->setHeading(tr("OSD Notification"));
|
||||||
|
m_notification.data()->setText(tr("Drag it on the screen to place it where you want."));
|
||||||
|
m_notification.data()->move(m_notifPosition);
|
||||||
|
m_notification.data()->show();
|
||||||
}
|
}
|
||||||
|
else if (ui->useNativeSystemNotifications->isChecked()) {
|
||||||
if (state) {
|
mApp->desktopNotifications()->nativeNotificationPreview();
|
||||||
if (ui->useOSDNotifications->isChecked()) {
|
|
||||||
if (m_notification) {
|
|
||||||
m_notifPosition = m_notification.data()->pos();
|
|
||||||
delete m_notification.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_notification = new DesktopNotification(true);
|
|
||||||
m_notification.data()->setHeading(tr("OSD Notification"));
|
|
||||||
m_notification.data()->setText(tr("Drag it on the screen to place it where you want."));
|
|
||||||
m_notification.data()->move(m_notifPosition);
|
|
||||||
m_notification.data()->show();
|
|
||||||
}
|
|
||||||
else if (ui->useNativeSystemNotifications->isChecked()) {
|
|
||||||
mApp->desktopNotifications()->nativeNotificationPreview();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
|
||||||
|
@ -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><b>Notifications</b></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><b>Notifications</b></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><b>Note: </b>You can change position of OSD Notification by dragging it on the screen.</string>
|
<string><b>Note: </b>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">
|
||||||
|
Loading…
Reference in New Issue
Block a user