MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / data

Method data

launcher/minecraft/mod/ModFolderModel.cpp:57–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57QVariant ModFolderModel::data(const QModelIndex &index, int role) const
58{
59 if (!validateIndex(index))
60 return {};
61
62 int row = index.row();
63 int column = index.column();
64
65 switch (role)
66 {
67 case Qt::DisplayRole:
68 switch (column)
69 {
70 case NameColumn:
71 return m_resources[row]->name();
72 case VersionColumn: {
73 switch(m_resources[row]->type()) {
74 case ResourceType::FOLDER:
75 return tr("Folder");
76 case ResourceType::SINGLEFILE:
77 return tr("File");
78 default:
79 break;
80 }
81 return at(row)->version();
82 }
83 case DateColumn:
84 return m_resources[row]->dateTimeChanged();
85 case ModUpdateColumn:
86 if(at(row)->metadata() && at(row)->metadata()->hasDoUpdates() && at(row)->metadata()->do_updates == "true") {
87 return QChar(11123);
88 } else if(!at(row)->metadata()) {
89 return QChar(11198);
90 }
91 return QString();
92 default:
93 return QVariant();
94 }
95
96 case Qt::ToolTipRole:
97 return m_resources[row]->internal_id();
98
99 case Qt::CheckStateRole:
100 switch (column)
101 {
102 case ActiveColumn:
103 return at(row)->enabled() ? Qt::Checked : Qt::Unchecked;
104 default:
105 return QVariant();
106 }
107 default:
108 return QVariant();
109 }
110}
111
112QVariant ModFolderModel::headerData(int section, Qt::Orientation orientation, int role) const
113{

Callers

nothing calls this directly

Calls 9

QStringClass · 0.85
dateTimeChangedMethod · 0.80
metadataMethod · 0.80
hasDoUpdatesMethod · 0.80
internal_idMethod · 0.80
enabledMethod · 0.80
nameMethod · 0.45
typeMethod · 0.45
versionMethod · 0.45

Tested by

no test coverage detected