diff options
Diffstat (limited to 'src/widgets/loadingbar.cpp')
-rw-r--r-- | src/widgets/loadingbar.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/widgets/loadingbar.cpp b/src/widgets/loadingbar.cpp index a9194bd..9ab5467 100644 --- a/src/widgets/loadingbar.cpp +++ b/src/widgets/loadingbar.cpp @@ -20,6 +20,7 @@ #include "loadingbar.h" #include <QWebEngineView> +#include <QTimer> LoadingBar::LoadingBar(QWidget *parent) : QProgressBar(parent) @@ -33,16 +34,18 @@ void LoadingBar::connectWebView(QWebEngineView *view) connect(view, SIGNAL(loadStarted()), this, SLOT(loadStarted())); connect(view, SIGNAL(loadProgress(int)), this, SLOT(setValue(int))); - connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); + connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); } void LoadingBar::loadStarted() { + resetFormat(); show(); setValue(0); } -void LoadingBar::loadFinished() +void LoadingBar::loadFinished(bool ok) { - hide(); + setFormat(QString("%p% %1").arg(ok ? tr("Finished") : tr("Failed"))); + QTimer::singleShot(2000, this, SLOT(hide())); } |