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 authored 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 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 );
mCustomVariablesTable->setEnabled( false );
}
QStringList customVarsList = mSettings->value( QStringLiteral( "qgis/customEnvVars" ) ).toStringList();
Q_FOREACH ( const QString &varStr, customVarsList )
const QStringList customVarsList = mSettings->value( QStringLiteral( "qgis/customEnvVars" ) ).toStringList();
for ( const QString &varStr : customVarsList )
{
int pos = varStr.indexOf( QLatin1Char( '|' ) );
if ( pos == -1 )
Expand Down Expand Up @@ -204,9 +204,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
// current environment variables
mCurrentVariablesTable->horizontalHeader()->setFixedHeight( fmCustomVarH );
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( '=' ) );
if ( pos == -1 )
Expand Down Expand Up @@ -254,49 +254,44 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mCurrentVariablesTable->resizeColumnToContents( 0 );

//local directories to search when loading c++ plugins
QStringList pathList = mSettings->value( QStringLiteral( "plugins/searchPathsForPlugins" ) ).toStringList();
Q_FOREACH ( const QString &path, pathList )
const QStringList pluginsPathList = mSettings->value( QStringLiteral( "plugins/searchPathsForPlugins" ) ).toStringList();
for ( const QString &path : pluginsPathList )
{
QListWidgetItem *newItem = new QListWidgetItem( mListPluginPaths );
newItem->setText( path );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mListPluginPaths->addItem( newItem );
}
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
pathList = QgsApplication::svgPaths();
if ( !pathList.isEmpty() )
const QStringList svgPathList = QgsApplication::svgPaths();
for ( const QString &path : svgPathList )
{
Q_FOREACH ( const QString &path, pathList )
{
QListWidgetItem *newItem = new QListWidgetItem( mListSVGPaths );
newItem->setText( path );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mListSVGPaths->addItem( newItem );
}
QListWidgetItem *newItem = new QListWidgetItem( mListSVGPaths );
newItem->setText( path );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mListSVGPaths->addItem( newItem );
}
connect( mBtnAddSVGPath, &QAbstractButton::clicked, this, &QgsOptions::addSVGPath );
connect( mBtnRemoveSVGPath, &QAbstractButton::clicked, this, &QgsOptions::removeSVGPath );

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

//paths hidden from browser
pathList = mSettings->value( QStringLiteral( "/browser/hiddenPaths" ) ).toStringList();
Q_FOREACH ( const QString &path, pathList )
const QStringList hiddenPathList = mSettings->value( QStringLiteral( "/browser/hiddenPaths" ) ).toStringList();
for ( const QString &path : hiddenPathList )
{
QListWidgetItem *newItem = new QListWidgetItem( mListHiddenBrowserPaths );
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 );

//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();
Q_FOREACH ( const QString &path, helpPathList )
const QStringList helpPathList = mSettings->value( QStringLiteral( "help/helpSearchPath" ), "http://docs.qgis.org/$qgis_short_version/$qgis_locale/docs/user_manual/" ).toStringList();
for ( const QString &path : helpPathList )
{
QTreeWidgetItem *item = new QTreeWidgetItem();
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 ) );

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

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

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

0 comments on commit ae33b58

Please sign in to comment.