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

Adam Treat treat at kde.org
Tue Sep 19 21:20:13 CEST 2006


SVN commit 586492 by treat:

* Port the linefit plugin to KstBasicPlugin instead
of inheriting directly from KstDataObject.  I'll prolly keep
the cross spectrum inheriting directly from KstDataObject as
a proof.
* Provide a default impl of makeDuplicate() in KstBasicPlugin...
I'm not sure what this method is used for, but either each
plugin will have to provide own impl or the default will return
0 as KstBasicPlugin is an abstract class.
* Give the dialog labels some semicolons.  Not sure if I should
prepend 'Vector Input -' etc, to the labels like the C plugins
do...



 M  +4 -4      libkstapp/kstbasicdialog_i.cpp  
 M  +10 -1     libkstmath/kstbasicplugin.cpp  
 M  +2 -2      libkstmath/kstbasicplugin.h  
 M  +0 -2      plugins/effective_bandwidth/effective_bandwidth.h  
 M  +1 -1      plugins/linefit/Makefile.am  
 A             plugins/linefit/kst_linefit.desktop  
 A             plugins/linefit/linefit.cpp   plugins/linefit/linefitplugin.cpp#586145 [License: GPL (v2+)]
 A             plugins/linefit/linefit.h   plugins/linefit/linefitplugin.h#586145 [License: GPL (v2+)]
 D             plugins/linefit/linefitdialog_i.cpp  
 D             plugins/linefit/linefitdialog_i.h  
 D             plugins/linefit/linefitplugin.cpp  
 D             plugins/linefit/linefitplugin.h  
 M  +0 -2      plugins/testplugin/testplugin.h  


--- branches/work/kst/pluginify/kst/src/libkstapp/kstbasicdialog_i.cpp #586491:586492
@@ -151,7 +151,7 @@
 
 
 void KstBasicDialogI::createInputVector(const QString &name, int row) {
-  QLabel *label = new QLabel(name, _w->_frame);
+  QLabel *label = new QLabel(name + ":", _w->_frame);
 
   VectorSelector *widget = new VectorSelector(_w->_frame,
                                               name.latin1());
@@ -166,7 +166,7 @@
 
 
 void KstBasicDialogI::createInputScalar(const QString &name, int row) {
-  QLabel *label = new QLabel(name, _w->_frame);
+  QLabel *label = new QLabel(name + ":", _w->_frame);
 
   ScalarSelector *widget = new ScalarSelector(_w->_frame,
                                               name.latin1());
@@ -182,7 +182,7 @@
 
 
 void KstBasicDialogI::createInputString(const QString &name, int row) {
-  QLabel *label = new QLabel(name, _w->_frame);
+  QLabel *label = new QLabel(name + ":", _w->_frame);
 
   StringSelector *widget = new StringSelector(_w->_frame,
                                               name.latin1());
@@ -197,7 +197,7 @@
 
 
 void KstBasicDialogI::createOutputWidget(const QString &name, int row) {
-  QLabel *label = new QLabel(name, _w->_frame);
+  QLabel *label = new QLabel(name + ":", _w->_frame);
   QLineEdit *widget = new QLineEdit(_w->_frame, name.latin1());
   _grid->addWidget(label, row, 0);
   label->show();
--- branches/work/kst/pluginify/kst/src/libkstmath/kstbasicplugin.cpp #586491:586492
@@ -44,6 +44,12 @@
 }
 
 
+KstDataObjectPtr KstBasicPlugin::makeDuplicate(KstDataObjectDataObjectMap &map) {
+  //FIXME I can't duplicate as this is an abstract class...
+  Q_UNUSED( map )
+  return 0;
+}
+
 void KstBasicPlugin::showNewDialog() {
   //FIXME shouldn't tagName() == propertyString() ??
   KstDialogs::self()->showBasicPluginDialog(propertyString());
@@ -175,7 +181,10 @@
 
   //Call the plugins algorithm to operate on the inputs
   //and produce the outputs
-  algorithm();
+  if ( !algorithm() ) {
+    KstDebug::self()->log(i18n("There is an error in the %1 algorithm.").arg(propertyString()), KstDebug::Error);
+    return lastUpdateResult();
+  }
 
   //Perform update on the outputs
   updateOutput(updateCounter);
--- branches/work/kst/pluginify/kst/src/libkstmath/kstbasicplugin.h #586491:586492
@@ -46,8 +46,8 @@
   //the plugin
   virtual QString propertyString() const = 0;
 
-  //Not sure how we'll handle this just yet...
-  virtual KstDataObjectPtr makeDuplicate(KstDataObjectDataObjectMap&) = 0;
+  //Provide an impl that returns 0...
+  virtual KstDataObjectPtr makeDuplicate(KstDataObjectDataObjectMap&);
 
   public slots:
   //Pure virtual slots from KstDataObject
--- branches/work/kst/pluginify/kst/src/plugins/effective_bandwidth/effective_bandwidth.h #586491:586492
@@ -35,8 +35,6 @@
     virtual QStringList outputStringList() const;
 
     virtual QString propertyString() const { return "Effective Bandwidth"; }
-
-    virtual KstDataObjectPtr makeDuplicate(KstDataObjectDataObjectMap&) { return 0; }
 };
 
 #endif
--- branches/work/kst/pluginify/kst/src/plugins/linefit/Makefile.am #586491:586492
@@ -3,7 +3,7 @@
 kde_module_LTLIBRARIES=kst_linefit.la
 
 kst_linefit_la_LDFLAGS=$(all_libraries) -module -avoid-version
-kst_linefit_la_SOURCES=linefitplugin.cpp linefitdialog_i.cpp linefitdialogwidget.ui
+kst_linefit_la_SOURCES=linefit.cpp
 
 services_DATA=kst_linefit.desktop
 servicesdir=$(kde_servicesdir)/kst
--- branches/work/kst/pluginify/kst/src/plugins/testplugin/testplugin.h #586491:586492
@@ -35,8 +35,6 @@
     virtual QStringList outputStringList() const;
 
     virtual QString propertyString() const { return "Test Plugin"; }
-
-    virtual KstDataObjectPtr makeDuplicate(KstDataObjectDataObjectMap&) { return 0; }
 };
 
 #endif


More information about the Kst mailing list