Changeset 809 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 9, 2007 2:00:39 PM (18 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r759 r809 45 45 46 46 class VBoxUSBMenu; 47 class VBoxSwitchMenu; 47 48 class VBoxUSBLedTip; 48 49 … … 118 119 void vmClose(); 119 120 void vmTakeSnapshot(); 120 void vmDisableMouseIntegr ();121 void vmDisableMouseIntegr (bool); 121 122 122 123 void devicesMountFloppyImage(); … … 124 125 void devicesMountDVDImage(); 125 126 void devicesUnmountDVD(); 126 void devicesSwitchVrdp ();127 void devicesSwitchVrdp (bool); 127 128 void devicesInstallGuestAdditions(); 128 129 129 130 void prepareFloppyMenu(); 130 131 void prepareDVDMenu(); 131 void prepareVRDPMenu();132 132 133 133 void captureFloppy (int id); … … 168 168 QAction *vmDisableMouseIntegrAction; 169 169 170 // VM popup menus 171 VBoxSwitchMenu *vmAutoresizeMenu; 172 VBoxSwitchMenu *vmDisMouseIntegrMenu; 173 170 174 // Devices actions 171 175 QAction *devicesMountFloppyImageAction; … … 192 196 QPopupMenu *devicesMountDVDMenu; 193 197 VBoxUSBMenu *devicesUSBMenu; 194 QPopupMenu *devicesVRDPMenu;198 VBoxSwitchMenu *devicesVRDPMenu; 195 199 196 200 int devicesUSBMenuSeparatorId; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r759 r809 43 43 #include <qintdict.h> 44 44 45 class QAction; 46 45 47 // Auxiliary types 46 48 //////////////////////////////////////////////////////////////////////////////// … … 525 527 }; 526 528 529 530 /** 531 * Enable/Disable Menu class. 532 * This class provides enable/disable menu items. 533 */ 534 class VBoxSwitchMenu : public QPopupMenu 535 { 536 Q_OBJECT 537 538 public: 539 540 VBoxSwitchMenu (QWidget *, QAction *, const QString &, bool aInverted = false); 541 542 private slots: 543 544 void processAboutToShow(); 545 546 void processActivated (int); 547 548 private: 549 550 QAction *mAction; 551 QString mTip; 552 bool mInverted; 553 }; 554 527 555 #endif /* __VBoxGlobal_h__ */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r784 r809 240 240 "cd_unmount_dis_16px.png")); 241 241 242 devicesSwitchVrdpAction = new QAction ( this, "devicesSwitchVrdpAction");242 devicesSwitchVrdpAction = new QAction (runningActions, "devicesSwitchVrdpAction"); 243 243 devicesSwitchVrdpAction->setIconSet (VBoxGlobal::iconSet ("vrdp_16px.png", 244 244 "vrdp_disabled_16px.png")); … … 295 295 vmCloseAction->addTo (vmMenu); 296 296 menuBar()->insertItem (QString::null, vmMenu, vmMenuId); 297 vmAutoresizeMenu = new VBoxSwitchMenu (vmMenu, vmAutoresizeGuestAction, 298 tr ("Auto-resize Guest Display", 299 "enable/disable...")); 300 vmDisMouseIntegrMenu = new VBoxSwitchMenu (vmMenu, vmDisableMouseIntegrAction, 301 tr ("Mouse Integration", 302 "enable/disable..."), 303 true /* inverted toggle state */); 297 304 298 305 /* Devices popup menu */ … … 304 311 devicesMountDVDMenu = new QPopupMenu (devicesMenu, "devicesMountDVDMenu"); 305 312 devicesUSBMenu = new VBoxUSBMenu (devicesMenu); 306 devicesVRDPMenu = new QPopupMenu (devicesMenu, "devicesVRDPMenu"); 313 devicesVRDPMenu = new VBoxSwitchMenu (devicesMenu, devicesSwitchVrdpAction, 314 tr ("Remote Desktop (RDP) Server", 315 "enable/disable...")); 307 316 308 317 devicesMenu->insertItem (VBoxGlobal::iconSet ("fd_16px.png", "fd_disabled_16px.png"), … … 440 449 connect (vmTakeSnapshotAction, SIGNAL(activated()), this, SLOT(vmTakeSnapshot())); 441 450 442 connect (vmDisableMouseIntegrAction, SIGNAL( activated()), this, SLOT(vmDisableMouseIntegr()));451 connect (vmDisableMouseIntegrAction, SIGNAL(toggled (bool)), this, SLOT(vmDisableMouseIntegr (bool))); 443 452 444 453 connect (devicesMountFloppyImageAction, SIGNAL(activated()), this, SLOT(devicesMountFloppyImage())); … … 446 455 connect (devicesMountDVDImageAction, SIGNAL(activated()), this, SLOT(devicesMountDVDImage())); 447 456 connect (devicesUnmountDVDAction, SIGNAL(activated()), this, SLOT(devicesUnmountDVD())); 448 connect (devicesSwitchVrdpAction, SIGNAL( activated()), this, SLOT(devicesSwitchVrdp()));457 connect (devicesSwitchVrdpAction, SIGNAL(toggled (bool)), this, SLOT(devicesSwitchVrdp (bool))); 449 458 connect (devicesInstallGuestToolsAction, SIGNAL(activated()), this, SLOT(devicesInstallGuestAdditions())); 450 459 … … 452 461 connect (devicesMountFloppyMenu, SIGNAL(aboutToShow()), this, SLOT(prepareFloppyMenu())); 453 462 connect (devicesMountDVDMenu, SIGNAL(aboutToShow()), this, SLOT(prepareDVDMenu())); 454 connect (devicesVRDPMenu, SIGNAL(aboutToShow()), this, SLOT(prepareVRDPMenu()));455 463 456 464 connect (devicesMountFloppyMenu, SIGNAL(activated(int)), this, SLOT(captureFloppy(int))); 457 465 connect (devicesMountDVDMenu, SIGNAL(activated(int)), this, SLOT(captureDVD(int))); 458 466 connect (devicesUSBMenu, SIGNAL(activated(int)), this, SLOT(switchUSB(int))); 459 connect (devicesVRDPMenu, SIGNAL(activated(int)), this, SLOT(devicesSwitchVrdp()));460 467 461 468 connect (helpWebAction, SIGNAL (activated()), … … 473 480 this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *))); 474 481 connect (vrdp_state, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)), 482 this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *))); 483 connect (autoresize_state, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)), 484 this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *))); 485 connect (mouse_state, SIGNAL (contextMenuRequested (QIStateIndicator *, QContextMenuEvent *)), 475 486 this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *))); 476 487 … … 603 614 /* initialize usb stuff */ 604 615 CUSBController usbctl = cmachine.GetUSBController(); 605 if (!usbctl.isNull()) 616 if (usbctl.isNull()) 617 { 618 /* hide usb_menu & usb_separator & usb_status_led */ 619 devicesMenu->setItemVisible (devicesUSBMenuId, false); 620 devicesMenu->setItemVisible (devicesUSBMenuSeparatorId, false); 621 usb_light->setHidden (true); 622 } 623 else 606 624 { 607 625 bool isUSBEnabled = usbctl.GetEnabled(); … … 609 627 devicesUSBMenu->setConsole (cconsole); 610 628 usb_light->setState (isUSBEnabled ? CEnums::DeviceIdle 611 : CEnums::InvalidActivity);629 : CEnums::InvalidActivity); 612 630 mUsbLedTip = new VBoxUSBLedTip (usb_light, cconsole, isUSBEnabled); 613 631 } … … 1189 1207 QToolTip::add (autoresize_state, 1190 1208 tr ("Indicates whether the guest display auto-resize function is On " 1191 "(<img src=auto_resize_on_16px.png/>) or Off (<img src=auto_resize_off_16px.png/>)")); 1209 "(<img src=auto_resize_on_16px.png/>) or Off (<img src=auto_resize_off_16px.png/>). " 1210 "Note that this function requires Guest Additions to be installed in the guest OS.")); 1192 1211 QToolTip::add (mouse_state, 1193 1212 tr ("Indicates whether the host mouse pointer is captured by the guest OS:<br>" … … 1196 1215 "<nobr><img src=mouse_seamless_16px.png/> mouse integration (MI) is On</nobr><br>" 1197 1216 "<nobr><img src=mouse_can_seamless_16px.png/> MI is Off, pointer is captured</nobr><br>" 1198 "<nobr><img src=mouse_can_seamless_uncaptured_16px.png/> MI is Off, pointer is not captured</nobr>")); 1217 "<nobr><img src=mouse_can_seamless_uncaptured_16px.png/> MI is Off, pointer is not captured</nobr><br>" 1218 "Note that the mouse integration feature requires Guest Additions to be installed in the guest OS.")); 1199 1219 QToolTip::add (hostkey_state, 1200 1220 tr ("Indicates whether the keyboard is captured by the guest OS " 1201 1221 "(<img src=hostkey_captured_16px.png/>) or not (<img src=hostkey_16px.png/>)")); 1202 1222 QToolTip::add (hostkey_name, 1203 tr ("Shows the currently assigned host key")); 1223 tr ("Shows the currently assigned Host key.<br>" 1224 "This key, when pressed alone, toggles the the keyboard and mouse " 1225 "capture state. It can also be used in combination with other keys " 1226 "to quickly perform actions from the main menu." )); 1204 1227 1205 1228 updateAppearanceOf (AllStuff); … … 1359 1382 vrdp_state->setState (isVRDPEnabled ? 1 : 0); 1360 1383 1361 /// @todo (r=dsen) do we really need to disable the control while1362 // in Pause? We'll check the same for USB above.1363 devicesSwitchVrdpAction->setEnabled (machine_state == CEnums::Running);1364 devicesVRDPMenu->setEnabled (machine_state == CEnums::Running);1365 1366 1384 /* compose status icon tooltip */ 1367 1385 QString tip = tr ("Indicates whether the Remote Display (VRDP Server) " … … 1661 1679 } 1662 1680 1663 void VBoxConsoleWnd::vmDisableMouseIntegr ()1681 void VBoxConsoleWnd::vmDisableMouseIntegr (bool aOff) 1664 1682 { 1665 1683 if (console) 1666 1684 { 1667 bool on = vmDisableMouseIntegrAction->isOn(); 1668 console->setMouseIntegrationEnabled (!on); 1685 console->setMouseIntegrationEnabled (!aOff); 1669 1686 updateAppearanceOf (DisableMouseIntegrAction); 1670 1687 } … … 1729 1746 } 1730 1747 1731 void VBoxConsoleWnd::devicesSwitchVrdp ()1748 void VBoxConsoleWnd::devicesSwitchVrdp (bool aOn) 1732 1749 { 1733 1750 if (!console) return; … … 1737 1754 Assert (!vrdpServer.isNull()); 1738 1755 1739 vrdpServer.SetEnabled ( !vrdpServer.GetEnabled());1756 vrdpServer.SetEnabled (aOn); 1740 1757 updateAppearanceOf (VRDPStuff); 1741 1758 } … … 1889 1906 1890 1907 /** 1891 * Prepares the "VRDP enable/disable" menu.1892 */1893 void VBoxConsoleWnd::prepareVRDPMenu()1894 {1895 if (!console) return;1896 1897 CVRDPServer vrdpServer = csession.GetMachine().GetVRDPServer();1898 devicesVRDPMenu->clear();1899 devicesVRDPMenu->insertItem (vrdpServer.GetEnabled() ? tr ("Disable") : tr ("Enable"));1900 }1901 1902 /**1903 1908 * Captures a floppy device corresponding to a given menu id. 1904 1909 */ … … 2017 2022 { 2018 2023 devicesVRDPMenu->exec (e->globalPos()); 2024 } 2025 else 2026 if (ind == autoresize_state) 2027 { 2028 vmAutoresizeMenu->exec (e->globalPos()); 2029 } 2030 else 2031 if (ind == mouse_state) 2032 { 2033 vmDisMouseIntegrMenu->exec (e->globalPos()); 2019 2034 } 2020 2035 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r759 r809 2157 2157 } 2158 2158 2159 2160 /** 2161 * Enable/Disable Menu class. 2162 * This class provides enable/disable menu items. 2163 */ 2164 VBoxSwitchMenu::VBoxSwitchMenu (QWidget *aParent, QAction *aAction, 2165 const QString &aTip, bool aInverted) 2166 : QPopupMenu (aParent), mAction (aAction) 2167 , mTip (aTip), mInverted (aInverted) 2168 { 2169 /* this menu works only with toggle action */ 2170 Assert (aAction->isToggleAction()); 2171 connect (this, SIGNAL (aboutToShow()), 2172 this, SLOT (processAboutToShow())); 2173 connect (this, SIGNAL (activated (int)), 2174 this, SLOT (processActivated (int))); 2175 } 2176 2177 void VBoxSwitchMenu::processAboutToShow() 2178 { 2179 clear(); 2180 QString text = mAction->isOn() ^ mInverted ? tr ("Disable") : tr ("Enable"); 2181 int id = insertItem (text); 2182 setItemEnabled (id, mAction->isEnabled()); 2183 QToolTip::add (this, tr ("%1 %2").arg (text).arg (mTip)); 2184 } 2185 2186 void VBoxSwitchMenu::processActivated (int /*aIndex*/) 2187 { 2188 mAction->setOn (!mAction->isOn()); 2189 } 2190
Note:
See TracChangeset
for help on using the changeset viewer.