summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/WorldList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'logic/minecraft/WorldList.cpp')
-rw-r--r--logic/minecraft/WorldList.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/logic/minecraft/WorldList.cpp b/logic/minecraft/WorldList.cpp
index 7d54c0ba..7066093c 100644
--- a/logic/minecraft/WorldList.cpp
+++ b/logic/minecraft/WorldList.cpp
@@ -66,7 +66,7 @@ void WorldList::internalSort(QList<World> &what)
{
auto predicate = [](const World &left, const World &right)
{
- return left.name().localeAwareCompare(right.name()) < 0;
+ return left.folderName().localeAwareCompare(right.folderName()) < 0;
};
std::sort(what.begin(), what.end(), predicate);
}
@@ -142,7 +142,7 @@ bool WorldList::deleteWorlds(int first, int last)
int WorldList::columnCount(const QModelIndex &parent) const
{
- return 1;
+ return 2;
}
QVariant WorldList::data(const QModelIndex &index, int role) const
@@ -156,20 +156,42 @@ QVariant WorldList::data(const QModelIndex &index, int role) const
if (row < 0 || row >= worlds.size())
return QVariant();
+ auto & world = worlds[row];
switch (role)
{
case Qt::DisplayRole:
switch (column)
{
case NameColumn:
- return worlds[row].name();
+ return world.name();
+
+ case LastPlayedColumn:
+ return world.lastPlayed();
default:
return QVariant();
}
case Qt::ToolTipRole:
- return worlds[row].name();
+ {
+ return world.folderName();
+ }
+ case FolderRole:
+ {
+ return QDir::toNativeSeparators(dir().absoluteFilePath(world.folderName()));
+ }
+ case SeedRole:
+ {
+ return qVariantFromValue<qlonglong>(world.seed());
+ }
+ case NameRole:
+ {
+ return world.name();
+ }
+ case LastPlayedRole:
+ {
+ return world.lastPlayed();
+ }
default:
return QVariant();
}
@@ -184,6 +206,8 @@ QVariant WorldList::headerData(int section, Qt::Orientation orientation, int rol
{
case NameColumn:
return tr("Name");
+ case LastPlayedColumn:
+ return tr("Last Played");
default:
return QVariant();
}
@@ -193,6 +217,8 @@ QVariant WorldList::headerData(int section, Qt::Orientation orientation, int rol
{
case NameColumn:
return tr("The name of the world.");
+ case LastPlayedColumn:
+ return tr("Date and time the world was last played.");
default:
return QVariant();
}