From f6da6ffa0e33e243ee9a53f93a8eb587cfa602e3 Mon Sep 17 00:00:00 2001 From: keshavbhatt Date: Sun, 11 Apr 2021 02:02:08 +0530 Subject: added setting obj --- src/notificationpopup.h | 10 ++++++++-- 1 file 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 #include #include "widgets/scrolltext/scrolltext.h" +#include #include @@ -25,6 +26,7 @@ class NotificationPopup : public QWidget QLabel m_icon, m_title; ScrollText m_message; std::unique_ptr 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))); -- cgit v1.2.3