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

List:       kde-commits
Subject:    [kst-plot] src: show a 'busy' progress bar when vectors are via a .kst file
From:       Peter_Kümmel <syntheticpp () gmx ! net>
Date:       2014-03-03 19:42:15
Message-ID: E1WKYkh-0003GJ-OQ () scm ! kde ! org
[Download RAW message or body]

Git commit eb7aa03de1c30bef82cac556f772bcd6d9499b50 by Peter Kümmel.
Committed on 03/03/2014 at 19:40.
Pushed by kuemmel into branch 'master'.

show a 'busy' progress bar when vectors are via a .kst file

M  +8    -2    src/datasources/ascii/asciisource.cpp
M  +1    -0    src/libkstapp/datasourcepluginfactory.cpp
M  +9    -0    src/libkstapp/mainwindow.cpp

http://commits.kde.org/kst-plot/eb7aa03de1c30bef82cac556f772bcd6d9499b50

diff --git a/src/datasources/ascii/asciisource.cpp \
b/src/datasources/ascii/asciisource.cpp index efb4971..043de09 100644
--- a/src/datasources/ascii/asciisource.cpp
+++ b/src/datasources/ascii/asciisource.cpp
@@ -557,8 +557,14 @@ void AsciiSource::emitProgress(int percent, const QString& \
message)  //-------------------------------------------------------------------------------------------
  void AsciiSource::updateProgress(const QString& message)
 {
-  if (_showProgress && _progressSteps != 0 && _read_count_max != -1) {
-    emitProgress(50 + 50 * _progress / _progressSteps, _actualField + ": " + \
message); +  if (_showProgress) {
+      if (_read_count_max == 0) {
+          emitProgress(-1, ""); // indicate "busy"
+      } else {
+        if (_progressSteps != 0 && _read_count_max != -1) {
+          emitProgress(50 + 50 * _progress / _progressSteps, _actualField + ": " + \
message); +        }
+      }
   }
 }
 
diff --git a/src/libkstapp/datasourcepluginfactory.cpp \
b/src/libkstapp/datasourcepluginfactory.cpp index 63f641e..a476213 100644
--- a/src/libkstapp/datasourcepluginfactory.cpp
+++ b/src/libkstapp/datasourcepluginfactory.cpp
@@ -80,6 +80,7 @@ DataSourcePtr \
                DataSourcePluginFactory::generateDataSource(ObjectStore *store, QX
     dataSource = DataSourcePluginManager::loadSource(store, fileName, fileType);
     if (dataSource) {
       QObject::connect(dataSource, SIGNAL(progress(int,QString)), \
kstApp->mainWindow(), SLOT(updateProgress(int,QString))); +      \
dataSource->vector().prepareRead(0);  \
dataSource->parseProperties(propertyAttributes);  if (fileName != alternate_filename) \
{  dataSource->setAlternateFilename(alternate_filename);
diff --git a/src/libkstapp/mainwindow.cpp b/src/libkstapp/mainwindow.cpp
index 4e1ac2a..15fedab 100644
--- a/src/libkstapp/mainwindow.cpp
+++ b/src/libkstapp/mainwindow.cpp
@@ -457,6 +457,7 @@ void MainWindow::openFile(const QString &file) {
   QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
   newDoc(true); // Does all the init stuff, but does not ask for override as it's \
supposed to be done elsewhere  bool ok = _doc->open(file);
+  updateProgress(100, "");
   QApplication::restoreOverrideCursor();
 
   if (!ok) {
@@ -1554,7 +1555,15 @@ QProgressBar *MainWindow::progressBar() const {
 
 void MainWindow::updateProgress(int percent, const QString& message)
 {
+  if (percent == -1) {
+    _progressBar->setMaximum(0);
+    _progressBar->setMinimum(0);
+    _progressBar->show();
+    return;
+  }
+
   if (percent  > 0 && percent < 100) {
+    _progressBar->setMaximum(100);
     _progressBar->setValue(percent);
     _progressBar->show();
   } else {


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

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