MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / fetchFlameKey

Method fetchFlameKey

launcher/ui/GuiUtil.cpp:53–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51#include <BuildConfig.h>
52
53QString GuiUtil::fetchFlameKey(QWidget *parentWidget)
54{
55 if (BuildConfig.FLAME_API_KEY_API_URL.isEmpty())
56 return "";
57
58 ProgressDialog prog(parentWidget);
59 auto flameKeyTask = std::make_unique<FetchFlameAPIKey>();
60 prog.execWithTask(flameKeyTask.get());
61
62 if (!flameKeyTask->wasSuccessful())
63 {
64 auto message = QObject::tr("Fetching the Curseforge API key failed. Reason: %1").arg(flameKeyTask->failReason());
65 if (!(APPLICATION->capabilities() & Application::SupportsFlame))
66 {
67 message += "\n\n" + QObject::tr("Downloading Curseforge modpacks will not work unless you manually set a valid Curseforge Core API key in the settings.");
68 }
69
70 CustomMessageBox::selectable(parentWidget,
71 QObject::tr("Failed to fetch Curseforge API key."),
72 message, QMessageBox::Critical)->exec();
73 }
74
75 return flameKeyTask->m_result;
76}
77
78QString GuiUtil::uploadPaste(const QString &text, QWidget *parentWidget)
79{

Callers

nothing calls this directly

Calls 8

selectableFunction · 0.85
isEmptyMethod · 0.80
execWithTaskMethod · 0.80
wasSuccessfulMethod · 0.80
failReasonMethod · 0.80
capabilitiesMethod · 0.80
getMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected