From 501e2035c4207ba906aee84461f3ee427a9bce97 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 30 Jun 2017 19:14:57 +0200 Subject: Status bar height capped; loading bar now hides after 2s --- src/widgets/loadingbar.cpp | 9 ++++++--- src/widgets/loadingbar.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/widgets') 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 +#include 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 -- cgit v1.2.1