VirtualBox

Changeset 27333 in vbox


Ignore:
Timestamp:
Mar 12, 2010 3:17:19 PM (15 years ago)
Author:
vboxsync
Message:

E/Qt4: New running VM core: mini-tool-bar support for seamless mode.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r27296 r27333  
    6565    int keyboardState() const;
    6666    int mouseState() const;
     67    virtual QRegion lastVisibleRegion() const { return QRegion(); }
    6768
    6869    /* Public setters: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h

    r27237 r27333  
    7979    void maybeRestrictMinimumSize() {}
    8080    void updateSliders() {}
     81    QRegion lastVisibleRegion() const { return m_lastVisibleRegion; }
    8182
    8283    /* Private variables: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r27161 r27333  
    3030/* Local includes */
    3131#include "VBoxGlobal.h"
     32#include "VBoxMiniToolBar.h"
    3233
    3334#ifdef Q_WS_MAC
     
    3536#endif /* Q_WS_MAC */
    3637#include "UISession.h"
     38#include "UIActionsPool.h"
    3739#include "UIMachineLogic.h"
    3840#include "UIMachineView.h"
     
    4345    , UIMachineWindow(pMachineLogic, uScreenId)
    4446    , m_pMainMenu(0)
     47    , m_pMiniToolBar(0)
    4548{
    4649    /* "This" is machine window: */
     
    6366    prepareMenu();
    6467
    65     /* Retranslate seamless window finally: */
    66     retranslateUi();
    67 
    6868    /* Prepare machine view container: */
    6969    prepareMachineViewContainer();
     
    7272    prepareMachineView();
    7373
     74    /* Prepare mini tool-bar: */
     75    prepareMiniToolBar();
     76
     77    /* Retranslate fullscreen window finally: */
     78    retranslateUi();
     79
    7480#ifdef Q_WS_MAC
    7581    /* Load seamless window settings: */
     
    8692UIMachineWindowSeamless::~UIMachineWindowSeamless()
    8793{
    88     /* Cleanup normal machine view: */
     94    /* Save window settings: */
     95    saveWindowSettings();
     96
     97    /* Cleanup machine view: */
    8998    cleanupMachineView();
    9099
     
    103112    if (m_pMainMenu && !m_pMainMenu->isEmpty())
    104113        m_pMainMenu->popup(machineWindow()->geometry().center());
     114}
     115
     116void UIMachineWindowSeamless::sltUpdateMiniToolBarMask()
     117{
     118    if (m_pMiniToolBar)
     119        setMask(machineView()->lastVisibleRegion());
    105120}
    106121
     
    191206}
    192207
     208void UIMachineWindowSeamless::prepareMiniToolBar()
     209{
     210    /* Get current machine: */
     211    CMachine machine = session().GetConsole().GetMachine();
     212    /* Check if mini tool-bar should present: */
     213    bool fIsActive = machine.GetExtraData(VBoxDefs::GUI_ShowMiniToolBar) != "no";
     214    if (fIsActive)
     215    {
     216        /* Get the mini tool-bar alignment: */
     217        bool fIsAtTop = machine.GetExtraData(VBoxDefs::GUI_MiniToolBarAlignment) == "top";
     218        /* Get the mini tool-bar auto-hide feature availability: */
     219        bool fIsAutoHide = machine.GetExtraData(VBoxDefs::GUI_MiniToolBarAutoHide) != "off";
     220        m_pMiniToolBar = new VBoxMiniToolBar(centralWidget(),
     221                                             fIsAtTop ? VBoxMiniToolBar::AlignTop : VBoxMiniToolBar::AlignBottom,
     222                                             true, fIsAutoHide);
     223        m_pMiniToolBar->setSeamlessMode(true);
     224        m_pMiniToolBar->updateDisplay(true, true);
     225        QList<QMenu*> menus;
     226        menus << uisession()->actionsPool()->action(UIActionIndex_Menu_Machine)->menu();
     227        menus << uisession()->actionsPool()->action(UIActionIndex_Menu_Devices)->menu();
     228        *m_pMiniToolBar << menus;
     229        connect(m_pMiniToolBar, SIGNAL(exitAction()),
     230                uisession()->actionsPool()->action(UIActionIndex_Toggle_Seamless), SLOT(trigger()));
     231        connect(m_pMiniToolBar, SIGNAL(closeAction()),
     232                uisession()->actionsPool()->action(UIActionIndex_Simple_Close), SLOT(trigger()));
     233        connect(m_pMiniToolBar, SIGNAL(geometryUpdated()), this, SLOT(sltUpdateMiniToolBarMask()));
     234    }
     235}
     236
    193237void UIMachineWindowSeamless::prepareMachineView()
    194238{
     
    230274#endif
    231275
     276void UIMachineWindowSeamless::saveWindowSettings()
     277{
     278    /* Get machine: */
     279    CMachine machine = session().GetConsole().GetMachine();
     280
     281    /* Save extra-data settings: */
     282    {
     283        /* Save mini tool-bar settings: */
     284        if (m_pMiniToolBar)
     285            machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAutoHide, m_pMiniToolBar->isAutoHide() ? QString() : "off");
     286    }
     287}
     288
    232289void UIMachineWindowSeamless::cleanupMachineView()
    233290{
     
    244301    delete m_pMainMenu;
    245302    m_pMainMenu = 0;
     303}
     304
     305void UIMachineWindowSeamless::updateAppearanceOf(int iElement)
     306{
     307    /* Base class update: */
     308    UIMachineWindow::updateAppearanceOf(iElement);
     309
     310    /* If mini tool-bar is present: */
     311    if (m_pMiniToolBar)
     312    {
     313        /* Get machine: */
     314        CMachine machine = session().GetConsole().GetMachine();
     315        /* Get snapshot(s): */
     316        QString strSnapshotName;
     317        if (machine.GetSnapshotCount() > 0)
     318        {
     319            CSnapshot snapshot = machine.GetCurrentSnapshot();
     320            strSnapshotName = " (" + snapshot.GetName() + ")";
     321        }
     322        /* Update mini tool-bar text: */
     323        m_pMiniToolBar->setDisplayText(machine.GetName() + strSnapshotName);
     324    }
    246325}
    247326
     
    264343#endif
    265344
    266 #if 0 // TODO: Add mini-toolbar support!
    267     /* Including mini toolbar area */
    268     QRegion toolBarRegion(mMiniToolBar->mask());
    269     toolBarRegion.translate(mMiniToolBar->mapToGlobal (toolBarRegion.boundingRect().topLeft()) - QPoint (1, 0));
     345    /* Including mini tool-bar area */
     346    QRegion toolBarRegion(m_pMiniToolBar->mask());
     347    toolBarRegion.translate(m_pMiniToolBar->mapToGlobal(toolBarRegion.boundingRect().topLeft()) - QPoint(1, 0));
    270348    region += toolBarRegion;
    271 #endif
    272349
    273350#if 0 // TODO: Is it really needed now?
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h

    r27141 r27333  
    3232#endif
    3333
     34/* Local forwards */
     35class VBoxMiniToolBar;
     36
    3437class UIMachineWindowSeamless : public QIWithRetranslateUI2<QIMainDialog>, public UIMachineWindow
    3538{
     
    4952    /* Popup main menu: */
    5053    void sltPopupMainMenu();
     54
     55    /* Update mini tool-bar mask: */
     56    void sltUpdateMiniToolBarMask();
    5157
    5258    /* Close window reimplementation: */
     
    7076    void prepareSeamless();
    7177    void prepareMenu();
     78    void prepareMiniToolBar();
    7279    void prepareMachineView();
    7380#ifdef Q_WS_MAC
     
    7683
    7784    /* Cleanup helpers: */
    78 #ifdef Q_WS_MAC
    79     //void saveWindowSettings() {}
    80 #endif /* Q_WS_MAC */
     85    void saveWindowSettings();
    8186    void cleanupMachineView();
     87    //void cleanupMiniToolBar() {}
    8288    void cleanupMenu();
    8389    //void cleanupSeamless() {}
     90
     91    /* Update routines: */
     92    void updateAppearanceOf(int iElement);
    8493
    8594    /* Other members: */
     
    9099    /* Private variables: */
    91100    QMenu *m_pMainMenu;
     101    VBoxMiniToolBar *m_pMiniToolBar;
    92102#ifdef Q_WS_WIN
    93103    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