Changeset 4201 in vbox
- Timestamp:
- Aug 17, 2007 9:52:37 AM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r4146 r4201 98 98 void additionsStateChanged (const QString &, bool, bool); 99 99 void mediaChanged (VBoxDefs::DiskType aType); 100 void sharedFoldersChanged(); 100 101 101 102 protected: -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r4146 r4201 112 112 USBStuff = 0x80, 113 113 VRDPStuff = 0x100, 114 AllStuff = 0xFF, 114 SharedFolderStuff = 0x200, 115 AllStuff = 0xFFFF, 115 116 }; 116 117 … … 167 168 void updateDeviceLights(); 168 169 void updateMachineState (CEnums::MachineState state); 169 170 170 void updateMouseState (int state); 171 172 171 void updateAdditionsState (const QString&, bool, bool); 173 174 172 void updateMediaState (VBoxDefs::DiskType aType); 173 void updateSharedFoldersState(); 175 174 176 175 void tryClose(); -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
r4146 r4201 135 135 SnapshotEventType, 136 136 USBDeviceStateChangeEventType, 137 SharedFolderChangeEventType, 137 138 RuntimeErrorEventType, 138 139 ModifierKeyChangeEventType, -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r4071 r4201 385 385 386 386 /* public static stuff */ 387 388 static bool isDOSType (const QString &aOSTypeId); 387 389 388 390 static void adoptLabelPixmap (QLabel *); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r4146 r4201 468 468 STDMETHOD(OnSharedFolderChange) (Scope_T aScope) 469 469 { 470 QApplication::postEvent (mView, 471 new QEvent ((QEvent::Type) 472 VBoxDefs::SharedFolderChangeEventType)); 470 473 return S_OK; 471 474 } … … 1150 1153 /// @todo update menu entries 1151 1154 1155 return true; 1156 } 1157 1158 case VBoxDefs::SharedFolderChangeEventType: 1159 { 1160 emit sharedFoldersChanged(); 1152 1161 return true; 1153 1162 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r4175 r4201 73 73 void maybeTip (const QPoint &/* aPoint */) 74 74 { 75 QString t oolTip = VBoxConsoleWnd::tr (76 "<qt> Indicates the activity of "77 "attached USB devices<br>"75 QString ttip = VBoxConsoleWnd::tr ( 76 "<qt><nobr>Indicates the activity of " 77 "attached USB devices:</nobr>" 78 78 "%1</qt>", 79 79 "USB device indicator"); 80 80 81 QString devices;81 QString info; 82 82 83 83 if (mUSBEnabled) … … 87 87 { 88 88 CUSBDevice usb = en.GetNext(); 89 devices += QString ("[<b><nobr>%1</nobr></b>]<br>")89 info += QString ("<br><b><nobr>%1</nobr></b>") 90 90 .arg (vboxGlobal().details (usb)); 91 91 } 92 if ( devices.isNull())93 devices = VBoxConsoleWnd::tr ("<nobr>[<b>not attached</b>]</nobr>",94 92 if (info.isNull()) 93 info = VBoxConsoleWnd::tr ("<br><nobr><b>No USB devices attached</b></nobr>", 94 "USB device indicator"); 95 95 } 96 96 else 97 devices = VBoxConsoleWnd::tr ("<nobr>[<b>USB Controller is disabled</b>]</nobr>",98 99 100 tip (parentWidget()->rect(), t oolTip.arg (devices));97 info = VBoxConsoleWnd::tr ("<br><nobr><b>USB Controller is disabled</b></nobr>", 98 "USB device indicator"); 99 100 tip (parentWidget()->rect(), ttip.arg (info)); 101 101 } 102 102 … … 125 125 void maybeTip (const QPoint &/* aPoint */) 126 126 { 127 QString t oolTip = VBoxConsoleWnd::tr (128 "<qt> Indicates the activity of the network interfaces",129 " Network adapters indicator"130 );131 132 QString devices;127 QString ttip = VBoxConsoleWnd::tr ( 128 "<qt><nobr>Indicates the activity of the network interfaces:</nobr>" 129 "%1</qt>", 130 "Network adapters indicator"); 131 132 QString info; 133 133 134 134 ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount(); … … 137 137 CNetworkAdapter adapter = mMachine.GetNetworkAdapter (slot); 138 138 if (adapter.GetEnabled()) 139 devices+= VBoxConsoleWnd::tr ("<br><nobr><b>Adapter %1 (%2)</b>: cable %3</nobr>",140 139 info += VBoxConsoleWnd::tr ("<br><nobr><b>Adapter %1 (%2)</b>: cable %3</nobr>", 140 "Network adapters indicator") 141 141 .arg (slot) 142 142 .arg (vboxGlobal().toString (adapter.GetAttachmentType())) … … 146 146 } 147 147 148 if ( devices.isNull())149 devices= VBoxConsoleWnd::tr ("<br><nobr><b>All network adapters are disabled</b></nobr>",150 151 152 tip (parentWidget()->rect(), t oolTip + devices);148 if (info.isNull()) 149 info = VBoxConsoleWnd::tr ("<br><nobr><b>All network adapters are disabled</b></nobr>", 150 "Network adapters indicator"); 151 152 tip (parentWidget()->rect(), ttip.arg (info)); 153 153 } 154 154 … … 858 858 connect (console, SIGNAL (mediaChanged (VBoxDefs::DiskType)), 859 859 this, SLOT (updateMediaState (VBoxDefs::DiskType))); 860 connect (console, SIGNAL (sharedFoldersChanged()), 861 this, SLOT (updateSharedFoldersState())); 860 862 861 863 #ifdef Q_WS_MAC … … 1543 1545 QToolTip::add (hostkey_state, 1544 1546 tr ("Indicates whether the keyboard is captured by the guest OS " 1545 "(<img src=hostkey_captured_16px.png/>) or not (<img src=hostkey_16px.png/>) "));1547 "(<img src=hostkey_captured_16px.png/>) or not (<img src=hostkey_16px.png/>).")); 1546 1548 QToolTip::add (hostkey_name, 1547 1549 tr ("Shows the currently assigned Host key.<br>" 1548 1550 "This key, when pressed alone, toggles the the keyboard and mouse " 1549 1551 "capture state. It can also be used in combination with other keys " 1550 "to quickly perform actions from the main menu." )); 1551 QToolTip::add (sf_light, 1552 /// @todo add later, when activity is actually reported 1553 // tr ("Indicates the activity of shared folders.")); 1554 tr ("Provides quick access to shared folders (by a right mouse button click).<br>" 1555 "Note that the shared folders feature requires Guest Additions to be installed in the guest OS.")); 1552 "to quickly perform actions from the main menu.")); 1556 1553 1557 1554 updateAppearanceOf (AllStuff); … … 1586 1583 devicesUnmountFloppyAction->setEnabled (machine_state == CEnums::Running && mounted); 1587 1584 fd_light->setState (mounted ? CEnums::DeviceIdle : CEnums::InvalidActivity); 1588 QString tip = tr ( 1589 "<qt>Indicates the activity of the floppy media" 1590 "<br>[<b>%1</b>]</qt>" 1591 ); 1585 QString tip = tr ("<qt><nobr>Indicates the activity of the floppy media:</nobr>" 1586 "%1</qt>", 1587 "Floppy tooltip"); 1592 1588 QString name; 1593 1589 switch (state) … … 1600 1596 QString fullName = description.isEmpty() ? 1601 1597 drvName : 1602 QString (" <nobr>%1 (%2)</nobr>").arg (description, drvName);1603 name = tr (" Host Drive ", "Floppy tooltip") +1604 fullName;1598 QString ("%1 (%2)").arg (description, drvName); 1599 name = tr ("<br><nobr><b>Host Drive</b>: %1</nobr>", 1600 "Floppy tooltip").arg (fullName); 1605 1601 break; 1606 1602 } 1607 1603 case CEnums::ImageMounted: 1608 name = floppy.GetImage().GetFilePath(); 1604 { 1605 name = tr ("<br><nobr><b>Image</b>: %1</nobr>", 1606 "Floppy tooltip") 1607 .arg (QDir::convertSeparators (floppy.GetImage().GetFilePath())); 1609 1608 break; 1609 } 1610 1610 case CEnums::NotMounted: 1611 name = tr ("not mounted", "Floppy tooltip"); 1611 { 1612 name = tr ("<br><nobr><b>No media mounted</b></nobr>", 1613 "Floppy tooltip"); 1612 1614 break; 1615 } 1613 1616 default: 1614 1617 AssertMsgFailed (("Invalid floppy drive state: %d\n", state)); … … 1624 1627 devicesUnmountDVDAction->setEnabled (machine_state == CEnums::Running && mounted); 1625 1628 cd_light->setState (mounted ? CEnums::DeviceIdle : CEnums::InvalidActivity); 1626 QString tip = tr ( 1627 "<qt>Indicates the activity of the CD/DVD-ROM media" 1628 "<br>[<b>%1</b>]</qt>" 1629 ); 1629 QString tip = tr ("<qt><nobr>Indicates the activity of the CD/DVD-ROM media:</nobr>" 1630 "%1</qt>", 1631 "DVD-ROM tooltip"); 1630 1632 QString name; 1631 1633 switch (state) … … 1638 1640 QString fullName = description.isEmpty() ? 1639 1641 drvName : 1640 QString (" <nobr>%1 (%2)</nobr>").arg (description, drvName);1641 name = tr (" Host Drive ", "DVD-ROM tooltip") +1642 fullName;1642 QString ("%1 (%2)").arg (description, drvName); 1643 name = tr ("<br><nobr><b>Host Drive</b>: %1</nobr>", 1644 "DVD-ROM tooltip").arg (fullName); 1643 1645 break; 1644 1646 } 1645 1647 case CEnums::ImageMounted: 1646 1648 { 1647 name = dvd.GetImage().GetFilePath(); 1649 name = tr ("<br><nobr><b>Image</b>: %1</nobr>", 1650 "DVD-ROM tooltip") 1651 .arg (QDir::convertSeparators (dvd.GetImage().GetFilePath())); 1648 1652 break; 1649 1653 } 1650 1654 case CEnums::NotMounted: 1651 1655 { 1652 name = tr ("not mounted", "DVD-ROM tooltip"); 1656 name = tr ("<br><nobr><b>No media mounted</b></nobr>", 1657 "DVD-ROM tooltip"); 1653 1658 break; 1654 1659 } 1655 1660 default: 1656 AssertMsgFailed (("Invalid dvddrive state: %d\n", state));1661 AssertMsgFailed (("Invalid DVD drive state: %d\n", state)); 1657 1662 } 1658 1663 QToolTip::add (cd_light, tip.arg (name)); … … 1660 1665 if (element & HardDiskStuff) 1661 1666 { 1662 QString info =1663 tr ("<qt>Indicates the activity of virtual hard disks");1664 const char *ctlNames[] = { "IDE0", "IDE1", "Controller%1" };1665 const char *devNames[] = { "Master", "Slave", "Device%1" };1667 QString tip = tr ("<qt><nobr>Indicates the activity of virtual hard disks:</nobr>" 1668 "%1</qt>", 1669 "HDD tooltip"); 1670 QString data; 1666 1671 bool hasDisks = false; 1667 1672 CHardDiskAttachmentEnumerator aen = cmachine.GetHardDiskAttachments().Enumerate(); 1668 while (aen.HasMore()) { 1673 while (aen.HasMore()) 1674 { 1669 1675 CHardDiskAttachment hda = aen.GetNext(); 1670 QString ctl, dev;1671 switch (hda.GetController()) {1672 case CEnums::IDE0Controller:1673 ctl = ctlNames[0];1674 break;1675 case CEnums::IDE1Controller:1676 ctl = ctlNames[1];1677 break;1678 default:1679 break;1680 }1681 if (!ctl.isNull()) {1682 dev = devNames[hda.GetDeviceNumber()];1683 } else {1684 ctl = QString (ctlNames[2]).arg (hda.GetController());1685 dev = QString (devNames[2]).arg (hda.GetDeviceNumber());1686 }1687 1676 CHardDisk hd = hda.GetHardDisk(); 1688 info += QString ("<br>[%1 %2: <b>%3</b>]") 1689 .arg (ctl).arg (dev) 1690 .arg (hd.GetLocation().replace (' ', " ")); 1677 data += QString ("<br><nobr><b>%1 %2</b>: %3</nobr>") 1678 .arg (vboxGlobal().toString (hda.GetController())) 1679 .arg (vboxGlobal().toString (hda.GetController(), 1680 hda.GetDeviceNumber())) 1681 .arg (QDir::convertSeparators (hd.GetLocation())); 1691 1682 hasDisks = true; 1692 1683 } 1693 1684 if (!hasDisks) 1694 info += tr ("<br>[<b>not attached</b>]", "HDD tooltip");1695 info += "</qt>";1696 QToolTip::add (hd_light, info);1685 data += tr ("<br><nobr><b>No hard disks attached</b></nobr>", 1686 "HDD tooltip"); 1687 QToolTip::add (hd_light, tip.arg (data)); 1697 1688 hd_light->setState (hasDisks ? CEnums::DeviceIdle : CEnums::InvalidActivity); 1698 1689 } … … 1730 1721 QString tip = tr ("Indicates whether the Remote Display (VRDP Server) " 1731 1722 "is enabled (<img src=vrdp_16px.png/>) or not " 1732 "(<img src=vrdp_disabled_16px.png/>) "1723 "(<img src=vrdp_disabled_16px.png/>)." 1733 1724 ); 1734 1725 if (vrdpsrv.GetEnabled()) … … 1736 1727 QToolTip::add (vrdp_state, tip); 1737 1728 #endif 1729 } 1730 if (element & SharedFolderStuff) 1731 { 1732 QString tip = tr ("<qt><nobr>Indicates the activity of shared folders:</nobr>" 1733 "%1</qt>", 1734 "Shared folders tooltip"); 1735 1736 QString data; 1737 QMap <QString, QString> sfs; 1738 1739 /// @todo later: add global folders 1740 1741 /* permanent folders */ 1742 CSharedFolderEnumerator en = cmachine.GetSharedFolders().Enumerate(); 1743 while (en.HasMore()) 1744 { 1745 CSharedFolder sf = en.GetNext(); 1746 sfs.insert (sf.GetName(), sf.GetHostPath()); 1747 } 1748 /* transient folders */ 1749 en = cconsole.GetSharedFolders().Enumerate(); 1750 while (en.HasMore()) 1751 { 1752 CSharedFolder sf = en.GetNext(); 1753 sfs.insert (sf.GetName(), sf.GetHostPath()); 1754 } 1755 1756 for (QMap <QString, QString>::ConstIterator it = sfs.begin(); 1757 it != sfs.end(); ++ it) 1758 { 1759 /* select slashes depending on the OS type */ 1760 if (VBoxGlobal::isDOSType (cconsole.GetGuest().GetOSTypeId())) 1761 data += QString ("<tr><td><nobr><b>\\\\vboxsvr\\%1</b></nobr></td>" 1762 "<td><nobr>%2</nobr></td>") 1763 .arg (it.key(), it.data()); 1764 else 1765 data += QString ("<tr><td><nobr><b>%1</b></nobr></td>" 1766 "<td><nobr>%2</nobr></td></tr>") 1767 .arg (it.key(), it.data()); 1768 } 1769 1770 if (sfs.count() == 0) 1771 data = tr ("<br><nobr><b>No shared folders</b></nobr>", 1772 "Shared folders tooltip"); 1773 else 1774 data = QString ("<br><table border=0 cellspacing=0 cellpadding=0 " 1775 "width=100%>%1</table>").arg (data); 1776 1777 QToolTip::add (sf_light, tip.arg (data)); 1738 1778 } 1739 1779 if (element & PauseAction) … … 2897 2937 } 2898 2938 2939 void VBoxConsoleWnd::updateSharedFoldersState() 2940 { 2941 updateAppearanceOf (SharedFolderStuff); 2942 } 2943 2899 2944 /** 2900 2945 * Helper to safely close the main console window. -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r4071 r4201 912 912 { 913 913 QString details; 914 QString m = aDevice.GetManufacturer() ;915 QString p = aDevice.GetProduct() ;914 QString m = aDevice.GetManufacturer().stripWhiteSpace(); 915 QString p = aDevice.GetProduct().stripWhiteSpace(); 916 916 if (m.isEmpty() && p.isEmpty()) 917 { 917 918 details = 918 919 tr ("Unknown device %1:%2", "USB device details") 919 920 .arg (QString().sprintf ("%04hX", aDevice.GetVendorId())) 920 921 .arg (QString().sprintf ("%04hX", aDevice.GetProductId())); 922 } 921 923 else 922 details = m + " " + p; 924 { 925 if (p.upper().startsWith (m.upper())) 926 details = p; 927 else 928 details = m + " " + p; 929 } 923 930 ushort r = aDevice.GetRevision(); 924 931 if (r != 0) … … 1338 1345 1339 1346 if (srv.GetEnabled()) 1340 {1341 1347 item = QString (sSectionItemTpl) 1342 1348 .arg (tr ("VRDP Server Port", "details report (VRDP)"), 1343 1349 tr ("%1", "details report (VRDP)") 1344 1350 .arg (srv.GetPort())); 1345 }1346 1351 else 1347 1352 item = QString (sSectionItemTpl) … … 1355 1360 item); /* items */ 1356 1361 } 1362 } 1363 /* Shared folders */ 1364 { 1365 ulong count = m.GetSharedFolders().GetCount(); 1366 if (count > 0) 1367 { 1368 item = QString (sSectionItemTpl) 1369 .arg (tr ("Shared Folders", "details report (shared folders)"), 1370 tr ("%1", "details report (shadef folders)") 1371 .arg (count)); 1372 } 1373 else 1374 item = QString (sSectionItemTpl) 1375 .arg (tr ("None", "details report (shared folders)"), ""); 1376 1377 detailsReport += sectionTpl 1378 .arg (2 + 1) /* rows */ 1379 .arg ("shared_folder_16px.png", /* icon */ 1380 "#sfolders", /* link */ 1381 tr ("Shared Folders", "details report"), /* title */ 1382 item); /* items */ 1357 1383 } 1358 1384 } … … 1903 1929 //////////////////////////////////////////////////////////////////////////////// 1904 1930 1931 /* static */ 1932 bool VBoxGlobal::isDOSType (const QString &aOSTypeId) 1933 { 1934 if (aOSTypeId.left (3) == "dos" || 1935 aOSTypeId.left (3) == "win" || 1936 aOSTypeId.left (3) == "os2") 1937 return true; 1938 1939 return false; 1940 } 1941 1905 1942 /** 1906 1943 * Sets the QLabel background and frame colors according tho the pixmap
Note:
See TracChangeset
for help on using the changeset viewer.