diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2023-07-09 22:10:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-09 22:10:43 +0100 |
commit | f816e3cd3fff4e27ec4f66db9f98bddab2efd1c9 (patch) | |
tree | fffbb9e9898f58b1f98d682bca3cf5024d40512e /launcher/ui/pages/instance/ExternalResourcesPage.cpp | |
parent | 49109b9213a14718316e1e6328f37b4e86599dd4 (diff) | |
parent | bc2940e16a8a7839a120a45be9232b5adebbe751 (diff) | |
download | PrismLauncher-f816e3cd3fff4e27ec4f66db9f98bddab2efd1c9.tar.gz PrismLauncher-f816e3cd3fff4e27ec4f66db9f98bddab2efd1c9.tar.bz2 PrismLauncher-f816e3cd3fff4e27ec4f66db9f98bddab2efd1c9.zip |
Merge pull request #1241 from Trial97/settings
Allow editing of running instances
Diffstat (limited to 'launcher/ui/pages/instance/ExternalResourcesPage.cpp')
-rw-r--r-- | launcher/ui/pages/instance/ExternalResourcesPage.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp index 173bcb66..12038f88 100644 --- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp +++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp @@ -151,9 +151,6 @@ void ExternalResourcesPage::retranslate() void ExternalResourcesPage::itemActivated(const QModelIndex&) { - if (!m_controlsEnabled) - return; - auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()); } @@ -197,9 +194,6 @@ bool ExternalResourcesPage::eventFilter(QObject* obj, QEvent* ev) void ExternalResourcesPage::addItem() { - if (!m_controlsEnabled) - return; - auto list = GuiUtil::BrowseForFiles( helpPage(), tr("Select %1", "Select whatever type of files the page contains. Example: 'Loader Mods'").arg(displayName()), m_fileSelectionFilter.arg(displayName()), APPLICATION->settings()->get("CentralModsDir").toString(), this->parentWidget()); @@ -213,9 +207,6 @@ void ExternalResourcesPage::addItem() void ExternalResourcesPage::removeItem() { - if (!m_controlsEnabled) - return; - auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()); int count = 0; @@ -259,23 +250,37 @@ void ExternalResourcesPage::removeItem() void ExternalResourcesPage::removeItems(const QItemSelection& selection) { + if (m_instance != nullptr && m_instance->isRunning()) { + auto response = CustomMessageBox::selectable(this, "Confirm Delete", + "If you remove this resource while the game is running it may crash your game.\n" + "Are you sure you want to do this?", + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) + ->exec(); + + if (response != QMessageBox::Yes) + return; + } m_model->deleteResources(selection.indexes()); } void ExternalResourcesPage::enableItem() { - if (!m_controlsEnabled) - return; - auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()); m_model->setResourceEnabled(selection.indexes(), EnableAction::ENABLE); } void ExternalResourcesPage::disableItem() { - if (!m_controlsEnabled) - return; + if (m_instance != nullptr && m_instance->isRunning()) { + auto response = CustomMessageBox::selectable(this, "Confirm disable", + "If you disable this resource while the game is running it may crash your game.\n" + "Are you sure you want to do this?", + QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) + ->exec(); + if (response != QMessageBox::Yes) + return; + } auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()); m_model->setResourceEnabled(selection.indexes(), EnableAction::DISABLE); } |