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

Function askIfShouldUpdate

launcher/InstanceTask.cpp:26–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26ShouldUpdate askIfShouldUpdate(QWidget* parent, QString original_version_name)
27{
28 if (APPLICATION->settings()->get("SkipModpackUpdatePrompt").toBool())
29 return ShouldUpdate::SkipUpdating;
30
31 auto info = CustomMessageBox::selectable(
32 parent, QObject::tr("Similar modpack was found!"),
33 QObject::tr(
34 "One or more of your instances are from this same modpack%1. Do you want to create a "
35 "separate instance, or update the existing one?\n\nNOTE: Make sure you made a backup of your important instance data before "
36 "updating, as worlds can be corrupted and some configuration may be lost (due to pack overrides).")
37 .arg(original_version_name),
38 QMessageBox::Information, QMessageBox::Cancel);
39 QAbstractButton* update = info->addButton(QObject::tr("Update existing instance"), QMessageBox::AcceptRole);
40 QAbstractButton* skip = info->addButton(QObject::tr("Create new instance"), QMessageBox::ResetRole);
41
42 info->exec();
43
44 if (info->clickedButton() == update)
45 return ShouldUpdate::Update;
46 if (info->clickedButton() == skip)
47 return ShouldUpdate::SkipUpdating;
48 return ShouldUpdate::Cancel;
49}
50
51QString InstanceName::name() const
52{

Callers 2

updateInstanceMethod · 0.85
updateInstanceMethod · 0.85

Calls 4

selectableFunction · 0.85
getMethod · 0.45
settingsMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected