Skip to content

Commit

Permalink
adding place holders for settings dialog adding settings UI file
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Bernasocchi authored and pka committed Jul 5, 2011
1 parent 8fff9f7 commit e62a086
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/plugins/globe/globe_plugin.cpp
Expand Up @@ -18,6 +18,7 @@

#include "globe_plugin.h"
#include "globe_plugin_gui.h"
//#include "globe_plugin_settings_gui.h"
#include "qgsosgearthtilesource.h"

#include <qgisinterface.h>
Expand All @@ -28,6 +29,7 @@

#include <QAction>
#include <QToolBar>
#include <QMessageBox>

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


//constructor
GlobePlugin::GlobePlugin( QgisInterface* theQgisInterface )
: QgisPlugin( sName, sDescription, sPluginVersion, sPluginType ),
mQGisIface( theQgisInterface ),
mQActionPointer( NULL ),
mQActionSettingsPointer( NULL ),
viewer(),
mQDockWidget( tr( "Globe" ) ),
mTileSource(0),
Expand All @@ -68,6 +73,7 @@ GlobePlugin::GlobePlugin( QgisInterface* theQgisInterface )
{
}

//destructor
GlobePlugin::~GlobePlugin()
{
}
Expand All @@ -76,13 +82,19 @@ void GlobePlugin::initGui()
{
// Create the action for tool
mQActionPointer = new QAction( QIcon( ":/globe/globe_plugin.png" ), tr( "Globe" ), this );
mQActionSettingsPointer = new QAction( QIcon( ":/globe/globe_plugin.png" ), tr( "Globe Settings" ), this );
// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Overlay data on a 3D globe" ) );
mQActionSettingsPointer->setWhatsThis( tr( "Settings for 3D globe" ) );
// Connect the action to the run
connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
// Connect to the setting slot
connect( mQActionSettingsPointer, SIGNAL( triggered() ), this, SLOT( settings() ) );
// Add the icon to the toolbar
mQGisIface->addToolBarIcon( mQActionPointer );
//Add menu
mQGisIface->addPluginToMenu( tr( "&Globe" ), mQActionPointer );
mQGisIface->addPluginToMenu( tr( "&Globe" ), mQActionSettingsPointer );
mQDockWidget.setWidget(&viewer);

connect(mQGisIface->mapCanvas() , SIGNAL(extentsChanged()),
Expand Down Expand Up @@ -147,11 +159,22 @@ void GlobePlugin::run()
#endif
}

void GlobePlugin::settings()
{
//Ui_GlobePluginSettings* settingsDialog = new Ui_globeSettingsGuiBase( mQGisIface->mainWindow(), QgisGui::ModalDialogFlags );
//ogrDialog->setAttribute( Qt::WA_DeleteOnClose );
//settingsDialog->show();
// TODO: implement settings dialog
QMessageBox msgBox;
msgBox.setText("settings dialog not implemented yet");
msgBox.exec();
}

void GlobePlugin::setupMap()
{
// read base layers from earth file
QString earthFileName = QDir::cleanPath( QgsApplication::pkgDataPath() + "/globe/globe.earth" );
EarthFile earthFile;
EarthFile earthFile;
QFile earthFileTemplate( earthFileName );
if (!earthFileTemplate.open(QIODevice::ReadOnly | QIODevice::Text))
{
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/globe/globe_plugin.h
Expand Up @@ -49,6 +49,8 @@ class GlobePlugin : public QObject, public QgisPlugin
virtual void initGui();
//! Show the dialog box
void run();
//! Show the settings dialog box
void settings();
//! unload the plugin
void unload();
//! show the help document
Expand Down Expand Up @@ -83,6 +85,8 @@ class GlobePlugin : public QObject, public QgisPlugin
QgisInterface *mQGisIface;
//!pointer to the qaction for this plugin
QAction * mQActionPointer;
//!pointer to the qaction for this plugin
QAction * mQActionSettingsPointer;
//! OSG Viewer
QgsOsgViewer viewer;
//! Dock widget for viewer
Expand Down
160 changes: 160 additions & 0 deletions src/plugins/globe/settings_guibase.ui
@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsGlobePluginSettingsGuiBase</class>
<widget class="QDialog" name="QgsGlobePluginSettingsGuiBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>491</width>
<height>337</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Globe Settings</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff/>
</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="earthGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Custom Earth file</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLineEdit" name="inputEarthDataset">
<property name="minimumSize">
<size>
<width>200</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="buttonSelectEarth">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="stereoGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Stereo 3D</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<widget class="QComboBox" name="comboStereo">
<property name="minimumSize">
<size>
<width>300</width>
<height>25</height>
</size>
</property>
<property name="maxCount">
<number>200</number>
</property>
<item>
<property name="text">
<string>OFF</string>
</property>
</item>
<item>
<property name="text">
<string>ANAGLYPHIC</string>
</property>
</item>
<item>
<property name="text">
<string>CHECKERBOARD</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>inputEarthDataset</tabstop>
<tabstop>buttonSelectEarth</tabstop>
<tabstop>comboStereo</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>QgsGlobePluginSettingsGuiBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>424</x>
<y>322</y>
</hint>
<hint type="destinationlabel">
<x>481</x>
<y>297</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>QgsGlobePluginSettingsGuiBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>365</x>
<y>323</y>
</hint>
<hint type="destinationlabel">
<x>281</x>
<y>339</y>
</hint>
</hints>
</connection>
</connections>
</ui>

0 comments on commit e62a086

Please sign in to comment.