Skip to content

Commit

Permalink
Add option to set the path to GPSBabel in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 2, 2021
1 parent 5ecd73d commit 827bef8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/options/qgsgpsdeviceoptions.cpp
Expand Up @@ -18,6 +18,7 @@
#include "qgssettings.h"
#include "qgsapplication.h"
#include "qgsbabelformatregistry.h"
#include "qgssettingsregistrycore.h"

#include <QMessageBox>

Expand Down Expand Up @@ -83,6 +84,10 @@ QgsGpsDeviceOptionsWidget::QgsGpsDeviceOptionsWidget( QWidget *parent )
connect( leTrkDown, &QLineEdit::textEdited, this, &QgsGpsDeviceOptionsWidget::updateCurrentDevice );
connect( leTrkUp, &QLineEdit::textEdited, this, &QgsGpsDeviceOptionsWidget::updateCurrentDevice );
connect( leDeviceName, &QLineEdit::textEdited, this, &QgsGpsDeviceOptionsWidget::renameCurrentDevice );

mGpsBabelFileWidget->setStorageMode( QgsFileWidget::GetFile );
mGpsBabelFileWidget->setDialogTitle( tr( "Select GPSBabel Executable" ) );
mGpsBabelFileWidget->setFilePath( QgsSettingsRegistryCore::settingsGpsBabelPath.value() );
}

void QgsGpsDeviceOptionsWidget::apply()
Expand All @@ -106,6 +111,8 @@ void QgsGpsDeviceOptionsWidget::apply()
}
settings.setValue( QStringLiteral( "/Plugin-GPS/devicelist" ), deviceNames );

QgsSettingsRegistryCore::settingsGpsBabelPath.setValue( mGpsBabelFileWidget->filePath() );

QgsApplication::gpsBabelFormatRegistry()->reloadFromSettings();
}

Expand Down
32 changes: 32 additions & 0 deletions src/ui/qgsgpsdevicedialogbase.ui
Expand Up @@ -32,6 +32,29 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>GPSBabel Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,1">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Path to GPSBabel</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QgsFileWidget" name="mGpsBabelFileWidget" native="true">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
Expand Down Expand Up @@ -299,7 +322,16 @@
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QgsFileWidget</class>
<extends>QWidget</extends>
<header>qgsfilewidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mGpsBabelFileWidget</tabstop>
<tabstop>mListDevices</tabstop>
<tabstop>mButtonAddDevice</tabstop>
<tabstop>mButtonRemoveDevice</tabstop>
Expand Down

0 comments on commit 827bef8

Please sign in to comment.