diff --git a/logic/InstanceList.cpp b/logic/InstanceList.cpp index 5a988fd3a..8a68c334a 100644 --- a/logic/InstanceList.cpp +++ b/logic/InstanceList.cpp @@ -283,9 +283,9 @@ void InstanceList::loadGroupList(QMap &groupMap) } } -QList InstanceList::discoverFTBInstances() +QSet InstanceList::discoverFTBInstances() { - QList records; + QSet records; QDir dir = QDir(MMC->settings()->get("FTBLauncherDataRoot").toString()); QDir dataDir = QDir(MMC->settings()->get("FTBRoot").toString()); if (!dataDir.exists()) @@ -333,7 +333,7 @@ QList InstanceList::discoverFTBInstances() record.logo = attrs.value("logo").toString(); record.mcVersion = attrs.value("mcVersion").toString(); record.description = attrs.value("description").toString(); - records.append(record); + records.insert(record); } break; } diff --git a/logic/InstanceList.h b/logic/InstanceList.h index f0bbb7ec0..b88a080ed 100644 --- a/logic/InstanceList.h +++ b/logic/InstanceList.h @@ -36,14 +36,23 @@ struct FTBRecord QString description; QString instanceDir; QString templateDir; + bool operator ==(const FTBRecord other) const + { + return instanceDir == other.instanceDir; + } }; +inline uint qHash(FTBRecord record) +{ + return qHash(record.instanceDir); +} + class InstanceList : public QAbstractListModel { Q_OBJECT private: void loadGroupList(QMap &groupList); - QList discoverFTBInstances(); + QSet discoverFTBInstances(); void loadFTBInstances(QMap &groupMap, QList & tempList); private