Skip to content

Commit e62a086

Browse files
Marco Bernasocchipka
authored andcommittedJul 5, 2011
adding place holders for settings dialog adding settings UI file
1 parent 8fff9f7 commit e62a086

File tree

3 files changed

+188
-1
lines changed

3 files changed

+188
-1
lines changed
 

‎src/plugins/globe/globe_plugin.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "globe_plugin.h"
2020
#include "globe_plugin_gui.h"
21+
//#include "globe_plugin_settings_gui.h"
2122
#include "qgsosgearthtilesource.h"
2223

2324
#include <qgisinterface.h>
@@ -28,6 +29,7 @@
2829

2930
#include <QAction>
3031
#include <QToolBar>
32+
#include <QMessageBox>
3133

3234
#include <osgGA/TrackballManipulator>
3335
#include <osgDB/ReadFile>
@@ -56,10 +58,13 @@ static const QString sDescription = QObject::tr( "Overlay data on a 3D globe" );
5658
static const QString sPluginVersion = QObject::tr( "Version 0.1" );
5759
static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
5860

61+
62+
//constructor
5963
GlobePlugin::GlobePlugin( QgisInterface* theQgisInterface )
6064
: QgisPlugin( sName, sDescription, sPluginVersion, sPluginType ),
6165
mQGisIface( theQgisInterface ),
6266
mQActionPointer( NULL ),
67+
mQActionSettingsPointer( NULL ),
6368
viewer(),
6469
mQDockWidget( tr( "Globe" ) ),
6570
mTileSource(0),
@@ -68,6 +73,7 @@ GlobePlugin::GlobePlugin( QgisInterface* theQgisInterface )
6873
{
6974
}
7075

76+
//destructor
7177
GlobePlugin::~GlobePlugin()
7278
{
7379
}
@@ -76,13 +82,19 @@ void GlobePlugin::initGui()
7682
{
7783
// Create the action for tool
7884
mQActionPointer = new QAction( QIcon( ":/globe/globe_plugin.png" ), tr( "Globe" ), this );
85+
mQActionSettingsPointer = new QAction( QIcon( ":/globe/globe_plugin.png" ), tr( "Globe Settings" ), this );
7986
// Set the what's this text
8087
mQActionPointer->setWhatsThis( tr( "Overlay data on a 3D globe" ) );
88+
mQActionSettingsPointer->setWhatsThis( tr( "Settings for 3D globe" ) );
8189
// Connect the action to the run
8290
connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
91+
// Connect to the setting slot
92+
connect( mQActionSettingsPointer, SIGNAL( triggered() ), this, SLOT( settings() ) );
8393
// Add the icon to the toolbar
8494
mQGisIface->addToolBarIcon( mQActionPointer );
95+
//Add menu
8596
mQGisIface->addPluginToMenu( tr( "&Globe" ), mQActionPointer );
97+
mQGisIface->addPluginToMenu( tr( "&Globe" ), mQActionSettingsPointer );
8698
mQDockWidget.setWidget(&viewer);
8799

88100
connect(mQGisIface->mapCanvas() , SIGNAL(extentsChanged()),
@@ -147,11 +159,22 @@ void GlobePlugin::run()
147159
#endif
148160
}
149161

162+
void GlobePlugin::settings()
163+
{
164+
//Ui_GlobePluginSettings* settingsDialog = new Ui_globeSettingsGuiBase( mQGisIface->mainWindow(), QgisGui::ModalDialogFlags );
165+
//ogrDialog->setAttribute( Qt::WA_DeleteOnClose );
166+
//settingsDialog->show();
167+
// TODO: implement settings dialog
168+
QMessageBox msgBox;
169+
msgBox.setText("settings dialog not implemented yet");
170+
msgBox.exec();
171+
}
172+
150173
void GlobePlugin::setupMap()
151174
{
152175
// read base layers from earth file
153176
QString earthFileName = QDir::cleanPath( QgsApplication::pkgDataPath() + "/globe/globe.earth" );
154-
EarthFile earthFile;
177+
EarthFile earthFile;
155178
QFile earthFileTemplate( earthFileName );
156179
if (!earthFileTemplate.open(QIODevice::ReadOnly | QIODevice::Text))
157180
{

‎src/plugins/globe/globe_plugin.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class GlobePlugin : public QObject, public QgisPlugin
4949
virtual void initGui();
5050
//! Show the dialog box
5151
void run();
52+
//! Show the settings dialog box
53+
void settings();
5254
//! unload the plugin
5355
void unload();
5456
//! show the help document
@@ -83,6 +85,8 @@ class GlobePlugin : public QObject, public QgisPlugin
8385
QgisInterface *mQGisIface;
8486
//!pointer to the qaction for this plugin
8587
QAction * mQActionPointer;
88+
//!pointer to the qaction for this plugin
89+
QAction * mQActionSettingsPointer;
8690
//! OSG Viewer
8791
QgsOsgViewer viewer;
8892
//! Dock widget for viewer

‎src/plugins/globe/settings_guibase.ui

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>QgsGlobePluginSettingsGuiBase</class>
4+
<widget class="QDialog" name="QgsGlobePluginSettingsGuiBase">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>491</width>
10+
<height>337</height>
11+
</rect>
12+
</property>
13+
<property name="sizePolicy">
14+
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
15+
<horstretch>0</horstretch>
16+
<verstretch>0</verstretch>
17+
</sizepolicy>
18+
</property>
19+
<property name="minimumSize">
20+
<size>
21+
<width>0</width>
22+
<height>0</height>
23+
</size>
24+
</property>
25+
<property name="windowTitle">
26+
<string>Globe Settings</string>
27+
</property>
28+
<property name="windowIcon">
29+
<iconset>
30+
<normaloff/>
31+
</iconset>
32+
</property>
33+
<layout class="QVBoxLayout" name="verticalLayout">
34+
<item>
35+
<widget class="QGroupBox" name="earthGroupBox">
36+
<property name="sizePolicy">
37+
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
38+
<horstretch>0</horstretch>
39+
<verstretch>0</verstretch>
40+
</sizepolicy>
41+
</property>
42+
<property name="title">
43+
<string>Custom Earth file</string>
44+
</property>
45+
<layout class="QGridLayout" name="gridLayout_2">
46+
<item row="0" column="0">
47+
<widget class="QLineEdit" name="inputEarthDataset">
48+
<property name="minimumSize">
49+
<size>
50+
<width>200</width>
51+
<height>25</height>
52+
</size>
53+
</property>
54+
</widget>
55+
</item>
56+
<item row="0" column="1">
57+
<widget class="QPushButton" name="buttonSelectEarth">
58+
<property name="text">
59+
<string>Browse</string>
60+
</property>
61+
</widget>
62+
</item>
63+
</layout>
64+
</widget>
65+
</item>
66+
<item>
67+
<widget class="QGroupBox" name="stereoGroupBox">
68+
<property name="sizePolicy">
69+
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
70+
<horstretch>0</horstretch>
71+
<verstretch>0</verstretch>
72+
</sizepolicy>
73+
</property>
74+
<property name="title">
75+
<string>Stereo 3D</string>
76+
</property>
77+
<layout class="QGridLayout" name="gridLayout_3">
78+
<item row="0" column="0" colspan="2">
79+
<widget class="QComboBox" name="comboStereo">
80+
<property name="minimumSize">
81+
<size>
82+
<width>300</width>
83+
<height>25</height>
84+
</size>
85+
</property>
86+
<property name="maxCount">
87+
<number>200</number>
88+
</property>
89+
<item>
90+
<property name="text">
91+
<string>OFF</string>
92+
</property>
93+
</item>
94+
<item>
95+
<property name="text">
96+
<string>ANAGLYPHIC</string>
97+
</property>
98+
</item>
99+
<item>
100+
<property name="text">
101+
<string>CHECKERBOARD</string>
102+
</property>
103+
</item>
104+
</widget>
105+
</item>
106+
</layout>
107+
</widget>
108+
</item>
109+
<item>
110+
<widget class="QDialogButtonBox" name="buttonBox">
111+
<property name="standardButtons">
112+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
113+
</property>
114+
</widget>
115+
</item>
116+
</layout>
117+
</widget>
118+
<layoutdefault spacing="6" margin="11"/>
119+
<tabstops>
120+
<tabstop>inputEarthDataset</tabstop>
121+
<tabstop>buttonSelectEarth</tabstop>
122+
<tabstop>comboStereo</tabstop>
123+
<tabstop>buttonBox</tabstop>
124+
</tabstops>
125+
<resources/>
126+
<connections>
127+
<connection>
128+
<sender>buttonBox</sender>
129+
<signal>accepted()</signal>
130+
<receiver>QgsGlobePluginSettingsGuiBase</receiver>
131+
<slot>accept()</slot>
132+
<hints>
133+
<hint type="sourcelabel">
134+
<x>424</x>
135+
<y>322</y>
136+
</hint>
137+
<hint type="destinationlabel">
138+
<x>481</x>
139+
<y>297</y>
140+
</hint>
141+
</hints>
142+
</connection>
143+
<connection>
144+
<sender>buttonBox</sender>
145+
<signal>rejected()</signal>
146+
<receiver>QgsGlobePluginSettingsGuiBase</receiver>
147+
<slot>reject()</slot>
148+
<hints>
149+
<hint type="sourcelabel">
150+
<x>365</x>
151+
<y>323</y>
152+
</hint>
153+
<hint type="destinationlabel">
154+
<x>281</x>
155+
<y>339</y>
156+
</hint>
157+
</hints>
158+
</connection>
159+
</connections>
160+
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.