[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Aug 11 21:54:34 CEST 2004


CVS commit by staikos: 

- reduce headers
- hide statusbar elements not in use
- reorder statusbar elements to reduce jitter


  M +28 -16    kst.cpp   1.204
  M +2 -3      kst.h   1.94


--- kdeextragear-2/kst/kst/kst.cpp  #1.203:1.204
@@ -26,4 +26,5 @@
 #include <qpainter.h>
 #include <qpaintdevicemetrics.h>
+#include <qprogressbar.h>
 #include <qpushbutton.h>
 #include <qtimer.h>
@@ -656,4 +657,14 @@ bool KstApp::getTieZoom() {
 
 void KstApp::initStatusBar() {
+  _dataBar = new QLabel(QString::null, statusBar());
+  statusBar()->addWidget(_dataBar, 0, true);
+
+#ifdef HAVE_LINUX
+  _memoryBar = new QLabel(i18n("0 MB available"), statusBar());
+  statusBar()->addWidget(_memoryBar, 0, true);
+  connect(&_memTimer, SIGNAL(timeout()), this, SLOT(updateMemoryStatus()));
+  _memTimer.start(5000);
+#endif
+
   _progressMsg = new QLabel(QString::null, statusBar());
   statusBar()->addWidget(_progressMsg, 0, true);
@@ -663,14 +674,8 @@ void KstApp::initStatusBar() {
   _progressBar->setCenterIndicator(true);
   statusBar()->addWidget(_progressBar, 0, true);
+  _progressBar->hide();
+  _progressMsg->hide();
 
   statusBar()->insertItem(i18n("Almost Ready"), KST_STATUSBAR_STATUS);
-#ifdef HAVE_LINUX
-  _memoryBar = new QLabel(i18n("0 MB available"), statusBar());
-  statusBar()->addWidget(_memoryBar, 0, true);
-  connect(&_memTimer, SIGNAL(timeout()), this, SLOT(updateMemoryStatus()));
-  _memTimer.start(5000);
-#endif
-  _dataBar = new QLabel(QString::null, statusBar());
-  statusBar()->addWidget(_dataBar, 0, true);
 
   statusBar()->show();
@@ -1112,19 +1117,26 @@ void KstApp::slotUpdateDataMsg(const QSt
 
 
-void KstApp::slotUpdateProgress(int iTotal, int iStep, const QString &msg) {
-  if (iStep > 0) {
+void KstApp::slotUpdateProgress(int total, int step, const QString &msg) {
+  if (step > 0) {
+    _progressBar->show();
     if (!_progressBar->percentageVisible()) {
       _progressBar->setPercentageVisible(true);
     }
-    if (iTotal != _progressBar->totalSteps()) {
-      _progressBar->setTotalSteps(iTotal);
+    if (total != _progressBar->totalSteps()) {
+      _progressBar->setTotalSteps(total);
     }
-    _progressMsg->setText(QString::null);
-    _progressBar->setProgress(iStep);
-    _progressMsg->setText(msg);
+    _progressBar->setProgress(step);
   } else {
     _progressBar->setPercentageVisible(false);
-    _progressMsg->setText(msg);
     _progressBar->reset();
+    _progressBar->hide();
+  }
+
+  if (msg.isEmpty()) {
+    _progressMsg->setText(QString::null);
+    _progressMsg->hide();
+  } else {
+    _progressMsg->setText(msg);
+    _progressMsg->show();
   }
 

--- kdeextragear-2/kst/kst/kst.h  #1.93:1.94
@@ -23,10 +23,8 @@
 
 // include files for Qt
-#include <qprogressbar.h>
 
 // include files for KDE
 #include <kapplication.h>
 #include <kmdimainfrm.h>
-#include <kprogress.h>
 
 // application specific includes
@@ -59,4 +57,5 @@ class VectorSaveDialog;
 
 class QLabel;
+class QProgressBar;
 
 /** The base class for Kst application windows. It sets up the main
@@ -239,5 +238,5 @@ class KstApp : public KMdiMainFrm {
     void slotUpdateStatusMsg(const QString &msg);
     void slotUpdateDataMsg(const QString &msg);
-    void slotUpdateProgress(int iTotal, int iStep, const QString &msg);
+    void slotUpdateProgress(int total, int step, const QString &msg);
     
     /** just calls plotDialog->show_I(0) */





More information about the Kst mailing list