mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-04-29 22:24:26 +02:00
Make deleting a verb
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
parent
45368fbf2f
commit
11a0dbf810
@ -93,7 +93,7 @@ QString askToUpdateInstanceDirName(InstancePtr instance, QWidget* parent)
|
||||
}
|
||||
|
||||
// Check for linked instances
|
||||
if (!checkLinkedInstances(instance->id(), parent))
|
||||
if (!checkLinkedInstances(instance->id(), parent, QObject::tr("Renaming")))
|
||||
return QString();
|
||||
|
||||
// Now we can confirm that a renaming is happening
|
||||
@ -109,17 +109,18 @@ QString askToUpdateInstanceDirName(InstancePtr instance, QWidget* parent)
|
||||
return newRoot;
|
||||
}
|
||||
|
||||
bool checkLinkedInstances(const QString& id, QWidget* parent)
|
||||
bool checkLinkedInstances(const QString& id, QWidget* parent, const QString& verb)
|
||||
{
|
||||
auto linkedInstances = APPLICATION->instances()->getLinkedInstancesById(id);
|
||||
if (!linkedInstances.empty()) {
|
||||
auto response = CustomMessageBox::selectable(parent, QObject::tr("There are linked instances"),
|
||||
QObject::tr("The following instance(s) might reference files in this instance:\n\n"
|
||||
"%1\n\n"
|
||||
"Deleting it could break the other instance(s), \n\n"
|
||||
"%2 it could break the other instance(s), \n\n"
|
||||
"Do you wish to proceed?",
|
||||
nullptr, linkedInstances.count())
|
||||
.arg(linkedInstances.join("\n")),
|
||||
.arg(linkedInstances.join("\n"))
|
||||
.arg(verb),
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
if (response != QMessageBox::Yes)
|
||||
|
@ -43,4 +43,4 @@
|
||||
QString askToUpdateInstanceDirName(InstancePtr instance, QWidget* parent);
|
||||
|
||||
/// Check if there are linked instances, and display a warning; return true if the operation should proceed
|
||||
bool checkLinkedInstances(const QString& id, QWidget* parent);
|
||||
bool checkLinkedInstances(const QString& id, QWidget* parent, const QString& verb);
|
||||
|
@ -1396,7 +1396,7 @@ void MainWindow::on_actionDeleteInstance_triggered()
|
||||
if (response != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
if (!checkLinkedInstances(id, this))
|
||||
if (!checkLinkedInstances(id, this, tr("Deleting")))
|
||||
return;
|
||||
|
||||
if (APPLICATION->instances()->trashInstance(id)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user