summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--logic/InstanceList.cpp6
-rw-r--r--logic/InstanceList.h11
2 files changed, 13 insertions, 4 deletions
diff --git a/logic/InstanceList.cpp b/logic/InstanceList.cpp
index 5a988fd3..8a68c334 100644
--- a/logic/InstanceList.cpp
+++ b/logic/InstanceList.cpp
@@ -283,9 +283,9 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap)
}
}
-QList<FTBRecord> InstanceList::discoverFTBInstances()
+QSet<FTBRecord> InstanceList::discoverFTBInstances()
{
- QList<FTBRecord> records;
+ QSet<FTBRecord> 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<FTBRecord> 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 f0bbb7ec..b88a080e 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<QString, QString> &groupList);
- QList<FTBRecord> discoverFTBInstances();
+ QSet<FTBRecord> discoverFTBInstances();
void loadFTBInstances(QMap<QString, QString> &groupMap, QList<InstancePtr> & tempList);
private