[Kst] branches/work/kst/portto4/kst/src/libkstapp

Peter Kümmel syntheticpp at gmx.net
Sat Mar 19 21:34:53 CET 2011


SVN commit 1225318 by kuemmel:

ask if it should plot all curves

 M  +21 -4     commandlineparser.cpp  
 M  +1 -2      commandlineparser.h  


--- branches/work/kst/portto4/kst/src/libkstapp/commandlineparser.cpp #1225317:1225318
@@ -24,6 +24,7 @@
 #include <QCoreApplication>
 #include <QFileInfo>
 #include <QMessageBox>
+
 #include "curve.h"
 #include "psd.h"
 #include "histogram.h"
@@ -608,23 +609,39 @@
           if (curves.isEmpty()) {
             curves = autoCurves(ds);
           }
-          if (!curves.isEmpty()) {
+          int curve_count = 0;
+          foreach(const ObjectPtr& ptr, curves) {
+            if (kst_cast<Curve>(ptr)) {
+              curve_count++;
+            }
+          }
+          if (curve_count > 0) {
             _mainWindow->updateRecentDataFiles(arg);
             int count = 0;
+            const int max_count = 6 * 6;
+            bool asked = false;
             foreach(const ObjectPtr& ptr, curves) {
               if (kst_cast<Curve>(ptr)) {
+                if (!asked && count >= max_count) {
+                  asked = true;
+                  QMessageBox::StandardButton res = QMessageBox::question(0, "Kst reading datafile", QString(
+                    "Kst found %1 Curves in the specified data file.\n"
+                    "Should Kst plot all %1 curves?\n"
+                    "If not, Kst plots only %2 curves.").arg(curve_count).arg(max_count),
+                    QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
+                  if (res == QMessageBox::No) {
+                    break;
+                  }
+                }
                 addCurve(kst_cast<Curve>(ptr));
                 count++;
               }
-              if (count >= 6 * 6) {
-                break;
               }
             }
           }
         }
       }
     }
-  }
 
   // set defaults to match what has been set.
   _dialogDefaults->setValue("print/landscape", _landscape);
--- branches/work/kst/portto4/kst/src/libkstapp/commandlineparser.h #1225317:1225318
@@ -38,6 +38,7 @@
   //bool landscape() const {return _landscape;}
 
 private:
+  MainWindow* _mainWindow;
   bool _doAve;
   bool _doSkip;
   bool _doConsecutivePlots;
@@ -58,8 +59,6 @@
   bool _landscape;
   QPrinter::PaperSize _paperSize;
 
-  MainWindow* _mainWindow;
-
   QStringList _fileNames;
   QStringList _arguments;
   PlotItem *_plotItem;


More information about the Kst mailing list