feat(modpage): mod icon in description and column

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-05-04 23:44:28 -07:00
parent ec157b766e
commit 9913080a82
3 changed files with 8 additions and 3 deletions

View File

@ -57,7 +57,7 @@
ModFolderModel::ModFolderModel(const QString& dir, std::shared_ptr<const BaseInstance> instance, bool is_indexed, bool create_dir)
: ResourceFolderModel(QDir(dir), instance, nullptr, create_dir), m_is_indexed(is_indexed)
{
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::VERSION, SortType::DATE, SortType::PROVIDER };
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::VERSION, SortType::DATE, SortType::PROVIDER, SortType::NAME };
}
QVariant ModFolderModel::data(const QModelIndex &index, int role) const
@ -118,7 +118,9 @@ QVariant ModFolderModel::data(const QModelIndex &index, int role) const
case Qt::DecorationRole: {
if (column == NAME_COLUMN && (at(row)->isSymLinkUnder(instDirPath()) || at(row)->isMoreThanOneHardLink()))
return APPLICATION->getThemedIcon("status-yellow");
if (column == ImageColumn) {
return at(row)->icon(QSize(64, 64), Qt::AspectRatioMode::KeepAspectRatioByExpanding);
}
return {};
}
case Qt::CheckStateRole:
@ -151,6 +153,8 @@ QVariant ModFolderModel::headerData(int section, Qt::Orientation orientation, in
return tr("Last changed");
case ProviderColumn:
return tr("Provider");
case ImageColumn:
return tr("Image");
default:
return QVariant();
}

View File

@ -68,6 +68,7 @@ public:
VersionColumn,
DateColumn,
ProviderColumn,
ImageColumn,
NUM_COLUMNS
};
enum ModStatusAction {

View File

@ -88,7 +88,7 @@ void InfoFrame::updateWithMod(Mod const& m)
setDescription(m.description());
}
setImage();
setImage(m.icon({64,64}));
}
void InfoFrame::updateWithResource(const Resource& resource)