aboutsummaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-06-30 19:14:57 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2017-06-30 19:14:57 +0200
commit501e2035c4207ba906aee84461f3ee427a9bce97 (patch)
treefa32316f806f9e0fe4b7f5e315dcbbb065bcd9b4 /src/widgets
parentSome MainWindow and WebViewTabBar cleanup (diff)
downloadsmolbote-501e2035c4207ba906aee84461f3ee427a9bce97.tar.xz
Status bar height capped; loading bar now hides after 2s
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/loadingbar.cpp9
-rw-r--r--src/widgets/loadingbar.h2
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