diff options
author | 2023-01-26 21:11:17 +0530 | |
---|---|---|
committer | 2023-01-26 21:59:39 +0530 | |
commit | c78394d1a47bdcbd968b896a5c5789ce61c09995 (patch) | |
tree | 48a07e525ffa2a4eb7e8a6fe6226debf551058f7 | |
parent | b3e2a2be16b7fff28d7284012e9c9fb2cb8b51d0 (diff) | |
download | whatsie-c78394d1a47bdcbd968b896a5c5789ce61c09995.tar.gz whatsie-c78394d1a47bdcbd968b896a5c5789ce61c09995.zip |
chore: cleanup
Diffstat (limited to '')
-rw-r--r-- | src/mainwindow.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a238b96..5cf7916 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -175,18 +175,20 @@ void MainWindow::updatePageTheme() { QString windowTheme = settings.value("windowTheme", "light").toString(); - if(windowTheme == "dark"){ - webEngine->page()->runJavaScript("localStorage['system-theme-mode']='false'; localStorage.theme='\"dark\"'; "); - }else{ - webEngine->page()->runJavaScript("localStorage['system-theme-mode']='false'; localStorage.theme='\"light\"'; "); - } - if (windowTheme == "dark") { webEngine->page()->runJavaScript( + "localStorage['system-theme-mode']='false'; " + "localStorage.theme='\"dark\"'; "); + + webEngine->page()->runJavaScript( "document.querySelector('body').classList.add('" + windowTheme + "');"); } else { webEngine->page()->runJavaScript( + "localStorage['system-theme-mode']='false'; " + "localStorage.theme='\"light\"'; "); + + webEngine->page()->runJavaScript( "document.querySelector('body').classList.remove('dark');"); } } @@ -958,7 +960,7 @@ void MainWindow::handleWebViewTitleChanged(QString title) { void MainWindow::handleLoadFinished(bool loaded) { if (loaded) { - qDebug()<<"Loaded"; + qDebug() << "Loaded"; checkLoadedCorrectly(); updatePageTheme(); handleZoom(); |