integrate with Color Ramp Manager plugin to download cpt-city files

This commit is contained in:
Etienne Tourigny 2012-08-06 20:38:12 -03:00
parent fbbb71a490
commit a58f737b75
2 changed files with 22 additions and 6 deletions

View File

@ -432,11 +432,23 @@ QStringList QgsCptCityColorRampV2::listSchemeNames( QString collectionName )
QString QgsCptCityColorRampV2::getBaseDir()
{
// currently hard-coded, but could be also in QGis install path and/or configurable
if ( mBaseDir.isNull() )
return QgsApplication::qgisSettingsDirPath() + "/" + "cpt-city";
else
return mBaseDir;
// if was set with setBaseDir, return that value
QString baseDir = mBaseDir;
// use CptCity/baseDir setting if set
if ( baseDir.isNull() )
{
QSettings settings;
baseDir = settings.value( "CptCity/baseDir", QString() ).toString();
if ( ! baseDir.isNull() )
baseDir += "/cpt-city";
}
// fallback to user setting dir
if ( baseDir.isNull() )
baseDir = QgsApplication::qgisSettingsDirPath() + "/" + "cpt-city";
return baseDir;
}
QString QgsCptCityColorRampV2::getFilename() const

View File

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