Skip to content

Commit

Permalink
Merge pull request #5533 from DelazJ/pluginlist
Browse files Browse the repository at this point in the history
[bugfix]Remember the c++ plugins folders in Options dialog
  • Loading branch information
m-kuhn committed Nov 6, 2017
2 parents ee59abf + 67dc318 commit ae33b58
Showing 1 changed file with 30 additions and 35 deletions.
65 changes: 30 additions & 35 deletions src/app/qgsoptions.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mRemoveCustomVarBtn->setEnabled( false ); mRemoveCustomVarBtn->setEnabled( false );
mCustomVariablesTable->setEnabled( false ); mCustomVariablesTable->setEnabled( false );
} }
QStringList customVarsList = mSettings->value( QStringLiteral( "qgis/customEnvVars" ) ).toStringList(); const QStringList customVarsList = mSettings->value( QStringLiteral( "qgis/customEnvVars" ) ).toStringList();
Q_FOREACH ( const QString &varStr, customVarsList ) for ( const QString &varStr : customVarsList )
{ {
int pos = varStr.indexOf( QLatin1Char( '|' ) ); int pos = varStr.indexOf( QLatin1Char( '|' ) );
if ( pos == -1 ) if ( pos == -1 )
Expand Down Expand Up @@ -204,9 +204,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
// current environment variables // current environment variables
mCurrentVariablesTable->horizontalHeader()->setFixedHeight( fmCustomVarH ); mCurrentVariablesTable->horizontalHeader()->setFixedHeight( fmCustomVarH );
QMap<QString, QString> sysVarsMap = QgsApplication::systemEnvVars(); QMap<QString, QString> sysVarsMap = QgsApplication::systemEnvVars();
QStringList currentVarsList = QProcess::systemEnvironment(); const QStringList currentVarsList = QProcess::systemEnvironment();


Q_FOREACH ( const QString &varStr, currentVarsList ) for ( const QString &varStr : currentVarsList )
{ {
int pos = varStr.indexOf( QLatin1Char( '=' ) ); int pos = varStr.indexOf( QLatin1Char( '=' ) );
if ( pos == -1 ) if ( pos == -1 )
Expand Down Expand Up @@ -254,49 +254,44 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mCurrentVariablesTable->resizeColumnToContents( 0 ); mCurrentVariablesTable->resizeColumnToContents( 0 );


//local directories to search when loading c++ plugins //local directories to search when loading c++ plugins
QStringList pathList = mSettings->value( QStringLiteral( "plugins/searchPathsForPlugins" ) ).toStringList(); const QStringList pluginsPathList = mSettings->value( QStringLiteral( "plugins/searchPathsForPlugins" ) ).toStringList();
Q_FOREACH ( const QString &path, pathList ) for ( const QString &path : pluginsPathList )
{ {
QListWidgetItem *newItem = new QListWidgetItem( mListPluginPaths ); QListWidgetItem *newItem = new QListWidgetItem( mListPluginPaths );
newItem->setText( path ); newItem->setText( path );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mListPluginPaths->addItem( newItem ); mListPluginPaths->addItem( newItem );
} }
connect( mBtnAddPluginPath, &QAbstractButton::clicked, this, &QgsOptions::addPluginPath ); connect( mBtnAddPluginPath, &QAbstractButton::clicked, this, &QgsOptions::addPluginPath );
connect( mBtnRemovePluginPath, &QAbstractButton::clicked, this, &QgsOptions::removePluginPath );


//local directories to search when looking for an SVG with a given basename //local directories to search when looking for an SVG with a given basename
pathList = QgsApplication::svgPaths(); const QStringList svgPathList = QgsApplication::svgPaths();
if ( !pathList.isEmpty() ) for ( const QString &path : svgPathList )
{ {
Q_FOREACH ( const QString &path, pathList ) QListWidgetItem *newItem = new QListWidgetItem( mListSVGPaths );
{ newItem->setText( path );
QListWidgetItem *newItem = new QListWidgetItem( mListSVGPaths ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
newItem->setText( path ); mListSVGPaths->addItem( newItem );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mListSVGPaths->addItem( newItem );
}
} }
connect( mBtnAddSVGPath, &QAbstractButton::clicked, this, &QgsOptions::addSVGPath ); connect( mBtnAddSVGPath, &QAbstractButton::clicked, this, &QgsOptions::addSVGPath );
connect( mBtnRemoveSVGPath, &QAbstractButton::clicked, this, &QgsOptions::removeSVGPath ); connect( mBtnRemoveSVGPath, &QAbstractButton::clicked, this, &QgsOptions::removeSVGPath );


//local directories to search when looking for a composer templates //local directories to search when looking for a composer templates
pathList = QgsApplication::composerTemplatePaths(); const QStringList composerTemplatePathList = QgsApplication::composerTemplatePaths();
if ( !pathList.isEmpty() ) for ( const QString &path : composerTemplatePathList )
{ {
Q_FOREACH ( const QString &path, pathList ) QListWidgetItem *newItem = new QListWidgetItem( mListComposerTemplatePaths );
{ newItem->setText( path );
QListWidgetItem *newItem = new QListWidgetItem( mListComposerTemplatePaths ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
newItem->setText( path ); mListComposerTemplatePaths->addItem( newItem );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mListComposerTemplatePaths->addItem( newItem );
}
} }
connect( mBtnAddTemplatePath, &QAbstractButton::clicked, this, &QgsOptions::addTemplatePath ); connect( mBtnAddTemplatePath, &QAbstractButton::clicked, this, &QgsOptions::addTemplatePath );
connect( mBtnRemoveTemplatePath, &QAbstractButton::clicked, this, &QgsOptions::removeTemplatePath ); connect( mBtnRemoveTemplatePath, &QAbstractButton::clicked, this, &QgsOptions::removeTemplatePath );


//paths hidden from browser //paths hidden from browser
pathList = mSettings->value( QStringLiteral( "/browser/hiddenPaths" ) ).toStringList(); const QStringList hiddenPathList = mSettings->value( QStringLiteral( "/browser/hiddenPaths" ) ).toStringList();
Q_FOREACH ( const QString &path, pathList ) for ( const QString &path : hiddenPathList )
{ {
QListWidgetItem *newItem = new QListWidgetItem( mListHiddenBrowserPaths ); QListWidgetItem *newItem = new QListWidgetItem( mListHiddenBrowserPaths );
newItem->setText( path ); newItem->setText( path );
Expand All @@ -305,8 +300,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
connect( mBtnRemoveHiddenPath, &QAbstractButton::clicked, this, &QgsOptions::removeHiddenPath ); connect( mBtnRemoveHiddenPath, &QAbstractButton::clicked, this, &QgsOptions::removeHiddenPath );


//locations of the QGIS help //locations of the QGIS help
QStringList helpPathList = mSettings->value( QStringLiteral( "help/helpSearchPath" ), "http://docs.qgis.org/$qgis_short_version/$qgis_locale/docs/user_manual/" ).toStringList(); const QStringList helpPathList = mSettings->value( QStringLiteral( "help/helpSearchPath" ), "http://docs.qgis.org/$qgis_short_version/$qgis_locale/docs/user_manual/" ).toStringList();
Q_FOREACH ( const QString &path, helpPathList ) for ( const QString &path : helpPathList )
{ {
QTreeWidgetItem *item = new QTreeWidgetItem(); QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText( 0, path ); item->setText( 0, path );
Expand Down Expand Up @@ -355,8 +350,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mProxyTypeComboBox->setCurrentIndex( mProxyTypeComboBox->findText( settingProxyType ) ); mProxyTypeComboBox->setCurrentIndex( mProxyTypeComboBox->findText( settingProxyType ) );


//URLs excluded not going through proxies //URLs excluded not going through proxies
pathList = mSettings->value( QStringLiteral( "proxy/proxyExcludedUrls" ) ).toStringList(); const QStringList excludedUrlPathList = mSettings->value( QStringLiteral( "proxy/proxyExcludedUrls" ) ).toStringList();
Q_FOREACH ( const QString &path, pathList ) for ( const QString &path : excludedUrlPathList )
{ {
QListWidgetItem *newItem = new QListWidgetItem( mExcludeUrlListWidget ); QListWidgetItem *newItem = new QListWidgetItem( mExcludeUrlListWidget );
newItem->setText( path ); newItem->setText( path );
Expand Down Expand Up @@ -787,11 +782,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
setZoomFactorValue(); setZoomFactorValue();


// predefined scales for scale combobox // predefined scales for scale combobox
QString myPaths = mSettings->value( QStringLiteral( "Map/scales" ), PROJECT_SCALES ).toString(); QString scalePaths = mSettings->value( QStringLiteral( "Map/scales" ), PROJECT_SCALES ).toString();
if ( !myPaths.isEmpty() ) if ( !scalePaths.isEmpty() )
{ {
QStringList myScalesList = myPaths.split( ',' ); const QStringList ScalesList = scalePaths.split( ',' );
Q_FOREACH ( const QString &scale, myScalesList ) for ( const QString &scale : ScalesList )
{ {
addScaleToScaleList( scale ); addScaleToScaleList( scale );
} }
Expand Down Expand Up @@ -1182,7 +1177,7 @@ void QgsOptions::saveOptions()
{ {
pathsList << mListPluginPaths->item( i )->text(); pathsList << mListPluginPaths->item( i )->text();
} }
mSettings->setValue( QStringLiteral( "help/helpSearchPath" ), pathsList ); mSettings->setValue( QStringLiteral( "plugins/searchPathsForPlugins" ), pathsList );


//search directories for svgs //search directories for svgs
pathsList.clear(); pathsList.clear();
Expand Down

0 comments on commit ae33b58

Please sign in to comment.