Skip to content

Commit ef0fa3e

Browse files
3nidsnyalldawson
authored andcommittedMar 19, 2023
correctly save GPS devices
1 parent 4f67a0c commit ef0fa3e

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed
 

‎src/app/options/qgsgpsdeviceoptions.cpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,20 @@ QgsGpsDeviceOptionsWidget::QgsGpsDeviceOptionsWidget( QWidget *parent )
9292

9393
void QgsGpsDeviceOptionsWidget::apply()
9494
{
95-
QStringList deviceNames;
96-
QgsSettings settings;
97-
const QString devPath = QStringLiteral( "babelDevices/%1" );
98-
settings.remove( QStringLiteral( "babelDevices" ), QgsSettings::Gps );
95+
QgsBabelFormatRegistry::sTreeBabelDevices->deleteAllItems();
9996

10097
for ( auto iter = mDevices.constBegin(); iter != mDevices.constEnd(); ++iter )
10198
{
10299
const QString name = iter.key();
103-
deviceNames << name;
104100
const QStringList commands = iter.value();
105-
settings.setValue( devPath.arg( name ) + "/wptdownload", commands.value( 0 ), QgsSettings::Gps );
106-
settings.setValue( devPath.arg( name ) + "/wptupload", commands.value( 1 ), QgsSettings::Gps );
107-
settings.setValue( devPath.arg( name ) + "/rtedownload", commands.value( 2 ), QgsSettings::Gps );
108-
settings.setValue( devPath.arg( name ) + "/rteupload", commands.value( 3 ), QgsSettings::Gps );
109-
settings.setValue( devPath.arg( name ) + "/trkdownload", commands.value( 4 ), QgsSettings::Gps );
110-
settings.setValue( devPath.arg( name ) + "/trkupload", commands.value( 5 ), QgsSettings::Gps );
111-
}
112-
settings.setValue( QStringLiteral( "babelDeviceList" ), deviceNames, QgsSettings::Gps );
113101

102+
QgsBabelFormatRegistry::settingsBabelWptDownload->setValue( commands.value( 0 ), name );
103+
QgsBabelFormatRegistry::settingsBabelWptUpload->setValue( commands.value( 1 ), name );
104+
QgsBabelFormatRegistry::settingsBabelRteDownload->setValue( commands.value( 2 ), name );
105+
QgsBabelFormatRegistry::settingsBabelRteUpload->setValue( commands.value( 3 ), name );
106+
QgsBabelFormatRegistry::settingsBabelTrkDownload->setValue( commands.value( 4 ), name );
107+
QgsBabelFormatRegistry::settingsBabelTrkUpload->setValue( commands.value( 5 ), name );
108+
}
114109
QgsSettingsRegistryCore::settingsGpsBabelPath->setValue( mGpsBabelFileWidget->filePath() );
115110

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

0 commit comments

Comments
 (0)
Please sign in to comment.