Added progressbar to the webview
Leonardo Robol [2012-04-23 20:17]
Added progressbar to the webview
diff --git a/include/mainwindow.h b/include/mainwindow.h
index b9a7ab4..2c58f7d 100644
--- a/include/mainwindow.h
+++ b/include/mainwindow.h
@@ -45,6 +45,10 @@ private slots:
void removeSelectedCategory ();
+ void on_webView_loadFinished(bool arg1);
+
+ void on_webView_loadStarted();
+
public slots:
/**
* @brief Callback for the start of an update of a feed.
diff --git a/larss/mainwindow.cpp b/larss/mainwindow.cpp
index 7d626c7..e230631 100644
--- a/larss/mainwindow.cpp
+++ b/larss/mainwindow.cpp
@@ -14,6 +14,9 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
+ // Don't show the progressbar by default, it will be shown only if really useful
+ ui->webProgressBar->hide();
+
// Open the database, and create the directories for the data
// storage if they are not yet present in the filesystem.
QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
@@ -394,3 +397,13 @@ void Larss::MainWindow::removeSelectedCategory()
feedModel->removeElement(index.row());
}
}
+
+void Larss::MainWindow::on_webView_loadFinished(bool arg1)
+{
+ ui->webProgressBar->hide();
+}
+
+void Larss::MainWindow::on_webView_loadStarted()
+{
+ ui->webProgressBar->show();
+}
diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui
index 7d7e7e4..82027df 100644
--- a/ui/mainwindow.ui
+++ b/ui/mainwindow.ui
@@ -104,6 +104,13 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QProgressBar" name="webProgressBar">
+ <property name="value">
+ <number>24</number>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -120,7 +127,7 @@
<x>0</x>
<y>0</y>
<width>420</width>
- <height>24</height>
+ <height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -183,5 +190,22 @@
<resources>
<include location="../qtresources.qrc"/>
</resources>
- <connections/>
+ <connections>
+ <connection>
+ <sender>webView</sender>
+ <signal>loadProgress(int)</signal>
+ <receiver>webProgressBar</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>260</x>
+ <y>202</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>260</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>