VirtualBox

Ignore:
Timestamp:
Mar 12, 2010 2:57:27 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
58759
Message:

FE/Qt4: New running VM core: mini-tool-bar support for fullscreen mode.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen
Files:
2 edited

Legend:

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

    r27161 r27332  
    3030/* Local includes */
    3131#include "VBoxGlobal.h"
     32#include "VBoxMiniToolBar.h"
    3233
    3334#include "UISession.h"
     35#include "UIActionsPool.h"
    3436#include "UIMachineLogic.h"
    3537#include "UIMachineView.h"
     
    4042    , UIMachineWindow(pMachineLogic, uScreenId)
    4143    , m_pMainMenu(0)
     44    , m_pMiniToolBar(0)
    4245{
    4346    /* "This" is machine window: */
     
    5760    prepareMenu();
    5861
     62    /* Prepare machine view container: */
     63    prepareMachineViewContainer();
     64
     65    /* Prepare fullscreen machine view: */
     66    prepareMachineView();
     67
     68    /* Prepare mini tool-bar: */
     69    prepareMiniToolBar();
     70
    5971    /* Retranslate fullscreen window finally: */
    6072    retranslateUi();
    6173
    62     /* Prepare machine view container: */
    63     prepareMachineViewContainer();
    64 
    65     /* Prepare fullscreen machine view: */
    66     prepareMachineView();
    67 
    6874    /* Update all the elements: */
    6975    updateAppearanceOf(UIVisualElement_AllStuff);
     
    8086UIMachineWindowFullscreen::~UIMachineWindowFullscreen()
    8187{
    82     /* Cleanup normal machine view: */
     88    /* Save window settings: */
     89    saveWindowSettings();
     90
     91    /* Cleanup machine view: */
    8392    cleanupMachineView();
    8493
     
    152161}
    153162
     163void UIMachineWindowFullscreen::prepareMiniToolBar()
     164{
     165    /* Get current machine: */
     166    CMachine machine = session().GetConsole().GetMachine();
     167    /* Check if mini tool-bar should present: */
     168    bool fIsActive = machine.GetExtraData(VBoxDefs::GUI_ShowMiniToolBar) != "no";
     169    if (fIsActive)
     170    {
     171        /* Get the mini tool-bar alignment: */
     172        bool fIsAtTop = machine.GetExtraData(VBoxDefs::GUI_MiniToolBarAlignment) == "top";
     173        /* Get the mini tool-bar auto-hide feature availability: */
     174        bool fIsAutoHide = machine.GetExtraData(VBoxDefs::GUI_MiniToolBarAutoHide) != "off";
     175        m_pMiniToolBar = new VBoxMiniToolBar(centralWidget(),
     176                                             fIsAtTop ? VBoxMiniToolBar::AlignTop : VBoxMiniToolBar::AlignBottom,
     177                                             true, fIsAutoHide);
     178        m_pMiniToolBar->updateDisplay(true, true);
     179        QList<QMenu*> menus;
     180        menus << uisession()->actionsPool()->action(UIActionIndex_Menu_Machine)->menu();
     181        menus << uisession()->actionsPool()->action(UIActionIndex_Menu_Devices)->menu();
     182        *m_pMiniToolBar << menus;
     183        connect(m_pMiniToolBar, SIGNAL(exitAction()),
     184                uisession()->actionsPool()->action(UIActionIndex_Toggle_Fullscreen), SLOT(trigger()));
     185        connect(m_pMiniToolBar, SIGNAL(closeAction()),
     186                uisession()->actionsPool()->action(UIActionIndex_Simple_Close), SLOT(trigger()));
     187    }
     188}
     189
    154190void UIMachineWindowFullscreen::prepareMachineView()
    155191{
     
    184220}
    185221
     222void UIMachineWindowFullscreen::saveWindowSettings()
     223{
     224    /* Get machine: */
     225    CMachine machine = session().GetConsole().GetMachine();
     226
     227    /* Save extra-data settings: */
     228    {
     229        /* Save mini tool-bar settings: */
     230        if (m_pMiniToolBar)
     231            machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAutoHide, m_pMiniToolBar->isAutoHide() ? QString() : "off");
     232    }
     233}
     234
    186235void UIMachineWindowFullscreen::cleanupMachineView()
    187236{
     
    200249}
    201250
     251void UIMachineWindowFullscreen::updateAppearanceOf(int iElement)
     252{
     253    /* Base class update: */
     254    UIMachineWindow::updateAppearanceOf(iElement);
     255
     256    /* If mini tool-bar is present: */
     257    if (m_pMiniToolBar)
     258    {
     259        /* Get machine: */
     260        CMachine machine = session().GetConsole().GetMachine();
     261        /* Get snapshot(s): */
     262        QString strSnapshotName;
     263        if (machine.GetSnapshotCount() > 0)
     264        {
     265            CSnapshot snapshot = machine.GetCurrentSnapshot();
     266            strSnapshotName = " (" + snapshot.GetName() + ")";
     267        }
     268        /* Update mini tool-bar text: */
     269        m_pMiniToolBar->setDisplayText(machine.GetName() + strSnapshotName);
     270    }
     271}
     272
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h

    r27141 r27332  
    3131# include <X11/Xlib.h>
    3232#endif
     33
     34/* Local forwards */
     35class VBoxMiniToolBar;
    3336
    3437class UIMachineWindowFullscreen : public QIWithRetranslateUI2<QIMainDialog>, public UIMachineWindow
     
    6669    /* Prepare helpers: */
    6770    void prepareMenu();
     71    void prepareMiniToolBar();
    6872    void prepareMachineView();
     73    //void loadWindowSettings() {}
    6974
    7075    /* Cleanup helpers: */
    71     //void saveWindowSettings() {}
     76    void saveWindowSettings();
    7277    void cleanupMachineView();
     78    //void cleanupMiniToolBar() {}
    7379    void cleanupMenu();
     80
     81    /* Update routines: */
     82    void updateAppearanceOf(int iElement);
    7483
    7584    /* Private variables: */
    7685    QMenu *m_pMainMenu;
     86    VBoxMiniToolBar *m_pMiniToolBar;
    7787
    7888    /* Factory support: */
Note: See TracChangeset for help on using the changeset viewer.

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