Changeset 27296 in vbox
- Timestamp:
- Mar 11, 2010 5:09:17 PM (15 years ago)
- 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 28 28 const char* VBoxDefs::GUI_LastWindowPosition = "GUI/LastWindowPostion"; 29 29 const char* VBoxDefs::GUI_LastWindowPosition_Max = "max"; 30 const char* VBoxDefs::GUI_LastGuestSizeHint = "GUI/LastGuestSizeHint"; 30 31 const char* VBoxDefs::GUI_Fullscreen = "GUI/Fullscreen"; 31 32 const char* VBoxDefs::GUI_Seamless = "GUI/Seamless"; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
r27215 r27296 146 146 static const char* GUI_LastWindowPosition; 147 147 static const char* GUI_LastWindowPosition_Max; 148 static const char* GUI_LastGuestSizeHint; 148 149 static const char* GUI_Fullscreen; 149 150 static const char* GUI_Seamless; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r27237 r27296 310 310 } 311 311 312 QSize 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 312 347 void UIMachineView::setDesktopGeometry(DesktopGeo geometry, int aWidth, int aHeight) 313 348 { … … 340 375 { 341 376 m_storedConsoleSize = QSize(iWidth, iHeight); 377 } 378 379 void 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); 342 389 } 343 390 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r27237 r27296 114 114 DesktopGeo desktopGeometryType() const { return m_desktopGeometryType; } 115 115 QSize desktopGeometry() const; 116 QSize guestSizeHint(); 116 117 117 118 /* Protected setters: */ … … 119 120 void storeConsoleSize(int iWidth, int iHeight); 120 121 void setMachineWindowResizeIgnored(bool fIgnore = true) { m_bIsMachineWindowResizeIgnored = fIgnore; } 122 void storeGuestSizeHint(const QSize &sizeHint); 121 123 122 124 /* Protected helpers: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r27227 r27296 614 614 } 615 615 616 QSize UISession::guestSizeHint(ulong uScreenId) const617 {618 return (int)uScreenId < m_guestSizeHints.size() ? m_guestSizeHints[uScreenId] : QSize();619 }620 621 616 bool UISession::setPause(bool fOn) 622 617 { … … 641 636 642 637 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;649 638 } 650 639 … … 948 937 pGuestAutoresizeSwitch->setChecked(strSettings != "off"); 949 938 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);958 939 } 959 940 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r27227 r27296 83 83 QMenuBar* newMenuBar(); 84 84 QCursor cursor() const { return m_cursor; } 85 QSize guestSizeHint(ulong uScreenId) const;86 85 87 86 bool isSaved() const { return machineState() == KMachineState_Saved; } … … 125 124 bool setPause(bool fOn); 126 125 void setGuestResizeIgnored(bool fIsGuestResizeIgnored) { m_fIsGuestResizeIgnored = fIsGuestResizeIgnored; } 127 void setGuestSizeHint(ulong uScreenId, QSize size);128 126 129 127 /* Keyboard setters: */ … … 198 196 HCURSOR m_alphaCursor; 199 197 #endif 200 QList<QSize> m_guestSizeHints;201 198 202 199 /* Common flags: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
r27252 r27296 249 249 machineWindowWrapper()->machineWindow()->hide(); 250 250 UIMachineViewBlocker blocker(this); 251 sltPerformGuestResize( uisession()->guestSizeHint(screenId()));251 sltPerformGuestResize(guestSizeHint()); 252 252 blocker.exec(); 253 253 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
r27237 r27296 253 253 { 254 254 /* Store guest size hint: */ 255 uisession()->setGuestSizeHint(screenId(),QSize(frameBuffer()->width(), frameBuffer()->height()));255 storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height())); 256 256 } 257 257 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
r27252 r27296 268 268 machineWindowWrapper()->machineWindow()->hide(); 269 269 UIMachineViewBlocker blocker(this); 270 sltPerformGuestResize( uisession()->guestSizeHint(screenId()));270 sltPerformGuestResize(guestSizeHint()); 271 271 blocker.exec(); 272 272 }
Note:
See TracChangeset
for help on using the changeset viewer.