diff --git a/launcher/ui/pages/instance/ServersPage.cpp b/launcher/ui/pages/instance/ServersPage.cpp index f616a5b22..59ae6e43f 100644 --- a/launcher/ui/pages/instance/ServersPage.cpp +++ b/launcher/ui/pages/instance/ServersPage.cpp @@ -112,11 +112,7 @@ struct Server { QByteArray m_icon; // Data - temporary - bool m_checked = false; - bool m_up = false; - QString m_motd; // https://mctools.org/motd-creator std::optional m_currentPlayers; // nullopt if not calculated/calculating - int m_maxPlayers = 0; }; static std::unique_ptr parseServersDat(const QString& filename) @@ -312,37 +308,33 @@ class ServersModel : public QAbstractListModel { switch (role) { case Qt::DecorationRole: { - switch (column) { - case 0: { - auto& bytes = m_servers[row].m_icon; - if (bytes.size()) { - QPixmap px; - if (px.loadFromData(bytes)) - return QIcon(px); - } - return QIcon::fromTheme("unknown_server"); + if (column == 0) { + auto& bytes = m_servers[row].m_icon; + if (bytes.size()) { + QPixmap px; + if (px.loadFromData(bytes)) + return QIcon(px); } + return QIcon::fromTheme("unknown_server"); + } else { + return QVariant(); + } + } + case Qt::DisplayRole: + switch (column) { + case 0: + return m_servers[row].m_name; case 1: return m_servers[row].m_address; - default: - return QVariant(); - } - case 2: - if (role == Qt::DisplayRole) { + case 2: if (m_servers[row].m_currentPlayers) { return *m_servers[row].m_currentPlayers; } else { return "..."; } - } else { + default: return QVariant(); - } - } - case Qt::DisplayRole: - if (column == 0) - return m_servers[row].m_name; - else - return QVariant(); + } case ServerPtrRole: if (column == 0) return QVariant::fromValue((void*)&m_servers[row]);