diff options
author | 2021-04-11 02:02:08 +0530 | |
---|---|---|
committer | 2021-04-11 02:02:08 +0530 | |
commit | f6da6ffa0e33e243ee9a53f93a8eb587cfa602e3 (patch) | |
tree | dc5a68d8c122efc463ee724f4ef9738265d40042 /src | |
parent | 58b2ad939444a315ff8e7057e86b3d97bd26c0dc (diff) | |
download | whatsie-f6da6ffa0e33e243ee9a53f93a8eb587cfa602e3.tar.gz whatsie-f6da6ffa0e33e243ee9a53f93a8eb587cfa602e3.zip |
added setting obj
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))); |