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; }
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); }