VirtualBox

Changeset 56701 in vbox for trunk


Ignore:
Timestamp:
Jun 30, 2015 2:58:12 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: 7844: Some cleanup in corresponding code.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r56217 r56701  
    30723072}
    30733073
    3074 QSize UIExtraDataManager::lastGuestSizeHint(ulong uScreenIndex, const QString &strID)
     3074QSize UIExtraDataManager::lastGuestScreenSizeHint(ulong uScreenIndex, const QString &strID)
    30753075{
    30763076    /* Choose corresponding key: */
     
    30963096}
    30973097
    3098 void UIExtraDataManager::setLastGuestSizeHint(ulong uScreenIndex, const QSize &sizeHint, const QString &strID)
     3098void UIExtraDataManager::setLastGuestScreenSizeHint(ulong uScreenIndex, const QSize &sizeHint, const QString &strID)
    30993099{
    31003100    /* Choose corresponding key: */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r55939 r56701  
    380380
    381381        /** Returns last guest-screen size-hint for screen with @a uScreenIndex. */
    382         QSize lastGuestSizeHint(ulong uScreenIndex, const QString &strID);
     382        QSize lastGuestScreenSizeHint(ulong uScreenIndex, const QString &strID);
    383383        /** Defines last guest-screen @a sizeHint for screen with @a uScreenIndex. */
    384         void setLastGuestSizeHint(ulong uScreenIndex, const QSize &sizeHint, const QString &strID);
     384        void setLastGuestScreenSizeHint(ulong uScreenIndex, const QSize &sizeHint, const QString &strID);
    385385
    386386        /** Returns host-screen index corresponding to passed guest-screen @a iGuestScreenIndex. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r56617 r56701  
    659659         * On X11 this will be additional done when the machine state was 'saved'. */
    660660        if (machine().GetState() == KMachineState_Saved)
    661             size = guestSizeHint();
     661            size = guestScreenSizeHint();
    662662#endif /* Q_WS_X11 */
    663663
     
    923923}
    924924
    925 QSize UIMachineView::guestSizeHint()
     925QSize UIMachineView::guestScreenSizeHint() const
    926926{
    927927    /* Load guest-screen size-hint: */
    928     QSize size = gEDataManager->lastGuestSizeHint(m_uScreenId, vboxGlobal().managedVMUuid());
     928    QSize sizeHint = gEDataManager->lastGuestScreenSizeHint(m_uScreenId, vboxGlobal().managedVMUuid());
    929929
    930930    /* Invent the default if necessary: */
    931     if (!size.isValid())
    932         size = QSize(800, 600);
     931    if (!sizeHint.isValid())
     932        sizeHint = QSize(800, 600);
    933933
    934934    /* Take the scale-factor(s) into account: */
    935     size = scaledForward(size);
    936 
    937     /* Return size: */
    938     return size;
     935    sizeHint = scaledForward(sizeHint);
     936
     937    /* Return size-hint: */
     938    return sizeHint;
     939}
     940
     941void UIMachineView::storeGuestSizeHint(const QSize &sizeHint)
     942{
     943    /* Save guest-screen size-hint: */
     944    LogRel(("GUI: UIMachineView::storeGuestSizeHint: "
     945            "Storing guest-screen size-hint for screen %d as %dx%d\n",
     946            (int)screenId(), sizeHint.width(), sizeHint.height()));
     947    gEDataManager->setLastGuestScreenSizeHint(m_uScreenId, sizeHint, vboxGlobal().managedVMUuid());
    939948}
    940949
     
    983992    LogRelFlow(("GUI: UIMachineView::handleScaleChange: Complete for Screen=%d\n",
    984993                (unsigned long)m_uScreenId));
    985 }
    986 
    987 void UIMachineView::storeGuestSizeHint(const QSize &size)
    988 {
    989     /* Save guest-screen size-hint: */
    990     LogRel(("GUI: UIMachineView::storeGuestSizeHint: "
    991             "Storing guest size-hint for screen %d as %dx%d\n",
    992             (int)screenId(), size.width(), size.height()));
    993     gEDataManager->setLastGuestSizeHint(m_uScreenId, size, vboxGlobal().managedVMUuid());
    994994}
    995995
     
    10591059
    10601060    /* Create a screen-shot on the basis of the screen-data we have in saved-state: */
    1061     QImage screenShot = QImage::fromData(screenData.data(), screenData.size(), "PNG").scaled(uGuestWidth > 0 ? QSize(uGuestWidth, uGuestHeight) : guestSizeHint());
     1061    QImage screenShot = QImage::fromData(screenData.data(), screenData.size(), "PNG").scaled(uGuestWidth > 0 ? QSize(uGuestWidth, uGuestHeight) : guestScreenSizeHint());
    10621062
    10631063    /* Dim screen-shot if it is Ok: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r56497 r56701  
    209209     * @sa m_u64MaxGuestSize. */
    210210    QSize maxGuestSize();
    211     /** Retrieve the last non-fullscreen guest size hint (from extra data).
    212      */
    213     QSize guestSizeHint();
     211
     212    /** Retrieves the last guest-screen size-hint from extra-data. */
     213    QSize guestScreenSizeHint() const;
     214    /** Stores a guest-screen size-hint to extra-data. */
     215    void storeGuestSizeHint(const QSize &sizeHint);
    214216
    215217    /** Handles machine-view scale changes. */
    216218    void handleScaleChange();
    217 
    218     /* Protected setters: */
    219     /** Store a guest size hint value to extra data, called on switching to
    220      * fullscreen. */
    221     void storeGuestSizeHint(const QSize &size);
    222219
    223220    /** Returns the pause-pixmap: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r56561 r56701  
    137137void UIMachineViewNormal::resendSizeHint()
    138138{
    139     /* Get the last size hint, taking the scale factor into account. */
    140     const QSize sizeHint = scaledBackward(guestSizeHint());
     139    /* Get the last guest-screen size-hint, taking the scale factor into account. */
     140    const QSize sizeHint = scaledBackward(guestScreenSizeHint());
    141141    LogRel(("GUI: UIMachineViewNormal::resendSizeHint: Restoring guest size-hint for screen %d to %dx%d\n",
    142142            (int)screenId(), sizeHint.width(), sizeHint.height()));
     143
     144    /* Expand current limitations: */
     145    setMaxGuestSize(sizeHint);
     146
    143147    if (uisession()->isGuestSupportsGraphics())
    144148    {
     
    150154        m_sizeHintOverride = sizeHint;
    151155    }
    152     /** @todo What if not m_bIsGuestAutoresizeEnabled?  Just let the guest start
    153      *        at the default 800x600? */
    154     display().SetVideoModeHint(screenId(), true, false, 0, 0, sizeHint.width(), sizeHint.height(), 0);
     156
     157    /* Send saved size-hint to the guest: */
     158    /// @todo What if not m_bIsGuestAutoresizeEnabled?
     159    ///       Just let the guest start at the default 800x600?
     160    display().SetVideoModeHint(screenId(),
     161                               true /* temporary decision */,
     162                               false, 0, 0, sizeHint.width(), sizeHint.height(), 0);
    155163}
    156164
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r56443 r56701  
    153153void UIMachineViewScale::resendSizeHint()
    154154{
    155     const QSize sizeHint = scaledBackward(guestSizeHint());
     155    /* Get the last guest-screen size-hint, taking the scale factor into account. */
     156    const QSize sizeHint = scaledBackward(guestScreenSizeHint());
    156157    LogRel(("GUI: UIMachineViewScale::resendSizeHint: Restoring guest size-hint for screen %d to %dx%d\n",
    157158            (int)screenId(), sizeHint.width(), sizeHint.height()));
     159
    158160    /* Expand current limitations: */
    159161    setMaxGuestSize(sizeHint);
    160     display().SetVideoModeHint(screenId(), true, false, 0, 0, sizeHint.width(), sizeHint.height(), 0);
     162
     163    /* Send saved size-hint to the guest: */
     164    display().SetVideoModeHint(screenId(),
     165                               true /* temporary decision */,
     166                               false, 0, 0, sizeHint.width(), sizeHint.height(), 0);
    161167}
    162168
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