VirtualBox

Changeset 54303 in vbox


Ignore:
Timestamp:
Feb 19, 2015 4:55:58 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 7253: Runtime UI: Move Remove Display action from Devices to View menu.

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  
    583583        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCaptureSettings: strResult = "VideoCaptureSettings"; break;
    584584        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartVideoCapture:    strResult = "StartVideoCapture"; break;
     585        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer:           strResult = "VRDEServer"; break;
    585586        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar:              strResult = "MenuBar"; break;
    586587        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings:      strResult = "MenuBarSettings"; break;
     
    617618    keys << "VideoCaptureSettings"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCaptureSettings;
    618619    keys << "StartVideoCapture";    values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartVideoCapture;
     620    keys << "VRDEServer";           values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer;
    619621    keys << "MenuBar";              values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar;
    620622    keys << "MenuBarSettings";      values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings;
     
    699701        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders:         strResult = "SharedFolders"; break;
    700702        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings: strResult = "SharedFoldersSettings"; break;
    701         case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer:            strResult = "VRDEServer"; break;
    702703        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools:     strResult = "InstallGuestTools"; break;
    703704        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Nothing:               strResult = "Nothing"; break;
     
    731732    keys << "SharedFolders";         values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders;
    732733    keys << "SharedFoldersSettings"; values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings;
    733     keys << "VRDEServer";            values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer;
    734734    keys << "InstallGuestTools";     values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools;
    735735    keys << "Nothing";               values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Nothing;
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r54299 r54303  
    391391        RuntimeMenuViewActionType_VideoCaptureSettings = RT_BIT(7),
    392392        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),
    402403        RuntimeMenuViewActionType_All                  = 0xFFFF
    403404    };
     
    435436        RuntimeMenuDevicesActionType_SharedFolders         = RT_BIT(11),
    436437        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),
    440440        RuntimeMenuDevicesActionType_All                   = 0xFFFF
    441441    };
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r54299 r54303  
    730730};
    731731
     732class UIActionToggleVRDEServer : public UIActionToggle
     733{
     734    Q_OBJECT;
     735
     736public:
     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
     743protected:
     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
    732764class UIActionMenuMenuBar : public UIActionMenu
    733765{
     
    15071539        setName(QApplication::translate("UIActionPool", "&Shared Folders Settings..."));
    15081540        setStatusTip(QApplication::translate("UIActionPool", "Create or modify shared folders"));
    1509     }
    1510 };
    1511 
    1512 class UIActionToggleVRDEServer : public UIActionToggle
    1513 {
    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() const
    1533     {
    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"));
    15411541    }
    15421542};
     
    20172017    m_pool[UIActionIndexRT_M_View_M_VideoCapture_S_Settings] = new UIActionSimpleShowVideoCaptureSettingsDialog(this);
    20182018    m_pool[UIActionIndexRT_M_View_M_VideoCapture_T_Start] = new UIActionToggleVideoCapture(this);
     2019    m_pool[UIActionIndexRT_M_View_T_VRDEServer] = new UIActionToggleVRDEServer(this);
    20192020    m_pool[UIActionIndexRT_M_View_M_MenuBar] = new UIActionMenuMenuBar(this);
    20202021    m_pool[UIActionIndexRT_M_View_M_MenuBar_S_Settings] = new UIActionSimpleShowMenuBarSettingsWindow(this);
     
    20512052    m_pool[UIActionIndexRT_M_Devices_M_SharedFolders] = new UIActionMenuSharedFolders(this);
    20522053    m_pool[UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings] = new UIActionSimpleShowSharedFoldersSettingsDialog(this);
    2053     m_pool[UIActionIndexRT_M_Devices_T_VRDEServer] = new UIActionToggleVRDEServer(this);
    20542054    m_pool[UIActionIndexRT_M_Devices_S_InstallGuestTools] = new UIActionSimplePerformInstallGuestTools(this);
    20552055
     
    21772177    if (!fExtensionPackOperationsAllowed)
    21782178    {
    2179         m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
    2180             (m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_VRDEServer);
     2179        m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
     2180            (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer);
    21812181    }
    21822182
     
    23582358    /* 'Video Capture Start' action: */
    23592359    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;
    23602362
    23612363    /* Separator: */
     
    27912793    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedFolders)) || fSeparator;
    27922794    updateMenuDevicesSharedFolders();
     2795
     2796    /* Separator: */
     2797    if (fSeparator)
     2798    {
     2799        pMenu->addSeparator();
     2800        fSeparator = false;
     2801    }
     2802
    27932803    /* 'Shared Clipboard' submenu: */
    27942804    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedClipboard)) || fSeparator;
    27952805    /* 'Drag&Drop' submenu: */
    27962806    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;
    28072807
    28082808    /* Separator: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r54299 r54303  
    6565    UIActionIndexRT_M_View_M_VideoCapture_S_Settings,
    6666    UIActionIndexRT_M_View_M_VideoCapture_T_Start,
     67    UIActionIndexRT_M_View_T_VRDEServer,
    6768    UIActionIndexRT_M_View_M_MenuBar,
    6869    UIActionIndexRT_M_View_M_MenuBar_S_Settings,
     
    99100    UIActionIndexRT_M_Devices_M_SharedFolders,
    100101    UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings,
    101     UIActionIndexRT_M_Devices_T_VRDEServer,
    102102    UIActionIndexRT_M_Devices_S_InstallGuestTools,
    103103
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r54299 r54303  
    930930    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_S_Settings));
    931931    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start));
     932    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer));
    932933    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar));
    933934    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings));
     
    954955    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders));
    955956    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings));
    956     m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_T_VRDEServer));
    957957    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools));
    958958#ifdef Q_WS_MAC
     
    10031003    connect(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start), SIGNAL(toggled(bool)),
    10041004            this, SLOT(sltToggleVideoCapture(bool)));
     1005    connect(actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer), SIGNAL(toggled(bool)),
     1006            this, SLOT(sltToggleVRDE(bool)));
    10051007
    10061008    /* 'Input' actions connections: */
     
    10261028    connect(actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings), SIGNAL(triggered()),
    10271029            this, SLOT(sltOpenSharedFoldersSettingsDialog()));
    1028     connect(actionPool()->action(UIActionIndexRT_M_Devices_T_VRDEServer), SIGNAL(toggled(bool)),
    1029             this, SLOT(sltToggleVRDE(bool)));
    10301030    connect(actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools), SIGNAL(triggered()),
    10311031            this, SLOT(sltInstallGuestAdditions()));
     
    16311631}
    16321632
    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 type
    1655      * 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 were
    1657      * 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     else
    1732     {
    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     else
    1769     {
    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 
    18101633void UIMachineLogic::sltToggleVRDE(bool fEnabled)
    18111634{
     
    18531676}
    18541677
     1678void 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
     1707void UIMachineLogic::sltOpenStorageSettingsDialog()
     1708{
     1709    /* Machine settings: Storage page: */
     1710    sltOpenVMSettingsDialog("#storage");
     1711}
     1712
     1713void UIMachineLogic::sltOpenNetworkSettingsDialog()
     1714{
     1715    /* Open VM settings : Network page: */
     1716    sltOpenVMSettingsDialog("#network");
     1717}
     1718
     1719void UIMachineLogic::sltOpenUSBDevicesSettingsDialog()
     1720{
     1721    /* Machine settings: Storage page: */
     1722    sltOpenVMSettingsDialog("#usb");
     1723}
     1724
     1725void 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
     1735void 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
     1748void 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
     1791void 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
     1823void 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. */
     1831void 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
     1848void UIMachineLogic::sltChangeDragAndDropType(QAction *pAction)
     1849{
     1850    /* Assign new mode (without save): */
     1851    KDnDMode mode = pAction->data().value<KDnDMode>();
     1852    machine().SetDnDMode(mode);
     1853}
     1854
    18551855void UIMachineLogic::sltInstallGuestAdditions()
    18561856{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r54299 r54303  
    263263    void sltOpenVideoCaptureOptions();
    264264    void sltToggleVideoCapture(bool fEnabled);
     265    void sltToggleVRDE(bool fEnabled);
    265266
    266267    /* "Device" menu functionality: */
     
    276277    void sltToggleNetworkAdapterConnection();
    277278    void sltChangeDragAndDropType(QAction *pAction);
    278     void sltToggleVRDE(bool fEnabled);
    279279    void sltInstallGuestAdditions();
    280280
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp

    r54299 r54303  
    498498        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_S_TakeScreenshot));
    499499        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start));
     500        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer));
    500501        pMenu->addSeparator();
    501502        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_MenuBar));
     
    536537        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_WebCams));
    537538        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders));
     539        pMenu->addSeparator();
    538540        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedClipboard));
    539541        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_DragAndDrop));
    540         pMenu->addSeparator();
    541         prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_T_VRDEServer));
    542542        pMenu->addSeparator();
    543543        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r54299 r54303  
    752752    // TODO: Is this status can be changed at runtime?
    753753    //       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);
    755755    /* Check/Uncheck VRDE action depending on VRDE server activity status: */
    756756    if (fIsVRDEServerAvailable)
    757         actionPool()->action(UIActionIndexRT_M_Devices_T_VRDEServer)->setChecked(server.GetEnabled());
     757        actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->setChecked(server.GetEnabled());
    758758    /* Notify listeners about VRDE change: */
    759759    emit sigVRDEChange();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette