Manager: Add display name to new machine wizard

This commit is contained in:
Alexander Babikov
2025-08-08 00:52:16 +05:00
parent 7b5a861005
commit fcf85d40a6
4 changed files with 33 additions and 3 deletions

View File

@@ -355,12 +355,13 @@ VMManagerMain::newMachineWizard()
const auto systemDir = QDir(vmm_path).path();
#endif
const auto existingConfiguration = wizard->field("existingConfiguration").toString();
addNewSystem(newName, systemDir, existingConfiguration);
const auto displayName = wizard->field("displayName").toString();
addNewSystem(newName, systemDir, displayName, existingConfiguration);
}
}
void
VMManagerMain::addNewSystem(const QString &name, const QString &dir, const QString &configFile)
VMManagerMain::addNewSystem(const QString &name, const QString &dir, const QString &displayName, const QString &configFile)
{
const auto newSytemDirectory = QDir(QDir::cleanPath(dir + "/" + name));
@@ -423,6 +424,8 @@ VMManagerMain::addNewSystem(const QString &name, const QString &dir, const QStri
delete new_system;
return;
}
auto added_system = vm_model->getConfigObjectForIndex(created_object);
added_system->setDisplayName(displayName);
// Get the index of the newly-created system and select it
const QModelIndex mapped_index = proxy_model->mapFromSource(created_object);
ui->listView->setCurrentIndex(mapped_index);