mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 05:07:46 +02:00
Add link instance detection
Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
@ -1379,20 +1379,8 @@ void MainWindow::on_actionDeleteInstance_triggered()
|
||||
if (response != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
auto linkedInstances = APPLICATION->instances()->getLinkedInstancesById(id);
|
||||
if (!linkedInstances.empty()) {
|
||||
response = CustomMessageBox::selectable(this, tr("There are linked instances"),
|
||||
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"
|
||||
"Do you wish to proceed?",
|
||||
nullptr, linkedInstances.count())
|
||||
.arg(linkedInstances.join("\n")),
|
||||
QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
|
||||
->exec();
|
||||
if (response != QMessageBox::Yes)
|
||||
return;
|
||||
}
|
||||
if (!checkLinkedInstances(id, this))
|
||||
return;
|
||||
|
||||
if (APPLICATION->instances()->trashInstance(id)) {
|
||||
ui->actionUndoTrashInstance->setEnabled(APPLICATION->instances()->trashedSomething());
|
||||
@ -1705,7 +1693,7 @@ void MainWindow::instanceDataChanged(const QModelIndex& topLeft, const QModelInd
|
||||
QItemSelection test(topLeft, bottomRight);
|
||||
if (test.contains(current)) {
|
||||
instanceChanged(current, current);
|
||||
if (m_selectedInstance && askToUpdateInstanceDirName(APPLICATION->settings(), m_selectedInstance, this)) {
|
||||
if (m_selectedInstance && askToUpdateInstanceDirName(m_selectedInstance, this)) {
|
||||
auto newID = m_selectedInstance->name();
|
||||
refreshInstances();
|
||||
setSelectedInstanceById(newID);
|
||||
|
Reference in New Issue
Block a user