Make ColorHistory more robust to change in format.
This commit is contained in:
@@ -77,7 +77,20 @@ namespace glabels
|
||||
for ( QString& nameColor : readNameColorList() )
|
||||
{
|
||||
QStringList v = nameColor.split( ':' );
|
||||
colorList << QColor( v[1] );
|
||||
if ( v.size() == 2 )
|
||||
{
|
||||
colorList << QColor( v[1] );
|
||||
}
|
||||
else if ( v.size() == 1 )
|
||||
{
|
||||
// Old-style, no name
|
||||
colorList << QColor( v[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should not happen
|
||||
qWarning() << "Invalid color history.";
|
||||
}
|
||||
}
|
||||
|
||||
return colorList;
|
||||
@@ -91,7 +104,20 @@ namespace glabels
|
||||
for ( QString& nameColor : readNameColorList() )
|
||||
{
|
||||
QStringList v = nameColor.split( ':' );
|
||||
nameList << v[0];
|
||||
if ( v.size() == 2 )
|
||||
{
|
||||
nameList << v[0];
|
||||
}
|
||||
else if ( v.size() == 1 )
|
||||
{
|
||||
// Old-style, no name
|
||||
nameList << QString(tr("color %1")).arg( v[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should not happen
|
||||
qWarning() << "Invalid color history.";
|
||||
}
|
||||
}
|
||||
|
||||
return nameList;
|
||||
|
||||
@@ -1127,6 +1127,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>glabels::ColorHistory</name>
|
||||
<message>
|
||||
<source>color %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>glabels::ColorPaletteDialog</name>
|
||||
<message>
|
||||
@@ -1154,6 +1161,10 @@
|
||||
<extracomment>%1 = color specification in hex. String must not contain a colon (:).</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Custom color #%1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>glabels::FieldButton</name>
|
||||
@@ -1912,6 +1923,14 @@
|
||||
<source>Shadow</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insert Field</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Selected File...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>glabels::PrintView</name>
|
||||
|
||||
Reference in New Issue
Block a user