From 1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 21 Feb 2016 01:44:27 +0100 Subject: GH-1453 report version file problems in the version page --- logic/minecraft/MinecraftProfile.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'logic/minecraft/MinecraftProfile.cpp') diff --git a/logic/minecraft/MinecraftProfile.cpp b/logic/minecraft/MinecraftProfile.cpp index 4f33920b..360fa575 100644 --- a/logic/minecraft/MinecraftProfile.cpp +++ b/logic/minecraft/MinecraftProfile.cpp @@ -295,6 +295,8 @@ QVariant MinecraftProfile::data(const QModelIndex &index, int role) const if (row < 0 || row >= VersionPatches.size()) return QVariant(); + auto patch = VersionPatches.at(row); + if (role == Qt::DisplayRole) { switch (column) @@ -303,7 +305,6 @@ QVariant MinecraftProfile::data(const QModelIndex &index, int role) const return VersionPatches.at(row)->getPatchName(); case 1: { - auto patch = VersionPatches.at(row); if(patch->isCustom()) { return QString("%1 (Custom)").arg(patch->getPatchVersion()); @@ -317,6 +318,29 @@ QVariant MinecraftProfile::data(const QModelIndex &index, int role) const return QVariant(); } } + if(role == Qt::DecorationRole) + { + switch(column) + { + case 0: + { + auto severity = patch->getProblemSeverity(); + switch (severity) + { + case PROBLEM_WARNING: + return "warning"; + case PROBLEM_ERROR: + return "error"; + default: + return QVariant(); + } + } + default: + { + return QVariant(); + } + } + } return QVariant(); } QVariant MinecraftProfile::headerData(int section, Qt::Orientation orientation, int role) const -- cgit v1.2.3