diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/notificationpopup.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/notificationpopup.h b/src/notificationpopup.h index 2246129..722fef5 100644 --- a/src/notificationpopup.h +++ b/src/notificationpopup.h @@ -16,6 +16,7 @@ #include <QDesktopWidget> #include <QDebug> #include "widgets/scrolltext/scrolltext.h" +#include <QSettings> #include <memory> @@ -25,6 +26,7 @@ class NotificationPopup : public QWidget QLabel m_icon, m_title; ScrollText m_message; std::unique_ptr<QWebEngineNotification> notification; + QSettings settings; public: NotificationPopup(QWidget *parent) : QWidget(parent) @@ -64,7 +66,9 @@ public: int y = 40; - QTimer::singleShot(10000,this,[=](){ + this->update(); + + QTimer::singleShot(settings.value("notificationTimeOut",5000).toInt(),this,[=](){ onClosed(); }); @@ -96,7 +100,7 @@ public: notification->show(); connect(notification.get(), &QWebEngineNotification::closed, this, &NotificationPopup::onClosed); - QTimer::singleShot(10000, notification.get(), [&] () { onClosed(); }); + QTimer::singleShot(settings.value("notificationTimeOut",5000).toInt(), notification.get(), [&] () { onClosed(); }); this->adjustSize(); qApp->processEvents(); @@ -104,6 +108,8 @@ public: int x = QApplication::desktop()->geometry().width()-(this->width()+10); int y = 40; + this->update(); + QPropertyAnimation *a = new QPropertyAnimation(this,"pos"); a->setDuration(200); a->setStartValue(QApplication::desktop()->mapToGlobal(QPoint(x+this->width(),y))); |