adjust timeouts of toast notifications a bit

This commit is contained in:
Martin Rotter 2024-04-24 08:10:05 +02:00
parent e00bb3aaba
commit 32e8f1f2a0
6 changed files with 16 additions and 16 deletions

View File

@ -102,10 +102,11 @@
#define WEB_BROWSER_SCROLL_STEP 50.0 #define WEB_BROWSER_SCROLL_STEP 50.0
#define MAX_NUMBER_OF_REDIRECTIONS 4 #define MAX_NUMBER_OF_REDIRECTIONS 4
#define NOTIFICATIONS_MARGIN 16 #define NOTIFICATIONS_MARGIN 16
#define NOTIFICATIONS_WIDTH 300 #define NOTIFICATIONS_WIDTH 300
#define NOTIFICATIONS_TIMEOUT 15s #define NOTIFICATIONS_TIMEOUT 10s
#define NOTIFICATIONS_PAGE_SIZE 10 #define NOTIFICATION_SHORT_TIMEOUT 3s
#define NOTIFICATIONS_PAGE_SIZE 10
#define GOOGLE_SEARCH_URL "https://www.google.com/search?q=%1&ie=utf-8&oe=utf-8" #define GOOGLE_SEARCH_URL "https://www.google.com/search?q=%1&ie=utf-8&oe=utf-8"
#define GOOGLE_SUGGEST_URL "http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=%1" #define GOOGLE_SUGGEST_URL "http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=%1"

View File

@ -66,7 +66,7 @@ ArticleListNotification::ArticleListNotification(QWidget* parent)
} }
void ArticleListNotification::loadResults(const QHash<Feed*, QList<Message>>& new_messages) { void ArticleListNotification::loadResults(const QHash<Feed*, QList<Message>>& new_messages) {
setupTimedClosing(); setupTimedClosing(false);
m_newMessages = new_messages; m_newMessages = new_messages;

View File

@ -67,9 +67,9 @@ void BaseToastNotification::stopTimedClosing() {
} }
} }
void BaseToastNotification::setupTimedClosing() { void BaseToastNotification::setupTimedClosing(bool want_shorter_timeout) {
if (m_timerId < 0) { if (m_timerId < 0) {
m_timerId = startTimer(NOTIFICATIONS_TIMEOUT); m_timerId = startTimer(want_shorter_timeout ? NOTIFICATION_SHORT_TIMEOUT : NOTIFICATIONS_TIMEOUT);
qDebugNN << LOGSEC_NOTIFICATIONS << "Starting timed closing for notification."; qDebugNN << LOGSEC_NOTIFICATIONS << "Starting timed closing for notification.";
} }
@ -81,7 +81,7 @@ bool BaseToastNotification::eventFilter(QObject* watched, QEvent* event) {
} }
if (watched == this && event->type() == QEvent::Type::Leave) { if (watched == this && event->type() == QEvent::Type::Leave) {
setupTimedClosing(); setupTimedClosing(true);
} }
if (event->type() == QEvent::Type::MouseButtonPress || event->type() == QEvent::Type::MouseButtonRelease) { if (event->type() == QEvent::Type::MouseButtonPress || event->type() == QEvent::Type::MouseButtonRelease) {

View File

@ -25,7 +25,7 @@ class BaseToastNotification : public QDialog {
virtual void closeEvent(QCloseEvent* event); virtual void closeEvent(QCloseEvent* event);
void setupHeading(QLabel* lbl); void setupHeading(QLabel* lbl);
void setupTimedClosing(); void setupTimedClosing(bool want_shorter_timeout);
void setupCloseButton(QAbstractButton* btn); void setupCloseButton(QAbstractButton* btn);
void stopTimedClosing(); void stopTimedClosing();

View File

@ -12,12 +12,12 @@ ToastNotification::ToastNotification(Notification::Event event,
const GuiMessage& msg, const GuiMessage& msg,
const GuiAction& action, const GuiAction& action,
QWidget* parent) QWidget* parent)
: BaseToastNotification() { : BaseToastNotification(parent) {
m_ui.setupUi(this); m_ui.setupUi(this);
setupHeading(m_ui.m_lblTitle); setupHeading(m_ui.m_lblTitle);
setupCloseButton(m_ui.m_btnClose); setupCloseButton(m_ui.m_btnClose);
setupTimedClosing(); setupTimedClosing(false);
loadNotification(event, msg, action); loadNotification(event, msg, action);
} }

View File

@ -119,7 +119,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Screen</string> <string>Screen</string>
@ -129,7 +129,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QSpinBox" name="m_sbScreen"> <widget class="QSpinBox" name="m_sbScreen">
<property name="value"> <property name="value">
<number>99</number> <number>99</number>
@ -143,7 +143,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="3" column="1">
<widget class="QSpinBox" name="m_sbOpacity"> <widget class="QSpinBox" name="m_sbOpacity">
<property name="suffix"> <property name="suffix">
<string notr="true"> %</string> <string notr="true"> %</string>
@ -153,7 +153,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Opacity</string> <string>Opacity</string>
@ -193,7 +193,6 @@
<tabstop>m_sbWidth</tabstop> <tabstop>m_sbWidth</tabstop>
<tabstop>m_sbMargin</tabstop> <tabstop>m_sbMargin</tabstop>
<tabstop>m_sbScreen</tabstop> <tabstop>m_sbScreen</tabstop>
<tabstop>m_sbOpacity</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections> <connections>