VirtualBox

Changeset 809 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Feb 9, 2007 2:00:39 PM (18 years ago)
Author:
vboxsync
Message:

FE/Qt: Added Enable/Disable context menus to USB/Mouse status bar icons; made all USB/VRDP VM-specific UI completely hidden when in OSE.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h

    r759 r809  
    4545
    4646class VBoxUSBMenu;
     47class VBoxSwitchMenu;
    4748class VBoxUSBLedTip;
    4849
     
    118119    void vmClose();
    119120    void vmTakeSnapshot();
    120     void vmDisableMouseIntegr();
     121    void vmDisableMouseIntegr (bool);
    121122
    122123    void devicesMountFloppyImage();
     
    124125    void devicesMountDVDImage();
    125126    void devicesUnmountDVD();
    126     void devicesSwitchVrdp();
     127    void devicesSwitchVrdp (bool);
    127128    void devicesInstallGuestAdditions();
    128129
    129130    void prepareFloppyMenu();
    130131    void prepareDVDMenu();
    131     void prepareVRDPMenu();
    132132
    133133    void captureFloppy (int id);
     
    168168    QAction *vmDisableMouseIntegrAction;
    169169
     170    // VM popup menus
     171    VBoxSwitchMenu *vmAutoresizeMenu;
     172    VBoxSwitchMenu *vmDisMouseIntegrMenu;
     173
    170174    // Devices actions
    171175    QAction *devicesMountFloppyImageAction;
     
    192196    QPopupMenu *devicesMountDVDMenu;
    193197    VBoxUSBMenu *devicesUSBMenu;
    194     QPopupMenu *devicesVRDPMenu;
     198    VBoxSwitchMenu *devicesVRDPMenu;
    195199
    196200    int devicesUSBMenuSeparatorId;
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h

    r759 r809  
    4343#include <qintdict.h>
    4444
     45class QAction;
     46
    4547// Auxiliary types
    4648////////////////////////////////////////////////////////////////////////////////
     
    525527};
    526528
     529
     530/**
     531 *  Enable/Disable Menu class.
     532 *  This class provides enable/disable menu items.
     533 */
     534class VBoxSwitchMenu : public QPopupMenu
     535{
     536    Q_OBJECT
     537
     538public:
     539
     540    VBoxSwitchMenu (QWidget *, QAction *, const QString &, bool aInverted = false);
     541
     542private slots:
     543
     544    void processAboutToShow();
     545
     546    void processActivated (int);
     547
     548private:
     549
     550    QAction *mAction;
     551    QString  mTip;
     552    bool     mInverted;
     553};
     554
    527555#endif /* __VBoxGlobal_h__ */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r784 r809  
    240240                                                     "cd_unmount_dis_16px.png"));
    241241
    242     devicesSwitchVrdpAction = new QAction (this, "devicesSwitchVrdpAction");
     242    devicesSwitchVrdpAction = new QAction (runningActions, "devicesSwitchVrdpAction");
    243243    devicesSwitchVrdpAction->setIconSet (VBoxGlobal::iconSet ("vrdp_16px.png",
    244244                                                              "vrdp_disabled_16px.png"));
     
    295295    vmCloseAction->addTo (vmMenu);
    296296    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 */);
    297304
    298305    /* Devices popup menu */
     
    304311    devicesMountDVDMenu = new QPopupMenu (devicesMenu, "devicesMountDVDMenu");
    305312    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..."));
    307316
    308317    devicesMenu->insertItem (VBoxGlobal::iconSet ("fd_16px.png", "fd_disabled_16px.png"),
     
    440449    connect (vmTakeSnapshotAction, SIGNAL(activated()), this, SLOT(vmTakeSnapshot()));
    441450
    442     connect (vmDisableMouseIntegrAction, SIGNAL(activated()), this, SLOT(vmDisableMouseIntegr()));
     451    connect (vmDisableMouseIntegrAction, SIGNAL(toggled (bool)), this, SLOT(vmDisableMouseIntegr (bool)));
    443452
    444453    connect (devicesMountFloppyImageAction, SIGNAL(activated()), this, SLOT(devicesMountFloppyImage()));
     
    446455    connect (devicesMountDVDImageAction, SIGNAL(activated()), this, SLOT(devicesMountDVDImage()));
    447456    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)));
    449458    connect (devicesInstallGuestToolsAction, SIGNAL(activated()), this, SLOT(devicesInstallGuestAdditions()));
    450459
     
    452461    connect (devicesMountFloppyMenu, SIGNAL(aboutToShow()), this, SLOT(prepareFloppyMenu()));
    453462    connect (devicesMountDVDMenu, SIGNAL(aboutToShow()), this, SLOT(prepareDVDMenu()));
    454     connect (devicesVRDPMenu, SIGNAL(aboutToShow()), this, SLOT(prepareVRDPMenu()));
    455463
    456464    connect (devicesMountFloppyMenu, SIGNAL(activated(int)), this, SLOT(captureFloppy(int)));
    457465    connect (devicesMountDVDMenu, SIGNAL(activated(int)), this, SLOT(captureDVD(int)));
    458466    connect (devicesUSBMenu, SIGNAL(activated(int)), this, SLOT(switchUSB(int)));
    459     connect (devicesVRDPMenu, SIGNAL(activated(int)), this, SLOT(devicesSwitchVrdp()));
    460467
    461468    connect (helpWebAction, SIGNAL (activated()),
     
    473480             this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
    474481    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 *)),
    475486             this, SLOT (showIndicatorContextMenu (QIStateIndicator *, QContextMenuEvent *)));
    476487
     
    603614    /* initialize usb stuff */
    604615    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
    606624    {
    607625        bool isUSBEnabled = usbctl.GetEnabled();
     
    609627        devicesUSBMenu->setConsole (cconsole);
    610628        usb_light->setState (isUSBEnabled ? CEnums::DeviceIdle
    611                                       : CEnums::InvalidActivity);
     629                                          : CEnums::InvalidActivity);
    612630        mUsbLedTip = new VBoxUSBLedTip (usb_light, cconsole, isUSBEnabled);
    613631    }
     
    11891207    QToolTip::add (autoresize_state,
    11901208        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."));
    11921211    QToolTip::add (mouse_state,
    11931212        tr ("Indicates whether the host mouse pointer is captured by the guest OS:<br>"
     
    11961215            "<nobr><img src=mouse_seamless_16px.png/>&nbsp;&nbsp;mouse integration (MI) is On</nobr><br>"
    11971216            "<nobr><img src=mouse_can_seamless_16px.png/>&nbsp;&nbsp;MI is Off, pointer is captured</nobr><br>"
    1198             "<nobr><img src=mouse_can_seamless_uncaptured_16px.png/>&nbsp;&nbsp;MI is Off, pointer is not captured</nobr>"));
     1217            "<nobr><img src=mouse_can_seamless_uncaptured_16px.png/>&nbsp;&nbsp;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."));
    11991219    QToolTip::add (hostkey_state,
    12001220        tr ("Indicates whether the keyboard is captured by the guest OS "
    12011221            "(<img src=hostkey_captured_16px.png/>) or not (<img src=hostkey_16px.png/>)"));
    12021222    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." ));
    12041227
    12051228    updateAppearanceOf (AllStuff);
     
    13591382        vrdp_state->setState (isVRDPEnabled ? 1 : 0);
    13601383
    1361         /// @todo (r=dsen) do we really need to disable the control while
    1362         //  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 
    13661384        /* compose status icon tooltip */
    13671385        QString tip = tr ("Indicates whether the Remote Display (VRDP Server) "
     
    16611679}
    16621680
    1663 void VBoxConsoleWnd::vmDisableMouseIntegr()
     1681void VBoxConsoleWnd::vmDisableMouseIntegr (bool aOff)
    16641682{
    16651683    if (console)
    16661684    {
    1667         bool on = vmDisableMouseIntegrAction->isOn();
    1668         console->setMouseIntegrationEnabled (!on);
     1685        console->setMouseIntegrationEnabled (!aOff);
    16691686        updateAppearanceOf (DisableMouseIntegrAction);
    16701687    }
     
    17291746}
    17301747
    1731 void VBoxConsoleWnd::devicesSwitchVrdp()
     1748void VBoxConsoleWnd::devicesSwitchVrdp (bool aOn)
    17321749{
    17331750    if (!console) return;
     
    17371754    Assert (!vrdpServer.isNull());
    17381755
    1739     vrdpServer.SetEnabled (!vrdpServer.GetEnabled());
     1756    vrdpServer.SetEnabled (aOn);
    17401757    updateAppearanceOf (VRDPStuff);
    17411758}
     
    18891906
    18901907/**
    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 /**
    19031908 *  Captures a floppy device corresponding to a given menu id.
    19041909 */
     
    20172022    {
    20182023        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());
    20192034    }
    20202035}
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r759 r809  
    21572157}
    21582158
     2159
     2160/**
     2161 *  Enable/Disable Menu class.
     2162 *  This class provides enable/disable menu items.
     2163 */
     2164VBoxSwitchMenu::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
     2177void 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
     2186void VBoxSwitchMenu::processActivated (int /*aIndex*/)
     2187{
     2188    mAction->setOn (!mAction->isOn());
     2189}
     2190
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