Auto-hide for the progress bar.

Leonardo Robol [2012-05-03 20:32]
Auto-hide for the progress bar.
Filename
include/mainwindow.h
larss/mainwindow.cpp
ui/mainwindow.ui
diff --git a/include/mainwindow.h b/include/mainwindow.h
index 2c58f7d..2d15af5 100644
--- a/include/mainwindow.h
+++ b/include/mainwindow.h
@@ -104,6 +104,11 @@ private:
      * @brief System tray icon used to show the notifications.
      */
     QSystemTrayIcon *systrayIcon;
+
+
+    void showProgressBar();
+
+    void hideProgressBar();
 };

 }
diff --git a/larss/mainwindow.cpp b/larss/mainwindow.cpp
index e230631..9418808 100644
--- a/larss/mainwindow.cpp
+++ b/larss/mainwindow.cpp
@@ -15,7 +15,7 @@ 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();
+    hideProgressBar();

     // Open the database, and create the directories for the data
     // storage if they are not yet present in the filesystem.
@@ -398,12 +398,26 @@ void Larss::MainWindow::removeSelectedCategory()
     }
 }

+void Larss::MainWindow::hideProgressBar()
+{
+    ui->webProgressBar->setHidden(true);
+}
+
+void Larss::MainWindow::showProgressBar()
+{
+    ui->webProgressBar->setHidden(false);
+    return;
+}
+
 void Larss::MainWindow::on_webView_loadFinished(bool arg1)
 {
-    ui->webProgressBar->hide();
+    Q_UNUSED(arg1);
+
+    hideProgressBar();
+    ui->webProgressBar->setValue(0);
 }

 void Larss::MainWindow::on_webView_loadStarted()
 {
-    ui->webProgressBar->show();
+    showProgressBar();
 }
diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui
index 82027df..df026f6 100644
--- a/ui/mainwindow.ui
+++ b/ui/mainwindow.ui
@@ -107,7 +107,7 @@
             <item>
              <widget class="QProgressBar" name="webProgressBar">
               <property name="value">
-               <number>24</number>
+               <number>0</number>
               </property>
              </widget>
             </item>
ViewGit