Store database icons as QImage instead of QIcon.

This has the advantage that they can be used without a running X server.
Add methods to retrieve QPixmaps that are converted from the stored QImages
and cached by QPixmapCache.
This commit is contained in:
Felix Geyer
2012-01-01 21:52:54 +01:00
parent fdf600e09a
commit 00aafa69f5
15 changed files with 137 additions and 60 deletions

View File

@@ -227,9 +227,9 @@ void KeePass2XmlReader::parseIcon()
uuid = readUuid();
}
else if (m_xml.name() == "Data") {
QPixmap pixmap;
pixmap.loadFromData(readBinary());
m_meta->addCustomIcon(uuid, QIcon(pixmap));
QImage icon;
icon.loadFromData(readBinary());
m_meta->addCustomIcon(uuid, icon);
}
else {
skipCurrentElement();
@@ -318,7 +318,7 @@ Group* KeePass2XmlReader::parseGroup()
raiseError();
}
else {
if (iconId >= DatabaseIcons::iconCount()) {
if (iconId >= databaseIcons()->iconCount()) {
qWarning("KeePass2XmlReader::parseGroup: icon id \"%d\" not supported", iconId);
}
group->setIcon(iconId);