Manager: Add display name to new machine wizard
This commit is contained in:
@@ -261,6 +261,12 @@ NameAndLocationPage(QWidget *parent)
|
|||||||
systemLocationValidation->setWordWrap(true);
|
systemLocationValidation->setWordWrap(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const auto displayNameLabel = new QLabel(tr("Display Name (optional)"));
|
||||||
|
displayName = new QLineEdit();
|
||||||
|
// Special event filter to override enter key
|
||||||
|
displayName->installEventFilter(this);
|
||||||
|
registerField("displayName*", displayName);
|
||||||
|
|
||||||
const auto layout = new QGridLayout();
|
const auto layout = new QGridLayout();
|
||||||
layout->addWidget(topLabel, 0, 0, 1, -1);
|
layout->addWidget(topLabel, 0, 0, 1, -1);
|
||||||
// Spacer row
|
// Spacer row
|
||||||
@@ -283,6 +289,11 @@ NameAndLocationPage(QWidget *parent)
|
|||||||
layout->setRowMinimumHeight(6, 20);
|
layout->setRowMinimumHeight(6, 20);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Another spacer
|
||||||
|
layout->setRowMinimumHeight(7, 20);
|
||||||
|
layout->addWidget(displayNameLabel, 8, 0);
|
||||||
|
layout->addWidget(displayName, 8, 1);
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
#ifdef CUSTOM_SYSTEM_LOCATION
|
#ifdef CUSTOM_SYSTEM_LOCATION
|
||||||
@@ -382,6 +393,10 @@ ConclusionPage(QWidget *parent)
|
|||||||
systemLocation = new QLabel();
|
systemLocation = new QLabel();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
displayNameLabel = new QLabel(tr("Display name:"));
|
||||||
|
displayNameLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||||
|
displayName = new QLabel();
|
||||||
|
|
||||||
const auto layout = new QGridLayout();
|
const auto layout = new QGridLayout();
|
||||||
layout->addWidget(topLabel, 0, 0, 1, -1);
|
layout->addWidget(topLabel, 0, 0, 1, -1);
|
||||||
layout->setRowMinimumHeight(1, 20);
|
layout->setRowMinimumHeight(1, 20);
|
||||||
@@ -391,6 +406,8 @@ ConclusionPage(QWidget *parent)
|
|||||||
layout->addWidget(systemLocationLabel, 3, 0);
|
layout->addWidget(systemLocationLabel, 3, 0);
|
||||||
layout->addWidget(systemLocation, 3, 1);
|
layout->addWidget(systemLocation, 3, 1);
|
||||||
#endif
|
#endif
|
||||||
|
layout->addWidget(displayNameLabel, 4, 0);
|
||||||
|
layout->addWidget(displayName, 4, 1);
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
}
|
}
|
||||||
@@ -404,9 +421,16 @@ ConclusionPage::initializePage()
|
|||||||
const auto nativePath = QDir::toNativeSeparators(finalPath);
|
const auto nativePath = QDir::toNativeSeparators(finalPath);
|
||||||
#endif
|
#endif
|
||||||
const auto systemNameDisplay = field("systemName").toString();
|
const auto systemNameDisplay = field("systemName").toString();
|
||||||
|
const auto displayNameDisplay = field("displayName").toString();
|
||||||
|
|
||||||
systemName->setText(systemNameDisplay);
|
systemName->setText(systemNameDisplay);
|
||||||
#ifdef CUSTOM_SYSTEM_LOCATION
|
#ifdef CUSTOM_SYSTEM_LOCATION
|
||||||
systemLocation->setText(nativePath);
|
systemLocation->setText(nativePath);
|
||||||
#endif
|
#endif
|
||||||
|
if (!displayNameDisplay.isEmpty())
|
||||||
|
displayName->setText(displayNameDisplay);
|
||||||
|
else {
|
||||||
|
displayNameLabel->setVisible(false);
|
||||||
|
displayName->setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ private:
|
|||||||
#ifdef CUSTOM_SYSTEM_LOCATION
|
#ifdef CUSTOM_SYSTEM_LOCATION
|
||||||
QLineEdit *systemLocation;
|
QLineEdit *systemLocation;
|
||||||
#endif
|
#endif
|
||||||
|
QLineEdit *displayName;
|
||||||
QLabel *systemNameValidation;
|
QLabel *systemNameValidation;
|
||||||
#ifdef CUSTOM_SYSTEM_LOCATION
|
#ifdef CUSTOM_SYSTEM_LOCATION
|
||||||
QLabel *systemLocationValidation;
|
QLabel *systemLocationValidation;
|
||||||
@@ -116,6 +117,8 @@ private:
|
|||||||
#ifdef CUSTOM_SYSTEM_LOCATION
|
#ifdef CUSTOM_SYSTEM_LOCATION
|
||||||
QLabel *systemLocation;
|
QLabel *systemLocation;
|
||||||
#endif
|
#endif
|
||||||
|
QLabel *displayNameLabel;
|
||||||
|
QLabel *displayName;
|
||||||
protected:
|
protected:
|
||||||
void initializePage() override;
|
void initializePage() override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -355,12 +355,13 @@ VMManagerMain::newMachineWizard()
|
|||||||
const auto systemDir = QDir(vmm_path).path();
|
const auto systemDir = QDir(vmm_path).path();
|
||||||
#endif
|
#endif
|
||||||
const auto existingConfiguration = wizard->field("existingConfiguration").toString();
|
const auto existingConfiguration = wizard->field("existingConfiguration").toString();
|
||||||
addNewSystem(newName, systemDir, existingConfiguration);
|
const auto displayName = wizard->field("displayName").toString();
|
||||||
|
addNewSystem(newName, systemDir, displayName, existingConfiguration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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));
|
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;
|
delete new_system;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
auto added_system = vm_model->getConfigObjectForIndex(created_object);
|
||||||
|
added_system->setDisplayName(displayName);
|
||||||
// Get the index of the newly-created system and select it
|
// Get the index of the newly-created system and select it
|
||||||
const QModelIndex mapped_index = proxy_model->mapFromSource(created_object);
|
const QModelIndex mapped_index = proxy_model->mapFromSource(created_object);
|
||||||
ui->listView->setCurrentIndex(mapped_index);
|
ui->listView->setCurrentIndex(mapped_index);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public slots:
|
|||||||
void shutdownForceButtonPressed() const;
|
void shutdownForceButtonPressed() const;
|
||||||
void searchSystems(const QString &text) const;
|
void searchSystems(const QString &text) const;
|
||||||
void newMachineWizard();
|
void newMachineWizard();
|
||||||
void addNewSystem(const QString &name, const QString &dir, const QString &configFile = {});
|
void addNewSystem(const QString &name, const QString &dir, const QString &displayName = QString(), const QString &configFile = {});
|
||||||
#if __GNUC__ >= 11
|
#if __GNUC__ >= 11
|
||||||
[[nodiscard]] QStringList getSearchCompletionList() const;
|
[[nodiscard]] QStringList getSearchCompletionList() const;
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user