~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/plugins/oracle_raster/qgsoracle_plugin.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    oracleplugin.cpp  Access Oracle Spatial Plugin
 
3
    -------------------
 
4
    begin                : Oracle Spatial Plugin
 
5
    copyright            : (C) Ivan Lucena
 
6
    email                : ivan.lucena@pmldnet.com
 
7
 ***************************************************************************
 
8
 *                                                                         *
 
9
 *   This program is free software; you can redistribute it and/or modify  *
 
10
 *   it under the terms of the GNU General Public License as published by  *
 
11
 *   the Free Software Foundation; either version 2 of the License, or     *
 
12
 *   (at your option) any later version.                                   *
 
13
 *                                                                         *
 
14
 ***************************************************************************/
 
15
/* $Id$ */
 
16
 
 
17
#include "qgsoracle_plugin.h"
 
18
#include "qgsselectgeoraster_ui.h"
 
19
 
 
20
static const char * const sIdent = "$Id: oracleplugin.cpp  $";
 
21
static const QString sName = QObject::tr( "Oracle Spatial GeoRaster" );
 
22
static const QString sDescription = QObject::tr( "Access Oracle Spatial GeoRaster" );
 
23
static const QString sPluginVersion = QObject::tr( "Version 0.1" );
 
24
static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
 
25
 
 
26
//////////////////////////////////////////////////////////////////////
 
27
//
 
28
// THE FOLLOWING METHODS ARE MANDATORY FOR ALL PLUGINS
 
29
//
 
30
//////////////////////////////////////////////////////////////////////
 
31
 
 
32
/**
 
33
 * Constructor for the plugin. The plugin is passed a pointer
 
34
 * an interface object that provides access to exposed functions in QGIS.
 
35
 * @param theQGisInterface - Pointer to the QGIS interface object
 
36
 */
 
37
QgsOraclePlugin::QgsOraclePlugin( QgisInterface * theQgisInterface ) :
 
38
    QgisPlugin( sName, sDescription, sPluginVersion, sPluginType ),
 
39
    mQGisIface( theQgisInterface )
 
40
{
 
41
}
 
42
 
 
43
QgsOraclePlugin::~QgsOraclePlugin()
 
44
{
 
45
 
 
46
}
 
47
 
 
48
/*
 
49
 * Initialize the GUI interface for the plugin - this is only called once when the plugin is
 
50
 * added to the plugin registry in the QGIS application.
 
51
 */
 
52
void QgsOraclePlugin::initGui()
 
53
{
 
54
 
 
55
  // Create the action for tool
 
56
  mQActionPointer = new QAction( QIcon( ":/oracleplugin/oracleplugin.png" ), tr( "Select GeoRaster" ), this );
 
57
  // Set the what's this text
 
58
  mQActionPointer->setWhatsThis( tr( "Open a Oracle Spatial GeoRaster" ) );
 
59
  // Connect the action to the run
 
60
  connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
 
61
  // Add the icon to the toolbar
 
62
  mQGisIface->addToolBarIcon( mQActionPointer );
 
63
  mQGisIface->addPluginToMenu( tr( "&Oracle Spatial" ), mQActionPointer );
 
64
 
 
65
}
 
66
//method defined in interface
 
67
 
 
68
void QgsOraclePlugin::help()
 
69
{
 
70
  //implement me!
 
71
}
 
72
 
 
73
// Slot called when the menu item is triggered
 
74
// If you created more menu items / toolbar buttons in initiGui, you should
 
75
// create a separate handler for each action - this single run() method will
 
76
// not be enough
 
77
 
 
78
void QgsOraclePlugin::run()
 
79
{
 
80
  QgsOracleSelectGeoraster *myPluginGui = new QgsOracleSelectGeoraster( mQGisIface->mainWindow(), mQGisIface, QgisGui::ModalDialogFlags );
 
81
  myPluginGui->setAttribute( Qt::WA_DeleteOnClose );
 
82
 
 
83
  myPluginGui->show();
 
84
}
 
85
 
 
86
// Unload the plugin by cleaning up the GUI
 
87
 
 
88
void QgsOraclePlugin::unload()
 
89
{
 
90
  // remove the GUI
 
91
  mQGisIface->removePluginMenu( "&Oracle Spatial", mQActionPointer );
 
92
  mQGisIface->removeToolBarIcon( mQActionPointer );
 
93
  delete mQActionPointer;
 
94
}
 
95
 
 
96
 
 
97
//////////////////////////////////////////////////////////////////////////
 
98
//
 
99
//
 
100
//  THE FOLLOWING CODE IS AUTOGENERATED BY THE PLUGIN BUILDER SCRIPT
 
101
//    YOU WOULD NORMALLY NOT NEED TO MODIFY THIS, AND YOUR PLUGIN
 
102
//      MAY NOT WORK PROPERLY IF YOU MODIFY THIS INCORRECTLY
 
103
//
 
104
//
 
105
//////////////////////////////////////////////////////////////////////////
 
106
 
 
107
 
 
108
/**
 
109
 * Required extern functions needed  for every plugin
 
110
 * These functions can be called prior to creating an instance
 
111
 * of the plugin class
 
112
 */
 
113
// Class factory to return a new instance of the plugin class
 
114
 
 
115
QGISEXTERN QgisPlugin * classFactory( QgisInterface * theQgisInterfacePointer )
 
116
{
 
117
  return new QgsOraclePlugin( theQgisInterfacePointer );
 
118
}
 
119
// Return the name of the plugin - note that we do not user class members as
 
120
// the class may not yet be insantiated when this method is called.
 
121
 
 
122
QGISEXTERN QString name()
 
123
{
 
124
  return sName;
 
125
}
 
126
 
 
127
// Return the description
 
128
 
 
129
QGISEXTERN QString description()
 
130
{
 
131
  return sDescription;
 
132
}
 
133
 
 
134
// Return the type (either UI or MapLayer plugin)
 
135
 
 
136
QGISEXTERN int type()
 
137
{
 
138
  return sPluginType;
 
139
}
 
140
 
 
141
// Return the version number for the plugin
 
142
 
 
143
QGISEXTERN QString version()
 
144
{
 
145
  return sPluginVersion;
 
146
}
 
147
 
 
148
// Delete ourself
 
149
 
 
150
QGISEXTERN void unload( QgisPlugin * thePluginPointer )
 
151
{
 
152
  delete thePluginPointer;
 
153
}