VirtualBox

Changeset 20441 in vbox for trunk/src


Ignore:
Timestamp:
Jun 9, 2009 2:09:13 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: 3948: Mini-ToolBar for Full-screen & Seamless modes: auto-save of auto-hide feature in extra-data.

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

Legend:

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

    r20412 r20441  
    151151    static const char* GUI_SaveMountedAtRuntime;
    152152    static const char* GUI_ShowMiniToolBar;
     153    static const char* GUI_MiniToolBarAutoHide;
    153154    static const char* GUI_LastCloseAction;
    154155    static const char* GUI_SuppressMessages;
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxMiniToolBar.h

    r20412 r20441  
    4949    };
    5050
    51     VBoxMiniToolBar (QWidget *aParent, Alignment aAlignment);
    52 
    53     void setActive (bool aIsActive);
    54     void setIsSeamlessMode (bool aIsSeamless);
     51    VBoxMiniToolBar (QWidget *aParent, Alignment aAlignment, bool aIsActive, bool aAutoHide);
    5552
    5653    VBoxMiniToolBar& operator<< (QList <QMenu*> aMenus);
    5754
     55    void setSeamlessMode (bool aIsSeamless);
     56    void setDisplayText (const QString &aText);
     57
     58    bool isAutoHide() const;
     59
    5860    void updateDisplay (bool aShow, bool aSetHideFlag);
    59     void setDisplayText (const QString &aText);
    6061
    6162signals:
     
    8889    QBasicTimer mAutoScrollTimer;
    8990
    90     int mAutoHideCounter;
     91    bool mActive;
     92    bool mPolished;
     93    bool mSeamless;
    9194    bool mAutoHide;
    9295    bool mSlideToScreen;
    9396    bool mHideAfterSlide;
    94     bool mPolished;
    9597
     98    int mAutoHideCounter;
    9699    int mPositionX;
    97100    int mPositionY;
    98 
    99     bool mIsActive;
    100     bool mIsSeamless;
    101101
    102102    /* Lists of used spacers */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r20412 r20441  
    807807    AssertWrapperOk (csession);
    808808
    809     console = new VBoxConsoleView (this, cconsole, mode,
    810                                    centralWidget());
     809    console = new VBoxConsoleView (this, cconsole, mode, centralWidget());
     810    static_cast <QGridLayout*> (centralWidget()->layout())->addWidget (console, 1, 1, Qt::AlignVCenter | Qt::AlignHCenter);
     811
     812    CMachine cmachine = csession.GetMachine();
    811813
    812814    /* Mini toolbar */
     815    bool isActive = !(cmachine.GetExtraData (VBoxDefs::GUI_ShowMiniToolBar) == "no");
     816    bool isAutoHide = !(cmachine.GetExtraData (VBoxDefs::GUI_MiniToolBarAutoHide) == "off");
    813817    QList <QMenu*> menus (QList <QMenu*> () << mMiniVMMenu << mDevicesMenu);
    814     mMiniToolBar = new VBoxMiniToolBar (centralWidget(), VBoxMiniToolBar::AlignBottom);
     818    mMiniToolBar = new VBoxMiniToolBar (centralWidget(), VBoxMiniToolBar::AlignBottom,
     819                                        isActive, isAutoHide);
    815820    *mMiniToolBar << menus;
    816821    connect (mMiniToolBar, SIGNAL (exitAction()), this, SLOT (mtExitMode()));
     
    820825
    821826    activateUICustomizations();
    822 
    823     static_cast<QGridLayout*>(centralWidget()->layout())->addWidget(console, 1, 1, Qt::AlignVCenter | Qt::AlignHCenter);
    824 
    825     CMachine cmachine = csession.GetMachine();
    826827
    827828    /* Set the VM-specific application icon */
     
    899900        if (str == "no")
    900901            mIsAutoSaveMedia = false;
    901 
    902         str = cmachine.GetExtraData (VBoxDefs::GUI_ShowMiniToolBar);
    903         if (str == "no")
    904             mMiniToolBar->setActive (false);
    905902
    906903        /* Check if one of extended modes to be activated on loading */
     
    15821579        machine.SetExtraData (VBoxDefs::GUI_AutoresizeGuest,
    15831580                              mVmAutoresizeGuestAction->isChecked() ? "on" : "off");
     1581        machine.SetExtraData (VBoxDefs::GUI_MiniToolBarAutoHide,
     1582                              mMiniToolBar->isAutoHide() ? "on" : "off");
    15841583
    15851584#ifdef VBOX_WITH_DEBUGGER_GUI
     
    24512450    if (aOn)
    24522451    {
    2453         mMiniToolBar->setIsSeamlessMode (aSeamless);
     2452        mMiniToolBar->setSeamlessMode (aSeamless);
    24542453        mMiniToolBar->updateDisplay (true, true);
    24552454    }
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxDefs.cpp

    r20412 r20441  
    3333const char* VBoxDefs::GUI_SaveMountedAtRuntime = "GUI/SaveMountedAtRuntime";
    3434const char* VBoxDefs::GUI_ShowMiniToolBar = "GUI/ShowMiniToolBar";
     35const char* VBoxDefs::GUI_MiniToolBarAutoHide = "GUI/MiniToolBarAutoHide";
    3536const char* VBoxDefs::GUI_LastCloseAction = "GUI/LastCloseAction";
    3637const char* VBoxDefs::GUI_SuppressMessages = "GUI/SuppressMessages";
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMiniToolBar.cpp

    r20412 r20441  
    3838#include <QToolButton>
    3939
    40 VBoxMiniToolBar::VBoxMiniToolBar (QWidget *aParent, Alignment aAlignment)
     40VBoxMiniToolBar::VBoxMiniToolBar (QWidget *aParent, Alignment aAlignment, bool aActive, bool aAutoHide)
    4141    : VBoxToolBar (aParent)
    42     , mAutoHideCounter (0)
    43     , mAutoHide (true)
     42    , mActive (aActive)
     43    , mPolished (false)
     44    , mSeamless (false)
     45    , mAutoHide (aAutoHide)
    4446    , mSlideToScreen (true)
    4547    , mHideAfterSlide (false)
    46     , mPolished (false)
    47     , mIsActive (true)
    48     , mIsSeamless (false)
     48    , mAutoHideCounter (0)
    4949    , mAlignment (aAlignment)
    5050    , mAnimated (true)
     
    108108}
    109109
    110 void VBoxMiniToolBar::setActive (bool aIsActive)
    111 {
    112     mIsActive = aIsActive;
    113 }
    114 
    115 void VBoxMiniToolBar::setIsSeamlessMode (bool aIsSeamless)
    116 {
    117     mIsSeamless = aIsSeamless;
    118 }
    119 
    120110VBoxMiniToolBar& VBoxMiniToolBar::operator<< (QList <QMenu*> aMenus)
    121111{
     
    135125}
    136126
     127void VBoxMiniToolBar::setSeamlessMode (bool aSeamless)
     128{
     129    mSeamless = aSeamless;
     130}
     131
     132/* Update the display text, usually the VM Name */
     133void VBoxMiniToolBar::setDisplayText (const QString &aText)
     134{
     135    mDisplayLabel->setText (aText);
     136}
     137
     138bool VBoxMiniToolBar::isAutoHide() const
     139{
     140    return mAutoHide;
     141}
     142
    137143void VBoxMiniToolBar::updateDisplay (bool aShow, bool aSetHideFlag)
    138144{
     
    153159                mSlideToScreen = true;
    154160            }
    155             if (mIsActive) show();
     161            if (mActive) show();
    156162            mScrollTimer.start (mScrollDelay, this);
    157163        }
    158         else if (mIsActive) show();
     164        else if (mActive) show();
    159165
    160166        if (mAutoHide)
     
    182188            mAutoScrollTimer.stop();
    183189    }
    184 }
    185 
    186 /* Update the display text, usually the VM Name */
    187 void VBoxMiniToolBar::setDisplayText (const QString &aText)
    188 {
    189     mDisplayLabel->setText (aText);
    190190}
    191191
     
    226226            case AlignBottom:
    227227            {
    228                 QRect screen = mIsSeamless ? QApplication::desktop()->availableGeometry (this) :
    229                                              QApplication::desktop()->screenGeometry (this);
     228                QRect screen = mSeamless ? QApplication::desktop()->availableGeometry (this) :
     229                                           QApplication::desktop()->screenGeometry (this);
    230230                if (((mPositionY == screen.height() - height()) && mSlideToScreen) ||
    231231                    ((mPositionY == screen.height() - 1) && !mSlideToScreen))
     
    361361void VBoxMiniToolBar::moveToBase()
    362362{
    363     QRect screen = mIsSeamless ? QApplication::desktop()->availableGeometry (this) :
    364                                  QApplication::desktop()->screenGeometry (this);
     363    QRect screen = mSeamless ? QApplication::desktop()->availableGeometry (this) :
     364                               QApplication::desktop()->screenGeometry (this);
    365365    mPositionX = screen.width() / 2 - width() / 2;
    366366    switch (mAlignment)
     
    389389    QPoint globalPosition = parentWidget()->mapFromGlobal (aPoint);
    390390    QRect fullArea = QApplication::desktop()->screenGeometry (this);
    391     QRect realArea = mIsSeamless ? QApplication::desktop()->availableGeometry (this) :
    392                                    QApplication::desktop()->screenGeometry (this);
     391    QRect realArea = mSeamless ? QApplication::desktop()->availableGeometry (this) :
     392                                 QApplication::desktop()->screenGeometry (this);
    393393    QPoint shiftToReal (realArea.topLeft() - fullArea.topLeft());
    394394    return globalPosition + shiftToReal;
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