VirtualBox

Changeset 2736 in vbox for trunk/src


Ignore:
Timestamp:
May 21, 2007 2:41:11 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
21337
Message:
  1. Messages for “your additions are outdated” and “there is a newer additions version” moved into ProblemReporter class.
  2. AutoResize event class replaced with zero-single-shot timer with the required slot for the exiting from full-screen and maximized modes.
  3. mIsAutoresizeEnabled flag replaced with mIsAdditionsActive which reflects the guest additions status and might be useful in different places to point up are additions activated or not. Currently it is used in "auto-resize mode active possibility" determination.
  4. Linux SDL Full-screen mode entering issue (screen is not refreshed in case of there is no changes on the screen and auto-resize mode is off) fixed.
Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
7 edited

Legend:

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

    r2700 r2736  
    4949class QMenuData;
    5050
    51 /** Auto-resize event.
    52   * Useful for posting into events queue to be processed just after all
    53   * QEvent::Resize & QEvent::WindowStateChange events currently posted.
    54   * This is necessary due to these two events - QEvent::Resize &
    55   * QEvent::WindowStateChange are processed in different sequence
    56   * under Win32 and X11. */
    57 class AutoResizeEvent : public QEvent
    58 {
    59 public:
    60     AutoResizeEvent () :
    61         QEvent ((QEvent::Type) VBoxDefs::AutoResizeEventType) {}
    62 };
    63 
    6451class VBoxConsoleView : public QScrollView
    6552{
     
    183170    static void dimImage (QImage &img);
    184171
    185     void performAutoResize();
    186 
    187172private slots:
     173
     174    void exitFullScreen();
    188175
    189176    void doResizeHint();
     
    218205
    219206    bool ignore_mainwnd_resize : 1;
    220     bool autoresize_guest : 1;
     207    bool mAutoresizeGuest : 1;
     208
     209    bool mIsAdditionsActive;
    221210
    222211    bool mfNumLock : 1;
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h

    r2700 r2736  
    249249    CSession csession;
    250250
    251     bool mIsAutoresizeEnabled;
    252 
    253251    // widgets
    254252    VBoxConsoleView *console;
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h

    r2700 r2736  
    129129        MachineStateChangeEventType,
    130130        AdditionsStateChangeEventType,
    131         AutoResizeEventType,
    132131        MachineDataChangeEventType,
    133132        MachineRegisteredEventType,
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h

    r2671 r2736  
    200200    bool confirmReleaseImage (QWidget*, QString);
    201201
     202    void warnAboutOldAdditions (QWidget*, const QString &);
     203    void warnAboutNewAdditions (QWidget*, const QString &);
     204
    202205    bool remindAboutInputCapture();
    203206    bool remindAboutAutoCapture();
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r2722 r2736  
    458458    , hostkey_alone (false)
    459459    , ignore_mainwnd_resize (false)
    460     , autoresize_guest (false)
     460    , mAutoresizeGuest (false)
     461    , mIsAdditionsActive (false)
    461462    , mfNumLock (false)
    462463    , mfScrollLock (false)
     
    769770void VBoxConsoleView::setAutoresizeGuest (bool on)
    770771{
    771     if (autoresize_guest != on)
    772     {
    773         autoresize_guest = on;
    774 
    775         if (on)
    776         {
    777             if (mode == VBoxDefs::SDLMode)
     772    if (mAutoresizeGuest != on)
     773    {
     774        mAutoresizeGuest = on;
     775
     776        if (mode == VBoxDefs::SDLMode)
     777        {
     778            /* restrict minimum size because we cannot correctly draw
     779             * in a scrolled window using SDL */
     780            if (!mAutoresizeGuest)
     781                setMinimumSize (sizeHint());
     782            else
    778783                setMinimumSize (0, 0);
    779 
     784        }
     785
     786        if (mIsAdditionsActive && mAutoresizeGuest)
    780787            doResizeHint();
    781         }
    782         else
    783         {
    784             /* restrict minimum size because we cannot correctly draw in a
    785              * scrolled window using SDL */
    786             if (mode == VBoxDefs::SDLMode)
    787                 setMinimumSize (sizeHint());
    788         }
    789788    }
    790789}
     
    848847                    /* restrict minimum size because we cannot correctly draw
    849848                     * in a scrolled window using SDL */
    850                     if (!autoresize_guest)
     849                    if (!mAutoresizeGuest)
    851850                        setMinimumSize (sizeHint());
    852851                    else
     
    938937                GuestAdditionsEvent *ge = (GuestAdditionsEvent *) e;
    939938                LogFlowFunc (("AdditionsStateChangeEventType\n"));
     939                mIsAdditionsActive = ge->additionActive();
    940940                emit additionsStateChanged (ge->additionVersion(), ge->additionActive());
    941941                return true;
     
    10311031            }
    10321032
    1033             case VBoxDefs::AutoResizeEventType:
    1034             {
    1035                 performAutoResize();
    1036                 return true;
    1037             }
    1038 
    10391033            default:
    10401034                break;
     
    11361130                if (!ignore_mainwnd_resize)
    11371131                {
    1138                     if (autoresize_guest)
     1132                    if (mIsAdditionsActive && mAutoresizeGuest)
    11391133                        resize_hint_timer->start (300, TRUE);
    11401134                    /* During window maximization WindowStateChange event is
     
    11551149                    !mainwnd->isMaximized() &&
    11561150                    !mainwnd->isTrueFullscreen())
    1157                     QApplication::postEvent (this, new AutoResizeEvent ());
     1151                    QTimer::singleShot (0, this, SLOT (exitFullScreen()));
    11581152            }
    11591153
     
    17051699}
    17061700
    1707 void VBoxConsoleView::performAutoResize()
    1708 {
    1709     if (autoresize_guest)
     1701/**
     1702 *  Called on every exit from fullscreen and maximized mode.
     1703 */
     1704void VBoxConsoleView::exitFullScreen()
     1705{
     1706    if (mIsAdditionsActive && mAutoresizeGuest)
    17101707    {
    17111708        doResizeHint();
     
    28782875void VBoxConsoleView::doResizeHint()
    28792876{
    2880     if (autoresize_guest)
     2877    if (mIsAdditionsActive && mAutoresizeGuest)
    28812878    {
    28822879        /* Get the available size for the guest display.
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r2703 r2736  
    216216    , dbgMenu (NULL)
    217217#endif
    218     , mIsAutoresizeEnabled (false)
    219218    , console (0)
    220219    , mUsbLedTip (0)
     
    726725        str = cmachine.GetExtraData (GUI_AutoresizeGuest);
    727726        if (str != "off")
    728             mIsAutoresizeEnabled = true;
     727            vmAutoresizeGuestAction->setOn (true);
    729728
    730729        str = cmachine.GetExtraData (GUI_LastWindowPosition);
     
    17111710    bool wasHidden = isHidden();
    17121711
     1712    static QSize prevMinimumSize;
    17131713    if (on)
    17141714    {
     1715        /* Save previous scroll-view minimum size before entering fullscreen
     1716         * state to make return to this minimum size before the exiting
     1717         * fullscreen. Required for correct scroll-view update in SDL mode. */
     1718        prevMinimumSize = console->minimumSize();
     1719        console->setMinimumSize (0, 0);
     1720
    17151721        /* memorize the maximized state */
    17161722        was_max = isMaximized();
     
    17601766    else
    17611767    {
     1768        /* Returns to previous scroll-view minimum size before the exiting
     1769         * fullscreen. Required for correct scroll-view update in SDL mode. */
     1770        console->setMinimumSize (prevMinimumSize);
     1771
    17621772        /* hide early to avoid extra flicker */
    17631773#ifdef Q_WS_MAC
     
    17881798        if (was_max)
    17891799            setWindowState (windowState() | WindowMaximized);
    1790         QApplication::postEvent (console, new AutoResizeEvent());
     1800        QTimer::singleShot (0, console, SLOT (exitFullScreen()));
    17911801    }
    17921802
     
    25032513void VBoxConsoleWnd::updateAdditionsState (const QString &aVersion, bool aActive)
    25042514{
    2505     /* mIsAutoresizeEnabled flag stores the auto-resize status loaded from the
    2506      * settings and used for the activation of the autoresize feature
    2507      * if the additions state told us here it is activated. */
    25082515    vmAutoresizeGuestAction->setEnabled (aActive);
    2509     vmAutoresizeGuestAction->setOn (aActive && mIsAutoresizeEnabled);
    25102516
    25112517    /* Checking for the Guest Additions version to warn user about possible
     
    25162522
    25172523    if (RT_HIWORD (version) < RT_HIWORD (VMMDEV_VERSION))
    2518         vboxProblem().message (this, VBoxProblemReporter::Warning,
    2519             tr ("<p>Your Guest Additions are outdated (current version: %1).</p>"
    2520                 "<p>You must update to the latest version by choosing Devices "
    2521                 "- Install Guest Additions.</p>").arg (fullVersion));
     2524        vboxProblem().warnAboutOldAdditions (this, fullVersion);
    25222525    else if (RT_HIWORD (version) == RT_HIWORD (VMMDEV_VERSION) &&
    25232526             RT_LOWORD (version) <  RT_LOWORD (VMMDEV_VERSION))
    2524         vboxProblem().message (this, VBoxProblemReporter::Warning,
    2525             tr ("<p>Your Guest Additions are outdated (current version: %1).</p>"
    2526                 "<p>There is a newer Guest Additions version. You should update "
    2527                 "to the latest version by choosing Devices "
    2528                 "- Install Guest Additions.</p>").arg (fullVersion));
     2527        vboxProblem().warnAboutNewAdditions (this, fullVersion);
    25292528}
    25302529
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r2671 r2736  
    3737#ifdef Q_WS_MAC
    3838# include <qpushbutton.h>
    39 #endif 
     39#endif
    4040
    4141#include <iprt/err.h>
     
    10971097}
    10981098
     1099void VBoxProblemReporter::warnAboutOldAdditions (QWidget *aParent,
     1100                                                 const QString &aVersion)
     1101{
     1102    message (aParent, VBoxProblemReporter::Warning,
     1103        tr ("<p>Your Guest Additions are outdated (current version: %1).</p>"
     1104            "<p>You must update to the latest version by choosing Devices "
     1105            "- Install Guest Additions.</p>").arg (aVersion));
     1106}
     1107
     1108void VBoxProblemReporter::warnAboutNewAdditions (QWidget *aParent,
     1109                                                 const QString &aVersion)
     1110{
     1111    message (aParent, VBoxProblemReporter::Warning,
     1112        tr ("<p>Your Guest Additions are outdated (current version: %1).</p>"
     1113            "<p>There is a newer Guest Additions version. You should update "
     1114            "to the latest version by choosing Devices "
     1115            "- Install Guest Additions.</p>").arg (aVersion));
     1116}
     1117
    10991118#if defined Q_WS_WIN
    11001119
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