Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Some usability, i18n and debug changes on GPS importer (and gpxprovid…
…er). Handles #804.

git-svn-id: http://svn.osgeo.org/qgis/trunk@7779 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Dec 13, 2007
1 parent b4f3ff3 commit 70a241b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
12 changes: 11 additions & 1 deletion src/plugins/gps_importer/qgsgpsplugin.cpp
Expand Up @@ -246,6 +246,9 @@ void QgsGPSPlugin::importGPSFile(QString inputFilename, QgsBabelFormat* importer
QStringList babelArgs =
importer->importCommand(mBabelPath, typeArg,
inputFilename, outputFilename);

QgsDebugMsg(QString("Import command: ") + babelArgs.join("|"));

Q3Process babelProcess(babelArgs);
if (!babelProcess.start()) {
QMessageBox::warning(NULL, tr("Could not start process"),
Expand Down Expand Up @@ -314,7 +317,7 @@ void QgsGPSPlugin::convertGPSFile(QString inputFilename,
QStringList babelArgs;
babelArgs << mBabelPath << "-i"<<"gpx"<<"-f"<< inputFilename
<< convertStrings <<"-o"<<"gpx"<<"-F"<< outputFilename;
QgsDebugMsg(QString("Conversion command: ") + babelArgs.join("_"));
QgsDebugMsg(QString("Conversion command: ") + babelArgs.join("|"));

Q3Process babelProcess(babelArgs);
if (!babelProcess.start()) {
Expand Down Expand Up @@ -394,6 +397,10 @@ void QgsGPSPlugin::downloadFromGPS(QString device, QString port,
tr("of ")) + features + ".");
return;
}


QgsDebugMsg(QString("Download command: ") + babelArgs.join("|"));

Q3Process babelProcess(babelArgs);
if (!babelProcess.start()) {
QMessageBox::warning(NULL, tr("Could not start process"),
Expand Down Expand Up @@ -476,6 +483,9 @@ void QgsGPSPlugin::uploadToGPS(QgsVectorLayer* gpxLayer, QString device,
features + ".");
return;
}

QgsDebugMsg(QString("Upload command: ") + babelArgs.join("|"));

Q3Process babelProcess(babelArgs);
if (!babelProcess.start()) {
QMessageBox::warning(NULL, tr("Could not start process"),
Expand Down
17 changes: 10 additions & 7 deletions src/plugins/gps_importer/qgsgpsplugingui.cpp
Expand Up @@ -91,11 +91,11 @@ void QgsGPSPluginGui::on_buttonBox_accepted()

// or import other file?
case 1: {
const QString& typeString(cmbDLFeatureType->currentText());
const QString& typeString(cmbIMPFeature->currentText());
emit importGPSFile(leIMPInput->text(),
mImporters.find(mImpFormat)->second,
typeString == "Waypoints", typeString == "Routes",
typeString == "Tracks", leIMPOutput->text(),
typeString == tr("Waypoints"), typeString == tr("Routes"),
typeString == tr("Tracks"), leIMPOutput->text(),
leIMPLayer->text());
break;
}
Expand Down Expand Up @@ -123,7 +123,9 @@ void QgsGPSPluginGui::on_buttonBox_accepted()
break;
}
}
accept();
// The slots that are called above will emit closeGui() when successfull.
// If not succesfull, the user will get another shot without starting from scratch
// accept();
}


Expand Down Expand Up @@ -253,11 +255,11 @@ void QgsGPSPluginGui::on_pbnIMPInput_clicked() {
leIMPInput->setText(myFileName);
cmbIMPFeature->clear();
if (iter->second->supportsWaypoints())
cmbIMPFeature->insertItem("Waypoints");
cmbIMPFeature->insertItem(tr("Waypoints"));
if (iter->second->supportsRoutes())
cmbIMPFeature->insertItem("Routes");
cmbIMPFeature->insertItem(tr("Routes"));
if (iter->second->supportsTracks())
cmbIMPFeature->insertItem("Tracks");
cmbIMPFeature->insertItem(tr("Tracks"));
}
}
}
Expand Down Expand Up @@ -385,6 +387,7 @@ void QgsGPSPluginGui::populateIMPBabelFormats() {
BabelMap::const_iterator iter;
for (iter = mImporters.begin(); iter != mImporters.end(); ++iter)
mBabelFilter.append((const char*)iter->first).append(" (*.*);;");
mBabelFilter.chop(2); // Remove the trailing ;;, which otherwise leads to an empty filetype
int u = -1, d = -1;
std::map<QString, QgsGPSDevice*>::const_iterator iter2;
for (iter2 = mDevices.begin(); iter2 != mDevices.end(); ++iter2) {
Expand Down
9 changes: 8 additions & 1 deletion src/plugins/gps_importer/qgsgpspluginguibase.ui
Expand Up @@ -233,7 +233,7 @@ p, li { white-space: pre-wrap; }
<widget class="QComboBox" name="cmbIMPFeature" >
<property name="minimumSize" >
<size>
<width>90</width>
<width>130</width>
<height>0</height>
</size>
</property>
Expand All @@ -246,6 +246,13 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QLabel" name="textLabel2_6" >
<property name="text" >
<string>(Note: Selecting correct file type in browser dialog important!)</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QLineEdit" name="leIMPInput" >
<property name="enabled" >
Expand Down
1 change: 0 additions & 1 deletion src/providers/gpx/qgsgpxprovider.cpp
Expand Up @@ -125,7 +125,6 @@ bool QgsGPXProvider::getNextFeature(QgsFeature& feature)

QgsAttributeList::const_iterator iter;

QgsDebugMsg("*** GPX ***");
if (mFeatureType == WaypointType)
{
// go through the list of waypoints and return the first one that is in
Expand Down

0 comments on commit 70a241b

Please sign in to comment.