aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-01-31 12:30:51 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2018-01-31 12:30:51 +0100
commitd1635b36d00b7239cbebcf9f78e9c8615ac1d7d5 (patch)
tree31525586e8e1fa89093b10b0d88924a27e1c2241 /src/mainwindow
parentAlways connect to local socket (diff)
downloadsmolbote-d1635b36d00b7239cbebcf9f78e9c8615ac1d7d5.tar.xz
Fixed bug where refresh button and loading bar would get stuck in loading state
Diffstat (limited to 'src/mainwindow')
-rw-r--r--src/mainwindow/widgets/loadingbar.cpp5
-rw-r--r--src/mainwindow/widgets/loadingbar.h2
-rw-r--r--src/mainwindow/widgets/navigationbar.cpp3
3 files changed, 7 insertions, 3 deletions
diff --git a/src/mainwindow/widgets/loadingbar.cpp b/src/mainwindow/widgets/loadingbar.cpp
index 2c12371..76eafc4 100644
--- a/src/mainwindow/widgets/loadingbar.cpp
+++ b/src/mainwindow/widgets/loadingbar.cpp
@@ -22,6 +22,7 @@ void LoadingBar::connectWebView(WebView *view)
disconnect(loadStartedConnection);
disconnect(loadProgressConnection);
+ disconnect(loadedConnection);
disconnect(loadFinishedConnection);
if(view->isLoaded()) {
@@ -33,6 +34,9 @@ void LoadingBar::connectWebView(WebView *view)
loadStartedConnection = connect(view, &QWebEngineView::loadStarted, this, &LoadingBar::loadStarted);
loadProgressConnection = connect(view, &QWebEngineView::loadProgress, this, &QProgressBar::setValue);
+ loadedConnection = connect(view, &WebView::loaded, this, [this]() {
+ QTimer::singleShot(2000, this, &LoadingBar::hide);
+ });
loadFinishedConnection = connect(view, &QWebEngineView::loadFinished, this, &LoadingBar::loadFinished);
}
@@ -46,5 +50,4 @@ void LoadingBar::loadStarted()
void LoadingBar::loadFinished(bool ok)
{
setFormat(QString("%p% %1").arg(ok ? tr("Finished") : tr("Failed")));
- QTimer::singleShot(2000, this, SLOT(hide()));
}
diff --git a/src/mainwindow/widgets/loadingbar.h b/src/mainwindow/widgets/loadingbar.h
index b03a25e..f75e72b 100644
--- a/src/mainwindow/widgets/loadingbar.h
+++ b/src/mainwindow/widgets/loadingbar.h
@@ -24,7 +24,7 @@ private slots:
void loadFinished(bool ok);
private:
- QMetaObject::Connection loadStartedConnection, loadProgressConnection, loadFinishedConnection;
+ QMetaObject::Connection loadStartedConnection, loadProgressConnection, loadedConnection, loadFinishedConnection;
};
#endif // LOADINGBAR_H
diff --git a/src/mainwindow/widgets/navigationbar.cpp b/src/mainwindow/widgets/navigationbar.cpp
index 93711e1..e488d77 100644
--- a/src/mainwindow/widgets/navigationbar.cpp
+++ b/src/mainwindow/widgets/navigationbar.cpp
@@ -9,6 +9,7 @@
#include "navigationbar.h"
#include "mainwindow/mainwindow.h"
#include <QHBoxLayout>
+#include <QMenu>
#include <QShortcut>
#include <QStyle>
#include <QToolBar>
@@ -112,7 +113,7 @@ void NavigationBar::connectWebView(WebView *view)
}
loadStartedConnection = connect(view, &QWebEngineView::loadStarted, this, &NavigationBar::update_loadStarted);
- loadFinishedConnection = connect(view, &QWebEngineView::loadFinished, this, &NavigationBar::update_loadFinished);
+ loadFinishedConnection = connect(view, &WebView::loaded, this, &NavigationBar::update_loadFinished);
}
void NavigationBar::update_loadStarted()