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

George Staikos staikos at kde.org
Wed Nov 21 16:35:48 CET 2007


SVN commit 739690 by staikos:

make it compile by moving the power spectrum setting code into objectdefaults.
I think it should be there anyway, and not use dialogdefaults at all, right?
This is a bit of a hack but if it's the right approach it can be adjusted and
cleaned.  headers also cleaned up in a few files.


 M  +0 -17     libkst/dialogdefaults.cpp  
 M  +0 -2      libkst/dialogdefaults.h  
 M  +14 -14    libkstapp/datawizard.cpp  
 M  +13 -15    libkstapp/powerspectrumdialog.cpp  
 M  +19 -0     libkstmath/objectdefaults.cpp  
 M  +2 -0      libkstmath/objectdefaults.h  


--- branches/work/kst/portto4/kst/src/libkst/dialogdefaults.cpp #739689:739690
@@ -33,20 +33,3 @@
   Kst::dialogDefaults->setValue("genVector/length", V->length());
 }
 
-void Kst::setSpectrumDefaults(PSDPtr P) {
-  //FIXME Do we need a V->readLock() here?
-  //NOTE: we are storing enums as ints here... so there might be
-  //      odd behavior if the enums change betwee recompiles.
-  Kst::dialogDefaults->setValue("spectrum/freq", P->frequency());
-  Kst::dialogDefaults->setValue("spectrum/average", P->average());
-  Kst::dialogDefaults->setValue("spectrum/len", P->length());
-  Kst::dialogDefaults->setValue("spectrum/apodize", P->apodize());
-  Kst::dialogDefaults->setValue("spectrum/removeMean", P->removeMean());
-  Kst::dialogDefaults->setValue("spectrum/vUnits", P->vectorUnits());
-  Kst::dialogDefaults->setValue("spectrum/rUnits", P->rateUnits());
-  Kst::dialogDefaults->setValue("spectrum/apodizeFxn", P->apodizeFxn());
-  Kst::dialogDefaults->setValue("spectrum/gaussianSigma", P->gaussianSigma());
-  Kst::dialogDefaults->setValue("spectrum/output", P->output());
-  Kst::dialogDefaults->setValue("spectrum/interpolateHoles", P->interpolateHoles());
-}
-
--- branches/work/kst/portto4/kst/src/libkst/dialogdefaults.h #739689:739690
@@ -19,7 +19,6 @@
 #define KSTDIALOGDEFAULTS
 
 #include "datavector.h"
-#include "../libkstmath/psd.h"
 #include "generatedvector.h"
 
 class QSettings;
@@ -29,7 +28,6 @@
 
   void setDataVectorDefaults(DataVectorPtr);
   void setGenVectorDefaults(GeneratedVectorPtr V);
-  void setSpectrumDefaults(PSDPtr P);
 }
 
 #endif
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #739689:739690
@@ -12,23 +12,23 @@
 #include "datawizard.h"
 
 #include <QFileInfo>
-#include "objectstore.h"
+#include <QMessageBox>
+
+#include "colorsequence.h"
+#include "curve.h"
+#include "datacollection.h"
+#include "dataobjectcollection.h"
+#include "datasourcedialog.h"
+#include "datavector.h"
+#include "dialogdefaults.h"
 #include "document.h"
 #include "mainwindow.h"
-#include "datasourcedialog.h"
-#include "datacollection.h"
-#include "dataobjectcollection.h"
+#include "objectdefaults.h"
+#include "objectstore.h"
+#include "plotitem.h"
 #include "plotiteminterface.h"
-#include "plotitem.h"
-#include "dialogdefaults.h"
-
-#include <QMessageBox>
-
+#include "settings.h"
 #include "vectordefaults.h"
-#include "datavector.h"
-#include "curve.h"
-#include "colorsequence.h"
-#include "settings.h"
 
 namespace Kst {
 
@@ -914,7 +914,7 @@
     }
 
     if (n_psd>0) {
-      setSpectrumDefaults(powerspectrum);
+      objectDefaults.setSpectrumDefaults(powerspectrum);
     }
   }
 
--- branches/work/kst/portto4/kst/src/libkstapp/powerspectrumdialog.cpp #739689:739690
@@ -11,24 +11,22 @@
 
 #include "powerspectrumdialog.h"
 
-#include "dialogpage.h"
-
-#include "psd.h"
-
-#include "view.h"
-#include "plotitem.h"
-#include "tabwidget.h"
-#include "mainwindow.h"
 #include "application.h"
-#include "plotrenderitem.h"
 #include "curve.h"
-#include "document.h"
-#include "objectstore.h"
-
-#include "defaultnames.h"
 #include "datacollection.h"
 #include "dataobjectcollection.h"
+#include "defaultnames.h"
 #include "dialogdefaults.h"
+#include "dialogpage.h"
+#include "document.h"
+#include "mainwindow.h"
+#include "objectdefaults.h"
+#include "objectstore.h"
+#include "plotitem.h"
+#include "plotrenderitem.h"
+#include "psd.h"
+#include "tabwidget.h"
+#include "view.h"
 
 #include <QPushButton>
 
@@ -187,7 +185,7 @@
 
   powerspectrum->update(0);
   powerspectrum->unlock();
-  setSpectrumDefaults(powerspectrum);
+  Kst::objectDefaults.setSpectrumDefaults(powerspectrum);
 
   //FIXME this should be a command...
   //FIXME need some smart placement...
@@ -262,7 +260,7 @@
     powerspectrum->update(0);
     powerspectrum->unlock();
 
-    setSpectrumDefaults(powerspectrum);
+    Kst::objectDefaults.setSpectrumDefaults(powerspectrum);
 
   }
   return dataObject();
--- branches/work/kst/portto4/kst/src/libkstmath/objectdefaults.cpp #739689:739690
@@ -16,6 +16,8 @@
 #include "psd.h"
 #include "objectstore.h"
 
+#include <dialogdefaults.h>
+
 namespace Kst {
 
 ObjectDefaults objectDefaults;
@@ -96,5 +98,22 @@
   _interpolateHoles = config->value("defaultInterpolateHoles", false).toBool();
 }
 
+void ObjectDefaults::setSpectrumDefaults(PSDPtr P) {
+  //FIXME Do we need a V->readLock() here?
+  //NOTE: we are storing enums as ints here... so there might be
+  //      odd behavior if the enums change between recompiles.
+  Kst::dialogDefaults->setValue("spectrum/freq", P->frequency());
+  Kst::dialogDefaults->setValue("spectrum/average", P->average());
+  Kst::dialogDefaults->setValue("spectrum/len", P->length());
+  Kst::dialogDefaults->setValue("spectrum/apodize", P->apodize());
+  Kst::dialogDefaults->setValue("spectrum/removeMean", P->removeMean());
+  Kst::dialogDefaults->setValue("spectrum/vUnits", P->vectorUnits());
+  Kst::dialogDefaults->setValue("spectrum/rUnits", P->rateUnits());
+  Kst::dialogDefaults->setValue("spectrum/apodizeFxn", P->apodizeFxn());
+  Kst::dialogDefaults->setValue("spectrum/gaussianSigma", P->gaussianSigma());
+  Kst::dialogDefaults->setValue("spectrum/output", P->output());
+  Kst::dialogDefaults->setValue("spectrum/interpolateHoles", P->interpolateHoles());
 }
+
+}
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstmath/objectdefaults.h #739689:739690
@@ -15,6 +15,7 @@
 #include <QString>
 
 #include "kst_export.h"
+#include "psd.h"
 
 class QSettings;
 
@@ -37,6 +38,7 @@
     int apodizeFxn() const { return _apodizeFxn; }
     int output() const { return _output; }
     int interpolateHoles() const { return _interpolateHoles; }
+    void setSpectrumDefaults(PSDPtr P);
 
     void readConfig(QSettings *config);
     void writeConfig(QSettings *config);


More information about the Kst mailing list