aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/mod/ModFolderModel.cpp
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-06-25 12:26:54 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-06-25 12:26:54 +0300
commitef0752972ae64002a02e66e430165f3e93c09c53 (patch)
treebb4337a52c9fe3b0c063cb3b3af5e411826a8d90 /launcher/minecraft/mod/ModFolderModel.cpp
parent3c9c39cb890252f94d0c50caa00de5439881d7f6 (diff)
parentbcf45c74a1b0b3389c05927637bf8aa95b8e43cf (diff)
downloadPrismLauncher-ef0752972ae64002a02e66e430165f3e93c09c53.tar.gz
PrismLauncher-ef0752972ae64002a02e66e430165f3e93c09c53.tar.bz2
PrismLauncher-ef0752972ae64002a02e66e430165f3e93c09c53.zip
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into export
Diffstat (limited to 'launcher/minecraft/mod/ModFolderModel.cpp')
-rw-r--r--launcher/minecraft/mod/ModFolderModel.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/launcher/minecraft/mod/ModFolderModel.cpp b/launcher/minecraft/mod/ModFolderModel.cpp
index 5e3b31e0..af98d834 100644
--- a/launcher/minecraft/mod/ModFolderModel.cpp
+++ b/launcher/minecraft/mod/ModFolderModel.cpp
@@ -37,6 +37,7 @@
#include "ModFolderModel.h"
#include <FileSystem.h>
+#include <qheaderview.h>
#include <QDebug>
#include <QFileSystemWatcher>
#include <QIcon>
@@ -52,12 +53,14 @@
#include "minecraft/mod/tasks/LocalModParseTask.h"
#include "minecraft/mod/tasks/ModFolderLoadTask.h"
-#include "modplatform/ModIndex.h"
ModFolderModel::ModFolderModel(const QString& dir, 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_names = QStringList({ "Enable", "Image", "Name", "Version", "Last Modified", "Provider" });
+ m_column_names_translated = QStringList({ tr("Enable"), tr("Image"), tr("Name"), tr("Version"), tr("Last Modified"), tr("Provider") });
+ m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::NAME , SortType::VERSION, SortType::DATE, SortType::PROVIDER};
+ m_column_resize_modes = { QHeaderView::ResizeToContents, QHeaderView::Interactive, QHeaderView::Stretch, QHeaderView::ResizeToContents, QHeaderView::ResizeToContents, QHeaderView::ResizeToContents};
}
QVariant ModFolderModel::data(const QModelIndex &index, int role) const
@@ -118,7 +121,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({32, 32}, Qt::AspectRatioMode::KeepAspectRatioByExpanding);
+ }
return {};
}
case Qt::CheckStateRole:
@@ -142,15 +147,12 @@ QVariant ModFolderModel::headerData(int section, Qt::Orientation orientation, in
switch (section)
{
case ActiveColumn:
- return QString();
case NameColumn:
- return tr("Name");
case VersionColumn:
- return tr("Version");
case DateColumn:
- return tr("Last changed");
case ProviderColumn:
- return tr("Provider");
+ case ImageColumn:
+ return columnNames().at(section);
default:
return QVariant();
}