23 #include <QRegularExpression>
178 qDeleteAll( mImporters );
179 qDeleteAll( mDevices );
184 return mImporters.keys();
189 return mImporters.value( name );
194 for (
auto it = mImporters.constBegin(); it != mImporters.constEnd(); ++it )
196 if ( it.value()->description().compare( description, Qt::CaseInsensitive ) == 0 )
200 const QString descriptionSquareBrackets = it.value()->
description().replace(
'(',
'[' ).replace(
')',
']' );
201 if ( descriptionSquareBrackets.compare( description, Qt::CaseInsensitive ) == 0 )
210 QMap< QString, QString > descriptionToString;
211 for (
auto it = mImporters.constBegin(); it != mImporters.constEnd(); ++it )
213 const QStringList extensions = it.value()->extensions();
215 if ( !extensions.empty() )
218 for (
const QString &extension : extensions )
219 fileFilter.append( QStringLiteral(
"*.%1" ).arg( extension ) );
220 fileFilter.append(
')' );
224 fileFilter = QStringLiteral(
"(*.*)" );
228 const QString description = it.value()->description().replace(
'(',
'[' ).replace(
')',
']' );
230 descriptionToString.insert( description.toLower(), QStringLiteral(
"%1 %2" ).arg( description, fileFilter ) );
234 for (
auto it = descriptionToString.constBegin(); it != descriptionToString.constEnd(); ++it )
237 return res.join( QLatin1String(
";;" ) );
242 return mDevices.keys();
247 return mDevices.value( name );
257 qDeleteAll( mDevices );
260 mDevices[QStringLiteral(
"Garmin serial" )] =
262 QStringLiteral(
"%babel -w -i gpx -o garmin %in %out" ),
263 QStringLiteral(
"%babel -r -i garmin -o gpx %in %out" ),
264 QStringLiteral(
"%babel -r -i gpx -o garmin %in %out" ),
265 QStringLiteral(
"%babel -t -i garmin -o gpx %in %out" ),
266 QStringLiteral(
"%babel -t -i gpx -o garmin %in %out" ) );
270 bool useOldPath =
false;
275 deviceNames = settings.
value( QStringLiteral(
"Plugin-GPS/devicelist" ) ).toStringList();
278 for (
const QString &device : std::as_const(
deviceNames ) )
283 baseKey = QStringLiteral(
"babelDevices/%1" ).arg( device );
286 baseKey = QStringLiteral(
"/Plugin-GPS/devices/%1" ).arg( device );
290 const QString wptDownload = settings.
value( QStringLiteral(
"%1/wptdownload" ).arg( baseKey ), QVariant(), section ).toString();
291 const QString wptUpload = settings.
value( QStringLiteral(
"%1/wptupload" ).arg( baseKey ), QVariant(), section ).toString();
292 const QString rteDownload = settings.
value( QStringLiteral(
"%1/rtedownload" ).arg( baseKey ), QVariant(), section ).toString();
293 const QString rteUpload = settings.
value( QStringLiteral(
"%1/rteupload" ).arg( baseKey ), QVariant(), section ).toString();
294 const QString trkDownload = settings.
value( QStringLiteral(
"%1/trkdownload" ).arg( baseKey ), QVariant(), section ).toString();
295 const QString trkUpload = settings.
value( QStringLiteral(
"%1/trkupload" ).arg( baseKey ), QVariant(), section ).toString();
298 delete mDevices.value( device );