aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/mod
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-06-28 18:28:25 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-06-28 18:28:25 +0300
commit0f64ee6a5f6d157e493d474b74004a4ebd0dae43 (patch)
tree40401602be06d89d0b746b66fd9269997ae9444c /launcher/minecraft/mod
parentc23bf2fd226d7e27b33b94b9c3509b1abcaa6fe3 (diff)
downloadPrismLauncher-0f64ee6a5f6d157e493d474b74004a4ebd0dae43.tar.gz
PrismLauncher-0f64ee6a5f6d157e493d474b74004a4ebd0dae43.tar.bz2
PrismLauncher-0f64ee6a5f6d157e493d474b74004a4ebd0dae43.zip
Added warnings for running instances
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/minecraft/mod')
-rw-r--r--launcher/minecraft/mod/ResourceFolderModel.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/launcher/minecraft/mod/ResourceFolderModel.cpp b/launcher/minecraft/mod/ResourceFolderModel.cpp
index 1a56b679..c2c0d178 100644
--- a/launcher/minecraft/mod/ResourceFolderModel.cpp
+++ b/launcher/minecraft/mod/ResourceFolderModel.cpp
@@ -1,14 +1,15 @@
#include "ResourceFolderModel.h"
+#include <QMessageBox>
#include <QCoreApplication>
#include <QDebug>
#include <QFileInfo>
#include <QIcon>
+#include <QMenu>
#include <QMimeData>
#include <QStyle>
#include <QThreadPool>
#include <QUrl>
-#include <QMenu>
#include "Application.h"
#include "FileSystem.h"
@@ -18,6 +19,7 @@
#include "settings/Setting.h"
#include "tasks/Task.h"
+#include "ui/dialogs/CustomMessageBox.h"
ResourceFolderModel::ResourceFolderModel(QDir dir, BaseInstance* instance, QObject* parent, bool create_dir)
: QAbstractListModel(parent), m_dir(dir), m_instance(instance), m_watcher(this)
@@ -451,8 +453,20 @@ bool ResourceFolderModel::setData(const QModelIndex& index, const QVariant& valu
if (row < 0 || row >= rowCount(index.parent()) || !index.isValid())
return false;
- if (role == Qt::CheckStateRole)
+ if (role == Qt::CheckStateRole) {
+ if (m_instance != nullptr && m_instance->isRunning()) {
+ auto response =
+ CustomMessageBox::selectable(nullptr, "Confirm toggle",
+ "If you enable/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 false;
+ }
return setResourceEnabled({ index }, EnableAction::TOGGLE);
+ }
return false;
}