mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
add size column for datapacks
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
bac959bc6f
commit
b7381d8088
2 changed files with 26 additions and 7 deletions
|
|
@ -45,13 +45,14 @@
|
|||
DataPackFolderModel::DataPackFolderModel(const QString& dir, BaseInstance* instance, bool isIndexed, bool createDir, QObject* parent)
|
||||
: ResourceFolderModel(QDir(dir), instance, isIndexed, createDir, parent)
|
||||
{
|
||||
m_columnNames = QStringList({ "Enable", "Image", "Name", "Pack Format", "Last Modified", "File Name" });
|
||||
m_columnNames = QStringList({ "Enable", "Image", "Name", "Pack Format", "Last Modified", "Size", "File Name" });
|
||||
m_columnNamesTranslated =
|
||||
QStringList({ tr("Enable"), tr("Image"), tr("Name"), tr("Pack Format"), tr("Last Modified"), tr("File Name") });
|
||||
m_columnSortKeys = { SortType::Enabled, SortType::Name, SortType::Name, SortType::PackFormat, SortType::Date, SortType::Filename };
|
||||
m_columnResizeModes = { QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Stretch,
|
||||
QStringList({ tr("Enable"), tr("Image"), tr("Name"), tr("Pack Format"), tr("Last Modified"), tr("Size"), tr("File Name") });
|
||||
m_columnSortKeys = { SortType::Enabled, SortType::Name, SortType::Name, SortType::PackFormat,
|
||||
SortType::Date, SortType::Size, SortType::Filename };
|
||||
m_columnResizeModes = { QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Stretch, QHeaderView::Interactive,
|
||||
QHeaderView::Interactive, QHeaderView::Interactive, QHeaderView::Interactive };
|
||||
m_columnsHideable = { false, true, false, true, true, true };
|
||||
m_columnsHideable = { false, true, false, true, true, true, true };
|
||||
}
|
||||
|
||||
QVariant DataPackFolderModel::data(const QModelIndex& index, int role) const
|
||||
|
|
@ -71,6 +72,10 @@ QVariant DataPackFolderModel::data(const QModelIndex& index, int role) const
|
|||
const auto& resource = at(row);
|
||||
return resource.packFormatStr();
|
||||
}
|
||||
if (column == SizeColumn) {
|
||||
const auto& resource = at(row);
|
||||
return resource.sizeStr();
|
||||
}
|
||||
break;
|
||||
case Qt::DecorationRole: {
|
||||
if (column == ImageColumn) {
|
||||
|
|
@ -112,7 +117,9 @@ QVariant DataPackFolderModel::data(const QModelIndex& index, int role) const
|
|||
case FileNameColumn:
|
||||
mappedIndex = index.siblingAtColumn(ResourceFolderModel::FileNameColumn);
|
||||
break;
|
||||
// FIXME: there is no size column due to an oversight
|
||||
case SizeColumn:
|
||||
mappedIndex = index.siblingAtColumn(ResourceFolderModel::SizeColumn);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -134,6 +141,7 @@ QVariant DataPackFolderModel::headerData(int section, [[maybe_unused]] Qt::Orien
|
|||
case PackFormatColumn:
|
||||
case DateColumn:
|
||||
case ImageColumn:
|
||||
case SizeColumn:
|
||||
case FileNameColumn:
|
||||
return columnNames().at(section);
|
||||
default:
|
||||
|
|
@ -151,6 +159,8 @@ QVariant DataPackFolderModel::headerData(int section, [[maybe_unused]] Qt::Orien
|
|||
return tr("The data pack format ID, as well as the Minecraft versions it was designed for.");
|
||||
case DateColumn:
|
||||
return tr("The date and time this data pack was last changed (or added).");
|
||||
case SizeColumn:
|
||||
return tr("The size of the data pack.");
|
||||
case FileNameColumn:
|
||||
return tr("The file name of the data pack.");
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -43,7 +43,16 @@
|
|||
class DataPackFolderModel : public ResourceFolderModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns : std::uint8_t { ActiveColumn = 0, ImageColumn, NameColumn, PackFormatColumn, DateColumn, FileNameColumn, NumColumns };
|
||||
enum Columns : std::uint8_t {
|
||||
ActiveColumn = 0,
|
||||
ImageColumn,
|
||||
NameColumn,
|
||||
PackFormatColumn,
|
||||
DateColumn,
|
||||
SizeColumn,
|
||||
FileNameColumn,
|
||||
NumColumns
|
||||
};
|
||||
|
||||
explicit DataPackFolderModel(const QString& dir, BaseInstance* instance, bool isIndexed, bool createDir, QObject* parent = nullptr);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue