Fix for bug 1077196 (plugin icons incorrect on first load). A tricky one.

git-svn-id: http://svn.osgeo.org/qgis/trunk@3198 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
g_j_m 2005-04-23 11:45:27 +00:00
parent 3f519be7fc
commit e3f307e610
13 changed files with 111 additions and 107 deletions

View File

@ -69,14 +69,15 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
* @param theQGisApp - Pointer to the QGIS main window
* @param theQGisInterface - Pointer to the QGIS interface object
*/
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterface):
QgsCommunityRegPlugin::QgsCommunityRegPlugin(QgisApp * theQGisApp,
QgisIface * theQgisInterface):
mQGisApp(theQGisApp),
mQGisIface(theQgisInterface),
QgisPlugin(sName,sDescription,sPluginVersion,sPluginType)
{
}
Plugin::~Plugin()
QgsCommunityRegPlugin::~QgsCommunityRegPlugin()
{
}
@ -84,7 +85,7 @@ Plugin::~Plugin()
/*
* Initialize the GUI interface for the plugin
*/
void Plugin::initGui()
void QgsCommunityRegPlugin::initGui()
{
QPopupMenu *pluginMenu = new QPopupMenu(mQGisApp);
pluginMenu->insertItem(QIconSet(icon),"&Community Register", this, SLOT(run()));
@ -102,13 +103,13 @@ void Plugin::initGui()
}
//method defined in interface
void Plugin::help()
void QgsCommunityRegPlugin::help()
{
//implement me!
}
// Slot called when the buffer menu item is activated
void Plugin::run()
void QgsCommunityRegPlugin::run()
{
PluginGui *myPluginGui=new PluginGui(mQGisApp,"Community Register",true,0);
//listen for when the layer has been made so we can draw it
@ -118,7 +119,7 @@ void Plugin::run()
}
// Unload the plugin by cleaning up the GUI
void Plugin::unload()
void QgsCommunityRegPlugin::unload()
{
// remove the GUI
mMenuBarPointer->removeItem(mMenuId);
@ -140,7 +141,7 @@ void Plugin::unload()
//!draw a raster layer in the qui - intended to respond to signal sent by diolog when it as finished creating
//layer
void Plugin::drawRasterLayer(QString theQString)
void QgsCommunityRegPlugin::drawRasterLayer(QString theQString)
{
mQGisIface->addRasterLayer(theQString);
}
@ -148,7 +149,7 @@ void Plugin::drawRasterLayer(QString theQString)
//!draw a vector layer in the qui - intended to respond to signal sent by
// dialog when it as finished creating a layer. It needs to be given
// vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
void Plugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
void QgsCommunityRegPlugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
{
mQGisIface->addVectorLayer( thePathNameQString, theBaseNameQString, theProviderQString);
}
@ -173,7 +174,7 @@ void Plugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQStr
// Class factory to return a new instance of the plugin class
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
{
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
return new QgsCommunityRegPlugin(theQGisAppPointer, theQgisInterfacePointer);
}
// Return the name of the plugin - note that we do not user class members as
// the class may not yet be insantiated when this method is called.

View File

@ -34,8 +34,8 @@
* DON'T: separate variable names using underscores: my_variable_name (NO!)
*
* **************************************************************************/
#ifndef PLUGIN
#define PLUGIN
#ifndef QGSCOMMUNITYREGPLUGIN
#define QGSCOMMUNITYREGPLUGIN
#include "../qgisplugin.h"
#include <qwidget.h>
@ -47,7 +47,7 @@
* \brief [name] plugin for QGIS
* [description]
*/
class Plugin:public QObject, public QgisPlugin
class QgsCommunityRegPlugin:public QObject, public QgisPlugin
{
Q_OBJECT public:
@ -63,9 +63,9 @@ class Plugin:public QObject, public QgisPlugin
* @param Pointer to the QgisApp object
* @param Pointer to the QgisIface object.
*/
Plugin(QgisApp * , QgisIface * );
QgsCommunityRegPlugin(QgisApp * , QgisIface * );
//! Destructor
virtual ~ Plugin();
virtual ~ QgsCommunityRegPlugin();
public slots:
//! init the gui

View File

@ -74,19 +74,20 @@ static const QgisPlugin::PLUGINTYPE type_ = QgisPlugin::UI;
* @param qgis Pointer to the QGIS main window
* @param _qI Pointer to the QGIS interface object
*/
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
QgsCopyrightLabelPlugin::QgsCopyrightLabelPlugin(QgisApp * theQGisApp,
QgisIface * theQgisInterFace):
qgisMainWindowPointer(theQGisApp),
qGisInterface(theQgisInterFace),
QgisPlugin(name_,description_,version_,type_)
{}
Plugin::~Plugin()
QgsCopyrightLabelPlugin::~QgsCopyrightLabelPlugin()
{}
/*
* Initialize the GUI interface for the plugin
*/
void Plugin::initGui()
void QgsCopyrightLabelPlugin::initGui()
{
// add a menu with 2 items
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
@ -112,7 +113,7 @@ void Plugin::initGui()
projectRead();
}
void Plugin::projectRead()
void QgsCopyrightLabelPlugin::projectRead()
{
#ifdef QGISDEBUG
std::cout << "+++++++++ Copyright plugin - project read slot called...." << std::endl;
@ -128,13 +129,13 @@ void Plugin::projectRead()
mLabelQColor = QColor(Qt::black);
}
//method defined in interface
void Plugin::help()
void QgsCopyrightLabelPlugin::help()
{
//implement me!
}
// Slot called when the buffer menu item is activated
void Plugin::run()
void QgsCopyrightLabelPlugin::run()
{
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"Copyright Label",true,0);
//listen for when the layer has been made so we can draw it
@ -152,12 +153,12 @@ void Plugin::run()
myPluginGui->show();
}
//! Refresh the map display using the mapcanvas exported via the plugin interface
void Plugin::refreshCanvas()
void QgsCopyrightLabelPlugin::refreshCanvas()
{
qGisInterface->getMapCanvas()->refresh();
}
void Plugin::renderLabel(QPainter * theQPainter)
void QgsCopyrightLabelPlugin::renderLabel(QPainter * theQPainter)
{
//Large IF statement to enable/disable copyright label
if (mEnable)
@ -213,7 +214,7 @@ void Plugin::renderLabel(QPainter * theQPainter)
}
}
// Unload the plugin by cleaning up the GUI
void Plugin::unload()
void QgsCopyrightLabelPlugin::unload()
{
// remove the GUI
menuBarPointer->removeItem(menuIdInt);
@ -223,7 +224,7 @@ void Plugin::unload()
//! change the copyright font
void Plugin::setFont(QFont theQFont)
void QgsCopyrightLabelPlugin::setFont(QFont theQFont)
{
mQFont = theQFont;
//save state to the project file.....
@ -233,14 +234,14 @@ void Plugin::setFont(QFont theQFont)
refreshCanvas();
}
//! change the copyright text
void Plugin::setLabel(QString theLabelQString)
void QgsCopyrightLabelPlugin::setLabel(QString theLabelQString)
{
mLabelQString = theLabelQString;
QgsProject::instance()->writeEntry("CopyrightLabel","/Label", mLabelQString );
refreshCanvas();
}
//! change the copyright text colour
void Plugin::setColor(QColor theQColor)
void QgsCopyrightLabelPlugin::setColor(QColor theQColor)
{
mLabelQColor = theQColor;
QgsProject::instance()->writeEntry("CopyrightLabel","/ColorRedPart", mLabelQColor.red());
@ -250,7 +251,7 @@ void Plugin::setColor(QColor theQColor)
}
//! set placement of copyright label
void Plugin::setPlacement(QString theQString)
void QgsCopyrightLabelPlugin::setPlacement(QString theQString)
{
mPlacement = theQString;
QgsProject::instance()->writeEntry("CopyrightLabel","/Placement", mPlacement);
@ -258,7 +259,7 @@ void Plugin::setPlacement(QString theQString)
}
//! set whether copyright label is enabled
void Plugin::setEnable(bool theBool)
void QgsCopyrightLabelPlugin::setEnable(bool theBool)
{
mEnable = theBool;
QgsProject::instance()->writeEntry("CopyrightLabel","/Enabled", mEnable );
@ -277,7 +278,7 @@ void Plugin::setEnable(bool theBool)
// Class factory to return a new instance of the plugin class
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
{
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
return new QgsCopyrightLabelPlugin(theQGisAppPointer, theQgisInterfacePointer);
}
// Return the name of the plugin - note that we do not user class members as

View File

@ -17,8 +17,8 @@
* *
***************************************************************************/
/* $Id$ */
#ifndef PLUGIN
#define PLUGIN
#ifndef QGSCOPYRIGHTLABELPLUGIN
#define QGSCOPYRIGHTLABELPLUGIN
#include "../qgisplugin.h"
#include "../../src/qgisapp.h"
#include <qwidget.h>
@ -31,7 +31,7 @@
* \brief OpenModeller plugin for QGIS
*
*/
class Plugin:public QObject, public QgisPlugin
class QgsCopyrightLabelPlugin:public QObject, public QgisPlugin
{
Q_OBJECT public:
/**
@ -40,9 +40,9 @@ class Plugin:public QObject, public QgisPlugin
* @param qgis Pointer to the QgisApp object
* @param qI Pointer to the QgisIface object.
*/
Plugin(QgisApp * , QgisIface * );
QgsCopyrightLabelPlugin(QgisApp * , QgisIface * );
//! Destructor
virtual ~ Plugin();
virtual ~ QgsCopyrightLabelPlugin();
void writeEntry(QString theScope, QString theProperty, QVariant theValue);
public slots:
//! init the gui

View File

@ -64,37 +64,38 @@ static const QgisPlugin::PLUGINTYPE type_ = QgisPlugin::UI;
* @param qgis Pointer to the QGIS main window
* @param _qI Pointer to the QGIS interface object
*/
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
QgsGridMakerPlugin::QgsGridMakerPlugin(QgisApp * theQGisApp,
QgisIface * theQgisInterFace):
qgisMainWindowPointer(theQGisApp),
qGisInterface(theQgisInterFace),
QgisPlugin(name_,description_,version_,type_)
{
}
Plugin::~Plugin()
QgsGridMakerPlugin::~QgsGridMakerPlugin()
{
}
/* Following functions return name, description, version, and type for the plugin */
QString Plugin::name()
QString QgsGridMakerPlugin::name()
{
return pluginNameQString;
}
QString Plugin::version()
QString QgsGridMakerPlugin::version()
{
return pluginVersionQString;
}
QString Plugin::description()
QString QgsGridMakerPlugin::description()
{
return pluginDescriptionQString;
}
int Plugin::type()
int QgsGridMakerPlugin::type()
{
return QgisPlugin::UI;
}
@ -102,7 +103,7 @@ int Plugin::type()
/*
* Initialize the GUI interface for the plugin
*/
void Plugin::initGui()
void QgsGridMakerPlugin::initGui()
{
// add a menu with 2 items
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
@ -123,13 +124,13 @@ void Plugin::initGui()
}
//method defined in interface
void Plugin::help()
void QgsGridMakerPlugin::help()
{
//implement me!
}
// Slot called when the buffer menu item is activated
void Plugin::run()
void QgsGridMakerPlugin::run()
{
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"Graticule Builder",true,0);
//listen for when the layer has been made so we can draw it
@ -139,19 +140,19 @@ void Plugin::run()
}
//!draw a raster layer in the qui - intended to respond to signal sent by diolog when it as finished creating
//layer
void Plugin::drawRasterLayer(QString theQString)
void QgsGridMakerPlugin::drawRasterLayer(QString theQString)
{
qGisInterface->addRasterLayer(theQString);
}
//!draw a vector layer in the qui - intended to respond to signal sent by diolog when it as finished creating a layer
////needs to be given vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
void Plugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
void QgsGridMakerPlugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
{
qGisInterface->addVectorLayer( thePathNameQString, theBaseNameQString, theProviderQString);
}
// Unload the plugin by cleaning up the GUI
void Plugin::unload()
void QgsGridMakerPlugin::unload()
{
// remove the GUI
menuBarPointer->removeItem(menuIdInt);
@ -166,7 +167,7 @@ void Plugin::unload()
// Class factory to return a new instance of the plugin class
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
{
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
return new QgsGridMakerPlugin(theQGisAppPointer, theQgisInterfacePointer);
}
// Return the name of the plugin - note that we do not user class members as

View File

@ -17,8 +17,8 @@
* *
***************************************************************************/
/* $Id$ */
#ifndef PLUGIN
#define PLUGIN
#ifndef QGSGRIDMAKERPLUGIN
#define QGSGRIDMAKERPLUGIN
#include "../qgisplugin.h"
#include <qwidget.h>
#include <qgisapp.h>
@ -28,7 +28,7 @@
* \brief OpenModeller plugin for QGIS
*
*/
class Plugin:public QObject, public QgisPlugin
class QgsGridMakerPlugin:public QObject, public QgisPlugin
{
Q_OBJECT public:
/**
@ -37,7 +37,7 @@ class Plugin:public QObject, public QgisPlugin
* @param qgis Pointer to the QgisApp object
* @param qI Pointer to the QgisIface object.
*/
Plugin(QgisApp * , QgisIface * );
QgsGridMakerPlugin(QgisApp * , QgisIface * );
/**
* Virtual function to return the name of the plugin. The name will be used when presenting a list
* of installable plugins to the user
@ -56,7 +56,7 @@ class Plugin:public QObject, public QgisPlugin
*/
virtual int type();
//! Destructor
virtual ~ Plugin();
virtual ~ QgsGridMakerPlugin();
public slots:
//! init the gui
virtual void initGui();

View File

@ -74,7 +74,7 @@ static const QgisPlugin::PLUGINTYPE type_ = QgisPlugin::UI;
* @param qgis Pointer to the QGIS main window
* @param _qI Pointer to the QGIS interface object
*/
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
QgsNorthArrowPlugin::QgsNorthArrowPlugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
qgisMainWindowPointer(theQGisApp),
qGisInterface(theQgisInterFace),
QgisPlugin(name_,description_,version_,type_)
@ -83,14 +83,14 @@ Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
mPlacement=tr("Bottom Left");
}
Plugin::~Plugin()
QgsNorthArrowPlugin::~QgsNorthArrowPlugin()
{
}
/*
/*
* Initialize the GUI interface for the plugin
*/
void Plugin::initGui()
void QgsNorthArrowPlugin::initGui()
{
// add a menu with 2 items
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
@ -116,7 +116,7 @@ void Plugin::initGui()
}
void Plugin::projectRead()
void QgsNorthArrowPlugin::projectRead()
{
#ifdef QGISDEBUG
std::cout << "+++++++++ north arrow plugin - project read slot called...." << std::endl;
@ -129,13 +129,13 @@ void Plugin::projectRead()
}
//method defined in interface
void Plugin::help()
void QgsNorthArrowPlugin::help()
{
//implement me!
}
// Slot called when the buffer menu item is activated
void Plugin::run()
void QgsNorthArrowPlugin::run()
{
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"North Arrow",true,0);
//overides function byt the same name created in .ui
@ -151,12 +151,12 @@ void Plugin::run()
}
//! Refresh the map display using the mapcanvas exported via the plugin interface
void Plugin::refreshCanvas()
void QgsNorthArrowPlugin::refreshCanvas()
{
qGisInterface->getMapCanvas()->refresh();
}
void Plugin::renderNorthArrow(QPainter * theQPainter)
void QgsNorthArrowPlugin::renderNorthArrow(QPainter * theQPainter)
{
#ifdef QGISDEBUG
std::cout << "Rendering n-arrow" << std::endl;
@ -243,7 +243,7 @@ void Plugin::renderNorthArrow(QPainter * theQPainter)
}
// Unload the plugin by cleaning up the GUI
void Plugin::unload()
void QgsNorthArrowPlugin::unload()
{
// remove the GUI
menuBarPointer->removeItem(menuIdInt);
@ -252,7 +252,7 @@ void Plugin::unload()
}
void Plugin::rotationChanged(int theInt)
void QgsNorthArrowPlugin::rotationChanged(int theInt)
{
mRotationInt = theInt;
QgsProject::instance()->writeEntry("NorthArrow","/Rotation", mRotationInt );
@ -260,14 +260,14 @@ void Plugin::rotationChanged(int theInt)
}
//! set placement of north arrow
void Plugin::setPlacement(QString theQString)
void QgsNorthArrowPlugin::setPlacement(QString theQString)
{
mPlacement = theQString;
QgsProject::instance()->writeEntry("NorthArrow","/Placement", mPlacement);
refreshCanvas();
}
void Plugin::setEnabled(bool theBool)
void QgsNorthArrowPlugin::setEnabled(bool theBool)
{
mEnable = theBool;
QgsProject::instance()->writeEntry("NorthArrow","/Enabled", mEnable );
@ -287,7 +287,7 @@ void Plugin::setEnabled(bool theBool)
// Class factory to return a new instance of the plugin class
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
{
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
return new QgsNorthArrowPlugin(theQGisAppPointer, theQgisInterfacePointer);
}
// Return the name of the plugin - note that we do not user class members as

View File

@ -17,8 +17,8 @@
* *
***************************************************************************/
/* $Id$ */
#ifndef PLUGIN
#define PLUGIN
#ifndef QGSNORTHARROWPLUGIN
#define QGSNORTHARROWPLUGIN
#include "../qgisplugin.h"
#include <qwidget.h>
#include <qpainter.h>
@ -31,7 +31,7 @@
* \brief North Arrow plugin for QGIS
*
*/
class Plugin:public QObject, public QgisPlugin
class QgsNorthArrowPlugin:public QObject, public QgisPlugin
{
Q_OBJECT public:
/**
@ -40,9 +40,9 @@ class Plugin:public QObject, public QgisPlugin
* @param qgis Pointer to the QgisApp object
* @param qI Pointer to the QgisIface object.
*/
Plugin(QgisApp * , QgisIface * );
QgsNorthArrowPlugin(QgisApp * , QgisIface * );
//! Destructor
virtual ~ Plugin();
virtual ~QgsNorthArrowPlugin();
public slots:
//! init the gui
virtual void initGui();

View File

@ -69,14 +69,15 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
* @param theQGisApp - Pointer to the QGIS main window
* @param theQGisInterface - Pointer to the QGIS interface object
*/
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterface):
[pluginname]::[pluginname](QgisApp * theQGisApp,
QgisIface * theQgisInterface):
mQGisApp(theQGisApp),
mQGisIface(theQgisInterface),
QgisPlugin(sName,sDescription,sPluginVersion,sPluginType)
{
}
Plugin::~Plugin()
[pluginname]::~[pluginname]()
{
}
@ -84,7 +85,7 @@ Plugin::~Plugin()
/*
* Initialize the GUI interface for the plugin
*/
void Plugin::initGui()
void [pluginname]::initGui()
{
QPopupMenu *pluginMenu = new QPopupMenu(mQGisApp);
pluginMenu->insertItem(QIconSet(icon),"&[menuitemname]", this, SLOT(run()));
@ -102,13 +103,13 @@ void Plugin::initGui()
}
//method defined in interface
void Plugin::help()
void [pluginname]::help()
{
//implement me!
}
// Slot called when the buffer menu item is activated
void Plugin::run()
void [pluginname]::run()
{
PluginGui *myPluginGui=new PluginGui(mQGisApp,"[menuitemname]",true,0);
//listen for when the layer has been made so we can draw it
@ -118,7 +119,7 @@ void Plugin::run()
}
// Unload the plugin by cleaning up the GUI
void Plugin::unload()
void [pluginname]::unload()
{
// remove the GUI
mMenuBarPointer->removeItem(mMenuId);
@ -140,7 +141,7 @@ void Plugin::unload()
//!draw a raster layer in the qui - intended to respond to signal sent by diolog when it as finished creating
//layer
void Plugin::drawRasterLayer(QString theQString)
void [pluginname]::drawRasterLayer(QString theQString)
{
mQGisIface->addRasterLayer(theQString);
}
@ -148,7 +149,7 @@ void Plugin::drawRasterLayer(QString theQString)
//!draw a vector layer in the qui - intended to respond to signal sent by
// dialog when it as finished creating a layer. It needs to be given
// vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
void Plugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
void [pluginname]::drawVectorLayer(QString thePathNameQString, QString theBaseNameQString, QString theProviderQString)
{
mQGisIface->addVectorLayer( thePathNameQString, theBaseNameQString, theProviderQString);
}
@ -173,7 +174,7 @@ void Plugin::drawVectorLayer(QString thePathNameQString, QString theBaseNameQStr
// Class factory to return a new instance of the plugin class
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
{
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
return new [pluginname](theQGisAppPointer, theQgisInterfacePointer);
}
// Return the name of the plugin - note that we do not user class members as
// the class may not yet be insantiated when this method is called.

View File

@ -34,8 +34,8 @@
* DON'T: separate variable names using underscores: my_variable_name (NO!)
*
* **************************************************************************/
#ifndef PLUGIN
#define PLUGIN
#ifndef [pluginname]
#define [pluginname]
#include "../qgisplugin.h"
#include <qwidget.h>
@ -47,7 +47,7 @@
* \brief [name] plugin for QGIS
* [description]
*/
class Plugin:public QObject, public QgisPlugin
class [pluginname]:public QObject, public QgisPlugin
{
Q_OBJECT public:
@ -63,9 +63,9 @@ class Plugin:public QObject, public QgisPlugin
* @param Pointer to the QgisApp object
* @param Pointer to the QgisIface object.
*/
Plugin(QgisApp * , QgisIface * );
[pluginname](QgisApp * , QgisIface * );
//! Destructor
virtual ~ Plugin();
virtual ~ [pluginname]();
public slots:
//! init the gui

View File

@ -49,7 +49,7 @@ class QgisPlugin
*/
typedef enum PLUGINTYPE
{
UI, /* user interface plug-in */
UI = 1, /* user interface plug-in */
MAPLAYER /* map layer plug-in */
};

View File

@ -81,7 +81,7 @@ static const QgisPlugin::PLUGINTYPE type_ = QgisPlugin::UI;
* @param qgis Pointer to the QGIS main window
* @param _qI Pointer to the QGIS interface object
*/
Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
QgsScaleBarPlugin::QgsScaleBarPlugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
qgisMainWindowPointer(theQGisApp),
qGisInterface(theQgisInterFace),
QgisPlugin(name_,description_,version_,type_)
@ -93,7 +93,7 @@ QgisPlugin(name_,description_,version_,type_)
mSnapping = true;
}
Plugin::~Plugin()
QgsScaleBarPlugin::~QgsScaleBarPlugin()
{
}
@ -101,7 +101,7 @@ Plugin::~Plugin()
/*
* Initialize the GUI interface for the plugin
*/
void Plugin::initGui()
void QgsScaleBarPlugin::initGui()
{
// add a menu with 2 items
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
@ -124,7 +124,7 @@ void Plugin::initGui()
qGisInterface->addToolBarIcon(myQActionPointer);
}
void Plugin::projectRead()
void QgsScaleBarPlugin::projectRead()
{
#ifdef QGISDEBUG
std::cout << "+++++++++ scalebar plugin - project read slot called...." << std::endl;
@ -142,13 +142,13 @@ void Plugin::projectRead()
mColour = QColor(myRedInt,myGreenInt,myBlueInt);
}
//method defined in interface
void Plugin::help()
void QgsScaleBarPlugin::help()
{
//implement me!
}
// Slot called when the menu item is activated
void Plugin::run()
void QgsScaleBarPlugin::run()
{
PluginGui *myPluginGui=new PluginGui(qgisMainWindowPointer,"Scale Bar",true,0);
myPluginGui->setPreferredSize(mPreferredSize);
@ -178,7 +178,7 @@ void Plugin::run()
}
void Plugin::refreshCanvas()
void QgsScaleBarPlugin::refreshCanvas()
{
qGisInterface->getMapCanvas()->refresh();
}
@ -186,7 +186,7 @@ void Plugin::refreshCanvas()
// Actual drawing of Scale Bar
void Plugin::renderScaleBar(QPainter * theQPainter)
void QgsScaleBarPlugin::renderScaleBar(QPainter * theQPainter)
{
int myBufferSize=1; //softcode this later
@ -483,7 +483,7 @@ void Plugin::renderScaleBar(QPainter * theQPainter)
// Unload the plugin by cleaning up the GUI
void Plugin::unload()
void QgsScaleBarPlugin::unload()
{
// remove the GUI
menuBarPointer->removeItem(menuIdInt);
@ -492,40 +492,40 @@ void Plugin::unload()
}
//! set placement of scale bar
void Plugin::setPlacement(QString theQString)
void QgsScaleBarPlugin::setPlacement(QString theQString)
{
mPlacement = theQString;
QgsProject::instance()->writeEntry("ScaleBar","/Placement",mPlacement);
}
//! set preferred size of scale bar
void Plugin::setPreferredSize(int thePreferredSize)
void QgsScaleBarPlugin::setPreferredSize(int thePreferredSize)
{
mPreferredSize = thePreferredSize;
QgsProject::instance()->writeEntry("ScaleBar","/PreferredSize",mPreferredSize);
}
//! set whether the scale bar length should snap to the closes A*10^B
void Plugin::setSnapping(bool theSnapping)
void QgsScaleBarPlugin::setSnapping(bool theSnapping)
{
mSnapping = theSnapping;
QgsProject::instance()->writeEntry("ScaleBar","/Snapping",mSnapping);
}
//! set scale bar enable
void Plugin::setEnabled(bool theBool)
void QgsScaleBarPlugin::setEnabled(bool theBool)
{
mEnabled = theBool;
QgsProject::instance()->writeEntry("ScaleBar","/Enabled",mEnabled);
}
//! set scale bar enable
void Plugin::setStyle(QString theStyleQString)
void QgsScaleBarPlugin::setStyle(QString theStyleQString)
{
mStyle = theStyleQString;
QgsProject::instance()->writeEntry("ScaleBar","/Style",mStyle);
}
//! set the scale bar colour
void Plugin::setColour(QColor theQColor)
void QgsScaleBarPlugin::setColour(QColor theQColor)
{
mColour = theQColor;
QgsProject::instance()->writeEntry("ScaleBar","/ColorRedPart", mColour.red());
@ -542,7 +542,7 @@ void Plugin::setColour(QColor theQColor)
// Class factory to return a new instance of the plugin class
QGISEXTERN QgisPlugin * classFactory(QgisApp * theQGisAppPointer, QgisIface * theQgisInterfacePointer)
{
return new Plugin(theQGisAppPointer, theQgisInterfacePointer);
return new QgsScaleBarPlugin(theQGisAppPointer, theQgisInterfacePointer);
}
// Return the name of the plugin - note that we do not user class members as

View File

@ -19,8 +19,8 @@ email : sbr00pwb@users.sourceforge.net
* *
***************************************************************************/
/* $Id$ */
#ifndef PLUGIN
#define PLUGIN
#ifndef QGSCALEBARPLUGIN
#define QGSCALEBARPLUGIN
#include "../qgisplugin.h"
#include <qwidget.h>
#include <qpainter.h>
@ -34,7 +34,7 @@ email : sbr00pwb@users.sourceforge.net
* \brief OpenModeller plugin for QGIS
*
*/
class Plugin:public QObject, public QgisPlugin
class QgsScaleBarPlugin:public QObject, public QgisPlugin
{
Q_OBJECT public:
/**
@ -43,12 +43,12 @@ class Plugin:public QObject, public QgisPlugin
* @param qgis Pointer to the QgisApp object
* @param qI Pointer to the QgisIface object.
*/
Plugin(QgisApp * , QgisIface * );
QgsScaleBarPlugin(QgisApp * , QgisIface * );
//! Destructor
virtual ~ Plugin();
virtual ~ QgsScaleBarPlugin();
public slots:
//! init the gui
virtual void initGui();