예제 #1
0
파일: cmodmanager.cpp 프로젝트: qdii/vcmi
bool CModManager::doEnableMod(QString mod, bool on)
{
	QJsonValue value(on);
	QJsonObject list = modSettings["activeMods"].toObject();

	list.insert(mod, value);
	modSettings.insert("activeMods", list);

	modList->setModSettings(modSettings["activeMods"].toObject());

	JsonToFile(settingsPath(), modSettings);

	return true;
}
예제 #2
0
void SaveSampleSet(const SampleSet& in, std::string json_path) {
  static Json::Value json;
  for (int i = 0; i < in.size(); ++i) {
    Json::Value jr;
    jr["r"] = DoubleVectorToValue(in[i].rect);
    jr["rn"] = DoubleVectorToValue(in[i].rect_norm);
    jr["crv"] = DoubleVectorToValue(in[i].children_rect_variance);
    jr["tc"] = IntVectorToValue(in[i].text_color_hists);
    jr["ts"] = IntVectorToValue(in[i].text_size_hists);
    jr["pq"] = in[i].pq_gram;
    jr["wpc"] = in[i].words_per_child;

    json.append(jr);
  }
  JsonToFile(json, json_path);
}