From 761548792a525b30b4e3f85f8cdc675ae4db06cb Mon Sep 17 00:00:00 2001 From: keshavbhatt Date: Sun, 11 Apr 2021 02:52:45 +0530 Subject: implemented notification timeout spinbox in settings --- src/mainwindow.cpp | 11 +++++++-- src/settingswidget.cpp | 7 ++++++ src/settingswidget.h | 4 +++ src/settingswidget.ui | 66 ++++++++++++++++++++++++++++++++++---------------- 4 files changed, 65 insertions(+), 23 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 41b6429..3dfe4e6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -18,6 +18,8 @@ MainWindow::MainWindow(QWidget *parent) qApp->setQuitOnLastWindowClosed(false); lightPalette = qApp->palette(); + lightPalette.setColor(QPalette::Window,QColor("#F0F0F0"));//whatsapp light palette + setWindowTitle(QApplication::applicationName()); setWindowIcon(QIcon(":/icons/app/icon-256.png")); @@ -110,11 +112,12 @@ void MainWindow::updateWindowTheme() palette.setColor(QPalette::Disabled,QPalette::HighlightedText,QColor(127,127,127)); qApp->setPalette(palette); this->webEngine->setStyleSheet("QWebEngineView{background:#131C21;}"); //whatsapp dark color + //this->webEngine->page()->setBackgroundColor(QColor("#131C21;")); //whatsapp dark color } else{ - this->webEngine->setStyleSheet("QWebEngineView{background:#F0F0F0;}"); //whatsapp light color - lightPalette.setColor(QPalette::Window,QColor("#F0F0F0")); qApp->setPalette(lightPalette); + this->webEngine->setStyleSheet("QWebEngineView{background:#F0F0F0;}"); //whatsapp light color + //this->webEngine->page()->setBackgroundColor(QColor("#F0F0F0;")); //whatsapp light color } setNotificationPresenter(webEngine->page()->profile()); @@ -185,6 +188,10 @@ void MainWindow::init_settingWidget() } }); + connect(settingsWidget,&SettingsWidget::notificationPopupTimeOutChanged,[=](){ + setNotificationPresenter(this->webEngine->page()->profile()); + }); + settingsWidget->appLockSetChecked(settings.value("lockscreen",false).toBool()); //spell checker diff --git a/src/settingswidget.cpp b/src/settingswidget.cpp index d90b673..2b23845 100644 --- a/src/settingswidget.cpp +++ b/src/settingswidget.cpp @@ -22,6 +22,7 @@ SettingsWidget::SettingsWidget(QWidget *parent, QString engineCachePath, QString ui->themeComboBox->setCurrentText(utils::toCamelCase(settings.value("windowTheme","light").toString())); ui->userAgentLineEdit->setText(settings.value("useragent",defaultUserAgentStr).toString()); ui->enableSpellCheck->setChecked(settings.value("sc_enabled",true).toBool()); + ui->notificationTimeOutspinBox->setValue(settings.value("notificationTimeOut",9000).toInt()/1000); this->setCurrentPasswordText("Current Password: " +QByteArray::fromBase64(settings.value("asdfg").toString().toUtf8())+""); @@ -299,3 +300,9 @@ void SettingsWidget::on_showPermissionsButton_clicked() permissionDialog->show(); } + +void SettingsWidget::on_notificationTimeOutspinBox_valueChanged(int arg1) +{ + settings.setValue("notificationTimeOut",arg1*1000); + emit notificationPopupTimeOutChanged(); +} diff --git a/src/settingswidget.h b/src/settingswidget.h index 737b987..ff33b04 100644 --- a/src/settingswidget.h +++ b/src/settingswidget.h @@ -26,6 +26,8 @@ signals: void init_lock(); void dictChanged(QString dict); void spellCheckChanged(bool checked); + void notificationPopupTimeOutChanged(); + public: explicit SettingsWidget(QWidget *parent = nullptr,QString engineCachePath = "", QString enginePersistentStoragePath = ""); @@ -73,6 +75,8 @@ private slots: void on_showPermissionsButton_clicked(); + void on_notificationTimeOutspinBox_valueChanged(int arg1); + private: Ui::SettingsWidget *ui; QString engineCachePath,enginePersistentStoragePath; diff --git a/src/settingswidget.ui b/src/settingswidget.ui index 21348f7..e5fcea3 100644 --- a/src/settingswidget.ui +++ b/src/settingswidget.ui @@ -106,27 +106,6 @@ background:transparent; - - - - Disable Auto Playback of Media - - - - - - - Mute Audio from Page - - - - - - - Disable Notifications PopUp - - - @@ -149,6 +128,51 @@ background:transparent; + + + + Disable Notifications PopUp + + + + + + + Disable Auto Playback of Media + + + + + + + Mute Audio from Page + + + + + + + + + PopUp timeout + + + + + + + Secs + + + 2 + + + 20 + + + + + -- cgit v1.2.3