aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/mod/ResourcePackFolderModel.cpp
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-06-23 20:01:17 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-06-23 20:01:17 +0300
commit69c709b05a90f342cc9d1f9337457bb5519a87a9 (patch)
tree4ff1cbe8123b627bfb171c119b3adc4e2ddaf89b /launcher/minecraft/mod/ResourcePackFolderModel.cpp
parent3e3be9ae6f902cc292ee26e4d330b078ddbb2a46 (diff)
parent046d510134a0061c0a1fa89fda80355c9e2f11ff (diff)
downloadPrismLauncher-69c709b05a90f342cc9d1f9337457bb5519a87a9.tar.gz
PrismLauncher-69c709b05a90f342cc9d1f9337457bb5519a87a9.tar.bz2
PrismLauncher-69c709b05a90f342cc9d1f9337457bb5519a87a9.zip
Merge branch 'develop' of https://github.com/PrismLauncher/PrismLauncher into develop
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/minecraft/mod/ResourcePackFolderModel.cpp')
-rw-r--r--launcher/minecraft/mod/ResourcePackFolderModel.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/launcher/minecraft/mod/ResourcePackFolderModel.cpp b/launcher/minecraft/mod/ResourcePackFolderModel.cpp
index c12d1f23..14a28b47 100644
--- a/launcher/minecraft/mod/ResourcePackFolderModel.cpp
+++ b/launcher/minecraft/mod/ResourcePackFolderModel.cpp
@@ -35,6 +35,8 @@
*/
#include "ResourcePackFolderModel.h"
+#include <qnamespace.h>
+#include <qsize.h>
#include <QIcon>
#include <QStyle>
@@ -48,7 +50,11 @@
ResourcePackFolderModel::ResourcePackFolderModel(const QString& dir, BaseInstance* instance)
: ResourceFolderModel(QDir(dir), instance)
{
- m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::PACK_FORMAT, SortType::DATE };
+ m_column_names = QStringList({ "Enable", "Image", "Name", "Pack Format", "Last Modified" });
+ m_column_names_translated = QStringList({ tr("Enable"), tr("Image"), tr("Name"), tr("Pack Format"), tr("Last Modified") });
+ m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::NAME, SortType::PACK_FORMAT, SortType::DATE};
+ m_column_resize_modes = { QHeaderView::ResizeToContents, QHeaderView::Interactive, QHeaderView::Stretch, QHeaderView::ResizeToContents};
+
}
QVariant ResourcePackFolderModel::data(const QModelIndex& index, int role) const
@@ -84,9 +90,11 @@ QVariant ResourcePackFolderModel::data(const QModelIndex& index, int role) const
return {};
}
case Qt::DecorationRole: {
- if (column == NAME_COLUMN && (at(row)->isSymLinkUnder(instDirPath()) || at(row)->isMoreThanOneHardLink()))
+ if (column == NameColumn && (at(row)->isSymLinkUnder(instDirPath()) || at(row)->isMoreThanOneHardLink()))
return APPLICATION->getThemedIcon("status-yellow");
-
+ if (column == ImageColumn) {
+ return at(row)->image({32, 32}, Qt::AspectRatioMode::KeepAspectRatioByExpanding);
+ }
return {};
}
case Qt::ToolTipRole: {
@@ -94,7 +102,7 @@ QVariant ResourcePackFolderModel::data(const QModelIndex& index, int role) const
//: The string being explained by this is in the format: ID (Lower version - Upper version)
return tr("The resource pack format ID, as well as the Minecraft versions it was designed for.");
}
- if (column == NAME_COLUMN) {
+ if (column == NameColumn) {
if (at(row)->isSymLinkUnder(instDirPath())) {
return m_resources[row]->internal_id() +
tr("\nWarning: This resource is symbolically linked from elsewhere. Editing it will also change the original."
@@ -126,13 +134,11 @@ QVariant ResourcePackFolderModel::headerData(int section, Qt::Orientation orient
case Qt::DisplayRole:
switch (section) {
case ActiveColumn:
- return QString();
case NameColumn:
- return tr("Name");
case PackFormatColumn:
- return tr("Pack Format");
case DateColumn:
- return tr("Last changed");
+ case ImageColumn:
+ return columnNames().at(section);
default:
return {};
}
@@ -151,6 +157,11 @@ QVariant ResourcePackFolderModel::headerData(int section, Qt::Orientation orient
default:
return {};
}
+ case Qt::SizeHintRole:
+ if (section == ImageColumn) {
+ return QSize(64,0);
+ }
+ return {};
default:
return {};
}