@@ -92,25 +92,20 @@ QgsGpsDeviceOptionsWidget::QgsGpsDeviceOptionsWidget( QWidget *parent )
92
92
93
93
void QgsGpsDeviceOptionsWidget::apply ()
94
94
{
95
- QStringList deviceNames;
96
- QgsSettings settings;
97
- const QString devPath = QStringLiteral ( " babelDevices/%1" );
98
- settings.remove ( QStringLiteral ( " babelDevices" ), QgsSettings::Gps );
95
+ QgsBabelFormatRegistry::sTreeBabelDevices ->deleteAllItems ();
99
96
100
97
for ( auto iter = mDevices .constBegin (); iter != mDevices .constEnd (); ++iter )
101
98
{
102
99
const QString name = iter.key ();
103
- deviceNames << name;
104
100
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 );
113
101
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
+ }
114
109
QgsSettingsRegistryCore::settingsGpsBabelPath->setValue ( mGpsBabelFileWidget ->filePath () );
115
110
116
111
QgsApplication::gpsBabelFormatRegistry ()->reloadFromSettings ();
0 commit comments