Пример #1
0
void MainWindow::load()
{
	console = new CConsoleHandler;
	CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() / "VCMI_Launcher_log.txt", console);
	logConfig.configureDefault();

	CResourceHandler::initialize();
	CResourceHandler::load("config/filesystem.json");

	for (auto & string : VCMIDirs::get().dataPaths())
		QDir::addSearchPath("icons", pathToQString(string / "launcher" / "icons"));
	QDir::addSearchPath("icons", pathToQString(VCMIDirs::get().userDataPath() / "launcher" / "icons"));

	settings.init();
}
Пример #2
0
void CModManager::loadMods()
{
	CModHandler handler;
	handler.loadMods();
	auto installedMods = handler.getAllMods();

	for(auto modname : installedMods)
	{
		ResourceID resID(CModInfo::getModFile(modname));
		if(CResourceHandler::get()->existsResource(resID))
		{
			boost::filesystem::path name = *CResourceHandler::get()->getResourceName(resID);
			auto mod = JsonUtils::JsonFromFile(pathToQString(name));
			localMods.insert(QString::fromUtf8(modname.c_str()).toLower(), mod);
		}
	}
	modList->setLocalModList(localMods);
}
Пример #3
0
bool CModManager::doUninstallMod(QString modname)
{
	ResourceID resID(std::string("Mods/") + modname.toUtf8().data(), EResType::DIRECTORY);
	// Get location of the mod, in case-insensitive way
	QString modDir = pathToQString(*CResourceHandler::get()->getResourceName(resID));

	if(!QDir(modDir).exists())
		return addError(modname, "Data with this mod was not found");

	if(!localMods.contains(modname))
		return addError(modname, "Data with this mod was not found");

	if(!removeModDir(modDir))
		return addError(modname, "Failed to delete mod data");

	localMods.remove(modname);
	modList->setLocalModList(localMods);
	modList->modChanged(modname);

	return true;
}
Пример #4
0
QString CModManager::settingsPath()
{
	return pathToQString(VCMIDirs::get().userConfigPath() / "modSettings.json");
}
Пример #5
0
void MainWindow::on_startGameButon_clicked()
{
	startExecutable(pathToQString(VCMIDirs::get().clientPath()));
}