~ubuntu-branches/ubuntu/trusty/qgis/trusty

« back to all changes in this revision

Viewing changes to src/plugins/maplayer/maplayertest.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
 
#include <q3popupmenu.h>
2
 
#include <qmessagebox.h>
3
 
#include "../qgisplugin.h"
4
 
#include "maplayertest.h"
5
 
// xpm for creating the toolbar icon
6
 
#include "matrix1.xpm"
7
 
MapLayerTest::MapLayerTest(){
8
 
}
9
 
void MapLayerTest::setQgisMainWindow(Q3MainWindow *app){
10
 
        qgisApp = app;
11
 
}
12
 
// set the coordinate transform for drawing the layer
13
 
void MapLayerTest::setCoordinateTransform(QgsMapToPixel *xform){
14
 
        coordTransform = xform;
15
 
}
16
 
void MapLayerTest::initGui(){
17
 
        // setup the menu
18
 
         Q3PopupMenu *mapLayerPluginMenu = new Q3PopupMenu( qgisApp );
19
 
 
20
 
        mapLayerPluginMenu->insertItem("&Add Foobar Layer", this, SLOT(open()));
21
 
        mapLayerPluginMenu->insertItem(  "&Unload Foobar Plugin", this, SLOT(unload()));
22
 
        // create the menubar
23
 
         menu = ((Q3MainWindow *)qgisApp)->menuBar();
24
 
 
25
 
        menuId = menu->insertItem( "&PluginMenu", mapLayerPluginMenu );
26
 
        //QAction *zoomPreviousAction = new QAction( "Zoom Previous",QIconSet(icon_matrix), "&Zoom Previous", CTRL+Key_S, qgisMainWindow, "zoomFull" );
27
 
                
28
 
     //   connect( zoomPreviousAction, SIGNAL( activated() ) , this, SLOT( zoomPrevious() ) );
29
 
 
30
 
}
31
 
void MapLayerTest::unload(){
32
 
        // remove the GUI
33
 
        menu->removeItem(menuId);
34
 
        // cleanup anything else that needs to be nuked
35
 
}
36
 
void MapLayerTest::open(){
37
 
        // try and open a layer dialog
38
 
        QMessageBox::information(qgisApp,"Plugin Message","You clicked the Add Foobar Layer menu item");
39
 
}
40
 
void MapLayerTest::draw(){
41
 
}
42
 
extern "C" QgsMapLayerInterface * classFactory(){
43
 
        return new MapLayerTest();
44
 
}
45
 
extern "C" QString name(){
46
 
        return QString("Map Layer test plugin");
47
 
}
48
 
extern "C" QString description(){
49
 
        return QString("Map Layer test plugin using QgsMapLayerInterface interface");
50
 
}
51
 
// Return the type (either UI or MapLayer plugin)
52
 
extern "C" int type()
53
 
{
54
 
    return QgisPlugin::MAPLAYER;
55
 
}