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

Adam Treat treat at kde.org
Mon Sep 18 21:11:12 CEST 2006


SVN commit 586117 by treat:

* Provide a default config widget for everything
that inherits KstBasicPlugin.  Plugin writers
can override this by reimplementing two virtual
functions or by inheriting KstDataObject directly.

* Rename the kstbasicdialog files to fit the current
name pattern.  Launch the dialogs like all the other
ones.


 M  +2 -1      libkstapp/Makefile.am  
 A             libkstapp/basicdialogwidget.ui  
 M  +10 -1     libkstapp/dialoglauncher-gui.cpp  
 M  +3 -1      libkstapp/dialoglauncher-gui.h  
 D             libkstapp/kstbasicdialog.cpp  
 D             libkstapp/kstbasicdialog.h  
 A             libkstapp/kstbasicdialog_i.cpp   libkstapp/kstbasicdialog.cpp#586104 [License: GPL (v2+)]
 A             libkstapp/kstbasicdialog_i.h   libkstapp/kstbasicdialog.h#586104 [License: GPL (v2+)]
 M  +6 -1      libkstmath/dialoglauncher.cpp  
 M  +3 -1      libkstmath/dialoglauncher.h  
 M  +8 -0      libkstmath/kstbasicplugin.cpp  
 M  +3 -3      libkstmath/kstbasicplugin.h  
 M  +2 -2      libkstmath/kstcplugin.cpp  
 M  +0 -10     plugins/testplugin/testplugin.h  


--- branches/work/kst/pluginify/kst/src/libkstapp/Makefile.am #586116:586117
@@ -20,6 +20,7 @@
 	imagedialogwidget.ui \
 	matrixdialogwidget.ui \
 	plugindialogwidget.ui \
+	basicdialogwidget.ui \
 	eventmonitorwidget.ui \
 	pluginmanager.ui \
 	curvedialogwidget.ui \
@@ -97,13 +98,13 @@
 	kstalignment.cpp \
 	ksteventmonitorentry.cpp \
 	kstcurvedialog_i.cpp \
+	kstbasicdialog_i.cpp \
 	kstdoc.cpp \
 	kstviewwindow.cpp \
 	ktimezonecombo.cpp \
 	plotdialog.ui \
 	extensiondlg.ui \
 	kstdatadialog.ui \
-	kstbasicdialog.cpp \
 	choosecolordialog.ui \
 	debugdialog.ui \
 	datawizard.ui \
--- branches/work/kst/pluginify/kst/src/libkstapp/dialoglauncher-gui.cpp #586116:586117
@@ -23,6 +23,7 @@
 #include "kstimagedialog_i.h"
 #include "kstmatrixdialog_i.h"
 #include "kstplugindialog_i.h"
+#include "kstbasicdialog_i.h"
 #include "kstpsddialog_i.h"
 #include "kstvectordialog_i.h"
 
@@ -44,7 +45,7 @@
 }
 
 
-void KstGuiDialogs::showPluginDialog(const QString& name) {
+void KstGuiDialogs::showCPluginDialog(const QString& name) {
   if ( name.isEmpty() )
     KstPluginDialogI::globalInstance()->show();
   else
@@ -52,6 +53,14 @@
 }
 
 
+void KstGuiDialogs::showBasicPluginDialog(const QString& name) {
+  if ( name.isEmpty() )
+    KstBasicDialogI::globalInstance()->show();
+  else
+    KstBasicDialogI::globalInstance()->showEdit(name);
+}
+
+
 void KstGuiDialogs::showEquationDialog(const QString& name) {
   if ( name.isEmpty() )
     KstEqDialogI::globalInstance()->show();
--- branches/work/kst/pluginify/kst/src/libkstapp/dialoglauncher-gui.h #586116:586117
@@ -26,8 +26,10 @@
 
     void showHistogramDialog(const QString& name = QString::null);
 
-    void showPluginDialog(const QString& name = QString::null);
+    void showCPluginDialog(const QString& name = QString::null);
 
+    void showBasicPluginDialog(const QString& name = QString::null);
+
     void showEquationDialog(const QString& name = QString::null);
 
     void showCSDDialog(const QString& name = QString::null);
--- branches/work/kst/pluginify/kst/src/libkstmath/dialoglauncher.cpp #586116:586117
@@ -48,11 +48,16 @@
 }
 
 
-void KstDialogs::showPluginDialog(const QString& name) {
+void KstDialogs::showCPluginDialog(const QString& name) {
   Q_UNUSED(name)
 }
 
 
+void KstDialogs::showBasicPluginDialog(const QString& name) {
+  Q_UNUSED(name)
+}
+
+
 void KstDialogs::showEquationDialog(const QString& name) {
   Q_UNUSED(name)
 }
--- branches/work/kst/pluginify/kst/src/libkstmath/dialoglauncher.h #586116:586117
@@ -36,8 +36,10 @@
 
     virtual void showHistogramDialog(const QString& name = QString::null);
 
-    virtual void showPluginDialog(const QString& name = QString::null);
+    virtual void showBasicPluginDialog(const QString& name = QString::null);
 
+    virtual void showCPluginDialog(const QString& name = QString::null);
+
     virtual void showEquationDialog(const QString& name = QString::null);
 
     virtual void showCSDDialog(const QString& name = QString::null);
--- branches/work/kst/pluginify/kst/src/libkstmath/kstbasicplugin.cpp #586116:586117
@@ -27,6 +27,7 @@
 // application specific includes
 #include "kstdebug.h"
 #include "kstbasicplugin.h"
+#include "dialoglauncher.h"
 #include "kstdatacollection.h"
 
 KstBasicPlugin::KstBasicPlugin()
@@ -42,7 +43,14 @@
 KstBasicPlugin::~KstBasicPlugin() {
 }
 
+void KstBasicPlugin::showNewDialog() {
+  KstDialogs::self()->showBasicPluginDialog();
+}
 
+void KstBasicPlugin::showEditDialog() {
+  KstDialogs::self()->showBasicPluginDialog(tagName());
+}
+
 KstVectorPtr KstBasicPlugin::inputVector(const QString& vector) const {
   KstVectorMap::ConstIterator i = _inputVectors.find(vector);
   if (i != _inputVectors.end())
--- branches/work/kst/pluginify/kst/src/libkstmath/kstbasicplugin.h #586116:586117
@@ -51,9 +51,9 @@
 
   public slots:
   //Pure virtual slots from KstDataObject
-  //Each plugin will need to provide an implementation for each
-  virtual void showNewDialog() = 0;
-  virtual void showEditDialog() = 0;
+  //Each plugin can provide an implementation or use the default
+  virtual void showNewDialog();
+  virtual void showEditDialog();
 
   public:
   //Returns the respective input object for name
--- branches/work/kst/pluginify/kst/src/libkstmath/kstcplugin.cpp #586116:586117
@@ -599,12 +599,12 @@
 
 
 void KstCPlugin::showNewDialog() {
-  KstDialogs::self()->showPluginDialog();
+  KstDialogs::self()->showCPluginDialog();
 }
 
 
 void KstCPlugin::showEditDialog() {
-  KstDialogs::self()->showPluginDialog(tagName());
+  KstDialogs::self()->showCPluginDialog(tagName());
 }
 
 
--- branches/work/kst/pluginify/kst/src/plugins/testplugin/testplugin.h #586116:586117
@@ -19,8 +19,6 @@
 
 #include <kstbasicplugin.h>
 
-#include <kmessagebox.h>
-
 class TestPlugin : public KstBasicPlugin {
   Q_OBJECT
   public:
@@ -39,14 +37,6 @@
     virtual QString propertyString() const { return "Test Plugin"; }
 
     virtual KstDataObjectPtr makeDuplicate(KstDataObjectDataObjectMap&) { return 0; }
-
-  protected slots:
-    virtual void showNewDialog() {
-        KMessageBox::information( 0, "insert testplugin config widget here :)", "testpluginconfig" );
-    }
-    virtual void showEditDialog() {
-      KMessageBox::information( 0, "insert testplugin config widget here :)", "testpluginconfig" );
-    }
 };
 
 #endif


More information about the Kst mailing list