** Some changes in the GPS plugin:

* Changed the tooltip of the action from "GPS Importer" to "GPS Tools"
   * Removed some old unused code
   * Made the upload/download tools much more flexible by letting users
     specifying "devices" with upload and download commands
   * Remember the last used device and port for uploads and downloads
   * Remember the last directory that a GPX file was loaded from


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@2159 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
larsl 2004-10-21 22:24:31 +00:00
parent f2abc684db
commit 6e5014e866
9 changed files with 510 additions and 608 deletions

View File

@ -3,6 +3,15 @@ ChangeLog,v 1.200 2004/10/21 17:27:35 mcoletti Exp
------------------------------------------------------------------------------
2004-10-22 [larsl] 0.5.0devel11
** Some changes in the GPS plugin:
* Changed the tooltip of the action from "GPS Importer" to "GPS Tools"
* Removed some old unused code
* Made the upload/download tools much more flexible by letting users
specifying "devices" with upload and download commands
* Remember the last used device and port for uploads and downloads
* Remember the last directory that a GPX file was loaded from
Version 0.6 'Simon' .... development version
2004-10-20 [mcoletti] 0.5.0devel10

View File

@ -26,7 +26,7 @@ dnl ---------------------------------------------------------------------------
MAJOR_VERSION=0
MINOR_VERSION=5
MICRO_VERSION=0
EXTRA_VERSION=10
EXTRA_VERSION=11
if test $EXTRA_VERSION -eq 0; then
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
else

View File

@ -40,22 +40,30 @@ gpsimporterplugin_la_SOURCES = plugin.cpp \
shpopen.c \
dbfopen.c \
shapefile.h \
qgsbabelformat.h \
qgsbabelformat.cpp \
plugingui.cpp \
qgsgpsdevicedialog.cpp \
$(plugin_UI)\
$(plugin_MOC)
plugin_MOC = plugin.moc.cpp \
plugingui.moc.cpp \
pluginguibase.moc.cpp
pluginguibase.moc.cpp \
qgsgpsdevicedialogbase.moc.cpp \
qgsgpsdevicedialog.moc.cpp
plugin_UI = pluginguibase.h \
pluginguibase.cpp
pluginguibase.cpp \
qgsgpsdevicedialogbase.h \
qgsgpsdevicedialogbase.cpp
plugin_UIC = pluginguibase.ui
plugin_UIC = pluginguibase.ui \
qgsgpsdevicedialogbase.ui
# UI dependencies
pluginguibase.cpp: pluginguibase.h pluginguibase.ui
qgsgpsdevicedialogbase.cpp: qgsgpsdevicedialogbase.h qgsgpsdevicedialogbase.ui
BUILT_SOURCES = $(plugin_MOC) $(plugin_UI)
@ -96,6 +104,9 @@ standalone_UI = pluginguibase.h \
EXTRA_DIST = $(plugin_UIC) icon.xpm \
pluginguibase.h \
pluginguibase.ui.h \
qgsgpsdevicedialogbase.h \
qgsgpsdevicedialogbase.ui.h \
plugingui.h \
plugin.h \
qgsgpsdevicedialog.h \
utils.h

View File

@ -41,6 +41,8 @@ email : tim@linfiniti.com
#include <qcursor.h>
#include <qprocess.h>
#include <qprogressdialog.h>
#include <qsettings.h>
#include <qstringlist.h>
//non qt includes
#include <cassert>
@ -76,11 +78,17 @@ Plugin::Plugin(QgisApp * theQGisApp, QgisIface * theQgisInterFace):
qGisInterface(theQgisInterFace),
QgisPlugin(name_,description_,version_,type_)
{
setupBabel();
}
Plugin::~Plugin()
{
// delete all our babel formats
BabelMap::iterator iter;
for (iter = mImporters.begin(); iter != mImporters.end(); ++iter)
delete iter->second;
for (iter = mDevices.begin(); iter != mDevices.end(); ++iter)
delete iter->second;
}
/* Following functions return name, description, version, and type for the plugin */
@ -113,20 +121,15 @@ void Plugin::initGui()
{
// add a menu with 2 items
QPopupMenu *pluginMenu = new QPopupMenu(qgisMainWindowPointer);
pluginMenu->insertItem(QIconSet(icon),"&Gps Tools", this, SLOT(run()));
menuBarPointer = ((QMainWindow *) qgisMainWindowPointer)->menuBar();
menuIdInt = qGisInterface->addMenu("&Gps", pluginMenu);
// Create the action for tool
myQActionPointer = new QAction("Import Gps Data", QIconSet(icon), "&Wmi",0, this, "run");
// Connect the action to the run
// add an action to the toolbar
myQActionPointer = new QAction("Gps Tools", QIconSet(icon), "&Wmi",0,
this, "run");
connect(myQActionPointer, SIGNAL(activated()), this, SLOT(run()));
// Add the icon to the toolbar
qGisInterface->addToolBarIcon(myQActionPointer);
}
//method defined in interface
@ -141,25 +144,33 @@ void Plugin::run()
// find all GPX layers
std::vector<QgsVectorLayer*> gpxLayers;
std::map<QString, QgsMapLayer*>::const_iterator iter;
std::cerr<<"LAYERS: "<<qGisInterface->getLayerRegistry()->
mapLayers().size()<<std::endl;
for (iter = qGisInterface->getLayerRegistry()->mapLayers().begin();
iter != qGisInterface->getLayerRegistry()->mapLayers().end(); ++iter) {
std::cerr<<iter->second->name()<<std::endl;
if (iter->second->type() == QgsMapLayer::VECTOR) {
QgsVectorLayer* vectorLayer =dynamic_cast<QgsVectorLayer*>(iter->second);
if (vectorLayer->providerType() == "gpx")
gpxLayers.push_back(vectorLayer);
QgsVectorLayer* vLayer = dynamic_cast<QgsVectorLayer*>(iter->second);
if (vLayer->providerType() == "gpx")
gpxLayers.push_back(vLayer);
}
}
std::cerr<<std::endl;
PluginGui *myPluginGui=new PluginGui(gpxLayers, qgisMainWindowPointer, "GPS Tools", true, 0);
PluginGui *myPluginGui=new PluginGui(mImporters, mDevices, gpxLayers,
qgisMainWindowPointer, "GPS Tools",
true, 0);
//listen for when the layer has been made so we can draw it
connect(myPluginGui, SIGNAL(drawRasterLayer(QString)), this, SLOT(drawRasterLayer(QString)));
connect(myPluginGui, SIGNAL(drawVectorLayer(QString,QString,QString)), this, SLOT(drawVectorLayer(QString,QString,QString)));
connect(myPluginGui, SIGNAL(drawRasterLayer(QString)),
this, SLOT(drawRasterLayer(QString)));
connect(myPluginGui, SIGNAL(drawVectorLayer(QString,QString,QString)),
this, SLOT(drawVectorLayer(QString,QString,QString)));
connect(myPluginGui, SIGNAL(loadGPXFile(QString, bool, bool, bool)),
this, SLOT(loadGPXFile(QString, bool, bool, bool)));
connect(myPluginGui, SIGNAL(importGPSFile(QString, QString, bool, bool, bool,
QString, QString)),
this, SLOT(importGPSFile(QString, QString, bool, bool, bool, QString,
QString)));
connect(myPluginGui, SIGNAL(importGPSFile(QString, QgsBabelFormat*, bool,
bool, bool, QString, QString)),
this, SLOT(importGPSFile(QString, QgsBabelFormat*, bool, bool,
bool, QString, QString)));
connect(myPluginGui, SIGNAL(downloadFromGPS(QString, QString, bool, bool,
bool, QString, QString)),
this, SLOT(downloadFromGPS(QString, QString, bool, bool, bool,
@ -171,12 +182,6 @@ void Plugin::run()
myPluginGui->show();
}
//!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)
{
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)
@ -205,6 +210,10 @@ void Plugin::loadGPXFile(QString filename, bool loadWaypoints, bool loadRoutes,
return;
}
// remember the directory
QSettings settings;
settings.writeEntry("/qgis/gps/gpxdirectory", fileInfo.dirPath());
// add the requested layers
if (loadTracks)
emit drawVectorLayer(filename + "?type=track",
@ -220,7 +229,7 @@ void Plugin::loadGPXFile(QString filename, bool loadWaypoints, bool loadRoutes,
}
void Plugin::importGPSFile(QString inputFilename, QString inputFormat,
void Plugin::importGPSFile(QString inputFilename, QgsBabelFormat* importer,
bool importWaypoints, bool importRoutes,
bool importTracks, QString outputFilename,
QString layerName) {
@ -235,9 +244,9 @@ void Plugin::importGPSFile(QString inputFilename, QString inputFormat,
typeArg = "-t";
// try to start the gpsbabel process
QStringList babelArgs;
babelArgs<<"gpsbabel"<<typeArg<<"-i"<<inputFormat<<"-o"<<"gpx"
<<inputFilename<<outputFilename;
QStringList babelArgs =
importer->getImportCommand(mBabelPath, typeArg,
inputFilename, outputFilename);
QProcess babelProcess(babelArgs);
if (!babelProcess.start()) {
QMessageBox::warning(NULL, "Could not start process",
@ -281,11 +290,11 @@ void Plugin::importGPSFile(QString inputFilename, QString inputFormat,
}
void Plugin::downloadFromGPS(QString protocol, QString deviceFilename,
void Plugin::downloadFromGPS(QString device, QString port,
bool downloadWaypoints, bool downloadRoutes,
bool downloadTracks, QString outputFilename,
QString layerName) {
// what does the user want to download?
QString typeArg;
if (downloadWaypoints)
@ -296,9 +305,9 @@ void Plugin::downloadFromGPS(QString protocol, QString deviceFilename,
typeArg = "-t";
// try to start the gpsbabel process
QStringList babelArgs;
babelArgs<<"gpsbabel"<<typeArg<<"-i"<<protocol<<"-o"<<"gpx"
<<deviceFilename<<outputFilename;
QStringList babelArgs =
mDevices[device]->getImportCommand(mBabelPath, typeArg,
port, outputFilename);
QProcess babelProcess(babelArgs);
if (!babelProcess.start()) {
QMessageBox::warning(NULL, "Could not start process",
@ -337,12 +346,17 @@ void Plugin::downloadFromGPS(QString protocol, QString deviceFilename,
emit drawVectorLayer(outputFilename + "?type=track",
layerName, "gpx");
// everything was OK, remember the device and port for next time
QSettings settings;
settings.writeEntry("/qgis/gps/lastdldevice", device);
settings.writeEntry("/qgis/gps/lastdlport", port);
emit closeGui();
}
void Plugin::uploadToGPS(QgsVectorLayer* gpxLayer, QString protocol,
QString deviceFilename) {
void Plugin::uploadToGPS(QgsVectorLayer* gpxLayer, QString device,
QString port) {
const QString& source(gpxLayer->getDataProvider()->getDataSourceUri());
@ -360,10 +374,9 @@ void Plugin::uploadToGPS(QgsVectorLayer* gpxLayer, QString protocol,
}
// try to start the gpsbabel process
QStringList babelArgs;
babelArgs<<"gpsbabel"<<typeArg<<"-i"<<"gpx"
<<"-o"<<protocol
<<source.left(source.findRev('?'))<<deviceFilename;
QStringList babelArgs =
mDevices[device]->getExportCommand(mBabelPath, typeArg,
source.left(source.findRev('?')), port);
QProcess babelProcess(babelArgs);
if (!babelProcess.start()) {
QMessageBox::warning(NULL, "Could not start process",
@ -391,10 +404,99 @@ void Plugin::uploadToGPS(QgsVectorLayer* gpxLayer, QString protocol,
return;
}
// everything was OK, remember this device for next time
QSettings settings;
settings.writeEntry("/qgis/gps/lastuldevice", device);
settings.writeEntry("/qgis/gps/lastulport", port);
emit closeGui();
}
void Plugin::setupBabel() {
// where is gpsbabel?
QSettings settings;
mBabelPath = settings.readEntry("/qgis/gps/gpsbabelpath");
if (mBabelPath.isEmpty())
mBabelPath = "gpsbabel";
// the importable formats
mImporters["Geocaching.com .loc"] =
new QgsSimpleBabelFormat("geo", true, false, false);
mImporters["Magellan Mapsend"] =
new QgsSimpleBabelFormat("mapsend", true, true, true);
mImporters["Garmin PCX5"] =
new QgsSimpleBabelFormat("pcx", true, false, true);
mImporters["Garmin Mapsource"] =
new QgsSimpleBabelFormat("mapsource", true, true, true);
mImporters["GPSUtil"] =
new QgsSimpleBabelFormat("gpsutil", true, false, false);
mImporters["PocketStreets 2002/2003 Pushpin"] =
new QgsSimpleBabelFormat("psp", true, false, false);
mImporters["CoPilot Flight Planner"] =
new QgsSimpleBabelFormat("copilot", true, false, false);
mImporters["Magellan Navigator Companion"] =
new QgsSimpleBabelFormat("magnav", true, false, false);
mImporters["Holux"] =
new QgsSimpleBabelFormat("holux", true, false, false);
mImporters["Topo by National Geographic"] =
new QgsSimpleBabelFormat("tpg", true, false, false);
mImporters["TopoMapPro"] =
new QgsSimpleBabelFormat("tmpro", true, false, false);
mImporters["GeocachingDB"] =
new QgsSimpleBabelFormat("gcdb", true, false, false);
mImporters["Tiger"] =
new QgsSimpleBabelFormat("tiger", true, false, false);
mImporters["EasyGPS Binary Format"] =
new QgsSimpleBabelFormat("easygps", true, false, false);
mImporters["Delorme Routes"] =
new QgsSimpleBabelFormat("saroute", false, false, true);
mImporters["Navicache"] =
new QgsSimpleBabelFormat("navicache", true, false, false);
mImporters["PSITrex"] =
new QgsSimpleBabelFormat("psitrex", true, true, true);
mImporters["Delorme GPS Log"] =
new QgsSimpleBabelFormat("gpl", false, false, true);
mImporters["OziExplorer"] =
new QgsSimpleBabelFormat("ozi", true, false, false);
mImporters["NMEA Sentences"] =
new QgsSimpleBabelFormat("nmea", true, false, true);
mImporters["Delorme Street Atlas 2004 Plus"] =
new QgsSimpleBabelFormat("saplus", true, false, false);
mImporters["Microsoft Streets and Trips"] =
new QgsSimpleBabelFormat("s_and_t", true, false, false);
mImporters["NIMA/GNIS Geographic Names"] =
new QgsSimpleBabelFormat("nima", true, false, false);
mImporters["Maptech"] =
new QgsSimpleBabelFormat("mxf", true, false, false);
mImporters["Mapopolis.com Mapconverter Application"] =
new QgsSimpleBabelFormat("mapconverter", true, false, false);
mImporters["GPSman"] =
new QgsSimpleBabelFormat("gpsman", true, false, false);
mImporters["GPSDrive"] =
new QgsSimpleBabelFormat("gpsdrive", true, false, false);
mImporters["Fugawi"] =
new QgsSimpleBabelFormat("fugawi", true, false, false);
mImporters["DNA"] =
new QgsSimpleBabelFormat("dna", true, false, false);
// and the GPS devices
mDevices["Garmin serial"] =
new QgsBabelCommand("%babel -i garmin -o gpx /dev/ttyS0 %out",
"%babel -i gpx -o garmin %in /dev/ttyS0");
QStringList deviceNames = settings.readListEntry("/qgis/gps/devicelist");
QStringList::iterator iter;
for (iter = deviceNames.begin(); iter != deviceNames.end(); ++iter) {
QString download = settings.
readEntry(QString("/qgis/gps/devices/%1/download").arg(*iter), "");
QString upload = settings.
readEntry(QString("/qgis/gps/devices/%1/upload").arg(*iter), "");
mDevices[*iter] = new QgsBabelCommand(download, upload);
}
}
/**
* Required extern functions needed for every plugin

View File

@ -19,6 +19,7 @@
/* $Id$ */
#ifndef PLUGIN
#define PLUGIN
#include "qgsbabelformat.h"
#include "../qgisplugin.h"
#include <qwidget.h>
#include <qgisapp.h>
@ -32,14 +33,15 @@ class QgsVectorLayer;
*/
class Plugin:public QObject, public QgisPlugin
{
Q_OBJECT public:
Q_OBJECT
public:
/**
* Constructor for a plugin. The QgisApp and QgisIface pointers are passed by
* QGIS when it attempts to instantiate the plugin.
* @param qgis Pointer to the QgisApp object
* @param qI Pointer to the QgisIface object.
*/
Plugin(QgisApp * , QgisIface * );
Plugin(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
@ -64,8 +66,6 @@ class Plugin:public QObject, public QgisPlugin
public slots:
//! Show the dialog box
void run();
//!draw a raster layer in the qui
void drawRasterLayer(QString);
//! Add a vector layer given vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
void drawVectorLayer(QString,QString,QString);
//! unload the plugin
@ -76,22 +76,24 @@ class Plugin:public QObject, public QgisPlugin
//! load a GPX file
void loadGPXFile(QString filename, bool loadWaypoints, bool loadRoutes,
bool loadTracks);
void importGPSFile(QString inputFilename, QString inputFormat,
void importGPSFile(QString inputFilename, QgsBabelFormat* importer,
bool importWaypoints, bool importRoutes,
bool importTracks, QString outputFilename,
QString layerName);
void downloadFromGPS(QString protocol, QString deviceFilename,
void downloadFromGPS(QString device, QString port,
bool downloadWaypoints, bool downloadRoutes,
bool downloadTracks, QString outputFilename,
QString layerName);
void uploadToGPS(QgsVectorLayer* gpxLayer, QString protocol,
QString deviceFilename);
void uploadToGPS(QgsVectorLayer* gpxLayer, QString device,
QString port);
signals:
void closeGui();
private:
private:
void setupBabel();
//! Name of the plugin
@ -112,6 +114,10 @@ class Plugin:public QObject, public QgisPlugin
QgisIface *qGisInterface;
//! Pointer to the QAction object used in the menu and toolbar
QAction *myQActionPointer;
QString mBabelPath;
std::map<QString, QgsBabelFormat*> mImporters;
std::map<QString, QgsBabelFormat*> mDevices;
};
#endif

View File

@ -10,6 +10,7 @@
* (at your option) any later version. *
***************************************************************************/
#include "plugingui.h"
#include "qgsgpsdevicedialog.h"
#include "../../src/qgsmaplayer.h"
#include "../../src/qgsdataprovider.h"
@ -28,6 +29,7 @@
#include <qfiledialog.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qsettings.h>
#include "waypointtoshape.h"
//standard includes
@ -36,22 +38,17 @@
#include <iostream>
PluginGui::PluginGui() : PluginGuiBase()
{
populateDeviceComboBox();
PluginGui::PluginGui(const BabelMap& importers, BabelMap& devices,
std::vector<QgsVectorLayer*> gpxMapLayers,
QWidget* parent, const char* name, bool modal, WFlags fl)
: PluginGuiBase(parent, name, modal, fl), gpxLayers(gpxMapLayers),
mImporters(importers), mDevices(devices) {
populatePortComboBoxes();
populateULLayerComboBox();
populateIMPBabelFormats();
tabWidget->removePage(tabWidget->page(2));
}
PluginGui::PluginGui( std::vector<QgsVectorLayer*> gpxMapLayers,
QWidget* parent , const char* name , bool modal ,
WFlags fl )
: PluginGuiBase( parent, name, modal, fl ), gpxLayers(gpxMapLayers)
{
populateDeviceComboBox();
populateULLayerComboBox();
populateIMPBabelFormats();
tabWidget->removePage(tabWidget->page(2));
connect(pbULEditDevices, SIGNAL(clicked()), this, SLOT(openDeviceEditor()));
connect(pbDLEditDevices, SIGNAL(clicked()), this, SLOT(openDeviceEditor()));
}
PluginGui::~PluginGui()
{
@ -97,7 +94,7 @@ void PluginGui::pbnOK_clicked()
case 1: {
const QString& typeString(cmbDLFeatureType->currentText());
emit importGPSFile(leIMPInput->text(),
babelFormats.find(impFormat)->second.formatName,
mImporters.find(impFormat)->second,
typeString == "Waypoints", typeString == "Routes",
typeString == "Tracks", leIMPOutput->text(),
leIMPLayer->text());
@ -107,9 +104,8 @@ void PluginGui::pbnOK_clicked()
// or download GPS data from a device?
case 2: {
int featureType = cmbDLFeatureType->currentItem();
emit downloadFromGPS(cmbDLProtocol->currentText().lower(),
cmbDLDevice->currentText(), featureType == 0,
featureType == 1, featureType == 2,
emit downloadFromGPS(cmbDLDevice->currentText(), cmbDLPort->currentText(),
featureType == 0, featureType == 1, featureType == 2,
leDLOutput->text(), leDLBasename->text());
break;
}
@ -117,52 +113,20 @@ void PluginGui::pbnOK_clicked()
// or upload GPS data to a device?
case 3:
emit uploadToGPS(gpxLayers[cmbULLayer->currentItem()],
cmbULProtocol->currentText().lower(),
cmbULDevice->currentText());
cmbULDevice->currentText(), cmbULPort->currentText());
break;
}
}
void PluginGui::pbnSelectInputFile_clicked()
{
std::cout << " Gps File Importer::pbnSelectInputFile_clicked() " << std::endl;
QString myFileTypeQString;
QString myFilterString="Text File (*.txt)";
QString myFileNameQString = QFileDialog::getOpenFileName(
"." , //initial dir
myFilterString, //filters to select
this , //parent dialog
"OpenFileDialog" , //QFileDialog qt object name
"Select GPS dump text file" , //caption
&myFileTypeQString //the pointer to store selected filter
);
std::cout << "Selected filetype filter is : " << myFileTypeQString << std::endl;
leInputFile->setText(myFileNameQString);
}
void PluginGui::pbnSelectOutputFile_clicked()
{
std::cout << " Gps File Importer Gui::pbnSelectOutputFile_clicked() " << std::endl;
QString myOutputFileNameQString = QFileDialog::getSaveFileName(
".",
"ESRI Shapefile (*.shp)",
this,
"save file dialog"
"Choose a filename to save under" );
leOutputShapeFile->setText(myOutputFileNameQString);
}
void PluginGui::pbnDLOutput_clicked()
{
QString myFileNameQString = QFileDialog::getSaveFileName(
"." , //initial dir
"GPS eXchange format (*.gpx)",
this , //parent dialog
"Select GPX output",
"Choose a filename to save under" );
QString myFileNameQString =
QFileDialog::getSaveFileName("." , //initial dir
"GPS eXchange format (*.gpx)",
this , //parent dialog
"Select GPX output",
"Choose a filename to save under");
leDLOutput->setText(myFileNameQString);
}
@ -193,18 +157,6 @@ void PluginGui::enableRelevantControls()
}
}
// import download file
else if (tabWidget->currentPageIndex() == 666) {
if ( (leOutputShapeFile->text()=="") || (leInputFile->text()=="") )
{
pbnOK->setEnabled(false);
}
else
{
pbnOK->setEnabled(true);
}
}
// import other file
else if (tabWidget->currentPageIndex() == 1) {
@ -224,7 +176,7 @@ void PluginGui::enableRelevantControls()
pbnOK->setEnabled(true);
}
// upload from device
// upload to device
else if (tabWidget->currentPageIndex() == 3) {
if (cmbULDevice->currentText() == "" || cmbULLayer->currentText() == "")
pbnOK->setEnabled(false);
@ -245,8 +197,12 @@ void PluginGui::pbnGPXSelectFile_clicked()
std::cout << " Gps File Importer::pbnGPXSelectFile_clicked() " << std::endl;
QString myFileTypeQString;
QString myFilterString="GPS eXchange format (*.gpx)";
QSettings settings;
QString dir = settings.readEntry("/qgis/gps/gpxdirectory");
if (dir.isEmpty())
dir = ".";
QString myFileNameQString = QFileDialog::getOpenFileName(
"." , //initial dir
dir , //initial dir
myFilterString, //filters to select
this , //parent dialog
"OpenFileDialog" , //QFileDialog qt object name
@ -269,9 +225,9 @@ void PluginGui::pbnIMPInput_clicked() {
&myFileType //the pointer to store selected filter
);
impFormat = myFileType.left(myFileType.length() - 6);
std::map<QString, BabelFormatInfo>::const_iterator iter;
iter = babelFormats.find(impFormat);
if (iter == babelFormats.end()) {
std::map<QString, QgsBabelFormat*>::const_iterator iter;
iter = mImporters.find(impFormat);
if (iter == mImporters.end()) {
std::cerr<<"Unknown file format selected: "
<<myFileType.left(myFileType.length() - 6)<<std::endl;
}
@ -279,11 +235,11 @@ void PluginGui::pbnIMPInput_clicked() {
std::cerr<<iter->first<<" selected"<<std::endl;
leIMPInput->setText(myFileName);
cmbIMPFeature->clear();
if (iter->second.hasWaypoints)
if (iter->second->supportsWaypoints())
cmbIMPFeature->insertItem("Waypoints");
if (iter->second.hasRoutes)
if (iter->second->supportsRoutes())
cmbIMPFeature->insertItem("Routes");
if (iter->second.hasTracks)
if (iter->second->supportsTracks())
cmbIMPFeature->insertItem("Tracks");
}
}
@ -300,14 +256,15 @@ void PluginGui::pbnIMPOutput_clicked() {
}
void PluginGui::populateDeviceComboBox() {
void PluginGui::populatePortComboBoxes() {
#ifdef linux
// look for linux serial devices
QString linuxDev("/dev/ttyS%1");
for (int i = 0; i < 10; ++i) {
if (QFileInfo(linuxDev.arg(i)).exists()) {
cmbDLDevice->insertItem(linuxDev.arg(i));
cmbULDevice->insertItem(linuxDev.arg(i));
cmbDLPort->insertItem(linuxDev.arg(i));
cmbULPort->insertItem(linuxDev.arg(i));
}
else
break;
@ -317,8 +274,8 @@ void PluginGui::populateDeviceComboBox() {
linuxDev = "/dev/ttyUSB%1";
for (int i = 0; i < 10; ++i) {
if (QFileInfo(linuxDev.arg(i)).exists()) {
cmbDLDevice->insertItem(linuxDev.arg(i));
cmbULDevice->insertItem(linuxDev.arg(i));
cmbDLPort->insertItem(linuxDev.arg(i));
cmbULPort->insertItem(linuxDev.arg(i));
}
else
break;
@ -331,8 +288,8 @@ void PluginGui::populateDeviceComboBox() {
QString freebsdDev("/dev/cuaa%1");
for (int i = 0; i < 10; ++i) {
if (QFileInfo(freebsdDev.arg(i)).exists()) {
cmbDLDevice->insertItem(freebsdDev.arg(i));
cmbULDevice->insertItem(freebsdDev.arg(i));
cmbDLPort->insertItem(freebsdDev.arg(i));
cmbULPort->insertItem(freebsdDev.arg(i));
}
else
break;
@ -344,8 +301,8 @@ void PluginGui::populateDeviceComboBox() {
QString solarisDev("/dev/cua/%1");
for (int i = 'a'; i < 'k'; ++i) {
if (QFileInfo(solarisDev.arg(char(i))).exists()) {
cmbDLDevice->insertItem(solarisDev.arg(char(i)));
cmbULDevice->insertItem(solarisDev.arg(char(i)));
cmbDLPort->insertItem(solarisDev.arg(char(i)));
cmbULPort->insertItem(solarisDev.arg(char(i)));
}
else
break;
@ -353,14 +310,30 @@ void PluginGui::populateDeviceComboBox() {
#endif
#ifdef WIN32
cmbULDevice->insertItem("com1");
cmbULDevice->insertItem("com2");
cmbDLDevice->insertItem("com1");
cmbDLDevice->insertItem("com2");
cmbULPort->insertItem("com1");
cmbULPort->insertItem("com2");
cmbDLPort->insertItem("com1");
cmbDLPort->insertItem("com2");
#endif
// OSX, OpenBSD, NetBSD etc? Anyone?
// remember the last ports used
QSettings settings;
QString lastDLPort = settings.readEntry("/qgis/gps/lastdlport", "");
QString lastULPort = settings.readEntry("/qgis/gps/lastulport", "");
for (int i = 0; i < cmbDLPort->count(); ++i) {
if (cmbDLPort->text(i) == lastDLPort) {
cmbDLPort->setCurrentItem(i);
break;
}
}
for (int i = 0; i < cmbULPort->count(); ++i) {
if (cmbULPort->text(i) == lastULPort) {
cmbULPort->setCurrentItem(i);
break;
}
}
}
@ -373,65 +346,49 @@ void PluginGui::populateULLayerComboBox() {
void PluginGui::populateIMPBabelFormats() {
babelFormats["Geocaching.com .loc"] =
BabelFormatInfo("geo", true, false, false);
babelFormats["Magellan Mapsend"] =
BabelFormatInfo("mapsend", true, true, true);
babelFormats["Garmin PCX5"] =
BabelFormatInfo("pcx", true, false, true);
babelFormats["Garmin Mapsource"] =
BabelFormatInfo("mapsource", true, true, true);
babelFormats["GPSUtil"] =
BabelFormatInfo("gpsutil", true, false, false);
babelFormats["PocketStreets 2002/2003 Pushpin"] =
BabelFormatInfo("psp", true, false, false);
babelFormats["CoPilot Flight Planner"] =
BabelFormatInfo("copilot", true, false, false);
babelFormats["Magellan Navigator Companion"] =
BabelFormatInfo("magnav", true, false, false);
babelFormats["Holux"] =
BabelFormatInfo("holux", true, false, false);
babelFormats["Topo by National Geographic"] =
BabelFormatInfo("tpg", true, false, false);
babelFormats["TopoMapPro"] =
BabelFormatInfo("tmpro", true, false, false);
babelFormats["GeocachingDB"] =
BabelFormatInfo("gcdb", true, false, false);
babelFormats["Tiger"] =
BabelFormatInfo("tiger", true, false, false);
babelFormats["EasyGPS Binary Format"] =
BabelFormatInfo("easygps", true, false, false);
babelFormats["Delorme Routes"] =
BabelFormatInfo("saroute", false, false, true);
babelFormats["Navicache"] =
BabelFormatInfo("navicache", true, false, false);
babelFormats["PSITrex"] =
BabelFormatInfo("psitrex", true, true, true);
babelFormats["Delorme GPS Log"] =
BabelFormatInfo("gpl", false, false, true);
babelFormats["OziExplorer"] =
BabelFormatInfo("ozi", true, false, false);
babelFormats["NMEA Sentences"] =
BabelFormatInfo("nmea", true, false, true);
babelFormats["Delorme Street Atlas 2004 Plus"] =
BabelFormatInfo("saplus", true, false, false);
babelFormats["Microsoft Streets and Trips"] =
BabelFormatInfo("s_and_t", true, false, false);
babelFormats["NIMA/GNIS Geographic Names"] =
BabelFormatInfo("nima", true, false, false);
babelFormats["Maptech"] =
BabelFormatInfo("mxf", true, false, false);
babelFormats["Mapopolis.com Mapconverter Application"] =
BabelFormatInfo("mapconverter", true, false, false);
babelFormats["GPSman"] =
BabelFormatInfo("gpsman", true, false, false);
babelFormats["GPSDrive"] =
BabelFormatInfo("gpsdrive", true, false, false);
babelFormats["Fugawi"] =
BabelFormatInfo("fugawi", true, false, false);
babelFormats["DNA"] =
BabelFormatInfo("dna", true, false, false);
std::map<QString, BabelFormatInfo>::const_iterator iter;
for (iter = babelFormats.begin(); iter != babelFormats.end(); ++iter)
babelFilter = "";
cmbULDevice->clear();
cmbDLDevice->clear();
QSettings settings;
QString lastDLDevice = settings.readEntry("/qgis/gps/lastdldevice", "");
QString lastULDevice = settings.readEntry("/qgis/gps/lastuldevice", "");
BabelMap::const_iterator iter;
for (iter = mImporters.begin(); iter != mImporters.end(); ++iter)
babelFilter.append((const char*)iter->first).append(" (*.*);;");
int u = -1, d = -1;
for (iter = mDevices.begin(); iter != mDevices.end(); ++iter) {
if (iter->second->supportsExport()) {
cmbULDevice->insertItem(iter->first);
if (iter->first == lastULDevice)
u = cmbULDevice->count() - 1;
}
if (iter->second->supportsImport()) {
cmbDLDevice->insertItem(iter->first);
if (iter->first == lastDLDevice)
d = cmbDLDevice->count() - 1;
}
}
if (u != -1)
cmbULDevice->setCurrentItem(u);
if (d != -1)
cmbDLDevice->setCurrentItem(d);
}
void populatePortComboBoxes() {
}
void PluginGui::openDeviceEditor() {
QgsGPSDeviceDialog* dlg = new QgsGPSDeviceDialog(mDevices);
dlg->show();
connect(dlg, SIGNAL(devicesChanged()), this, SLOT(slotDevicesUpdated()));
}
void PluginGui::slotDevicesUpdated() {
populateIMPBabelFormats();
}

View File

@ -14,6 +14,7 @@
#include "../../src/qgsvectorlayer.h"
#include "pluginguibase.h"
#include "qgsbabelformat.h"
#include <vector>
@ -26,64 +27,59 @@
class PluginGui : public PluginGuiBase
{
Q_OBJECT
public:
PluginGui();
PluginGui( std::vector<QgsVectorLayer*> gpxMapLayers, QWidget* parent ,
const char* name , bool modal , WFlags );
~PluginGui();
public:
PluginGui(const BabelMap& importers, BabelMap& devices,
std::vector<QgsVectorLayer*> gpxMapLayers, QWidget* parent,
const char* name , bool modal , WFlags);
~PluginGui();
private:
void pbnSelectInputFile_clicked();
void pbnSelectOutputFile_clicked();
void pbnGPXSelectFile_clicked();
void pbnIMPInput_clicked();
void pbnIMPOutput_clicked();
void pbnDLOutput_clicked();
void enableRelevantControls();
void pbnCancel_clicked();
void pbnOK_clicked();
void populateDeviceComboBox();
void populateULLayerComboBox();
void populateIMPBabelFormats();
signals:
void drawRasterLayer(QString);
void drawVectorLayer(QString,QString,QString);
void loadGPXFile(QString filename, bool showWaypoints, bool showRoutes,
bool showTracks);
void importGPSFile(QString inputFilename, QString inputFormat,
bool importWaypoints, bool importRoutes,
bool importTracks, QString outputFilename,
QString layerName);
void downloadFromGPS(QString protocol, QString deviceFilename,
bool downloadWaypoints, bool downloadRoutes,
bool downloadTracks, QString outputFilename,
QString layerName);
void uploadToGPS(QgsVectorLayer* gpxLayer, QString protocol,
QString deviceFilename);
public slots:
void openDeviceEditor();
void slotDevicesUpdated();
private:
struct BabelFormatInfo {
BabelFormatInfo(QString fn = "", bool hw = false, bool hr = false,
bool ht = false) :
formatName(fn), hasWaypoints(hw), hasRoutes(hr), hasTracks(ht) { }
QString formatName;
bool hasWaypoints;
bool hasRoutes;
bool hasTracks;
};
std::vector<QgsVectorLayer*> gpxLayers;
std::map<QString, BabelFormatInfo> babelFormats;
QString babelFilter;
QString impFormat;
void pbnSelectInputFile_clicked();
void pbnSelectOutputFile_clicked();
void pbnGPXSelectFile_clicked();
void pbnIMPInput_clicked();
void pbnIMPOutput_clicked();
void pbnDLOutput_clicked();
void enableRelevantControls();
void pbnCancel_clicked();
void pbnOK_clicked();
void populateDeviceComboBox();
void populateULLayerComboBox();
void populateIMPBabelFormats();
void populatePortComboBoxes();
signals:
void drawRasterLayer(QString);
void drawVectorLayer(QString,QString,QString);
void loadGPXFile(QString filename, bool showWaypoints, bool showRoutes,
bool showTracks);
void importGPSFile(QString inputFilename, QgsBabelFormat* importer,
bool importWaypoints, bool importRoutes,
bool importTracks, QString outputFilename,
QString layerName);
void downloadFromGPS(QString device, QString port, bool downloadWaypoints,
bool downloadRoutes, bool downloadTracks,
QString outputFilename, QString layerName);
void uploadToGPS(QgsVectorLayer* gpxLayer, QString device, QString port);
private:
std::vector<QgsVectorLayer*> gpxLayers;
const BabelMap& mImporters;
BabelMap& mDevices;
QString babelFilter;
QString impFormat;
};
#endif

View File

@ -1,4 +1,4 @@
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>PluginGuiBase</class>
<widget class="QDialog">
<property name="name">
@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>763</width>
<height>405</height>
<width>606</width>
<height>370</height>
</rect>
</property>
<property name="paletteBackgroundColor">
@ -287,125 +287,6 @@ tracks, so some feature types may be disabled for some file formats.&lt;/p&gt;
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>GPS Download File Importer</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QTextEdit" row="0" column="0" rowspan="1" colspan="5">
<property name="name">
<cstring>teInstructions</cstring>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name="qrichtext" content="1" /&gt;&lt;/head&gt;&lt;body style="font-size:12pt;font-family:Arial"&gt;
&lt;p style="margin-top:16px"&gt;&lt;span style="font-size:17pt;font-weight:600"&gt;Description&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Select the GPS download file that you would like to convert to a shapefile and this plugin will do the job for you! &lt;/p&gt;
&lt;p&gt;Use the minumum time gap to let the importer know what time interval should be used before starting a new feature. &lt;/p&gt;
&lt;p&gt;Use the minimum distance gap to define what distance between two readings should be considered the start of a new feature.&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;
</string>
</property>
<property name="wordWrap">
<enum>WidgetWidth</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLineEdit" row="2" column="0" rowspan="1" colspan="4">
<property name="name">
<cstring>leInputFile</cstring>
</property>
</widget>
<widget class="QLabel" row="3" column="0" rowspan="1" colspan="5">
<property name="name">
<cstring>lblOutputFile</cstring>
</property>
<property name="text">
<string>Output (Shape) File:</string>
</property>
</widget>
<widget class="QLineEdit" row="4" column="0" rowspan="1" colspan="4">
<property name="name">
<cstring>leOutputShapeFile</cstring>
</property>
</widget>
<widget class="QLabel" row="5" column="0">
<property name="name">
<cstring>lblMinTimeGap</cstring>
</property>
<property name="text">
<string>Minimum time gap (s):</string>
</property>
</widget>
<widget class="QLabel" row="5" column="2">
<property name="name">
<cstring>lblMinDistanceGap</cstring>
</property>
<property name="text">
<string>Minimum distance gap (dd):</string>
</property>
</widget>
<widget class="QSpinBox" row="5" column="1">
<property name="name">
<cstring>spinMinTimeGap</cstring>
</property>
<property name="maxValue">
<number>999999999</number>
</property>
<property name="lineStep">
<number>10</number>
</property>
<property name="value">
<number>60</number>
</property>
</widget>
<widget class="QPushButton" row="2" column="4">
<property name="name">
<cstring>pbnSelectInputFile</cstring>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QPushButton" row="4" column="4">
<property name="name">
<cstring>pbnSelectOutputFile</cstring>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QSpinBox" row="5" column="3" rowspan="1" colspan="2">
<property name="name">
<cstring>spinMinDistanceGap</cstring>
</property>
<property name="maxValue">
<number>999999999</number>
</property>
<property name="lineStep">
<number>10</number>
</property>
<property name="value">
<number>60</number>
</property>
</widget>
<widget class="QLabel" row="1" column="0" rowspan="1" colspan="5">
<property name="name">
<cstring>lblInputFile</cstring>
</property>
<property name="text">
<string>Input File:</string>
</property>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tab</cstring>
@ -425,9 +306,9 @@ tracks, so some feature types may be disabled for some file formats.&lt;/p&gt;
<string>&lt;html&gt;&lt;head&gt;&lt;meta name="qrichtext" content="1" /&gt;&lt;/head&gt;&lt;body style="font-size:12pt;font-family:Arial"&gt;
&lt;p style="margin-top:16px"&gt;&lt;span style="font-size:17pt;font-weight:600"&gt;Description&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This tool will help you download data from a GPS device. Choose your
protocol, the device your GPS is connected to, the feature type you want
to download, a name for your new layer, and the GPX file where
you want to store the data.&lt;/p&gt;
GPS device, the port it is connected to, the feature type you want to download, a name for your new layer,
and the GPX file where you want to store the data. If your device isn't listed, or if
you want to change some settings, you can also edit the devices.&lt;/p&gt;
&lt;p&gt;This tool uses the program GPSBabel
(&lt;a href="http://gpsbabel.sf.net"&gt;http://gpsbabel.sf.net&lt;/a&gt;) to transfer the data. If you
don't have GPSBabel installed where QGIS can find it, this tool will not work.&lt;/p&gt;
@ -441,22 +322,6 @@ don't have GPSBabel installed where QGIS can find it, this tool will not work.&l
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Protocol:</string>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>Device file:</string>
</property>
</widget>
<widget class="QPushButton" row="3" column="4">
<property name="name">
<cstring>pbDLOutput</cstring>
@ -465,6 +330,66 @@ don't have GPSBabel installed where QGIS can find it, this tool will not work.&l
<string>...</string>
</property>
</widget>
<widget class="QPushButton" row="2" column="1">
<property name="name">
<cstring>pbDLEditDevices</cstring>
</property>
<property name="text">
<string>Edit devices</string>
</property>
</widget>
<widget class="QComboBox" row="1" column="1">
<property name="name">
<cstring>cmbDLDevice</cstring>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>GPS device:</string>
</property>
</widget>
<spacer row="2" column="2">
<property name="name">
<cstring>spacer6</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
</spacer>
<spacer row="1" column="2">
<property name="name">
<cstring>spacer5_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QLineEdit" row="3" column="1" rowspan="1" colspan="3">
<property name="name">
<cstring>leDLOutput</cstring>
</property>
</widget>
<widget class="QLabel" row="3" column="0">
<property name="name">
<cstring>textLabel2</cstring>
@ -473,12 +398,36 @@ don't have GPSBabel installed where QGIS can find it, this tool will not work.&l
<string>Output file:</string>
</property>
</widget>
<widget class="QLineEdit" row="3" column="1" rowspan="1" colspan="3">
<widget class="QLabel" row="4" column="0">
<property name="name">
<cstring>leDLOutput</cstring>
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Layer name:</string>
</property>
</widget>
<widget class="QComboBox" row="1" column="3" rowspan="1" colspan="2">
<widget class="QLineEdit" row="4" column="1" rowspan="1" colspan="3">
<property name="name">
<cstring>leDLBasename</cstring>
</property>
</widget>
<widget class="QLabel" row="2" column="3">
<property name="name">
<cstring>textLabel1_3</cstring>
</property>
<property name="text">
<string>Feature type:</string>
</property>
</widget>
<widget class="QLabel" row="1" column="3">
<property name="name">
<cstring>textLabel2_5</cstring>
</property>
<property name="text">
<string>Port:</string>
</property>
</widget>
<widget class="QComboBox" row="2" column="4">
<item>
<property name="text">
<string>Waypoints</string>
@ -498,51 +447,9 @@ don't have GPSBabel installed where QGIS can find it, this tool will not work.&l
<cstring>cmbDLFeatureType</cstring>
</property>
</widget>
<widget class="QLineEdit" row="2" column="3" rowspan="1" colspan="2">
<widget class="QComboBox" row="1" column="4">
<property name="name">
<cstring>leDLBasename</cstring>
</property>
</widget>
<widget class="QLabel" row="2" column="2">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Layer name:</string>
</property>
</widget>
<widget class="QLabel" row="1" column="2">
<property name="name">
<cstring>textLabel1_3</cstring>
</property>
<property name="text">
<string>Feature type:</string>
</property>
</widget>
<widget class="QComboBox" row="1" column="1">
<item>
<property name="text">
<string>Garmin</string>
</property>
</item>
<item>
<property name="text">
<string>Magellan</string>
</property>
</item>
<property name="name">
<cstring>cmbDLProtocol</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
</widget>
<widget class="QComboBox" row="2" column="1">
<property name="name">
<cstring>cmbDLDevice</cstring>
</property>
<property name="editable">
<bool>true</bool>
<cstring>cmbDLPort</cstring>
</property>
</widget>
</grid>
@ -558,23 +465,7 @@ don't have GPSBabel installed where QGIS can find it, this tool will not work.&l
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel" row="3" column="0">
<property name="name">
<cstring>textLabel3_2</cstring>
</property>
<property name="text">
<string>Device file:</string>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>textLabel1_4</cstring>
</property>
<property name="text">
<string>Protocol:</string>
</property>
</widget>
<widget class="QTextEdit" row="0" column="0" rowspan="1" colspan="3">
<widget class="QTextEdit" row="0" column="0" rowspan="1" colspan="5">
<property name="name">
<cstring>teDLInstructions_2</cstring>
</property>
@ -582,10 +473,12 @@ don't have GPSBabel installed where QGIS can find it, this tool will not work.&l
<string>&lt;html&gt;&lt;head&gt;&lt;meta name="qrichtext" content="1" /&gt;&lt;/head&gt;&lt;body style="font-size:12pt;font-family:Arial"&gt;
&lt;p style="margin-top:16px"&gt;&lt;span style="font-size:17pt;font-weight:600"&gt;Description&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This tool will help you upload data from a GPX layer to a GPS device.
Choose the layer you want to upload, your protocol, and the device your
GPS is connected to.&lt;/p&gt;
&lt;p&gt;This tool uses the program &lt;a href="http://gpsbabel.sf.net"&gt;GPSBabel&lt;/a&gt; to transfer the data. If you don't
have GPSBabel installed where QGIS can find it, this tool will not work.&lt;/p&gt;
Choose the layer you want to upload, the device you want to upload it to, and the port
your device is connected to.
If your device isn't listed, or if you want to change some settings, you can also
edit the devices.&lt;/p&gt;
&lt;p&gt;This tool uses the program GPSBabel (&lt;a href="http://gpsbabel.sf.net"&gt;http://gpsbabel.sf.net&lt;/a&gt;)
to transfer the data. If you don't have GPSBabel installed where QGIS can find it, this tool will not work.&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;
</string>
</property>
@ -604,52 +497,60 @@ have GPSBabel installed where QGIS can find it, this tool will not work.&lt;/p&g
<string>Data layer:</string>
</property>
</widget>
<widget class="QComboBox" row="2" column="1">
<item>
<property name="text">
<string>Garmin</string>
</property>
</item>
<item>
<property name="text">
<string>Magellan</string>
</property>
</item>
<widget class="QLabel" row="1" column="3">
<property name="name">
<cstring>cmbULProtocol</cstring>
<cstring>textLabel2_4</cstring>
</property>
<property name="enabled">
<bool>true</bool>
<property name="text">
<string>GPS device:</string>
</property>
</widget>
<widget class="QComboBox" row="3" column="1">
<widget class="QPushButton" row="2" column="4">
<property name="name">
<cstring>cmbULDevice</cstring>
<cstring>pbULEditDevices</cstring>
</property>
<property name="editable">
<bool>true</bool>
<property name="text">
<string>Edit devices</string>
</property>
</widget>
<spacer row="1" column="2" rowspan="3" colspan="1">
<widget class="QComboBox" row="1" column="1">
<property name="name">
<cstring>spacer2</cstring>
<cstring>cmbULLayer</cstring>
</property>
</widget>
<spacer row="1" column="2">
<property name="name">
<cstring>spacer11</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>90</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QComboBox" row="1" column="1">
<widget class="QComboBox" row="1" column="4">
<property name="name">
<cstring>cmbULLayer</cstring>
<cstring>cmbULDevice</cstring>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>Port:</string>
</property>
</widget>
<widget class="QComboBox" row="2" column="1">
<property name="name">
<cstring>cmbULPort</cstring>
</property>
</widget>
</grid>
@ -724,78 +625,18 @@ have GPSBabel installed where QGIS can find it, this tool will not work.&lt;/p&g
<receiver>PluginGuiBase</receiver>
<slot>pbnOK_clicked()</slot>
</connection>
<connection>
<sender>pbnSelectInputFile</sender>
<signal>clicked()</signal>
<receiver>PluginGuiBase</receiver>
<slot>pbnSelectInputFile_clicked()</slot>
</connection>
<connection>
<sender>pbnSelectOutputFile</sender>
<signal>clicked()</signal>
<receiver>PluginGuiBase</receiver>
<slot>pbnSelectOutputFile_clicked()</slot>
</connection>
<connection>
<sender>pbnCancel</sender>
<signal>clicked()</signal>
<receiver>PluginGuiBase</receiver>
<slot>pbnCancel_clicked()</slot>
</connection>
<connection>
<sender>leInputFile</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>leInputFile_textChanged(const QString&amp;)</slot>
</connection>
<connection>
<sender>leOutputShapeFile</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>leOutputShapeFile_textChanged(const QString&amp;)</slot>
</connection>
<connection>
<sender>leGPXFile</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>leGPXFile_textChanged(const QString&amp;)</slot>
</connection>
<connection>
<sender>pbnGPXSelectFile</sender>
<signal>clicked()</signal>
<receiver>PluginGuiBase</receiver>
<slot>pbnGPXSelectFile_clicked()</slot>
</connection>
<connection>
<sender>leGPXFile</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
</connection>
<connection>
<sender>leInputFile</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
</connection>
<connection>
<sender>leOutputShapeFile</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
</connection>
<connection>
<sender>tabWidget</sender>
<signal>currentChanged(QWidget*)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
</connection>
<connection>
<sender>cmbDLDevice</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
</connection>
<connection>
<sender>leDLBasename</sender>
<signal>textChanged(const QString&amp;)</signal>
@ -815,23 +656,11 @@ have GPSBabel installed where QGIS can find it, this tool will not work.&lt;/p&g
<slot>pbnDLOutput_clicked()</slot>
</connection>
<connection>
<sender>leIMPInput</sender>
<sender>leIMPLayer</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
</connection>
<connection>
<sender>leIMPOutput</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
</connection>
<connection>
<sender>pbIMPInput</sender>
<signal>clicked()</signal>
<receiver>PluginGuiBase</receiver>
<slot>pbnIMPInput_clicked()</slot>
</connection>
<connection>
<sender>pbIMPOutput</sender>
<signal>clicked()</signal>
@ -839,7 +668,13 @@ have GPSBabel installed where QGIS can find it, this tool will not work.&lt;/p&g
<slot>pbnIMPOutput_clicked()</slot>
</connection>
<connection>
<sender>leIMPInput</sender>
<sender>pbIMPInput</sender>
<signal>clicked()</signal>
<receiver>PluginGuiBase</receiver>
<slot>pbnIMPInput_clicked()</slot>
</connection>
<connection>
<sender>leIMPOutput</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
@ -851,7 +686,31 @@ have GPSBabel installed where QGIS can find it, this tool will not work.&lt;/p&g
<slot>enableRelevantControls()</slot>
</connection>
<connection>
<sender>leIMPLayer</sender>
<sender>leIMPInput</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
</connection>
<connection>
<sender>leIMPInput</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
</connection>
<connection>
<sender>pbnGPXSelectFile</sender>
<signal>clicked()</signal>
<receiver>PluginGuiBase</receiver>
<slot>pbnGPXSelectFile_clicked()</slot>
</connection>
<connection>
<sender>leGPXFile</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>leGPXFile_textChanged(const QString&amp;)</slot>
</connection>
<connection>
<sender>leGPXFile</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>PluginGuiBase</receiver>
<slot>enableRelevantControls()</slot>
@ -859,11 +718,7 @@ have GPSBabel installed where QGIS can find it, this tool will not work.&lt;/p&g
</connections>
<slots>
<slot>pbnOK_clicked()</slot>
<slot>pbnSelectInputFile_clicked()</slot>
<slot>pbnSelectOutputFile_clicked()</slot>
<slot>pbnCancel_clicked()</slot>
<slot>leInputFile_textChanged( const QString &amp; theQString )</slot>
<slot>leOutputShapeFile_textChanged( const QString &amp; theQString )</slot>
<slot>leGPXFile_textChanged( const QString &amp; theQString )</slot>
<slot>pbnGPXSelectFile_clicked()</slot>
<slot>cbGPXWaypoints_toggled( bool )</slot>

View File

@ -15,16 +15,6 @@ void PluginGuiBase::pbnOK_clicked()
}
void PluginGuiBase::pbnSelectInputFile_clicked()
{
}
void PluginGuiBase::pbnSelectOutputFile_clicked()
{
}
void PluginGuiBase::pbnCancel_clicked()
@ -33,30 +23,6 @@ void PluginGuiBase::pbnCancel_clicked()
}
void PluginGuiBase::leInputFile_textChanged( const QString & theQString)
{
if (theQString != "")
{
pbnOK->setEnabled(true);
}
else
{
pbnOK->setEnabled(false);
}
}
void PluginGuiBase::leOutputShapeFile_textChanged( const QString & theQString )
{
if (theQString != "")
{
pbnOK->setEnabled(true);
}
else
{
pbnOK->setEnabled(false);
}
}
void PluginGuiBase::leGPXFile_textChanged( const QString & theQString )