[Kst] branches/work/kst/pluginify/kst/src/plugins/crossspectrum
Adam Treat
treat at kde.org
Wed Sep 20 21:42:01 CEST 2006
SVN commit 586860 by treat:
* Style fixes
M +30 -0 crosspowerspectrum.cpp
M +36 -37 crosspowerspectrum.h
M +19 -16 crossspectrumdialog_i.cpp
--- branches/work/kst/pluginify/kst/src/plugins/crossspectrum/crosspowerspectrum.cpp #586859:586860
@@ -48,9 +48,11 @@
: KstDataObject() {
}
+
CrossPowerSpectrum::~CrossPowerSpectrum() {
}
+
QString CrossPowerSpectrum::v1Tag() const {
KstVectorPtr v = v1();
if (v) {
@@ -59,6 +61,7 @@
return QString::null;
}
+
QString CrossPowerSpectrum::v2Tag() const {
KstVectorPtr v = v2();
if (v) {
@@ -67,6 +70,7 @@
return QString::null;
}
+
QString CrossPowerSpectrum::fftTag() const {
KstScalarPtr s = fft();
if (s) {
@@ -75,6 +79,7 @@
return QString::null;
}
+
QString CrossPowerSpectrum::sampleTag() const {
KstScalarPtr s = sample();
if (s) {
@@ -83,6 +88,7 @@
return QString::null;
}
+
QString CrossPowerSpectrum::realTag() const {
KstVectorPtr v = real();
if (v) {
@@ -91,6 +97,7 @@
return QString::null;
}
+
QString CrossPowerSpectrum::imaginaryTag() const {
KstVectorPtr v = imaginary();
if (v) {
@@ -99,6 +106,7 @@
return QString::null;
}
+
QString CrossPowerSpectrum::frequencyTag() const {
KstVectorPtr v = frequency();
if (v) {
@@ -107,34 +115,42 @@
return QString::null;
}
+
KstVectorPtr CrossPowerSpectrum::v1() const {
return *_inputVectors.find(VECTOR_ONE);
}
+
KstVectorPtr CrossPowerSpectrum::v2() const {
return *_inputVectors.find(VECTOR_TWO);
}
+
KstScalarPtr CrossPowerSpectrum::fft() const {
return *_inputScalars.find(FFT_LENGTH);
}
+
KstScalarPtr CrossPowerSpectrum::sample() const {
return *_inputScalars.find(SAMPLE_RATE);
}
+
KstVectorPtr CrossPowerSpectrum::real() const {
return *_outputVectors.find(REAL);
}
+
KstVectorPtr CrossPowerSpectrum::imaginary() const {
return *_outputVectors.find(IMAGINARY);
}
+
KstVectorPtr CrossPowerSpectrum::frequency() const {
return *_outputVectors.find(FREQUENCY);
}
+
void CrossPowerSpectrum::setV1(KstVectorPtr new_v1) {
if (new_v1) {
_inputVectors[VECTOR_ONE] = new_v1;
@@ -144,6 +160,7 @@
setDirty();
}
+
void CrossPowerSpectrum::setV2(KstVectorPtr new_v2) {
if (new_v2) {
_inputVectors[VECTOR_TWO] = new_v2;
@@ -153,6 +170,7 @@
setDirty();
}
+
void CrossPowerSpectrum::setFFT(KstScalarPtr new_fft) {
if (new_fft) {
_inputScalars[FFT_LENGTH] = new_fft;
@@ -162,6 +180,7 @@
setDirty();
}
+
void CrossPowerSpectrum::setSample(KstScalarPtr new_sample) {
if (new_sample) {
_inputScalars[SAMPLE_RATE] = new_sample;
@@ -171,24 +190,28 @@
setDirty();
}
+
void CrossPowerSpectrum::setReal(const QString &name) {
KstVectorPtr v = new KstVector(name, 0, this, false);
_outputVectors.insert(REAL, v);
KST::addVectorToList(v);
}
+
void CrossPowerSpectrum::setImaginary(const QString &name) {
KstVectorPtr v = new KstVector(name, 0, this, false);
_outputVectors.insert(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();
setDirty(false);
@@ -229,6 +252,7 @@
return setLastUpdateResult(depUpdated ? UPDATE : NO_CHANGE);
}
+
void CrossPowerSpectrum::crossspectrum() {
KstVectorPtr v1 = *_inputVectors.find(VECTOR_ONE);
KstVectorPtr v2 = *_inputVectors.find(VECTOR_TWO);
@@ -349,24 +373,29 @@
// return 0;
}
+
QString CrossPowerSpectrum::propertyString() const {
return "crosspowerspectrum";
}
+
KstDataObjectPtr CrossPowerSpectrum::makeDuplicate(KstDataObjectDataObjectMap&) {
return 0;
}
+
void CrossPowerSpectrum::showNewDialog() {
CrossSpectrumDialogI *dialog = new CrossSpectrumDialogI;
dialog->show();
}
+
void CrossPowerSpectrum::showEditDialog() {
CrossSpectrumDialogI *dialog = new CrossSpectrumDialogI;
dialog->showEdit(tagName());
}
+
void CrossPowerSpectrum::load(const QDomElement &e) {
QDomNode n = e.firstChild();
@@ -402,6 +431,7 @@
}
}
+
void CrossPowerSpectrum::save(QTextStream& ts, const QString& indent) {
QString l2 = indent + " ";
ts << indent << "<plugin name=\"Cross Power Spectrum\">" << endl;
--- branches/work/kst/pluginify/kst/src/plugins/crossspectrum/crosspowerspectrum.h #586859:586860
@@ -21,51 +21,50 @@
class CrossPowerSpectrum : public KstDataObject {
Q_OBJECT
-public:
+ public:
+ CrossPowerSpectrum(QObject *parent, const char *name, const QStringList &args);
+ virtual ~CrossPowerSpectrum();
- CrossPowerSpectrum(QObject *parent, const char *name, const QStringList &args);
- virtual ~CrossPowerSpectrum();
+ //algorithm
+ void crossspectrum();
- //algorithm
- void crossspectrum();
+ QString v1Tag() const;
+ QString v2Tag() const;
+ QString fftTag() const;
+ QString sampleTag() const;
+ QString realTag() const;
+ QString imaginaryTag() const;
+ QString frequencyTag() const;
- 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;
+ KstScalarPtr sample() const;
+ KstVectorPtr real() const;
+ KstVectorPtr imaginary() const;
+ KstVectorPtr frequency() const;
- KstVectorPtr v1() const;
- KstVectorPtr v2() const;
- KstScalarPtr fft() const;
- KstScalarPtr sample() const;
- KstVectorPtr real() const;
- 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);
- 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;
+ virtual KstDataObjectPtr makeDuplicate(KstDataObjectDataObjectMap&);
- //Pure virtual methods from KstDataObject
- virtual KstObject::UpdateType update(int updateCounter = -1);
- virtual QString propertyString() const;
- virtual KstDataObjectPtr makeDuplicate(KstDataObjectDataObjectMap&);
+ //Regular virtual methods from KstDataObject
+ virtual void load(const QDomElement &e);
+ virtual void save(QTextStream& ts, const QString& indent = QString::null);
- //Regular virtual methods from KstDataObject
- virtual void load(const QDomElement &e);
- virtual void save(QTextStream& ts, const QString& indent = QString::null);
-
protected slots:
- //Pure virtual slots from KstDataObject
- virtual void showNewDialog();
- virtual void showEditDialog();
+ //Pure virtual slots from KstDataObject
+ virtual void showNewDialog();
+ virtual void showEditDialog();
};
typedef KstSharedPtr<CrossPowerSpectrum> CrossPowerSpectrumPtr;
--- branches/work/kst/pluginify/kst/src/plugins/crossspectrum/crossspectrumdialog_i.cpp #586859:586860
@@ -67,16 +67,17 @@
connect(this, SIGNAL(modified()), KstApp::inst()->document(), SLOT(wasModified())); //FIXME this should be in KstDataDialog constructor...
}
+
CrossSpectrumDialogI::~CrossSpectrumDialogI() {
}
-void CrossSpectrumDialogI::update()
-{
+
+void CrossSpectrumDialogI::update() {
//called upon showing the dialog either in 'edit' mode or 'new' mode
}
-bool CrossSpectrumDialogI::newObject()
-{
+
+bool CrossSpectrumDialogI::newObject() {
//called upon clicking 'ok' in 'new' mode
//return false if the specified objects can't be made, otherwise true
@@ -125,8 +126,8 @@
return true;
}
-bool CrossSpectrumDialogI::editObject()
-{
+
+bool CrossSpectrumDialogI::editObject() {
//called upon clicking 'ok' in 'edit' mode
//return false if the specified objects can't be editted, otherwise true
@@ -172,8 +173,8 @@
return true;
}
-bool CrossSpectrumDialogI::editSingleObject(CrossPowerSpectrumPtr cps)
-{
+
+bool CrossSpectrumDialogI::editSingleObject(CrossPowerSpectrumPtr cps) {
KST::vectorList.lock().readLock();
KST::scalarList.lock().readLock();
@@ -227,6 +228,7 @@
return true;
}
+
void CrossSpectrumDialogI::fillFieldsForEdit() {
CrossPowerSpectrumPtr cps = kst_cast<CrossPowerSpectrum>(_dp);
if (!cps) {
@@ -238,20 +240,20 @@
_tagName->setText(cps->tagName());
_legendText->setText(defaultTag); //FIXME?
- _w->_v1->setSelection( cps->v1Tag() );
- _w->_v2->setSelection( cps->v2Tag() );
+ _w->_v1->setSelection(cps->v1Tag());
+ _w->_v2->setSelection(cps->v2Tag());
- _w->_fft->setSelection( cps->fftTag() );
- _w->_sample->setSelection( cps->sampleTag() );
+ _w->_fft->setSelection(cps->fftTag());
+ _w->_sample->setSelection(cps->sampleTag());
- _w->_real->setText( cps->realTag() );
+ _w->_real->setText(cps->realTag());
_w->_real->setEnabled( false );
- _w->_imaginary->setText( cps->imaginaryTag() );
+ _w->_imaginary->setText(cps->imaginaryTag());
_w->_imaginary->setEnabled( false );
- _w->_frequency->setText( cps->frequencyTag() );
- _w->_frequency->setEnabled( false );
+ _w->_frequency->setText(cps->frequencyTag());
+ _w->_frequency->setEnabled(false);
cps->unlock();
@@ -260,6 +262,7 @@
setFixedHeight(height());
}
+
void CrossSpectrumDialogI::fillFieldsForNew() {
_tagName->setText(defaultTag);
_legendText->setText(defaultTag);
More information about the Kst
mailing list