VirtualBox

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


Ignore:
Timestamp:
May 26, 2009 4:08:25 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: 3948: Mini-ToolBar for Full-screen & Seamless modes - Initial commit.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r19961 r20047  
    254254        include/VBoxConsoleWnd.h \
    255255        include/VBoxConsoleView.h \
     256        include/VBoxMiniToolBar.h \
    256257        include/VBoxProblemReporter.h \
    257258        include/VBoxProgressDialog.h \
     
    345346        src/VBoxConsoleView.cpp \
    346347        src/VBoxConsoleWnd.cpp \
     348        src/VBoxMiniToolBar.cpp \
    347349        src/VBoxDownloaderWgt.cpp \
    348350        src/VBoxVMListView.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox.qrc

    r19877 r20047  
    340340    <file alias="chipset_disabled_16px.png">images/chipset_disabled_16px.png</file>
    341341    <file alias="chipset_disabled_32px.png">images/chipset_disabled_32px.png</file>
     342    <file alias="pin_16px.png">images/pin_16px.png</file>
     343    <file alias="restore_16px.png">images/restore_16px.png</file>
    342344 </qresource>
    343345 </RCC>
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h

    r17730 r20047  
    5757
    5858class VBoxChangeDockIconUpdateEvent;
     59
     60class VBoxMiniToolBar;
    5961
    6062/* We want to make the first action highlighted but not
     
    250252    void setViewInSeamlessMode (const QRect &aTargetRect);
    251253
     254    void mtExitMode();
     255    void mtCloseVM();
     256
    252257private:
    253258
     
    307312
    308313    QMenu *mVMMenu;
     314    QMenu *mMiniVMMenu;
    309315    QMenu *mDevicesMenu;
    310316    QMenu *mDevicesMountFloppyMenu;
     
    392398    CGDisplayFadeReservationToken mFadeToken;
    393399#endif
     400
     401    VBoxMiniToolBar *mMiniToolBar;
    394402};
    395403
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxToolBar.h

    r17349 r20047  
    3030
    3131/* Qt includes */
     32#include <QLayout>
     33#include <QMainWindow>
    3234#include <QToolBar>
    33 #include <QMainWindow>
    3435
    3536/* Note: This styles are available on _all_ platforms. */
     
    123124        ::darwinSetShowsToolbarButton (this, aShow);
    124125#else  /* Q_WS_MAC */
    125         NOREF (aShow);
     126        Q_UNUSED (aShow);
    126127#endif /* !Q_WS_MAC */
    127128    }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r19844 r20047  
    26032603        doResizeHint (newSize);
    26042604    }
     2605
     2606    /* Reactivate the console window to preserve the focus position.
     2607     * Else focus will move to the mini-tool-bar. */
     2608    activateWindow();
    26052609}
    26062610
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r19904 r20047  
    3232#include "VBoxGlobal.h"
    3333#include "VBoxProblemReporter.h"
     34#include "VBoxMiniToolBar.h"
    3435
    3536#include "QIStateIndicator.h"
     
    503504
    504505    mHelpActions.addTo (mHelpMenu);
     506
     507    /* Machine submenu for mini toolbar */
     508    mMiniVMMenu = new QMenu (this);
     509    mMiniVMMenu->addAction (mVmTypeCADAction);
     510#ifdef Q_WS_X11
     511    mMiniVMMenu->addAction (mVmTypeCABSAction);
     512#endif
     513    mMiniVMMenu->addSeparator();
     514    mMiniVMMenu->addAction (mVmTakeSnapshotAction);
     515    mMiniVMMenu->addSeparator();
     516    mMiniVMMenu->addAction (mVmShowInformationDlgAction);
     517    mMiniVMMenu->addSeparator();
     518    mMiniVMMenu->addAction (mVmResetAction);
     519    mMiniVMMenu->addAction (mVmPauseAction);
     520    mMiniVMMenu->addAction (mVmACPIShutdownAction);
     521
     522    /* Mini toolbar */
     523    QList <QMenu*> menuList;
     524    menuList.append (mMiniVMMenu);
     525    menuList.append (mDevicesMenu);
     526    mMiniToolBar = new VBoxMiniToolBar (menuList);
     527    connect (mMiniToolBar, SIGNAL (exitAction()), this, SLOT (mtExitMode()));
     528    connect (mMiniToolBar, SIGNAL (closeAction()), this, SLOT (mtCloseVM()));
     529    connect (this, SIGNAL (closing()), mMiniToolBar, SLOT (close()));
    505530
    506531    ///// Status bar ////////////////////////////////////////////////////////
     
    17421767//    mVMMenu->setIcon (VBoxGlobal::iconSet (":/machine_16px.png"));
    17431768
     1769    mMiniVMMenu->setTitle (tr ("&Machine"));
     1770
    17441771    mDevicesMenu->setTitle (tr ("&Devices"));
    17451772//    mDevicesMenu->setIcon (VBoxGlobal::iconSet (":/settings_16px.png"));
     
    18061833                        " [" + vboxGlobal().toString (machine_state) + "] - " +
    18071834                        caption_prefix);
     1835        mMiniToolBar->setDisplayText (cmachine.GetName() + snapshotName);
    18081836//#ifdef Q_WS_MAC
    18091837//        SetWindowTitleWithCFString (reinterpret_cast <WindowPtr> (this->winId()), CFSTR("sfds"));
     
    23272355
    23282356        /* Hide all but the central widget containing the console view. */
    2329         QList<QWidget *> list = findChildren<QWidget *>();
     2357        QList <QWidget*> list (findChildren <QWidget*> ());
     2358        QList <QWidget*> excludes;
     2359        excludes << centralWidget() << centralWidget()->findChildren <QWidget*> ();
    23302360        foreach (QWidget *w, list)
    23312361        {
    2332             /* todo: The list is now recursive. So think about a better way to
    2333              * prevent the childrens of the centralWidget to be hidden */
    2334             if (w != centralWidget() &&
    2335                 w != console &&
    2336                 w != console->viewport())
     2362            if (!excludes.contains (w))
    23372363            {
    23382364                if (!w->isHidden())
     
    24012427        mIsWaitingModeResize = true;
    24022428
     2429    if (!aOn)
     2430    {
     2431        /* Animation takes a bit long, the mini toolbar is still disappearing
     2432         * when switched to normal mode so hide it completely */
     2433        mMiniToolBar->hide();
     2434        mMiniToolBar->updateDisplay (false, true);
     2435    }
     2436
    24032437    /* Toggle qt full-screen mode */
    24042438    switchToFullscreen (aOn, aSeamless);
     2439
     2440    if (aOn)
     2441    {
     2442        mMiniToolBar->updateDisplay (true, true);
     2443    }
    24052444
    24062445#ifdef Q_WS_MAC
     
    25192558    NOREF (aTargetRect);
    25202559#endif // !Q_WS_MAC
     2560}
     2561
     2562void VBoxConsoleWnd::mtExitMode()
     2563{
     2564    if (mIsSeamless)
     2565        mVmSeamlessAction->toggle();
     2566    else
     2567        mVmFullscreenAction->toggle();
     2568}
     2569
     2570void VBoxConsoleWnd::mtCloseVM()
     2571{
     2572    mVmCloseAction->trigger();
    25212573}
    25222574
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