aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--snap/snapcraft.yaml2
-rw-r--r--src/WhatsApp.pro2
-rw-r--r--src/common.h8
-rw-r--r--src/downloadmanagerwidget.cpp30
-rw-r--r--src/downloadwidget.cpp30
-rw-r--r--src/elidedlabel.cpp12
-rw-r--r--src/elidedlabel.h6
-rw-r--r--src/icons.qrc9
-rw-r--r--src/icons/app/whatsapp-message-32.pngbin0 -> 1797 bytes
-rw-r--r--src/icons/icon-512.xcfbin410837 -> 0 bytes
-rw-r--r--src/icons/others/Histogram.pngbin291 -> 0 bytes
-rw-r--r--src/icons/others/Omonitor.pngbin13176 -> 0 bytes
-rw-r--r--src/icons/others/greendot.pngbin7109 -> 0 bytes
-rw-r--r--src/icons/others/monitor.pngbin3922 -> 0 bytes
-rw-r--r--src/icons/others/snapcraft.pngbin1602 -> 0 bytes
-rw-r--r--src/icons/others/snapcraft.svg59
-rw-r--r--src/icons/others/tt_tbc_head.pngbin83727 -> 0 bytes
-rw-r--r--src/icons/others/wall_placeholder_180.jpgbin5155 -> 0 bytes
-rw-r--r--src/icons/tiktok-downloader.pngbin76834 -> 0 bytes
-rw-r--r--src/lock.cpp15
-rw-r--r--src/lock.h61
-rw-r--r--src/main.cpp6
-rw-r--r--src/mainwindow.cpp263
-rw-r--r--src/mainwindow.h25
-rw-r--r--src/rateapp.cpp3
-rw-r--r--src/settingswidget.cpp254
-rw-r--r--src/settingswidget.h166
-rw-r--r--src/settingswidget.ui917
-rw-r--r--src/utils.cpp14
-rw-r--r--src/utils.h2
-rw-r--r--src/webenginepage.cpp21
-rw-r--r--src/webview.cpp4
-rw-r--r--src/webview.h15
33 files changed, 1205 insertions, 719 deletions
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 1228d00..23850cb 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,5 +1,5 @@
name: whatsie
-version: '3.0'
+version: '4.0'
summary: Qt Based WhatsApp Client
description: |
Fast Light weight WhatsApp Client based on Qt's WebEngine, With lots of settings and packed goodies.
diff --git a/src/WhatsApp.pro b/src/WhatsApp.pro
index 083f339..b83ec8e 100644
--- a/src/WhatsApp.pro
+++ b/src/WhatsApp.pro
@@ -42,7 +42,7 @@ BUILD_TIMESTAMP="\\\"$$system(date -u +\""%Y-%m-%dT%H:%M:%SUTC\"")\\\""
DEFINES += GIT_HASH=$$GIT_HASH GIT_BRANCH=$$GIT_BRANCH BUILD_TIMESTAMP=$$BUILD_TIMESTAMP
# Set program version
-VERSION = 3.0
+VERSION = 4.0
DEFINES += VERSIONSTR=\\\"$${VERSION}\\\"
# You can also make your code fail to compile if you use deprecated APIs.
diff --git a/src/common.h b/src/common.h
index 92a67c2..0d57ab8 100644
--- a/src/common.h
+++ b/src/common.h
@@ -2,9 +2,13 @@
#define COMMON_H
#include <QString>
-//QString defaultUserAgentStr = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.4389.114 Safari/537.36";
-
+// userAgent
QString defaultUserAgentStr = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36";
+//appAutoLock
+int defaultAppAutoLockDuration = 60;
+bool defaultAppAutoLock = false;
+double defaultZoomFactorMaximized = 1.50;
+
#endif // COMMON_H
diff --git a/src/downloadmanagerwidget.cpp b/src/downloadmanagerwidget.cpp
index 6480e10..7f5b300 100644
--- a/src/downloadmanagerwidget.cpp
+++ b/src/downloadmanagerwidget.cpp
@@ -3,6 +3,7 @@
#include "downloadwidget.h"
#include <QFileDialog>
+#include <QStandardPaths>
#include <QWebEngineDownloadItem>
DownloadManagerWidget::DownloadManagerWidget(QWidget *parent)
@@ -14,23 +15,18 @@ void DownloadManagerWidget::downloadRequested(
QWebEngineDownloadItem *download) {
Q_ASSERT(download &&
download->state() == QWebEngineDownloadItem::DownloadRequested);
- QString path;
-
- bool usenativeFileDialog =
- settings.value("useNativeFileDialog", false).toBool();
- if (usenativeFileDialog == false) {
- path = QFileDialog::getSaveFileName(this, tr("Save as"), download->downloadFileName(),
- tr("Any file (*)"), nullptr,
- QFileDialog::DontUseNativeDialog);
- } else {
- path = QFileDialog::getSaveFileName(this, tr("Save as"), download->downloadFileName(),
- tr("Any file (*)"), nullptr);
- }
-
- if (path.isEmpty())
- return;
-
- download->setDownloadFileName(path);
+ QString path =
+ settings
+ .value("defaultDownloadLocation",
+ QStandardPaths::writableLocation(
+ QStandardPaths::DownloadLocation) +
+ QDir::separator() + QApplication::applicationName())
+ .toString();
+ QDir d;
+ d.mkpath(path);
+
+ download->setDownloadFileName(path + QDir::separator() +
+ download->downloadFileName());
download->accept();
add(new DownloadWidget(download));
show();
diff --git a/src/downloadwidget.cpp b/src/downloadwidget.cpp
index 4af29d3..d228074 100644
--- a/src/downloadwidget.cpp
+++ b/src/downloadwidget.cpp
@@ -11,7 +11,7 @@ DownloadWidget::DownloadWidget(QWebEngineDownloadItem *download,
m_dstName->setText(QFileInfo(m_download->downloadDirectory()).fileName());
m_srcUrl->setText(m_download->url().toDisplayString());
- connect(m_cancelButton, &QPushButton::clicked, [this](bool) {
+ connect(m_cancelButton, &QPushButton::clicked, m_download, [this](bool) {
if (m_download->state() == QWebEngineDownloadItem::DownloadInProgress)
m_download->cancel();
else
@@ -53,30 +53,30 @@ void DownloadWidget::updateWidget() {
m_progressBar->setValue(qRound(100 * receivedBytes / totalBytes));
m_progressBar->setDisabled(false);
m_progressBar->setFormat(tr("%p% - %1 of %2 downloaded - %3/s")
- .arg(withUnit(receivedBytes))
- .arg(withUnit(totalBytes))
- .arg(withUnit(bytesPerSecond)));
+ .arg(withUnit(receivedBytes),
+ withUnit(totalBytes),
+ withUnit(bytesPerSecond)));
} else {
m_progressBar->setValue(0);
m_progressBar->setDisabled(false);
- m_progressBar->setFormat(tr("unknown size - %1 downloaded - %2/s")
- .arg(withUnit(receivedBytes))
- .arg(withUnit(bytesPerSecond)));
+ m_progressBar->setFormat(
+ tr("unknown size - %1 downloaded - %2/s")
+ .arg(withUnit(receivedBytes), withUnit(bytesPerSecond)));
}
break;
case QWebEngineDownloadItem::DownloadCompleted:
m_progressBar->setValue(100);
m_progressBar->setDisabled(true);
- m_progressBar->setFormat(tr("completed - %1 downloaded - %2/s")
- .arg(withUnit(receivedBytes))
- .arg(withUnit(bytesPerSecond)));
+ m_progressBar->setFormat(
+ tr("completed - %1 downloaded - %2/s")
+ .arg(withUnit(receivedBytes), withUnit(bytesPerSecond)));
break;
case QWebEngineDownloadItem::DownloadCancelled:
m_progressBar->setValue(0);
m_progressBar->setDisabled(true);
- m_progressBar->setFormat(tr("cancelled - %1 downloaded - %2/s")
- .arg(withUnit(receivedBytes))
- .arg(withUnit(bytesPerSecond)));
+ m_progressBar->setFormat(
+ tr("cancelled - %1 downloaded - %2/s")
+ .arg(withUnit(receivedBytes), withUnit(bytesPerSecond)));
break;
case QWebEngineDownloadItem::DownloadInterrupted:
m_progressBar->setValue(0);
@@ -87,11 +87,11 @@ void DownloadWidget::updateWidget() {
}
if (state == QWebEngineDownloadItem::DownloadInProgress) {
- static QIcon cancelIcon(QStringLiteral(":/icons/stop-line.png"));
+ static QIcon cancelIcon(":/icons/stop-line.png");
m_cancelButton->setIcon(cancelIcon);
m_cancelButton->setToolTip(tr("Stop downloading"));
} else {
- static QIcon removeIcon(QStringLiteral(":/icons/close-fill.png"));
+ static QIcon removeIcon(":/icons/close-fill.png");
m_cancelButton->setIcon(removeIcon);
m_cancelButton->setToolTip(tr("Remove from list"));
}
diff --git a/src/elidedlabel.cpp b/src/elidedlabel.cpp
index b88ed4f..e870959 100644
--- a/src/elidedlabel.cpp
+++ b/src/elidedlabel.cpp
@@ -5,19 +5,19 @@
#include <QResizeEvent>
#include <QStyle>
-ElidedLabel::ElidedLabel(QWidget *parent, Qt::WindowFlags f)
- : QLabel(parent, f), m_elide_mode(Qt::ElideRight) {
+ElidedLabel::ElidedLabel(QWidget *parent)
+ : QLabel(parent), m_elide_mode(Qt::ElideRight) {
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
}
-ElidedLabel::ElidedLabel(const QString &txt, QWidget *parent, Qt::WindowFlags f)
- : QLabel(txt, parent, f), m_elide_mode(Qt::ElideRight) {
+ElidedLabel::ElidedLabel(const QString &txt, QWidget *parent)
+ : QLabel(txt, parent), m_elide_mode(Qt::ElideRight) {
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
}
ElidedLabel::ElidedLabel(const QString &txt, Qt::TextElideMode elideMode,
- QWidget *parent, Qt::WindowFlags f)
- : QLabel(txt, parent, f), m_elide_mode(elideMode) {
+ QWidget *parent)
+ : QLabel(txt, parent), m_elide_mode(elideMode) {
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
}
diff --git a/src/elidedlabel.h b/src/elidedlabel.h
index 1ce5210..7dc610a 100644
--- a/src/elidedlabel.h
+++ b/src/elidedlabel.h
@@ -16,9 +16,9 @@ private:
public:
- ElidedLabel(QWidget* parent = NULL, Qt::WindowFlags f = 0);
- ElidedLabel(const QString& txt, QWidget* parent = NULL, Qt::WindowFlags f = 0);
- ElidedLabel(const QString& txt, Qt::TextElideMode elideMode = Qt::ElideRight, QWidget* parent = NULL, Qt::WindowFlags f = 0);
+ ElidedLabel(QWidget* parent = NULL);
+ ElidedLabel(const QString& txt, QWidget* parent = NULL);
+ ElidedLabel(const QString& txt, Qt::TextElideMode elideMode = Qt::ElideRight, QWidget* parent = NULL);
public:
// Set the elide mode used for displaying text.
diff --git a/src/icons.qrc b/src/icons.qrc
index b5d99cb..6c3a11c 100644
--- a/src/icons.qrc
+++ b/src/icons.qrc
@@ -80,8 +80,6 @@
<file>icons/white/white_arrow-right-line.png</file>
<file>icons/white/white_arrow-left-line.png</file>
<file>icons/white/white_picture-in-picture-line.png</file>
- <file>icons/others/monitor.png</file>
- <file>icons/others/wall_placeholder_180.jpg</file>
<file>icons/categories/devices-and-iot.png</file>
<file>icons/categories/social.png</file>
<file>icons/categories/server-and-cloud.png</file>
@@ -102,7 +100,6 @@
<file>icons/categories/development.png</file>
<file>icons/categories/books-and-reference.png</file>
<file>icons/categories/utilities.png</file>
- <file>icons/others/snapcraft.png</file>
<file>icons/mail-line.png</file>
<file>icons/app/icon-256.png</file>
<file>icons/app/icon-128.png</file>
@@ -111,7 +108,6 @@
<file>icons/app/icon-16.png</file>
<file>icons/app/icon-512.png</file>
<file>icons/app/resize.sh</file>
- <file>icons/others/greendot.png</file>
<file>icons/anticlockwise-line.png</file>
<file>icons/arrow-go-back-line.png</file>
<file>icons/arrow-go-forward-line.png</file>
@@ -133,14 +129,10 @@
<file>icons/fullscreen-line.png</file>
<file>icons/clockwise-fill.png</file>
<file>icons/anticlockwise-fill.png</file>
- <file>icons/others/Histogram.png</file>
- <file>icons/tiktok-downloader.png</file>
- <file>icons/icon-512.xcf</file>
<file>icons/blur-off-line.png</file>
<file>icons/lock-line.png</file>
<file>icons/lock-unlock-line.png</file>
<file>icons/funds-line.png</file>
- <file>icons/others/tt_tbc_head.png</file>
<file>icons/app/whatsapp-message.svg</file>
<file>icons/app/whatsapp.svg</file>
<file>icons/wa_bg.png</file>
@@ -403,5 +395,6 @@
<file>icons/flags/zw.png</file>
<file>icons/minus.png</file>
<file>icons/plus.png</file>
+ <file>icons/app/whatsapp-message-32.png</file>
</qresource>
</RCC>
diff --git a/src/icons/app/whatsapp-message-32.png b/src/icons/app/whatsapp-message-32.png
new file mode 100644
index 0000000..77e3b56
--- /dev/null
+++ b/src/icons/app/whatsapp-message-32.png
Binary files differ
diff --git a/src/icons/icon-512.xcf b/src/icons/icon-512.xcf
deleted file mode 100644
index b9275f6..0000000
--- a/src/icons/icon-512.xcf
+++ /dev/null
Binary files differ
diff --git a/src/icons/others/Histogram.png b/src/icons/others/Histogram.png
deleted file mode 100644
index d2bddb3..0000000
--- a/src/icons/others/Histogram.png
+++ /dev/null
Binary files differ
diff --git a/src/icons/others/Omonitor.png b/src/icons/others/Omonitor.png
deleted file mode 100644
index f1c1a64..0000000
--- a/src/icons/others/Omonitor.png
+++ /dev/null
Binary files differ
diff --git a/src/icons/others/greendot.png b/src/icons/others/greendot.png
deleted file mode 100644
index be914c6..0000000
--- a/src/icons/others/greendot.png
+++ /dev/null
Binary files differ
diff --git a/src/icons/others/monitor.png b/src/icons/others/monitor.png
deleted file mode 100644
index 7ba4759..0000000
--- a/src/icons/others/monitor.png
+++ /dev/null
Binary files differ
diff --git a/src/icons/others/snapcraft.png b/src/icons/others/snapcraft.png
deleted file mode 100644
index da50180..0000000
--- a/src/icons/others/snapcraft.png
+++ /dev/null
Binary files differ
diff --git a/src/icons/others/snapcraft.svg b/src/icons/others/snapcraft.svg
deleted file mode 100644
index a14c440..0000000
--- a/src/icons/others/snapcraft.svg
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- aria-hidden="true"
- focusable="false"
- width="1em"
- height="1em"
- style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
- preserveAspectRatio="xMidYMid meet"
- viewBox="0 0 24 24"
- id="svg2"
- version="1.1"
- inkscape:version="0.91 r13725"
- sodipodi:docname="snapcraft.svg">
- <metadata
- id="metadata10">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs8" />
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="1311"
- inkscape:window-height="744"
- id="namedview6"
- showgrid="false"
- inkscape:zoom="9.8333333"
- inkscape:cx="12"
- inkscape:cy="12"
- inkscape:window-x="55"
- inkscape:window-y="24"
- inkscape:window-maximized="1"
- inkscape:current-layer="svg2" />
- <path
- d="M13.804 13.367V5.69l5.292 2.362l-5.292 5.315zM3.701 23.514l6.49-12.22l2.847 2.843L3.7 23.514zM0 .486l13.355 4.848v8.484L0 .486zm21.803 4.848H14.11L24 9.748z"
- fill="#626262"
- id="path4"
- style="fill-opacity:1;fill:#9fa0a4" />
-</svg>
diff --git a/src/icons/others/tt_tbc_head.png b/src/icons/others/tt_tbc_head.png
deleted file mode 100644
index 20cac2c..0000000
--- a/src/icons/others/tt_tbc_head.png
+++ /dev/null
Binary files differ
diff --git a/src/icons/others/wall_placeholder_180.jpg b/src/icons/others/wall_placeholder_180.jpg
deleted file mode 100644
index d696b5f..0000000
--- a/src/icons/others/wall_placeholder_180.jpg
+++ /dev/null
Binary files differ
diff --git a/src/icons/tiktok-downloader.png b/src/icons/tiktok-downloader.png
deleted file mode 100644
index 7ca80f6..0000000
--- a/src/icons/tiktok-downloader.png
+++ /dev/null
Binary files differ
diff --git a/src/lock.cpp b/src/lock.cpp
index 4eb65d1..c2b8a13 100644
--- a/src/lock.cpp
+++ b/src/lock.cpp
@@ -23,11 +23,7 @@ Lock::Lock(QWidget *parent) : QWidget(parent), ui(new Ui::Lock) {
animate();
if (settings.value("asdfg").isValid() == false) {
- isLocked = false;
- ui->signup->show();
- ui->login->hide();
- animate();
- ui->passcode1->setFocus();
+ signUp();
} else {
lock_app();
}
@@ -43,6 +39,15 @@ Lock::Lock(QWidget *parent) : QWidget(parent), ui(new Ui::Lock) {
ui->wrong->setStyleSheet(capsStyle);
}
+
+void Lock::signUp(){
+ isLocked = false;
+ ui->signup->show();
+ ui->login->hide();
+ animate();
+ ui->passcode1->setFocus();
+}
+
void Lock::animate() {
ui->centerWidget->hide();
QPropertyAnimation *a =
diff --git a/src/lock.h b/src/lock.h
index f079c9d..972e6ed 100644
--- a/src/lock.h
+++ b/src/lock.h
@@ -1,55 +1,50 @@
#ifndef LOCK_H
#define LOCK_H
-#include <QWidget>
#include <QSettings>
+#include <QWidget>
namespace Ui {
class Lock;
}
-class Lock : public QWidget
-{
- Q_OBJECT
+class Lock : public QWidget {
+ Q_OBJECT
public:
- explicit Lock(QWidget *parent = nullptr);
- ~Lock();
- bool isLocked = true;
+ explicit Lock(QWidget *parent = nullptr);
+ ~Lock();
+ bool isLocked = true;
private slots:
- void on_passcode1_textChanged(const QString &arg1);
-
- void on_passcode2_textChanged(const QString &arg1);
-
- void on_setPass_clicked();
- bool check_password_set();
- void on_unlock_clicked();
-
- void on_passcodeLogin_textChanged(const QString &arg1);
-
- void on_passcodeLogin_returnPressed();
-
- bool getCapsLockOn();
- void checkCaps();
- void on_cancelSetting_clicked();
-
- void animate();
+ void on_passcode1_textChanged(const QString &arg1);
+ void on_passcode2_textChanged(const QString &arg1);
+ void on_setPass_clicked();
+ bool check_password_set();
+ void on_unlock_clicked();
+ void on_passcodeLogin_textChanged(const QString &arg1);
+ void on_passcodeLogin_returnPressed();
+ bool getCapsLockOn();
+ void checkCaps();
+ void on_cancelSetting_clicked();
+ void animate();
public slots:
- void lock_app();
- void applyThemeQuirks();
+ void lock_app();
+ void applyThemeQuirks();
+ void signUp();
signals:
- void passwordSet();
- void passwordNotSet();
- void unLocked();
+ void passwordSet();
+ void passwordNotSet();
+ void unLocked();
protected slots:
- void keyReleaseEvent(QKeyEvent *event);
+ void keyReleaseEvent(QKeyEvent *event);
+
+ bool event(QEvent *e);
- bool event(QEvent *e);
private:
- Ui::Lock *ui;
- QSettings settings;
+ Ui::Lock *ui;
+ QSettings settings;
};
#endif // LOCK_H
diff --git a/src/main.cpp b/src/main.cpp
index 68fbe3a..57c2852 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -38,23 +38,19 @@ int main(int argc, char *argv[]) {
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-logging --single-process");
QApplication app(argc, argv);
+ app.setQuitOnLastWindowClosed(false);
app.setWindowIcon(QIcon(":/icons/app/icon-256.png"));
-
QApplication::setApplicationName("WhatSie");
QApplication::setOrganizationName("org.keshavnrj.ubuntu");
QApplication::setApplicationVersion(VERSIONSTR);
-
QString appname = QApplication::applicationName();
-// allow multiple instances in debug builds
-#ifndef QT_DEBUG
RunGuard guard("org.keshavnrj.ubuntu." + appname);
if (!guard.tryToRun()) {
QMessageBox::critical(0, appname,
"An instance of " + appname + " is already running.");
return 0;
}
-#endif
QWebEngineSettings::defaultSettings()->setAttribute(
QWebEngineSettings::PluginsEnabled, true);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index f8b29d1..683072f 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -8,53 +8,90 @@
#include <QWebEngineNotification>
extern QString defaultUserAgentStr;
+extern double defaultZoomFactorMaximized;
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), notificationsTitleRegExp("^\\([1-9]\\d*\\).*"),
- trayIconRead(":/icons/app/whatsapp.svg"),
- trayIconUnread(":/icons/app/whatsapp-message.svg") {
- this->setObjectName("MainWindow");
-
- qApp->setQuitOnLastWindowClosed(false);
-
- lightPalette = qApp->palette();
- lightPalette.setColor(QPalette::Window,
- QColor(240, 240, 240)); // whatsapp light palette
+ trayIconRead(":/icons/app/icon-32.png"),
+ trayIconUnread(":/icons/app/whatsapp-message-32.png") {
+ setObjectName("MainWindow");
setWindowTitle(QApplication::applicationName());
setWindowIcon(QIcon(":/icons/app/icon-256.png"));
setMinimumWidth(750);
setMinimumHeight(640);
-
restoreGeometry(settings.value("geometry").toByteArray());
restoreState(settings.value("windowState").toByteArray());
-
+ initThemes();
createActions();
createTrayIcon();
createWebEngine();
-
- if (settings.value("lockscreen", false).toBool()) {
- init_lock();
- }
- QTimer *timer = new QTimer(this);
- timer->setInterval(1000);
- connect(timer, &QTimer::timeout, lockWidget, [=]() {
- if (settings.value("asdfg").isValid()) {
- if (lockWidget && lockWidget->isLocked == false) {
- timer->stop();
- }
- }
- });
- timer->start();
-
init_settingWidget();
-
- // quit application if the download manager window is the only remaining
- // window
- m_downloadManagerWidget.setAttribute(Qt::WA_QuitOnClose, false);
-
+ initRateWidget();
+ tryLock();
updateWindowTheme();
+}
+void MainWindow::initThemes() {
+ // Light
+ lightPalette.setColor(QPalette::Window, QColor(240, 240, 240));
+ lightPalette.setColor(QPalette::WindowText, QColor(0, 0, 0));
+ lightPalette.setColor(QPalette::Button, QColor(240, 240, 240));
+ lightPalette.setColor(QPalette::Light, QColor(180, 180, 180));
+ lightPalette.setColor(QPalette::Midlight, QColor(200, 200, 200));
+ lightPalette.setColor(QPalette::Dark, QColor(225, 225, 225));
+ lightPalette.setColor(QPalette::Text, QColor(0, 0, 0));
+ lightPalette.setColor(QPalette::BrightText, QColor(0, 0, 0));
+ lightPalette.setColor(QPalette::ButtonText, QColor(0, 0, 0));
+ lightPalette.setColor(QPalette::Base, QColor(237, 237, 237));
+ lightPalette.setColor(QPalette::Shadow, QColor(20, 20, 20));
+ lightPalette.setColor(QPalette::Highlight, QColor(76, 163, 224));
+ lightPalette.setColor(QPalette::HighlightedText, QColor(0, 0, 0));
+ lightPalette.setColor(QPalette::Link, QColor(0, 162, 232));
+ lightPalette.setColor(QPalette::AlternateBase, QColor(225, 225, 225));
+ lightPalette.setColor(QPalette::ToolTipBase, QColor(240, 240, 240));
+ lightPalette.setColor(QPalette::ToolTipText, QColor(0, 0, 0));
+ lightPalette.setColor(QPalette::LinkVisited, QColor(222, 222, 222));
+ lightPalette.setColor(QPalette::Disabled, QPalette::WindowText,
+ QColor(115, 115, 115));
+ lightPalette.setColor(QPalette::Disabled, QPalette::Text,
+ QColor(115, 115, 115));
+ lightPalette.setColor(QPalette::Disabled, QPalette::ButtonText,
+ QColor(115, 115, 115));
+ lightPalette.setColor(QPalette::Disabled, QPalette::Highlight,
+ QColor(190, 190, 190));
+ lightPalette.setColor(QPalette::Disabled, QPalette::HighlightedText,
+ QColor(115, 115, 115));
+
+ // Dark
+ darkPalette.setColor(QPalette::Window, QColor(17, 27, 33));
+ darkPalette.setColor(QPalette::Text, Qt::white);
+ darkPalette.setColor(QPalette::WindowText, Qt::white);
+ darkPalette.setColor(QPalette::Base, QColor(32, 44, 51));
+ darkPalette.setColor(QPalette::AlternateBase, QColor(95, 108, 115));
+ darkPalette.setColor(QPalette::ToolTipBase, QColor(66, 66, 66));
+ darkPalette.setColor(QPalette::ToolTipText, QColor(192, 192, 192));
+ darkPalette.setColor(QPalette::Dark, QColor(35, 35, 35));
+ darkPalette.setColor(QPalette::Shadow, QColor(20, 20, 20));
+ darkPalette.setColor(QPalette::Button, QColor(17, 27, 33));
+ darkPalette.setColor(QPalette::ButtonText, Qt::white);
+ darkPalette.setColor(QPalette::BrightText, Qt::red);
+ darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
+ darkPalette.setColor(QPalette::Highlight, QColor(38, 140, 196));
+ darkPalette.setColor(QPalette::HighlightedText, Qt::white);
+ darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText,
+ QColor(127, 127, 127));
+ darkPalette.setColor(QPalette::Disabled, QPalette::Window,
+ QColor(65, 65, 67));
+ darkPalette.setColor(QPalette::Disabled, QPalette::Highlight,
+ QColor(80, 80, 80));
+ darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText,
+ QColor(127, 127, 127));
+ darkPalette.setColor(QPalette::Disabled, QPalette::Text,
+ QColor(127, 127, 127));
+}
+
+void MainWindow::initRateWidget() {
RateApp *rateApp = new RateApp(this, "snap://whatsie", 5, 5, 1000 * 30);
rateApp->setWindowTitle(QApplication::applicationName() + " | " +
tr("Rate Application"));
@@ -82,10 +119,10 @@ void MainWindow::loadAppWithArgument(const QString &arg) {
// The WhatsApp Messenger application
if (arg.contains("://app")) {
- qWarning() << "WhatsApp Messenger application";
this->show(); // restore app
return;
}
+
// PASSED SCHEME whatsapp://send?text=Hello%2C%20World!&phone=919568388397"
// CONVERTED URI
// https://web.whatsapp.com/send?phone=919568388397&text=Hello%2C%20World New
@@ -100,10 +137,8 @@ void MainWindow::loadAppWithArgument(const QString &arg) {
// create send url equivalent
phone = query.queryItemValue("phone");
text = query.queryItemValue("text");
-
phoneStr = phone.isEmpty() ? "" : "phone=" + phone;
textStr = text.isEmpty() ? "" : "text=" + text;
-
urlStr = "https://web.whatsapp.com/send?" + phoneStr + "&" + textStr;
qWarning() << "Loading" << urlStr;
this->webEngine->page()->load(QUrl(urlStr));
@@ -117,6 +152,7 @@ void MainWindow::updatePageTheme() {
if (windowTheme == "dark") {
webPageTheme = "web dark";
}
+#ifdef QT_DEBUG
if (webEngine && webEngine->page()) {
webEngine->page()->runJavaScript(
"document.querySelector('body').className='" + webPageTheme + "';",
@@ -124,6 +160,7 @@ void MainWindow::updatePageTheme() {
qDebug() << "Value is: " << result.toString() << Qt::endl;
});
}
+#endif
}
void MainWindow::resizeEvent(QResizeEvent *event) {
@@ -133,35 +170,12 @@ void MainWindow::resizeEvent(QResizeEvent *event) {
}
void MainWindow::updateWindowTheme() {
+ qApp->setStyle(QStyleFactory::create(
+ settings.value("widgetStyle", "Fusion").toString()));
if (settings.value("windowTheme", "light").toString() == "dark") {
- qApp->setStyle(QStyleFactory::create("fusion"));
- QPalette palette;
- palette.setColor(QPalette::Window, QColor(38, 45, 49));
- palette.setColor(QPalette::Text, Qt::white);
- palette.setColor(QPalette::WindowText, Qt::white);
- palette.setColor(QPalette::Base, QColor(50, 55, 57));
- palette.setColor(QPalette::AlternateBase, QColor(95, 108, 115));
- palette.setColor(QPalette::ToolTipBase, QColor(66, 66, 66));
- palette.setColor(QPalette::Disabled, QPalette::Window, QColor(65, 65, 67));
- palette.setColor(QPalette::ToolTipText, QColor("silver"));
- palette.setColor(QPalette::Disabled, QPalette::Text, QColor(127, 127, 127));
- palette.setColor(QPalette::Dark, QColor(35, 35, 35));
- palette.setColor(QPalette::Shadow, QColor(20, 20, 20));
- palette.setColor(QPalette::Button, QColor(38, 45, 49));
- palette.setColor(QPalette::ButtonText, Qt::white);
- palette.setColor(QPalette::Disabled, QPalette::ButtonText,
- QColor(127, 127, 127));
- palette.setColor(QPalette::BrightText, Qt::red);
- palette.setColor(QPalette::Link, QColor(42, 130, 218));
- palette.setColor(QPalette::Highlight, QColor(38, 140, 196));
- palette.setColor(QPalette::Disabled, QPalette::Highlight,
- QColor(80, 80, 80));
- palette.setColor(QPalette::HighlightedText, Qt::white);
- palette.setColor(QPalette::Disabled, QPalette::HighlightedText,
- QColor(127, 127, 127));
- qApp->setPalette(palette);
+ qApp->setPalette(darkPalette);
this->webEngine->setStyleSheet(
- "QWebEngineView{background:#131C21;}"); // whatsapp dark color
+ "QWebEngineView{background:rgb(17, 27, 33);}"); // whatsapp dark color
} else {
qApp->setPalette(lightPalette);
this->webEngine->setStyleSheet(
@@ -170,9 +184,7 @@ void MainWindow::updateWindowTheme() {
QList<QWidget *> widgets = this->findChildren<QWidget *>();
- foreach (QWidget *w, widgets) {
- w->setPalette(qApp->palette());
- }
+ foreach (QWidget *w, widgets) { w->setPalette(qApp->palette()); }
setNotificationPresenter(webEngine->page()->profile());
@@ -199,6 +211,9 @@ void MainWindow::init_settingWidget() {
settingsWidget->setWindowFlags(Qt::Dialog);
connect(settingsWidget, SIGNAL(init_lock()), this, SLOT(init_lock()));
+ connect(settingsWidget, SIGNAL(change_lock_password()), this,
+ SLOT(change_lock_password()));
+
connect(settingsWidget, SIGNAL(updateWindowTheme()), this,
SLOT(updateWindowTheme()));
connect(settingsWidget, SIGNAL(updatePageTheme()), this,
@@ -243,10 +258,24 @@ void MainWindow::init_settingWidget() {
connect(
settingsWidget, &SettingsWidget::zoomChanged, settingsWidget, [=]() {
- double currentFactor = settings.value("zoomFactor", 1.0).toDouble();
- webEngine->page()->setZoomFactor(currentFactor);
+ if (windowState() == Qt::WindowNoState) {
+ double currentFactor = settings.value("zoomFactor", 1.0).toDouble();
+ webEngine->page()->setZoomFactor(currentFactor);
+ }
});
+ connect(settingsWidget, &SettingsWidget::zoomMaximizedChanged,
+ settingsWidget, [=]() {
+ if (windowState() == Qt::WindowMaximized ||
+ windowState() == Qt::WindowFullScreen) {
+ double currentFactor = settings
+ .value("zoomFactorMaximized",
+ defaultZoomFactorMaximized)
+ .toDouble();
+ webEngine->page()->setZoomFactor(currentFactor);
+ }
+ });
+
connect(settingsWidget, &SettingsWidget::notificationPopupTimeOutChanged,
settingsWidget, [=]() {
setNotificationPresenter(this->webEngine->page()->profile());
@@ -263,6 +292,40 @@ void MainWindow::init_settingWidget() {
}
}
+void MainWindow::changeEvent(QEvent *e) {
+ if (e->type() == QEvent::WindowStateChange) {
+ handleZoomOnWindowStateChange(static_cast<QWindowStateChangeEvent *>(e));
+ }
+ QMainWindow::changeEvent(e);
+}
+
+void MainWindow::handleZoomOnWindowStateChange(QWindowStateChangeEvent *ev) {
+ if (settingsWidget != nullptr) {
+ if (ev->oldState().testFlag(Qt::WindowMaximized) &&
+ windowState().testFlag(Qt::WindowNoState)) {
+ emit settingsWidget->zoomChanged();
+ } else if ((!ev->oldState().testFlag(Qt::WindowMaximized) &&
+ windowState().testFlag(Qt::WindowMaximized)) ||
+ (!ev->oldState().testFlag(Qt::WindowMaximized) &&
+ windowState().testFlag(Qt::WindowFullScreen))) {
+ emit settingsWidget->zoomMaximizedChanged();
+ }
+ }
+}
+
+void MainWindow::handleZoom() {
+ if (windowState() == Qt::WindowMaximized ||
+ windowState() == Qt::WindowFullScreen) {
+ double currentFactor =
+ settings.value("zoomFactorMaximized", defaultZoomFactorMaximized)
+ .toDouble();
+ webEngine->page()->setZoomFactor(currentFactor);
+ } else if (windowState() == Qt::WindowNoState) {
+ double currentFactor = settings.value("zoomFactor", 1.0).toDouble();
+ webEngine->page()->setZoomFactor(currentFactor);
+ }
+}
+
void MainWindow::lockApp() {
if (lockWidget != nullptr && lockWidget->isLocked)
return;
@@ -278,7 +341,9 @@ void MainWindow::lockApp() {
.scaled(42, 42, Qt::KeepAspectRatio, Qt::SmoothTransformation));
msgBox.setInformativeText("Do you want to setup App lock now ?");
msgBox.setStandardButtons(QMessageBox::Cancel);
- QPushButton *setAppLock = new QPushButton("Yes", nullptr);
+ QPushButton *setAppLock =
+ new QPushButton(this->style()->standardIcon(QStyle::SP_DialogYesButton),
+ "Yes", nullptr);
msgBox.addButton(setAppLock, QMessageBox::NoRole);
connect(setAppLock, &QPushButton::clicked, setAppLock,
[=]() { init_lock(); });
@@ -484,15 +549,18 @@ void MainWindow::createTrayIcon() {
}
void MainWindow::init_lock() {
+
if (lockWidget == nullptr) {
lockWidget = new Lock(this);
lockWidget->setObjectName("lockWidget");
}
+
lockWidget->setWindowFlags(Qt::Widget);
lockWidget->setStyleSheet("QWidget#login{background-color:palette(window)};"
"QWidget#signup{background-color:palette(window)}");
lockWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
lockWidget->setGeometry(this->rect());
+ // lockWidget->disconnect();
connect(lockWidget, &Lock::passwordNotSet, settingsWidget, [=]() {
settings.setValue("lockscreen", false);
@@ -504,28 +572,38 @@ void MainWindow::init_lock() {
});
connect(lockWidget, &Lock::passwordSet, settingsWidget, [=]() {
- // enable disable lock screen
if (settings.value("asdfg").isValid()) {
settingsWidget->setCurrentPasswordText(
- "Current Password: <i>" +
- QByteArray::fromBase64(settings.value("asdfg").toString().toUtf8()) +
- "</i>");
+ QByteArray::fromBase64(settings.value("asdfg").toString().toUtf8()));
} else {
- settingsWidget->setCurrentPasswordText(
- "Current Password: <i>Require setup</i>");
+ settingsWidget->setCurrentPasswordText("Require setup");
}
settingsWidget->appLockSetChecked(
settings.value("lockscreen", false).toBool());
});
+
lockWidget->applyThemeQuirks();
lockWidget->show();
if (settings.value("asdfg").isValid() &&
- settings.value("lockscreen").toBool() == true) {
+ settings.value("lockscreen").toBool()) {
lockWidget->lock_app();
+ } else if (settings.value("lockscreen").toBool() &&
+ !settings.value("asdfg").isValid()) {
+ lockWidget->signUp();
+ } else {
+ lockWidget->hide();
}
updateWindowTheme();
}
+void MainWindow::change_lock_password() {
+ settings.remove("asdfg");
+ settingsWidget->appLockSetChecked(false);
+ settingsWidget->clearAllData();
+ doReload(true);
+ init_lock();
+}
+
// check window state and set tray menus
void MainWindow::check_window_state() {
QObject *tray_icon_menu = this->findChild<QObject *>("trayIconMenu");
@@ -574,6 +652,10 @@ void MainWindow::init_globalWebProfile() {
false);
webSettings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled,
false);
+ webSettings->setAttribute(QWebEngineSettings::SpatialNavigationEnabled, true);
+ webSettings->setAttribute(QWebEngineSettings::JavascriptCanPaste, true);
+ webSettings->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard,
+ true);
webSettings->setAttribute(QWebEngineSettings::PlaybackRequiresUserGesture,
settings.value("autoPlayMedia", false).toBool());
}
@@ -622,7 +704,7 @@ void MainWindow::createWebPage(bool offTheRecord) {
QWebEnginePage *page = new WebEnginePage(profile, webEngine);
if (settings.value("windowTheme", "light").toString() == "dark") {
- page->setBackgroundColor(QColor(19, 28, 33)); // whatsapp dark bg color
+ page->setBackgroundColor(QColor(17, 27, 33)); // whatsapp dark bg color
} else {
page->setBackgroundColor(QColor(240, 240, 240)); // whatsapp light bg color
}
@@ -710,13 +792,14 @@ void MainWindow::handleWebViewTitleChanged(QString title) {
setWindowTitle(QApplication::applicationName() + ": " + title);
if (notificationsTitleRegExp.exactMatch(title)) {
- if (notificationsTitleRegExp.isEmpty() == false) {
- QString capturedTitle = notificationsTitleRegExp.capturedTexts().first();
+ if (notificationsTitleRegExp.isEmpty() == false &&
+ notificationsTitleRegExp.capturedTexts().isEmpty() == false) {
+ QString capturedTitle =
+ notificationsTitleRegExp.capturedTexts().constFirst();
QRegExp rgex("\\([^\\d]*(\\d+)[^\\d]*\\)");
rgex.setMinimal(true);
if (rgex.indexIn(capturedTitle) != -1) {
- qDebug() << rgex.capturedTexts();
- QString unreadMessageCount = rgex.capturedTexts().last();
+ QString unreadMessageCount = rgex.capturedTexts().constLast();
QString suffix =
unreadMessageCount.toInt() > 1 ? tr("messages") : tr("message");
restoreAction->setText(tr("Restore") + " | " + unreadMessageCount +
@@ -733,9 +816,9 @@ void MainWindow::handleWebViewTitleChanged(QString title) {
void MainWindow::handleLoadFinished(bool loaded) {
if (loaded) {
- // check if page has loaded correctly
checkLoadedCorrectly();
updatePageTheme();
+ handleZoom();
}
}
@@ -764,7 +847,7 @@ void MainWindow::checkLoadedCorrectly() {
quitAction->trigger();
} else {
- qWarning() << "Test 1 Loaded correctly value:" << result.toString();
+ qWarning() << "Test 1 loaded correctly value:" << result.toString();
}
});
}
@@ -816,6 +899,8 @@ void MainWindow::handleDownloadRequested(QWebEngineDownloadItem *download) {
void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason) {
Q_UNUSED(reason);
+ if (settings.value("minimizeOnTrayIconClick", false).toBool() == false)
+ return;
if (isVisible()) {
hide();
} else {
@@ -863,9 +948,9 @@ bool MainWindow::isPhoneNumber(const QString &phoneNumber) {
return reg.match(phoneNumber).hasMatch();
}
-void MainWindow::doReload() {
+void MainWindow::doReload(bool byPassCache) {
this->webEngine->triggerPageAction(QWebEnginePage::ReloadAndBypassCache,
- false);
+ byPassCache);
}
void MainWindow::toggleMute(const bool &checked) {
@@ -886,3 +971,15 @@ QString MainWindow::getPageTheme() {
}
return theme;
}
+
+void MainWindow::tryLock() {
+ if (settings.value("asdfg").isValid() &&
+ settings.value("lockscreen", false).toBool()) {
+ init_lock();
+ }
+ if (settings.value("asdfg").isValid() == false) {
+ settings.setValue("lockscreen", false);
+ settingsWidget->appLockSetChecked(false);
+ init_lock();
+ }
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 5ffe9b1..e1298b0 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -24,16 +24,15 @@
#include <QWebEngineSettings>
#include <QWebEngineView>
+#include "about.h"
+#include "dictionaries.h"
+#include "downloadmanagerwidget.h"
#include "lock.h"
#include "notificationpopup.h"
+#include "rateapp.h"
#include "requestinterceptor.h"
#include "settingswidget.h"
#include "webenginepage.h"
-
-#include "about.h"
-#include "dictionaries.h"
-#include "downloadmanagerwidget.h"
-#include "rateapp.h"
#include "webview.h"
class MainWindow : public QMainWindow {
@@ -53,9 +52,10 @@ public slots:
protected slots:
void closeEvent(QCloseEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
+ void changeEvent(QEvent *e) override;
private:
- QPalette lightPalette;
+ QPalette lightPalette, darkPalette;
void createActions();
void createTrayIcon();
void createWebEngine();
@@ -87,34 +87,37 @@ private:
private slots:
+ QString getPageTheme();
void iconActivated(QSystemTrayIcon::ActivationReason reason);
void messageClicked();
- void doReload();
+ void doReload(bool byPassCache = false);
void showAbout();
void notify(QString title, QString message);
void showSettings();
void handleCookieAdded(const QNetworkCookie &cookie);
-
- QString getPageTheme();
void toggleMute(const bool &checked);
void doAppReload();
void askToReloadPage();
void updateSettingsUserAgentWidget();
void fullScreenRequested(QWebEngineFullScreenRequest request);
-
void createWebPage(bool offTheRecord = false);
void init_settingWidget();
void init_globalWebProfile();
void check_window_state();
void init_lock();
void lockApp();
-
void checkLoadedCorrectly();
void loadingQuirk(QString test);
void setNotificationPresenter(QWebEngineProfile *profile);
void newChat();
bool isPhoneNumber(const QString &phoneNumber);
void quitApp();
+ void initRateWidget();
+ void initThemes();
+ void handleZoomOnWindowStateChange(QWindowStateChangeEvent *ev);
+ void handleZoom();
+ void change_lock_password();
+ void tryLock();
};
#endif // MAINWINDOW_H
diff --git a/src/rateapp.cpp b/src/rateapp.cpp
index f69080e..430716d 100644
--- a/src/rateapp.cpp
+++ b/src/rateapp.cpp
@@ -38,7 +38,7 @@ RateApp::RateApp(QWidget *parent, QString app_rating_url, int app_launch_count,
settings.setValue("app_install_time", QDateTime::currentSecsSinceEpoch());
} else if (settings.value("app_install_time").isValid()) {
- qDebug() << "RATEAPP should show:" << shouldShow();
+ //qDebug() << "RATEAPP should show:" << shouldShow();
if (shouldShow()) {
showTimer->start();
} else {
@@ -86,7 +86,6 @@ bool RateApp::shouldShow() {
}
RateApp::~RateApp() {
- qDebug() << "RateApp Obj deleted";
showTimer->disconnect();
showTimer->deleteLater();
delete ui;
diff --git a/src/settingswidget.cpp b/src/settingswidget.cpp
index b07340c..473e1a2 100644
--- a/src/settingswidget.cpp
+++ b/src/settingswidget.cpp
@@ -4,10 +4,14 @@
#include "mainwindow.h"
#include <QDateTime>
#include <QMessageBox>
+#include <QStyle>
#include "automatictheme.h"
extern QString defaultUserAgentStr;
+extern int defaultAppAutoLockDuration;
+extern bool defaultAppAutoLock;
+extern double defaultZoomFactorMaximized;
SettingsWidget::SettingsWidget(QWidget *parent, QString engineCachePath,
QString enginePersistentStoragePath)
@@ -20,6 +24,11 @@ SettingsWidget::SettingsWidget(QWidget *parent, QString engineCachePath,
ui->zoomFactorSpinBox->setRange(0.25, 5.0);
ui->zoomFactorSpinBox->setValue(settings.value("zoomFactor", 1.0).toDouble());
+ ui->zoomFactorSpinBoxMaximized->setRange(0.25, 5.0);
+ ui->zoomFactorSpinBoxMaximized->setValue(
+ settings.value("zoomFactorMaximized", defaultZoomFactorMaximized)
+ .toDouble());
+
ui->closeButtonActionComboBox->setCurrentIndex(
settings.value("closeButtonActionCombo", 0).toInt());
ui->notificationCheckBox->setChecked(
@@ -30,8 +39,12 @@ SettingsWidget::SettingsWidget(QWidget *parent, QString engineCachePath,
settings.value("autoPlayMedia", false).toBool());
ui->themeComboBox->setCurrentText(
utils::toCamelCase(settings.value("windowTheme", "light").toString()));
+
ui->userAgentLineEdit->setText(
settings.value("useragent", defaultUserAgentStr).toString());
+ ui->userAgentLineEdit->home(true);
+ ui->userAgentLineEdit->deselect();
+
ui->enableSpellCheck->setChecked(settings.value("sc_enabled", true).toBool());
ui->notificationTimeOutspinBox->setValue(
settings.value("notificationTimeOut", 9000).toInt() / 1000);
@@ -41,6 +54,25 @@ SettingsWidget::SettingsWidget(QWidget *parent, QString engineCachePath,
settings.value("useNativeFileDialog", false).toBool());
ui->startMinimized->setChecked(
settings.value("startMinimized", false).toBool());
+ ui->appAutoLockcheckBox->setChecked(
+ settings.value("appAutoLocking", defaultAppAutoLock).toBool());
+ ui->autoLockDurationSpinbox->setValue(
+ settings.value("autoLockDuration", defaultAppAutoLockDuration).toInt());
+ ui->minimizeOnTrayIconClick->setChecked(
+ settings.value("minimizeOnTrayIconClick", false).toBool());
+ ui->defaultDownloadLocation->setText(
+ settings
+ .value("defaultDownloadLocation",
+ QStandardPaths::writableLocation(
+ QStandardPaths::DownloadLocation) +
+ QDir::separator() + QApplication::applicationName())
+ .toString());
+
+ ui->styleComboBox->blockSignals(true);
+ ui->styleComboBox->addItems(QStyleFactory::keys());
+ ui->styleComboBox->blockSignals(false);
+ ui->styleComboBox->setCurrentText(
+ settings.value("widgetStyle", "Fusion").toString());
ui->automaticThemeCheckBox->blockSignals(true);
bool automaticThemeSwitching =
@@ -50,7 +82,7 @@ SettingsWidget::SettingsWidget(QWidget *parent, QString engineCachePath,
themeSwitchTimer = new QTimer(this);
themeSwitchTimer->setInterval(60000); // 1 min
- connect(themeSwitchTimer, &QTimer::timeout,
+ connect(themeSwitchTimer, &QTimer::timeout, &settings,
[=]() { themeSwitchTimerTimeout(); });
// instantly call the timeout slot if automatic theme switching enabled
@@ -60,9 +92,7 @@ SettingsWidget::SettingsWidget(QWidget *parent, QString engineCachePath,
updateAutomaticTheme();
this->setCurrentPasswordText(
- "Current Password: <i>" +
- QByteArray::fromBase64(settings.value("asdfg").toString().toUtf8()) +
- "</i>");
+ QByteArray::fromBase64(settings.value("asdfg").toString().toUtf8()));
applyThemeQuirks();
@@ -152,7 +182,11 @@ void SettingsWidget::updateAutomaticTheme() {
}
}
-SettingsWidget::~SettingsWidget() { delete ui; }
+SettingsWidget::~SettingsWidget() {
+ themeSwitchTimer->stop();
+ themeSwitchTimer->deleteLater();
+ delete ui;
+}
void SettingsWidget::loadDictionaries(QStringList dictionaries) {
// set up supported spellcheck dictionaries
@@ -240,7 +274,7 @@ void SettingsWidget::on_deleteCache_clicked() {
QPixmap(":/icons/information-line.png")
.scaled(42, 42, Qt::KeepAspectRatio, Qt::SmoothTransformation));
- msgBox.setInformativeText("Delete Application cache ?");
+ msgBox.setInformativeText("Delete Application cache?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
int ret = msgBox.exec();
@@ -263,14 +297,13 @@ void SettingsWidget::on_deletePersistentData_clicked() {
msgBox.setIconPixmap(
QPixmap(":/icons/information-line.png")
.scaled(42, 42, Qt::KeepAspectRatio, Qt::SmoothTransformation));
- msgBox.setInformativeText("Delete Application Cookies ?");
+ msgBox.setInformativeText("Delete Application Cookies?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
int ret = msgBox.exec();
switch (ret) {
case QMessageBox::Yes: {
- utils::delete_cache(this->persistentStoragePath());
- refresh();
+ clearAllData();
break;
}
case QMessageBox::No:
@@ -278,6 +311,12 @@ void SettingsWidget::on_deletePersistentData_clicked() {
}
}
+void SettingsWidget::clearAllData() {
+ utils::delete_cache(this->cachePath());
+ utils::delete_cache(this->persistentStoragePath());
+ refresh();
+}
+
void SettingsWidget::on_notificationCheckBox_toggled(bool checked) {
settings.setValue("disableNotificationPopups", checked);
}
@@ -356,21 +395,54 @@ void SettingsWidget::on_closeButtonActionComboBox_currentIndexChanged(
}
void SettingsWidget::appLockSetChecked(bool checked) {
+ ui->applock_checkbox->blockSignals(true);
ui->applock_checkbox->setChecked(checked);
+ ui->applock_checkbox->blockSignals(false);
}
void SettingsWidget::setCurrentPasswordText(QString str) {
- ui->current_password->setText(str);
+ ui->current_password->setStyleSheet(
+ "QLineEdit[echoMode=\"2\"]{lineedit-password-character: 9899}");
+ if (str == "Require setup") {
+ ui->current_password->setEchoMode(QLineEdit::Normal);
+ } else {
+ ui->current_password->setEchoMode(QLineEdit::Password);
+ ui->current_password->setText(str);
+ }
}
void SettingsWidget::on_applock_checkbox_toggled(bool checked) {
if (settings.value("asdfg").isValid()) {
settings.setValue("lockscreen", checked);
+ } else if (checked && !settings.value("asdfg").isValid()) {
+ settings.setValue("lockscreen", true);
+ if (checked)
+ showSetApplockPasswordDialog();
} else {
settings.setValue("lockscreen", false);
+ if (checked)
+ showSetApplockPasswordDialog();
}
- if (checked) {
- emit init_lock();
+}
+
+void SettingsWidget::showSetApplockPasswordDialog() {
+ QMessageBox msgBox;
+ msgBox.setText("App lock is not configured.");
+ msgBox.setIconPixmap(
+ QPixmap(":/icons/information-line.png")
+ .scaled(42, 42, Qt::KeepAspectRatio, Qt::SmoothTransformation));
+ msgBox.setInformativeText("Do you want to setup App lock now?");
+ msgBox.setStandardButtons(QMessageBox::Cancel);
+ QPushButton *setAppLock = new QPushButton(
+ this->style()->standardIcon(QStyle::SP_DialogYesButton), "Yes", nullptr);
+ msgBox.addButton(setAppLock, QMessageBox::NoRole);
+ connect(setAppLock, &QPushButton::clicked, setAppLock,
+ [=]() { emit init_lock(); });
+ int ret = msgBox.exec();
+ if (ret == QMessageBox::Cancel) {
+ ui->applock_checkbox->blockSignals(true);
+ ui->applock_checkbox->setChecked(false);
+ ui->applock_checkbox->blockSignals(false);
}
}
@@ -443,14 +515,15 @@ void SettingsWidget::on_automaticThemeCheckBox_toggled(bool checked) {
" | Automatic theme switcher setup");
automaticTheme->setWindowFlag(Qt::Dialog);
automaticTheme->setAttribute(Qt::WA_DeleteOnClose, true);
- connect(automaticTheme, &AutomaticTheme::destroyed, [=]() {
- bool automaticThemeSwitching =
- settings.value("automaticTheme", false).toBool();
- ui->automaticThemeCheckBox->setChecked(automaticThemeSwitching);
- if (automaticThemeSwitching)
- themeSwitchTimerTimeout();
- updateAutomaticTheme();
- });
+ connect(automaticTheme, &AutomaticTheme::destroyed,
+ ui->automaticThemeCheckBox, [=]() {
+ bool automaticThemeSwitching =
+ settings.value("automaticTheme", false).toBool();
+ ui->automaticThemeCheckBox->setChecked(automaticThemeSwitching);
+ if (automaticThemeSwitching)
+ themeSwitchTimerTimeout();
+ updateAutomaticTheme();
+ });
automaticTheme->show();
} else {
settings.setValue("automaticTheme", false);
@@ -462,11 +535,38 @@ void SettingsWidget::on_useNativeFileDialog_toggled(bool checked) {
settings.setValue("useNativeFileDialog", checked);
}
+void SettingsWidget::on_startMinimized_toggled(bool checked) {
+ settings.setValue("startMinimized", checked);
+}
+
+void SettingsWidget::on_appAutoLockcheckBox_toggled(bool checked) {
+ settings.setValue("appAutoLocking", checked);
+}
+
+void SettingsWidget::on_autoLockDurationSpinbox_valueChanged(int arg1) {
+ settings.setValue("autoLockDuration", arg1);
+}
+
+void SettingsWidget::on_resetAppAutoLockPushButton_clicked() {
+ ui->appAutoLockcheckBox->setChecked(defaultAppAutoLock);
+ ui->autoLockDurationSpinbox->setValue(defaultAppAutoLockDuration);
+}
+
+void SettingsWidget::on_minimizeOnTrayIconClick_toggled(bool checked) {
+ settings.setValue("minimizeOnTrayIconClick", checked);
+}
+
+void SettingsWidget::on_styleComboBox_currentTextChanged(const QString &arg1) {
+ applyThemeQuirks();
+ settings.setValue("widgetStyle", arg1);
+ emit updateWindowTheme();
+ emit updatePageTheme();
+}
+
void SettingsWidget::on_zoomPlus_clicked() {
double currentFactor = settings.value("zoomFactor", 1.0).toDouble();
double newFactor = currentFactor + 0.25;
ui->zoomFactorSpinBox->setValue(newFactor);
-
settings.setValue("zoomFactor", ui->zoomFactorSpinBox->value());
emit zoomChanged();
}
@@ -475,19 +575,119 @@ void SettingsWidget::on_zoomMinus_clicked() {
double currentFactor = settings.value("zoomFactor", 1.0).toDouble();
double newFactor = currentFactor - 0.25;
ui->zoomFactorSpinBox->setValue(newFactor);
-
settings.setValue("zoomFactor", ui->zoomFactorSpinBox->value());
emit zoomChanged();
}
void SettingsWidget::on_zoomReset_clicked() {
- double newFactor = 1.0;
- ui->zoomFactorSpinBox->setValue(newFactor);
-
+ ui->zoomFactorSpinBox->setValue(1.0);
settings.setValue("zoomFactor", ui->zoomFactorSpinBox->value());
emit zoomChanged();
}
-void SettingsWidget::on_startMinimized_toggled(bool checked) {
- settings.setValue("startMinimized", checked);
+void SettingsWidget::on_zoomResetMaximized_clicked() {
+ ui->zoomFactorSpinBoxMaximized->setValue(defaultZoomFactorMaximized);
+ settings.setValue("zoomFactorMaximized",
+ ui->zoomFactorSpinBoxMaximized->value());
+ emit zoomMaximizedChanged();
+}
+
+void SettingsWidget::on_zoomPlusMaximized_clicked() {
+ double currentFactor =
+ settings.value("zoomFactorMaximized", defaultZoomFactorMaximized)
+ .toDouble();
+ double newFactor = currentFactor + 0.25;
+ ui->zoomFactorSpinBoxMaximized->setValue(newFactor);
+ settings.setValue("zoomFactorMaximized",
+ ui->zoomFactorSpinBoxMaximized->value());
+ emit zoomMaximizedChanged();
+}
+
+void SettingsWidget::on_zoomMinusMaximized_clicked() {
+ double currentFactor =
+ settings.value("zoomFactorMaximized", defaultZoomFactorMaximized)
+ .toDouble();
+ double newFactor = currentFactor - 0.25;
+ ui->zoomFactorSpinBoxMaximized->setValue(newFactor);
+ settings.setValue("zoomFactorMaximized",
+ ui->zoomFactorSpinBoxMaximized->value());
+ emit zoomMaximizedChanged();
+}
+
+void SettingsWidget::on_changeDefaultDownloadLocationPb_clicked() {
+ QFileDialog dialog(this);
+ dialog.setFileMode(QFileDialog::Directory);
+ dialog.setOption(QFileDialog::ShowDirsOnly);
+
+ QString path;
+ bool usenativeFileDialog =
+ settings.value("useNativeFileDialog", false).toBool();
+ if (usenativeFileDialog == false) {
+ path = QFileDialog::getExistingDirectory(
+ this, tr("Select download directory"),
+ settings
+ .value("defaultDownloadLocation",
+ QStandardPaths::writableLocation(
+ QStandardPaths::DownloadLocation) +
+ QDir::separator() + QApplication::applicationName())
+ .toString(),
+ QFileDialog::DontUseNativeDialog);
+ } else {
+ path = QFileDialog::getSaveFileName(
+ this, tr("Select download directory"),
+ settings
+ .value("defaultDownloadLocation",
+ QStandardPaths::writableLocation(
+ QStandardPaths::DownloadLocation) +
+ QDir::separator() + QApplication::applicationName())
+ .toString());
+ }
+
+ if (!path.isNull() && !path.isEmpty()) {
+ ui->defaultDownloadLocation->setText(path);
+ settings.setValue("defaultDownloadLocation", path);
+ }
+}
+
+void SettingsWidget::on_userAgentLineEdit_editingFinished() {
+ ui->userAgentLineEdit->home(true);
+ ui->userAgentLineEdit->deselect();
+}
+
+void SettingsWidget::on_viewPassword_clicked() {
+ ui->current_password->setEchoMode(QLineEdit::Normal);
+ ui->viewPassword->setEnabled(false);
+ QTimer *timer = new QTimer(this);
+ timer->setInterval(5000);
+ connect(timer, &QTimer::timeout, ui->current_password, [=]() {
+ ui->current_password->setEchoMode(QLineEdit::Password);
+ ui->viewPassword->setEnabled(true);
+ timer->stop();
+ timer->deleteLater();
+ });
+ timer->start();
+}
+
+void SettingsWidget::on_chnageCurrentPasswordPushButton_clicked() {
+ if (settings.value("asdfg").isValid()) {
+ QMessageBox msgBox;
+ msgBox.setText("You are about to change your current app lock password!"
+ "\n\nThis will LogOut your current session.");
+ msgBox.setIconPixmap(
+ QPixmap(":/icons/information-line.png")
+ .scaled(42, 42, Qt::KeepAspectRatio, Qt::SmoothTransformation));
+ msgBox.setInformativeText("Do you want to proceed?");
+ msgBox.setStandardButtons(QMessageBox::Cancel);
+ QPushButton *changePassword =
+ new QPushButton(this->style()->standardIcon(QStyle::SP_DialogYesButton),
+ "Change password", nullptr);
+ msgBox.addButton(changePassword, QMessageBox::NoRole);
+ connect(changePassword, &QPushButton::clicked, changePassword,
+ [=]() { emit change_lock_password(); });
+ msgBox.exec();
+
+ } else {
+ settings.setValue("lockscreen", false);
+ showSetApplockPasswordDialog();
+ }
}
diff --git a/src/settingswidget.h b/src/settingswidget.h
index d7353ec..c9931a2 100644
--- a/src/settingswidget.h
+++ b/src/settingswidget.h
@@ -1,110 +1,102 @@
#ifndef SETTINGSWIDGET_H
#define SETTINGSWIDGET_H
-#include <QWidget>
-#include <QSettings>
-#include "utils.h"
-
#include "permissiondialog.h"
+#include "utils.h"
-
+#include <QSettings>
+#include <QWidget>
namespace Ui {
class SettingsWidget;
}
-class SettingsWidget : public QWidget
-{
- Q_OBJECT
+class SettingsWidget : public QWidget {
+ Q_OBJECT
signals:
- void updateWindowTheme();
- void updatePageTheme();
- void muteToggled(const bool checked);
- void autoPlayMediaToggled(const bool checked);
- void userAgentChanged(QString userAgentStr);
- void init_lock();
- void dictChanged(QString dict);
- void spellCheckChanged(bool checked);
- void notificationPopupTimeOutChanged();
- void notify(QString message);
- void zoomChanged();
+ void updateWindowTheme();
+ void updatePageTheme();
+ void muteToggled(const bool checked);
+ void autoPlayMediaToggled(const bool checked);
+ void userAgentChanged(QString userAgentStr);
+ void init_lock();
+ void change_lock_password();
+ void dictChanged(QString dict);
+ void spellCheckChanged(bool checked);
+ void notificationPopupTimeOutChanged();
+ void notify(QString message);
+ void zoomChanged();
+ void zoomMaximizedChanged();
public:
- explicit SettingsWidget(QWidget *parent = nullptr,QString engineCachePath = "",
- QString enginePersistentStoragePath = "");
- ~SettingsWidget();
+ explicit SettingsWidget(QWidget *parent = nullptr,
+ QString engineCachePath = "",
+ QString enginePersistentStoragePath = "");
+ ~SettingsWidget();
public slots:
- void refresh();
- void updateDefaultUAButton(const QString engineUA);
- void appLockSetChecked(bool checked);
- void setCurrentPasswordText(QString str);
- void loadDictionaries(QStringList dictionaries);
-protected slots:
- bool eventFilter(QObject *obj, QEvent *event);
- void closeEvent(QCloseEvent *event);
-private slots:
- QString cachePath();
- QString persistentStoragePath();
-
- void on_deleteCache_clicked();
-
- void on_deletePersistentData_clicked();
-
- void on_notificationCheckBox_toggled(bool checked);
-
- void on_themeComboBox_currentTextChanged(const QString &arg1);
-
- void applyThemeQuirks();
- void on_muteAudioCheckBox_toggled(bool checked);
-
- void on_defaultUserAgentButton_clicked();
-
- void on_userAgentLineEdit_textChanged(const QString &arg1);
+ void refresh();
+ void updateDefaultUAButton(const QString engineUA);
+ void appLockSetChecked(bool checked);
+ void setCurrentPasswordText(QString str);
+ void loadDictionaries(QStringList dictionaries);
- void on_setUserAgent_clicked();
-
- void on_autoPlayMediaCheckBox_toggled(bool checked);
-
- void on_closeButtonActionComboBox_currentIndexChanged(int index);
-
- void on_applock_checkbox_toggled(bool checked);
-
- void on_dictComboBox_currentIndexChanged(const QString &arg1);
-
- void on_enableSpellCheck_toggled(bool checked);
-
- void on_showShortcutsButton_clicked();
-
- void on_showPermissionsButton_clicked();
-
-
- void on_notificationTimeOutspinBox_valueChanged(int arg1);
-
- void on_notificationCombo_currentIndexChanged(int index);
-
- void on_tryNotification_clicked();
-
- void on_automaticThemeCheckBox_toggled(bool checked);
-
- void updateAutomaticTheme();
- void themeSwitchTimerTimeout();
- void on_useNativeFileDialog_toggled(bool checked);
-
- void on_zoomPlus_clicked();
- void on_zoomMinus_clicked();
-
- void on_zoomReset_clicked();
+ void clearAllData();
+protected slots:
+ bool eventFilter(QObject *obj, QEvent *event);
+ void closeEvent(QCloseEvent *event);
- bool isChildOf(QObject *Of, QObject *self);
- void on_startMinimized_toggled(bool checked);
+private slots:
+ QString cachePath();
+ QString persistentStoragePath();
+ bool isChildOf(QObject *Of, QObject *self);
+ void applyThemeQuirks();
+ void on_appAutoLockcheckBox_toggled(bool checked);
+ void on_applock_checkbox_toggled(bool checked);
+ void on_autoLockDurationSpinbox_valueChanged(int arg1);
+ void on_autoPlayMediaCheckBox_toggled(bool checked);
+ void on_automaticThemeCheckBox_toggled(bool checked);
+ void on_changeDefaultDownloadLocationPb_clicked();
+ void on_chnageCurrentPasswordPushButton_clicked();
+ void on_closeButtonActionComboBox_currentIndexChanged(int index);
+ void on_defaultUserAgentButton_clicked();
+ void on_deleteCache_clicked();
+ void on_deletePersistentData_clicked();
+ void on_dictComboBox_currentIndexChanged(const QString &arg1);
+ void on_enableSpellCheck_toggled(bool checked);
+ void on_minimizeOnTrayIconClick_toggled(bool checked);
+ void on_muteAudioCheckBox_toggled(bool checked);
+ void on_notificationCheckBox_toggled(bool checked);
+ void on_notificationCombo_currentIndexChanged(int index);
+ void on_notificationTimeOutspinBox_valueChanged(int arg1);
+ void on_resetAppAutoLockPushButton_clicked();
+ void on_setUserAgent_clicked();
+ void on_showPermissionsButton_clicked();
+ void on_showShortcutsButton_clicked();
+ void on_startMinimized_toggled(bool checked);
+ void on_styleComboBox_currentTextChanged(const QString &arg1);
+ void on_themeComboBox_currentTextChanged(const QString &arg1);
+ void on_tryNotification_clicked();
+ void on_useNativeFileDialog_toggled(bool checked);
+ void on_userAgentLineEdit_editingFinished();
+ void on_userAgentLineEdit_textChanged(const QString &arg1);
+ void on_viewPassword_clicked();
+ void on_zoomMinusMaximized_clicked();
+ void on_zoomMinus_clicked();
+ void on_zoomPlusMaximized_clicked();
+ void on_zoomPlus_clicked();
+ void on_zoomResetMaximized_clicked();
+ void on_zoomReset_clicked();
+ void showSetApplockPasswordDialog();
+ void themeSwitchTimerTimeout();
+ void updateAutomaticTheme();
private:
- Ui::SettingsWidget *ui;
- QString engineCachePath,enginePersistentStoragePath;
- QSettings settings;
- QTimer *themeSwitchTimer;
+ Ui::SettingsWidget *ui;
+ QString engineCachePath, enginePersistentStoragePath;
+ QSettings settings;
+ QTimer *themeSwitchTimer;
};
#endif // SETTINGSWIDGET_H
diff --git a/src/settingswidget.ui b/src/settingswidget.ui
index 09e5639..44f6b7a 100644
--- a/src/settingswidget.ui
+++ b/src/settingswidget.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>537</width>
- <height>580</height>
+ <width>637</width>
+ <height>792</height>
</rect>
</property>
<property name="windowTitle">
@@ -98,8 +98,8 @@ background:transparent;
<rect>
<x>0</x>
<y>0</y>
- <width>521</width>
- <height>592</height>
+ <width>621</width>
+ <height>791</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -112,128 +112,88 @@ background:transparent;
<item row="8" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="QLabel" name="label">
+ <widget class="QLabel" name="label_8">
<property name="text">
- <string>Close button action</string>
+ <string>Widget Style</string>
</property>
</widget>
</item>
<item>
- <widget class="QComboBox" name="closeButtonActionComboBox">
- <item>
- <property name="text">
- <string>Minimize to tray</string>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/window-2-line.png</normaloff>:/icons/window-2-line.png</iconset>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Quit Application</string>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/shut-down-line.png</normaloff>:/icons/shut-down-line.png</iconset>
- </property>
- </item>
- </widget>
+ <widget class="QComboBox" name="styleComboBox"/>
</item>
</layout>
</item>
- <item row="5" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <property name="topMargin">
- <number>0</number>
+ <item row="11" column="0">
+ <widget class="Line" name="line_4">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>1</height>
+ </size>
</property>
- <item>
- <widget class="QCheckBox" name="applock_checkbox">
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable application lock screen.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="text">
- <string>Enable App Lock on Start</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="current_password">
- <property name="text">
- <string>Current Password:</string>
- </property>
- </widget>
- </item>
- </layout>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>1</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">background-color: rgba(63, 129, 216, 48);</string>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
</item>
- <item row="1" column="0">
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="1">
- <widget class="Line" name="line_3">
- <property name="minimumSize">
- <size>
- <width>1</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>1</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">background-color: rgba(63, 129, 216, 48);</string>
- </property>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
+ <item row="9" column="0">
+ <layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
- <widget class="QCheckBox" name="notificationCheckBox">
+ <widget class="QLabel" name="label_2">
<property name="text">
- <string>Disable Notifications PopUp</string>
+ <string>Widget Theme</string>
</property>
</widget>
</item>
- <item row="1" column="2">
- <widget class="QCheckBox" name="autoPlayMediaCheckBox">
- <property name="text">
- <string>Disable Auto Playback of Media</string>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="automaticThemeCheckBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Based on your system timezone and location.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="muteAudioCheckBox">
<property name="text">
- <string>Mute Audio from Page</string>
+ <string>Automatic</string>
</property>
</widget>
</item>
<item row="0" column="2">
- <layout class="QHBoxLayout" name="horizontalLayout_9">
+ <widget class="QComboBox" name="themeComboBox">
<item>
- <widget class="QLabel" name="label_14">
- <property name="text">
- <string>PopUp timeout</string>
- </property>
- </widget>
+ <property name="text">
+ <string>Dark</string>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/moon-line.png</normaloff>:/icons/moon-line.png</iconset>
+ </property>
</item>
<item>
- <widget class="QSpinBox" name="notificationTimeOutspinBox">
- <property name="suffix">
- <string> Secs</string>
- </property>
- <property name="minimum">
- <number>2</number>
- </property>
- <property name="maximum">
- <number>20</number>
- </property>
- </widget>
+ <property name="text">
+ <string>Light</string>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/lightbulb-line.png</normaloff>:/icons/lightbulb-line.png</iconset>
+ </property>
</item>
- </layout>
+ </widget>
</item>
</layout>
</item>
@@ -262,127 +222,9 @@ background:transparent;
</property>
</widget>
</item>
- <item row="3" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_10">
- <item>
- <widget class="QCheckBox" name="startMinimized">
- <property name="text">
- <string>Start minimized</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="useNativeFileDialog">
- <property name="text">
- <string>Use Native File Dialog</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <widget class="QCheckBox" name="enableSpellCheck">
- <property name="text">
- <string>Enable Spell Checker</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line">
- <property name="minimumSize">
- <size>
- <width>1</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>1</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">background-color: rgba(63, 129, 216, 48);</string>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>SpellChecker Language</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="dictComboBox"/>
- </item>
- </layout>
- </item>
- <item row="10" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_8">
- <property name="topMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="label_10">
- <property name="text">
- <string>App permissions</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="showPermissionsButton">
- <property name="text">
- <string> Show permissions</string>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/categories/security.png</normaloff>:/icons/categories/security.png</iconset>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="9" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_6">
- <item>
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Global App shortcuts</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="showShortcutsButton">
- <property name="text">
- <string> Show shortcuts</string>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/share-forward-line.png</normaloff>:/icons/share-forward-line.png</iconset>
- </property>
- </widget>
- </item>
- </layout>
- </item>
<item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_11">
- <item>
- <widget class="QLabel" name="label_16">
- <property name="text">
- <string>Notification type</string>
- </property>
- </widget>
- </item>
- <item>
+ <layout class="QGridLayout" name="gridLayout_8">
+ <item row="0" column="1">
<widget class="QComboBox" name="notificationCombo">
<item>
<property name="text">
@@ -404,7 +246,7 @@ background:transparent;
</item>
</widget>
</item>
- <item>
+ <item row="0" column="2">
<widget class="QPushButton" name="tryNotification">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
@@ -421,10 +263,44 @@ background:transparent;
</property>
</widget>
</item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_16">
+ <property name="text">
+ <string>Notification type</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="notificationCheckBox">
+ <property name="text">
+ <string>Disable Notifications PopUp</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>PopUp timeout</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QSpinBox" name="notificationTimeOutspinBox">
+ <property name="suffix">
+ <string> Secs</string>
+ </property>
+ <property name="minimum">
+ <number>2</number>
+ </property>
+ <property name="maximum">
+ <number>20</number>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
- <item row="11" column="0">
- <widget class="Line" name="line_4">
+ <item row="7" column="0">
+ <widget class="Line" name="line_3">
<property name="minimumSize">
<size>
<width>0</width>
@@ -448,7 +324,60 @@ background:transparent;
</property>
</widget>
</item>
- <item row="13" column="0">
+ <item row="1" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="1">
+ <widget class="QComboBox" name="dictComboBox">
+ <property name="toolTip">
+ <string>Spell checker Language</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="useNativeFileDialog">
+ <property name="text">
+ <string>Use Native File Dialog</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="muteAudioCheckBox">
+ <property name="text">
+ <string>Mute Audio from Page</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="autoPlayMediaCheckBox">
+ <property name="text">
+ <string>Disable Auto Playback of Media</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="enableSpellCheck">
+ <property name="text">
+ <string>Enable Spell Checker</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QCheckBox" name="startMinimized">
+ <property name="text">
+ <string>Minimize app in tray on start</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="minimizeOnTrayIconClick">
+ <property name="text">
+ <string>Minimize/Maximize on right clicking tray Icon</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="15" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
@@ -473,164 +402,490 @@ background:transparent;
</item>
<item>
<widget class="QPushButton" name="defaultUserAgentButton">
+ <property name="toolTip">
+ <string>Reset to default</string>
+ </property>
<property name="text">
- <string> Default</string>
+ <string/>
</property>
<property name="icon">
<iconset resource="icons.qrc">
- <normaloff>:/icons/refresh-line.png</normaloff>:/icons/refresh-line.png</iconset>
+ <normaloff>:/icons/arrow-go-back-line.png</normaloff>:/icons/arrow-go-back-line.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
- <item row="7" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Theme</string>
+ <item row="12" column="0">
+ <layout class="QGridLayout" name="gridLayout_9">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_12">
+ <property name="topMargin">
+ <number>0</number>
</property>
- </widget>
+ <item>
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>Zoom factor when normal</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QPushButton" name="zoomMinus">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Zoom Out</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/minus.png</normaloff>:/icons/minus.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="zoomFactorSpinBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::NoButtons</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="zoomPlus">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Zoom In</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/plus.png</normaloff>:/icons/plus.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line_5">
+ <property name="minimumSize">
+ <size>
+ <width>1</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>1</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">background-color: rgba(63, 129, 216, 48);</string>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="zoomReset">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>reset</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/arrow-go-back-line.png</normaloff>:/icons/arrow-go-back-line.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</item>
- <item>
- <widget class="QCheckBox" name="automaticThemeCheckBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Based on your system timezone and location.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="text">
- <string>Automatic</string>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_13">
+ <property name="topMargin">
+ <number>0</number>
</property>
- </widget>
+ <item>
+ <widget class="QLabel" name="label_17">
+ <property name="text">
+ <string>Zoom factor when maximized/fullscreen</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QPushButton" name="zoomMinusMaximized">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Zoom Out</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/minus.png</normaloff>:/icons/minus.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="zoomFactorSpinBoxMaximized">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="buttonSymbols">
+ <enum>QAbstractSpinBox::NoButtons</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="zoomPlusMaximized">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Zoom In</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/plus.png</normaloff>:/icons/plus.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line_6">
+ <property name="minimumSize">
+ <size>
+ <width>1</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>1</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">background-color: rgba(63, 129, 216, 48);</string>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="zoomResetMaximized">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>reset</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/arrow-go-back-line.png</normaloff>:/icons/arrow-go-back-line.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</item>
- <item>
- <widget class="QComboBox" name="themeComboBox">
+ </layout>
+ </item>
+ <item row="10" column="0">
+ <layout class="QGridLayout" name="gridLayout_6">
+ <item row="0" column="1">
+ <widget class="QComboBox" name="closeButtonActionComboBox">
<item>
<property name="text">
- <string>Dark</string>
+ <string>Minimize to tray</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
- <normaloff>:/icons/moon-line.png</normaloff>:/icons/moon-line.png</iconset>
+ <normaloff>:/icons/window-2-line.png</normaloff>:/icons/window-2-line.png</iconset>
</property>
</item>
<item>
<property name="text">
- <string>Light</string>
+ <string>Quit Application</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
- <normaloff>:/icons/lightbulb-line.png</normaloff>:/icons/lightbulb-line.png</iconset>
+ <normaloff>:/icons/shut-down-line.png</normaloff>:/icons/shut-down-line.png</iconset>
</property>
</item>
</widget>
</item>
- </layout>
- </item>
- <item row="12" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_12">
- <property name="topMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="label_15">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_9">
<property name="text">
- <string>Zoom factor</string>
+ <string>Global App shortcuts</string>
</property>
</widget>
</item>
- <item>
- <widget class="QPushButton" name="zoomMinus">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Zoom Out</string>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Close button action</string>
</property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="showShortcutsButton">
<property name="text">
- <string/>
+ <string> Show shortcuts</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
- <normaloff>:/icons/minus.png</normaloff>:/icons/minus.png</iconset>
+ <normaloff>:/icons/share-forward-line.png</normaloff>:/icons/share-forward-line.png</iconset>
</property>
</widget>
</item>
- <item>
- <widget class="QDoubleSpinBox" name="zoomFactorSpinBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>App permissions</string>
</property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="showPermissionsButton">
+ <property name="text">
+ <string> Show permissions</string>
</property>
- <property name="readOnly">
- <bool>true</bool>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/categories/security.png</normaloff>:/icons/categories/security.png</iconset>
</property>
- <property name="buttonSymbols">
- <enum>QAbstractSpinBox::NoButtons</enum>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="5" column="0">
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="applock_checkbox">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable application lock screen.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="text">
+ <string>Enable App lock on start</string>
</property>
</widget>
</item>
- <item>
- <widget class="QPushButton" name="zoomPlus">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_19">
+ <property name="text">
+ <string>Current Password</string>
</property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QPushButton" name="chnageCurrentPasswordPushButton">
<property name="toolTip">
- <string>Zoom In</string>
+ <string>Change password</string>
</property>
<property name="text">
- <string/>
+ <string>Change</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
- <normaloff>:/icons/plus.png</normaloff>:/icons/plus.png</iconset>
+ <normaloff>:/icons/categories/utilities.png</normaloff>:/icons/categories/utilities.png</iconset>
</property>
</widget>
</item>
- <item>
- <widget class="Line" name="line_5">
- <property name="minimumSize">
- <size>
- <width>1</width>
- <height>0</height>
- </size>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="appAutoLockcheckBox">
+ <property name="text">
+ <string>Enable App auto locking after</string>
</property>
- <property name="maximumSize">
- <size>
- <width>1</width>
- <height>16777215</height>
- </size>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="autoLockDurationSpinbox">
+ <property name="suffix">
+ <string> Secs</string>
</property>
- <property name="styleSheet">
- <string notr="true">background-color: rgba(63, 129, 216, 48);</string>
+ <property name="minimum">
+ <number>10</number>
</property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
+ <property name="maximum">
+ <number>14400</number>
</property>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
+ <property name="value">
+ <number>60</number>
</property>
</widget>
</item>
- <item>
- <widget class="QPushButton" name="zoomReset">
+ <item row="1" column="2">
+ <widget class="QPushButton" name="resetAppAutoLockPushButton">
+ <property name="toolTip">
+ <string>Change password</string>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/arrow-go-back-line.png</normaloff>:/icons/arrow-go-back-line.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QLineEdit" name="current_password">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="viewPassword">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>View password</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/eye-line.png</normaloff>:/icons/eye-line.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0">
+ <layout class="QGridLayout" name="gridLayout_7">
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="defaultDownloadLocation">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_18">
+ <property name="text">
+ <string>Default Download location</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QPushButton" name="changeDefaultDownloadLocationPb">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -638,14 +893,14 @@ background:transparent;
</sizepolicy>
</property>
<property name="toolTip">
- <string>reset</string>
+ <string>Change Download Location</string>
</property>
<property name="text">
- <string/>
+ <string>Change</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
- <normaloff>:/icons/arrow-go-back-line.png</normaloff>:/icons/arrow-go-back-line.png</iconset>
+ <normaloff>:/icons/folder-download-line.png</normaloff>:/icons/folder-download-line.png</iconset>
</property>
</widget>
</item>
@@ -692,6 +947,12 @@ background:transparent;
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_11">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="font">
<font>
<pointsize>10</pointsize>
@@ -705,6 +966,12 @@ background:transparent;
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_13">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="font">
<font>
<pointsize>10</pointsize>
@@ -721,6 +988,12 @@ background:transparent;
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_12">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="font">
<font>
<pointsize>10</pointsize>
diff --git a/src/utils.cpp b/src/utils.cpp
index 802c51d..eeab445 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -122,14 +122,12 @@ QString utils::convertSectoDay(qint64 secs) {
}
// static on demand path maker
-QString utils::returnPath(QString pathname) {
- QString _data_path =
- QStandardPaths::writableLocation(QStandardPaths::DataLocation);
- if (!QDir(_data_path + "/" + pathname).exists()) {
- QDir d(_data_path + "/" + pathname);
- d.mkpath(_data_path + "/" + pathname);
- }
- return _data_path + "/" + pathname + "/";
+QString utils::returnPath(QString pathname,QString standardLocation = QStandardPaths::writableLocation(
+ QStandardPaths::DataLocation)) {
+ QChar sepe = QDir::separator();
+ QDir d(standardLocation + sepe + pathname);
+ d.mkpath(standardLocation + sepe + pathname);
+ return standardLocation + sepe + pathname + sepe;
}
QString utils::EncodeXML(const QString &encodeMe) {
diff --git a/src/utils.h b/src/utils.h
index bd76e9d..93cbaca 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -23,7 +23,7 @@ public slots:
static QString generateRandomId(int length);
static QString genRand(int length);
static QString convertSectoDay(qint64 secs);
- static QString returnPath(QString pathname);
+ static QString returnPath(QString pathname, QString standardLocation);
static QString EncodeXML ( const QString& encodeMe );
static QString DecodeXML ( const QString& decodeMe );
static QString htmlToPlainText(QString str);
diff --git a/src/webenginepage.cpp b/src/webenginepage.cpp
index d5ecfff..451d187 100644
--- a/src/webenginepage.cpp
+++ b/src/webenginepage.cpp
@@ -6,7 +6,6 @@
WebEnginePage::WebEnginePage(QWebEngineProfile *profile, QObject *parent)
: QWebEnginePage(profile, parent) {
- // Connect signals and slots
profile->setHttpUserAgent(
profile->httpUserAgent().replace("QtWebEngine/5.13.0", ""));
connect(this, &QWebEnginePage::loadFinished, this,
@@ -29,8 +28,6 @@ WebEnginePage::WebEnginePage(QWebEngineProfile *profile, QObject *parent)
bool WebEnginePage::acceptNavigationRequest(const QUrl &url,
QWebEnginePage::NavigationType type,
bool isMainFrame) {
- qDebug() << "Navigation request: [" + url.toDisplayString() + "] " + type;
-
if (QWebEnginePage::NavigationType::NavigationTypeLinkClicked == type) {
QDesktopServices::openUrl(url);
return false;
@@ -132,7 +129,6 @@ void WebEnginePage::handleLoadFinished(bool ok) {
void WebEnginePage::fullScreenRequestedByPage(
QWebEngineFullScreenRequest request) {
- // qDebug()<<"Fullscreen";
request.accept();
}
@@ -216,9 +212,9 @@ void WebEnginePage::handleAuthenticationRequired(const QUrl &requestUrl,
nullptr, mainWindow));
passwordDialog.m_iconLabel->setPixmap(icon.pixmap(32, 32));
- QString introMessage(tr("Enter username and password for \"%1\" at %2")
- .arg(auth->realm())
- .arg(requestUrl.toString().toHtmlEscaped()));
+ QString introMessage(
+ tr("Enter username and password for \"%1\" at %2")
+ .arg(auth->realm(), requestUrl.toString().toHtmlEscaped()));
passwordDialog.m_infoLabel->setText(introMessage);
passwordDialog.m_infoLabel->setWordWrap(true);
@@ -264,11 +260,10 @@ void WebEnginePage::handleProxyAuthenticationRequired(
//! [registerProtocolHandlerRequested]
void WebEnginePage::handleRegisterProtocolHandlerRequested(
QWebEngineRegisterProtocolHandlerRequest request) {
- auto answer =
- QMessageBox::question(view()->window(), tr("Permission Request"),
- tr("Allow %1 to open all %2 links?")
- .arg(request.origin().host())
- .arg(request.scheme()));
+ auto answer = QMessageBox::question(
+ view()->window(), tr("Permission Request"),
+ tr("Allow %1 to open all %2 links?")
+ .arg(request.origin().host(), request.scheme()));
if (answer == QMessageBox::Yes)
request.accept();
else
@@ -283,7 +278,7 @@ void WebEnginePage::handleSelectClientCertificate(
selection.select(selection.certificates().at(0));
qDebug() << __FUNCTION__;
- for (QSslCertificate cert : selection.certificates()) {
+ for (const QSslCertificate &cert : selection.certificates()) {
qDebug() << cert;
selection.select(cert); // select the first available cert
break;
diff --git a/src/webview.cpp b/src/webview.cpp
index 39273eb..7f497a3 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -44,7 +44,7 @@ WebView::WebView(QWidget *parent, QStringList dictionaries)
"Do you want to reload the page ?")
.arg(statusCode));
if (btn == QMessageBox::Yes)
- QTimer::singleShot(0, [this] { this->reload(); });
+ QTimer::singleShot(0, this, [this] { this->reload(); });
});
}
@@ -80,7 +80,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) {
if (profile->isSpellCheckEnabled()) {
QMenu *subMenu = menu->addMenu(tr("Select Language"));
- for (const QString &dict : m_dictionaries) {
+ for (const QString &dict : qAsConst(m_dictionaries)) {
QAction *action = subMenu->addAction(dict);
action->setCheckable(true);
action->setChecked(languages.contains(dict));
diff --git a/src/webview.h b/src/webview.h
index b896ad6..70b5a6e 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -1,22 +1,21 @@
#ifndef WEBVIEW_H
#define WEBVIEW_H
-#include <QWebEngineView>
#include <QSettings>
+#include <QWebEngineView>
-class WebView: public QWebEngineView
-{
- Q_OBJECT
+class WebView : public QWebEngineView {
+ Q_OBJECT
public:
- WebView(QWidget *parent = nullptr, QStringList dictionaries = {});
+ WebView(QWidget *parent = nullptr, QStringList dictionaries = {});
protected:
- void contextMenuEvent(QContextMenuEvent *event) override;
+ void contextMenuEvent(QContextMenuEvent *event) override;
private:
- QStringList m_dictionaries;
- QSettings settings;
+ QStringList m_dictionaries;
+ QSettings settings;
};
#endif // WEBVIEW_H