Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2024-06-10 10:00:52 +03:00
66 changed files with 2109 additions and 1018 deletions

View File

@ -65,29 +65,24 @@ std::pair<Version, Version> DataPack::compatibleVersions() const
return s_pack_format_versions.constFind(m_pack_format).value();
}
std::pair<int, bool> DataPack::compare(const Resource& other, SortType type) const
int DataPack::compare(const Resource& other, SortType type) const
{
auto const& cast_other = static_cast<DataPack const&>(other);
switch (type) {
default: {
auto res = Resource::compare(other, type);
if (res.first != 0)
return res;
break;
}
default:
return Resource::compare(other, type);
case SortType::PACK_FORMAT: {
auto this_ver = packFormat();
auto other_ver = cast_other.packFormat();
if (this_ver > other_ver)
return { 1, type == SortType::PACK_FORMAT };
return 1;
if (this_ver < other_ver)
return { -1, type == SortType::PACK_FORMAT };
return -1;
break;
}
}
return { 0, false };
return 0;
}
bool DataPack::applyFilter(QRegularExpression filter) const

View File

@ -56,7 +56,7 @@ class DataPack : public Resource {
bool valid() const override;
[[nodiscard]] auto compare(Resource const& other, SortType type) const -> std::pair<int, bool> override;
[[nodiscard]] int compare(Resource const& other, SortType type) const override;
[[nodiscard]] bool applyFilter(QRegularExpression filter) const override;
protected:

View File

@ -80,7 +80,7 @@ void Mod::setDetails(const ModDetails& details)
m_local_details = details;
}
std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
int Mod::compare(const Resource& other, SortType type) const
{
auto cast_other = dynamic_cast<Mod const*>(&other);
if (!cast_other)
@ -90,59 +90,49 @@ std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
default:
case SortType::ENABLED:
case SortType::NAME:
case SortType::DATE: {
auto res = Resource::compare(other, type);
if (res.first != 0)
return res;
break;
}
case SortType::DATE:
case SortType::SIZE:
return Resource::compare(other, type);
case SortType::VERSION: {
auto this_ver = Version(version());
auto other_ver = Version(cast_other->version());
if (this_ver > other_ver)
return { 1, type == SortType::VERSION };
return 1;
if (this_ver < other_ver)
return { -1, type == SortType::VERSION };
return -1;
break;
}
case SortType::PROVIDER: {
auto compare_result =
QString::compare(provider().value_or("Unknown"), cast_other->provider().value_or("Unknown"), Qt::CaseInsensitive);
if (compare_result != 0)
return { compare_result, type == SortType::PROVIDER };
break;
return QString::compare(provider().value_or("Unknown"), cast_other->provider().value_or("Unknown"), Qt::CaseInsensitive);
}
case SortType::SIDE: {
if (side() > cast_other->side())
return { 1, type == SortType::SIDE };
return 1;
else if (side() < cast_other->side())
return { -1, type == SortType::SIDE };
return -1;
break;
}
case SortType::LOADERS: {
if (loaders() > cast_other->loaders())
return { 1, type == SortType::LOADERS };
return 1;
else if (loaders() < cast_other->loaders())
return { -1, type == SortType::LOADERS };
return -1;
break;
}
case SortType::MC_VERSIONS: {
auto thisVersion = mcVersions().join(",");
auto otherVersion = cast_other->mcVersions().join(",");
auto compare_result = QString::compare(thisVersion, otherVersion, Qt::CaseInsensitive);
if (compare_result != 0)
return { compare_result, type == SortType::MC_VERSIONS };
break;
return QString::compare(thisVersion, otherVersion, Qt::CaseInsensitive);
}
case SortType::RELEASE_TYPE: {
if (releaseType() > cast_other->releaseType())
return { 1, type == SortType::RELEASE_TYPE };
return 1;
else if (releaseType() < cast_other->releaseType())
return { -1, type == SortType::RELEASE_TYPE };
return -1;
break;
}
}
return { 0, false };
return 0;
}
bool Mod::applyFilter(QRegularExpression filter) const

View File

@ -94,7 +94,7 @@ class Mod : public Resource {
bool valid() const override;
[[nodiscard]] auto compare(Resource const& other, SortType type) const -> std::pair<int, bool> override;
[[nodiscard]] int compare(Resource const& other, SortType type) const override;
[[nodiscard]] bool applyFilter(QRegularExpression filter) const override;
// Delete all the files of this mod

View File

@ -48,7 +48,6 @@
#include <QThreadPool>
#include <QUrl>
#include <QUuid>
#include <algorithm>
#include "Application.h"
@ -65,17 +64,18 @@
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_names = QStringList(
{ "Enable", "Image", "Name", "Version", "Last Modified", "Provider", "Side", "Loaders", "Miecraft Versions", "Release Type" });
m_column_names = QStringList({ "Enable", "Image", "Name", "Version", "Last Modified", "Provider", "Size", "Side", "Loaders",
"Miecraft Versions", "Release Type" });
m_column_names_translated = QStringList({ tr("Enable"), tr("Image"), tr("Name"), tr("Version"), tr("Last Modified"), tr("Provider"),
tr("Side"), tr("Loaders"), tr("Miecraft Versions"), tr("Release Type") });
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::NAME, SortType::VERSION, SortType::DATE,
SortType::PROVIDER, SortType::SIDE, SortType::LOADERS, SortType::MC_VERSIONS, SortType::RELEASE_TYPE };
tr("Size"), tr("Side"), tr("Loaders"), tr("Miecraft Versions"), tr("Release Type") });
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::NAME, SortType::VERSION,
SortType::DATE, SortType::PROVIDER, SortType::SIZE, SortType::SIDE,
SortType::LOADERS, SortType::MC_VERSIONS, SortType::RELEASE_TYPE };
m_column_resize_modes = { QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Stretch, QHeaderView::Interactive,
QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Interactive,
QHeaderView::Interactive, QHeaderView::Interactive };
m_columnsHideable = { false, true, false, true, true, true, true, true, true, true };
m_columnsHiddenByDefault = { false, false, false, false, false, false, true, true, true, true };
QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Interactive };
m_columnsHideable = { false, true, false, true, true, true, true, true, true, true, true };
m_columnsHiddenByDefault = { false, false, false, false, false, false, false, true, true, true, true };
}
QVariant ModFolderModel::data(const QModelIndex& index, int role) const
@ -133,12 +133,14 @@ QVariant ModFolderModel::data(const QModelIndex& index, int role) const
case ReleaseTypeColumn: {
return at(row)->releaseType().toString();
}
case SizeColumn:
return m_resources[row]->sizeStr();
default:
return QVariant();
}
case Qt::ToolTipRole:
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."
@ -152,7 +154,7 @@ QVariant ModFolderModel::data(const QModelIndex& index, int role) const
}
return m_resources[row]->internal_id();
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)->icon({ 32, 32 }, Qt::AspectRatioMode::KeepAspectRatioByExpanding);
@ -191,6 +193,7 @@ QVariant ModFolderModel::headerData(int section, [[maybe_unused]] Qt::Orientatio
case LoadersColumn:
case McVersionsColumn:
case ReleaseTypeColumn:
case SizeColumn:
return columnNames().at(section);
default:
return QVariant();
@ -216,6 +219,8 @@ QVariant ModFolderModel::headerData(int section, [[maybe_unused]] Qt::Orientatio
return tr("The supported minecraft versions.");
case ReleaseTypeColumn:
return tr("The release type.");
case SizeColumn:
return tr("The size of the mod.");
default:
return QVariant();
}

View File

@ -69,6 +69,7 @@ class ModFolderModel : public ResourceFolderModel {
VersionColumn,
DateColumn,
ProviderColumn,
SizeColumn,
SideColumn,
LoadersColumn,
McVersionsColumn,

View File

@ -1,9 +1,12 @@
#include "Resource.h"
#include <QDirIterator>
#include <QFileInfo>
#include <QRegularExpression>
#include <tuple>
#include "FileSystem.h"
#include "StringUtils.h"
Resource::Resource(QObject* parent) : QObject(parent) {}
@ -18,6 +21,20 @@ void Resource::setFile(QFileInfo file_info)
parseFile();
}
std::tuple<QString, qint64> calculateFileSize(const QFileInfo& file)
{
if (file.isDir()) {
auto dir = QDir(file.absoluteFilePath());
dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot);
auto count = dir.count();
auto str = QObject::tr("item");
if (count != 1)
str = QObject::tr("items");
return { QString("%1 %2").arg(QString::number(count), str), count };
}
return { StringUtils::humanReadableFileSize(file.size(), true), file.size() };
}
void Resource::parseFile()
{
QString file_name{ m_file_info.fileName() };
@ -26,6 +43,7 @@ void Resource::parseFile()
m_internal_id = file_name;
std::tie(m_size_str, m_size_info) = calculateFileSize(m_file_info);
if (m_file_info.isDir()) {
m_type = ResourceType::FOLDER;
m_name = file_name;
@ -61,15 +79,15 @@ static void removeThePrefix(QString& string)
string = string.trimmed();
}
std::pair<int, bool> Resource::compare(const Resource& other, SortType type) const
int Resource::compare(const Resource& other, SortType type) const
{
switch (type) {
default:
case SortType::ENABLED:
if (enabled() && !other.enabled())
return { 1, type == SortType::ENABLED };
return 1;
if (!enabled() && other.enabled())
return { -1, type == SortType::ENABLED };
return -1;
break;
case SortType::NAME: {
QString this_name{ name() };
@ -78,20 +96,31 @@ std::pair<int, bool> Resource::compare(const Resource& other, SortType type) con
removeThePrefix(this_name);
removeThePrefix(other_name);
auto compare_result = QString::compare(this_name, other_name, Qt::CaseInsensitive);
if (compare_result != 0)
return { compare_result, type == SortType::NAME };
break;
return QString::compare(this_name, other_name, Qt::CaseInsensitive);
}
case SortType::DATE:
if (dateTimeChanged() > other.dateTimeChanged())
return { 1, type == SortType::DATE };
return 1;
if (dateTimeChanged() < other.dateTimeChanged())
return { -1, type == SortType::DATE };
return -1;
break;
case SortType::SIZE: {
if (this->type() != other.type()) {
if (this->type() == ResourceType::FOLDER)
return -1;
if (other.type() == ResourceType::FOLDER)
return 1;
}
if (sizeInfo() > other.sizeInfo())
return 1;
if (sizeInfo() < other.sizeInfo())
return -1;
break;
}
}
return { 0, false };
return 0;
}
bool Resource::applyFilter(QRegularExpression filter) const

View File

@ -50,7 +50,7 @@ enum class ResourceType {
LITEMOD, //!< The resource is a litemod
};
enum class SortType { NAME, DATE, VERSION, ENABLED, PACK_FORMAT, PROVIDER, SIDE, LOADERS, MC_VERSIONS, RELEASE_TYPE };
enum class SortType { NAME, DATE, VERSION, ENABLED, PACK_FORMAT, PROVIDER, SIZE, SIDE, LOADERS, MC_VERSIONS, RELEASE_TYPE };
enum class EnableAction { ENABLE, DISABLE, TOGGLE };
@ -80,6 +80,8 @@ class Resource : public QObject {
[[nodiscard]] auto internal_id() const -> QString { return m_internal_id; }
[[nodiscard]] auto type() const -> ResourceType { return m_type; }
[[nodiscard]] bool enabled() const { return m_enabled; }
[[nodiscard]] QString sizeStr() const { return m_size_str; }
[[nodiscard]] qint64 sizeInfo() const { return m_size_info; }
[[nodiscard]] virtual auto name() const -> QString { return m_name; }
[[nodiscard]] virtual bool valid() const { return m_type != ResourceType::UNKNOWN; }
@ -88,10 +90,8 @@ class Resource : public QObject {
* > 0: 'this' comes after 'other'
* = 0: 'this' is equal to 'other'
* < 0: 'this' comes before 'other'
*
* The second argument in the pair is true if the sorting type that decided which one is greater was 'type'.
*/
[[nodiscard]] virtual auto compare(Resource const& other, SortType type = SortType::NAME) const -> std::pair<int, bool>;
[[nodiscard]] virtual int compare(Resource const& other, SortType type = SortType::NAME) const;
/** Returns whether the given filter should filter out 'this' (false),
* or if such filter includes the Resource (true).
@ -152,4 +152,6 @@ class Resource : public QObject {
bool m_is_resolving = false;
bool m_is_resolved = false;
int m_resolution_ticket = 0;
QString m_size_str;
qint64 m_size_info;
};

View File

@ -16,6 +16,7 @@
#include "FileSystem.h"
#include "QVariantUtils.h"
#include "StringUtils.h"
#include "minecraft/mod/tasks/BasicFolderLoadTask.h"
#include "settings/Setting.h"
@ -416,15 +417,17 @@ QVariant ResourceFolderModel::data(const QModelIndex& index, int role) const
switch (role) {
case Qt::DisplayRole:
switch (column) {
case NAME_COLUMN:
case NameColumn:
return m_resources[row]->name();
case DATE_COLUMN:
case DateColumn:
return m_resources[row]->dateTimeChanged();
case SizeColumn:
return m_resources[row]->sizeStr();
default:
return {};
}
case Qt::ToolTipRole:
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."
@ -440,14 +443,14 @@ QVariant ResourceFolderModel::data(const QModelIndex& index, int role) const
return m_resources[row]->internal_id();
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");
return {};
}
case Qt::CheckStateRole:
switch (column) {
case ACTIVE_COLUMN:
case ActiveColumn:
return m_resources[row]->enabled() ? Qt::Checked : Qt::Unchecked;
default:
return {};
@ -486,24 +489,27 @@ QVariant ResourceFolderModel::headerData(int section, [[maybe_unused]] Qt::Orien
switch (role) {
case Qt::DisplayRole:
switch (section) {
case ACTIVE_COLUMN:
case NAME_COLUMN:
case DATE_COLUMN:
case ActiveColumn:
case NameColumn:
case DateColumn:
case SizeColumn:
return columnNames().at(section);
default:
return {};
}
case Qt::ToolTipRole: {
switch (section) {
case ACTIVE_COLUMN:
case ActiveColumn:
//: Here, resource is a generic term for external resources, like Mods, Resource Packs, Shader Packs, etc.
return tr("Is the resource enabled?");
case NAME_COLUMN:
case NameColumn:
//: Here, resource is a generic term for external resources, like Mods, Resource Packs, Shader Packs, etc.
return tr("The name of the resource.");
case DATE_COLUMN:
case DateColumn:
//: Here, resource is a generic term for external resources, like Mods, Resource Packs, Shader Packs, etc.
return tr("The date and time this resource was last changed (or added).");
case SizeColumn:
return tr("The size of the resource.");
default:
return {};
}
@ -614,12 +620,10 @@ SortType ResourceFolderModel::columnToSortKey(size_t column) const
auto const& resource_right = model->at(source_right.row());
auto compare_result = resource_left.compare(resource_right, column_sort_key);
if (compare_result.first == 0)
if (compare_result == 0)
return QSortFilterProxyModel::lessThan(source_left, source_right);
if (compare_result.second || sortOrder() != Qt::DescendingOrder)
return (compare_result.first < 0);
return (compare_result.first > 0);
return compare_result < 0;
}
QString ResourceFolderModel::instDirPath() const

View File

@ -96,7 +96,7 @@ class ResourceFolderModel : public QAbstractListModel {
/* Qt behavior */
/* Basic columns */
enum Columns { ACTIVE_COLUMN = 0, NAME_COLUMN, DATE_COLUMN, NUM_COLUMNS };
enum Columns { ActiveColumn = 0, NameColumn, DateColumn, SizeColumn, NUM_COLUMNS };
QStringList columnNames(bool translated = true) const { return translated ? m_column_names_translated : m_column_names; }
[[nodiscard]] int rowCount(const QModelIndex& parent = {}) const override { return parent.isValid() ? 0 : static_cast<int>(size()); }
@ -195,12 +195,13 @@ class ResourceFolderModel : public QAbstractListModel {
protected:
// Represents the relationship between a column's index (represented by the list index), and it's sorting key.
// As such, the order in with they appear is very important!
QList<SortType> m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::DATE };
QStringList m_column_names = { "Enable", "Name", "Last Modified" };
QStringList m_column_names_translated = { tr("Enable"), tr("Name"), tr("Last Modified") };
QList<QHeaderView::ResizeMode> m_column_resize_modes = { QHeaderView::Interactive, QHeaderView::Stretch, QHeaderView::Interactive };
QList<bool> m_columnsHideable = { false, false, true };
QList<bool> m_columnsHiddenByDefault = { false, false, false };
QList<SortType> m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::DATE, SortType::SIZE };
QStringList m_column_names = { "Enable", "Name", "Last Modified", "Size" };
QStringList m_column_names_translated = { tr("Enable"), tr("Name"), tr("Last Modified"), tr("Size") };
QList<QHeaderView::ResizeMode> m_column_resize_modes = { QHeaderView::Interactive, QHeaderView::Stretch, QHeaderView::Interactive,
QHeaderView::Interactive };
QList<bool> m_columnsHideable = { false, false, true, true };
QList<bool> m_columnsHiddenByDefault = { false, false, false, false };
QDir m_dir;
BaseInstance* m_instance;

View File

@ -94,29 +94,24 @@ std::pair<Version, Version> ResourcePack::compatibleVersions() const
return s_pack_format_versions.constFind(m_pack_format).value();
}
std::pair<int, bool> ResourcePack::compare(const Resource& other, SortType type) const
int ResourcePack::compare(const Resource& other, SortType type) const
{
auto const& cast_other = static_cast<ResourcePack const&>(other);
switch (type) {
default: {
auto res = Resource::compare(other, type);
if (res.first != 0)
return res;
break;
}
default:
return Resource::compare(other, type);
case SortType::PACK_FORMAT: {
auto this_ver = packFormat();
auto other_ver = cast_other.packFormat();
if (this_ver > other_ver)
return { 1, type == SortType::PACK_FORMAT };
return 1;
if (this_ver < other_ver)
return { -1, type == SortType::PACK_FORMAT };
return -1;
break;
}
}
return { 0, false };
return 0;
}
bool ResourcePack::applyFilter(QRegularExpression filter) const

View File

@ -44,7 +44,7 @@ class ResourcePack : public Resource {
bool valid() const override;
[[nodiscard]] auto compare(Resource const& other, SortType type) const -> std::pair<int, bool> override;
[[nodiscard]] int compare(Resource const& other, SortType type) const override;
[[nodiscard]] bool applyFilter(QRegularExpression filter) const override;
protected:

View File

@ -44,18 +44,19 @@
#include "Application.h"
#include "Version.h"
#include "minecraft/mod/Resource.h"
#include "minecraft/mod/tasks/BasicFolderLoadTask.h"
#include "minecraft/mod/tasks/LocalResourcePackParseTask.h"
ResourcePackFolderModel::ResourcePackFolderModel(const QString& dir, BaseInstance* instance) : ResourceFolderModel(QDir(dir), instance)
{
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::Interactive, QHeaderView::Interactive, QHeaderView::Stretch, QHeaderView::Interactive,
QHeaderView::Interactive };
m_columnsHideable = { false, true, false, true, true };
m_columnsHiddenByDefault = { false, false, false, false, false };
m_column_names = QStringList({ "Enable", "Image", "Name", "Pack Format", "Last Modified", "Size" });
m_column_names_translated = QStringList({ tr("Enable"), tr("Image"), tr("Name"), tr("Pack Format"), tr("Last Modified"), tr("Size") });
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::NAME, SortType::PACK_FORMAT, SortType::DATE, SortType::SIZE };
m_column_resize_modes = { QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Stretch,
QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Interactive };
m_columnsHideable = { false, true, false, true, true, true };
m_columnsHiddenByDefault = { false, false, false, false, false, false };
}
QVariant ResourcePackFolderModel::data(const QModelIndex& index, int role) const
@ -86,6 +87,8 @@ QVariant ResourcePackFolderModel::data(const QModelIndex& index, int role) const
}
case DateColumn:
return m_resources[row]->dateTimeChanged();
case SizeColumn:
return m_resources[row]->sizeStr();
default:
return {};
@ -145,6 +148,7 @@ QVariant ResourcePackFolderModel::headerData(int section, [[maybe_unused]] Qt::O
case PackFormatColumn:
case DateColumn:
case ImageColumn:
case SizeColumn:
return columnNames().at(section);
default:
return {};
@ -161,6 +165,8 @@ QVariant ResourcePackFolderModel::headerData(int section, [[maybe_unused]] Qt::O
return tr("The resource pack format ID, as well as the Minecraft versions it was designed for.");
case DateColumn:
return tr("The date and time this resource pack was last changed (or added).");
case SizeColumn:
return tr("The size of the resource pack.");
default:
return {};
}

View File

@ -7,7 +7,7 @@
class ResourcePackFolderModel : public ResourceFolderModel {
Q_OBJECT
public:
enum Columns { ActiveColumn = 0, ImageColumn, NameColumn, PackFormatColumn, DateColumn, NUM_COLUMNS };
enum Columns { ActiveColumn = 0, ImageColumn, NameColumn, PackFormatColumn, DateColumn, SizeColumn, NUM_COLUMNS };
explicit ResourcePackFolderModel(const QString& dir, BaseInstance* instance);

View File

@ -37,6 +37,7 @@
#include "Application.h"
#include "StringUtils.h"
#include "TexturePackFolderModel.h"
#include "minecraft/mod/tasks/BasicFolderLoadTask.h"
@ -49,7 +50,6 @@ TexturePackFolderModel::TexturePackFolderModel(const QString& dir, BaseInstance*
m_column_sort_keys = { SortType::ENABLED, SortType::NAME, SortType::NAME, SortType::DATE };
m_column_resize_modes = { QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Stretch, QHeaderView::Interactive };
m_columnsHideable = { false, true, false, true };
m_columnsHiddenByDefault = { false, false, false, false };
}
Task* TexturePackFolderModel::createUpdateTask()
@ -77,6 +77,8 @@ QVariant TexturePackFolderModel::data(const QModelIndex& index, int role) const
return m_resources[row]->name();
case DateColumn:
return m_resources[row]->dateTimeChanged();
case SizeColumn:
return m_resources[row]->sizeStr();
default:
return {};
}
@ -128,6 +130,7 @@ QVariant TexturePackFolderModel::headerData(int section, [[maybe_unused]] Qt::Or
case NameColumn:
case DateColumn:
case ImageColumn:
case SizeColumn:
return columnNames().at(section);
default:
return {};
@ -136,13 +139,15 @@ QVariant TexturePackFolderModel::headerData(int section, [[maybe_unused]] Qt::Or
switch (section) {
case ActiveColumn:
//: Here, resource is a generic term for external resources, like Mods, Resource Packs, Shader Packs, etc.
return tr("Is the resource enabled?");
return tr("Is the texture pack enabled?");
case NameColumn:
//: Here, resource is a generic term for external resources, like Mods, Resource Packs, Shader Packs, etc.
return tr("The name of the resource.");
return tr("The name of the texture pack.");
case DateColumn:
//: Here, resource is a generic term for external resources, like Mods, Resource Packs, Shader Packs, etc.
return tr("The date and time this resource was last changed (or added).");
return tr("The date and time this texture pack was last changed (or added).");
case SizeColumn:
return tr("The size of the texture pack.");
default:
return {};
}

View File

@ -44,7 +44,7 @@ class TexturePackFolderModel : public ResourceFolderModel {
Q_OBJECT
public:
enum Columns { ActiveColumn = 0, ImageColumn, NameColumn, DateColumn, NUM_COLUMNS };
enum Columns { ActiveColumn = 0, ImageColumn, NameColumn, DateColumn, SizeColumn, NUM_COLUMNS };
explicit TexturePackFolderModel(const QString& dir, std::shared_ptr<const BaseInstance> instance);