summaryrefslogtreecommitdiff
path: root/src/icondelegate.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-01-23 00:05:46 +0100
committerTannin <devnull@localhost>2014-01-23 00:05:46 +0100
commite597823337c858f2985c615ee5147f47567991ee (patch)
treee42647cf1114ebd4d42e4a8c15a91b941961c3df /src/icondelegate.cpp
parente69210b3a78c4a6c63086d84e6bdb2c3b47d8944 (diff)
- boss integration
- plugin list can now also display multiple flags for a file (like the mod list) - changed some compiler&linker settings to produce smaller binaries
Diffstat (limited to 'src/icondelegate.cpp')
-rw-r--r--src/icondelegate.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/icondelegate.cpp b/src/icondelegate.cpp
index 2540e1d5..048b09f9 100644
--- a/src/icondelegate.cpp
+++ b/src/icondelegate.cpp
@@ -29,38 +29,17 @@ IconDelegate::IconDelegate(QObject *parent)
}
-QIcon IconDelegate::getFlagIcon(ModInfo::EFlag flag) const
-{
- switch (flag) {
- case ModInfo::FLAG_BACKUP: return QIcon(":/MO/gui/emblem_backup");
- case ModInfo::FLAG_INVALID: return QIcon(":/MO/gui/emblem_problem");
- case ModInfo::FLAG_NOTENDORSED: return QIcon(":/MO/gui/emblem_notendorsed");
- case ModInfo::FLAG_NOTES: return QIcon(":/MO/gui/emblem_notes");
- case ModInfo::FLAG_CONFLICT_OVERWRITE: return QIcon(":/MO/gui/emblem_conflict_overwrite");
- case ModInfo::FLAG_CONFLICT_OVERWRITTEN: return QIcon(":/MO/gui/emblem_conflict_overwritten");
- case ModInfo::FLAG_CONFLICT_MIXED: return QIcon(":/MO/gui/emblem_conflict_mixed");
- case ModInfo::FLAG_CONFLICT_REDUNDANT: return QIcon(":MO/gui/emblem_conflict_redundant");
- default: return QIcon();
- }
-}
-
-
void IconDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyledItemDelegate::paint(painter, option, index);
- QVariant modid = index.data(Qt::UserRole + 1);
- if (!modid.isValid()) {
- return;
- }
- ModInfo::Ptr info = ModInfo::getByIndex(modid.toInt());
- std::vector<ModInfo::EFlag> flags = info->getFlags();
+
+ QList<QIcon> icons = getIcons(index);
int x = 4;
painter->save();
painter->translate(option.rect.topLeft());
- for (auto iter = flags.begin(); iter != flags.end(); ++iter) {
- QIcon temp = getFlagIcon(*iter);
- painter->drawPixmap(x, 2, 16, 16, temp.pixmap(QSize(16, 16)));
+ for (auto iter = icons.begin(); iter != icons.end(); ++iter) {
+ painter->drawPixmap(x, 2, 16, 16, iter->pixmap(QSize(16, 16)));
x += 20;
}
@@ -70,6 +49,7 @@ void IconDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
QSize IconDelegate::sizeHint(const QStyleOptionViewItem&, const QModelIndex &modelIndex) const
{
+ int count = getNumIcons(modelIndex);
unsigned int index = modelIndex.data(Qt::UserRole + 1).toInt();
if (index < ModInfo::getNumMods()) {
ModInfo::Ptr info = ModInfo::getByIndex(index);