Fix FTB.
Add support of private packs. Fix instance ID problems related to FTB instances.
This commit is contained in:
		@@ -57,7 +57,7 @@ public:
 | 
			
		||||
 | 
			
		||||
	/// The instance's ID. The ID SHALL be determined by MMC internally. The ID IS guaranteed to
 | 
			
		||||
	/// be unique.
 | 
			
		||||
	QString id() const;
 | 
			
		||||
	virtual QString id() const;
 | 
			
		||||
 | 
			
		||||
	/// get the type of this instance
 | 
			
		||||
	QString instanceType() const;
 | 
			
		||||
 
 | 
			
		||||
@@ -14,3 +14,8 @@ bool LegacyFTBInstance::menuActionEnabled(QString action_name) const
 | 
			
		||||
{
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString LegacyFTBInstance::id() const
 | 
			
		||||
{
 | 
			
		||||
	return "FTB/" + BaseInstance::id();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -10,4 +10,5 @@ public:
 | 
			
		||||
							   QObject *parent = 0);
 | 
			
		||||
	virtual QString getStatusbarDescription();
 | 
			
		||||
	virtual bool menuActionEnabled(QString action_name) const;
 | 
			
		||||
	virtual QString id() const;
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -92,6 +92,11 @@ OneSixFTBInstance::OneSixFTBInstance(const QString &rootDir, SettingsObject *set
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString OneSixFTBInstance::id() const
 | 
			
		||||
{
 | 
			
		||||
	return "FTB/" + BaseInstance::id();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString OneSixFTBInstance::getStatusbarDescription()
 | 
			
		||||
{
 | 
			
		||||
	return "OneSix FTB: " + intendedVersionId();
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,8 @@ public:
 | 
			
		||||
 | 
			
		||||
	virtual std::shared_ptr<Task> doUpdate(bool only_prepare) override;
 | 
			
		||||
 | 
			
		||||
	virtual QString id() const;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
	std::shared_ptr<OneSixLibrary> m_forge;
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -308,11 +308,16 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap)
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	dir.cd("ModPacks");
 | 
			
		||||
	auto fpath = dir.absoluteFilePath("modpacks.xml");
 | 
			
		||||
	auto allFiles = dir.entryList(QDir::Readable | QDir::Files, QDir::Name);
 | 
			
		||||
	for(auto filename: allFiles)
 | 
			
		||||
	{
 | 
			
		||||
		if(!filename.endsWith(".xml"))
 | 
			
		||||
			continue;
 | 
			
		||||
		auto fpath = dir.absoluteFilePath(filename);
 | 
			
		||||
		QFile f(fpath);
 | 
			
		||||
		QLOG_INFO() << "Discovering FTB instances -- " << fpath;
 | 
			
		||||
		if (!f.open(QFile::ReadOnly))
 | 
			
		||||
		return;
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		// read the FTB packs XML.
 | 
			
		||||
		QXmlStreamReader reader(&f);
 | 
			
		||||
@@ -347,6 +352,8 @@ void InstanceList::loadForgeInstances(QMap<QString, QString> groupMap)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		f.close();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(!records.size())
 | 
			
		||||
	{
 | 
			
		||||
		QLOG_INFO() << "No FTB instances to load.";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user