Skip to content

Commit 85a64b8

Browse files
author
homann
committed
Some usability, i18n and debug changes on GPS importer (and gpxprovider). Handles #804.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7779 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c81a8b5 commit 85a64b8

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

src/plugins/gps_importer/qgsgpsplugin.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ void QgsGPSPlugin::importGPSFile(QString inputFilename, QgsBabelFormat* importer
246246
QStringList babelArgs =
247247
importer->importCommand(mBabelPath, typeArg,
248248
inputFilename, outputFilename);
249+
250+
QgsDebugMsg(QString("Import command: ") + babelArgs.join("|"));
251+
249252
Q3Process babelProcess(babelArgs);
250253
if (!babelProcess.start()) {
251254
QMessageBox::warning(NULL, tr("Could not start process"),
@@ -314,7 +317,7 @@ void QgsGPSPlugin::convertGPSFile(QString inputFilename,
314317
QStringList babelArgs;
315318
babelArgs << mBabelPath << "-i"<<"gpx"<<"-f"<< inputFilename
316319
<< convertStrings <<"-o"<<"gpx"<<"-F"<< outputFilename;
317-
QgsDebugMsg(QString("Conversion command: ") + babelArgs.join("_"));
320+
QgsDebugMsg(QString("Conversion command: ") + babelArgs.join("|"));
318321

319322
Q3Process babelProcess(babelArgs);
320323
if (!babelProcess.start()) {
@@ -394,6 +397,10 @@ void QgsGPSPlugin::downloadFromGPS(QString device, QString port,
394397
tr("of ")) + features + ".");
395398
return;
396399
}
400+
401+
402+
QgsDebugMsg(QString("Download command: ") + babelArgs.join("|"));
403+
397404
Q3Process babelProcess(babelArgs);
398405
if (!babelProcess.start()) {
399406
QMessageBox::warning(NULL, tr("Could not start process"),
@@ -476,6 +483,9 @@ void QgsGPSPlugin::uploadToGPS(QgsVectorLayer* gpxLayer, QString device,
476483
features + ".");
477484
return;
478485
}
486+
487+
QgsDebugMsg(QString("Upload command: ") + babelArgs.join("|"));
488+
479489
Q3Process babelProcess(babelArgs);
480490
if (!babelProcess.start()) {
481491
QMessageBox::warning(NULL, tr("Could not start process"),

src/plugins/gps_importer/qgsgpsplugingui.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ void QgsGPSPluginGui::on_buttonBox_accepted()
9191

9292
// or import other file?
9393
case 1: {
94-
const QString& typeString(cmbDLFeatureType->currentText());
94+
const QString& typeString(cmbIMPFeature->currentText());
9595
emit importGPSFile(leIMPInput->text(),
9696
mImporters.find(mImpFormat)->second,
97-
typeString == "Waypoints", typeString == "Routes",
98-
typeString == "Tracks", leIMPOutput->text(),
97+
typeString == tr("Waypoints"), typeString == tr("Routes"),
98+
typeString == tr("Tracks"), leIMPOutput->text(),
9999
leIMPLayer->text());
100100
break;
101101
}
@@ -123,7 +123,9 @@ void QgsGPSPluginGui::on_buttonBox_accepted()
123123
break;
124124
}
125125
}
126-
accept();
126+
// The slots that are called above will emit closeGui() when successfull.
127+
// If not succesfull, the user will get another shot without starting from scratch
128+
// accept();
127129
}
128130

129131

@@ -253,11 +255,11 @@ void QgsGPSPluginGui::on_pbnIMPInput_clicked() {
253255
leIMPInput->setText(myFileName);
254256
cmbIMPFeature->clear();
255257
if (iter->second->supportsWaypoints())
256-
cmbIMPFeature->insertItem("Waypoints");
258+
cmbIMPFeature->insertItem(tr("Waypoints"));
257259
if (iter->second->supportsRoutes())
258-
cmbIMPFeature->insertItem("Routes");
260+
cmbIMPFeature->insertItem(tr("Routes"));
259261
if (iter->second->supportsTracks())
260-
cmbIMPFeature->insertItem("Tracks");
262+
cmbIMPFeature->insertItem(tr("Tracks"));
261263
}
262264
}
263265
}
@@ -385,6 +387,7 @@ void QgsGPSPluginGui::populateIMPBabelFormats() {
385387
BabelMap::const_iterator iter;
386388
for (iter = mImporters.begin(); iter != mImporters.end(); ++iter)
387389
mBabelFilter.append((const char*)iter->first).append(" (*.*);;");
390+
mBabelFilter.chop(2); // Remove the trailing ;;, which otherwise leads to an empty filetype
388391
int u = -1, d = -1;
389392
std::map<QString, QgsGPSDevice*>::const_iterator iter2;
390393
for (iter2 = mDevices.begin(); iter2 != mDevices.end(); ++iter2) {

src/plugins/gps_importer/qgsgpspluginguibase.ui

+8-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ p, li { white-space: pre-wrap; }
233233
<widget class="QComboBox" name="cmbIMPFeature" >
234234
<property name="minimumSize" >
235235
<size>
236-
<width>90</width>
236+
<width>130</width>
237237
<height>0</height>
238238
</size>
239239
</property>
@@ -246,6 +246,13 @@ p, li { white-space: pre-wrap; }
246246
</property>
247247
</widget>
248248
</item>
249+
<item row="2" column="2" >
250+
<widget class="QLabel" name="textLabel2_6" >
251+
<property name="text" >
252+
<string>(Note: Selecting correct file type in browser dialog important!)</string>
253+
</property>
254+
</widget>
255+
</item>
249256
<item row="1" column="1" colspan="2" >
250257
<widget class="QLineEdit" name="leIMPInput" >
251258
<property name="enabled" >

src/providers/gpx/qgsgpxprovider.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ bool QgsGPXProvider::getNextFeature(QgsFeature& feature)
125125

126126
QgsAttributeList::const_iterator iter;
127127

128-
QgsDebugMsg("*** GPX ***");
129128
if (mFeatureType == WaypointType)
130129
{
131130
// go through the list of waypoints and return the first one that is in

0 commit comments

Comments
 (0)