From 6c6275c34bfc4d1e37dfa50495c977af485f9cf0 Mon Sep 17 00:00:00 2001 From: Keshav Bhatt Date: Mon, 4 Jul 2022 23:21:32 +0530 Subject: fix(web): bypass lock check while loading quirk - just reload without asking while loading quirks --- src/mainwindow.cpp | 40 ++++++++++++++++++++++------------------ src/mainwindow.h | 2 +- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3cc8367..5a7e6e2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -500,8 +500,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { this->hide(); event->ignore(); if (settings.value("firstrun_tray", true).toBool()) { - notify(QApplication::applicationName(), - "Minimized to system tray."); + notify(QApplication::applicationName(), "Minimized to system tray."); settings.setValue("firstrun_tray", false); } return; @@ -579,9 +578,7 @@ void MainWindow::createActions() { reloadAction = new QAction(tr("Re&load"), this); reloadAction->setShortcut(Qt::Key_F5); - connect(reloadAction, &QAction::triggered,this, [=]{ - this->doReload(); - }); + connect(reloadAction, &QAction::triggered, this, [=] { this->doReload(); }); addAction(reloadAction); lockAction = new QAction(tr("Loc&k"), this); @@ -1072,7 +1069,7 @@ void MainWindow::loadingQuirk(QString test) { if (correctlyLoaderRetries > -1) { qWarning() << test << "checkLoadedCorrectly()/loadingQuirk()/doReload()" << correctlyLoaderRetries; - doReload(); + doReload(false, false, true); correctlyLoaderRetries--; } else { utils::delete_cache(webEngine->page()->profile()->cachePath()); @@ -1181,22 +1178,29 @@ bool MainWindow::isPhoneNumber(const QString &phoneNumber) { return reg.match(phoneNumber).hasMatch(); } -void MainWindow::doReload(bool byPassCache, bool isAskedByCLI) { - if (lockWidget && !lockWidget->getIsLocked()) { - this->notify(QApplication::applicationName(), QObject::tr("Reloading...")); +void MainWindow::doReload(bool byPassCache, bool isAskedByCLI, + bool byLoadingQuirk) { + if (byLoadingQuirk) { + this->webEngine->triggerPageAction(QWebEnginePage::ReloadAndBypassCache, + byPassCache); } else { - QString error = tr("Unlock to Reload the App."); - if (isAskedByCLI) { - this->notify(QApplication::applicationName() + "| Error", error); + if (lockWidget && !lockWidget->getIsLocked()) { + this->notify(QApplication::applicationName(), + QObject::tr("Reloading...")); } else { - QMessageBox::critical(this, QApplication::applicationName() + "| Error", - error); + QString error = tr("Unlock to Reload the App."); + if (isAskedByCLI) { + this->notify(QApplication::applicationName() + "| Error", error); + } else { + QMessageBox::critical(this, QApplication::applicationName() + "| Error", + error); + } + this->show(); + return; } - this->show(); - return; + this->webEngine->triggerPageAction(QWebEnginePage::ReloadAndBypassCache, + byPassCache); } - this->webEngine->triggerPageAction(QWebEnginePage::ReloadAndBypassCache, - byPassCache); } void MainWindow::toggleMute(const bool &checked) { diff --git a/src/mainwindow.h b/src/mainwindow.h index f8a4ff5..76abe86 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -55,7 +55,7 @@ public slots: void alreadyRunning(bool notify = false); void notify(QString title, QString message); void toggleTheme(); - void doReload(bool byPassCache = false, bool isAskedByCLI = false); + void doReload(bool byPassCache = false, bool isAskedByCLI = false, bool byLoadingQuirk = false); void newChat(); protected slots: void closeEvent(QCloseEvent *event) override; -- cgit v1.2.3 From 8a74ccbcfc1471bbd3fad54250a3d22398e62772 Mon Sep 17 00:00:00 2001 From: Keshav Bhatt Date: Mon, 4 Jul 2022 23:43:48 +0530 Subject: chore(ui): update ui color - update color to match vendor specified one in settings widget - add bottom strip in lock dialog --- src/lock.cpp | 29 +- src/lock.ui | 712 +++++++++++++++++++++++++++---------------------- src/settingswidget.cpp | 48 ++-- src/settingswidget.ui | 8 +- 4 files changed, 445 insertions(+), 352 deletions(-) diff --git a/src/lock.cpp b/src/lock.cpp index 3c47fb2..46b38cd 100644 --- a/src/lock.cpp +++ b/src/lock.cpp @@ -96,13 +96,15 @@ void Lock::applyThemeQuirks() { })"); ui->widget_2->setStyleSheet(R"(QWidget#widget_2 { - border-radius: 5px; - background-image: url(":/icons/texture.png"); - background-color: palette(shadow); + border-top-left-radius: 4px; + border-top-right-radius: 4px; + background-image: url(":/icons/texture.png"); + background-color: palette(shadow); })"); ui->widget->setStyleSheet(R"(QWidget#widget{ - border-radius: 5px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; background-image:url(":/icons/texture.png"); background-color:palette(shadow); })"); @@ -110,6 +112,20 @@ void Lock::applyThemeQuirks() { ui->centerWidget->setStyleSheet(R"(QWidget#centerWidget { background-image: url(":/icons/wa_bg.png"); })"); + + // little quirks + QString border = "border-bottom-right-radius: 4px;" + "border-bottom-left-radius: 4px;"; + QString lightBg = "background-color: rgb(37, 211, 102);"; + QString darkBg = "background-color: rgb(0, 117, 96);"; + if (QString::compare(settings.value("windowTheme", "light").toString(), + "dark", Qt::CaseInsensitive) == 0) { // light + ui->bottomLine->setStyleSheet(darkBg + border); + ui->bottomLine_2->setStyleSheet(darkBg + border); + } else { // dark + ui->bottomLine->setStyleSheet(lightBg + border); + ui->bottomLine_2->setStyleSheet(lightBg + border); + } } Lock::~Lock() { delete ui; } @@ -132,10 +148,7 @@ void Lock::keyReleaseEvent(QKeyEvent *event) { bool Lock::event(QEvent *e) { return QWidget::event(e); } -bool Lock::getIsLocked() const -{ - return isLocked; -} +bool Lock::getIsLocked() const { return isLocked; } void Lock::on_passcode1_textChanged(const QString &arg1) { if (arg1.contains(" ")) { diff --git a/src/lock.ui b/src/lock.ui index 264bb7d..de4df9a 100644 --- a/src/lock.ui +++ b/src/lock.ui @@ -6,8 +6,8 @@ 0 0 - 810 - 510 + 936 + 680 @@ -96,181 +96,216 @@ - - - + + + 0 - - - 10 - - - QLayout::SetMinimumSize - - - 20 - - - 20 - - - 20 - - - 20 - - - + + 0 + + + 0 + + + + + + + + + 10 + + + QLayout::SetMinimumSize + + + 20 + - 0 + 20 + + + 20 - 5 + 20 - - - Qt::Horizontal + + + 0 - - - 40 - 20 - + + 5 - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 128 + 128 + + + + background-color:transparent; + + + + + + :/icons/app/icon-128.png + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + + + + 14 + + + + Set lock passcode + + + Qt::AlignCenter + + + true + + + + + - 128 - 128 + 0 + 30 - - background-color:transparent; + + QLineEdit::Password - - + + Qt::AlignCenter + + + enter passcode + + + + + + + + 0 + 30 + - - :/icons/app/icon-128.png + + QLineEdit::Password Qt::AlignCenter + + enter passcode again + - - - Qt::Horizontal + + + + 0 + 30 + + + + Set Pass Code - + + + + + - 40 - 20 + 0 + 30 - + + Cancel + + + + + + + Warning: Caps Lock is On + + + Qt::AlignCenter + + - - - - - - 14 - - - - Set lock passcode - - - Qt::AlignCenter - - - true - - - - - - - - 0 - 30 - - - - QLineEdit::Password - - - Qt::AlignCenter - - - enter passcode - - - - - - - - 0 - 30 - - - - QLineEdit::Password - - - Qt::AlignCenter - - - enter passcode again - - - - - - - - 0 - 30 - - - - Set Pass Code - - - - - - - - 0 - 30 - - - - Cancel - - - - - - - Warning: Caps Lock is On - - - Qt::AlignCenter - - - - - + + + + + + + 6 + 0 + + + + + 16777215 + 6 + + + + background-color: rgb(6, 207, 156); +border-bottom-right-radius: 4px; +border-bottom-left-radius: 4px; + + + + + @@ -398,127 +433,213 @@ - - - + + + 0 + + + 0 - - - 10 - - - 20 - - - 20 - - - 20 - - - 20 - - - + + 0 + + + + + + + + + 10 + + + 20 + - 0 + 20 + + + 20 - 0 + 20 - - - Qt::Horizontal + + + 0 - - - 40 - 20 - + + 0 - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 128 + 128 + + + + background-color:transparent; + + + + + + :/icons/app/icon-128.png + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - 128 - 128 - + + + 0 - - background-color:transparent; + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 32 + 32 + + + + + 32 + 32 + + + + background-color:transparent; + + + + + + :/icons/lock-2-fill.png + + + true + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 14 + - - - - :/icons/app/icon-128.png + Enter your passcode to get access to app Qt::AlignCenter + + true + - - - Qt::Horizontal - - + + - 40 - 20 + 0 + 30 - - - - - - - - 0 - - - - - Qt::Horizontal + + QLineEdit::Password - - - 40 - 20 - + + Qt::AlignCenter - + + enter your passcode + + - + - 32 - 32 + 0 + 30 - - - 32 - 32 - - - - background-color:transparent; - - + Unlock - - :/icons/lock-2-fill.png - - - true + + + + + + Warning: Caps Lock is On Qt::AlignCenter @@ -526,95 +647,44 @@ - - - Qt::Horizontal + + + <html><head/><body><p>Wrong Passcode, Please try again.</p></body></html> - - - 40 - 20 - + + Qt::AlignCenter + + + true - + - - - - - - 14 - - - - Enter your passcode to get access to app - - - Qt::AlignCenter - - - true - - - - - - - - 0 - 30 - - - - QLineEdit::Password - - - Qt::AlignCenter - - - enter your passcode - - - - - - - - 0 - 30 - - - - Unlock - - - - - - - Warning: Caps Lock is On - - - Qt::AlignCenter - - - - - - - <html><head/><body><p>Wrong Passcode, Please try again.</p></body></html> - - - Qt::AlignCenter - - - true - - - - - + + + + + + + 6 + 0 + + + + + 16777215 + 6 + + + + background-color: rgb(6, 207, 156); +border-bottom-right-radius: 4px; +border-bottom-left-radius: 4px; + + + + + diff --git a/src/settingswidget.cpp b/src/settingswidget.cpp index a58a967..1a385f1 100644 --- a/src/settingswidget.cpp +++ b/src/settingswidget.cpp @@ -56,7 +56,8 @@ SettingsWidget::SettingsWidget(QWidget *parent, int screenNumber, ui->startMinimized->setChecked( settings.value("startMinimized", false).toBool()); - this->appAutoLockingSetChecked(settings.value("appAutoLocking", defaultAppAutoLock).toBool()); + this->appAutoLockingSetChecked( + settings.value("appAutoLocking", defaultAppAutoLock).toBool()); ui->autoLockDurationSpinbox->setValue( settings.value("autoLockDuration", defaultAppAutoLockDuration).toInt()); @@ -303,9 +304,8 @@ void SettingsWidget::on_deleteCache_clicked() { void SettingsWidget::on_deletePersistentData_clicked() { QMessageBox msgBox; - msgBox.setText( - "This will delete Persistent Data ! Persistent data includes " - "persistent cookies, HTML5 local storage, and visited links."); + msgBox.setText("This will delete Persistent Data ! Persistent data includes " + "persistent cookies, HTML5 local storage, and visited links."); msgBox.setIconPixmap( QPixmap(":/icons/information-line.png") .scaled(42, 42, Qt::KeepAspectRatio, Qt::SmoothTransformation)); @@ -344,13 +344,25 @@ void SettingsWidget::applyThemeQuirks() { // little quirks if (QString::compare(ui->themeComboBox->currentText(), "dark", Qt::CaseInsensitive) == 0) { - ui->bottomLine->setStyleSheet("background-color: rgb(5, 97, 98);"); + ui->bottomLine->setStyleSheet("background-color: rgb(0, 117, 96);"); ui->label_7->setStyleSheet( "color:#c2c5d1;padding: 0px 8px 0px 8px;background:transparent;"); + ui->headerWidget->setStyleSheet("background-color: qlineargradient(" + "spread:reflect, x1:0, y1:1, x2:1, y2:1," + "stop:0 rgba(0, 117, 96, 255), " + "stop:0.328358 rgba(0, 117, 96, 144)," + "stop:0.61194 rgba(0, 117, 96, 78)," + "stop:0.895522 rgba(0, 117, 96, 6));"); } else { - ui->bottomLine->setStyleSheet("background-color: rgb(74, 223, 131);"); + ui->bottomLine->setStyleSheet("background-color: rgb(37, 211, 102);"); ui->label_7->setStyleSheet( "color:#1e1f21;padding: 0px 8px 0px 8px;background:transparent;"); + ui->headerWidget->setStyleSheet("background-color: qlineargradient(" + "spread:reflect, x1:0, y1:1, x2:1, y2:1," + "stop:0 rgba(37, 211, 102, 200), " + "stop:0.328358 rgba(37, 211, 102, 122)," + "stop:0.61194 rgba(37, 211, 102, 68)," + "stop:0.895522 rgba(37, 211, 102, 6));"); } } @@ -429,18 +441,18 @@ void SettingsWidget::appAutoLockingSetChecked(bool checked) { ui->appAutoLockcheckBox->blockSignals(false); } -void SettingsWidget::toggleTheme() -{ - //disable automatic theme first - if(settings.value("automaticTheme", false).toBool()){ - emit notify(tr("Automatic theme switching was disabled due to manual theme toggle.")); - ui->automaticThemeCheckBox->setChecked(false); - } - if(ui->themeComboBox->currentIndex() == 0){ - ui->themeComboBox->setCurrentIndex(1); - }else{ - ui->themeComboBox->setCurrentIndex(0); - } +void SettingsWidget::toggleTheme() { + // disable automatic theme first + if (settings.value("automaticTheme", false).toBool()) { + emit notify(tr( + "Automatic theme switching was disabled due to manual theme toggle.")); + ui->automaticThemeCheckBox->setChecked(false); + } + if (ui->themeComboBox->currentIndex() == 0) { + ui->themeComboBox->setCurrentIndex(1); + } else { + ui->themeComboBox->setCurrentIndex(0); + } } void SettingsWidget::setCurrentPasswordText(QString str) { diff --git a/src/settingswidget.ui b/src/settingswidget.ui index 900d949..1b259a8 100644 --- a/src/settingswidget.ui +++ b/src/settingswidget.ui @@ -38,9 +38,7 @@ - /*background-color: qlineargradient(spread:reflect, x1:0, y1:1, x2:1, y2:1, stop:0 rgba(63, 129, 216, 255), stop:0.328358 rgba(63, 129, 216, 111), stop:0.61194 rgba(63, 129, 216, 48), stop:0.895522 rgba(63, 129, 216, 15));*/ - -background-color: qlineargradient(spread:reflect, x1:0, y1:1, x2:1, y2:1, stop:0 rgba(28, 139, 130, 255), stop:0.328358 rgba(28, 139, 130, 144), stop:0.61194 rgba(28, 139, 130, 78), stop:0.895522 rgba(28, 139, 130, 6)); + @@ -97,7 +95,7 @@ background:transparent; 0 - -14 + 0 677 791 @@ -1070,7 +1068,7 @@ background:transparent; - background-color: rgb(74, 223, 131); + background-color: rgb(6, 207, 156); -- cgit v1.2.3 From cee2dc85e3ce245813b01be3f01457cc88305288 Mon Sep 17 00:00:00 2001 From: Keshav Bhatt Date: Tue, 5 Jul 2022 00:36:07 +0530 Subject: fix: focus on password edit when echo --- src/settingswidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/settingswidget.cpp b/src/settingswidget.cpp index 1a385f1..1322e17 100644 --- a/src/settingswidget.cpp +++ b/src/settingswidget.cpp @@ -730,6 +730,7 @@ void SettingsWidget::on_userAgentLineEdit_editingFinished() { void SettingsWidget::on_viewPassword_clicked() { ui->current_password->setEchoMode(QLineEdit::Normal); ui->viewPassword->setEnabled(false); + ui->current_password->setFocus(); QTimer *timer = new QTimer(this); timer->setInterval(5000); connect(timer, &QTimer::timeout, ui->current_password, [=]() { -- cgit v1.2.3