VirtualBox

Changeset 27296 in vbox


Ignore:
Timestamp:
Mar 11, 2010 5:09:17 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: New running VM core: storing guest-size-hints in machine extra-data instead of temporary placement in uisession.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp

    r27215 r27296  
    2828const char* VBoxDefs::GUI_LastWindowPosition = "GUI/LastWindowPostion";
    2929const char* VBoxDefs::GUI_LastWindowPosition_Max = "max";
     30const char* VBoxDefs::GUI_LastGuestSizeHint = "GUI/LastGuestSizeHint";
    3031const char* VBoxDefs::GUI_Fullscreen = "GUI/Fullscreen";
    3132const char* VBoxDefs::GUI_Seamless = "GUI/Seamless";
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h

    r27215 r27296  
    146146    static const char* GUI_LastWindowPosition;
    147147    static const char* GUI_LastWindowPosition_Max;
     148    static const char* GUI_LastGuestSizeHint;
    148149    static const char* GUI_Fullscreen;
    149150    static const char* GUI_Seamless;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r27237 r27296  
    310310}
    311311
     312QSize UIMachineView::guestSizeHint()
     313{
     314    /* Result: */
     315    QSize sizeHint;
     316
     317    /* Get current machine: */
     318    CMachine machine = session().GetMachine();
     319
     320    /* Load machine view hint: */
     321    QString strKey = m_uScreenId == 0 ? QString("%1").arg(VBoxDefs::GUI_LastGuestSizeHint) :
     322                     QString("%1%2").arg(VBoxDefs::GUI_LastGuestSizeHint).arg(m_uScreenId);
     323    QString strValue = machine.GetExtraData(strKey);
     324
     325    bool ok = true;
     326    int width = 0, height = 0;
     327    if (ok)
     328        width = strValue.section(',', 0, 0).toInt(&ok);
     329    if (ok)
     330        height = strValue.section(',', 1, 1).toInt(&ok);
     331
     332    if (ok /* If previous parameters were read correctly! */)
     333    {
     334        /* Compose guest size hint from loaded values: */
     335        sizeHint = QSize(width, height);
     336    }
     337    else
     338    {
     339        /* Compose guest size hint from default attributes: */
     340        sizeHint = QSize(800, 600);
     341    }
     342
     343    /* Return result: */
     344    return sizeHint;
     345}
     346
    312347void UIMachineView::setDesktopGeometry(DesktopGeo geometry, int aWidth, int aHeight)
    313348{
     
    340375{
    341376    m_storedConsoleSize = QSize(iWidth, iHeight);
     377}
     378
     379void UIMachineView::storeGuestSizeHint(const QSize &sizeHint)
     380{
     381    /* Get current machine: */
     382    CMachine machine = session().GetMachine();
     383
     384    /* Save machine view hint: */
     385    QString strKey = m_uScreenId == 0 ? QString("%1").arg(VBoxDefs::GUI_LastGuestSizeHint) :
     386                     QString("%1%2").arg(VBoxDefs::GUI_LastGuestSizeHint).arg(m_uScreenId);
     387    QString strValue = QString("%1,%2").arg(sizeHint.width()).arg(sizeHint.height());
     388    machine.SetExtraData(strKey, strValue);
    342389}
    343390
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r27237 r27296  
    114114    DesktopGeo desktopGeometryType() const { return m_desktopGeometryType; }
    115115    QSize desktopGeometry() const;
     116    QSize guestSizeHint();
    116117
    117118    /* Protected setters: */
     
    119120    void storeConsoleSize(int iWidth, int iHeight);
    120121    void setMachineWindowResizeIgnored(bool fIgnore = true) { m_bIsMachineWindowResizeIgnored = fIgnore; }
     122    void storeGuestSizeHint(const QSize &sizeHint);
    121123
    122124    /* Protected helpers: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r27227 r27296  
    614614}
    615615
    616 QSize UISession::guestSizeHint(ulong uScreenId) const
    617 {
    618     return (int)uScreenId < m_guestSizeHints.size() ? m_guestSizeHints[uScreenId] : QSize();
    619 }
    620 
    621616bool UISession::setPause(bool fOn)
    622617{
     
    641636
    642637    return ok;
    643 }
    644 
    645 void UISession::setGuestSizeHint(ulong uScreenId, QSize size)
    646 {
    647     if ((int)uScreenId < m_guestSizeHints.size())
    648         m_guestSizeHints[uScreenId] = size;
    649638}
    650639
     
    948937        pGuestAutoresizeSwitch->setChecked(strSettings != "off");
    949938        pGuestAutoresizeSwitch->blockSignals(false);
    950     }
    951 
    952     /* Some initialization: */
    953     {
    954         /* Initial guest size hints: */
    955         m_guestSizeHints.clear();
    956         for (ulong i = 0; i < machine.GetMonitorCount(); ++ i)
    957             m_guestSizeHints << QSize(640, 480);
    958939    }
    959940}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r27227 r27296  
    8383    QMenuBar* newMenuBar();
    8484    QCursor cursor() const { return m_cursor; }
    85     QSize guestSizeHint(ulong uScreenId) const;
    8685
    8786    bool isSaved() const { return machineState() == KMachineState_Saved; }
     
    125124    bool setPause(bool fOn);
    126125    void setGuestResizeIgnored(bool fIsGuestResizeIgnored) { m_fIsGuestResizeIgnored = fIsGuestResizeIgnored; }
    127     void setGuestSizeHint(ulong uScreenId, QSize size);
    128126
    129127    /* Keyboard setters: */
     
    198196    HCURSOR m_alphaCursor;
    199197#endif
    200     QList<QSize> m_guestSizeHints;
    201198
    202199    /* Common flags: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp

    r27252 r27296  
    249249            machineWindowWrapper()->machineWindow()->hide();
    250250            UIMachineViewBlocker blocker(this);
    251             sltPerformGuestResize(uisession()->guestSizeHint(screenId()));
     251            sltPerformGuestResize(guestSizeHint());
    252252            blocker.exec();
    253253        }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r27237 r27296  
    253253{
    254254    /* Store guest size hint: */
    255     uisession()->setGuestSizeHint(screenId(), QSize(frameBuffer()->width(), frameBuffer()->height()));
     255    storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height()));
    256256}
    257257
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r27252 r27296  
    268268        machineWindowWrapper()->machineWindow()->hide();
    269269        UIMachineViewBlocker blocker(this);
    270         sltPerformGuestResize(uisession()->guestSizeHint(screenId()));
     270        sltPerformGuestResize(guestSizeHint());
    271271        blocker.exec();
    272272    }
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