@@ -206,7 +206,9 @@ void MainWindow::updateWindowTheme() {
206
206
}
207
207
208
208
QList<QWidget *> widgets = this ->findChildren <QWidget *>();
209
- foreach (QWidget *w, widgets) { w->setPalette (qApp->palette ()); }
209
+ foreach (QWidget *w, widgets) {
210
+ w->setPalette (qApp->palette ());
211
+ }
210
212
setNotificationPresenter (webEngine->page ()->profile ());
211
213
212
214
if (lockWidget != nullptr ) {
@@ -534,6 +536,7 @@ void MainWindow::notify(QString title, QString message) {
534
536
});
535
537
} else {
536
538
auto popup = new NotificationPopup (webEngine);
539
+ popup->setAttribute (Qt::WA_DeleteOnClose, true );
537
540
connect (popup, &NotificationPopup::notification_clicked, popup, [=]() {
538
541
if (windowState ().testFlag (Qt::WindowMinimized) ||
539
542
!windowState ().testFlag (Qt::WindowActive) || this ->isHidden ()) {
@@ -826,6 +829,8 @@ void MainWindow::createWebPage(bool offTheRecord) {
826
829
settings.value (" useragent" , defaultUserAgentStr).toString ());
827
830
828
831
setNotificationPresenter (profile);
832
+ // profile->setHttpCacheMaximumSize(209715200/2);
833
+ // profile->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
829
834
830
835
QWebEnginePage *page = new WebEnginePage (profile, webEngine);
831
836
if (settings.value (" windowTheme" , " light" ).toString () == " dark" ) {
@@ -838,8 +843,6 @@ void MainWindow::createWebPage(bool offTheRecord) {
838
843
// Release of profile requested but WebEnginePage still not deleted. Expect
839
844
// troubles !
840
845
profile->setParent (page);
841
- // RequestInterceptor *interceptor = new RequestInterceptor(profile);
842
- // profile->setUrlRequestInterceptor(interceptor);
843
846
auto randomValue = QRandomGenerator::global ()->generateDouble () * 300 ;
844
847
page->setUrl (
845
848
QUrl (" https://web.whatsapp.com?v=" + QString::number (randomValue)));
@@ -862,6 +865,7 @@ void MainWindow::setNotificationPresenter(QWebEngineProfile *profile) {
862
865
}
863
866
864
867
auto popup = new NotificationPopup (webEngine);
868
+ popup->setAttribute (Qt::WA_DeleteOnClose, true );
865
869
popup->setObjectName (" engineNotifier" );
866
870
connect (popup, &NotificationPopup::notification_clicked, popup, [=]() {
867
871
if (windowState ().testFlag (Qt::WindowMinimized) ||
@@ -1035,7 +1039,7 @@ void MainWindow::injectNewChatJavaScript() {
1035
1039
1036
1040
void MainWindow::checkLoadedCorrectly () {
1037
1041
if (webEngine && webEngine->page ()) {
1038
- // test 1 based on the class name of body of the page
1042
+ // test 1 based on the class name of body tag of the page
1039
1043
webEngine->page ()->runJavaScript (
1040
1044
" document.querySelector('body').className" ,
1041
1045
[this ](const QVariant &result) {
@@ -1050,12 +1054,10 @@ void MainWindow::checkLoadedCorrectly() {
1050
1054
utils::delete_cache (
1051
1055
webEngine->page ()->profile ()->persistentStoragePath ());
1052
1056
settings.setValue (" useragent" , defaultUserAgentStr);
1053
- utils *util = new utils (this );
1054
- util->DisplayExceptionErrorDialog (
1057
+ utils::DisplayExceptionErrorDialog (
1055
1058
" test1 handleWebViewTitleChanged(title) title: Error, "
1056
1059
" Resetting UA, Quiting!\n UA: " +
1057
1060
settings.value (" useragent" , " DefaultUA" ).toString ());
1058
-
1059
1061
quitAction->trigger ();
1060
1062
} else {
1061
1063
qDebug () << " Test 1 loaded correctly, value:" << result.toString ();
@@ -1075,8 +1077,7 @@ void MainWindow::loadingQuirk(QString test) {
1075
1077
utils::delete_cache (webEngine->page ()->profile ()->cachePath ());
1076
1078
utils::delete_cache (webEngine->page ()->profile ()->persistentStoragePath ());
1077
1079
settings.setValue (" useragent" , defaultUserAgentStr);
1078
- utils *util = new utils (this );
1079
- util->DisplayExceptionErrorDialog (
1080
+ utils::DisplayExceptionErrorDialog (
1080
1081
test +
1081
1082
" checkLoadedCorrectly()/loadingQuirk() reload retries 0, Resetting "
1082
1083
" UA, Quiting!\n UA: " +
@@ -1110,7 +1111,8 @@ void MainWindow::handleDownloadRequested(QWebEngineDownloadItem *download) {
1110
1111
1111
1112
void MainWindow::iconActivated (QSystemTrayIcon::ActivationReason reason) {
1112
1113
Q_UNUSED (reason);
1113
- if (settings.value (" minimizeOnTrayIconClick" , false ).toBool () == false || reason == QSystemTrayIcon::Context)
1114
+ if (settings.value (" minimizeOnTrayIconClick" , false ).toBool () == false ||
1115
+ reason == QSystemTrayIcon::Context)
1114
1116
return ;
1115
1117
if (isVisible ()) {
1116
1118
hide ();
@@ -1181,7 +1183,7 @@ bool MainWindow::isPhoneNumber(const QString &phoneNumber) {
1181
1183
void MainWindow::doReload (bool byPassCache, bool isAskedByCLI,
1182
1184
bool byLoadingQuirk) {
1183
1185
if (byLoadingQuirk) {
1184
- this ->webEngine ->triggerPageAction (QWebEnginePage::ReloadAndBypassCache,
1186
+ this ->webEngine ->triggerPageAction (QWebEnginePage::ReloadAndBypassCache,
1185
1187
byPassCache);
1186
1188
} else {
1187
1189
if (lockWidget && !lockWidget->getIsLocked ()) {
0 commit comments