[Kst] branches/work/kst/pluginify/kst/src/plugins
Adam Treat
treat at kde.org
Thu Sep 14 22:45:27 CEST 2006
SVN commit 584430 by treat:
* Implement the dialog for new crossspectrum plugin.
* Clean up formatting a bit.
M +2 -2 crossspectrum/Makefile.am
M +116 -2 crossspectrum/crosspowerspectrum.cpp
M +16 -0 crossspectrum/crosspowerspectrum.h
A crossspectrum/crossspectrumdialog_i.cpp [License: GPL (v2+)]
A crossspectrum/crossspectrumdialog_i.h [License: GPL (v2+)]
A crossspectrum/crossspectrumdialogwidget.ui
M +1 -3 linefit/linefitdialog_i.cpp
M +1 -2 linefit/linefitdialog_i.h
M +5 -10 linefit/linefitplugin.cpp
--- branches/work/kst/pluginify/kst/src/plugins/crossspectrum/Makefile.am #584429:584430
@@ -1,9 +1,9 @@
-INCLUDES=-I$(top_srcdir)/kst -I$(top_srcdir)/kst/src/libkst -I$(top_srcdir)/kst/src/libkstmath $(all_includes)
+INCLUDES=-I$(top_srcdir)/kst -I$(top_srcdir)/kst/src/widgets -I$(top_srcdir)/kst/src/libkst -I$(top_srcdir)/kst/src/libkstapp -I$(top_srcdir)/kst/src/libkstmath $(all_includes)
kde_module_LTLIBRARIES=kst_crossspectrum.la
kst_crossspectrum_la_LDFLAGS=$(all_libraries) -module -avoid-version
-kst_crossspectrum_la_SOURCES=crosspowerspectrum.cpp crossspectrum.cpp fftsg_h.c
+kst_crossspectrum_la_SOURCES=crosspowerspectrum.cpp crossspectrumdialog_i.cpp crossspectrumdialogwidget.ui crossspectrum.cpp fftsg_h.c
services_DATA=kst_crossspectrum.desktop
servicesdir=$(kde_servicesdir)/kst
--- branches/work/kst/pluginify/kst/src/plugins/crossspectrum/crosspowerspectrum.cpp #584429:584430
@@ -24,6 +24,8 @@
#include <kstdatacollection.h>
+#include "crossspectrumdialog_i.h"
+
#define KSTPSDMAXLEN 27
extern "C" void rdft(int n, int isgn, double *a); //fast fourier transform...
@@ -49,6 +51,62 @@
CrossPowerSpectrum::~CrossPowerSpectrum() {
}
+QString CrossPowerSpectrum::v1Tag() const {
+ KstVectorPtr v = v1();
+ if (v) {
+ return v->tagName();
+ }
+ return QString::null;
+}
+
+QString CrossPowerSpectrum::v2Tag() const {
+ KstVectorPtr v = v2();
+ if (v) {
+ return v->tagName();
+ }
+ return QString::null;
+}
+
+QString CrossPowerSpectrum::fftTag() const {
+ KstScalarPtr s = fft();
+ if (s) {
+ return s->tagName();
+ }
+ return QString::null;
+}
+
+QString CrossPowerSpectrum::sampleTag() const {
+ KstScalarPtr s = sample();
+ if (s) {
+ return s->tagName();
+ }
+ return QString::null;
+}
+
+QString CrossPowerSpectrum::realTag() const {
+ KstVectorPtr v = real();
+ if (v) {
+ return v->tagName();
+ }
+ return QString::null;
+}
+
+QString CrossPowerSpectrum::imaginaryTag() const {
+ KstVectorPtr v = imaginary();
+ if (v) {
+ return v->tagName();
+ }
+ return QString::null;
+}
+
+QString CrossPowerSpectrum::frequencyTag() const {
+ KstVectorPtr v = frequency();
+ if (v) {
+ return v->tagName();
+ }
+ return QString::null;
+}
+
KstVectorPtr CrossPowerSpectrum::v1() const {
return *_inputVectors.find(VECTOR_ONE);
}
@@ -77,6 +135,60 @@
return *_outputVectors.find(FREQUENCY);
}
+void CrossPowerSpectrum::setV1(KstVectorPtr new_v1) {
+ if (new_v1) {
+ _inputVectors[VECTOR_ONE] = new_v1;
+ } else {
+ _inputVectors.remove(VECTOR_ONE);
+ }
+ setDirty();
+}
+
+void CrossPowerSpectrum::setV2(KstVectorPtr new_v2) {
+ if (new_v2) {
+ _inputVectors[VECTOR_TWO] = new_v2;
+ } else {
+ _inputVectors.remove(VECTOR_TWO);
+ }
+ setDirty();
+}
+
+void CrossPowerSpectrum::setFFT(KstScalarPtr new_fft) {
+ if (new_fft) {
+ _inputScalars[FFT_LENGTH] = new_fft;
+ } else {
+ _inputScalars.remove(FFT_LENGTH);
+ }
+ setDirty();
+}
+
+void CrossPowerSpectrum::setSample(KstScalarPtr new_sample) {
+ if (new_sample) {
+ _inputScalars[SAMPLE_RATE] = new_sample;
+ } else {
+ _inputScalars.remove(SAMPLE_RATE);
+ }
+ setDirty();
+}
+
+void CrossPowerSpectrum::setReal(const QString &name) {
+ KstVectorPtr v = new KstVector(name, 0, this, false);
+ _outputVectors.insert("Cross Spectrum: Real", v);
+ KST::addVectorToList(v);
+}
+
+void CrossPowerSpectrum::setImaginary(const QString &name) {
+ KstVectorPtr v = new KstVector(name, 0, this, false);
+ _outputVectors.insert("Cross Spectrum: Imaginary", v);
+ KST::addVectorToList(v);
+}
+
+void CrossPowerSpectrum::setFrequency(const QString &name) {
+ KstVectorPtr v = new KstVector(name, 0, this, false);
+ _outputVectors.insert("Frequency", v);
+ KST::addVectorToList(v);
+}
+
KstObject::UpdateType CrossPowerSpectrum::update(int updateCounter)
{
bool force = dirty();
@@ -237,11 +349,13 @@
}
void CrossPowerSpectrum::showNewDialog() {
- KMessageBox::information( 0, "insert testplugin config widget here :)", "testpluginconfig" );
+ CrossSpectrumDialogI *dialog = new CrossSpectrumDialogI;
+ dialog->show();
}
void CrossPowerSpectrum::showEditDialog() {
- KMessageBox::information( 0, "insert testplugin config widget here :)", "testpluginconfig" );
+ CrossSpectrumDialogI *dialog = new CrossSpectrumDialogI;
+ dialog->showEdit(tagName());
}
void CrossPowerSpectrum::load(const QDomElement &e) {
--- branches/work/kst/pluginify/kst/src/plugins/crossspectrum/crosspowerspectrum.h #584429:584430
@@ -29,6 +29,14 @@
//algorithm
void crossspectrum();
+ QString v1Tag() const;
+ QString v2Tag() const;
+ QString fftTag() const;
+ QString sampleTag() const;
+ QString realTag() const;
+ QString imaginaryTag() const;
+ QString frequencyTag() const;
+
KstVectorPtr v1() const;
KstVectorPtr v2() const;
KstScalarPtr fft() const;
@@ -37,6 +45,14 @@
KstVectorPtr imaginary() const;
KstVectorPtr frequency() const;
+ void setV1(KstVectorPtr new_v1);
+ void setV2(KstVectorPtr new_v2);
+ void setFFT(KstScalarPtr new_fft);
+ void setSample(KstScalarPtr new_sample);
+ void setReal(const QString &name);
+ void setImaginary(const QString &name);
+ void setFrequency(const QString &name);
+
//Pure virtual methods from KstDataObject
virtual KstObject::UpdateType update(int updateCounter = -1);
virtual QString propertyString() const;
--- branches/work/kst/pluginify/kst/src/plugins/linefit/linefitdialog_i.cpp #584429:584430
@@ -1,5 +1,5 @@
/***************************************************************************
- kstlinefitdialog_i.h - Part of KST
+ linefitdialog_i.h - Part of KST
-------------------
begin : 09/12/06
copyright : (C) 2006 The University of Toronto
@@ -51,8 +51,6 @@
const QString& LineFitDialogI::defaultTag = KGlobal::staticQString("<Auto Name>");
-QGuardedPtr<LineFitDialogI> LineFitDialogI::_inst;
-
LineFitDialogI::LineFitDialogI(QWidget* parent, const char* name, bool modal, WFlags fl)
: KstDataDialog(parent, name, modal, fl) {
_w = new LineFitDialogWidget(_contents);
--- branches/work/kst/pluginify/kst/src/plugins/linefit/linefitdialog_i.h #584429:584430
@@ -1,5 +1,5 @@
/***************************************************************************
- kstlinefitdialog_i.h - Part of KST
+ linefitdialog_i.h - Part of KST
-------------------
begin : 09/12/06
copyright : (C) 2006 The University of Toronto
@@ -51,7 +51,6 @@
private:
bool editSingleObject(LineFitPtr lf);
static const QString& defaultTag;
- static QGuardedPtr<LineFitDialogI> _inst;
LineFitDialogWidget *_w;
};
--- branches/work/kst/pluginify/kst/src/plugins/linefit/linefitplugin.cpp #584429:584430
@@ -283,34 +283,29 @@
setDirty();
}
-void LineFit::setXInterpolated(const QString &name)
-{
+void LineFit::setXInterpolated(const QString &name) {
KstVectorPtr v = new KstVector(name, 0, this, false);
_outputVectors.insert("X Interpolated", v);
KST::addVectorToList(v);
}
-void LineFit::setYInterpolated(const QString &name)
-{
+void LineFit::setYInterpolated(const QString &name) {
KstVectorPtr v = new KstVector(name, 0, this, false);
_outputVectors.insert("Y Interpolated", v);
KST::addVectorToList(v);
}
-void LineFit::setA(const QString &name)
-{
+void LineFit::setA(const QString &name) {
KstScalarPtr sp = new KstScalar(name, this);
_outputScalars.insert("a", sp);
}
-void LineFit::setB(const QString &name)
-{
+void LineFit::setB(const QString &name) {
KstScalarPtr sp = new KstScalar(name, this);
_outputScalars.insert("b", sp);
}
-void LineFit::setChi2(const QString &name)
-{
+void LineFit::setChi2(const QString &name) {
KstScalarPtr sp = new KstScalar(name, this);
_outputScalars.insert("chi^2", sp);
}
More information about the Kst
mailing list