예제 #1
0
void DeviceList::instanceLoadedProfiles(DeviceInstance* dev) {
	emit profilesLoaded(dev->getInstance());
}
예제 #2
0
void ProfileManager::eventLoopStarted()
{
	QSettings settings;

	for (int i = 0 ; true ; i++) {
		if (!settings.contains(QString("profile%1/name").arg(i))) {
			break;
		}

		Profile* profile = new Profile(settings.value(QString("profile%1/name").arg(i)).toString());

		GameInfo::VersionMode ver;

		QString verStr = settings.value(QString("profile%1/version").arg(i)).toString();

		if (verStr == "gta3")
			ver = GameInfo::GTAIII;
		else if (verStr == "gtavc")
			ver = GameInfo::GTAVC;
		else
			ver = GameInfo::GTASA;

		GameInfo info(ver, File(settings.value(QString("profile%1/root").arg(i)).toString().toLocal8Bit().constData()));
		profile->setGameInfo(info);

		for (int j = 0 ; true ; j++) {
			if (!settings.contains(QString("profile%1/resource%2").arg(i).arg(j))) {
				break;
			}

			QString resource = settings.value(QString("profile%1/resource%2").arg(i).arg(j)).toString();
			profile->addResource(File(resource.toLocal8Bit().constData()));
		}

		for (int j = 0 ; true ; j++) {
			if (!settings.contains(QString("profile%1/search_resource%2").arg(i).arg(j))) {
				break;
			}

			QString resource = settings.value(QString("profile%1/search_resource%2").arg(i).arg(j)).toString();
			profile->addSearchResource(File(resource.toLocal8Bit().constData()));
		}

		for (int j = 0 ; true ; j++) {
			if (!settings.contains(QString("profile%1/dat_file%2").arg(i).arg(j))) {
				break;
			}

			QString datFile = settings.value(QString("profile%1/dat_file%2").arg(i).arg(j)).toString();
			profile->addDATFile(File(datFile.toLocal8Bit().constData()));
		}

		addProfile(profile);
	}

	int currentProfileIdx = settings.value("main/current_profile", -1).toInt();

	if (currentProfileIdx != -1) {
		setCurrentProfile(getProfile(currentProfileIdx));
	} else {
		setCurrentProfile(NULL);
	}

	emit profilesLoaded();
}