From 8a0027c73a755849bf5b58c1509c71a543ddb982 Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Sat, 22 Aug 2020 01:34:55 +0200 Subject: NOISSUE Add world icons and world icon reset button --- api/logic/minecraft/WorldList.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'api/logic/minecraft/WorldList.cpp') diff --git a/api/logic/minecraft/WorldList.cpp b/api/logic/minecraft/WorldList.cpp index b7a24434..94b59da4 100644 --- a/api/logic/minecraft/WorldList.cpp +++ b/api/logic/minecraft/WorldList.cpp @@ -136,6 +136,19 @@ bool WorldList::deleteWorlds(int first, int last) return true; } +bool WorldList::resetIcon(int row) +{ + if (row >= worlds.size() || row < 0) + return false; + World &m = worlds[row]; + if(m.resetIcon()) { + emit dataChanged(index(row), index(row), {WorldList::IconFileRole}); + return true; + } + return false; +} + + int WorldList::columnCount(const QModelIndex &parent) const { return 3; @@ -195,6 +208,10 @@ QVariant WorldList::data(const QModelIndex &index, int role) const { return world.lastPlayed(); } + case IconFileRole: + { + return world.iconFile(); + } default: return QVariant(); } -- cgit