Changeset 30751 in vbox
- Timestamp:
- Jul 8, 2010 9:21:06 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r30677 r30751 635 635 h = winPos.section (',', 3, 3).toInt (&ok); 636 636 if (ok) 637 max = winPos.section (',', 4, 4) == VBoxDefs::GUI_LastWindow Position_Max;637 max = winPos.section (',', 4, 4) == VBoxDefs::GUI_LastWindowState_Max; 638 638 639 639 QRect ar = ok ? QApplication::desktop()->availableGeometry (QPoint (x, y)) : … … 779 779 if (isMaximized()) 780 780 #endif /* !Q_WS_MAC */ 781 winPos += QString (",%1").arg (VBoxDefs::GUI_LastWindow Position_Max);781 winPos += QString (",%1").arg (VBoxDefs::GUI_LastWindowState_Max); 782 782 783 783 vbox.SetExtraData (VBoxDefs::GUI_LastWindowPosition, winPos); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp
r30677 r30751 21 21 #include <VBoxDefs.h> 22 22 23 const char* VBoxDefs::GUI_LastWindowPosition = "GUI/LastWindowPostion"; 24 const char* VBoxDefs::GUI_LastWindowPosition_Max = "max"; 23 const char* VBoxDefs::GUI_LastWindowPosition = "GUI/LastWindowPosition"; 24 const char* VBoxDefs::GUI_LastNormalWindowPosition = "GUI/LastNormalWindowPosition"; 25 const char* VBoxDefs::GUI_LastWindowState_Max = "max"; 25 26 const char* VBoxDefs::GUI_LastGuestSizeHint = "GUI/LastGuestSizeHint"; 26 27 const char* VBoxDefs::GUI_Toolbar = "GUI/Toolbar"; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
r30677 r30751 100 100 101 101 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; 103 104 static const char* GUI_SplitterSizes; 104 105 static const char* GUI_Toolbar; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r30637 r30751 513 513 /* Load extra-data settings: */ 514 514 { 515 QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(VBoxDefs::GUI_Last WindowPosition) :516 QString("%1%2").arg(VBoxDefs::GUI_Last WindowPosition).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; 520 520 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; 530 531 531 532 QRect ar = ok ? QApplication::desktop()->availableGeometry(QPoint(x, y)) : 532 533 QApplication::desktop()->availableGeometry(machineWindow()); 533 534 534 if (ok /* if previous parameters were read correctly */) 535 /* If previous parameters were read correctly: */ 536 if (ok) 535 537 { 538 /* If previous machine state is SAVED: */ 536 539 if (machine.GetState() == KMachineState_Saved) 537 540 { 538 /* restore from a saved state: restore window size and position*/541 /* Restore window size and position: */ 539 542 m_normalGeometry = QRect(x, y, w, h); 540 543 setGeometry(m_normalGeometry); 541 544 } 545 /* If previous machine state is not SAVED: */ 542 546 else 543 547 { 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); 546 551 if (machineView()) 547 552 machineView()->normalizeGeometry(false /* adjust position? */); 548 549 553 } 550 551 554 /* Maximize if needed: */ 552 555 if (max) … … 558 561 if (machineView()) 559 562 machineView()->normalizeGeometry(true /* adjust position? */); 560 561 563 /* Move newly created window to the screen center: */ 562 564 m_normalGeometry = geometry(); … … 614 616 .arg(m_normalGeometry.width()).arg(m_normalGeometry.height()); 615 617 if (isMaximizedChecked()) 616 strWindowPosition += QString(",%1").arg(VBoxDefs::GUI_LastWindow Position_Max);617 QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(VBoxDefs::GUI_Last WindowPosition) :618 QString("%1%2").arg(VBoxDefs::GUI_Last WindowPosition).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); 619 621 machine.SetExtraData(strPositionAddress, strWindowPosition); 620 622 }
Note:
See TracChangeset
for help on using the changeset viewer.