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

Peter Kümmel syntheticpp at gmx.net
Sat Mar 19 14:13:42 CET 2011


SVN commit 1225297 by kuemmel:

simplify usecase: open data by double-click, fix read options with the data wizard.
                  ->show last data file in data wizard

 M  +3 -1      commandlineparser.cpp  
 M  +6 -2      commandlineparser.h  
 M  +2 -1      datawizard.cpp  
 M  +4 -1      mainwindow.cpp  
 M  +2 -1      mainwindow.h  


--- branches/work/kst/portto4/kst/src/libkstapp/commandlineparser.cpp #1225296:1225297
@@ -138,7 +138,8 @@
 
 
 
-CommandLineParser::CommandLineParser(Document *doc):
+CommandLineParser::CommandLineParser(Document *doc, MainWindow* mw) :
+      _mainWindow(mw),
       _doAve(false), _doSkip(false), _doConsecutivePlots(true), _useBargraph(false), 
       _useLines(true), _usePoints(false), _overrideStyle(false), _sampleRate(1.0), 
       _numFrames(-1), _startFrame(-1),
@@ -608,6 +609,7 @@
             curves = autoCurves(ds);
           }
           if (!curves.isEmpty()) {
+            _mainWindow->updateRecentDataFiles(arg);
             int count = 0;
             foreach(const ObjectPtr& ptr, curves) {
               if (kst_cast<Curve>(ptr)) {
--- branches/work/kst/portto4/kst/src/libkstapp/commandlineparser.h #1225296:1225297
@@ -16,6 +16,7 @@
 #include "document.h"
 #include "datavector.h"
 #include "plotitem.h"
+#include "mainwindow.h"
 
 #include <QStringList>
 #include <QPrinter>
@@ -24,9 +25,10 @@
 /**
 	@author Barth Netterfield <netterfield at physics.utoronto.ca>
 */
-class CommandLineParser{
+class CommandLineParser
+{
 public:
-  CommandLineParser(Document *doc);
+  CommandLineParser(Document *doc, MainWindow* mw);
   ~CommandLineParser();
 
   bool processCommandLine(bool *ok);
@@ -56,6 +58,8 @@
   bool _landscape;
   QPrinter::PaperSize _paperSize;
 
+  MainWindow* _mainWindow;
+
   QStringList _fileNames;
   QStringList _arguments;
   PlotItem *_plotItem;
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #1225296:1225297
@@ -45,7 +45,8 @@
 //
 
 DataWizardPageDataSource::DataWizardPageDataSource(ObjectStore *store, QWidget *parent, const QString& default_source)
-  : QWizardPage(parent), _pageValid(false), _store(store), _requestID(0) {
+  : QWizardPage(parent), _pageValid(false), _store(store), _requestID(0)
+{
    setupUi(this);
 
   MainWindow::setWidgetFlags(this);
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1225296:1225297
@@ -298,7 +298,10 @@
 void MainWindow::updateRecentDataFiles(const QString& filename)
 {
   updateRecentFiles("recentDataFileList", _toolsMenu, _bottomRecentDataActions, _recentDataFilesMenu, filename, SLOT(openRecentDataFile()));
+  if (!filename.isEmpty()) {
+    _dialogDefaults->setValue("vector/datasource", filename);
 }
+}
 
 
 void MainWindow::updateRecentFiles(const QString& key, QMenu* menu, QList<QAction*>& actions, QMenu* submenu, const QString& newfilename, const char* openslot)
@@ -375,7 +378,7 @@
   delete _doc;
   _doc = new Document(this);
 
-  CommandLineParser P(_doc);
+  CommandLineParser P(_doc, this);
 
   bool ok = _doc->initFromCommandLine(&P);
   if (!P.pngFile().isEmpty()) {
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.h #1225296:1225297
@@ -107,6 +107,8 @@
     void tiedZoomRemoved();
     void allPlotsTiedZoom();
 
+    void updateRecentDataFiles(const QString& newfilename = QString());
+
   private Q_SLOTS:
     void aboutToQuit();
     void about();
@@ -148,7 +150,6 @@
     void openRecentKstFile();
     void openRecentDataFile();
     void updateRecentKstFiles(const QString& newfilename = QString());
-    void updateRecentDataFiles(const QString& newfilename = QString());
     void checkRecentFilesOnExistence();
 
   protected:


More information about the Kst mailing list