Skip to content


Fixed #872 in plugin_template, made links clickable and changed templ…
Browse files Browse the repository at this point in the history
…ate to make it more translateable

git-svn-id: c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Dec 16, 2007
1 parent 6d4d3bf commit 32d6a71
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 72 deletions.
7 changes: 2 additions & 5 deletions src/plugins/plugin_template/plugin.cpp
Expand Up @@ -70,17 +70,14 @@ void [pluginname]::initGui()

// Create the action for tool
mQActionPointer = new QAction(QIcon(":/[pluginlcasename]/[pluginlcasename].png"),"[menuitemname]", this);
mQActionPointer = new QAction(QIcon(":/[pluginlcasename]/[pluginlcasename].png"),tr("[menuitemname]"), this);
// Set the what's this text
mQActionPointer->setWhatsThis(tr("Replace this with a short description of the what the plugin does"));
// Connect the action to the run
connect(mQActionPointer, SIGNAL(activated()), this, SLOT(run()));
// Add the toolbar
mToolBarPointer = new QToolBar(mQGisIface->getMainWindow(), "[menuname]");
// Add the icon to the toolbar
mQGisIface->addPluginMenu("&[menuname]", mQActionPointer);
mQGisIface->addPluginMenu(tr("&[menuname]"), mQActionPointer);

//method defined in interface
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/plugin_template/plugin.h
Expand Up @@ -92,8 +92,6 @@ public slots:

int mPluginType;
//! Pointer to our toolbar
QToolBar *mToolBarPointer;
//! Pointer to the QGIS interface object
QgisInterface *mQGisIface;
//!pointer to the qaction for this plugin
Expand Down
55 changes: 55 additions & 0 deletions src/plugins/plugin_template/plugingui.cpp
Expand Up @@ -20,6 +20,61 @@
: QDialog ( parent, fl )

// Below is an example of how to make the translators job
// much easier. Please follow this general guideline for LARGE
// pieces of text. One-liners can be added in the .ui file

// Note: Format does not relate to translation.
QString format("<html><body><h3>%1</h3>%2<h3>%3</h3>%4<p><a href=>"
"<h4>[pluginlcasename].h, [pluginlcasename].cpp</h4>%12"
"<h4>[pluginlcasename]gui.cpp, [pluginlcasename]gui.h</h4>%14"
"<p><b>The QGIS Team<br>2007</b>"

// Note: Table does not translate
QString table("<table><tr><td>QGisInterface<td><a href=>"
"<tr><td>QgsMapCanvas<td><a href=>"
"<tr><td>QgsMapTool<td><a href=>"
"<tr><td>QgsPlugin<td><a href=>"

// Note: Translatable strings below
QString text = format
.arg(tr("Welcome to your automatically generated plugin!"))
.arg(tr("This is just a starting point. You now need to modify the code to make it do something on for a more information to get yourself started."))
.arg(tr("You really need to read the QGIS API Documentation now at:"))
.arg(tr("In particular look at the following classes:"))
.arg("QGisInterface is an abstract base class (ABC) that specifies what publicly available features of QGIS are exposed to third party code and plugins. An instance of the QgisInterface is passed to the plugin when it loads. Please consult the QGIS development team if there is functionality required in the QGisInterface that is not available.")
.arg(tr("QgsPlugin is an ABC that defines required behaviour your plugin must provide. See below for more details."))
.arg(tr("What are all the files in my generated plugin directory for?"))
.arg(tr("This is the generated CMake file that builds the plugin. You should add you application specific dependencies and source files to this file."))
.arg(tr("This is the class that provides the 'glue' between your custom application logic and the QGIS application. You will see that a number of methods are already implemented for you - including some examples of how to add a raster or vector layer to the main application map canvas. This class is a concrete instance of the QgisPlugin interface which defines required behaviour for a plugin. In particular, a plugin has a number of static methods and members so that the QgsPluginManager and plugin loader logic can identify each plugin, create an appropriate menu entry for it etc. Note there is nothing stopping you creating multiple toolbar icons and menu entries for a single plugin. By default though a single menu entry and toolbar button is created and its pre-configured to call the run() method in this class when selected. This default implementation provided for you by the plugin builder is well documented, so please refer to the code for further advice."))
.arg(tr("This is a Qt designer 'ui' file. It defines the look of the default plugin dialog without implementing any application logic. You can modify this form to suite your needs or completely remove it if your plugin does not need to display a user form (e.g. for custom MapTools)."))
.arg(tr("This is the concrete class where application logic for the above mentioned dialog should go. The world is your oyster here really...."))
.arg(tr("This is the Qt4 resources file for your plugin. The Makefile generated for your plugin is all set up to compile the resource file so all you need to do is add your additional icons etc using the simple xml file format. Note the namespace used for all your resources e.g. (':/Homann/'). It is important to use this prefix for all your resources. We suggest you include any other images and run time data in this resurce file too."))
.arg(tr("This is the icon that will be used for your plugin menu entry and toolbar icon. Simply replace this icon with your own icon to make your plugin disctinctive from the rest."))
.arg(tr("This file contains the documentation you are reading now!"))
.arg(tr("Getting developer help:"))
.arg(tr("For Questions and Comments regarding the plugin builder template and creating your features in QGIS using the plugin interface please contact us via:"))
.arg(tr("<li> the QGIS developers mailing list, or </li><li> IRC (#qgis on</li>"))
.arg(tr("QGIS is distributed under the Gnu Public License. If you create a useful plugin please consider contributing it back to the community."))
.arg(tr("Have fun and thank you for choosing QGIS."));


Expand Down

0 comments on commit 32d6a71

Please sign in to comment.