fix: Make world safety nag title text match the action being performed instead of always saying 'Copy World'

Signed-off-by: Robb <computerguy440+gh@gmail.com>
This commit is contained in:
Robb 2022-08-09 16:01:21 -05:00
parent 75f92de8f8
commit cd30f75173
No known key found for this signature in database
GPG Key ID: 3AB49FC501117A0B
2 changed files with 7 additions and 7 deletions

View File

@ -211,7 +211,7 @@ void WorldListPage::on_actionDatapacks_triggered()
return; return;
} }
if(!worldSafetyNagQuestion()) if(!worldSafetyNagQuestion("Open World Datapacks Folder"))
return; return;
auto fullPath = m_worlds->data(index, WorldList::FolderRole).toString(); auto fullPath = m_worlds->data(index, WorldList::FolderRole).toString();
@ -269,7 +269,7 @@ void WorldListPage::on_actionMCEdit_triggered()
return; return;
} }
if(!worldSafetyNagQuestion()) if(!worldSafetyNagQuestion("Open World in MCEdit"))
return; return;
auto fullPath = m_worlds->data(index, WorldList::FolderRole).toString(); auto fullPath = m_worlds->data(index, WorldList::FolderRole).toString();
@ -373,11 +373,11 @@ bool WorldListPage::isWorldSafe(QModelIndex)
return !m_inst->isRunning(); return !m_inst->isRunning();
} }
bool WorldListPage::worldSafetyNagQuestion() bool WorldListPage::worldSafetyNagQuestion(const QString &actionType)
{ {
if(!isWorldSafe(getSelectedWorld())) if(!isWorldSafe(getSelectedWorld()))
{ {
auto result = QMessageBox::question(this, tr("Copy World"), tr("Changing a world while Minecraft is running is potentially unsafe.\nDo you wish to proceed?")); auto result = QMessageBox::question(this, tr("%1").arg(actionType), tr("Changing a world while Minecraft is running is potentially unsafe.\nDo you wish to proceed?"));
if(result == QMessageBox::No) if(result == QMessageBox::No)
{ {
return false; return false;
@ -395,7 +395,7 @@ void WorldListPage::on_actionCopy_triggered()
return; return;
} }
if(!worldSafetyNagQuestion()) if(!worldSafetyNagQuestion("Copy World"))
return; return;
auto worldVariant = m_worlds->data(index, WorldList::ObjectRole); auto worldVariant = m_worlds->data(index, WorldList::ObjectRole);
@ -417,7 +417,7 @@ void WorldListPage::on_actionRename_triggered()
return; return;
} }
if(!worldSafetyNagQuestion()) if(!worldSafetyNagQuestion("Rename World"))
return; return;
auto worldVariant = m_worlds->data(index, WorldList::ObjectRole); auto worldVariant = m_worlds->data(index, WorldList::ObjectRole);

View File

@ -93,7 +93,7 @@ protected:
private: private:
QModelIndex getSelectedWorld(); QModelIndex getSelectedWorld();
bool isWorldSafe(QModelIndex index); bool isWorldSafe(QModelIndex index);
bool worldSafetyNagQuestion(); bool worldSafetyNagQuestion(const QString &actionType);
void mceditError(); void mceditError();
private: private: