Skip to content

Commit

Permalink
Further updates to plugin builder - build a valid resources file. Var…
Browse files Browse the repository at this point in the history
…ious other clean ups. Get rid of xpm useage. Makefile cleanups. I still get compile errors with the generated plugin so its not useable yet.

git-svn-id: http://svn.osgeo.org/qgis/trunk@5169 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Apr 4, 2006
1 parent f00bbe4 commit 0fe2e11
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 281 deletions.
4 changes: 3 additions & 1 deletion src/plugins/plugin_builder.pl
Expand Up @@ -77,6 +77,8 @@
system("mkdir $pluginDir");
# copy files to appropriate names
system("cp plugin_template/Makefile.am $pluginDir/");
system("cp plugin_template/plugin.qrc $pluginDir/$pluginLCaseName.qrc");
system("cp plugin_template/plugin.png $pluginDir/$pluginLCaseName.png");
system("cp plugin_template/plugin.cpp $pluginDir/$pluginLCaseName.cpp");
system("cp plugin_template/plugin.h $pluginDir/$pluginLCaseName.h");
system("cp plugin_template/plugingui.cpp $pluginDir/${pluginLCaseName}gui.cpp");
Expand All @@ -88,7 +90,7 @@
# This is a brute force approach but its quick and dirty :)
#
# replace [pluginlcasename] in template with the new plugin name
system("perl -pi -e 's/\\\[pluginlcasename\\\]/$pluginLCaseName/g' $pluginDir/*.cpp $pluginDir/*.h $pluginDir/*.am $pluginDir/*.ui");
system("perl -pi -e 's/\\\[pluginlcasename\\\]/$pluginLCaseName/g' $pluginDir/*.qrc $pluginDir/*.cpp $pluginDir/*.h $pluginDir/*.am $pluginDir/*.ui");
# replace [pluginname] in template with the new plugin name
system("perl -pi -e 's/\\\[pluginname\\\]/$pluginName/g' $pluginDir/*.cpp $pluginDir/*.h $pluginDir/*.am $pluginDir/*.ui");
# replace [plugindescription] in template with the description
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/plugin_template/Makefile.am
Expand Up @@ -42,7 +42,7 @@ ui_%.h: %.ui
## For plugin lib
##

[pluginlcasename]_la_SOURCES = [pluginlcasename].cpp \
libqgis_plugin_[pluginlcasename]_la_SOURCES = [pluginlcasename].cpp \
[pluginlcasename]gui.cpp \
$(plugin_UI)\
$(plugin_MOC)\
Expand All @@ -63,12 +63,12 @@ plugin_QRC = [pluginlcasename].qrc

BUILT_SOURCES = $(plugin_MOC) $(plugin_UI) $(plugin_RES)

[pluginlcasename]_la_LIBADD = $(QT_LDADD) \
libqgis_plugin_[pluginlcasename]_la_LIBADD = $(QT_LDADD) \
$(GDAL_LDADD) \
../../core/libqgis_core.la \
../../gui/libqgis_gui.la
[pluginlcasename]_la_CFLAGS = $(CFLAGS) $(EXTRA_CFLAGS) $(DEBUG_QGIS)
[pluginlcasename]_la_CXXFLAGS = $(CXXFLAGS) \
libqgis_plugin_[pluginlcasename]_la_CFLAGS = $(CFLAGS) $(EXTRA_CFLAGS) $(DEBUG_QGIS)
libqgis_plugin_[pluginlcasename]_la_CXXFLAGS = $(CXXFLAGS) \
$(EXTRA_CXXFLAGS) \
$(QT_CXXFLAGS) \
$(DEBUG_QGIS) \
Expand All @@ -77,4 +77,4 @@ BUILT_SOURCES = $(plugin_MOC) $(plugin_UI) $(plugin_RES)
-I../../core \
-I../../ui \
-I../../gui
[pluginlcasename]_la_LDFLAGS = -avoid-version -module
libqgis_plugin_[pluginlcasename]_la_LDFLAGS = -avoid-version -module
273 changes: 0 additions & 273 deletions src/plugins/plugin_template/icon.xpm

This file was deleted.

4 changes: 2 additions & 2 deletions src/plugins/plugin_template/plugin.cpp
Expand Up @@ -44,7 +44,6 @@ email : tim@linfiniti.com
#include "plugingui.h"

// xpm for creating the toolbar icon
#include "icon.xpm"
#ifdef WIN32
#define QGISEXTERN extern "C" __declspec( dllexport )
#else
Expand Down Expand Up @@ -88,7 +87,8 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
void [pluginname]::initGui()
{
Q3PopupMenu *pluginMenu = qGisInterface->getPluginMenu("&[menuname]");
menuId = pluginMenu->insertItem(QIcon(icon),"&[menuitemname]", this, SLOT(run()));
//set teh icon from the resource file
menuId = pluginMenu->insertItem(QIcon(":/[pluginlcasename]/[pluginlcasename].png"),"&[menuitemname]", this, SLOT(run()));

pluginMenu->setWhatsThis(menuId, tr("Replace this with a short description of the what the plugin does"));

Expand Down
Binary file added src/plugins/plugin_template/plugin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/plugins/plugin_template/plugin.qrc
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/[pluginlcasename]/" >
<file>[pluginlcasename].png</file>
</qresource>
</RCC>

0 comments on commit 0fe2e11

Please sign in to comment.