Rename QgsApplication::composerTemplatePaths to layoutTemplatePaths

This commit is contained in:
Nyall Dawson 2018-01-16 21:34:19 +10:00
parent 343c070adf
commit 64a8bda8cc
6 changed files with 16 additions and 10 deletions

View File

@ -504,6 +504,7 @@ QgsApplication {#qgis_api_break_3_0_QgsApplication}
- srsDbFilePath() was renamed to srsDatabaseFilePath() - srsDbFilePath() was renamed to srsDatabaseFilePath()
- setAuthDbDirPath() was renamed to setAuthDatabaseDirPath() - setAuthDbDirPath() was renamed to setAuthDatabaseDirPath()
- createDB() was renamed to createDatabase() - createDB() was renamed to createDatabase()
- composerTemplatePaths() was renamed to layoutTemplatePaths()
QgsAttributeDialog {#qgis_api_break_3_0_QgsAttributeDialog} QgsAttributeDialog {#qgis_api_break_3_0_QgsAttributeDialog}

View File

@ -275,9 +275,11 @@ Returns the path to the srs.db file.
Returns the paths to svg directories. Returns the paths to svg directories.
%End %End
static QStringList composerTemplatePaths(); static QStringList layoutTemplatePaths();
%Docstring %Docstring
Returns the paths to composer template directories Returns the paths to layout template directories.
.. versionadded:: 3.0
%End %End
static QMap<QString, QString> systemEnvVars(); static QMap<QString, QString> systemEnvVars();

View File

@ -169,7 +169,7 @@ QMap<QString, QString> QgsLayoutManagerDialog::defaultTemplates( bool fromUser )
QMap<QString, QString> QgsLayoutManagerDialog::otherTemplates() const QMap<QString, QString> QgsLayoutManagerDialog::otherTemplates() const
{ {
QMap<QString, QString> templateMap; QMap<QString, QString> templateMap;
QStringList paths = QgsApplication::composerTemplatePaths(); QStringList paths = QgsApplication::layoutTemplatePaths();
Q_FOREACH ( const QString &path, paths ) Q_FOREACH ( const QString &path, paths )
{ {
QMap<QString, QString> templates = templatesFromPath( path ); QMap<QString, QString> templates = templatesFromPath( path );

View File

@ -277,7 +277,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
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
const QStringList composerTemplatePathList = QgsApplication::composerTemplatePaths(); const QStringList composerTemplatePathList = QgsApplication::layoutTemplatePaths();
for ( const QString &path : composerTemplatePathList ) for ( const QString &path : composerTemplatePathList )
{ {
QListWidgetItem *newItem = new QListWidgetItem( mListComposerTemplatePaths ); QListWidgetItem *newItem = new QListWidgetItem( mListComposerTemplatePaths );
@ -1141,7 +1141,7 @@ void QgsOptions::saveOptions()
{ {
pathsList << mListComposerTemplatePaths->item( i )->text(); pathsList << mListComposerTemplatePaths->item( i )->text();
} }
mSettings->setValue( QStringLiteral( "composer/searchPathsForTemplates" ), pathsList ); mSettings->setValue( QStringLiteral( "Layout/searchPathsForTemplates" ), pathsList, QgsSettings::Core );
pathsList.clear(); pathsList.clear();
for ( int i = 0; i < mListHiddenBrowserPaths->count(); ++i ) for ( int i = 0; i < mListHiddenBrowserPaths->count(); ++i )

View File

@ -784,12 +784,12 @@ QStringList QgsApplication::svgPaths()
return paths; return paths;
} }
QStringList QgsApplication::composerTemplatePaths() QStringList QgsApplication::layoutTemplatePaths()
{ {
//local directories to search when looking for an SVG with a given basename //local directories to search when looking for an template with a given basename
//defined by user in options dialog //defined by user in options dialog
QgsSettings settings; QgsSettings settings;
QStringList pathList = settings.value( QStringLiteral( "composer/searchPathsForTemplates" ) ).toStringList(); QStringList pathList = settings.value( QStringLiteral( "Layout/searchPathsForTemplates" ), QVariant(), QgsSettings::Core ).toStringList();
return pathList; return pathList;
} }

View File

@ -278,8 +278,11 @@ class CORE_EXPORT QgsApplication : public QApplication
//! Returns the paths to svg directories. //! Returns the paths to svg directories.
static QStringList svgPaths(); static QStringList svgPaths();
//! Returns the paths to composer template directories /**
static QStringList composerTemplatePaths(); * Returns the paths to layout template directories.
* \since QGIS 3.0
*/
static QStringList layoutTemplatePaths();
//! Returns the system environment variables passed to application. //! Returns the system environment variables passed to application.
static QMap<QString, QString> systemEnvVars() { return ABISYM( mSystemEnvVars ); } static QMap<QString, QString> systemEnvVars() { return ABISYM( mSystemEnvVars ); }