VirtualBox

Changeset 30751 in vbox


Ignore:
Timestamp:
Jul 8, 2010 9:21:06 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt: New running VM core: Few little fixes for initial selector window & machine window(s) positioning.

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

Legend:

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

    r30677 r30751  
    635635            h = winPos.section (',', 3, 3).toInt (&ok);
    636636        if (ok)
    637             max = winPos.section (',', 4, 4) == VBoxDefs::GUI_LastWindowPosition_Max;
     637            max = winPos.section (',', 4, 4) == VBoxDefs::GUI_LastWindowState_Max;
    638638
    639639        QRect ar = ok ? QApplication::desktop()->availableGeometry (QPoint (x, y)) :
     
    779779        if (isMaximized())
    780780#endif /* !Q_WS_MAC */
    781             winPos += QString (",%1").arg (VBoxDefs::GUI_LastWindowPosition_Max);
     781            winPos += QString (",%1").arg (VBoxDefs::GUI_LastWindowState_Max);
    782782
    783783        vbox.SetExtraData (VBoxDefs::GUI_LastWindowPosition, winPos);
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp

    r30677 r30751  
    2121#include <VBoxDefs.h>
    2222
    23 const char* VBoxDefs::GUI_LastWindowPosition = "GUI/LastWindowPostion";
    24 const char* VBoxDefs::GUI_LastWindowPosition_Max = "max";
     23const char* VBoxDefs::GUI_LastWindowPosition = "GUI/LastWindowPosition";
     24const char* VBoxDefs::GUI_LastNormalWindowPosition = "GUI/LastNormalWindowPosition";
     25const char* VBoxDefs::GUI_LastWindowState_Max = "max";
    2526const char* VBoxDefs::GUI_LastGuestSizeHint = "GUI/LastGuestSizeHint";
    2627const char* VBoxDefs::GUI_Toolbar = "GUI/Toolbar";
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h

    r30677 r30751  
    100100
    101101    static const char* GUI_LastWindowPosition;
    102     static const char* GUI_LastWindowPosition_Max;
     102    static const char* GUI_LastNormalWindowPosition;
     103    static const char* GUI_LastWindowState_Max;
    103104    static const char* GUI_SplitterSizes;
    104105    static const char* GUI_Toolbar;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r30637 r30751  
    513513    /* Load extra-data settings: */
    514514    {
    515         QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(VBoxDefs::GUI_LastWindowPosition) :
    516                                      QString("%1%2").arg(VBoxDefs::GUI_LastWindowPosition).arg(m_uScreenId);
    517         QString strPositionSettings = machine.GetExtraData(strPositionAddress);
    518 
    519         bool ok = false, max = false;
     515        QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(VBoxDefs::GUI_LastNormalWindowPosition) :
     516                                     QString("%1%2").arg(VBoxDefs::GUI_LastNormalWindowPosition).arg(m_uScreenId);
     517        QStringList strPositionSettings = machine.GetExtraDataStringList(strPositionAddress);
     518
     519        bool ok = true, max = false;
    520520        int x = 0, y = 0, w = 0, h = 0;
    521         x = strPositionSettings.section(',', 0, 0).toInt(&ok);
    522         if (ok)
    523             y = strPositionSettings.section(',', 1, 1).toInt(&ok);
    524         if (ok)
    525             w = strPositionSettings.section(',', 2, 2).toInt(&ok);
    526         if (ok)
    527             h = strPositionSettings.section(',', 3, 3).toInt(&ok);
    528         if (ok)
    529             max = strPositionSettings.section(',', 4, 4) == VBoxDefs::GUI_LastWindowPosition_Max;
     521        if (ok && strPositionSettings.size() > 0)
     522            x = strPositionSettings[0].toInt(&ok);
     523        if (ok && strPositionSettings.size() > 1)
     524            y = strPositionSettings[1].toInt(&ok);
     525        if (ok && strPositionSettings.size() > 2)
     526            w = strPositionSettings[2].toInt(&ok);
     527        if (ok && strPositionSettings.size() > 3)
     528            h = strPositionSettings[3].toInt(&ok);
     529        if (ok && strPositionSettings.size() > 4)
     530            max = strPositionSettings[4] == VBoxDefs::GUI_LastWindowState_Max;
    530531
    531532        QRect ar = ok ? QApplication::desktop()->availableGeometry(QPoint(x, y)) :
    532533                        QApplication::desktop()->availableGeometry(machineWindow());
    533534
    534         if (ok /* if previous parameters were read correctly */)
     535        /* If previous parameters were read correctly: */
     536        if (ok)
    535537        {
     538            /* If previous machine state is SAVED: */
    536539            if (machine.GetState() == KMachineState_Saved)
    537540            {
    538                 /* restore from a saved state: restore window size and position */
     541                /* Restore window size and position: */
    539542                m_normalGeometry = QRect(x, y, w, h);
    540543                setGeometry(m_normalGeometry);
    541544            }
     545            /* If previous machine state is not SAVED: */
    542546            else
    543547            {
    544                 /* not restored from a saved state: restore only the last position */
    545                 move(x, y);
     548                /* Restore only window position: */
     549                m_normalGeometry = QRect(x, y, width(), height());
     550                setGeometry(m_normalGeometry);
    546551                if (machineView())
    547552                    machineView()->normalizeGeometry(false /* adjust position? */);
    548 
    549553            }
    550 
    551554            /* Maximize if needed: */
    552555            if (max)
     
    558561            if (machineView())
    559562                machineView()->normalizeGeometry(true /* adjust position? */);
    560 
    561563            /* Move newly created window to the screen center: */
    562564            m_normalGeometry = geometry();
     
    614616                                    .arg(m_normalGeometry.width()).arg(m_normalGeometry.height());
    615617        if (isMaximizedChecked())
    616             strWindowPosition += QString(",%1").arg(VBoxDefs::GUI_LastWindowPosition_Max);
    617         QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(VBoxDefs::GUI_LastWindowPosition) :
    618                                      QString("%1%2").arg(VBoxDefs::GUI_LastWindowPosition).arg(m_uScreenId);
     618            strWindowPosition += QString(",%1").arg(VBoxDefs::GUI_LastWindowState_Max);
     619        QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(VBoxDefs::GUI_LastNormalWindowPosition) :
     620                                     QString("%1%2").arg(VBoxDefs::GUI_LastNormalWindowPosition).arg(m_uScreenId);
    619621        machine.SetExtraData(strPositionAddress, strWindowPosition);
    620622    }
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