[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Fri Aug 27 21:32:03 CEST 2004


CVS commit by arwalker: 

Make the progress bar and progress messages functional again.

Hiding and showing the progress bar and message does not work as the function to show them posts a message, which does not get handled until the message queue is pumped, which may not be until the data wizard has finished creating and populating all the plots.


  A            kstquicklabel.cpp   1.1 [GPL (v2+)]
  A            kstquicklabel.h   1.1 [GPL (v2+)]
  A            kstquickprogressbar.cpp   1.1 [GPL (v2+)]
  A            kstquickprogressbar.h   1.1 [GPL (v2+)]
  M +2 -0      Makefile.am   1.140
  M +11 -18    kst.cpp   1.224
  M +5 -2      kst.h   1.106


--- kdeextragear-2/kst/kst/kst.cpp  #1.223:1.224
@@ -663,15 +663,12 @@ void KstApp::initStatusBar() {
   statusBar()->addWidget(_dataBar, 1, true);
 
-  _readyBar = new QLabel(i18n("Almost Ready"), statusBar());
-  statusBar()->addWidget(_readyBar, 0, true);
-
-  _progressMsg = new QLabel(QString::null, statusBar());
-  statusBar()->addWidget(_progressMsg, 0, true);
-  _progressBar = new QProgressBar(statusBar());
+  _progressBar = new KstQuickProgressBar(statusBar());
   _progressBar->setPercentageVisible(false);
   _progressBar->setCenterIndicator(true);
-  statusBar()->addWidget(_progressBar, 0, true);
-  _progressBar->hide();
-  _progressMsg->hide();
+  statusBar()->addWidget(_progressBar, 1, true);
+
+  _readyBar = new KstQuickLabel(i18n("Almost Ready"), statusBar());
+  _readyBar->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+  statusBar()->addWidget(_readyBar, 1, true);
 
 #ifdef HAVE_LINUX
@@ -1145,5 +1142,4 @@ void KstApp::slotUpdateDataMsg(const QSt
 void KstApp::slotUpdateProgress(int total, int step, const QString &msg) {
   if (step > 0) {
-    _progressBar->show();
     if (!_progressBar->percentageVisible()) {
       _progressBar->setPercentageVisible(true);
@@ -1152,20 +1148,17 @@ void KstApp::slotUpdateProgress(int tota
       _progressBar->setTotalSteps(total);
     }
+    if (_progressBar->progress() != step) {
     _progressBar->setProgress(step);
+    }
   } else {
     _progressBar->setPercentageVisible(false);
     _progressBar->reset();
-    _progressBar->hide();
   }
 
   if (msg.isEmpty()) {
-    _progressMsg->setText(QString::null);
-    _progressMsg->hide();
+    _readyBar->setText(i18n("Ready"));
   } else {
-    _progressMsg->setText(msg);
-    _progressMsg->show();
+    _readyBar->setText(msg);
   }
-
-  while (kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput));
 }
 

--- kdeextragear-2/kst/kst/kst.h  #1.105:1.106
@@ -30,4 +30,6 @@
 #include "kst2dplot.h"
 #include "ksteventmonitorentry.h"
+#include "kstquickprogressbar.h"
+#include "kstquicklabel.h"
 
 typedef enum {LegendOn, LegendOff, LegendAuto} LegendType;
@@ -453,6 +455,7 @@ class KstApp : public KMdiMainFrm {
     KToggleAction *viewStatusBar;
 
-    QLabel *_dataBar, *_memoryBar, *_progressMsg, *_readyBar;
-    QProgressBar *_progressBar;
+    KstQuickLabel *_readyBar;
+    KstQuickProgressBar *_progressBar;
+    QLabel *_memoryBar, *_dataBar;
     bool _stopping;
     KstIfaceImpl *_dcopIface;

--- kdeextragear-2/kst/kst/Makefile.am  #1.139:1.140
@@ -48,4 +48,6 @@
         plotlistbox.cpp \
         kstdataobject.cpp \
+        kstquickprogressbar.cpp \
+        kstquicklabel.cpp \
         kstscalartable.cpp \
         kstvectortable.cpp \





More information about the Kst mailing list