@@ -138,7 +138,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
138
138
mRemoveCustomVarBtn ->setEnabled ( false );
139
139
mCustomVariablesTable ->setEnabled ( false );
140
140
}
141
- QStringList customVarsList = mSettings ->value ( QStringLiteral ( " qgis/customEnvVars" ), " " ).toStringList ();
141
+ QStringList customVarsList = mSettings ->value ( QStringLiteral ( " qgis/customEnvVars" ) ).toStringList ();
142
142
Q_FOREACH ( const QString &varStr, customVarsList )
143
143
{
144
144
int pos = varStr.indexOf ( QLatin1Char ( ' |' ) );
@@ -221,25 +221,20 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
221
221
mCurrentVariablesTable ->resizeColumnToContents ( 0 );
222
222
223
223
// local directories to search when loading c++ plugins
224
- QString myPaths = mSettings ->value ( QStringLiteral ( " plugins/searchPathsForPlugins" ), " " ). toString ();
225
- if ( !myPaths. isEmpty () )
224
+ QStringList pathList = mSettings ->value ( QStringLiteral ( " plugins/searchPathsForPlugins" ) ). toStringList ();
225
+ Q_FOREACH ( const QString& path, pathList )
226
226
{
227
- QStringList myPathList = myPaths.split ( ' |' );
228
- QStringList::const_iterator pathIt = myPathList.constBegin ();
229
- for ( ; pathIt != myPathList.constEnd (); ++pathIt )
230
- {
231
- QListWidgetItem* newItem = new QListWidgetItem ( mListPluginPaths );
232
- newItem->setText ( *pathIt );
233
- newItem->setFlags ( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
234
- mListPluginPaths ->addItem ( newItem );
235
- }
227
+ QListWidgetItem* newItem = new QListWidgetItem ( mListPluginPaths );
228
+ newItem->setText ( path );
229
+ newItem->setFlags ( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
230
+ mListPluginPaths ->addItem ( newItem );
236
231
}
237
232
238
233
// local directories to search when looking for an SVG with a given basename
239
- QStringList svgPaths = QgsApplication::svgPaths ();
240
- if ( !svgPaths .isEmpty () )
234
+ pathList = QgsApplication::svgPaths ();
235
+ if ( !pathList .isEmpty () )
241
236
{
242
- Q_FOREACH ( const QString& path, svgPaths )
237
+ Q_FOREACH ( const QString& path, pathList )
243
238
{
244
239
QListWidgetItem* newItem = new QListWidgetItem ( mListSVGPaths );
245
240
newItem->setText ( path );
@@ -248,10 +243,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
248
243
}
249
244
}
250
245
251
- QStringList templatePaths = QgsApplication::composerTemplatePaths ();
252
- if ( !templatePaths.isEmpty () )
246
+ // local directories to search when looking for a composer templates
247
+ pathList = QgsApplication::composerTemplatePaths ();
248
+ if ( !pathList.isEmpty () )
253
249
{
254
- Q_FOREACH ( const QString& path, templatePaths )
250
+ Q_FOREACH ( const QString& path, pathList )
255
251
{
256
252
QListWidgetItem* newItem = new QListWidgetItem ( mListComposerTemplatePaths );
257
253
newItem->setText ( path );
@@ -260,13 +256,12 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
260
256
}
261
257
}
262
258
263
- QStringList hiddenItems = mSettings ->value ( QStringLiteral ( " /browser/hiddenPaths" ),
264
- QStringList () ).toStringList ();
265
- QStringList::const_iterator pathIt = hiddenItems.constBegin ();
266
- for ( ; pathIt != hiddenItems.constEnd (); ++pathIt )
259
+ // paths hidden from browser
260
+ pathList = mSettings ->value ( QStringLiteral ( " /browser/hiddenPaths" ) ).toStringList ();
261
+ Q_FOREACH ( const QString& path, pathList )
267
262
{
268
263
QListWidgetItem* newItem = new QListWidgetItem ( mListHiddenBrowserPaths );
269
- newItem->setText ( *pathIt );
264
+ newItem->setText ( path );
270
265
mListHiddenBrowserPaths ->addItem ( newItem );
271
266
}
272
267
@@ -300,18 +295,13 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
300
295
mProxyTypeComboBox ->setCurrentIndex ( mProxyTypeComboBox ->findText ( settingProxyType ) );
301
296
302
297
// URLs excluded not going through proxies
303
- QString proxyExcludedURLs = mSettings ->value ( QStringLiteral ( " proxy/proxyExcludedUrls" ), " " ). toString ();
304
- if ( !proxyExcludedURLs. isEmpty () )
298
+ pathList = mSettings ->value ( QStringLiteral ( " proxy/proxyExcludedUrls" ) ). toStringList ();
299
+ Q_FOREACH ( const QString& path, pathList )
305
300
{
306
- QStringList splitUrls = proxyExcludedURLs.split ( ' |' );
307
- QStringList::const_iterator urlIt = splitUrls.constBegin ();
308
- for ( ; urlIt != splitUrls.constEnd (); ++urlIt )
309
- {
310
- QListWidgetItem* newItem = new QListWidgetItem ( mExcludeUrlListWidget );
311
- newItem->setText ( *urlIt );
312
- newItem->setFlags ( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
313
- mExcludeUrlListWidget ->addItem ( newItem );
314
- }
301
+ QListWidgetItem* newItem = new QListWidgetItem ( mExcludeUrlListWidget );
302
+ newItem->setText ( path );
303
+ newItem->setFlags ( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
304
+ mExcludeUrlListWidget ->addItem ( newItem );
315
305
}
316
306
317
307
// cache settings
@@ -731,7 +721,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
731
721
spinZoomFactor->setValue ( mSettings ->value ( QStringLiteral ( " /qgis/zoom_factor" ), 2 ).toDouble () );
732
722
733
723
// predefined scales for scale combobox
734
- myPaths = mSettings ->value ( QStringLiteral ( " Map/scales" ), PROJECT_SCALES ).toString ();
724
+ QString myPaths = mSettings ->value ( QStringLiteral ( " Map/scales" ), PROJECT_SCALES ).toString ();
735
725
if ( !myPaths.isEmpty () )
736
726
{
737
727
QStringList myScalesList = myPaths.split ( ' ,' );
@@ -933,8 +923,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
933
923
mVariableEditor ->reloadContext ();
934
924
mVariableEditor ->setEditableScopeIndex ( 0 );
935
925
936
-
937
-
938
926
mAdvancedSettingsEditor ->setSettingsObject ( mSettings );
939
927
940
928
// restore window and widget geometry/state
@@ -1077,46 +1065,34 @@ void QgsOptions::saveOptions()
1077
1065
mSettings ->setValue ( QStringLiteral ( " qgis/customEnvVars" ), QVariant ( customVars ) );
1078
1066
1079
1067
// search directories for user plugins
1080
- QString myPaths ;
1068
+ QStringList pathsList ;
1081
1069
for ( int i = 0 ; i < mListPluginPaths ->count (); ++i )
1082
1070
{
1083
- if ( i != 0 )
1084
- {
1085
- myPaths += ' |' ;
1086
- }
1087
- myPaths += mListPluginPaths ->item ( i )->text ();
1071
+ pathsList << mListPluginPaths ->item ( i )->text ();
1088
1072
}
1089
- mSettings ->setValue ( QStringLiteral ( " plugins/searchPathsForPlugins " ), myPaths );
1073
+ mSettings ->setValue ( QStringLiteral ( " help/helpSearchPath " ), pathsList );
1090
1074
1091
1075
// search directories for svgs
1092
- myPaths .clear ();
1076
+ pathsList .clear ();
1093
1077
for ( int i = 0 ; i < mListSVGPaths ->count (); ++i )
1094
1078
{
1095
- if ( i != 0 )
1096
- {
1097
- myPaths += ' |' ;
1098
- }
1099
- myPaths += mListSVGPaths ->item ( i )->text ();
1079
+ pathsList << mListSVGPaths ->item ( i )->text ();
1100
1080
}
1101
- mSettings ->setValue ( QStringLiteral ( " svg/searchPathsForSVG" ), myPaths );
1081
+ mSettings ->setValue ( QStringLiteral ( " svg/searchPathsForSVG" ), pathsList );
1102
1082
1103
- myPaths .clear ();
1083
+ pathsList .clear ();
1104
1084
for ( int i = 0 ; i < mListComposerTemplatePaths ->count (); ++i )
1105
1085
{
1106
- if ( i != 0 )
1107
- {
1108
- myPaths += ' |' ;
1109
- }
1110
- myPaths += mListComposerTemplatePaths ->item ( i )->text ();
1086
+ pathsList << mListComposerTemplatePaths ->item ( i )->text ();
1111
1087
}
1112
- mSettings ->setValue ( QStringLiteral ( " composer/searchPathsForTemplates" ), myPaths );
1088
+ mSettings ->setValue ( QStringLiteral ( " composer/searchPathsForTemplates" ), pathsList );
1113
1089
1114
- QStringList paths ;
1090
+ pathsList. clear () ;
1115
1091
for ( int i = 0 ; i < mListHiddenBrowserPaths ->count (); ++i )
1116
1092
{
1117
- paths << mListHiddenBrowserPaths ->item ( i )->text ();
1093
+ pathsList << mListHiddenBrowserPaths ->item ( i )->text ();
1118
1094
}
1119
- mSettings ->setValue ( QStringLiteral ( " /browser/hiddenPaths" ), paths );
1095
+ mSettings ->setValue ( QStringLiteral ( " /browser/hiddenPaths" ), pathsList );
1120
1096
1121
1097
// Network timeout
1122
1098
mSettings ->setValue ( QStringLiteral ( " /qgis/networkAndProxy/networkTimeout" ), mNetworkTimeoutSpinBox ->value () );
@@ -1398,7 +1374,7 @@ void QgsOptions::saveOptions()
1398
1374
mSettings ->setValue ( QStringLiteral ( " /qgis/digitizing/offset_miter_limit" ), mCurveOffsetMiterLimitComboBox ->value () );
1399
1375
1400
1376
// default scale list
1401
- myPaths. clear () ;
1377
+ QString myPaths;
1402
1378
for ( int i = 0 ; i < mListGlobalScales ->count (); ++i )
1403
1379
{
1404
1380
if ( i != 0 )
0 commit comments