42 Q_UNUSED( baseColor );
64 Q_UNUSED( baseColor );
72 foreach (
QVariant color, recentColorVariants )
98 Q_UNUSED( baseColor );
128 it != customColorVariants.
end(); ++it )
132 if ( customColorLabels.
length() > colorIndex )
134 label = customColorLabels.
at( colorIndex ).toString();
137 colorList.
append( qMakePair( color, label ) );
147 Q_UNUSED( baseColor );
155 for ( ; colorIt != colors.
constEnd(); ++colorIt )
157 QVariant color = ( *colorIt ).first;
158 QVariant label = ( *colorIt ).second;
159 customColors.
append( color );
160 customColorLabels.
append( label );
163 settings.
setValue(
QString(
"/colors/palettelabels" ), customColorLabels );
186 Q_UNUSED( baseColor );
196 it != colorStrings.
end(); ++it )
200 if ( colorLabels.
length() > colorIndex )
202 label = colorLabels.
at( colorIndex );
205 colorList.
append( qMakePair( color, label ) );
215 Q_UNUSED( baseColor );
222 for ( ; colorIt != colors.
constEnd(); ++colorIt )
225 QString label = ( *colorIt ).second;
226 customColors.
append( color );
227 customColorLabels.
append( label );
258 Q_UNUSED( baseColor );
261 if ( sourceFilePath.
isEmpty() )
269 QFile sourceFile( sourceFilePath );
276 Q_UNUSED( baseColor );
284 QFile destFile( destFilePath );
295 , mFilename( filename )
300 if ( sourceFile.
open( QIODevice::ReadOnly ) )
312 QRegExp rx(
"Name:\\s*(\\S.*)$" );
313 if ( rx.
indexIn( line ) != -1 )
357 if ( !localDir.
mkpath( palettesDir ) )
virtual QgsNamedColorList fetchColors(const QString &context=QString(), const QColor &baseColor=QColor()) override
Gets a list of colors from the scheme.
QString cap(int nth) const
virtual ~QgsColorScheme()
bool erase()
Erases the associated gpl palette file from the users "palettes" folder.
QString readLine(qint64 maxlen)
virtual ~QgsRecentColorScheme()
QList< QVariant > toList() const
Abstract base class for color schemes.
virtual bool setColors(const QgsNamedColorList &colors, const QString &context=QString(), const QColor &baseColor=QColor()) override
Sets the colors for the scheme.
virtual QgsColorScheme * clone() const override
Clones a color scheme.
const T & at(int i) const
QString filePath(const QString &fileName) const
static QColor decodeColor(QString str)
static QString colorToName(const QColor &color)
Returns a friendly display name for a color.
static const QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
QgsColorScheme * clone() const override
Clones a color scheme.
QgsColorScheme * clone() const override
Clones a color scheme.
static QString encodeColor(QColor color)
void setValue(const QString &key, const QVariant &value)
int indexIn(const QString &str, int offset, CaretMode caretMode) const
virtual ~QgsCustomColorScheme()
bool writeEntry(const QString &scope, const QString &key, bool value)
QStringList readListEntry(const QString &scope, const QString &key, QStringList def=QStringList(), bool *ok=0) const
key value accessors
void append(const T &value)
static bool saveColorsToGpl(QFile &file, const QString paletteName, QgsNamedColorList colors)
Exports colors to a gpl GIMP palette file.
static QgsNamedColorList importColorsFromGpl(QFile &file, bool &ok, QString &name)
Imports colors from a gpl GIMP palette file.
bool contains(const QString &key) const
QgsUserColorScheme(const QString &filename)
Constructs a new user color scheme, using a specified gpl palette file.
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
virtual bool setColors(const QgsNamedColorList &colors, const QString &context=QString(), const QColor &baseColor=QColor()) override
Sets the colors for the scheme.
virtual ~QgsProjectColorScheme()
virtual QString gplFilePath()=0
Returns the file path for the associated gpl palette file.
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
virtual QString gplFilePath() override
Returns the file path for the associated gpl palette file.
QgsColorScheme * clone() const override
Clones a color scheme.
QVariant value(const QString &key, const QVariant &defaultValue) const
virtual QgsNamedColorList fetchColors(const QString &context=QString(), const QColor &baseColor=QColor()) override
Gets a list of colors from the scheme.
virtual QString schemeName() const override
Gets the name for the color scheme.
virtual QString schemeName() const =0
Gets the name for the color scheme.
virtual bool setColors(const QgsNamedColorList &colors, const QString &context=QString(), const QColor &baseColor=QColor()) override
Sets the colors for the scheme.
static QgsProject * instance()
access to canonical QgsProject instance
const_iterator constEnd() const
virtual ~QgsGplColorScheme()
const_iterator constBegin() const
virtual QgsNamedColorList fetchColors(const QString &context=QString(), const QColor &baseColor=QColor()) override
Gets a list of colors from the scheme.
virtual QgsNamedColorList fetchColors(const QString &context=QString(), const QColor &baseColor=QColor()) override
Gets a list of colors from the scheme.
virtual ~QgsUserColorScheme()
virtual bool setColors(const QgsNamedColorList &colors, const QString &context=QString(), const QColor &baseColor=QColor())
Sets the colors for the scheme.
A color scheme which stores its colors in a gpl palette file.
bool mkpath(const QString &dirPath) const