MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / getModFileChangelog

Method getModFileChangelog

launcher/modplatform/flame/FlameAPI.cpp:38–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38QString FlameAPI::getModFileChangelog(int modId, int fileId)
39{
40 QEventLoop lock;
41 QString changelog;
42
43 auto netJob = makeShared<NetJob>(QString("Flame::FileChangelog"), APPLICATION->network());
44 auto [action, response] = Net::ApiDownload::makeByteArray(
45 QString(BuildConfig.FLAME_BASE_URL + "/mods/%1/files/%2/changelog")
46 .arg(QString::fromStdString(std::to_string(modId)), QString::fromStdString(std::to_string(fileId))));
47 netJob->addNetAction(action);
48
49 QObject::connect(netJob.get(), &NetJob::succeeded, [&netJob, response, &changelog] {
50 QJsonParseError parse_error{};
51 QJsonDocument doc = QJsonDocument::fromJson(*response, &parse_error);
52 if (parse_error.error != QJsonParseError::NoError) {
53 qWarning() << "Error while parsing JSON response from Flame::FileChangelog at" << parse_error.offset
54 << "reason:" << parse_error.errorString();
55 qWarning() << *response;
56
57 netJob->failed(parse_error.errorString());
58 return;
59 }
60
61 changelog = doc.object()["data"].toString();
62 });
63
64 QObject::connect(netJob.get(), &NetJob::finished, [&lock] { lock.quit(); });
65
66 netJob->start();
67 lock.exec();
68
69 return changelog;
70}
71
72QString FlameAPI::getModDescription(int modId)
73{

Callers 4

suggestVersionMethod · 0.80
checkCandidatesMethod · 0.80

Calls 12

fromStdStringFunction · 0.85
networkMethod · 0.80
addNetActionMethod · 0.80
errorStringMethod · 0.80
objectMethod · 0.80
quitMethod · 0.80
QStringClass · 0.50
getMethod · 0.45
failedMethod · 0.45
toStringMethod · 0.45
startMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected