Exemple #1
0
void Installer::FormatFromSetting(AvailableSoftWare::SoftWareMap& softMap, const AppsConfig::AppMap& setting) {
    for (AppsConfig::AppMap::const_iterator appIter = setting.begin(); appIter != setting.end(); ++appIter) {
        AppsConfig::AppVersion::const_iterator iter = appIter.value().begin();
        if (iter == appIter.value().end())
            continue;

        const AppConfig& appConfig = iter.value();

        SoftWare soft;
        soft.m_CurVersion = appConfig.m_Version;
        soft.m_RunPath = appConfig.m_RunPath;
        softMap[appConfig.m_Name] = soft;
    }
}
Exemple #2
0
void Installer::FormatFromUpdate(AvailableSoftWare::SoftWareMap& softMap, const AppsConfig::AppMap& update) {
    for (AppsConfig::AppMap::const_iterator appIter = update.begin(); appIter != update.end(); ++appIter) {
        for (AppsConfig::AppVersion::const_iterator iter = appIter.value().begin();
             iter != appIter.value().end();
             ++iter) {
            const AppConfig& appConfig = iter.value();

            if (softMap.contains(appConfig.m_Name)) {
                softMap[appConfig.m_Name].m_AvailableVersion.insert(appConfig.m_Version);
            } else {
                SoftWare soft;
                soft.m_AvailableVersion.insert(appConfig.m_Version);
                softMap[appConfig.m_Name] = soft;
            }
            if (Settings::GetVersion(softMap[appConfig.m_Name].m_NewVersion) != Settings::GetVersion(appConfig.m_Version))
                softMap[appConfig.m_Name].m_NewVersion = appConfig.m_Version;
        }
    }
}
Exemple #3
0
void Settings::EmitAppConfig(YAML::Emitter& emitter, const char* appType, const AppsConfig::AppMap& appsMap) {
    if (appsMap.size()) {
        emitter << YAML::Key << appType;
        emitter << YAML::Value;
        emitter << YAML::BeginMap;
        for (AppsConfig::AppMap::const_iterator appIter = appsMap.begin(); appIter != appsMap.end(); ++appIter) {
            AppsConfig::AppVersion::const_iterator iter = appIter.value().begin();
            if (iter == appIter.value().end())
                continue;

            const AppConfig& config = iter.value();
            emitter << YAML::Key << config.m_Name.toStdString();
            emitter << YAML::Value;
            emitter << YAML::BeginMap;
            emitter << YAML::Key << VERSION;
            emitter << YAML::Value << config.m_Version.toStdString();
            emitter << YAML::Key << RUN_PATH;
            emitter << YAML::Value << config.m_RunPath.toStdString();
            emitter << YAML::Key << INSTALL_CMD;
            emitter << YAML::Value << config.m_InstallCmd.toStdString();
            emitter << YAML::Key << UNINSTALL_CMD;
            emitter << YAML::Value << config.m_UninstallCmd.toStdString();
            emitter << YAML::Key << INSTALL_PARAMS;
            emitter << YAML::Value << config.m_InstallParams.toStdString();
            emitter << YAML::Key << UNINSTALL_PARAMS;
            emitter << YAML::Value << config.m_UninstallParams.toStdString();

            if (config.m_InstalledFiles.size()) {
                emitter << YAML::Key << INSTALLED_FILES;
                emitter << YAML::Value;
                emitter << YAML::BeginSeq;
                for (int i = 0; i < config.m_InstalledFiles.size(); i++) {
                    emitter << config.m_InstalledFiles.at(i).toStdString();
                }
                emitter << YAML::EndSeq;
            }
            emitter << YAML::EndMap;
        }
        emitter << YAML::EndMap;
    }
}