[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/apps/dolphin/src
From:       Peter Penz <peter.penz19 () gmail ! com>
Date:       2010-12-10 21:54:54
Message-ID: 20101210215454.5D84BAC8A7 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1205329 by ppenz:

Show an undetermined progress indication within one second after changing an URL.


 M  +6 -0      dolphinviewcontainer.cpp  
 M  +18 -1     statusbar/dolphinstatusbar.cpp  
 M  +6 -6      statusbar/dolphinstatusbar.h  
 U             tests/dolphindetailsviewtest.cpp  


--- trunk/KDE/kdebase/apps/dolphin/src/dolphinviewcontainer.cpp #1205328:1205329
@@ -289,6 +289,7 @@
 {
     if (newUrl != m_urlNavigator->locationUrl()) {
         m_urlNavigator->setLocationUrl(newUrl);
+
         // Temporary disable the 'File'->'Create New...' menu until
         // the write permissions can be checked in a fast way at
         // DolphinViewContainer::slotDirListerCompleted().
@@ -296,6 +297,11 @@
         if (isActive()) {
             emit writeStateChanged(false);
         }
+
+        // Trigger an undetermined progress indication. The progress
+        // information in percent will be triggered by the percent() signal
+        // of the directory lister later.
+        updateProgress(-1);
     }
 }
 
--- trunk/KDE/kdebase/apps/dolphin/src/statusbar/dolphinstatusbar.cpp #1205328:1205329
@@ -37,6 +37,7 @@
 #include <QLabel>
 #include <QProgressBar>
 #include <QToolButton>
+#include <QTime>
 #include <QTimer>
 
 #include <views/dolphinview.h>
@@ -54,6 +55,7 @@
     m_progressBar(0),
     m_stopButton(0),
     m_progress(100),
+    m_showProgressBarTimer(0),
     m_messageTimeStamp()
 {
     connect(m_view, SIGNAL(urlChanged(const KUrl&)),
@@ -114,6 +116,11 @@
     m_progressBar = new QProgressBar(this);
     m_progressBar->hide();
 
+    m_showProgressBarTimer = new QTimer(this);
+    m_showProgressBarTimer->setInterval(1000);
+    m_showProgressBarTimer->setSingleShot(true);
+    connect(m_showProgressBarTimer, SIGNAL(timeout()), this, SLOT(updateProgressInfo()));
+
     // Initialize top layout and size policies
     const int fontHeight = QFontMetrics(m_messageLabel->font()).height();
     const int zoomWidgetHeight = m_zoomWidget->minimumSizeHint().height();
@@ -222,6 +229,7 @@
         percent = 100;
     }
 
+    const bool progressRestarted = (percent < 100) && (percent < m_progress);
     m_progress = percent;
     if (m_messageLabel->type() == KonqStatusBarMessageLabel::Error) {
         // Don't update any widget or status bar text if an
@@ -229,8 +237,17 @@
         return;
     }
 
+    if (progressRestarted && !m_progressBar->isVisible()) {
+        // Show the progress bar delayed: In the case if 100 % are reached within
+        // a short time, no progress bar will be shown at all.
+        m_showProgressBarTimer->start();
+    }
+
     m_progressBar->setValue(m_progress);
-    if (!m_progressBar->isVisible() || (percent == 100)) {
+    if (percent == 100) {
+        // The end of the progress has been reached. Assure that the progress bar
+        // gets hidden and the extensions widgets get visible again.
+        m_showProgressBarTimer->stop();
         updateProgressInfo();
     }
 
--- trunk/KDE/kdebase/apps/dolphin/src/statusbar/dolphinstatusbar.h #1205328:1205329
@@ -32,6 +32,7 @@
 class QProgressBar;
 class QToolButton;
 class QSlider;
+class QTimer;
 
 /**
  * @brief Represents the statusbar of a Dolphin view.
@@ -86,11 +87,9 @@
 
     /**
      * Sets the progress in percent (0 - 100). The
-     * progress is shown with a delay of 300 milliseconds:
-     * if the progress does reach 100 % within 300 milliseconds,
-     * the progress is not shown at all. This assures that
-     * no flickering occurs for showing a progress of fast
-     * operations.
+     * progress is shown delayed by 1 second:
+     * If the progress does reach 100 % within 1 second,
+     * the progress is not shown at all.
      */
     void setProgress(int percent);
     int progress() const;
@@ -142,9 +141,9 @@
     void zoomIn();
     void showZoomSliderToolTip(int zoomLevel);
 
-private:
     void updateProgressInfo();
 
+private:
     /**
      * Makes the space information widget and zoom slider widget
      * visible, if \a visible is true and the settings allow to show
@@ -173,6 +172,7 @@
     QProgressBar* m_progressBar;
     QToolButton* m_stopButton;
     int m_progress;
+    QTimer* m_showProgressBarTimer;
 
     // Timestamp when the last message has been set that has not the type
     // 'Default'. The timestamp is used to prevent that default messages
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic