Skip to content

Commit

Permalink
integrate with Color Ramp Manager plugin to download cpt-city files
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennesky committed Aug 6, 2012
1 parent fbbb71a commit a58f737
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
22 changes: 17 additions & 5 deletions src/core/symbology-ng/qgsvectorcolorrampv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a58f737

Please sign in to comment.