Changeset 5837 in vbox
- Timestamp:
- Nov 26, 2007 4:49:18 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 26295
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro
r5570 r5837 8 8 # 9 9 # Copyright (C) 2006-2007 innotek GmbH 10 # 10 # 11 11 # This file is part of VirtualBox Open Source Edition (OSE), as 12 12 # available from http://www.virtualbox.org. This file is free software; … … 23 23 ui/VBoxVMNetworkSettings.ui \ 24 24 ui/VBoxVMSerialPortSettings.ui \ 25 ui/VBoxVMParallelPortSettings.ui \ 25 26 ui/VBoxUSBFilterSettings.ui \ 26 27 ui/VBoxSharedFoldersSettings.ui \ -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r5370 r5837 372 372 QString toCOMPortName (ulong aIRQ, ulong aIOBase) const; 373 373 bool toCOMPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const; 374 375 QStringList LPTPortNames() const; 376 QString toLPTPortName (ulong aIRQ, ulong aIOBase) const; 377 bool toLPTPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const; 374 378 375 379 QPixmap snapshotIcon (bool online) const … … 605 609 QStringVector USBDeviceStates; 606 610 607 QString mUserDefined COMPortName;611 QString mUserDefinedPortName; 608 612 609 613 mutable bool detailReportTemplatesReady; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r5370 r5837 957 957 } 958 958 959 st atic const struct PortConfig959 struct PortConfig 960 960 { 961 961 const char *name; 962 962 const ulong IRQ; 963 963 const ulong IOBase; 964 } 965 kKnownPorts[] = 964 }; 965 966 static const PortConfig comKnownPorts[] = 966 967 { 967 968 { "COM1", 4, 0x3F8 }, … … 973 974 }; 974 975 976 static const PortConfig lptKnownPorts[] = 977 { 978 { "LPT1", 7, 0x3BC }, 979 { "LPT2", 5, 0x378 }, 980 { "LPT3", 5, 0x278 }, 981 /* must not contain an element with IRQ=0 and IOBase=0 used to cause 982 * toLPTPortName() to return the "User-defined" string for these values. */ 983 }; 984 975 985 /** 976 986 * Returns the list of the standard COM port names (i.e. "COMx"). … … 979 989 { 980 990 QStringList list; 981 for (size_t i = 0; i < ELEMENTS (kKnownPorts); ++ i) 982 list << kKnownPorts [i].name; 991 for (size_t i = 0; i < ELEMENTS (comKnownPorts); ++ i) 992 list << comKnownPorts [i].name; 993 994 return list; 995 } 996 997 /** 998 * Returns the list of the standard LPT port names (i.e. "LPTx"). 999 */ 1000 QStringList VBoxGlobal::LPTPortNames() const 1001 { 1002 QStringList list; 1003 for (size_t i = 0; i < ELEMENTS (lptKnownPorts); ++ i) 1004 list << lptKnownPorts [i].name; 983 1005 984 1006 return list; … … 992 1014 QString VBoxGlobal::toCOMPortName (ulong aIRQ, ulong aIOBase) const 993 1015 { 994 for (size_t i = 0; i < ELEMENTS (kKnownPorts); ++ i) 995 if (kKnownPorts [i].IRQ == aIRQ && 996 kKnownPorts [i].IOBase == aIOBase) 997 return kKnownPorts [i].name; 998 999 return mUserDefinedCOMPortName; 1016 for (size_t i = 0; i < ELEMENTS (comKnownPorts); ++ i) 1017 if (comKnownPorts [i].IRQ == aIRQ && 1018 comKnownPorts [i].IOBase == aIOBase) 1019 return comKnownPorts [i].name; 1020 1021 return mUserDefinedPortName; 1022 } 1023 1024 /** 1025 * Returns the name of the standard LPT port corresponding to the given 1026 * parameters, or "User-defined" (which is also returned when both 1027 * @a aIRQ and @a aIOBase are 0). 1028 */ 1029 QString VBoxGlobal::toLPTPortName (ulong aIRQ, ulong aIOBase) const 1030 { 1031 for (size_t i = 0; i < ELEMENTS (lptKnownPorts); ++ i) 1032 if (lptKnownPorts [i].IRQ == aIRQ && 1033 lptKnownPorts [i].IOBase == aIOBase) 1034 return lptKnownPorts [i].name; 1035 1036 return mUserDefinedPortName; 1000 1037 } 1001 1038 … … 1008 1045 ulong &aIOBase) const 1009 1046 { 1010 for (size_t i = 0; i < ELEMENTS (kKnownPorts); ++ i) 1011 if (strcmp (kKnownPorts [i].name, aName.utf8().data()) == 0) 1012 { 1013 aIRQ = kKnownPorts [i].IRQ; 1014 aIOBase = kKnownPorts [i].IOBase; 1047 for (size_t i = 0; i < ELEMENTS (comKnownPorts); ++ i) 1048 if (strcmp (comKnownPorts [i].name, aName.utf8().data()) == 0) 1049 { 1050 aIRQ = comKnownPorts [i].IRQ; 1051 aIOBase = comKnownPorts [i].IOBase; 1052 return true; 1053 } 1054 1055 return false; 1056 } 1057 1058 /** 1059 * Returns port parameters corresponding to the given standard LPT name. 1060 * Returns @c true on success, or @c false if the given port name is not one 1061 * of the standard names (i.e. "LPTx"). 1062 */ 1063 bool VBoxGlobal::toLPTPortNumbers (const QString &aName, ulong &aIRQ, 1064 ulong &aIOBase) const 1065 { 1066 for (size_t i = 0; i < ELEMENTS (lptKnownPorts); ++ i) 1067 if (strcmp (lptKnownPorts [i].name, aName.utf8().data()) == 0) 1068 { 1069 aIRQ = lptKnownPorts [i].IRQ; 1070 aIOBase = lptKnownPorts [i].IOBase; 1015 1071 return true; 1016 1072 } … … 1514 1570 if (mode == CEnums::HostPipePort || 1515 1571 mode == CEnums::HostDevicePort) 1516 data += QString ("%1 (<nobr>% 1</nobr>)")1572 data += QString ("%1 (<nobr>%2</nobr>)") 1517 1573 .arg (vboxGlobal().toString (mode)) 1518 1574 .arg (QDir::convertSeparators (port.GetPath())); … … 1539 1595 "#serialPorts", /* link */ 1540 1596 tr ("Serial Ports", "details report"), /* title */ 1597 item); /* items */ 1598 } 1599 /* parallel ports */ 1600 { 1601 item = QString::null; 1602 ulong count = mVBox.GetSystemProperties().GetParallelPortCount(); 1603 int rows = 2; /* including section header and footer */ 1604 for (ulong slot = 0; slot < count; slot ++) 1605 { 1606 CParallelPort port = m.GetParallelPort (slot); 1607 if (port.GetEnabled()) 1608 { 1609 QString data = 1610 toLPTPortName (port.GetIRQ(), port.GetIOBase()) + 1611 QString (" (<nobr>%1</nobr>)") 1612 .arg (QDir::convertSeparators (port.GetPath())); 1613 1614 item += QString (sSectionItemTpl) 1615 .arg (tr ("Port %1", "details report (parallel ports)") 1616 .arg (port.GetSlot())) 1617 .arg (data); 1618 ++ rows; 1619 } 1620 } 1621 if (item.isNull()) 1622 { 1623 item = QString (sSectionItemTpl) 1624 .arg (tr ("Disabled", "details report (parallel ports)"), ""); 1625 ++ rows; 1626 } 1627 1628 detailsReport += sectionTpl 1629 .arg (rows) /* rows */ 1630 .arg ("serial_port_16px.png", /* icon */ 1631 "#parallelPorts", /* link */ 1632 tr ("Parallel Ports", "details report"), /* title */ 1541 1633 item); /* items */ 1542 1634 } … … 2121 2213 tr ("Captured", "USBDeviceState"); 2122 2214 2123 mUserDefined COMPortName = tr ("User-defined", "serial port");2215 mUserDefinedPortName = tr ("User-defined", "serial port"); 2124 2216 2125 2217 detailReportTemplatesReady = false; -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSerialPortSettings.ui
r5194 r5837 6 6 7 7 Copyright (C) 2006-2007 innotek GmbH 8 8 9 9 This file is part of VirtualBox Open Source Edition (OSE), as 10 10 available from http://www.virtualbox.org. This file is free software; … … 230 230 <include location="global" impldecl="in implementation">qvalidator.h</include> 231 231 <include location="local" impldecl="in implementation">VBoxGlobal.h</include> 232 <include location="local" impldecl="in implementation">VBoxProblemReporter.h</include>233 232 <include location="local" impldecl="in implementation">VBoxVMSerialPortSettings.ui.h</include> 234 233 </includes> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSerialPortSettings.ui.h
r5807 r5837 83 83 mPort.SetIOBase (mIOPortLine->text().toULong (NULL, 0)); 84 84 85 CEnums::PortMode mode = vboxGlobal().toPortMode (mHostModeCombo->currentText()); 86 mPort.SetHostMode (mode); 85 mPort.SetPath (QDir::convertSeparators (mPortPathLine->text())); 87 86 87 mPort.SetHostMode (vboxGlobal().toPortMode (mHostModeCombo->currentText())); 88 88 mPort.SetServer (mServerCheck->isChecked()); 89 mPort.SetPath (QDir::convertSeparators (mPortPathLine->text()));90 89 } 91 90 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
r5795 r5837 213 213 </property> 214 214 <property name="text"> 215 <string> 7</string>215 <string>8</string> 216 216 </property> 217 217 <property name="text"> … … 233 233 </property> 234 234 <property name="text"> 235 <string> 9</string>235 <string>10</string> 236 236 </property> 237 237 <property name="text"> … … 253 253 </property> 254 254 <property name="text"> 255 <string> 8</string>255 <string>9</string> 256 256 </property> 257 257 <property name="text"> … … 277 277 <property name="text"> 278 278 <string>#serialPorts</string> 279 </property> 280 <property name="pixmap"> 281 <pixmap>serial_port_16px.png</pixmap> 282 </property> 283 <property name="pixmap"> 284 <pixmap></pixmap> 285 </property> 286 <property name="pixmap"> 287 <pixmap></pixmap> 288 </property> 289 </item> 290 <item> 291 <property name="text"> 292 <string> Parallel Ports </string> 293 </property> 294 <property name="text"> 295 <string>7</string> 296 </property> 297 <property name="text"> 298 <string>#parallelPorts</string> 279 299 </property> 280 300 <property name="pixmap"> … … 2276 2296 </property> 2277 2297 <attribute name="id"> 2278 <number> 7</number>2298 <number>8</number> 2279 2299 </attribute> 2280 2300 <vbox> … … 2536 2556 </property> 2537 2557 <attribute name="id"> 2538 <number> 9</number>2558 <number>10</number> 2539 2559 </attribute> 2540 2560 <vbox> … … 2750 2770 </property> 2751 2771 <attribute name="id"> 2752 <number> 8</number>2772 <number>9</number> 2753 2773 </attribute> 2754 2774 </widget> … … 2770 2790 <property name="name"> 2771 2791 <cstring>tbwSerialPorts</cstring> 2792 </property> 2793 <property name="sizePolicy"> 2794 <sizepolicy> 2795 <hsizetype>1</hsizetype> 2796 <vsizetype>1</vsizetype> 2797 <horstretch>0</horstretch> 2798 <verstretch>0</verstretch> 2799 </sizepolicy> 2800 </property> 2801 </widget> 2802 </vbox> 2803 </widget> 2804 <widget class="QWidget"> 2805 <property name="name"> 2806 <cstring>pageParallel</cstring> 2807 </property> 2808 <attribute name="id"> 2809 <number>7</number> 2810 </attribute> 2811 <vbox> 2812 <property name="name"> 2813 <cstring>unnamed</cstring> 2814 </property> 2815 <property name="margin"> 2816 <number>0</number> 2817 </property> 2818 <widget class="QTabWidget"> 2819 <property name="name"> 2820 <cstring>tbwParallelPorts</cstring> 2772 2821 </property> 2773 2822 <property name="sizePolicy"> … … 3121 3170 <include location="local" impldecl="in implementation">VBoxVMNetworkSettings.h</include> 3122 3171 <include location="local" impldecl="in implementation">VBoxVMSerialPortSettings.h</include> 3172 <include location="local" impldecl="in implementation">VBoxVMParallelPortSettings.h</include> 3123 3173 <include location="local" impldecl="in implementation">VBoxUSBFilterSettings.h</include> 3124 3174 <include location="local" impldecl="in implementation">VBoxSharedFoldersSettings.h</include> … … 3183 3233 <slot>addNetworkAdapter( const CNetworkAdapter & )</slot> 3184 3234 <slot>addSerialPort( const CSerialPort & )</slot> 3235 <slot>addParallelPort( const CParallelPort & )</slot> 3185 3236 <slot>slRAM_valueChanged( int val )</slot> 3186 3237 <slot>leRAM_textChanged( const QString & text )</slot> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r5807 r5837 1505 1505 else if (pg == pageSerial) 1506 1506 { 1507 valid = true; 1507 1508 QValueList <QString> ports; 1508 1509 QValueList <QString> paths; … … 1541 1542 tr ("Duplicate port path is entered "); 1542 1543 pageTitle += ": " + tbwSerialPorts->tabLabel (tab); 1544 break; 1545 } 1546 paths << path; 1547 } 1548 } 1549 } 1550 else if (pg == pageParallel) 1551 { 1552 valid = true; 1553 QValueList <QString> ports; 1554 QValueList <QString> paths; 1555 1556 int index = 0; 1557 for (; index < tbwParallelPorts->count(); ++ index) 1558 { 1559 QWidget *tab = tbwParallelPorts->page (index); 1560 VBoxVMParallelPortSettings *page = 1561 static_cast <VBoxVMParallelPortSettings *> (tab); 1562 1563 /* check the predefined port number unicity */ 1564 if (page->mParallelPortBox->isChecked() && !page->isUserDefined()) 1565 { 1566 QString port = page->mPortNumCombo->currentText(); 1567 valid = !ports.contains (port); 1568 if (!valid) 1569 { 1570 warningText = tr ("Duplicate port number is selected "); 1571 pageTitle += ": " + tbwParallelPorts->tabLabel (tab); 1572 break; 1573 } 1574 ports << port; 1575 } 1576 /* check the port path emptiness & unicity */ 1577 if (page->mParallelPortBox->isChecked()) 1578 { 1579 QString path = page->mPortPathLine->text(); 1580 valid = !path.isEmpty() && !paths.contains (path); 1581 if (!valid) 1582 { 1583 warningText = path.isEmpty() ? 1584 tr ("Port path is not specified ") : 1585 tr ("Duplicate port path is entered "); 1586 pageTitle += ": " + tbwParallelPorts->tabLabel (tab); 1543 1587 break; 1544 1588 } … … 1830 1874 } 1831 1875 1876 /* parallel ports */ 1877 { 1878 ulong count = vbox.GetSystemProperties().GetParallelPortCount(); 1879 for (ulong slot = 0; slot < count; ++ slot) 1880 { 1881 CParallelPort port = machine.GetParallelPort (slot); 1882 addParallelPort (port); 1883 } 1884 } 1885 1832 1886 /* USB */ 1833 1887 { … … 2115 2169 VBoxVMSerialPortSettings *page = 2116 2170 (VBoxVMSerialPortSettings *) tbwSerialPorts->page (index); 2171 Assert (page); 2172 page->putBackToPort(); 2173 } 2174 } 2175 2176 /* parallel ports */ 2177 { 2178 for (int index = 0; index < tbwParallelPorts->count(); index++) 2179 { 2180 VBoxVMParallelPortSettings *page = 2181 (VBoxVMParallelPortSettings *) tbwParallelPorts->page (index); 2117 2182 Assert (page); 2118 2183 page->putBackToPort(); … … 2306 2371 } 2307 2372 2373 void VBoxVMSettingsDlg::addParallelPort (const CParallelPort &aPort) 2374 { 2375 VBoxVMParallelPortSettings *page = new VBoxVMParallelPortSettings(); 2376 page->getFromPort (aPort); 2377 QString pageTitle = QString (tr ("Port %1", "parallel ports")) 2378 .arg (aPort.GetSlot()); 2379 tbwParallelPorts->addTab (page, pageTitle); 2380 2381 /* fix the tab order so that main dialog's buttons are always the last */ 2382 setTabOrder (page->mPortPathLine, buttonHelp); 2383 setTabOrder (buttonHelp, buttonOk); 2384 setTabOrder (buttonOk, buttonCancel); 2385 2386 /* setup validation */ 2387 QIWidgetValidator *wval = 2388 new QIWidgetValidator (QString ("%1: %2") 2389 .arg (pagePath (pageParallel), pageTitle), 2390 pageParallel, this); 2391 connect (page->mParallelPortBox, SIGNAL (toggled (bool)), 2392 wval, SLOT (revalidate())); 2393 connect (page->mIRQLine, SIGNAL (textChanged (const QString &)), 2394 wval, SLOT (revalidate())); 2395 connect (page->mIOPortLine, SIGNAL (textChanged (const QString &)), 2396 wval, SLOT (revalidate())); 2397 connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)), 2398 this, SLOT (enableOk (const QIWidgetValidator *))); 2399 connect (wval, SIGNAL (isValidRequested (QIWidgetValidator *)), 2400 this, SLOT (revalidate (QIWidgetValidator *))); 2401 2402 wval->revalidate(); 2403 } 2404 2308 2405 void VBoxVMSettingsDlg::slRAM_valueChanged( int val ) 2309 2406 {
Note:
See TracChangeset
for help on using the changeset viewer.