VirtualBox

Changeset 27141 in vbox for trunk


Ignore:
Timestamp:
Mar 7, 2010 4:30:12 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: New running VM core: fullscreen/seamless modes menu restored (non-mac host for now).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp

    r26919 r27141  
    3939}
    4040
    41 QMenuBar* UIMachineMenuBar::createMenuBar(UISession *pSession)
    42 {
    43     QMenuBar *pMenuBar = new QMenuBar(0);
    44 
    45     UIActionsPool *pActionsPool = pSession->actionsPool();
     41QMenu* UIMachineMenuBar::createMenu(UIActionsPool *pActionsPool)
     42{
     43    /* Create empty menu: */
     44    QMenu *pMenu = new QMenu;
     45
     46    /* Fill menu with prepared items: */
     47    foreach (QMenu *pSubMenu, prepareSubMenus(pActionsPool))
     48        pMenu->addMenu(pSubMenu);
     49
     50    /* Return filled menu: */
     51    return pMenu;
     52}
     53
     54QMenuBar* UIMachineMenuBar::createMenuBar(UIActionsPool *pActionsPool)
     55{
     56    /* Create empty menubar: */
     57    QMenuBar *pMenuBar = new QMenuBar;
     58
     59    /* Fill menubar with prepared items: */
     60    foreach (QMenu *pSubMenu, prepareSubMenus(pActionsPool))
     61        pMenuBar->addMenu(pSubMenu);
     62
     63    /* Return filled menubar: */
     64    return pMenuBar;
     65}
     66
     67QList<QMenu*> UIMachineMenuBar::prepareSubMenus(UIActionsPool *pActionsPool)
     68{
     69    /* Create empty submenu list: */
     70    QList<QMenu*> preparedSubMenus;
    4671
    4772    /* Machine submenu: */
    4873    QMenu *pMenuMachine = pActionsPool->action(UIActionIndex_Menu_Machine)->menu();
    4974    prepareMenuMachine(pMenuMachine, pActionsPool);
    50     pMenuBar->addMenu(pMenuMachine);
     75    preparedSubMenus << pMenuMachine;
    5176
    5277    /* Devices submenu: */
    5378    QMenu *pMenuDevices = pActionsPool->action(UIActionIndex_Menu_Devices)->menu();
    5479    prepareMenuDevices(pMenuDevices, pActionsPool);
    55     pMenuBar->addMenu(pMenuDevices);
     80    preparedSubMenus << pMenuDevices;
    5681
    5782#ifdef VBOX_WITH_DEBUGGER_GUI
     83    /* Debug submenu: */
    5884    if (vboxGlobal().isDebuggerEnabled())
    5985    {
    6086        QMenu *pMenuDebug = pActionsPool->action(UIActionIndex_Menu_Debug)->menu();
    6187        prepareMenuDebug(pMenuDebug, pActionsPool);
    62         pMenuBar->addMenu(pMenuDebug);
     88        preparedSubMenus << pMenuDebug;
    6389    }
    6490#endif
     
    6793    QMenu *pMenuHelp = pActionsPool->action(UIActionIndex_Menu_Help)->menu();
    6894    prepareMenuHelp(pMenuHelp, pActionsPool);
    69     pMenuBar->addMenu(pMenuHelp);
    70 
    71     /* Because this connections are done to VBoxGlobal, they are needed once
    72      * only. Otherwise we will get the slots called more than once. */
     95    preparedSubMenus << pMenuHelp;
     96
     97    /* Return a list of prepared submenus: */
     98    return preparedSubMenus;
     99}
     100
     101void UIMachineMenuBar::prepareMenuMachine(QMenu *pMenu, UIActionsPool *pActionsPool)
     102{
     103    /* Do not prepare if ready: */
     104    if (!pMenu->isEmpty())
     105        return;
     106
     107    /* Machine submenu: */
     108    pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Fullscreen));
     109    pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Seamless));
     110    pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_GuestAutoresize));
     111    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_AdjustWindow));
     112    pMenu->addSeparator();
     113    pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_MouseIntegration));
     114    pMenu->addSeparator();
     115    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TypeCAD));
     116#ifdef Q_WS_X11
     117    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TypeCABS));
     118#endif
     119    pMenu->addSeparator();
     120    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TakeSnapshot));
     121    pMenu->addSeparator();
     122    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InformationDialog));
     123    pMenu->addSeparator();
     124    pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Pause));
     125    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Reset));
     126    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Shutdown));
     127#ifndef Q_WS_MAC
     128    pMenu->addSeparator();
     129#else /* Q_WS_MAC */
     130    if (m_fIsFirstTime)
     131#endif /* !Q_WS_MAC */
     132        pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Close));
     133}
     134
     135void UIMachineMenuBar::prepareMenuDevices(QMenu *pMenu, UIActionsPool *pActionsPool)
     136{
     137    /* Do not prepare if ready: */
     138    if (!pMenu->isEmpty())
     139        return;
     140
     141    /* Devices submenu: */
     142    pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_OpticalDevices)->menu());
     143    pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_FloppyDevices)->menu());
     144    pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_USBDevices)->menu());
     145    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_NetworkAdaptersDialog));
     146    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_SharedFoldersDialog));
     147    pMenu->addSeparator();
     148    pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_VRDP));
     149    pMenu->addSeparator();
     150    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InstallGuestTools));
     151}
     152
     153#ifdef VBOX_WITH_DEBUGGER_GUI
     154void UIMachineMenuBar::prepareMenuDebug(QMenu *pMenu, UIActionsPool *pActionsPool)
     155{
     156    /* Do not prepare if ready: */
     157    if (!pMenu->isEmpty())
     158        return;
     159
     160    /* Debug submenu: */
     161    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Statistics));
     162    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_CommandLine));
     163    pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Logging));
     164}
     165#endif /* VBOX_WITH_DEBUGGER_GUI */
     166
     167void UIMachineMenuBar::prepareMenuHelp(QMenu *pMenu, UIActionsPool *pActionsPool)
     168{
     169    /* Do not prepare if ready: */
     170    if (!pMenu->isEmpty())
     171        return;
     172
     173    /* Help submenu: */
     174    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Help));
     175    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Web));
     176    pMenu->addSeparator();
     177    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_ResetWarnings));
     178    pMenu->addSeparator();
     179
     180#ifdef VBOX_WITH_REGISTRATION
     181    pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Register));
     182#endif
     183
     184#ifdef Q_WS_MAC
     185    if (m_fIsFirstTime)
     186#endif /* Q_WS_MAC */
     187        pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Update));
     188
     189#ifndef Q_WS_MAC
     190    pMenu->addSeparator();
     191#else /* Q_WS_MAC */
     192    if (m_fIsFirstTime)
     193#endif /* !Q_WS_MAC */
     194        pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_About));
     195
     196    /* Because this connections are done to VBoxGlobal, they are needed once only.
     197     * Otherwise we will get the slots called more than once. */
    73198    if (m_fIsFirstTime)
    74199    {
     
    93218        m_fIsFirstTime = false;
    94219    }
    95 
    96     return pMenuBar;
    97 }
    98 
    99 void UIMachineMenuBar::prepareMenuMachine(QMenu *pMenu, UIActionsPool *pActionsPool)
    100 {
    101     pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Fullscreen));
    102     pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Seamless));
    103     pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_GuestAutoresize));
    104     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_AdjustWindow));
    105     pMenu->addSeparator();
    106     pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_MouseIntegration));
    107     pMenu->addSeparator();
    108     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TypeCAD));
    109 #ifdef Q_WS_X11
    110     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TypeCABS));
    111 #endif
    112     pMenu->addSeparator();
    113     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TakeSnapshot));
    114     pMenu->addSeparator();
    115     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InformationDialog));
    116     pMenu->addSeparator();
    117     pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Pause));
    118     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Reset));
    119     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Shutdown));
    120 #ifndef Q_WS_MAC
    121     pMenu->addSeparator();
    122 #else /* Q_WS_MAC */
    123     if (m_fIsFirstTime)
    124 #endif /* !Q_WS_MAC */
    125         pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Close));
    126 }
    127 
    128 void UIMachineMenuBar::prepareMenuDevices(QMenu *pMenu, UIActionsPool *pActionsPool)
    129 {
    130     /* Devices submenu */
    131     pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_OpticalDevices)->menu());
    132     pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_FloppyDevices)->menu());
    133     pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_USBDevices)->menu());
    134     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_NetworkAdaptersDialog));
    135     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_SharedFoldersDialog));
    136     pMenu->addSeparator();
    137     pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_VRDP));
    138     pMenu->addSeparator();
    139     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InstallGuestTools));
    140 }
    141 
    142 #ifdef VBOX_WITH_DEBUGGER_GUI
    143 void UIMachineMenuBar::prepareMenuDebug(QMenu *pMenu, UIActionsPool *pActionsPool)
    144 {
    145     /* Debug submenu */
    146     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Statistics));
    147     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_CommandLine));
    148     pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Logging));
    149 }
    150 #endif /* VBOX_WITH_DEBUGGER_GUI */
    151 
    152 void UIMachineMenuBar::prepareMenuHelp(QMenu *pMenu, UIActionsPool *pActionsPool)
    153 {
    154     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Help));
    155     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Web));
    156     pMenu->addSeparator();
    157     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_ResetWarnings));
    158     pMenu->addSeparator();
    159 
    160 #ifdef VBOX_WITH_REGISTRATION
    161     pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Register));
    162 #endif
    163 
    164 #ifdef Q_WS_MAC
    165     if (m_fIsFirstTime)
    166 #endif /* Q_WS_MAC */
    167         pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Update));
    168 
    169 #ifndef Q_WS_MAC
    170     pMenu->addSeparator();
    171 #else /* Q_WS_MAC */
    172     if (m_fIsFirstTime)
    173 #endif /* !Q_WS_MAC */
    174         pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_About));
    175 }
    176 
     220}
     221
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.h

    r26919 r27141  
    2424#define __UIMachineMenuBar_h__
    2525
    26 class UISession;
     26/* Global includes */
     27#include <QList>
     28
     29/* Global forwards */
     30class QMenu;
     31class QMenuBar;
     32
     33/* Local forwards */
    2734class UIActionsPool;
    28 class QMenuBar;
    29 class QMenu;
    3035
    3136class UIMachineMenuBar
    3237{
    3338public:
     39
    3440    UIMachineMenuBar();
    3541
    36     QMenuBar* createMenuBar(UISession *pSession);
     42    QMenu* createMenu(UIActionsPool *pActionsPool);
     43    QMenuBar* createMenuBar(UIActionsPool *pActionsPool);
    3744
    3845protected:
    3946
     47    QList<QMenu*> prepareSubMenus(UIActionsPool *pActionsPool);
    4048    void prepareMenuMachine(QMenu *pMenu, UIActionsPool *pActionsPool);
    4149    void prepareMenuDevices(QMenu *pMenu, UIActionsPool *pActionsPool);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r27124 r27141  
    529529    , m_callback(CConsoleCallback(new UIConsoleCallback(this)))
    530530    /* Common variables: */
    531     , m_pMenuBar(0)
     531    , m_pMenuPool(0)
    532532    , m_machineState(KMachineState_Null)
    533533#if defined(Q_WS_WIN)
     
    560560    session().GetConsole().RegisterCallback(m_callback);
    561561
     562    /* Prepare main menu: */
     563    prepareMenuPool();
     564
    562565    /* Load uisession settings: */
    563566    loadSessionSettings();
     
    568571    /* Save uisession settings: */
    569572    saveSessionSettings();
     573
     574    /* Cleanup main menu: */
     575    cleanupMenuPool();
    570576
    571577    /* Unregister console callback: */
     
    584590}
    585591
     592QMenu* UISession::newMenu()
     593{
     594    /* Create new menu: */
     595    QMenu *pMenu = m_pMenuPool->createMenu(actionsPool());
     596
     597    /* Re-init menu pool for the case manu were recreated: */
     598    reinitMenuPool();
     599
     600    /* Return newly created menu: */
     601    return pMenu;
     602}
     603
    586604QMenuBar* UISession::newMenuBar()
    587605{
    588     /* */
    589     QMenuBar *pMenuBar = m_pMenuBar->createMenuBar(this);
    590 
    591     /* Get uisession machine: */
    592     CMachine machine = session().GetConsole().GetMachine();
    593 
    594     /* Availability settings: */
    595     {
    596         /* USB Stuff: */
    597         CUSBController usbController = machine.GetUSBController();
    598         if (   usbController.isNull()
    599             || !usbController.GetProxyAvailable())
    600         {
    601             /* Hide USB menu if controller is NULL or no USB proxy available: */
    602             uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setVisible(false);
    603         }
    604         else
    605         {
    606             /* Enable/Disable USB menu depending on USB controller: */
    607             uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setEnabled(usbController.GetEnabled());
    608         }
    609     }
    610 
    611     /* Prepare some initial settings: */
    612     {
    613         /* Initialize CD/FD menus: */
    614         int iDevicesCountCD = 0;
    615         int iDevicesCountFD = 0;
    616         const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();
    617         foreach (const CMediumAttachment &attachment, attachments)
    618         {
    619             if (attachment.GetType() == KDeviceType_DVD)
    620                 ++ iDevicesCountCD;
    621             if (attachment.GetType() == KDeviceType_Floppy)
    622                 ++ iDevicesCountFD;
    623         }
    624         QAction *pOpticalDevicesMenu = uimachine()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices);
    625         QAction *pFloppyDevicesMenu = uimachine()->actionsPool()->action(UIActionIndex_Menu_FloppyDevices);
    626         pOpticalDevicesMenu->setData(iDevicesCountCD);
    627         pOpticalDevicesMenu->setVisible(iDevicesCountCD);
    628         pFloppyDevicesMenu->setData(iDevicesCountFD);
    629         pFloppyDevicesMenu->setVisible(iDevicesCountFD);
    630     }
    631 
     606    /* Create new menubar: */
     607    QMenuBar *pMenuBar = m_pMenuPool->createMenuBar(actionsPool());
     608
     609    /* Re-init menu pool for the case manu were recreated: */
     610    reinitMenuPool();
     611
     612    /* Return newly created menubar: */
    632613    return pMenuBar;
    633614}
     
    916897}
    917898
     899void UISession::prepareMenuPool()
     900{
     901    m_pMenuPool = new UIMachineMenuBar;
     902}
     903
    918904void UISession::loadSessionSettings()
    919905{
    920     m_pMenuBar = new UIMachineMenuBar;
    921 
    922     /* Get uisession machine: */
     906   /* Get uisession machine: */
    923907    CMachine machine = session().GetConsole().GetMachine();
    924908
     
    984968        //machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAutoHide, mMiniToolBar->isAutoHide() ? "on" : "off");
    985969    }
    986 
    987     delete m_pMenuBar;
    988     m_pMenuBar = 0;
     970}
     971
     972void UISession::cleanupMenuPool()
     973{
     974    delete m_pMenuPool;
     975    m_pMenuPool = 0;
    989976}
    990977
     
    12291216}
    12301217
     1218void UISession::reinitMenuPool()
     1219{
     1220    /* Get uisession machine: */
     1221    CMachine machine = session().GetConsole().GetMachine();
     1222
     1223    /* Availability settings: */
     1224    {
     1225        /* USB Stuff: */
     1226        CUSBController usbController = machine.GetUSBController();
     1227        if (   usbController.isNull()
     1228            || !usbController.GetProxyAvailable())
     1229        {
     1230            /* Hide USB menu if controller is NULL or no USB proxy available: */
     1231            uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setVisible(false);
     1232        }
     1233        else
     1234        {
     1235            /* Enable/Disable USB menu depending on USB controller: */
     1236            uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setEnabled(usbController.GetEnabled());
     1237        }
     1238    }
     1239
     1240    /* Prepare some initial settings: */
     1241    {
     1242        /* Initialize CD/FD menus: */
     1243        int iDevicesCountCD = 0;
     1244        int iDevicesCountFD = 0;
     1245        const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();
     1246        foreach (const CMediumAttachment &attachment, attachments)
     1247        {
     1248            if (attachment.GetType() == KDeviceType_DVD)
     1249                ++ iDevicesCountCD;
     1250            if (attachment.GetType() == KDeviceType_Floppy)
     1251                ++ iDevicesCountFD;
     1252        }
     1253        QAction *pOpticalDevicesMenu = uimachine()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices);
     1254        QAction *pFloppyDevicesMenu = uimachine()->actionsPool()->action(UIActionIndex_Menu_FloppyDevices);
     1255        pOpticalDevicesMenu->setData(iDevicesCountCD);
     1256        pOpticalDevicesMenu->setVisible(iDevicesCountCD);
     1257        pFloppyDevicesMenu->setData(iDevicesCountFD);
     1258        pFloppyDevicesMenu->setVisible(iDevicesCountFD);
     1259    }
     1260}
     1261
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r27124 r27141  
    3232
    3333/* Global forwards */
     34class QMenu;
    3435class QMenuBar;
    3536
     
    7980    KMachineState machineState() const { return m_machineState; }
    8081    UIActionsPool* actionsPool() const;
     82    QMenu* newMenu();
    8183    QMenuBar* newMenuBar();
     84    QCursor cursor() const { return m_cursor; }
    8285    QSize guestSizeHint(ulong uScreenId) const;
    8386
     
    9598    bool isIgnoreRuntimeMediumsChanging() const { return m_fIsIgnoreRutimeMediumsChanging; }
    9699    bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; }
    97     QCursor cursor() const { return m_cursor; }
    98100
    99101    /* Guest additions state getters: */
     
    171173
    172174    /* Prepare helpers: */
     175    void prepareMenuPool();
    173176    void loadSessionSettings();
    174177
    175178    /* Cleanup helpers: */
    176179    void saveSessionSettings();
     180    void cleanupMenuPool();
    177181
    178182    /* Common helpers: */
    179183    WId winId() const;
    180184    void setPointerShape(const uchar *pShapeData, bool fHasAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight);
     185    void reinitMenuPool();
    181186
    182187    /* Private variables: */
     
    185190    const CConsoleCallback m_callback;
    186191
    187     UIMachineMenuBar *m_pMenuBar;
     192    UIMachineMenuBar *m_pMenuPool;
    188193
    189194    /* Common variables: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp

    r27124 r27141  
    235235            {
    236236                if (pKeyEvent->key() == Qt::Key_Home)
    237                 {
    238 #if 0 // TODO: Activate Main Menu!
    239                     // should we create it first?
    240 #endif
    241                 }
     237                    QTimer::singleShot(0, machineWindowWrapper()->machineWindow(), SLOT(sltPopupMainMenu()));
    242238                else
    243239                    pEvent->ignore();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    r27130 r27141  
    3131#include "VBoxGlobal.h"
    3232
    33 #ifdef Q_WS_MAC
    3433#include "UISession.h"
    35 #endif /* Q_WS_MAC */
    3634#include "UIMachineLogic.h"
    3735#include "UIMachineView.h"
     
    4139    : QIWithRetranslateUI2<QIMainDialog>(0, Qt::FramelessWindowHint)
    4240    , UIMachineWindow(pMachineLogic, uScreenId)
     41    , m_pMainMenu(0)
    4342{
    4443    /* "This" is machine window: */
    4544    m_pMachineWindow = this;
    4645
    47     /* Set the main window in VBoxGlobal */
     46    /* Set the main window in VBoxGlobal: */
    4847    if (uScreenId == 0)
    4948        vboxGlobal().setMainWindow(this);
    5049
    51     /* Prepare window icon: */
     50    /* Prepare fullscreen window icon: */
    5251    prepareWindowIcon();
    5352
     
    5554    prepareConsoleConnections();
    5655
    57 #ifdef Q_WS_MAC
    58     /* Prepare menu: */
     56    /* Prepare fullscreen menu: */
    5957    prepareMenu();
    60 #endif /* Q_WS_MAC */
    61 
    62     /* Retranslate normal window finally: */
     58
     59    /* Retranslate fullscreen window finally: */
    6360    retranslateUi();
    6461
     
    6663    prepareMachineViewContainer();
    6764
    68     /* Prepare normal machine view: */
     65    /* Prepare fullscreen machine view: */
    6966    prepareMachineView();
    7067
     
    8582    /* Cleanup normal machine view: */
    8683    cleanupMachineView();
     84
     85    /* Cleanup menu: */
     86    cleanupMenu();
    8787}
    8888
     
    9090{
    9191    UIMachineWindow::sltMachineStateChanged();
     92}
     93
     94void UIMachineWindowFullscreen::sltPopupMainMenu()
     95{
     96    /* Popup main menu if present: */
     97    if (m_pMainMenu && !m_pMainMenu->isEmpty())
     98        m_pMainMenu->popup(machineWindow()->geometry().center());
    9299}
    93100
     
    137144}
    138145
    139 #ifdef Q_WS_MAC
    140146void UIMachineWindowFullscreen::prepareMenu()
    141147{
     148#ifdef Q_WS_MAC
    142149    setMenuBar(uisession()->newMenuBar());
    143 }
    144 #endif /* Q_WS_MAC */
     150#else /* To NaN: Please uncomment below for mac too and test! */
     151    m_pMainMenu = uisession()->newMenu();
     152#endif /* Q_WS_MAC */
     153}
    145154
    146155void UIMachineWindowFullscreen::prepareMachineView()
     
    186195}
    187196
     197void UIMachineWindowFullscreen::cleanupMenu()
     198{
     199#ifdef Q_WS_MAC
     200    // Sync with UIMachineWindowFullscreen::prepareMenu()!
     201#else /* To NaN: Please uncomment below for mac too and test! */
     202    delete m_pMainMenu;
     203    m_pMainMenu = 0;
     204#endif /* Q_WS_MAC */
     205}
     206
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h

    r27064 r27141  
    4747    void sltMachineStateChanged();
    4848
     49    /* Popup main menu: */
     50    void sltPopupMainMenu();
     51
    4952    /* Close window reimplementation: */
    5053    void sltTryClose();
     
    6265
    6366    /* Prepare helpers: */
    64 #ifdef Q_WS_MAC
    6567    void prepareMenu();
    66 #endif /* Q_WS_MAC */
    6768    void prepareMachineView();
    6869
     
    7071    //void saveWindowSettings() {}
    7172    void cleanupMachineView();
    72 #ifdef Q_WS_MAC
    73     //void cleanupMenu() {}
    74 #endif /* Q_WS_MAC */
     73    void cleanupMenu();
     74
     75    /* Private variables: */
     76    QMenu *m_pMainMenu;
    7577
    7678    /* Factory support: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r27124 r27141  
    242242            {
    243243                if (pKeyEvent->key() == Qt::Key_Home)
    244                 {
    245 #if 0 // TODO: Activate Main Menu!
    246                     // should we create it first?
    247 #endif
    248                 }
     244                    QTimer::singleShot(0, machineWindowWrapper()->machineWindow(), SLOT(sltPopupMainMenu()));
    249245                else
    250246                    pEvent->ignore();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r27130 r27141  
    3232
    3333#ifdef Q_WS_MAC
    34 # include "UISession.h"
    3534# include "VBoxUtils.h"
    3635#endif /* Q_WS_MAC */
     36#include "UISession.h"
    3737#include "UIMachineLogic.h"
    3838#include "UIMachineView.h"
     
    4242    : QIWithRetranslateUI2<QIMainDialog>(0, Qt::FramelessWindowHint)
    4343    , UIMachineWindow(pMachineLogic, uScreenId)
     44    , m_pMainMenu(0)
    4445{
    4546    /* "This" is machine window: */
    4647    m_pMachineWindow = this;
    4748
    48     /* Set the main window in VBoxGlobal */
     49    /* Set the main window in VBoxGlobal: */
    4950    if (uScreenId == 0)
    5051        vboxGlobal().setMainWindow(this);
    5152
    52     /* Prepare window icon: */
     53    /* Prepare seamless window icon: */
    5354    prepareWindowIcon();
    5455
     
    5960    prepareSeamless();
    6061
    61 #ifdef Q_WS_MAC
    62     /* Prepare menu: */
     62    /* Prepare seamless menu: */
    6363    prepareMenu();
    64 #endif /* Q_WS_MAC */
    6564
    6665    /* Retranslate seamless window finally: */
    6766    retranslateUi();
    6867
    69     /* Prepare normal machine view container: */
     68    /* Prepare machine view container: */
    7069    prepareMachineViewContainer();
    7170
    72     /* Prepare normal machine view: */
     71    /* Prepare seamless machine view: */
    7372    prepareMachineView();
    7473
    7574#ifdef Q_WS_MAC
    76     /* Load normal window settings: */
     75    /* Load seamless window settings: */
    7776    loadWindowSettings();
    7877#endif /* Q_WS_MAC */
     
    8988    /* Cleanup normal machine view: */
    9089    cleanupMachineView();
     90
     91    /* Cleanup menu: */
     92    cleanupMenu();
    9193}
    9294
     
    9496{
    9597    UIMachineWindow::sltMachineStateChanged();
     98}
     99
     100void UIMachineWindowSeamless::sltPopupMainMenu()
     101{
     102    /* Popup main menu if present: */
     103    if (m_pMainMenu && !m_pMainMenu->isEmpty())
     104        m_pMainMenu->popup(machineWindow()->geometry().center());
    96105}
    97106
     
    174183}
    175184
    176 #ifdef Q_WS_MAC
    177185void UIMachineWindowSeamless::prepareMenu()
    178186{
     187#ifdef Q_WS_MAC
    179188    setMenuBar(uisession()->newMenuBar());
    180 }
    181 #endif /* Q_WS_MAC */
     189#else /* To NaN: Please uncomment below for mac too and test! */
     190    m_pMainMenu = uisession()->newMenu();
     191#endif /* Q_WS_MAC */
     192}
    182193
    183194void UIMachineWindowSeamless::prepareMachineView()
     
    228239    UIMachineView::destroy(m_pMachineView);
    229240    m_pMachineView = 0;
     241}
     242
     243void UIMachineWindowSeamless::cleanupMenu()
     244{
     245#ifdef Q_WS_MAC
     246    // Sync with UIMachineWindowSeamless::prepareMenu()!
     247#else /* To NaN: Please uncomment below for mac too and test! */
     248    delete m_pMainMenu;
     249    m_pMainMenu = 0;
     250#endif /* Q_WS_MAC */
    230251}
    231252
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h

    r27089 r27141  
    4747    void sltMachineStateChanged();
    4848
     49    /* Popup main menu: */
     50    void sltPopupMainMenu();
     51
    4952    /* Close window reimplementation: */
    5053    void sltTryClose();
     
    6669    /* Prepare helpers: */
    6770    void prepareSeamless();
    68 #ifdef Q_WS_MAC
    6971    void prepareMenu();
    70 #endif /* Q_WS_MAC */
    7172    void prepareMachineView();
    7273#ifdef Q_WS_MAC
     
    7980#endif /* Q_WS_MAC */
    8081    void cleanupMachineView();
    81 #ifdef Q_WS_MAC
    82     //void cleanupMenu() {}
    83 #endif /* Q_WS_MAC */
     82    void cleanupMenu();
    8483    //void cleanupSeamless() {}
    8584
     
    9089
    9190    /* Private variables: */
     91    QMenu *m_pMainMenu;
    9292#ifdef Q_WS_WIN
    9393    QRegion m_prevRegion;
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