summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2020-07-28 11:34:21 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2020-07-28 11:34:21 +0000
commit78c6a6bbadfce626ff051e630636453e4b9a96de (patch)
treeff227e9c67958a9876efa9220a81c3762e5808bd
parentf30f8ac5b1310edb548e77f76e6e356449516a33 (diff)
downloadVirtualBox-svn-78c6a6bbadfce626ff051e630636453e4b9a96de.tar.gz
FE/Qt: bugref:9722: !VirtualBox Manager: Allow terminal applications registered via Cloud Console Manager to have own argument without any profiles; Profiles will be overriding argument if created, s.a. r139521.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@85486 cfe28804-0f27-0410-a406-dd0f0b0b656f
-rw-r--r--src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.cpp40
-rw-r--r--src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.h9
-rw-r--r--src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleManager.cpp47
-rw-r--r--src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp1
4 files changed, 89 insertions, 8 deletions
diff --git a/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.cpp b/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.cpp
index 8eb531a121e..2b73f2d909d 100644
--- a/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.cpp
@@ -40,6 +40,8 @@ UICloudConsoleDetailsWidget::UICloudConsoleDetailsWidget(EmbedTo enmEmbedding, Q
, m_pEditorApplicationName(0)
, m_pLabelApplicationPath(0)
, m_pEditorApplicationPath(0)
+ , m_pLabelApplicationArgument(0)
+ , m_pEditorApplicationArgument(0)
, m_pLabelProfileName(0)
, m_pEditorProfileName(0)
, m_pLabelProfileArgument(0)
@@ -94,6 +96,7 @@ void UICloudConsoleDetailsWidget::clearData()
/* Clear widgets: */
m_pEditorApplicationName->setText(QString());
m_pEditorApplicationPath->setText(QString());
+ m_pEditorApplicationArgument->setText(QString());
m_pEditorProfileName->setText(QString());
m_pEditorProfileArgument->setText(QString());
@@ -109,6 +112,7 @@ void UICloudConsoleDetailsWidget::retranslateUi()
/* Translate name-editor labels: */
m_pLabelApplicationName->setText(tr("Name:"));
m_pLabelApplicationPath->setText(tr("Path:"));
+ m_pLabelApplicationArgument->setText(tr("Argument:"));
m_pLabelProfileName->setText(tr("Name:"));
m_pLabelProfileArgument->setText(tr("Argument:"));
/* Translate name-editor: */
@@ -126,6 +130,7 @@ void UICloudConsoleDetailsWidget::retranslateEditor()
/* Translate placeholders: */
m_pEditorApplicationName->setPlaceholderText(tr("Enter a name for this console application..."));
m_pEditorApplicationPath->setPlaceholderText(tr("Enter a path for this console application..."));
+ m_pEditorApplicationArgument->setPlaceholderText(tr("Enter an argument for this console application..."));
m_pEditorProfileName->setPlaceholderText(tr("Enter a name for this console profile..."));
m_pEditorProfileArgument->setPlaceholderText(tr("Enter an argument for this console profile..."));
}
@@ -173,6 +178,17 @@ void UICloudConsoleDetailsWidget::sltApplicationPathChanged(const QString &strPa
updateButtonStates();
}
+void UICloudConsoleDetailsWidget::sltApplicationArgumentChanged(const QString &strArgument)
+{
+ /* Push changes back: */
+ m_newApplicationData.m_strArgument = strArgument;
+
+ /* Revalidate: */
+ revalidate(m_pEditorApplicationArgument);
+ /* Update button states: */
+ updateButtonStates();
+}
+
void UICloudConsoleDetailsWidget::sltProfileNameChanged(const QString &strName)
{
/* Push changes back: */
@@ -248,7 +264,7 @@ void UICloudConsoleDetailsWidget::prepareWidgets()
if (pLayoutApplication)
{
pLayoutApplication->setContentsMargins(0, 0, 0, 0);
- pLayoutApplication->setRowStretch(2, 1);
+ pLayoutApplication->setRowStretch(3, 1);
if (m_enmEmbedding == EmbedTo_Dialog)
{
@@ -314,6 +330,27 @@ void UICloudConsoleDetailsWidget::prepareWidgets()
/* Add into layout: */
pLayoutApplication->addWidget(m_pLabelApplicationPath, 1, 0);
}
+
+ /* Create argument editor: */
+ m_pEditorApplicationArgument = new QLineEdit(pWidgetApplication);
+ if (m_pEditorApplicationArgument)
+ {
+ connect(m_pEditorApplicationArgument, &QLineEdit::textChanged,
+ this, &UICloudConsoleDetailsWidget::sltApplicationArgumentChanged);
+
+ /* Add into layout: */
+ pLayoutApplication->addWidget(m_pEditorApplicationArgument, 2, 1);
+ }
+ /* Create argument label: */
+ m_pLabelApplicationArgument = new QLabel(pWidgetApplication);
+ if (m_pLabelApplicationArgument)
+ {
+ m_pLabelApplicationArgument->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+ m_pLabelApplicationArgument->setBuddy(m_pEditorApplicationArgument);
+
+ /* Add into layout: */
+ pLayoutApplication->addWidget(m_pLabelApplicationArgument, 2, 0);
+ }
}
/* Add into layout: */
@@ -426,6 +463,7 @@ void UICloudConsoleDetailsWidget::loadData()
{
m_pEditorApplicationName->setText(m_oldApplicationData.m_strName);
m_pEditorApplicationPath->setText(m_oldApplicationData.m_strPath);
+ m_pEditorApplicationArgument->setText(m_oldApplicationData.m_strArgument);
}
/* If profile pane is selected: */
else
diff --git a/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.h b/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.h
index d7347892c18..972c52abae9 100644
--- a/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleDetailsWidget.h
@@ -52,6 +52,7 @@ struct UIDataCloudConsoleApplication
&& (m_strId == other.m_strId)
&& (m_strName == other.m_strName)
&& (m_strPath == other.m_strPath)
+ && (m_strArgument == other.m_strArgument)
&& (m_fRestricted == other.m_fRestricted)
;
}
@@ -67,6 +68,8 @@ struct UIDataCloudConsoleApplication
QString m_strName;
/** Holds the console application path. */
QString m_strPath;
+ /** Holds the console application argument. */
+ QString m_strArgument;
/** Holds whether console application is restricted. */
bool m_fRestricted;
};
@@ -158,6 +161,8 @@ private slots:
void sltApplicationNameChanged(const QString &strName);
/** Handles console application path change. */
void sltApplicationPathChanged(const QString &strPath);
+ /** Handles console application argument change. */
+ void sltApplicationArgumentChanged(const QString &strArgument);
/** Handles console profile name change. */
void sltProfileNameChanged(const QString &strName);
/** Handles console profile argument change. */
@@ -224,6 +229,10 @@ private:
QLabel *m_pLabelApplicationPath;
/** Holds the application path editor instance. */
QLineEdit *m_pEditorApplicationPath;
+ /** Holds the application argument label instance. */
+ QLabel *m_pLabelApplicationArgument;
+ /** Holds the application argument editor instance. */
+ QLineEdit *m_pEditorApplicationArgument;
/** Holds the profile name label instance. */
QLabel *m_pLabelProfileName;
diff --git a/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleManager.cpp b/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleManager.cpp
index 5beee5c5a1d..29aefba0e7d 100644
--- a/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/cloud/consolemanager/UICloudConsoleManager.cpp
@@ -83,6 +83,8 @@ public:
QString name() const { return m_strName; }
/** Returns item path. */
QString path() const { return m_strPath; }
+ /** Returns item argument. */
+ QString argument() const { return m_strArgument; }
};
/** Cloud Console Manager profile's tree-widget item. */
@@ -122,6 +124,8 @@ public:
QString name() const;
/** Returns application path. */
QString path() const;
+ /** Returns application argument. */
+ QString argument() const;
protected:
@@ -141,6 +145,10 @@ private:
QLabel *m_pLabelPath;
/** Holds the path editor instance. */
QLineEdit *m_pEditorPath;
+ /** Holds the argument label instance. */
+ QLabel *m_pLabelArgument;
+ /** Holds the argument editor instance. */
+ QLineEdit *m_pEditorArgument;
/** Holds the button-box instance. */
QIDialogButtonBox *m_pButtonBox;
@@ -239,6 +247,8 @@ UIInputDialogCloudConsoleApplication::UIInputDialogCloudConsoleApplication(QWidg
, m_pEditorName(0)
, m_pLabelPath(0)
, m_pEditorPath(0)
+ , m_pLabelArgument(0)
+ , m_pEditorArgument(0)
, m_pButtonBox(0)
{
prepare();
@@ -254,11 +264,17 @@ QString UIInputDialogCloudConsoleApplication::path() const
return m_pEditorPath->text();
}
+QString UIInputDialogCloudConsoleApplication::argument() const
+{
+ return m_pEditorArgument->text();
+}
+
void UIInputDialogCloudConsoleApplication::retranslateUi()
{
setWindowTitle(tr("Add Application"));
m_pLabelName->setText(tr("Name:"));
m_pLabelPath->setText(tr("Path:"));
+ m_pLabelArgument->setText(tr("Argument:"));
}
void UIInputDialogCloudConsoleApplication::prepare()
@@ -270,10 +286,7 @@ void UIInputDialogCloudConsoleApplication::prepare()
QGridLayout *pMainLayout = new QGridLayout(this);
if (pMainLayout)
{
- pMainLayout->setRowStretch(0, 0);
- pMainLayout->setRowStretch(1, 0);
- pMainLayout->setRowStretch(2, 1);
- pMainLayout->setRowStretch(3, 0);
+ pMainLayout->setRowStretch(3, 1);
/* Prepare name editor: */
m_pEditorName = new QLineEdit(this);
@@ -305,6 +318,21 @@ void UIInputDialogCloudConsoleApplication::prepare()
pMainLayout->addWidget(m_pLabelPath, 1, 0);
}
+ /* Prepare argument editor: */
+ m_pEditorArgument = new QLineEdit(this);
+ if (m_pEditorArgument)
+ {
+ pMainLayout->addWidget(m_pEditorArgument, 2, 1);
+ }
+ /* Prepare argument editor label: */
+ m_pLabelArgument = new QLabel(this);
+ if (m_pLabelArgument)
+ {
+ m_pLabelArgument->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+ m_pLabelArgument->setBuddy(m_pEditorArgument);
+ pMainLayout->addWidget(m_pLabelArgument, 2, 0);
+ }
+
/* Prepare button-box: */
m_pButtonBox = new QIDialogButtonBox(this);
if (m_pButtonBox)
@@ -312,7 +340,7 @@ void UIInputDialogCloudConsoleApplication::prepare()
m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UIInputDialogCloudConsoleApplication::reject);
connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UIInputDialogCloudConsoleApplication::accept);
- pMainLayout->addWidget(m_pButtonBox, 3, 0, 1, 2);
+ pMainLayout->addWidget(m_pButtonBox, 4, 0, 1, 2);
}
}
@@ -485,7 +513,9 @@ void UICloudConsoleManagerWidget::sltApplyCloudConsoleDetailsChanges()
/* Save application settings if changed: */
if (newData != oldData)
gEDataManager->setCloudConsoleManagerApplication(newData.m_strId,
- QString("%1,%2").arg(newData.m_strName, newData.m_strPath));
+ QString("%1,%2,%3").arg(newData.m_strName,
+ newData.m_strPath,
+ newData.m_strArgument));
break;
}
case CloudConsoleItemType_Profile:
@@ -513,6 +543,7 @@ void UICloudConsoleManagerWidget::sltAddCloudConsoleApplication()
QString strId;
QString strApplicationName;
QString strApplicationPath;
+ QString strApplicationArgument;
bool fCancelled = true;
QPointer<UIInputDialogCloudConsoleApplication> pDialog = new UIInputDialogCloudConsoleApplication(this);
if (pDialog)
@@ -522,6 +553,7 @@ void UICloudConsoleManagerWidget::sltAddCloudConsoleApplication()
strId = QUuid::createUuid().toString().remove(QRegExp("[{}]"));
strApplicationName = pDialog->name();
strApplicationPath = pDialog->path();
+ strApplicationArgument = pDialog->argument();
fCancelled = false;
}
delete pDialog;
@@ -532,7 +564,7 @@ void UICloudConsoleManagerWidget::sltAddCloudConsoleApplication()
/* Update current-item definition: */
m_strDefinition = QString("/%1").arg(strId);
/* Compose extra-data superset: */
- const QString strValue = QString("%1,%2").arg(strApplicationName, strApplicationPath);
+ const QString strValue = QString("%1,%2,%3").arg(strApplicationName, strApplicationPath, strApplicationArgument);
/* Save new console application to extra-data: */
gEDataManager->setCloudConsoleManagerApplication(strId, strValue);
@@ -980,6 +1012,7 @@ void UICloudConsoleManagerWidget::loadCloudConsoleApplication(const QString &str
applicationData.m_strId = values.value(0);
applicationData.m_strName = values.value(1);
applicationData.m_strPath = values.value(2);
+ applicationData.m_strArgument = values.value(3);
}
void UICloudConsoleManagerWidget::loadCloudConsoleProfile(const QString &strSuperset,
diff --git a/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp b/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
index dfd31ad800e..e7752fdd640 100644
--- a/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
@@ -2811,6 +2811,7 @@ void UIVirtualBoxManager::updateMenuMachineConsole(QMenu *pMenu)
.arg(applicationValues.value(0)),
this, &UIVirtualBoxManager::sltExecuteExternalApplication);
pAction->setProperty("path", applicationValues.value(1));
+ pAction->setProperty("arguments", applicationValues.value(2));
}
}
/* Terminal application configuration tool: */