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

Method removeItems

launcher/ui/pages/instance/ModFolderPage.cpp:128–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void ModFolderPage::removeItems(const QItemSelection& selection)
129{
130 if (m_instance != nullptr && m_instance->isRunning()) {
131 auto response = CustomMessageBox::selectable(this, tr("Confirm Delete"),
132 tr("If you remove mods while the game is running it may crash your game.\n"
133 "Are you sure you want to do this?"),
134 QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
135 ->exec();
136
137 if (response != QMessageBox::Yes)
138 return;
139 }
140
141 auto indexes = selection.indexes();
142 auto affected = m_model->getAffectedMods(indexes, EnableAction::DISABLE);
143 if (!affected.isEmpty()) {
144 auto response = CustomMessageBox::selectable(this, tr("Confirm Disable"),
145 tr("The mods you are trying to delete are required by %1 mods.\n"
146 "Do you want to disable them?")
147 .arg(affected.length()),
148 QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
149 QMessageBox::Cancel)
150 ->exec();
151
152 if (response == QMessageBox::Cancel) {
153 return;
154 }
155 if (response == QMessageBox::Yes) {
156 m_model->setResourceEnabled(affected, EnableAction::DISABLE);
157 }
158 }
159 m_model->deleteResources(indexes);
160}
161
162void ModFolderPage::downloadMods()
163{

Callers

nothing calls this directly

Calls 7

selectableFunction · 0.85
getAffectedModsMethod · 0.80
isRunningMethod · 0.45
execMethod · 0.45
isEmptyMethod · 0.45
setResourceEnabledMethod · 0.45
deleteResourcesMethod · 0.45

Tested by

no test coverage detected