From 7a3f401bf92bb7ee187c917f4d81872d76d2d254 Mon Sep 17 00:00:00 2001 From: gsherman Date: Mon, 14 Oct 2002 16:03:46 +0000 Subject: [PATCH] mods to plugin api git-svn-id: http://svn.osgeo.org/qgis/trunk@139 c8812cc2-4d05-0410-92ff-de0c093fc19c --- plugins/Makefile | 11 ++++++++--- plugins/qgisplugin.h | 2 +- plugins/qgisplugin.pro | 6 +++++- plugins/qgisplugingui.h | 2 ++ plugins/qgistestplugin.cpp | 5 +++++ src/qgisapp.cpp | 8 ++++---- 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/plugins/Makefile b/plugins/Makefile index be8428becb8..af83a53a770 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: libqgisplugin.so.1.0.0 -# Generated by qmake (1.03a) on: Wed Oct 9 22:22:46 2002 +# Generated by qmake (1.03a) on: Mon Oct 14 07:52:32 2002 # Project: qgisplugin.pro # Template: lib # Command: $(QMAKE) qgisplugin.pro @@ -41,7 +41,11 @@ OBJECTS_DIR = ./ ####### Files -HEADERS = qgisplugin.h +HEADERS = qgisplugin.h \ + qgisplugingui.h \ + qgispluginmenu.h \ + qgispluginguielement.h \ + qgisplugintoolbar.h SOURCES = qgistestplugin.cpp OBJECTS = qgistestplugin.o FORMS = @@ -131,7 +135,8 @@ FORCE: ####### Compile -qgistestplugin.o: qgistestplugin.cpp qgisplugin.h +qgistestplugin.o: qgistestplugin.cpp qgisplugin.h \ + qgisplugingui.h ####### Install diff --git a/plugins/qgisplugin.h b/plugins/qgisplugin.h index d51bd86830b..ea1a3beb63b 100644 --- a/plugins/qgisplugin.h +++ b/plugins/qgisplugin.h @@ -51,6 +51,6 @@ typedef QgisPlugin* create_t(); //! Typedef for the function to unload a plugin and free its resources typedef void unload_t(QgisPlugin *); //! Element type corresponding to one of the values in the ELEMENTS enum -typedef int QGIS_GUI_TYPE; +//typedef int QGIS_GUI_TYPE; #endif //qgisplugin_h diff --git a/plugins/qgisplugin.pro b/plugins/qgisplugin.pro index 6890983b39a..d68974c55ec 100644 --- a/plugins/qgisplugin.pro +++ b/plugins/qgisplugin.pro @@ -1,4 +1,8 @@ TEMPLATE = lib SOURCES = qgistestplugin.cpp -HEADERS = qgisplugin.h +HEADERS = qgisplugin.h \ + qgisplugingui.h \ + qgispluginmenu.h \ + qgispluginguielement.h \ + qgisplugintoolbar.h diff --git a/plugins/qgisplugingui.h b/plugins/qgisplugingui.h index a51a578b0eb..f6451b2f87d 100644 --- a/plugins/qgisplugingui.h +++ b/plugins/qgisplugingui.h @@ -17,6 +17,8 @@ public: QgisPluginGuiElement element(int index); //! Adds a new element void addElement(QgisPluginGuiElement); + //! Destructor + virtual ~QgisPluginGui(); private: std::vector elements; }; diff --git a/plugins/qgistestplugin.cpp b/plugins/qgistestplugin.cpp index 3ba676cf1a1..5d40e5eab4a 100644 --- a/plugins/qgistestplugin.cpp +++ b/plugins/qgistestplugin.cpp @@ -52,6 +52,11 @@ QString QgisTestPlugin::description(){ return pDescription; } +QgisPluginGui * QgisTestPlugin::gui(){ + // stub + return 0; +} + extern "C" QgisPlugin * classFactory(){ return new QgisTestPlugin(); } diff --git a/src/qgisapp.cpp b/src/qgisapp.cpp index 4621aeda387..12cc22789a0 100644 --- a/src/qgisapp.cpp +++ b/src/qgisapp.cpp @@ -578,11 +578,11 @@ void QgisApp::testPluginFunctions() std::cout << "Getting pointer to a QgisPlugin object from the library\n"; QgisPlugin *pl = cf(); std::cout << "Displaying name, version, and description\n"; - std::cout << "Plugin name: " << pl->pluginName() << std::endl; - std::cout << "Plugin version: " << pl->pluginVersion() << std::endl; - std::cout << "Plugin description: " << pl->pluginDescription() << std::endl; + std::cout << "Plugin name: " << pl->name() << std::endl; + std::cout << "Plugin version: " << pl->version() << std::endl; + std::cout << "Plugin description: " << pl->description() << std::endl; QMessageBox::information(this,"Plugin Information","QGis loaded the following plugin:\nName: " - + pl->pluginName() + "\nVersion: " + pl->pluginVersion() + "\nDescription: " + pl->pluginDescription()); + + pl->name() + "\nVersion: " + pl->version() + "\nDescription: " + pl->description()); // unload the plugin (delete it) std::cout << "Attempting to resolve the unload function" << std::endl; unload_t *ul = (unload_t *) myLib.resolve("unload");