Changeset 54303 in vbox
- Timestamp:
- Feb 19, 2015 4:55:58 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r54299 r54303 583 583 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCaptureSettings: strResult = "VideoCaptureSettings"; break; 584 584 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartVideoCapture: strResult = "StartVideoCapture"; break; 585 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer: strResult = "VRDEServer"; break; 585 586 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar: strResult = "MenuBar"; break; 586 587 case UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings: strResult = "MenuBarSettings"; break; … … 617 618 keys << "VideoCaptureSettings"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCaptureSettings; 618 619 keys << "StartVideoCapture"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartVideoCapture; 620 keys << "VRDEServer"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer; 619 621 keys << "MenuBar"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar; 620 622 keys << "MenuBarSettings"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings; … … 699 701 case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders: strResult = "SharedFolders"; break; 700 702 case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings: strResult = "SharedFoldersSettings"; break; 701 case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer: strResult = "VRDEServer"; break;702 703 case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools: strResult = "InstallGuestTools"; break; 703 704 case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Nothing: strResult = "Nothing"; break; … … 731 732 keys << "SharedFolders"; values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders; 732 733 keys << "SharedFoldersSettings"; values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings; 733 keys << "VRDEServer"; values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer;734 734 keys << "InstallGuestTools"; values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools; 735 735 keys << "Nothing"; values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Nothing; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r54299 r54303 391 391 RuntimeMenuViewActionType_VideoCaptureSettings = RT_BIT(7), 392 392 RuntimeMenuViewActionType_StartVideoCapture = RT_BIT(8), 393 RuntimeMenuViewActionType_MenuBar = RT_BIT(9), 394 RuntimeMenuViewActionType_MenuBarSettings = RT_BIT(10), 395 RuntimeMenuViewActionType_ToggleMenuBar = RT_BIT(11), 396 RuntimeMenuViewActionType_StatusBar = RT_BIT(12), 397 RuntimeMenuViewActionType_StatusBarSettings = RT_BIT(13), 398 RuntimeMenuViewActionType_ToggleStatusBar = RT_BIT(14), 399 RuntimeMenuViewActionType_ScaleFactor = RT_BIT(15), 400 RuntimeMenuViewActionType_Resize = RT_BIT(16), 401 RuntimeMenuViewActionType_Multiscreen = RT_BIT(17), 393 RuntimeMenuViewActionType_VRDEServer = RT_BIT(9), 394 RuntimeMenuViewActionType_MenuBar = RT_BIT(10), 395 RuntimeMenuViewActionType_MenuBarSettings = RT_BIT(11), 396 RuntimeMenuViewActionType_ToggleMenuBar = RT_BIT(12), 397 RuntimeMenuViewActionType_StatusBar = RT_BIT(13), 398 RuntimeMenuViewActionType_StatusBarSettings = RT_BIT(14), 399 RuntimeMenuViewActionType_ToggleStatusBar = RT_BIT(15), 400 RuntimeMenuViewActionType_ScaleFactor = RT_BIT(16), 401 RuntimeMenuViewActionType_Resize = RT_BIT(17), 402 RuntimeMenuViewActionType_Multiscreen = RT_BIT(18), 402 403 RuntimeMenuViewActionType_All = 0xFFFF 403 404 }; … … 435 436 RuntimeMenuDevicesActionType_SharedFolders = RT_BIT(11), 436 437 RuntimeMenuDevicesActionType_SharedFoldersSettings = RT_BIT(12), 437 RuntimeMenuDevicesActionType_VRDEServer = RT_BIT(13), 438 RuntimeMenuDevicesActionType_InstallGuestTools = RT_BIT(14), 439 RuntimeMenuDevicesActionType_Nothing = RT_BIT(15), 438 RuntimeMenuDevicesActionType_InstallGuestTools = RT_BIT(13), 439 RuntimeMenuDevicesActionType_Nothing = RT_BIT(14), 440 440 RuntimeMenuDevicesActionType_All = 0xFFFF 441 441 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
r54299 r54303 730 730 }; 731 731 732 class UIActionToggleVRDEServer : public UIActionToggle 733 { 734 Q_OBJECT; 735 736 public: 737 738 UIActionToggleVRDEServer(UIActionPool *pParent) 739 : UIActionToggle(pParent, 740 ":/vrdp_on_16px.png", ":/vrdp_16px.png", 741 ":/vrdp_on_disabled_16px.png", ":/vrdp_disabled_16px.png") {} 742 743 protected: 744 745 /** Returns action extra-data ID. */ 746 virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer; } 747 /** Returns action extra-data key. */ 748 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer); } 749 /** Returns whether action is allowed. */ 750 virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer); } 751 752 QString shortcutExtraDataID() const 753 { 754 return QString("VRDPServer"); 755 } 756 757 void retranslateUi() 758 { 759 setName(QApplication::translate("UIActionPool", "R&emote Display")); 760 setStatusTip(QApplication::translate("UIActionPool", "Toggle remote desktop (RDP) connections to this machine")); 761 } 762 }; 763 732 764 class UIActionMenuMenuBar : public UIActionMenu 733 765 { … … 1507 1539 setName(QApplication::translate("UIActionPool", "&Shared Folders Settings...")); 1508 1540 setStatusTip(QApplication::translate("UIActionPool", "Create or modify shared folders")); 1509 }1510 };1511 1512 class UIActionToggleVRDEServer : public UIActionToggle1513 {1514 Q_OBJECT;1515 1516 public:1517 1518 UIActionToggleVRDEServer(UIActionPool *pParent)1519 : UIActionToggle(pParent,1520 ":/vrdp_on_16px.png", ":/vrdp_16px.png",1521 ":/vrdp_on_disabled_16px.png", ":/vrdp_disabled_16px.png") {}1522 1523 protected:1524 1525 /** Returns action extra-data ID. */1526 virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer; }1527 /** Returns action extra-data key. */1528 virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer); }1529 /** Returns whether action is allowed. */1530 virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer); }1531 1532 QString shortcutExtraDataID() const1533 {1534 return QString("VRDPServer");1535 }1536 1537 void retranslateUi()1538 {1539 setName(QApplication::translate("UIActionPool", "R&emote Display"));1540 setStatusTip(QApplication::translate("UIActionPool", "Toggle remote desktop (RDP) connections to this machine"));1541 1541 } 1542 1542 }; … … 2017 2017 m_pool[UIActionIndexRT_M_View_M_VideoCapture_S_Settings] = new UIActionSimpleShowVideoCaptureSettingsDialog(this); 2018 2018 m_pool[UIActionIndexRT_M_View_M_VideoCapture_T_Start] = new UIActionToggleVideoCapture(this); 2019 m_pool[UIActionIndexRT_M_View_T_VRDEServer] = new UIActionToggleVRDEServer(this); 2019 2020 m_pool[UIActionIndexRT_M_View_M_MenuBar] = new UIActionMenuMenuBar(this); 2020 2021 m_pool[UIActionIndexRT_M_View_M_MenuBar_S_Settings] = new UIActionSimpleShowMenuBarSettingsWindow(this); … … 2051 2052 m_pool[UIActionIndexRT_M_Devices_M_SharedFolders] = new UIActionMenuSharedFolders(this); 2052 2053 m_pool[UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings] = new UIActionSimpleShowSharedFoldersSettingsDialog(this); 2053 m_pool[UIActionIndexRT_M_Devices_T_VRDEServer] = new UIActionToggleVRDEServer(this);2054 2054 m_pool[UIActionIndexRT_M_Devices_S_InstallGuestTools] = new UIActionSimplePerformInstallGuestTools(this); 2055 2055 … … 2177 2177 if (!fExtensionPackOperationsAllowed) 2178 2178 { 2179 m_restrictedActionsMenu Devices[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)2180 (m_restrictedActionsMenu Devices[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer);2179 m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType) 2180 (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer); 2181 2181 } 2182 2182 … … 2358 2358 /* 'Video Capture Start' action: */ 2359 2359 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_VideoCapture_T_Start)) || fSeparator; 2360 /* 'VRDE Server' action: */ 2361 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_VRDEServer)) || fSeparator; 2360 2362 2361 2363 /* Separator: */ … … 2791 2793 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedFolders)) || fSeparator; 2792 2794 updateMenuDevicesSharedFolders(); 2795 2796 /* Separator: */ 2797 if (fSeparator) 2798 { 2799 pMenu->addSeparator(); 2800 fSeparator = false; 2801 } 2802 2793 2803 /* 'Shared Clipboard' submenu: */ 2794 2804 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedClipboard)) || fSeparator; 2795 2805 /* 'Drag&Drop' submenu: */ 2796 2806 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_DragAndDrop)) || fSeparator; 2797 2798 /* Separator: */2799 if (fSeparator)2800 {2801 pMenu->addSeparator();2802 fSeparator = false;2803 }2804 2805 /* 'VRDE Server' action: */2806 fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_T_VRDEServer)) || fSeparator;2807 2807 2808 2808 /* Separator: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
r54299 r54303 65 65 UIActionIndexRT_M_View_M_VideoCapture_S_Settings, 66 66 UIActionIndexRT_M_View_M_VideoCapture_T_Start, 67 UIActionIndexRT_M_View_T_VRDEServer, 67 68 UIActionIndexRT_M_View_M_MenuBar, 68 69 UIActionIndexRT_M_View_M_MenuBar_S_Settings, … … 99 100 UIActionIndexRT_M_Devices_M_SharedFolders, 100 101 UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings, 101 UIActionIndexRT_M_Devices_T_VRDEServer,102 102 UIActionIndexRT_M_Devices_S_InstallGuestTools, 103 103 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r54299 r54303 930 930 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_S_Settings)); 931 931 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start)); 932 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)); 932 933 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar)); 933 934 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)); … … 954 955 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders)); 955 956 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings)); 956 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_T_VRDEServer));957 957 m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools)); 958 958 #ifdef Q_WS_MAC … … 1003 1003 connect(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start), SIGNAL(toggled(bool)), 1004 1004 this, SLOT(sltToggleVideoCapture(bool))); 1005 connect(actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer), SIGNAL(toggled(bool)), 1006 this, SLOT(sltToggleVRDE(bool))); 1005 1007 1006 1008 /* 'Input' actions connections: */ … … 1026 1028 connect(actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings), SIGNAL(triggered()), 1027 1029 this, SLOT(sltOpenSharedFoldersSettingsDialog())); 1028 connect(actionPool()->action(UIActionIndexRT_M_Devices_T_VRDEServer), SIGNAL(toggled(bool)),1029 this, SLOT(sltToggleVRDE(bool)));1030 1030 connect(actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools), SIGNAL(triggered()), 1031 1031 this, SLOT(sltInstallGuestAdditions())); … … 1631 1631 } 1632 1632 1633 void UIMachineLogic::sltOpenVMSettingsDialog(const QString &strCategory /* = QString() */,1634 const QString &strControl /* = QString()*/)1635 {1636 /* Do not process if window(s) missed! */1637 if (!isMachineWindowsCreated())1638 return;1639 1640 /* Create VM settings window on the heap!1641 * Its necessary to allow QObject hierarchy cleanup to delete this dialog if necessary: */1642 QPointer<UISettingsDialogMachine> pDialog = new UISettingsDialogMachine(activeMachineWindow(),1643 machine().GetId(),1644 strCategory, strControl);1645 /* Executing VM settings window.1646 * This blocking function calls for the internal event-loop to process all further events,1647 * including event which can delete the dialog itself. */1648 pDialog->execute();1649 /* Delete dialog if its still valid: */1650 if (pDialog)1651 delete pDialog;1652 1653 /* We can't rely on MediumChange events as they are not yet properly implemented within Main.1654 * We can't watch for MachineData change events as well as they are of broadcast type1655 * and console event-handler do not processing broadcast events.1656 * But we still want to be updated after possible medium changes at least if they were1657 * originated from our side. */1658 foreach (UIMachineWindow *pMachineWindow, machineWindows())1659 pMachineWindow->updateAppearanceOf(UIVisualElement_HDStuff | UIVisualElement_CDStuff | UIVisualElement_FDStuff);1660 }1661 1662 void UIMachineLogic::sltOpenStorageSettingsDialog()1663 {1664 /* Machine settings: Storage page: */1665 sltOpenVMSettingsDialog("#storage");1666 }1667 1668 void UIMachineLogic::sltOpenNetworkSettingsDialog()1669 {1670 /* Open VM settings : Network page: */1671 sltOpenVMSettingsDialog("#network");1672 }1673 1674 void UIMachineLogic::sltOpenUSBDevicesSettingsDialog()1675 {1676 /* Machine settings: Storage page: */1677 sltOpenVMSettingsDialog("#usb");1678 }1679 1680 void UIMachineLogic::sltOpenSharedFoldersSettingsDialog()1681 {1682 /* Do not process if additions are not loaded! */1683 if (!uisession()->isGuestAdditionsActive())1684 msgCenter().remindAboutGuestAdditionsAreNotActive();1685 1686 /* Open VM settings : Shared folders page: */1687 sltOpenVMSettingsDialog("#sharedFolders");1688 }1689 1690 void UIMachineLogic::sltMountStorageMedium()1691 {1692 /* Sender action: */1693 QAction *pAction = qobject_cast<QAction*>(sender());1694 AssertMsgReturnVoid(pAction, ("This slot should only be called by menu action!\n"));1695 1696 /* Current mount-target: */1697 const UIMediumTarget target = pAction->data().value<UIMediumTarget>();1698 1699 /* Update current machine mount-target: */1700 vboxGlobal().updateMachineStorage(machine(), target);1701 }1702 1703 void UIMachineLogic::sltAttachUSBDevice()1704 {1705 /* Get and check sender action object: */1706 QAction *pAction = qobject_cast<QAction*>(sender());1707 AssertMsg(pAction, ("This slot should only be called on selecting USB menu item!\n"));1708 1709 /* Get operation target: */1710 USBTarget target = pAction->data().value<USBTarget>();1711 1712 /* Attach USB device: */1713 if (target.attach)1714 {1715 /* Try to attach corresponding device: */1716 console().AttachUSBDevice(target.id, QString(""));1717 /* Check if console is OK: */1718 if (!console().isOk())1719 {1720 /* Get current host: */1721 CHost host = vboxGlobal().host();1722 /* Search the host for the corresponding USB device: */1723 CHostUSBDevice hostDevice = host.FindUSBDeviceById(target.id);1724 /* Get USB device from host USB device: */1725 CUSBDevice device(hostDevice);1726 /* Show a message about procedure failure: */1727 msgCenter().cannotAttachUSBDevice(console(), vboxGlobal().details(device));1728 }1729 }1730 /* Detach USB device: */1731 else1732 {1733 /* Search the console for the corresponding USB device: */1734 CUSBDevice device = console().FindUSBDeviceById(target.id);1735 /* Try to detach corresponding device: */1736 console().DetachUSBDevice(target.id);1737 /* Check if console is OK: */1738 if (!console().isOk())1739 {1740 /* Show a message about procedure failure: */1741 msgCenter().cannotDetachUSBDevice(console(), vboxGlobal().details(device));1742 }1743 }1744 }1745 1746 void UIMachineLogic::sltAttachWebCamDevice()1747 {1748 /* Get and check sender action object: */1749 QAction *pAction = qobject_cast<QAction*>(sender());1750 AssertReturnVoid(pAction);1751 1752 /* Get operation target: */1753 WebCamTarget target = pAction->data().value<WebCamTarget>();1754 1755 /* Get current emulated USB: */1756 CEmulatedUSB dispatcher = console().GetEmulatedUSB();1757 1758 /* Attach webcam device: */1759 if (target.attach)1760 {1761 /* Try to attach corresponding device: */1762 dispatcher.WebcamAttach(target.path, "");1763 /* Check if dispatcher is OK: */1764 if (!dispatcher.isOk())1765 msgCenter().cannotAttachWebCam(dispatcher, target.name, machineName());1766 }1767 /* Detach webcam device: */1768 else1769 {1770 /* Try to detach corresponding device: */1771 dispatcher.WebcamDetach(target.path);1772 /* Check if dispatcher is OK: */1773 if (!dispatcher.isOk())1774 msgCenter().cannotDetachWebCam(dispatcher, target.name, machineName());1775 }1776 }1777 1778 void UIMachineLogic::sltChangeSharedClipboardType(QAction *pAction)1779 {1780 /* Assign new mode (without save): */1781 KClipboardMode mode = pAction->data().value<KClipboardMode>();1782 machine().SetClipboardMode(mode);1783 }1784 1785 /** Toggles network adapter's <i>Cable Connected</i> state. */1786 void UIMachineLogic::sltToggleNetworkAdapterConnection()1787 {1788 /* Get and check 'the sender' action object: */1789 QAction *pAction = qobject_cast<QAction*>(sender());1790 AssertReturnVoid(pAction);1791 1792 /* Get operation target: */1793 CNetworkAdapter adapter = machine().GetNetworkAdapter((ULONG)pAction->property("slot").toInt());1794 AssertReturnVoid(machine().isOk() && !adapter.isNull());1795 1796 /* Connect/disconnect cable to/from target: */1797 adapter.SetCableConnected(!adapter.GetCableConnected());1798 machine().SaveSettings();1799 if (!machine().isOk())1800 msgCenter().cannotSaveMachineSettings(machine());1801 }1802 1803 void UIMachineLogic::sltChangeDragAndDropType(QAction *pAction)1804 {1805 /* Assign new mode (without save): */1806 KDnDMode mode = pAction->data().value<KDnDMode>();1807 machine().SetDnDMode(mode);1808 }1809 1810 1633 void UIMachineLogic::sltToggleVRDE(bool fEnabled) 1811 1634 { … … 1853 1676 } 1854 1677 1678 void UIMachineLogic::sltOpenVMSettingsDialog(const QString &strCategory /* = QString() */, 1679 const QString &strControl /* = QString()*/) 1680 { 1681 /* Do not process if window(s) missed! */ 1682 if (!isMachineWindowsCreated()) 1683 return; 1684 1685 /* Create VM settings window on the heap! 1686 * Its necessary to allow QObject hierarchy cleanup to delete this dialog if necessary: */ 1687 QPointer<UISettingsDialogMachine> pDialog = new UISettingsDialogMachine(activeMachineWindow(), 1688 machine().GetId(), 1689 strCategory, strControl); 1690 /* Executing VM settings window. 1691 * This blocking function calls for the internal event-loop to process all further events, 1692 * including event which can delete the dialog itself. */ 1693 pDialog->execute(); 1694 /* Delete dialog if its still valid: */ 1695 if (pDialog) 1696 delete pDialog; 1697 1698 /* We can't rely on MediumChange events as they are not yet properly implemented within Main. 1699 * We can't watch for MachineData change events as well as they are of broadcast type 1700 * and console event-handler do not processing broadcast events. 1701 * But we still want to be updated after possible medium changes at least if they were 1702 * originated from our side. */ 1703 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 1704 pMachineWindow->updateAppearanceOf(UIVisualElement_HDStuff | UIVisualElement_CDStuff | UIVisualElement_FDStuff); 1705 } 1706 1707 void UIMachineLogic::sltOpenStorageSettingsDialog() 1708 { 1709 /* Machine settings: Storage page: */ 1710 sltOpenVMSettingsDialog("#storage"); 1711 } 1712 1713 void UIMachineLogic::sltOpenNetworkSettingsDialog() 1714 { 1715 /* Open VM settings : Network page: */ 1716 sltOpenVMSettingsDialog("#network"); 1717 } 1718 1719 void UIMachineLogic::sltOpenUSBDevicesSettingsDialog() 1720 { 1721 /* Machine settings: Storage page: */ 1722 sltOpenVMSettingsDialog("#usb"); 1723 } 1724 1725 void UIMachineLogic::sltOpenSharedFoldersSettingsDialog() 1726 { 1727 /* Do not process if additions are not loaded! */ 1728 if (!uisession()->isGuestAdditionsActive()) 1729 msgCenter().remindAboutGuestAdditionsAreNotActive(); 1730 1731 /* Open VM settings : Shared folders page: */ 1732 sltOpenVMSettingsDialog("#sharedFolders"); 1733 } 1734 1735 void UIMachineLogic::sltMountStorageMedium() 1736 { 1737 /* Sender action: */ 1738 QAction *pAction = qobject_cast<QAction*>(sender()); 1739 AssertMsgReturnVoid(pAction, ("This slot should only be called by menu action!\n")); 1740 1741 /* Current mount-target: */ 1742 const UIMediumTarget target = pAction->data().value<UIMediumTarget>(); 1743 1744 /* Update current machine mount-target: */ 1745 vboxGlobal().updateMachineStorage(machine(), target); 1746 } 1747 1748 void UIMachineLogic::sltAttachUSBDevice() 1749 { 1750 /* Get and check sender action object: */ 1751 QAction *pAction = qobject_cast<QAction*>(sender()); 1752 AssertMsg(pAction, ("This slot should only be called on selecting USB menu item!\n")); 1753 1754 /* Get operation target: */ 1755 USBTarget target = pAction->data().value<USBTarget>(); 1756 1757 /* Attach USB device: */ 1758 if (target.attach) 1759 { 1760 /* Try to attach corresponding device: */ 1761 console().AttachUSBDevice(target.id, QString("")); 1762 /* Check if console is OK: */ 1763 if (!console().isOk()) 1764 { 1765 /* Get current host: */ 1766 CHost host = vboxGlobal().host(); 1767 /* Search the host for the corresponding USB device: */ 1768 CHostUSBDevice hostDevice = host.FindUSBDeviceById(target.id); 1769 /* Get USB device from host USB device: */ 1770 CUSBDevice device(hostDevice); 1771 /* Show a message about procedure failure: */ 1772 msgCenter().cannotAttachUSBDevice(console(), vboxGlobal().details(device)); 1773 } 1774 } 1775 /* Detach USB device: */ 1776 else 1777 { 1778 /* Search the console for the corresponding USB device: */ 1779 CUSBDevice device = console().FindUSBDeviceById(target.id); 1780 /* Try to detach corresponding device: */ 1781 console().DetachUSBDevice(target.id); 1782 /* Check if console is OK: */ 1783 if (!console().isOk()) 1784 { 1785 /* Show a message about procedure failure: */ 1786 msgCenter().cannotDetachUSBDevice(console(), vboxGlobal().details(device)); 1787 } 1788 } 1789 } 1790 1791 void UIMachineLogic::sltAttachWebCamDevice() 1792 { 1793 /* Get and check sender action object: */ 1794 QAction *pAction = qobject_cast<QAction*>(sender()); 1795 AssertReturnVoid(pAction); 1796 1797 /* Get operation target: */ 1798 WebCamTarget target = pAction->data().value<WebCamTarget>(); 1799 1800 /* Get current emulated USB: */ 1801 CEmulatedUSB dispatcher = console().GetEmulatedUSB(); 1802 1803 /* Attach webcam device: */ 1804 if (target.attach) 1805 { 1806 /* Try to attach corresponding device: */ 1807 dispatcher.WebcamAttach(target.path, ""); 1808 /* Check if dispatcher is OK: */ 1809 if (!dispatcher.isOk()) 1810 msgCenter().cannotAttachWebCam(dispatcher, target.name, machineName()); 1811 } 1812 /* Detach webcam device: */ 1813 else 1814 { 1815 /* Try to detach corresponding device: */ 1816 dispatcher.WebcamDetach(target.path); 1817 /* Check if dispatcher is OK: */ 1818 if (!dispatcher.isOk()) 1819 msgCenter().cannotDetachWebCam(dispatcher, target.name, machineName()); 1820 } 1821 } 1822 1823 void UIMachineLogic::sltChangeSharedClipboardType(QAction *pAction) 1824 { 1825 /* Assign new mode (without save): */ 1826 KClipboardMode mode = pAction->data().value<KClipboardMode>(); 1827 machine().SetClipboardMode(mode); 1828 } 1829 1830 /** Toggles network adapter's <i>Cable Connected</i> state. */ 1831 void UIMachineLogic::sltToggleNetworkAdapterConnection() 1832 { 1833 /* Get and check 'the sender' action object: */ 1834 QAction *pAction = qobject_cast<QAction*>(sender()); 1835 AssertReturnVoid(pAction); 1836 1837 /* Get operation target: */ 1838 CNetworkAdapter adapter = machine().GetNetworkAdapter((ULONG)pAction->property("slot").toInt()); 1839 AssertReturnVoid(machine().isOk() && !adapter.isNull()); 1840 1841 /* Connect/disconnect cable to/from target: */ 1842 adapter.SetCableConnected(!adapter.GetCableConnected()); 1843 machine().SaveSettings(); 1844 if (!machine().isOk()) 1845 msgCenter().cannotSaveMachineSettings(machine()); 1846 } 1847 1848 void UIMachineLogic::sltChangeDragAndDropType(QAction *pAction) 1849 { 1850 /* Assign new mode (without save): */ 1851 KDnDMode mode = pAction->data().value<KDnDMode>(); 1852 machine().SetDnDMode(mode); 1853 } 1854 1855 1855 void UIMachineLogic::sltInstallGuestAdditions() 1856 1856 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r54299 r54303 263 263 void sltOpenVideoCaptureOptions(); 264 264 void sltToggleVideoCapture(bool fEnabled); 265 void sltToggleVRDE(bool fEnabled); 265 266 266 267 /* "Device" menu functionality: */ … … 276 277 void sltToggleNetworkAdapterConnection(); 277 278 void sltChangeDragAndDropType(QAction *pAction); 278 void sltToggleVRDE(bool fEnabled);279 279 void sltInstallGuestAdditions(); 280 280 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
r54299 r54303 498 498 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_S_TakeScreenshot)); 499 499 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start)); 500 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)); 500 501 pMenu->addSeparator(); 501 502 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_MenuBar)); … … 536 537 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_WebCams)); 537 538 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders)); 539 pMenu->addSeparator(); 538 540 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedClipboard)); 539 541 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_DragAndDrop)); 540 pMenu->addSeparator();541 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_T_VRDEServer));542 542 pMenu->addSeparator(); 543 543 prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools)); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r54299 r54303 752 752 // TODO: Is this status can be changed at runtime? 753 753 // Because if no => the place for that stuff is in prepareActions(). 754 actionPool()->action(UIActionIndexRT_M_ Devices_T_VRDEServer)->setVisible(fIsVRDEServerAvailable);754 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->setVisible(fIsVRDEServerAvailable); 755 755 /* Check/Uncheck VRDE action depending on VRDE server activity status: */ 756 756 if (fIsVRDEServerAvailable) 757 actionPool()->action(UIActionIndexRT_M_ Devices_T_VRDEServer)->setChecked(server.GetEnabled());757 actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->setChecked(server.GetEnabled()); 758 758 /* Notify listeners about VRDE change: */ 759 759 emit sigVRDEChange();
Note:
See TracChangeset
for help on using the changeset viewer.