diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/loadingbar.cpp | 9 | ||||
-rw-r--r-- | src/widgets/loadingbar.h | 2 |
2 files changed, 7 insertions, 4 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())); } diff --git a/src/widgets/loadingbar.h b/src/widgets/loadingbar.h index 4523f88..a797e55 100644 --- a/src/widgets/loadingbar.h +++ b/src/widgets/loadingbar.h @@ -35,7 +35,7 @@ signals: public slots: void loadStarted(); - void loadFinished(); + void loadFinished(bool ok); }; #endif // LOADINGBAR_H |