Changeset 4324 in vbox
- Timestamp:
- Aug 23, 2007 7:01:31 PM (17 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r4288 r4324 1058 1058 { 1059 1059 ULONG uIRQ, uIOBase; 1060 SerialHostMode_T HostMode;1060 PortMode_T HostMode; 1061 1061 Bstr path; 1062 1062 BOOL fServer; … … 1072 1072 { 1073 1073 default: 1074 case SerialHostMode_Disconnected:1074 case PortMode_DisconnectedPort: 1075 1075 RTPrintf(", disconnected\n"); 1076 1076 break; 1077 case SerialHostMode_HostPipe:1077 case PortMode_HostPipePort: 1078 1078 RTPrintf(", attached to pipe (%s) '%lS'\n", 1079 1079 fServer ? "server" : "client", path.raw()); 1080 1080 break; 1081 case SerialHostMode_HostDevice:1081 case PortMode_HostDevicePort: 1082 1082 RTPrintf(", attached to device '%lS'\n", path.raw()); 1083 1083 break; … … 4112 4112 if (strcmp(uarts_mode[n], "disconnected") == 0) 4113 4113 { 4114 CHECK_ERROR_RET(uart, COMSETTER(HostMode) ( SerialHostMode_Disconnected), 1);4114 CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_DisconnectedPort), 1); 4115 4115 } 4116 4116 else … … 4118 4118 if (strcmp(uarts_mode[n], "server") == 0) 4119 4119 { 4120 CHECK_ERROR_RET(uart, COMSETTER(HostMode) ( SerialHostMode_HostPipe), 1);4120 CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostPipePort), 1); 4121 4121 CHECK_ERROR_RET(uart, COMSETTER(Server) (TRUE), 1); 4122 4122 } 4123 4123 else if (strcmp(uarts_mode[n], "client") == 0) 4124 4124 { 4125 CHECK_ERROR_RET(uart, COMSETTER(HostMode) ( SerialHostMode_HostPipe), 1);4125 CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostPipePort), 1); 4126 4126 CHECK_ERROR_RET(uart, COMSETTER(Server) (FALSE), 1); 4127 4127 } 4128 4128 else 4129 4129 { 4130 CHECK_ERROR_RET(uart, COMSETTER(HostMode) ( SerialHostMode_HostDevice), 1);4130 CHECK_ERROR_RET(uart, COMSETTER(HostMode) (PortMode_HostDevicePort), 1); 4131 4131 } 4132 4132 CHECK_ERROR_RET(uart, COMSETTER(Path) (Bstr(uarts_path[n])), 1); -
trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro
r4071 r4324 22 22 FORMS = ui/VBoxDiskImageManagerDlg.ui \ 23 23 ui/VBoxVMNetworkSettings.ui \ 24 ui/VBoxVMSerialPortSettings.ui \ 24 25 ui/VBoxUSBFilterSettings.ui \ 25 26 ui/VBoxSharedFoldersSettings.ui \ -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r4294 r4324 226 226 } 227 227 228 QString toString (CEnums:: SerialHostMode t) const229 { 230 AssertMsg (! serialHostModeTypes [t].isNull(), ("No text for %d", t));231 return serialHostModeTypes [t];228 QString toString (CEnums::PortMode t) const 229 { 230 AssertMsg (!portModeTypes [t].isNull(), ("No text for %d", t)); 231 return portModeTypes [t]; 232 232 } 233 233 … … 260 260 } 261 261 262 CEnums:: SerialHostMode toSerialHostMode (const QString &s) const262 CEnums::PortMode toPortMode (const QString &s) const 263 263 { 264 264 QStringVector::const_iterator it = 265 qFind ( serialHostModeTypes.begin(), serialHostModeTypes.end(), s);266 AssertMsg (it != serialHostModeTypes.end(), ("No value for {%s}", s.latin1()));267 return CEnums:: SerialHostMode (it - serialHostModeTypes.begin());265 qFind (portModeTypes.begin(), portModeTypes.end(), s); 266 AssertMsg (it != portModeTypes.end(), ("No value for {%s}", s.latin1())); 267 return CEnums::PortMode (it - portModeTypes.begin()); 268 268 } 269 269 … … 549 549 QStringVector diskStorageTypes; 550 550 QStringVector vrdpAuthTypes; 551 QStringVector serialHostModeTypes;551 QStringVector portModeTypes; 552 552 QStringVector usbFilterActionTypes; 553 553 QStringVector diskControllerDevices; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r4297 r4324 576 576 , diskStorageTypes (CEnums::HardDiskStorageType_COUNT) 577 577 , vrdpAuthTypes (CEnums::VRDPAuthType_COUNT) 578 , serialHostModeTypes (CEnums::SerialHostMode_COUNT)578 , portModeTypes (CEnums::PortMode_COUNT) 579 579 , usbFilterActionTypes (CEnums::USBDeviceFilterAction_COUNT) 580 580 , diskControllerDevices (3) … … 1864 1864 tr ("Guest", "VRDPAuthType"); 1865 1865 1866 serialHostModeTypes [CEnums::Disconnected] =1867 tr ("Disconnected", " SerialHostMode");1868 serialHostModeTypes [CEnums::HostPipe] =1869 tr ("Host Pipe", " SerialHostMode");1870 serialHostModeTypes [CEnums::HostDevice] =1871 tr ("Host Device", " SerialHostMode");1866 portModeTypes [CEnums::DisconnectedPort] = 1867 tr ("Disconnected", "PortMode"); 1868 portModeTypes [CEnums::HostPipePort] = 1869 tr ("Host Pipe", "PortMode"); 1870 portModeTypes [CEnums::HostDevicePort] = 1871 tr ("Host Device", "PortMode"); 1872 1872 1873 1873 usbFilterActionTypes [CEnums::USBDeviceFilterIgnore] = -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMNetworkSettings.ui.h
r4071 r4324 26 26 *****************************************************************************/ 27 27 28 /**29 * VBoxVMNetworkSettings class to use as network interface setup page.30 */31 28 void VBoxVMNetworkSettings::init() 32 29 { -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
r4294 r4324 270 270 <item> 271 271 <property name="text"> 272 <string> Serial Port </string>272 <string> Serial Ports </string> 273 273 </property> 274 274 <property name="text"> … … 276 276 </property> 277 277 <property name="text"> 278 <string>#serial </string>278 <string>#serialPorts</string> 279 279 </property> 280 280 <property name="pixmap"> 281 <pixmap> refresh_16px.png</pixmap>281 <pixmap></pixmap> 282 282 </property> 283 283 <property name="pixmap"> … … 2712 2712 <number>9</number> 2713 2713 </attribute> 2714 <vbox> 2715 <property name="name"> 2716 <cstring>unnamed</cstring> 2717 </property> 2718 <property name="margin"> 2719 <number>0</number> 2720 </property> 2721 <widget class="QTabWidget"> 2722 <property name="name"> 2723 <cstring>tbwSerialPorts</cstring> 2724 </property> 2725 <property name="sizePolicy"> 2726 <sizepolicy> 2727 <hsizetype>1</hsizetype> 2728 <vsizetype>1</vsizetype> 2729 <horstretch>0</horstretch> 2730 <verstretch>0</verstretch> 2731 </sizepolicy> 2732 </property> 2733 </widget> 2734 </vbox> 2714 2735 </widget> 2715 2736 </widget> … … 3055 3076 <include location="local" impldecl="in declaration">VBoxGlobal.h</include> 3056 3077 <include location="local" impldecl="in implementation">VBoxVMNetworkSettings.h</include> 3078 <include location="local" impldecl="in implementation">VBoxVMSerialPortSettings.h</include> 3057 3079 <include location="local" impldecl="in implementation">VBoxUSBFilterSettings.h</include> 3058 3080 <include location="local" impldecl="in implementation">VBoxSharedFoldersSettings.h</include> … … 3066 3088 <forward>class VBoxUSBMenu</forward> 3067 3089 <forward>class VBoxSharedFoldersSettings</forward> 3068 <forward>class VBoxVMSerialPortSettings</forward>3069 3090 <forward>class QIRichLabel</forward> 3070 3091 <forward>class BootItemsList</forward> … … 3092 3113 <variable access="private">bool mUSBFilterListModified;</variable> 3093 3114 <variable access="private">VBoxSharedFoldersSettings *mSharedFolders;</variable> 3094 <variable access="private">VBoxVMSerialPortSettings *mSerialPorts;</variable>3095 3115 <variable access="private">QString warningString;</variable> 3096 3116 <variable access="private">VBoxMediaComboBox *cbHDA;</variable> … … 3116 3136 <slot>showImageManagerISOFloppy()</slot> 3117 3137 <slot>showVDImageManager( QUuid *id, VBoxMediaComboBox *le, QLabel *tx = NULL )</slot> 3118 <slot>addNetworkAdapter( const CNetworkAdapter & adapter )</slot> 3138 <slot>addNetworkAdapter( const CNetworkAdapter & )</slot> 3139 <slot>addSerialPort( const CSerialPort & )</slot> 3119 3140 <slot>slRAM_valueChanged( int val )</slot> 3120 3141 <slot>leRAM_textChanged( const QString & text )</slot> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r4300 r4324 470 470 471 471 472 class VBoxVMSerialPortSettings : public QWidget473 {474 Q_OBJECT475 476 public:477 478 VBoxVMSerialPortSettings (QWidget *aParent)479 : QWidget (aParent, "VBoxVMSerialPortSettings")480 , mTabWidget (0)481 {482 /* Basic initialization */483 mTabWidget = new QTabWidget (this, "mTabWidget");484 mTabWidget->setMargin (11);485 mTabWidget->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Preferred);486 QVBoxLayout *mainLayout = new QVBoxLayout (this);487 mainLayout->addWidget (mTabWidget);488 mainLayout->addItem (new QSpacerItem (0, 0, QSizePolicy::Preferred,489 QSizePolicy::Expanding));490 491 /* Create a list of known COM interfaces configurations */492 mConfigList << PortConfig (0x3f8, 4, 1);493 mConfigList << PortConfig (0x2f8, 3, 2);494 mConfigList << PortConfig (0x3e8, 4, 3);495 mConfigList << PortConfig (0x2e8, 3, 4);496 }497 498 void getFromMachine (const CMachine &aMachine)499 {500 mMachine = aMachine;501 502 ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetSerialPortCount();503 for (ulong slot = 0; slot < count; ++ slot)504 {505 CSerialPort port = mMachine.GetSerialPort (slot);506 addPage (port, slot);507 }508 509 /* Revalidate all pages */510 portConfigUpdate();511 }512 513 void putBackToMachine()514 {515 for (int slot = 0; slot < mTabWidget->count(); ++ slot)516 {517 CSerialPort port = mMachine.GetSerialPort (slot);518 519 port.SetEnabled (static_cast<QGroupBox*> (mTabWidget->page (slot))->isChecked());520 521 PortConfig config = parsePortConfig (mPortList.at (slot)->currentText());522 port.SetIOBase (config.io);523 port.SetIRQ (config.irq);524 525 port.SetHostMode (vboxGlobal().toSerialHostMode (mModeList.at (slot)->currentText()));526 527 QCheckBox *chbIsServer = mIsServerList.at (slot);528 port.SetServer (chbIsServer->isEnabled() ?529 chbIsServer->isChecked() : false);530 531 QLineEdit *lePath = mPathList.at (slot);532 port.SetPath (lePath->isEnabled() ?533 lePath->text() : QString::null);534 }535 }536 537 private slots:538 539 void portConfigUpdate()540 {541 for (int index = 0; index < mTabWidget->count(); ++ index)542 {543 QComboBox *cbPortConfig = mPortList.at (index);544 QString oldText = cbPortConfig->currentText();545 QStringList newList = portConfigList (index);546 cbPortConfig->clear();547 cbPortConfig->insertStringList (newList);548 cbPortConfig->setCurrentText (oldText);549 }550 }551 552 void hostModeUpdate (int aIndex = -1)553 {554 if (aIndex == -1)555 aIndex = mTabWidget->currentPageIndex();556 QCheckBox *chbIsServer = mIsServerList.at (aIndex);557 QLineEdit *lePath = mPathList.at (aIndex);558 CEnums::SerialHostMode mode = vboxGlobal().toSerialHostMode (559 mModeList.at (aIndex)->currentText());560 chbIsServer->setEnabled (mode == CEnums::HostPipe);561 lePath->setEnabled (mode != CEnums::Disconnected);562 }563 564 private:565 566 struct PortConfig567 {568 PortConfig ()569 : io (0), irq (0), number (0) {}570 PortConfig (ulong aIO, ulong aIRQ, ulong aNumber)571 : io (aIO), irq (aIRQ), number (aNumber) {}572 573 bool isNull() { return !io && !irq; }574 575 bool operator== (const PortConfig &aCfg) const576 {577 return io == aCfg.io && irq == aCfg.irq;578 }579 580 static QString format()581 {582 return QString ("I/O Port = 0x%1, IRQ = %2");583 }584 QString toString()585 {586 QString info = format().arg (QString::number (io, 16)).arg (irq);587 if (number)588 info += QString (" (COM%1)").arg (number);589 return info;590 }591 592 ulong io;593 ulong irq;594 ulong number;595 };596 typedef QValueList<PortConfig> PortConfigs;597 598 void addPage (const CSerialPort &aPort, ulong aSlot)599 {600 /* Create Serial Port page */601 QGroupBox *gBox = new QGroupBox (tr ("&Enable Serial Port"));602 gBox->setColumnLayout (0, Qt::Vertical);603 gBox->layout()->setMargin (11);604 gBox->layout()->setSpacing (6);605 gBox->setCheckable (true);606 607 QLabel *lbPort = new QLabel (tr ("Serial Port &Number"), gBox);608 QComboBox *cbPort = new QComboBox (gBox);609 lbPort->setBuddy (cbPort);610 connect (cbPort, SIGNAL (activated (int)),611 this , SLOT (portConfigUpdate()));612 613 QLabel *lbType = new QLabel (tr ("Serial Port Host &Mode"), gBox);614 QComboBox *cbMode = new QComboBox (gBox);615 lbType->setBuddy (cbMode);616 cbMode->insertItem (vboxGlobal().toString (CEnums::Disconnected));617 cbMode->insertItem (vboxGlobal().toString (CEnums::HostPipe));618 cbMode->insertItem (vboxGlobal().toString (CEnums::HostDevice));619 connect (cbMode, SIGNAL (activated (int)),620 this , SLOT (hostModeUpdate()));621 622 QCheckBox *chbIsServer = new QCheckBox (tr ("Create Pipe &Automatically"), gBox);623 624 QLabel *lbPath = new QLabel (tr ("Serial Port &Path"), gBox);625 QLineEdit *lePath = new QLineEdit (gBox);626 lbPath->setBuddy (lePath);627 628 QGridLayout *pageLayout = new QGridLayout (gBox->layout());629 pageLayout->setAlignment (Qt::AlignTop);630 pageLayout->addWidget (lbPort, 0, 0);631 pageLayout->addMultiCellWidget (cbPort, 0, 0, 1, 2);632 pageLayout->addWidget (lbType, 1, 0);633 pageLayout->addWidget (cbMode, 1, 1);634 pageLayout->addWidget (chbIsServer, 1, 2);635 pageLayout->addWidget (lbPath, 2, 0);636 pageLayout->addMultiCellWidget (lePath, 2, 2, 1, 2);637 638 /* Load machine information */639 gBox->setChecked (aPort.GetEnabled());640 641 PortConfig config (aPort.GetIOBase(), aPort.GetIRQ(), 0);642 if (!mConfigList.contains (config))643 mConfigList << config;644 cbPort->insertStringList (portConfigList (mTabWidget->count()));645 for (int id = 0; id < cbPort->count(); ++ id)646 if (parsePortConfig (cbPort->text (id)) == config)647 cbPort->setCurrentItem (id);648 649 cbMode->setCurrentText (vboxGlobal().toString (aPort.GetHostMode()));650 651 chbIsServer->setChecked (aPort.GetServer());652 653 lePath->setText (aPort.GetPath());654 655 /* Append newly createrd widget */656 mTabWidget->addTab (gBox, tr ("Port &%1").arg (aSlot));657 mPortList.append (cbPort);658 mModeList.append (cbMode);659 mIsServerList.append (chbIsServer);660 mPathList.append (lePath);661 662 /* Revalidate page */663 hostModeUpdate (aSlot);664 }665 666 QStringList portConfigList (int aIndex)667 {668 QStringList list;669 PortConfigs config = portConfigs (aIndex);670 for (ulong id = 0; id < config.count(); ++ id)671 list << config [id].toString();672 return list;673 }674 675 PortConfigs portConfigs (int aIndex)676 {677 PortConfigs config (mConfigList);678 if (aIndex == mTabWidget->count())679 return config;680 681 for (int index = 0; index < mTabWidget->count(); ++ index)682 {683 if (index != aIndex)684 {685 PortConfig used = parsePortConfig (mPortList.at (index)->currentText());686 Assert (!used.isNull());687 config.remove (used);688 }689 }690 return config;691 }692 693 PortConfig parsePortConfig (const QString &aString)694 {695 QRegExp regExp (PortConfig::format().arg ("([0-9a-f]+)").arg ("(\\d+)"));696 if (regExp.search (aString) != -1)697 return PortConfig (regExp.cap (1).toULong(0, 16),698 regExp.cap (2).toULong(), 0);699 Assert (0);700 return PortConfig();701 }702 703 QTabWidget *mTabWidget;704 PortConfigs mConfigList;705 706 QPtrList<QComboBox> mPortList;707 QPtrList<QComboBox> mModeList;708 QPtrList<QCheckBox> mIsServerList;709 QPtrList<QLineEdit> mPathList;710 711 CMachine mMachine;712 };713 714 715 472 void VBoxVMSettingsDlg::init() 716 473 { … … 957 714 QToolTip::add (pbHostRemove, tr ("Remove")); 958 715 716 /* Serial Port Page */ 717 959 718 /* USB Page */ 960 719 … … 1021 780 mSharedFolders->setDialogType (VBoxSharedFoldersSettings::MachineType); 1022 781 pageFoldersLayout->addWidget (mSharedFolders); 1023 1024 /* Serial Port Page */1025 1026 QVBoxLayout* pageSerialLayout = new QVBoxLayout (pageSerial, 0, 0);1027 mSerialPorts = new VBoxVMSerialPortSettings (pageSerial);1028 pageSerialLayout->addWidget (mSerialPorts);1029 782 1030 783 /* … … 1549 1302 Q_UNUSED (wval); 1550 1303 1304 /* reset the warning text; interested parties will set it during 1305 * validation */ 1306 setWarning (QString::null); 1307 1551 1308 /* detect the overall validity */ 1552 1309 bool newValid = true; … … 1567 1324 valid = newValid; 1568 1325 buttonOk->setEnabled (valid); 1569 if (valid) 1570 setWarning(0); 1571 warningLabel->setHidden(valid); 1572 warningPixmap->setHidden(valid); 1573 } 1574 } 1575 1576 1577 void VBoxVMSettingsDlg::revalidate( QIWidgetValidator *wval ) 1326 warningLabel->setHidden (valid); 1327 warningPixmap->setHidden (valid); 1328 } 1329 } 1330 1331 1332 void VBoxVMSettingsDlg::revalidate (QIWidgetValidator *wval) 1578 1333 { 1579 1334 /* do individual validations for pages */ … … 1581 1336 bool valid = wval->isOtherValid(); 1582 1337 1338 QString warningText; 1339 QString pageTitle = ::path (listView->currentItem()); 1340 1583 1341 if (pg == pageHDD) 1584 1342 { … … 1593 1351 { 1594 1352 valid = false; 1595 setWarning (tr ("Primary Master hard disk is not selected."));1353 warningText = tr ("Primary Master hard disk is not selected"); 1596 1354 } 1597 1355 else uuids << uuidHDA; … … 1603 1361 { 1604 1362 valid = false; 1605 setWarning (tr ("Primary Slave hard disk is not selected."));1363 warningText = tr ("Primary Slave hard disk is not selected"); 1606 1364 } 1607 1365 else … … 1616 1374 uuids << uuidHDB; 1617 1375 else 1618 setWarning (tr ("Primary Slave hard disk is already attached "1619 "to a different slot."));1376 warningText = tr ("Primary Slave hard disk is already attached " 1377 "to a different slot"); 1620 1378 } 1621 1379 } … … 1626 1384 { 1627 1385 valid = false; 1628 setWarning (tr ("Secondary Slave hard disk is not selected."));1386 warningText = tr ("Secondary Slave hard disk is not selected"); 1629 1387 } 1630 1388 else … … 1639 1397 uuids << uuidHDB; 1640 1398 else 1641 setWarning (tr ("Secondary Slave hard disk is already attached "1642 "to a different slot."));1399 warningText = tr ("Secondary Slave hard disk is already attached " 1400 "to a different slot"); 1643 1401 } 1644 1402 } … … 1667 1425 1668 1426 if (!valid) 1669 setWarning (tr ("CD/DVD image file is not selected."));1427 warningText = tr ("CD/DVD image file is not selected"); 1670 1428 } 1671 1429 else if (pg == pageFloppy) … … 1684 1442 1685 1443 if (!valid) 1686 setWarning (tr ("Floppy image file is not selected."));1444 warningText = tr ("Floppy image file is not selected"); 1687 1445 } 1688 1446 else if (pg == pageNetwork) 1689 1447 { 1448 QWidget *tab = NULL; 1449 for (int index = 0; index < tbwNetwork->count(); ++ index) 1450 { 1451 QWidget *tab = tbwNetwork->page (index); 1452 VBoxVMNetworkSettings *page = 1453 static_cast <VBoxVMNetworkSettings *> (tab); 1454 valid = page->isPageValid (mInterfaceList); 1455 if (!valid) break; 1456 } 1457 if (!valid) 1458 { 1459 Assert (tab); 1460 warningText = tr ("Incorrect host network interface is selected"); 1461 pageTitle += ": " + tbwNetwork->tabLabel (tab); 1462 } 1463 } 1464 else if (pg == pageSerial) 1465 { 1466 QValueList <QString> ports; 1467 QValueList <QString> paths; 1468 1690 1469 int index = 0; 1691 for (; index < tbwNetwork->count(); ++index) 1692 { 1693 QWidget *tab = tbwNetwork->page (index); 1694 VBoxVMNetworkSettings *set = static_cast<VBoxVMNetworkSettings*> (tab); 1695 valid = set->isPageValid (mInterfaceList); 1696 if (!valid) break; 1697 } 1698 if (!valid) 1699 setWarning (tr ("Incorrect host network interface is selected " 1700 "for Adapter %1.").arg (index)); 1470 for (; index < tbwSerialPorts->count(); ++ index) 1471 { 1472 QWidget *tab = tbwSerialPorts->page (index); 1473 VBoxVMSerialPortSettings *page = 1474 static_cast <VBoxVMSerialPortSettings *> (tab); 1475 1476 /* skip disabled ports */ 1477 if (!page->mSerialPortBox->isChecked()) 1478 continue; 1479 /* check the predefined port number unicity */ 1480 if (!page->isUserDefined()) 1481 { 1482 QString port = page->mPortNumCombo->currentText(); 1483 valid = !ports.contains (port); 1484 if (!valid) 1485 { 1486 warningText = tr ("Duplicate port number is selected "); 1487 pageTitle += ": " + tbwSerialPorts->tabLabel (tab); 1488 break; 1489 } 1490 ports << port; 1491 } 1492 /* check the port path unicity */ 1493 CEnums::PortMode mode = 1494 vboxGlobal().toPortMode (page->mHostModeCombo->currentText()); 1495 if (mode != CEnums::DisconnectedPort) 1496 { 1497 QString path = page->mPortPathLine->text(); 1498 valid = !paths.contains (path); 1499 if (!valid) 1500 { 1501 warningText = tr ("Duplicate port path is entered "); 1502 pageTitle += ": " + tbwSerialPorts->tabLabel (tab); 1503 break; 1504 } 1505 paths << path; 1506 } 1507 } 1701 1508 } 1702 1509 else if (pg == pageVRDP) … … 1707 1514 (leVRDPPort->text().isEmpty() || leVRDPTimeout->text().isEmpty())); 1708 1515 if (!valid && leVRDPPort->text().isEmpty()) 1709 setWarning (tr ("VRDP Port is not set."));1516 warningText = tr ("VRDP Port is not set "); 1710 1517 if (!valid && leVRDPTimeout->text().isEmpty()) 1711 setWarning (tr ("VRDP Timeout is not set."));1518 warningText = tr ("VRDP Timeout is not set "); 1712 1519 } 1713 1520 else 1714 1521 valid = true; 1715 1522 } 1523 1524 if (!valid) 1525 setWarning (tr ("%1 on the <b>%2</b> page.") 1526 .arg (warningText, pageTitle)); 1716 1527 1717 1528 wval->setOtherValid (valid); … … 1980 1791 } 1981 1792 1793 /* serial ports */ 1794 { 1795 ulong count = vbox.GetSystemProperties().GetSerialPortCount(); 1796 for (ulong slot = 0; slot < count; ++ slot) 1797 { 1798 CSerialPort port = machine.GetSerialPort (slot); 1799 addSerialPort (port); 1800 } 1801 } 1802 1982 1803 /* USB */ 1983 1804 { … … 2049 1870 { 2050 1871 mSharedFolders->getFromMachine (machine); 2051 }2052 2053 /* serial ports */2054 {2055 mSerialPorts->getFromMachine (machine);2056 1872 } 2057 1873 … … 2254 2070 } 2255 2071 2072 /* serial ports */ 2073 { 2074 for (int index = 0; index < tbwSerialPorts->count(); index++) 2075 { 2076 VBoxVMSerialPortSettings *page = 2077 (VBoxVMSerialPortSettings *) tbwSerialPorts->page (index); 2078 Assert (page); 2079 page->putBackToPort(); 2080 } 2081 } 2082 2256 2083 /* usb */ 2257 2084 { … … 2316 2143 } 2317 2144 2318 /* serial ports */2319 {2320 mSerialPorts->putBackToMachine();2321 }2322 2323 2145 return COMResult(); 2324 2146 } … … 2400 2222 2401 2223 #endif 2224 } 2225 2226 void VBoxVMSettingsDlg::addSerialPort (const CSerialPort &aPort) 2227 { 2228 VBoxVMSerialPortSettings *page = new VBoxVMSerialPortSettings(); 2229 page->getFromPort (aPort); 2230 tbwSerialPorts->addTab (page, QString (tr ("Port %1", "serial ports")) 2231 .arg (aPort.GetSlot())); 2232 2233 /* fix the tab order so that main dialog's buttons are always the last */ 2234 setTabOrder (page->mPortPathLine, buttonHelp); 2235 setTabOrder (buttonHelp, buttonOk); 2236 setTabOrder (buttonOk, buttonCancel); 2237 2238 /* setup validation */ 2239 QIWidgetValidator *wval = new QIWidgetValidator (pageSerial, this); 2240 connect (page->mSerialPortBox, SIGNAL (toggled (bool)), 2241 wval, SLOT (revalidate())); 2242 connect (page->mIRQLine, SIGNAL (textChanged (const QString &)), 2243 wval, SLOT (revalidate())); 2244 connect (page->mIOPortLine, SIGNAL (textChanged (const QString &)), 2245 wval, SLOT (revalidate())); 2246 connect (page->mHostModeCombo, SIGNAL (activated (const QString &)), 2247 wval, SLOT (revalidate())); 2248 connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)), 2249 this, SLOT (enableOk (const QIWidgetValidator *))); 2250 connect (wval, SIGNAL (isValidRequested (QIWidgetValidator *)), 2251 this, SLOT (revalidate (QIWidgetValidator *))); 2252 2253 wval->revalidate(); 2402 2254 } 2403 2255 -
trunk/src/VBox/Main/ConsoleImpl.cpp
r4322 r4324 5925 5925 5926 5926 ULONG uIRQ, uIOBase; 5927 SerialHostMode_T HostMode;5927 PortMode_T HostMode; 5928 5928 Bstr path; 5929 5929 BOOL fServer; … … 5935 5935 rc = CFGMR3InsertInteger(pCfg, "IRQ", uIRQ); RC_CHECK(); 5936 5936 rc = CFGMR3InsertInteger(pCfg, "IOBase", uIOBase); RC_CHECK(); 5937 if (HostMode != SerialHostMode_Disconnected)5937 if (HostMode != PortMode_DisconnectedPort) 5938 5938 { 5939 5939 rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0); RC_CHECK(); 5940 if (HostMode == SerialHostMode_HostPipe)5940 if (HostMode == PortMode_HostPipePort) 5941 5941 { 5942 5942 rc = CFGMR3InsertString(pLunL0, "Driver", "Char"); RC_CHECK(); … … 5947 5947 rc = CFGMR3InsertInteger(pLunL2, "IsServer", fServer); RC_CHECK(); 5948 5948 } 5949 else if (HostMode == SerialHostMode_HostDevice)5949 else if (HostMode == PortMode_HostDevicePort) 5950 5950 { 5951 5951 rc = CFGMR3InsertString(pLunL0, "Driver", "Host Serial"); RC_CHECK(); … … 5980 5980 hrc = parallelPort->COMGETTER(IRQ)(&uIRQ); H(); 5981 5981 hrc = parallelPort->COMGETTER(IOBase)(&uIOBase); H(); 5982 hrc = parallelPort->COMGETTER( DevicePath)(DevicePath.asOutParam());H();5982 hrc = parallelPort->COMGETTER(Path)(DevicePath.asOutParam()); H(); 5983 5983 rc = CFGMR3InsertInteger(pCfg, "IRQ", uIRQ); RC_CHECK(); 5984 5984 rc = CFGMR3InsertInteger(pCfg, "IOBase", uIOBase); RC_CHECK(); -
trunk/src/VBox/Main/ParallelPortImpl.cpp
r4071 r4324 262 262 uint32_t uIRQ; 263 263 CFGLDRQueryUInt32 (portNode, "IRQ", &uIRQ); 264 /* device path (required)*/265 Bstr DevicePath;266 CFGLDRQueryBSTR (portNode, " DevicePath", DevicePath.asOutParam());264 /* device path */ 265 Bstr path; 266 CFGLDRQueryBSTR (portNode, "path", path.asOutParam()); 267 267 268 268 mData->mEnabled = fEnabled; … … 270 270 mData->mIOBase = uIOBase; 271 271 mData->mIRQ = uIRQ; 272 mData->m DevicePath = DevicePath;272 mData->mPath = path; 273 273 274 274 return S_OK; … … 292 292 CFGLDRSetUInt32 (portNode, "IOBase", mData->mIOBase); 293 293 CFGLDRSetUInt32 (portNode, "IRQ", mData->mIRQ); 294 CFGLDRSetBSTR (portNode, " DevicePath", mData->mDevicePath);294 CFGLDRSetBSTR (portNode, "path", mData->mPath); 295 295 296 296 return S_OK; … … 451 451 } 452 452 453 STDMETHODIMP ParallelPort::COMGETTER( DevicePath) (BSTR *aDevicePath)454 { 455 if (!a DevicePath)453 STDMETHODIMP ParallelPort::COMGETTER(Path) (BSTR *aPath) 454 { 455 if (!aPath) 456 456 return E_POINTER; 457 457 … … 461 461 AutoReaderLock alock (this); 462 462 463 mData->m DevicePath.cloneTo (aDevicePath);464 465 return S_OK; 466 } 467 468 STDMETHODIMP ParallelPort::COMSETTER( DevicePath) (INPTR BSTR aDevicePath)469 { 470 if (!a DevicePath || *aDevicePath == 0)463 mData->mPath.cloneTo (aPath); 464 465 return S_OK; 466 } 467 468 STDMETHODIMP ParallelPort::COMSETTER(Path) (INPTR BSTR aPath) 469 { 470 if (!aPath || *aPath == 0) 471 471 return E_INVALIDARG; 472 472 … … 480 480 AutoLock alock (this); 481 481 482 if (mData->m DevicePath != aDevicePath)482 if (mData->mPath != aPath) 483 483 { 484 484 mData.backup(); 485 mData->m DevicePath = aDevicePath;485 mData->mPath = aPath; 486 486 487 487 /* leave the lock before informing callbacks */ -
trunk/src/VBox/Main/SerialPortImpl.cpp
r4293 r4324 256 256 bool fEnabled = false; 257 257 CFGLDRQueryBool (portNode, "enabled", &fEnabled); 258 Bstr mode;259 258 uint32_t uIOBase; 260 259 /* I/O base (required) */ … … 264 263 CFGLDRQueryUInt32 (portNode, "IRQ", &uIRQ); 265 264 /* host mode (required) */ 266 CFGLDRQueryBSTR (portNode, "HostMode", mode.asOutParam()); 265 Bstr mode; 266 CFGLDRQueryBSTR (portNode, "hostMode", mode.asOutParam()); 267 267 if (mode == L"HostPipe") 268 mData->mHostMode = SerialHostMode_HostPipe;268 mData->mHostMode = PortMode_HostPipePort; 269 269 else if (mode == L"HostDevice") 270 mData->mHostMode = SerialHostMode_HostDevice;270 mData->mHostMode = PortMode_HostDevicePort; 271 271 else 272 mData->mHostMode = SerialHostMode_Disconnected;273 /* name of the pipe (required)*/272 mData->mHostMode = PortMode_DisconnectedPort; 273 /* pipe/device path */ 274 274 Bstr path; 275 275 int rc = CFGLDRQueryBSTR(portNode, "path", path.asOutParam()); 276 /* backward compatibility */ 277 if (rc == VERR_CFG_NO_VALUE) 278 CFGLDRQueryBSTR(portNode, "pipe", path.asOutParam()); 276 /* server mode */ 279 277 bool fServer = true; 280 CFGLDRQueryBool 278 CFGLDRQueryBool (portNode, "server", &fServer); 281 279 282 280 mData->mEnabled = fEnabled; … … 307 305 { 308 306 default: 309 case SerialHostMode_Disconnected:307 case PortMode_DisconnectedPort: 310 308 mode = "Disconnected"; 311 309 break; 312 case SerialHostMode_HostPipe:310 case PortMode_HostPipePort: 313 311 mode = "HostPipe"; 314 312 break; 315 case SerialHostMode_HostDevice:313 case PortMode_HostDevicePort: 316 314 mode = "HostDevice"; 317 315 break; … … 319 317 CFGLDRSetUInt32 (portNode, "slot", mData->mSlot); 320 318 CFGLDRSetBool (portNode, "enabled", !!mData->mEnabled); 321 if (mData->mEnabled) 322 { 323 CFGLDRSetUInt32 (portNode, "IOBase", mData->mIOBase); 324 CFGLDRSetUInt32 (portNode, "IRQ", mData->mIRQ); 325 CFGLDRSetString (portNode, "HostMode", mode); 326 if (mData->mHostMode != SerialHostMode_Disconnected) 327 { 328 CFGLDRSetBSTR (portNode, "path", mData->mPath); 329 if (mData->mHostMode == SerialHostMode_HostPipe) 330 CFGLDRSetBool (portNode, "server", !!mData->mServer); 331 } 319 CFGLDRSetUInt32 (portNode, "IOBase", mData->mIOBase); 320 CFGLDRSetUInt32 (portNode, "IRQ", mData->mIRQ); 321 CFGLDRSetString (portNode, "hostMode", mode); 322 if (mData->mHostMode != PortMode_DisconnectedPort) 323 { 324 CFGLDRSetBSTR (portNode, "path", mData->mPath); 325 if (mData->mHostMode == PortMode_HostPipePort) 326 CFGLDRSetBool (portNode, "server", !!mData->mServer); 332 327 } 333 328 … … 380 375 } 381 376 382 STDMETHODIMP SerialPort::COMGETTER(HostMode) ( SerialHostMode_T *aHostMode)377 STDMETHODIMP SerialPort::COMGETTER(HostMode) (PortMode_T *aHostMode) 383 378 { 384 379 if (!aHostMode) … … 395 390 } 396 391 397 STDMETHODIMP SerialPort::COMSETTER(HostMode) ( SerialHostMode_T aHostMode)392 STDMETHODIMP SerialPort::COMSETTER(HostMode) (PortMode_T aHostMode) 398 393 { 399 394 AutoCaller autoCaller (this); … … 413 408 mData.backup(); 414 409 mData->mHostMode = aHostMode; 415 if (aHostMode == SerialHostMode_Disconnected)410 if (aHostMode == PortMode_DisconnectedPort) 416 411 { 417 412 mData->mPath = ""; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r4318 r4324 7088 7088 7089 7089 <enum 7090 name=" SerialHostMode"7091 uuid=" 5ac6ae50-30d4-4c89-8f9c-35b4500a5b9f"7090 name="PortMode" 7091 uuid="b266f43c-2e93-46b3-812b-c20e600e867b" 7092 7092 > 7093 <const name="Disconnected " value="0"/>7094 <const name="HostPipe " value="1"/>7095 <const name="HostDevice " value="2"/>7093 <const name="DisconnectedPort" value="0"/> 7094 <const name="HostPipePort" value="1"/> 7095 <const name="HostDevicePort" value="2"/> 7096 7096 </enum> 7097 7097 7098 7098 <interface 7099 7099 name="ISerialPort" extends="$unknown" 7100 uuid=" a5ab0989-0ca9-4d5e-b565-f7739b92bb0c"7100 uuid="937f6970-5103-4745-b78e-d28dcf1479a8" 7101 7101 wsmap="managed" 7102 7102 > … … 7112 7112 <attribute name="enabled" type="boolean"> 7113 7113 <desc> 7114 Flag whether the serial port is enabled. If it isdisabled,7115 the serial port will not be reported to the guest .7114 Flag whether the serial port is enabled. If disabled, 7115 the serial port will not be reported to the guest OS. 7116 7116 </desc> 7117 7117 </attribute> 7118 7118 7119 7119 <attribute name="IOBase" type="unsigned long"> 7120 <desc> Gets theI/O base of the serial port.</desc>7120 <desc>I/O base of the serial port.</desc> 7121 7121 </attribute> 7122 7122 7123 7123 <attribute name="IRQ" type="unsigned long"> 7124 <desc> Gets theIRQ of the serial port.</desc>7125 </attribute> 7126 7127 <attribute name=" HostMode" type="SerialHostMode">7124 <desc>IRQ of the serial port.</desc> 7125 </attribute> 7126 7127 <attribute name="hostMode" type="PortMode"> 7128 7128 <desc>How is this port connected to the host.</desc> 7129 7129 </attribute> 7130 7130 7131 7131 <attribute name="server" type="boolean"> 7132 <desc>Flag whether this serial port acts as a server or a client.</desc> 7132 <desc> 7133 Flag whether this serial port acts as a server (creates a new pipe on 7134 the host) or as a client (uses the existing pipe). This attribute is 7135 used only when #hostMode is PortMode::HostPipe. 7136 </desc> 7133 7137 </attribute> 7134 7138 7135 7139 <attribute name="path" type="wstring"> 7136 <desc>Flag whether this serial port acts as a server or a client.</desc> 7140 <desc> 7141 Path to the serial port's pipe on the host when #hostMode is 7142 PortMode::HostPipe, or the host serial device name when #hostMode is 7143 PortMode::HostDevice. 7144 </desc> 7137 7145 </attribute> 7138 7146 … … 7146 7154 <interface 7147 7155 name="IParallelPort" extends="$unknown" 7148 uuid=" 6d7f2385-8ce3-4342-a042-61fa1882354b"7156 uuid="0c925f06-dd10-4b77-8de8-294d738c3214" 7149 7157 wsmap="managed" 7150 7158 > … … 7160 7168 <attribute name="enabled" type="boolean"> 7161 7169 <desc> 7162 Flag whether the parallel port is enabled. If it isdisabled,7163 the parallel port will not be reported to the guest .7170 Flag whether the parallel port is enabled. If disabled, 7171 the parallel port will not be reported to the guest OS. 7164 7172 </desc> 7165 7173 </attribute> 7166 7174 7167 7175 <attribute name="IOBase" type="unsigned long"> 7168 <desc> Gets theI/O base of the parallel port.</desc>7176 <desc>I/O base of the parallel port.</desc> 7169 7177 </attribute> 7170 7178 7171 7179 <attribute name="IRQ" type="unsigned long"> 7172 <desc> Gets theIRQ of the parallel port.</desc>7173 </attribute> 7174 7175 <attribute name=" DevicePath" type="wstring">7176 <desc> Gets the of the device path connected to the parallel port.</desc>7180 <desc>IRQ of the parallel port.</desc> 7181 </attribute> 7182 7183 <attribute name="path" type="wstring"> 7184 <desc>Host parallel device name.</desc> 7177 7185 </attribute> 7178 7186 -
trunk/src/VBox/Main/include/ParallelPortImpl.h
r4071 r4324 48 48 mEnabled == that.mEnabled && 49 49 mIRQ == that.mIRQ && 50 mIOBase == that.mIOBase); 50 mIOBase == that.mIOBase && 51 mPath == that.mPath); 51 52 } 52 53 … … 55 56 ULONG mIRQ; 56 57 ULONG mIOBase; 57 Bstr m DevicePath;58 Bstr mPath; 58 59 }; 59 60 … … 90 91 STDMETHOD(COMGETTER(IOBase)) (ULONG *aIOBase); 91 92 STDMETHOD(COMSETTER(IOBase)) (ULONG aIOBase); 92 STDMETHOD(COMGETTER( DevicePath)) (BSTR *aDevicePath);93 STDMETHOD(COMSETTER( DevicePath)) (INPTR BSTR aDevicePath);93 STDMETHOD(COMGETTER(Path)) (BSTR *aPath); 94 STDMETHOD(COMSETTER(Path)) (INPTR BSTR aPath); 94 95 95 96 // public methods only for internal purposes -
trunk/src/VBox/Main/include/SerialPortImpl.h
r4273 r4324 40 40 , mIRQ (4) 41 41 , mIOBase (0x3f8) 42 , mHostMode ( SerialHostMode_Disconnected)42 , mHostMode (PortMode_DisconnectedPort) 43 43 , mServer (FALSE) 44 44 {} … … 49 49 (mSlot == that.mSlot && 50 50 mEnabled == that.mEnabled && 51 mIRQ == that.mIRQ && 52 mIOBase == that.mIOBase && 51 53 mHostMode == that.mHostMode && 52 m IRQ == that.mIRQ&&53 m IOBase == that.mIOBase);54 mPath == that.mPath && 55 mServer == that.mServer); 54 56 } 55 57 … … 58 60 ULONG mIRQ; 59 61 ULONG mIOBase; 60 SerialHostMode_T mHostMode;62 PortMode_T mHostMode; 61 63 Bstr mPath; 62 64 BOOL mServer; … … 91 93 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled); 92 94 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled); 93 STDMETHOD(COMGETTER(HostMode)) ( SerialHostMode_T *aHostMode);94 STDMETHOD(COMSETTER(HostMode)) ( SerialHostMode_T aHostMode);95 STDMETHOD(COMGETTER(HostMode)) (PortMode_T *aHostMode); 96 STDMETHOD(COMSETTER(HostMode)) (PortMode_T aHostMode); 95 97 STDMETHOD(COMGETTER(IRQ)) (ULONG *aIRQ); 96 98 STDMETHOD(COMSETTER(IRQ)) (ULONG aIRQ); -
trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd
r4269 r4324 172 172 </xsd:simpleType> 173 173 174 <xsd:simpleType name="T UartHostModeType">174 <xsd:simpleType name="TPortMode"> 175 175 <xsd:restriction base="xsd:string"> 176 176 <xsd:enumeration value="Disconnected"/> … … 529 529 </xsd:attribute> 530 530 <xsd:attribute name="enabled" type="xsd:boolean" use="required"/> 531 <xsd:attribute name="IRQ" type="xsd:unsignedInt" default="4"/> 532 <xsd:attribute name="IOBase" type="xsd:unsignedInt" default="1016"/> 533 <xsd:attribute name="HostMode" type="TUartHostModeType" default="Disconnected"/> 534 <xsd:attribute name="pipe" type="xsd:string"/> 535 <xsd:attribute name="path" type="xsd:string"/> 536 <xsd:attribute name="server" type="xsd:boolean"/> 531 <xsd:attribute name="IRQ" type="xsd:unsignedInt" use="required"/> 532 <xsd:attribute name="IOBase" type="xsd:unsignedInt" use="required"/> 533 <xsd:attribute name="hostMode" type="TPortMode" use="required"/> 534 <xsd:attribute name="path" type="TLocalFile"/> 535 <xsd:attribute name="server" type="xsd:boolean" default="false"/> 537 536 </xsd:complexType> 538 537 … … 560 559 </xsd:attribute> 561 560 <xsd:attribute name="enabled" type="xsd:boolean" use="required"/> 562 <xsd:attribute name="IRQ" type="xsd:unsignedInt" default="4"/>563 <xsd:attribute name="IOBase" type="xsd:unsignedInt" default="888"/>564 <xsd:attribute name=" DevicePath" type="TLocalFile"/>561 <xsd:attribute name="IRQ" type="xsd:unsignedInt" use="required"/> 562 <xsd:attribute name="IOBase" type="xsd:unsignedInt" use="required"/> 563 <xsd:attribute name="path" type="TLocalFile"/> 565 564 </xsd:complexType> 566 565
Note:
See TracChangeset
for help on using the changeset viewer.