42 Q_UNUSED( baseColor );
64 Q_UNUSED( baseColor );
68 QList< QVariant > recentColorVariants = settings.value( QString(
"/colors/recent" ) ).toList();
72 foreach ( QVariant color, recentColorVariants )
98 Q_UNUSED( baseColor );
105 if ( !settings.contains( QString(
"/colors/palettecolors" ) ) )
108 colorList.append( qMakePair( QColor(
"#000000" ), QString() ) );
109 colorList.append( qMakePair( QColor(
"#ffffff" ), QString() ) );
110 colorList.append( qMakePair( QColor(
"#a6cee3" ), QString() ) );
111 colorList.append( qMakePair( QColor(
"#1f78b4" ), QString() ) );
112 colorList.append( qMakePair( QColor(
"#b2df8a" ), QString() ) );
113 colorList.append( qMakePair( QColor(
"#33a02c" ), QString() ) );
114 colorList.append( qMakePair( QColor(
"#fb9a99" ), QString() ) );
115 colorList.append( qMakePair( QColor(
"#e31a1c" ), QString() ) );
116 colorList.append( qMakePair( QColor(
"#fdbf6f" ), QString() ) );
117 colorList.append( qMakePair( QColor(
"#ff7f00" ), QString() ) );
122 QList< QVariant > customColorVariants = settings.value( QString(
"/colors/palettecolors" ) ).toList();
123 QList< QVariant > customColorLabels = settings.value( QString(
"/colors/palettelabels" ) ).toList();
127 for ( QList< QVariant >::iterator it = customColorVariants.begin();
128 it != customColorVariants.end(); ++it )
130 QColor color = ( *it ).value<QColor>();
132 if ( customColorLabels.length() > colorIndex )
134 label = customColorLabels.at( colorIndex ).toString();
137 colorList.append( qMakePair( color, label ) );
147 Q_UNUSED( baseColor );
151 QList< QVariant > customColors;
152 QList< QVariant > customColorLabels;
154 QgsNamedColorList::const_iterator colorIt = colors.constBegin();
155 for ( ; colorIt != colors.constEnd(); ++colorIt )
157 QVariant color = ( *colorIt ).first;
158 QVariant label = ( *colorIt ).second;
159 customColors.append( color );
160 customColorLabels.append( label );
162 settings.setValue( QString(
"/colors/palettecolors" ), customColors );
163 settings.setValue( QString(
"/colors/palettelabels" ), customColorLabels );
186 Q_UNUSED( baseColor );
195 for ( QStringList::iterator it = colorStrings.begin();
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 );
218 QStringList customColors;
219 QStringList customColorLabels;
221 QgsNamedColorList::const_iterator colorIt = colors.constBegin();
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 );
279 if ( destFilePath.isEmpty() )
284 QFile destFile( destFilePath );
295 , mFilename( filename )
300 if ( sourceFile.open( QIODevice::ReadOnly ) )
302 QTextStream in( &sourceFile );
306 while ( !in.atEnd() && !line.startsWith(
"Name:" ) )
308 line = in.readLine();
312 QRegExp rx(
"Name:\\s*(\\S.*)$" );
313 if ( rx.indexIn( line ) != -1 )
319 if (
mName.isEmpty() )
343 if ( filePath.isEmpty() )
349 return QFile::remove( filePath );
357 if ( !localDir.mkpath( palettesDir ) )
362 return QDir( palettesDir ).filePath(
mFilename );