Skip to content

Commit a58f737

Browse files
committed
integrate with Color Ramp Manager plugin to download cpt-city files
1 parent fbbb71a commit a58f737

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/core/symbology-ng/qgsvectorcolorrampv2.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,23 @@ QStringList QgsCptCityColorRampV2::listSchemeNames( QString collectionName )
432432

433433
QString QgsCptCityColorRampV2::getBaseDir()
434434
{
435-
// currently hard-coded, but could be also in QGis install path and/or configurable
436-
if ( mBaseDir.isNull() )
437-
return QgsApplication::qgisSettingsDirPath() + "/" + "cpt-city";
438-
else
439-
return mBaseDir;
435+
// if was set with setBaseDir, return that value
436+
QString baseDir = mBaseDir;
437+
438+
// use CptCity/baseDir setting if set
439+
if ( baseDir.isNull() )
440+
{
441+
QSettings settings;
442+
baseDir = settings.value( "CptCity/baseDir", QString() ).toString();
443+
if ( ! baseDir.isNull() )
444+
baseDir += "/cpt-city";
445+
}
446+
447+
// fallback to user setting dir
448+
if ( baseDir.isNull() )
449+
baseDir = QgsApplication::qgisSettingsDirPath() + "/" + "cpt-city";
450+
451+
return baseDir;
440452
}
441453

442454
QString QgsCptCityColorRampV2::getFilename() const

src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ QgsCptCityColorRampV2Dialog::QgsCptCityColorRampV2Dialog( QgsCptCityColorRampV2*
4848
edit->setReadOnly( true );
4949
// not sure if we want this long string to be translated
5050
QString helpText = tr( "Error - cpt-city gradient files not found.\n\n"
51-
"Please download the complete collection (in svg format) "
51+
"You have two means of installing them:\n\n"
52+
"1) Install the \"Color Ramp Manager\" python plugin "
53+
"(you must enable Experimental plugins in the plugin manager) "
54+
"and use it to download latest cpt-city package.\n\n"
55+
"2) Download the complete collection (in svg format) "
5256
"and unzip it to your QGis settings directory [%1] .\n\n"
5357
"This file can be found at [%2]\nand current file is [%3]"
5458
).arg( QgsApplication::qgisSettingsDirPath()

0 commit comments

Comments
 (0)