Make the FTB packs a set instead of a list.
This commit is contained in:
parent
19278c853b
commit
9b3ae29a36
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user