GH-336 Only allow non running instance renaming

This commit is contained in:
janrupf 2019-06-17 22:49:28 +02:00 committed by Petr Mrázek
parent 14c4df8427
commit f711425bcf
2 changed files with 9 additions and 2 deletions

View File

@ -232,15 +232,21 @@ QString BaseInstance::iconKey() const
void BaseInstance::setName(QString val, bool requestDirChange)
{
if(m_settings->get("name") == val) {
if(m_settings->get("name") == val)
{
return;
}
m_settings->set("name", val);
emit propertiesChanged(this);
if(requestDirChange) {
if(requestDirChange && !isRunning())
{
emit instanceDirChangeRequest(this);
}
else if(requestDirChange && isRunning())
{
qWarning() << "Tried to rename running instance with folder";
}
}
QString BaseInstance::name() const

View File

@ -1831,6 +1831,7 @@ void MainWindow::instanceChanged(const QModelIndex &current, const QModelIndex &
ui->actionLaunchInstanceOffline->setEnabled(m_selectedInstance->canLaunch());
ui->actionExportInstance->setEnabled(m_selectedInstance->canExport());
ui->renameButton->setText(m_selectedInstance->name());
ui->actionRenameInstance->setDisabled(m_selectedInstance->isRunning());
m_statusLeft->setText(m_selectedInstance->getStatusbarDescription());
updateInstanceToolIcon(m_selectedInstance->iconKey());