summaryrefslogtreecommitdiff
path: root/src/VBox
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox')
-rw-r--r--src/VBox/Frontends/VBoxManage/VBoxManage.cpp16
-rw-r--r--src/VBox/Frontends/VirtualBox/VBoxUI.pro1
-rw-r--r--src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h16
-rw-r--r--src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp14
-rw-r--r--src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h3
-rw-r--r--src/VBox/Frontends/VirtualBox/ui/VBoxVMSerialPortSettings.ui255
-rw-r--r--src/VBox/Frontends/VirtualBox/ui/VBoxVMSerialPortSettings.ui.h165
-rw-r--r--src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui33
-rw-r--r--src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h414
-rw-r--r--src/VBox/Main/ConsoleImpl.cpp10
-rw-r--r--src/VBox/Main/ParallelPortImpl.cpp24
-rw-r--r--src/VBox/Main/SerialPortImpl.cpp47
-rw-r--r--src/VBox/Main/idl/VirtualBox.xidl48
-rw-r--r--src/VBox/Main/include/ParallelPortImpl.h9
-rw-r--r--src/VBox/Main/include/SerialPortImpl.h14
-rw-r--r--src/VBox/Main/xml/VirtualBox-settings-common.xsd19
16 files changed, 692 insertions, 396 deletions
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManage.cpp b/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
index f6e2ad1c8cf..1c032886f2b 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
@@ -1057,7 +1057,7 @@ static HRESULT showVMInfo (ComPtr <IVirtualBox> virtualBox, ComPtr<IMachine> mac
else
{
ULONG uIRQ, uIOBase;
- SerialHostMode_T HostMode;
+ PortMode_T HostMode;
Bstr path;
BOOL fServer;
uart->COMGETTER(IRQ)(&uIRQ);
@@ -1071,14 +1071,14 @@ static HRESULT showVMInfo (ComPtr <IVirtualBox> virtualBox, ComPtr<IMachine> mac
switch (HostMode)
{
default:
- case SerialHostMode_Disconnected:
+ case PortMode_DisconnectedPort:
RTPrintf(", disconnected\n");
break;
- case SerialHostMode_HostPipe:
+ case PortMode_HostPipePort:
RTPrintf(", attached to pipe (%s) '%lS'\n",
fServer ? "server" : "client", path.raw());
break;
- case SerialHostMode_HostDevice:
+ case PortMode_HostDevicePort:
RTPrintf(", attached to device '%lS'\n", path.raw());
break;
}
@@ -4111,23 +4111,23 @@ static int handleModifyVM(int argc, char *argv[],
{
if (strcmp(uarts_mode[n], "disconnected") == 0)
{
- CHECK_ERROR_RET(uart, COMSETTER(HostMode) (SerialHostMode_Disconnected), 1);
+ CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_DisconnectedPort), 1);
}
else
{
if (strcmp(uarts_mode[n], "server") == 0)
{
- CHECK_ERROR_RET(uart, COMSETTER(HostMode) (SerialHostMode_HostPipe), 1);
+ CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostPipePort), 1);
CHECK_ERROR_RET(uart, COMSETTER(Server) (TRUE), 1);
}
else if (strcmp(uarts_mode[n], "client") == 0)
{
- CHECK_ERROR_RET(uart, COMSETTER(HostMode) (SerialHostMode_HostPipe), 1);
+ CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostPipePort), 1);
CHECK_ERROR_RET(uart, COMSETTER(Server) (FALSE), 1);
}
else
{
- CHECK_ERROR_RET(uart, COMSETTER(HostMode) (SerialHostMode_HostDevice), 1);
+ CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostDevicePort), 1);
}
CHECK_ERROR_RET(uart, COMSETTER(Path) (Bstr(uarts_path[n])), 1);
}
diff --git a/src/VBox/Frontends/VirtualBox/VBoxUI.pro b/src/VBox/Frontends/VirtualBox/VBoxUI.pro
index 2164131f922..75224423772 100644
--- a/src/VBox/Frontends/VirtualBox/VBoxUI.pro
+++ b/src/VBox/Frontends/VirtualBox/VBoxUI.pro
@@ -21,6 +21,7 @@ LANGUAGE = C++
FORMS = ui/VBoxDiskImageManagerDlg.ui \
ui/VBoxVMNetworkSettings.ui \
+ ui/VBoxVMSerialPortSettings.ui \
ui/VBoxUSBFilterSettings.ui \
ui/VBoxSharedFoldersSettings.ui \
ui/VBoxNewVMWzd.ui \
diff --git a/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h b/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
index e529b50049f..34569bfee6a 100644
--- a/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
+++ b/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
@@ -225,10 +225,10 @@ public:
return vrdpAuthTypes [t];
}
- QString toString (CEnums::SerialHostMode t) const
+ QString toString (CEnums::PortMode t) const
{
- AssertMsg (!serialHostModeTypes [t].isNull(), ("No text for %d", t));
- return serialHostModeTypes [t];
+ AssertMsg (!portModeTypes [t].isNull(), ("No text for %d", t));
+ return portModeTypes [t];
}
QString toString (CEnums::USBDeviceFilterAction t) const
@@ -259,12 +259,12 @@ public:
return CEnums::VRDPAuthType (it - vrdpAuthTypes.begin());
}
- CEnums::SerialHostMode toSerialHostMode (const QString &s) const
+ CEnums::PortMode toPortMode (const QString &s) const
{
QStringVector::const_iterator it =
- qFind (serialHostModeTypes.begin(), serialHostModeTypes.end(), s);
- AssertMsg (it != serialHostModeTypes.end(), ("No value for {%s}", s.latin1()));
- return CEnums::SerialHostMode (it - serialHostModeTypes.begin());
+ qFind (portModeTypes.begin(), portModeTypes.end(), s);
+ AssertMsg (it != portModeTypes.end(), ("No value for {%s}", s.latin1()));
+ return CEnums::PortMode (it - portModeTypes.begin());
}
CEnums::USBDeviceFilterAction toUSBDevFilterAction (const QString &s) const
@@ -548,7 +548,7 @@ private:
QStringVector diskTypes;
QStringVector diskStorageTypes;
QStringVector vrdpAuthTypes;
- QStringVector serialHostModeTypes;
+ QStringVector portModeTypes;
QStringVector usbFilterActionTypes;
QStringVector diskControllerDevices;
QStringVector audioDriverTypes;
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
index a010e94a0a6..de1bc894312 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
@@ -575,7 +575,7 @@ VBoxGlobal::VBoxGlobal()
, diskTypes (CEnums::HardDiskType_COUNT)
, diskStorageTypes (CEnums::HardDiskStorageType_COUNT)
, vrdpAuthTypes (CEnums::VRDPAuthType_COUNT)
- , serialHostModeTypes (CEnums::SerialHostMode_COUNT)
+ , portModeTypes (CEnums::PortMode_COUNT)
, usbFilterActionTypes (CEnums::USBDeviceFilterAction_COUNT)
, diskControllerDevices (3)
, audioDriverTypes (CEnums::AudioDriverType_COUNT)
@@ -1863,12 +1863,12 @@ void VBoxGlobal::languageChange()
vrdpAuthTypes [CEnums::VRDPAuthGuest] =
tr ("Guest", "VRDPAuthType");
- serialHostModeTypes [CEnums::Disconnected] =
- tr ("Disconnected", "SerialHostMode");
- serialHostModeTypes [CEnums::HostPipe] =
- tr ("Host Pipe", "SerialHostMode");
- serialHostModeTypes [CEnums::HostDevice] =
- tr ("Host Device", "SerialHostMode");
+ portModeTypes [CEnums::DisconnectedPort] =
+ tr ("Disconnected", "PortMode");
+ portModeTypes [CEnums::HostPipePort] =
+ tr ("Host Pipe", "PortMode");
+ portModeTypes [CEnums::HostDevicePort] =
+ tr ("Host Device", "PortMode");
usbFilterActionTypes [CEnums::USBDeviceFilterIgnore] =
tr ("Ignore", "USBFilterActionType");
diff --git a/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h b/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h
index a524fd84e34..c09c7395c15 100644
--- a/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h
+++ b/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h
@@ -25,9 +25,6 @@
** place of a destructor.
*****************************************************************************/
-/**
- * VBoxVMNetworkSettings class to use as network interface setup page.
- */
void VBoxVMNetworkSettings::init()
{
leMACAddress->setValidator (new QRegExpValidator (QRegExp ("[0-9,A-F]{12,12}"), this));
diff --git a/src/VBox/Frontends/VirtualBox/ui/VBoxVMSerialPortSettings.ui b/src/VBox/Frontends/VirtualBox/ui/VBoxVMSerialPortSettings.ui
new file mode 100644
index 00000000000..75692af2368
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/ui/VBoxVMSerialPortSettings.ui
@@ -0,0 +1,255 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>VBoxVMSerialPortSettings</class>
+<comment>
+:mode=html:tabSize=4:indentSize=4:noTabs=true:
+:folding=explicit:collapseFolds=1:
+
+ Copyright (C) 2006-2007 innotek GmbH
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License as published by the Free Software Foundation,
+ in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ distribution. VirtualBox OSE is distributed in the hope that it will
+ be useful, but WITHOUT ANY WARRANTY of any kind.
+</comment>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>VBoxVMSerialPortSettings</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>493</width>
+ <height>279</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>VBoxVMSerialPortSettings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>10</number>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>mSerialPortBox</cstring>
+ </property>
+ <property name="title">
+ <string>&amp;Enable Serial Port</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When checked, enables the given serial port of the virtual machine.</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>mPortNumLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Port &amp;Number</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mPortNumCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>mPortNumCombo</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the serial port number. You can choose one of the standard serial ports or select &lt;b&gt;User-defined&lt;/b&gt; and specify port parameters manually.</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>mIROLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;IRQ</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mIRQLine</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>mIRQLine</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>LineEditPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the IRQ number of this serial port. Valid values are integer numbers in range from &lt;tt&gt;0&lt;/tt&gt; to &lt;tt&gt;255&lt;/tt&gt;. Values greater than &lt;tt&gt;15&lt;/tt&gt; may be used only if the &lt;b&gt;IO APIC&lt;/b&gt; is enabled for this virtual machine.</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>mIOPortLabel</cstring>
+ </property>
+ <property name="text">
+ <string>I/O Po&amp;rt</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mIOPortLine</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>mIOPortLine</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the base I/O port address of this serial port. Valid values are integer numbers in range from &lt;tt&gt;0&lt;/tt&gt; to &lt;tt&gt;0xFFFF&lt;/tt&gt;.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>mHostModeLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Port &amp;Mode</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mHostModeCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>mHostModeCombo</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Controls the working mode of this serial port. If you select &lt;b&gt;Disconnected&lt;/b&gt;, the guest OS will detect the serial port but will not be able to operate it.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>mServerCheck</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Create Pipe</string>
+ </property>
+ <property name="accel">
+ <string>Alt+C</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If checked, the pipe specified in the &lt;b&gt;Port Path&lt;/b&gt; field will be created by the virtual machine when it starts. Otherwise, the virtual machine will try to use the existing pipe.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>mPortPathLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Port &amp;Path</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>mPortPathLine</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>mPortPathLine</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>LineEditPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Displays the path to the serial port's pipe on the host when the port works in &lt;b&gt;Host Pipe&lt;/b&gt; mode, or the host serial device name when the port works in &lt;b&gt;Host Device&lt;/b&gt; mode.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>mPortNumCombo</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>VBoxVMSerialPortSettings</receiver>
+ <slot>mPortNumCombo_activated(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>mHostModeCombo</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>VBoxVMSerialPortSettings</receiver>
+ <slot>mHostModeCombo_activated(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>mSerialPortBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>VBoxVMSerialPortSettings</receiver>
+ <slot>mSerialPortBox_toggled(bool)</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in declaration">COMDefs.h</include>
+ <include location="local" impldecl="in declaration">QIWidgetValidator.h</include>
+ <include location="global" impldecl="in implementation">qdir.h</include>
+ <include location="global" impldecl="in implementation">qvalidator.h</include>
+ <include location="local" impldecl="in implementation">VBoxGlobal.h</include>
+ <include location="local" impldecl="in implementation">VBoxProblemReporter.h</include>
+ <include location="local" impldecl="in implementation">VBoxVMSerialPortSettings.ui.h</include>
+</includes>
+<variables>
+ <variable access="private">CSerialPort mPort;</variable>
+ <variable access="private">QIWidgetValidator *mWalidator;</variable>
+</variables>
+<slots>
+ <slot>mSerialPortBox_toggled( bool )</slot>
+ <slot>mPortNumCombo_activated( const QString &amp; aText )</slot>
+ <slot>mHostModeCombo_activated( const QString &amp; aText )</slot>
+</slots>
+<functions>
+ <function access="private" specifier="non virtual">init()</function>
+ <function>getFromPort( const CSerialPort &amp; )</function>
+ <function>putBackToPort()</function>
+ <function returnType="bool">isUserDefined()</function>
+</functions>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/src/VBox/Frontends/VirtualBox/ui/VBoxVMSerialPortSettings.ui.h b/src/VBox/Frontends/VirtualBox/ui/VBoxVMSerialPortSettings.ui.h
new file mode 100644
index 00000000000..42c3be48bc4
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/ui/VBoxVMSerialPortSettings.ui.h
@@ -0,0 +1,165 @@
+/**
+ *
+ * VBox frontends: Qt GUI ("VirtualBox"):
+ * "VM serial port settings" dialog UI include (Qt Designer)
+ */
+
+/*
+ * Copyright (C) 2006-2007 innotek GmbH
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License as published by the Free Software Foundation,
+ * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+ * distribution. VirtualBox OSE is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+
+static const struct PortConfig
+{
+ const char *name;
+ const ulong IRQ;
+ const ulong IOBase;
+}
+kKnownPorts[] =
+{
+ { "COM1", 4, 0x3F8 },
+ { "COM2", 3, 0x2F8 },
+ { "COM3", 4, 0x3E8 },
+ { "COM4", 3, 0x2E8 },
+ /* must not contain an element with IRQ=0 and IOBase=0 used to cause
+ * portNumbers2Name() to return the "User-defined" string. */
+};
+
+static const PortConfig *findByPortNumbers (ulong aIRQ, ulong aIOBase)
+{
+ for (size_t i = 0; i < ELEMENTS (kKnownPorts); ++ i)
+ if (kKnownPorts [i].IRQ == aIRQ &&
+ kKnownPorts [i].IOBase == aIOBase)
+ return &kKnownPorts [i];
+ return NULL;
+}
+
+static const PortConfig *findByPortName (const char *aName)
+{
+ for (size_t i = 0; i < ELEMENTS (kKnownPorts); ++ i)
+ if (strcmp (kKnownPorts [i].name, aName) == 0)
+ return &kKnownPorts [i];
+ return NULL;
+}
+
+static QString portNumbers2Name (ulong aIRQ, ulong aIOBase)
+{
+ const PortConfig *config = findByPortNumbers (aIRQ, aIOBase);
+ if (config)
+ return config->name;
+
+ return VBoxVMSerialPortSettings::tr ("User-defined");
+}
+
+
+void VBoxVMSerialPortSettings::init()
+{
+ /* setup validation */
+
+ mIRQLine->setValidator (new QIULongValidator (0, 255, this));
+ mIOPortLine->setValidator (new QIULongValidator (0, 0xFFFF, this));
+
+ mPortPathLine->setValidator (new QRegExpValidator (QRegExp (".+"), this));
+
+ /* setup constraints */
+
+ mIRQLine->setMaximumWidth (mIRQLine->fontMetrics().width ("888888")
+ + mIRQLine->frameWidth() * 2);
+ mIRQLine->setMinimumWidth (mIRQLine->minimumWidth());
+
+ mIOPortLine->setMaximumWidth (mIOPortLine->fontMetrics().width ("8888888")
+ + mIOPortLine->frameWidth() * 2);
+ mIOPortLine->setMinimumWidth (mIOPortLine->minimumWidth());
+
+ /* set initial values */
+
+ for (size_t i = 0; i < ELEMENTS (kKnownPorts); ++ i)
+ mPortNumCombo->insertItem (kKnownPorts [i].name);
+ mPortNumCombo->insertItem (portNumbers2Name (0, 0));
+
+ mHostModeCombo->insertItem (vboxGlobal().toString (CEnums::DisconnectedPort));
+ mHostModeCombo->insertItem (vboxGlobal().toString (CEnums::HostPipePort));
+ mHostModeCombo->insertItem (vboxGlobal().toString (CEnums::HostDevicePort));
+}
+
+void VBoxVMSerialPortSettings::getFromPort (const CSerialPort &aPort)
+{
+ mPort = aPort;
+
+ mSerialPortBox->setChecked (mPort.GetEnabled());
+
+ ulong IRQ = mPort.GetIRQ();
+ ulong IOBase = mPort.GetIOBase();
+ mPortNumCombo->setCurrentText (portNumbers2Name (IRQ, IOBase));
+ mIRQLine->setText (QString::number (IRQ));
+ mIOPortLine->setText ("0x" + QString::number (IOBase, 16).upper());
+
+ mHostModeCombo->setCurrentText (vboxGlobal().toString (mPort.GetHostMode()));
+ mServerCheck->setChecked (mPort.GetServer());
+ mPortPathLine->setText (mPort.GetPath());
+
+ /* ensure everything is up-to-date */
+ mSerialPortBox_toggled (mSerialPortBox->isChecked());
+}
+
+void VBoxVMSerialPortSettings::putBackToPort()
+{
+ mPort.SetEnabled (mSerialPortBox->isChecked());
+
+ mPort.SetIRQ (mIRQLine->text().toULong (NULL, 0));
+ mPort.SetIOBase (mIOPortLine->text().toULong (NULL, 0));
+
+ mPort.SetHostMode (vboxGlobal().toPortMode (mHostModeCombo->currentText()));
+ mPort.SetServer (mServerCheck->isChecked());
+ mPort.SetPath (QDir::convertSeparators (mPortPathLine->text()));
+}
+
+bool VBoxVMSerialPortSettings::isUserDefined()
+{
+ return findByPortName (mPortNumCombo->currentText().utf8().data()) == NULL;
+}
+
+void VBoxVMSerialPortSettings::mSerialPortBox_toggled (bool aOn)
+{
+ if (aOn)
+ {
+ mPortNumCombo_activated (mPortNumCombo->currentText());
+ mHostModeCombo_activated (mHostModeCombo->currentText());
+ }
+}
+
+void VBoxVMSerialPortSettings::mPortNumCombo_activated (const QString &aText)
+{
+ const PortConfig *config = findByPortName (aText.utf8().data());
+ mIRQLine->setEnabled (config == NULL);
+ mIOPortLine->setEnabled (config == NULL);
+ if (config != NULL)
+ {
+ mIRQLine->setText (QString::number (config->IRQ));
+ mIOPortLine->setText ("0x" + QString::number (config->IOBase, 16).upper());
+ }
+}
+
+void VBoxVMSerialPortSettings::mHostModeCombo_activated (const QString &aText)
+{
+ CEnums::PortMode mode = vboxGlobal().toPortMode (aText);
+ mServerCheck->setEnabled (mode == CEnums::HostPipePort);
+ mPortPathLine->setEnabled (mode != CEnums::DisconnectedPort);
+}
diff --git a/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui b/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
index 560aeec2595..f8c58193c8a 100644
--- a/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
+++ b/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
@@ -269,16 +269,16 @@
</item>
<item>
<property name="text">
- <string> Serial Port </string>
+ <string> Serial Ports </string>
</property>
<property name="text">
<string>9</string>
</property>
<property name="text">
- <string>#serial</string>
+ <string>#serialPorts</string>
</property>
<property name="pixmap">
- <pixmap>refresh_16px.png</pixmap>
+ <pixmap></pixmap>
</property>
<property name="pixmap">
<pixmap></pixmap>
@@ -2711,6 +2711,27 @@ makes the guest see an audio card, however every access to it will be ignored.&l
<attribute name="id">
<number>9</number>
</attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tbwSerialPorts</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </vbox>
</widget>
</widget>
<widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2">
@@ -3054,6 +3075,7 @@ makes the guest see an audio card, however every access to it will be ignored.&l
<include location="local" impldecl="in implementation">VBoxUtils.h</include>
<include location="local" impldecl="in declaration">VBoxGlobal.h</include>
<include location="local" impldecl="in implementation">VBoxVMNetworkSettings.h</include>
+ <include location="local" impldecl="in implementation">VBoxVMSerialPortSettings.h</include>
<include location="local" impldecl="in implementation">VBoxUSBFilterSettings.h</include>
<include location="local" impldecl="in implementation">VBoxSharedFoldersSettings.h</include>
<include location="local" impldecl="in implementation">VBoxDiskImageManagerDlg.h</include>
@@ -3065,7 +3087,6 @@ makes the guest see an audio card, however every access to it will be ignored.&l
<forward>class VBoxDiskImageManagerDlg</forward>
<forward>class VBoxUSBMenu</forward>
<forward>class VBoxSharedFoldersSettings</forward>
- <forward>class VBoxVMSerialPortSettings</forward>
<forward>class QIRichLabel</forward>
<forward>class BootItemsList</forward>
</forwards>
@@ -3091,7 +3112,6 @@ makes the guest see an audio card, however every access to it will be ignored.&l
<variable access="private">QWidgetStack *wstUSBFilters;</variable>
<variable access="private">bool mUSBFilterListModified;</variable>
<variable access="private">VBoxSharedFoldersSettings *mSharedFolders;</variable>
- <variable access="private">VBoxVMSerialPortSettings *mSerialPorts;</variable>
<variable access="private">QString warningString;</variable>
<variable access="private">VBoxMediaComboBox *cbHDA;</variable>
<variable access="private">VBoxMediaComboBox *cbHDB;</variable>
@@ -3115,7 +3135,8 @@ makes the guest see an audio card, however every access to it will be ignored.&l
<slot>showImageManagerISODVD()</slot>
<slot>showImageManagerISOFloppy()</slot>
<slot>showVDImageManager( QUuid *id, VBoxMediaComboBox *le, QLabel *tx = NULL )</slot>
- <slot>addNetworkAdapter( const CNetworkAdapter &amp; adapter )</slot>
+ <slot>addNetworkAdapter( const CNetworkAdapter &amp; )</slot>
+ <slot>addSerialPort( const CSerialPort &amp; )</slot>
<slot>slRAM_valueChanged( int val )</slot>
<slot>leRAM_textChanged( const QString &amp; text )</slot>
<slot>slVRAM_valueChanged( int val )</slot>
diff --git a/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h b/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
index 469e01b9b71..5dae039e096 100644
--- a/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
+++ b/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
@@ -469,249 +469,6 @@ enum
};
-class VBoxVMSerialPortSettings : public QWidget
-{
- Q_OBJECT
-
-public:
-
- VBoxVMSerialPortSettings (QWidget *aParent)
- : QWidget (aParent, "VBoxVMSerialPortSettings")
- , mTabWidget (0)
- {
- /* Basic initialization */
- mTabWidget = new QTabWidget (this, "mTabWidget");
- mTabWidget->setMargin (11);
- mTabWidget->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Preferred);
- QVBoxLayout *mainLayout = new QVBoxLayout (this);
- mainLayout->addWidget (mTabWidget);
- mainLayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Preferred,
- QSizePolicy::Expanding));
-
- /* Create a list of known COM interfaces configurations */
- mConfigList << PortConfig (0x3f8, 4, 1);
- mConfigList << PortConfig (0x2f8, 3, 2);
- mConfigList << PortConfig (0x3e8, 4, 3);
- mConfigList << PortConfig (0x2e8, 3, 4);
- }
-
- void getFromMachine (const CMachine &aMachine)
- {
- mMachine = aMachine;
-
- ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetSerialPortCount();
- for (ulong slot = 0; slot < count; ++ slot)
- {
- CSerialPort port = mMachine.GetSerialPort (slot);
- addPage (port, slot);
- }
-
- /* Revalidate all pages */
- portConfigUpdate();
- }
-
- void putBackToMachine()
- {
- for (int slot = 0; slot < mTabWidget->count(); ++ slot)
- {
- CSerialPort port = mMachine.GetSerialPort (slot);
-
- port.SetEnabled (static_cast<QGroupBox*> (mTabWidget->page (slot))->isChecked());
-
- PortConfig config = parsePortConfig (mPortList.at (slot)->currentText());
- port.SetIOBase (config.io);
- port.SetIRQ (config.irq);
-
- port.SetHostMode (vboxGlobal().toSerialHostMode (mModeList.at (slot)->currentText()));
-
- QCheckBox *chbIsServer = mIsServerList.at (slot);
- port.SetServer (chbIsServer->isEnabled() ?
- chbIsServer->isChecked() : false);
-
- QLineEdit *lePath = mPathList.at (slot);
- port.SetPath (lePath->isEnabled() ?
- lePath->text() : QString::null);
- }
- }
-
-private slots:
-
- void portConfigUpdate()
- {
- for (int index = 0; index < mTabWidget->count(); ++ index)
- {
- QComboBox *cbPortConfig = mPortList.at (index);
- QString oldText = cbPortConfig->currentText();
- QStringList newList = portConfigList (index);
- cbPortConfig->clear();
- cbPortConfig->insertStringList (newList);
- cbPortConfig->setCurrentText (oldText);
- }
- }
-
- void hostModeUpdate (int aIndex = -1)
- {
- if (aIndex == -1)
- aIndex = mTabWidget->currentPageIndex();
- QCheckBox *chbIsServer = mIsServerList.at (aIndex);
- QLineEdit *lePath = mPathList.at (aIndex);
- CEnums::SerialHostMode mode = vboxGlobal().toSerialHostMode (
- mModeList.at (aIndex)->currentText());
- chbIsServer->setEnabled (mode == CEnums::HostPipe);
- lePath->setEnabled (mode != CEnums::Disconnected);
- }
-
-private:
-
- struct PortConfig
- {
- PortConfig ()
- : io (0), irq (0), number (0) {}
- PortConfig (ulong aIO, ulong aIRQ, ulong aNumber)
- : io (aIO), irq (aIRQ), number (aNumber) {}
-
- bool isNull() { return !io && !irq; }
-
- bool operator== (const PortConfig &aCfg) const
- {
- return io == aCfg.io && irq == aCfg.irq;
- }
-
- static QString format()
- {
- return QString ("I/O Port = 0x%1, IRQ = %2");
- }
- QString toString()
- {
- QString info = format().arg (QString::number (io, 16)).arg (irq);
- if (number)
- info += QString (" (COM%1)").arg (number);
- return info;
- }
-
- ulong io;
- ulong irq;
- ulong number;
- };
- typedef QValueList<PortConfig> PortConfigs;
-
- void addPage (const CSerialPort &aPort, ulong aSlot)
- {
- /* Create Serial Port page */
- QGroupBox *gBox = new QGroupBox (tr ("&Enable Serial Port"));
- gBox->setColumnLayout (0, Qt::Vertical);
- gBox->layout()->setMargin (11);
- gBox->layout()->setSpacing (6);
- gBox->setCheckable (true);
-
- QLabel *lbPort = new QLabel (tr ("Serial Port &Number"), gBox);
- QComboBox *cbPort = new QComboBox (gBox);
- lbPort->setBuddy (cbPort);
- connect (cbPort, SIGNAL (activated (int)),
- this , SLOT (portConfigUpdate()));
-
- QLabel *lbType = new QLabel (tr ("Serial Port Host &Mode"), gBox);
- QComboBox *cbMode = new QComboBox (gBox);
- lbType->setBuddy (cbMode);
- cbMode->insertItem (vboxGlobal().toString (CEnums::Disconnected));
- cbMode->insertItem (vboxGlobal().toString (CEnums::HostPipe));
- cbMode->insertItem (vboxGlobal().toString (CEnums::HostDevice));
- connect (cbMode, SIGNAL (activated (int)),
- this , SLOT (hostModeUpdate()));
-
- QCheckBox *chbIsServer = new QCheckBox (tr ("Create Pipe &Automatically"), gBox);
-
- QLabel *lbPath = new QLabel (tr ("Serial Port &Path"), gBox);
- QLineEdit *lePath = new QLineEdit (gBox);
- lbPath->setBuddy (lePath);
-
- QGridLayout *pageLayout = new QGridLayout (gBox->layout());
- pageLayout->setAlignment (Qt::AlignTop);
- pageLayout->addWidget (lbPort, 0, 0);
- pageLayout->addMultiCellWidget (cbPort, 0, 0, 1, 2);
- pageLayout->addWidget (lbType, 1, 0);
- pageLayout->addWidget (cbMode, 1, 1);
- pageLayout->addWidget (chbIsServer, 1, 2);
- pageLayout->addWidget (lbPath, 2, 0);
- pageLayout->addMultiCellWidget (lePath, 2, 2, 1, 2);
-
- /* Load machine information */
- gBox->setChecked (aPort.GetEnabled());
-
- PortConfig config (aPort.GetIOBase(), aPort.GetIRQ(), 0);
- if (!mConfigList.contains (config))
- mConfigList << config;
- cbPort->insertStringList (portConfigList (mTabWidget->count()));
- for (int id = 0; id < cbPort->count(); ++ id)
- if (parsePortConfig (cbPort->text (id)) == config)
- cbPort->setCurrentItem (id);
-
- cbMode->setCurrentText (vboxGlobal().toString (aPort.GetHostMode()));
-
- chbIsServer->setChecked (aPort.GetServer());
-
- lePath->setText (aPort.GetPath());
-
- /* Append newly createrd widget */
- mTabWidget->addTab (gBox, tr ("Port &%1").arg (aSlot));
- mPortList.append (cbPort);
- mModeList.append (cbMode);
- mIsServerList.append (chbIsServer);
- mPathList.append (lePath);
-
- /* Revalidate page */
- hostModeUpdate (aSlot);
- }
-
- QStringList portConfigList (int aIndex)
- {
- QStringList list;
- PortConfigs config = portConfigs (aIndex);
- for (ulong id = 0; id < config.count(); ++ id)
- list << config [id].toString();
- return list;
- }
-
- PortConfigs portConfigs (int aIndex)
- {
- PortConfigs config (mConfigList);
- if (aIndex == mTabWidget->count())
- return config;
-
- for (int index = 0; index < mTabWidget->count(); ++ index)
- {
- if (index != aIndex)
- {
- PortConfig used = parsePortConfig (mPortList.at (index)->currentText());
- Assert (!used.isNull());
- config.remove (used);
- }
- }
- return config;
- }
-
- PortConfig parsePortConfig (const QString &aString)
- {
- QRegExp regExp (PortConfig::format().arg ("([0-9a-f]+)").arg ("(\\d+)"));
- if (regExp.search (aString) != -1)
- return PortConfig (regExp.cap (1).toULong(0, 16),
- regExp.cap (2).toULong(), 0);
- Assert (0);
- return PortConfig();
- }
-
- QTabWidget *mTabWidget;
- PortConfigs mConfigList;
-
- QPtrList<QComboBox> mPortList;
- QPtrList<QComboBox> mModeList;
- QPtrList<QCheckBox> mIsServerList;
- QPtrList<QLineEdit> mPathList;
-
- CMachine mMachine;
-};
-
-
void VBoxVMSettingsDlg::init()
{
polished = false;
@@ -956,6 +713,8 @@ void VBoxVMSettingsDlg::init()
QToolTip::add (pbHostAdd, tr ("Add"));
QToolTip::add (pbHostRemove, tr ("Remove"));
+ /* Serial Port Page */
+
/* USB Page */
lvUSBFilters->header()->hide();
@@ -1021,12 +780,6 @@ void VBoxVMSettingsDlg::init()
mSharedFolders->setDialogType (VBoxSharedFoldersSettings::MachineType);
pageFoldersLayout->addWidget (mSharedFolders);
- /* Serial Port Page */
-
- QVBoxLayout* pageSerialLayout = new QVBoxLayout (pageSerial, 0, 0);
- mSerialPorts = new VBoxVMSerialPortSettings (pageSerial);
- pageSerialLayout->addWidget (mSerialPorts);
-
/*
* set initial values
* ----------------------------------------------------------------------
@@ -1548,6 +1301,10 @@ void VBoxVMSettingsDlg::enableOk( const QIWidgetValidator *wval )
{
Q_UNUSED (wval);
+ /* reset the warning text; interested parties will set it during
+ * validation */
+ setWarning (QString::null);
+
/* detect the overall validity */
bool newValid = true;
{
@@ -1566,20 +1323,21 @@ void VBoxVMSettingsDlg::enableOk( const QIWidgetValidator *wval )
{
valid = newValid;
buttonOk->setEnabled (valid);
- if (valid)
- setWarning(0);
- warningLabel->setHidden(valid);
- warningPixmap->setHidden(valid);
+ warningLabel->setHidden (valid);
+ warningPixmap->setHidden (valid);
}
}
-void VBoxVMSettingsDlg::revalidate( QIWidgetValidator *wval )
+void VBoxVMSettingsDlg::revalidate (QIWidgetValidator *wval)
{
/* do individual validations for pages */
QWidget *pg = wval->widget();
bool valid = wval->isOtherValid();
+ QString warningText;
+ QString pageTitle = ::path (listView->currentItem());
+
if (pg == pageHDD)
{
CVirtualBox vbox = vboxGlobal().virtualBox();
@@ -1592,7 +1350,7 @@ void VBoxVMSettingsDlg::revalidate( QIWidgetValidator *wval )
if (uuidHDA.isNull())
{
valid = false;
- setWarning (tr ("Primary Master hard disk is not selected."));
+ warningText = tr ("Primary Master hard disk is not selected");
}
else uuids << uuidHDA;
}
@@ -1602,7 +1360,7 @@ void VBoxVMSettingsDlg::revalidate( QIWidgetValidator *wval )
if (uuidHDB.isNull())
{
valid = false;
- setWarning (tr ("Primary Slave hard disk is not selected."));
+ warningText = tr ("Primary Slave hard disk is not selected");
}
else
{
@@ -1615,8 +1373,8 @@ void VBoxVMSettingsDlg::revalidate( QIWidgetValidator *wval )
if (valid)
uuids << uuidHDB;
else
- setWarning (tr ("Primary Slave hard disk is already attached "
- "to a different slot."));
+ warningText = tr ("Primary Slave hard disk is already attached "
+ "to a different slot");
}
}
@@ -1625,7 +1383,7 @@ void VBoxVMSettingsDlg::revalidate( QIWidgetValidator *wval )
if (uuidHDD.isNull())
{
valid = false;
- setWarning (tr ("Secondary Slave hard disk is not selected."));
+ warningText = tr ("Secondary Slave hard disk is not selected");
}
else
{
@@ -1638,8 +1396,8 @@ void VBoxVMSettingsDlg::revalidate( QIWidgetValidator *wval )
if (valid)
uuids << uuidHDB;
else
- setWarning (tr ("Secondary Slave hard disk is already attached "
- "to a different slot."));
+ warningText = tr ("Secondary Slave hard disk is already attached "
+ "to a different slot");
}
}
@@ -1666,7 +1424,7 @@ void VBoxVMSettingsDlg::revalidate( QIWidgetValidator *wval )
tbISODVD->setEnabled (rbISODVD->isChecked());
if (!valid)
- setWarning (tr ("CD/DVD image file is not selected."));
+ warningText = tr ("CD/DVD image file is not selected");
}
else if (pg == pageFloppy)
{
@@ -1683,21 +1441,70 @@ void VBoxVMSettingsDlg::revalidate( QIWidgetValidator *wval )
tbISOFloppy->setEnabled (rbISOFloppy->isChecked());
if (!valid)
- setWarning (tr ("Floppy image file is not selected."));
+ warningText = tr ("Floppy image file is not selected");
}
else if (pg == pageNetwork)
{
- int index = 0;
- for (; index < tbwNetwork->count(); ++index)
+ QWidget *tab = NULL;
+ for (int index = 0; index < tbwNetwork->count(); ++ index)
{
QWidget *tab = tbwNetwork->page (index);
- VBoxVMNetworkSettings *set = static_cast<VBoxVMNetworkSettings*> (tab);
- valid = set->isPageValid (mInterfaceList);
+ VBoxVMNetworkSettings *page =
+ static_cast <VBoxVMNetworkSettings *> (tab);
+ valid = page->isPageValid (mInterfaceList);
if (!valid) break;
}
if (!valid)
- setWarning (tr ("Incorrect host network interface is selected "
- "for Adapter %1.").arg (index));
+ {
+ Assert (tab);
+ warningText = tr ("Incorrect host network interface is selected");
+ pageTitle += ": " + tbwNetwork->tabLabel (tab);
+ }
+ }
+ else if (pg == pageSerial)
+ {
+ QValueList <QString> ports;
+ QValueList <QString> paths;
+
+ int index = 0;
+ for (; index < tbwSerialPorts->count(); ++ index)
+ {
+ QWidget *tab = tbwSerialPorts->page (index);
+ VBoxVMSerialPortSettings *page =
+ static_cast <VBoxVMSerialPortSettings *> (tab);
+
+ /* skip disabled ports */
+ if (!page->mSerialPortBox->isChecked())
+ continue;
+ /* check the predefined port number unicity */
+ if (!page->isUserDefined())
+ {
+ QString port = page->mPortNumCombo->currentText();
+ valid = !ports.contains (port);
+ if (!valid)
+ {
+ warningText = tr ("Duplicate port number is selected ");
+ pageTitle += ": " + tbwSerialPorts->tabLabel (tab);
+ break;
+ }
+ ports << port;
+ }
+ /* check the port path unicity */
+ CEnums::PortMode mode =
+ vboxGlobal().toPortMode (page->mHostModeCombo->currentText());
+ if (mode != CEnums::DisconnectedPort)
+ {
+ QString path = page->mPortPathLine->text();
+ valid = !paths.contains (path);
+ if (!valid)
+ {
+ warningText = tr ("Duplicate port path is entered ");
+ pageTitle += ": " + tbwSerialPorts->tabLabel (tab);
+ break;
+ }
+ paths << path;
+ }
+ }
}
else if (pg == pageVRDP)
{
@@ -1706,14 +1513,18 @@ void VBoxVMSettingsDlg::revalidate( QIWidgetValidator *wval )
valid = !(grbVRDP->isChecked() &&
(leVRDPPort->text().isEmpty() || leVRDPTimeout->text().isEmpty()));
if (!valid && leVRDPPort->text().isEmpty())
- setWarning (tr ("VRDP Port is not set."));
+ warningText = tr ("VRDP Port is not set ");
if (!valid && leVRDPTimeout->text().isEmpty())
- setWarning (tr ("VRDP Timeout is not set."));
+ warningText = tr ("VRDP Timeout is not set ");
}
else
valid = true;
}
+ if (!valid)
+ setWarning (tr ("%1 on the <b>%2</b> page.")
+ .arg (warningText, pageTitle));
+
wval->setOtherValid (valid);
}
@@ -1979,6 +1790,16 @@ void VBoxVMSettingsDlg::getFromMachine (const CMachine &machine)
}
}
+ /* serial ports */
+ {
+ ulong count = vbox.GetSystemProperties().GetSerialPortCount();
+ for (ulong slot = 0; slot < count; ++ slot)
+ {
+ CSerialPort port = machine.GetSerialPort (slot);
+ addSerialPort (port);
+ }
+ }
+
/* USB */
{
CUSBController ctl = machine.GetUSBController();
@@ -2050,11 +1871,6 @@ void VBoxVMSettingsDlg::getFromMachine (const CMachine &machine)
mSharedFolders->getFromMachine (machine);
}
- /* serial ports */
- {
- mSerialPorts->getFromMachine (machine);
- }
-
/* request for media shortcuts update */
cbHDA->setBelongsTo (machine.GetId());
cbHDB->setBelongsTo (machine.GetId());
@@ -2253,6 +2069,17 @@ COMResult VBoxVMSettingsDlg::putBackToMachine()
}
}
+ /* serial ports */
+ {
+ for (int index = 0; index < tbwSerialPorts->count(); index++)
+ {
+ VBoxVMSerialPortSettings *page =
+ (VBoxVMSerialPortSettings *) tbwSerialPorts->page (index);
+ Assert (page);
+ page->putBackToPort();
+ }
+ }
+
/* usb */
{
CUSBController ctl = cmachine.GetUSBController();
@@ -2315,11 +2142,6 @@ COMResult VBoxVMSettingsDlg::putBackToMachine()
mSharedFolders->putBackToMachine();
}
- /* serial ports */
- {
- mSerialPorts->putBackToMachine();
- }
-
return COMResult();
}
@@ -2401,6 +2223,36 @@ void VBoxVMSettingsDlg::addNetworkAdapter (const CNetworkAdapter &aAdapter)
#endif
}
+void VBoxVMSettingsDlg::addSerialPort (const CSerialPort &aPort)
+{
+ VBoxVMSerialPortSettings *page = new VBoxVMSerialPortSettings();
+ page->getFromPort (aPort);
+ tbwSerialPorts->addTab (page, QString (tr ("Port %1", "serial ports"))
+ .arg (aPort.GetSlot()));
+
+ /* fix the tab order so that main dialog's buttons are always the last */
+ setTabOrder (page->mPortPathLine, buttonHelp);
+ setTabOrder (buttonHelp, buttonOk);
+ setTabOrder (buttonOk, buttonCancel);
+
+ /* setup validation */
+ QIWidgetValidator *wval = new QIWidgetValidator (pageSerial, this);
+ connect (page->mSerialPortBox, SIGNAL (toggled (bool)),
+ wval, SLOT (revalidate()));
+ connect (page->mIRQLine, SIGNAL (textChanged (const QString &)),
+ wval, SLOT (revalidate()));
+ connect (page->mIOPortLine, SIGNAL (textChanged (const QString &)),
+ wval, SLOT (revalidate()));
+ connect (page->mHostModeCombo, SIGNAL (activated (const QString &)),
+ wval, SLOT (revalidate()));
+ connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)),
+ this, SLOT (enableOk (const QIWidgetValidator *)));
+ connect (wval, SIGNAL (isValidRequested (QIWidgetValidator *)),
+ this, SLOT (revalidate (QIWidgetValidator *)));
+
+ wval->revalidate();
+}
+
void VBoxVMSettingsDlg::slRAM_valueChanged( int val )
{
leRAM->setText( QString().setNum( val ) );
diff --git a/src/VBox/Main/ConsoleImpl.cpp b/src/VBox/Main/ConsoleImpl.cpp
index e7f8555ef69..bf306a76e07 100644
--- a/src/VBox/Main/ConsoleImpl.cpp
+++ b/src/VBox/Main/ConsoleImpl.cpp
@@ -5924,7 +5924,7 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvTask)
rc = CFGMR3InsertNode(pInst, "Config", &pCfg); RC_CHECK();
ULONG uIRQ, uIOBase;
- SerialHostMode_T HostMode;
+ PortMode_T HostMode;
Bstr path;
BOOL fServer;
hrc = serialPort->COMGETTER(HostMode)(&HostMode); H();
@@ -5934,10 +5934,10 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvTask)
hrc = serialPort->COMGETTER(Server)(&fServer); H();
rc = CFGMR3InsertInteger(pCfg, "IRQ", uIRQ); RC_CHECK();
rc = CFGMR3InsertInteger(pCfg, "IOBase", uIOBase); RC_CHECK();
- if (HostMode != SerialHostMode_Disconnected)
+ if (HostMode != PortMode_DisconnectedPort)
{
rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0); RC_CHECK();
- if (HostMode == SerialHostMode_HostPipe)
+ if (HostMode == PortMode_HostPipePort)
{
rc = CFGMR3InsertString(pLunL0, "Driver", "Char"); RC_CHECK();
rc = CFGMR3InsertNode(pLunL0, "AttachedDriver", &pLunL1); RC_CHECK();
@@ -5946,7 +5946,7 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvTask)
rc = CFGMR3InsertString(pLunL2, "Location", Utf8Str(path)); RC_CHECK();
rc = CFGMR3InsertInteger(pLunL2, "IsServer", fServer); RC_CHECK();
}
- else if (HostMode == SerialHostMode_HostDevice)
+ else if (HostMode == PortMode_HostDevicePort)
{
rc = CFGMR3InsertString(pLunL0, "Driver", "Host Serial"); RC_CHECK();
rc = CFGMR3InsertNode(pLunL0, "Config", &pLunL1); RC_CHECK();
@@ -5979,7 +5979,7 @@ DECLCALLBACK(int) Console::configConstructor(PVM pVM, void *pvTask)
Bstr DevicePath;
hrc = parallelPort->COMGETTER(IRQ)(&uIRQ); H();
hrc = parallelPort->COMGETTER(IOBase)(&uIOBase); H();
- hrc = parallelPort->COMGETTER(DevicePath)(DevicePath.asOutParam()); H();
+ hrc = parallelPort->COMGETTER(Path)(DevicePath.asOutParam()); H();
rc = CFGMR3InsertInteger(pCfg, "IRQ", uIRQ); RC_CHECK();
rc = CFGMR3InsertInteger(pCfg, "IOBase", uIOBase); RC_CHECK();
rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0); RC_CHECK();
diff --git a/src/VBox/Main/ParallelPortImpl.cpp b/src/VBox/Main/ParallelPortImpl.cpp
index c7c0d9d4075..b892d20b586 100644
--- a/src/VBox/Main/ParallelPortImpl.cpp
+++ b/src/VBox/Main/ParallelPortImpl.cpp
@@ -261,15 +261,15 @@ HRESULT ParallelPort::loadSettings (CFGNODE aNode, ULONG aSlot)
/* IRQ (required) */
uint32_t uIRQ;
CFGLDRQueryUInt32 (portNode, "IRQ", &uIRQ);
- /* device path (required) */
- Bstr DevicePath;
- CFGLDRQueryBSTR (portNode, "DevicePath", DevicePath.asOutParam());
+ /* device path */
+ Bstr path;
+ CFGLDRQueryBSTR (portNode, "path", path.asOutParam());
mData->mEnabled = fEnabled;
mData->mSlot = uSlot;
mData->mIOBase = uIOBase;
mData->mIRQ = uIRQ;
- mData->mDevicePath = DevicePath;
+ mData->mPath = path;
return S_OK;
}
@@ -291,7 +291,7 @@ HRESULT ParallelPort::saveSettings (CFGNODE aNode)
CFGLDRSetBool (portNode, "enabled", !!mData->mEnabled);
CFGLDRSetUInt32 (portNode, "IOBase", mData->mIOBase);
CFGLDRSetUInt32 (portNode, "IRQ", mData->mIRQ);
- CFGLDRSetBSTR (portNode, "DevicePath", mData->mDevicePath);
+ CFGLDRSetBSTR (portNode, "path", mData->mPath);
return S_OK;
}
@@ -450,9 +450,9 @@ STDMETHODIMP ParallelPort::COMSETTER(IOBase)(ULONG aIOBase)
return rc;
}
-STDMETHODIMP ParallelPort::COMGETTER(DevicePath) (BSTR *aDevicePath)
+STDMETHODIMP ParallelPort::COMGETTER(Path) (BSTR *aPath)
{
- if (!aDevicePath)
+ if (!aPath)
return E_POINTER;
AutoCaller autoCaller (this);
@@ -460,14 +460,14 @@ STDMETHODIMP ParallelPort::COMGETTER(DevicePath) (BSTR *aDevicePath)
AutoReaderLock alock (this);
- mData->mDevicePath.cloneTo (aDevicePath);
+ mData->mPath.cloneTo (aPath);
return S_OK;
}
-STDMETHODIMP ParallelPort::COMSETTER(DevicePath) (INPTR BSTR aDevicePath)
+STDMETHODIMP ParallelPort::COMSETTER(Path) (INPTR BSTR aPath)
{
- if (!aDevicePath || *aDevicePath == 0)
+ if (!aPath || *aPath == 0)
return E_INVALIDARG;
AutoCaller autoCaller (this);
@@ -479,10 +479,10 @@ STDMETHODIMP ParallelPort::COMSETTER(DevicePath) (INPTR BSTR aDevicePath)
AutoLock alock (this);
- if (mData->mDevicePath != aDevicePath)
+ if (mData->mPath != aPath)
{
mData.backup();
- mData->mDevicePath = aDevicePath;
+ mData->mPath = aPath;
/* leave the lock before informing callbacks */
alock.unlock();
diff --git a/src/VBox/Main/SerialPortImpl.cpp b/src/VBox/Main/SerialPortImpl.cpp
index e7ddd6bf04d..e3700a55a63 100644
--- a/src/VBox/Main/SerialPortImpl.cpp
+++ b/src/VBox/Main/SerialPortImpl.cpp
@@ -255,7 +255,6 @@ HRESULT SerialPort::loadSettings (CFGNODE aNode, ULONG aSlot)
/* enabled (required) */
bool fEnabled = false;
CFGLDRQueryBool (portNode, "enabled", &fEnabled);
- Bstr mode;
uint32_t uIOBase;
/* I/O base (required) */
CFGLDRQueryUInt32 (portNode, "IOBase", &uIOBase);
@@ -263,21 +262,20 @@ HRESULT SerialPort::loadSettings (CFGNODE aNode, ULONG aSlot)
uint32_t uIRQ;
CFGLDRQueryUInt32 (portNode, "IRQ", &uIRQ);
/* host mode (required) */
- CFGLDRQueryBSTR (portNode, "HostMode", mode.asOutParam());
+ Bstr mode;
+ CFGLDRQueryBSTR (portNode, "hostMode", mode.asOutParam());
if (mode == L"HostPipe")
- mData->mHostMode = SerialHostMode_HostPipe;
+ mData->mHostMode = PortMode_HostPipePort;
else if (mode == L"HostDevice")
- mData->mHostMode = SerialHostMode_HostDevice;
+ mData->mHostMode = PortMode_HostDevicePort;
else
- mData->mHostMode = SerialHostMode_Disconnected;
- /* name of the pipe (required) */
+ mData->mHostMode = PortMode_DisconnectedPort;
+ /* pipe/device path */
Bstr path;
int rc = CFGLDRQueryBSTR(portNode, "path", path.asOutParam());
- /* backward compatibility */
- if (rc == VERR_CFG_NO_VALUE)
- CFGLDRQueryBSTR(portNode, "pipe", path.asOutParam());
+ /* server mode */
bool fServer = true;
- CFGLDRQueryBool (portNode, "server", &fServer);
+ CFGLDRQueryBool (portNode, "server", &fServer);
mData->mEnabled = fEnabled;
mData->mSlot = uSlot;
@@ -306,29 +304,26 @@ HRESULT SerialPort::saveSettings (CFGNODE aNode)
switch (mData->mHostMode)
{
default:
- case SerialHostMode_Disconnected:
+ case PortMode_DisconnectedPort:
mode = "Disconnected";
break;
- case SerialHostMode_HostPipe:
+ case PortMode_HostPipePort:
mode = "HostPipe";
break;
- case SerialHostMode_HostDevice:
+ case PortMode_HostDevicePort:
mode = "HostDevice";
break;
}
CFGLDRSetUInt32 (portNode, "slot", mData->mSlot);
CFGLDRSetBool (portNode, "enabled", !!mData->mEnabled);
- if (mData->mEnabled)
+ CFGLDRSetUInt32 (portNode, "IOBase", mData->mIOBase);
+ CFGLDRSetUInt32 (portNode, "IRQ", mData->mIRQ);
+ CFGLDRSetString (portNode, "hostMode", mode);
+ if (mData->mHostMode != PortMode_DisconnectedPort)
{
- CFGLDRSetUInt32 (portNode, "IOBase", mData->mIOBase);
- CFGLDRSetUInt32 (portNode, "IRQ", mData->mIRQ);
- CFGLDRSetString (portNode, "HostMode", mode);
- if (mData->mHostMode != SerialHostMode_Disconnected)
- {
- CFGLDRSetBSTR (portNode, "path", mData->mPath);
- if (mData->mHostMode == SerialHostMode_HostPipe)
- CFGLDRSetBool (portNode, "server", !!mData->mServer);
- }
+ CFGLDRSetBSTR (portNode, "path", mData->mPath);
+ if (mData->mHostMode == PortMode_HostPipePort)
+ CFGLDRSetBool (portNode, "server", !!mData->mServer);
}
return S_OK;
@@ -379,7 +374,7 @@ STDMETHODIMP SerialPort::COMSETTER(Enabled) (BOOL aEnabled)
return S_OK;
}
-STDMETHODIMP SerialPort::COMGETTER(HostMode) (SerialHostMode_T *aHostMode)
+STDMETHODIMP SerialPort::COMGETTER(HostMode) (PortMode_T *aHostMode)
{
if (!aHostMode)
return E_POINTER;
@@ -394,7 +389,7 @@ STDMETHODIMP SerialPort::COMGETTER(HostMode) (SerialHostMode_T *aHostMode)
return S_OK;
}
-STDMETHODIMP SerialPort::COMSETTER(HostMode) (SerialHostMode_T aHostMode)
+STDMETHODIMP SerialPort::COMSETTER(HostMode) (PortMode_T aHostMode)
{
AutoCaller autoCaller (this);
CheckComRCReturnRC (autoCaller.rc());
@@ -412,7 +407,7 @@ STDMETHODIMP SerialPort::COMSETTER(HostMode) (SerialHostMode_T aHostMode)
{
mData.backup();
mData->mHostMode = aHostMode;
- if (aHostMode == SerialHostMode_Disconnected)
+ if (aHostMode == PortMode_DisconnectedPort)
{
mData->mPath = "";
mData->mServer = false;
diff --git a/src/VBox/Main/idl/VirtualBox.xidl b/src/VBox/Main/idl/VirtualBox.xidl
index c0cf9ddc146..a2b4551cb2c 100644
--- a/src/VBox/Main/idl/VirtualBox.xidl
+++ b/src/VBox/Main/idl/VirtualBox.xidl
@@ -7087,17 +7087,17 @@
-->
<enum
- name="SerialHostMode"
- uuid="5ac6ae50-30d4-4c89-8f9c-35b4500a5b9f"
+ name="PortMode"
+ uuid="b266f43c-2e93-46b3-812b-c20e600e867b"
>
- <const name="Disconnected" value="0"/>
- <const name="HostPipe" value="1"/>
- <const name="HostDevice" value="2"/>
+ <const name="DisconnectedPort" value="0"/>
+ <const name="HostPipePort" value="1"/>
+ <const name="HostDevicePort" value="2"/>
</enum>
<interface
name="ISerialPort" extends="$unknown"
- uuid="a5ab0989-0ca9-4d5e-b565-f7739b92bb0c"
+ uuid="937f6970-5103-4745-b78e-d28dcf1479a8"
wsmap="managed"
>
@@ -7111,29 +7111,37 @@
<attribute name="enabled" type="boolean">
<desc>
- Flag whether the serial port is enabled. If it is disabled,
- the serial port will not be reported to the guest.
+ Flag whether the serial port is enabled. If disabled,
+ the serial port will not be reported to the guest OS.
</desc>
</attribute>
<attribute name="IOBase" type="unsigned long">
- <desc>Gets the I/O base of the serial port.</desc>
+ <desc>I/O base of the serial port.</desc>
</attribute>
<attribute name="IRQ" type="unsigned long">
- <desc>Gets the IRQ of the serial port.</desc>
+ <desc>IRQ of the serial port.</desc>
</attribute>
- <attribute name="HostMode" type="SerialHostMode">
+ <attribute name="hostMode" type="PortMode">
<desc>How is this port connected to the host.</desc>
</attribute>
<attribute name="server" type="boolean">
- <desc>Flag whether this serial port acts as a server or a client.</desc>
+ <desc>
+ Flag whether this serial port acts as a server (creates a new pipe on
+ the host) or as a client (uses the existing pipe). This attribute is
+ used only when #hostMode is PortMode::HostPipe.
+ </desc>
</attribute>
<attribute name="path" type="wstring">
- <desc>Flag whether this serial port acts as a server or a client.</desc>
+ <desc>
+ Path to the serial port's pipe on the host when #hostMode is
+ PortMode::HostPipe, or the host serial device name when #hostMode is
+ PortMode::HostDevice.
+ </desc>
</attribute>
</interface>
@@ -7145,7 +7153,7 @@
<interface
name="IParallelPort" extends="$unknown"
- uuid="6d7f2385-8ce3-4342-a042-61fa1882354b"
+ uuid="0c925f06-dd10-4b77-8de8-294d738c3214"
wsmap="managed"
>
@@ -7159,21 +7167,21 @@
<attribute name="enabled" type="boolean">
<desc>
- Flag whether the parallel port is enabled. If it is disabled,
- the parallel port will not be reported to the guest.
+ Flag whether the parallel port is enabled. If disabled,
+ the parallel port will not be reported to the guest OS.
</desc>
</attribute>
<attribute name="IOBase" type="unsigned long">
- <desc>Gets the I/O base of the parallel port.</desc>
+ <desc>I/O base of the parallel port.</desc>
</attribute>
<attribute name="IRQ" type="unsigned long">
- <desc>Gets the IRQ of the parallel port.</desc>
+ <desc>IRQ of the parallel port.</desc>
</attribute>
- <attribute name="DevicePath" type="wstring">
- <desc>Gets the of the device path connected to the parallel port.</desc>
+ <attribute name="path" type="wstring">
+ <desc>Host parallel device name.</desc>
</attribute>
</interface>
diff --git a/src/VBox/Main/include/ParallelPortImpl.h b/src/VBox/Main/include/ParallelPortImpl.h
index 0b90fdfbaab..a91be1f9a8b 100644
--- a/src/VBox/Main/include/ParallelPortImpl.h
+++ b/src/VBox/Main/include/ParallelPortImpl.h
@@ -47,14 +47,15 @@ public:
(mSlot == that.mSlot &&
mEnabled == that.mEnabled &&
mIRQ == that.mIRQ &&
- mIOBase == that.mIOBase);
+ mIOBase == that.mIOBase &&
+ mPath == that.mPath);
}
ULONG mSlot;
BOOL mEnabled;
ULONG mIRQ;
ULONG mIOBase;
- Bstr mDevicePath;
+ Bstr mPath;
};
VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (ParallelPort)
@@ -89,8 +90,8 @@ public:
STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ);
STDMETHOD(COMGETTER(IOBase)) (ULONG *aIOBase);
STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase);
- STDMETHOD(COMGETTER(DevicePath)) (BSTR *aDevicePath);
- STDMETHOD(COMSETTER(DevicePath)) (INPTR BSTR aDevicePath);
+ STDMETHOD(COMGETTER(Path)) (BSTR *aPath);
+ STDMETHOD(COMSETTER(Path)) (INPTR BSTR aPath);
// public methods only for internal purposes
bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
diff --git a/src/VBox/Main/include/SerialPortImpl.h b/src/VBox/Main/include/SerialPortImpl.h
index 2406b56ecc3..668f2e6ab8d 100644
--- a/src/VBox/Main/include/SerialPortImpl.h
+++ b/src/VBox/Main/include/SerialPortImpl.h
@@ -39,7 +39,7 @@ public:
, mEnabled (FALSE)
, mIRQ (4)
, mIOBase (0x3f8)
- , mHostMode (SerialHostMode_Disconnected)
+ , mHostMode (PortMode_DisconnectedPort)
, mServer (FALSE)
{}
@@ -48,16 +48,18 @@ public:
return this == &that ||
(mSlot == that.mSlot &&
mEnabled == that.mEnabled &&
- mHostMode == that.mHostMode &&
mIRQ == that.mIRQ &&
- mIOBase == that.mIOBase);
+ mIOBase == that.mIOBase &&
+ mHostMode == that.mHostMode &&
+ mPath == that.mPath &&
+ mServer == that.mServer);
}
ULONG mSlot;
BOOL mEnabled;
ULONG mIRQ;
ULONG mIOBase;
- SerialHostMode_T mHostMode;
+ PortMode_T mHostMode;
Bstr mPath;
BOOL mServer;
};
@@ -90,8 +92,8 @@ public:
STDMETHOD(COMGETTER(Slot)) (ULONG *aSlot);
STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
- STDMETHOD(COMGETTER(HostMode)) (SerialHostMode_T *aHostMode);
- STDMETHOD(COMSETTER(HostMode)) (SerialHostMode_T aHostMode);
+ STDMETHOD(COMGETTER(HostMode)) (PortMode_T *aHostMode);
+ STDMETHOD(COMSETTER(HostMode)) (PortMode_T aHostMode);
STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ);
STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ);
STDMETHOD(COMGETTER(IOBase) ) (ULONG *aIOBase);
diff --git a/src/VBox/Main/xml/VirtualBox-settings-common.xsd b/src/VBox/Main/xml/VirtualBox-settings-common.xsd
index 2944672346d..5662514c667 100644
--- a/src/VBox/Main/xml/VirtualBox-settings-common.xsd
+++ b/src/VBox/Main/xml/VirtualBox-settings-common.xsd
@@ -171,7 +171,7 @@
</xsd:restriction>
</xsd:simpleType>
-<xsd:simpleType name="TUartHostModeType">
+<xsd:simpleType name="TPortMode">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Disconnected"/>
<xsd:enumeration value="HostPipe"/>
@@ -528,12 +528,11 @@
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="enabled" type="xsd:boolean" use="required"/>
- <xsd:attribute name="IRQ" type="xsd:unsignedInt" default="4"/>
- <xsd:attribute name="IOBase" type="xsd:unsignedInt" default="1016"/>
- <xsd:attribute name="HostMode" type="TUartHostModeType" default="Disconnected"/>
- <xsd:attribute name="pipe" type="xsd:string"/>
- <xsd:attribute name="path" type="xsd:string"/>
- <xsd:attribute name="server" type="xsd:boolean"/>
+ <xsd:attribute name="IRQ" type="xsd:unsignedInt" use="required"/>
+ <xsd:attribute name="IOBase" type="xsd:unsignedInt" use="required"/>
+ <xsd:attribute name="hostMode" type="TPortMode" use="required"/>
+ <xsd:attribute name="path" type="TLocalFile"/>
+ <xsd:attribute name="server" type="xsd:boolean" default="false"/>
</xsd:complexType>
<xsd:complexType name="TUart">
@@ -559,9 +558,9 @@
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="enabled" type="xsd:boolean" use="required"/>
- <xsd:attribute name="IRQ" type="xsd:unsignedInt" default="4"/>
- <xsd:attribute name="IOBase" type="xsd:unsignedInt" default="888"/>
- <xsd:attribute name="DevicePath" type="TLocalFile"/>
+ <xsd:attribute name="IRQ" type="xsd:unsignedInt" use="required"/>
+ <xsd:attribute name="IOBase" type="xsd:unsignedInt" use="required"/>
+ <xsd:attribute name="path" type="TLocalFile"/>
</xsd:complexType>
<xsd:complexType name="TLpt">