Changeset 7335 in vbox
- Timestamp:
- Mar 6, 2008 5:16:24 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r7323 r7335 285 285 CGImageRef mVirtualBoxLogo; 286 286 #endif 287 QSize mLastSizeHint; 287 288 }; 288 289 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
r7188 r7335 168 168 static const char* GUI_LastVMSelected; 169 169 static const char* GUI_InfoDlgState; 170 static const char* GUI_LastSizeHint; 170 171 }; 171 172 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r7322 r7335 2868 2868 break; 2869 2869 } 2870 case KMachineState_Stopping: 2871 { 2872 if (mLastSizeHint.isValid()) 2873 { 2874 CMachine cmachine = mConsole.GetMachine(); 2875 QString str = QString ("%1,%2") 2876 .arg (mLastSizeHint.width()) 2877 .arg (mLastSizeHint.height()); 2878 cmachine.SetExtraData (VBoxDefs::GUI_LastSizeHint, str); 2879 } 2880 } 2870 2881 default: 2871 2882 break; … … 3567 3578 3568 3579 mConsole.GetDisplay().SetVideoModeHint (sz.width(), sz.height(), 0, 0); 3580 mLastSizeHint = sz; 3569 3581 } 3570 3582 } … … 3577 3589 void VBoxConsoleView::sendInitialSizeHint(void) 3578 3590 { 3579 enum { NUM_RES = 4 }; 3580 3581 const int sizeList[NUM_RES][2] = 3582 { 3583 { 640, 480 }, 3584 { 800, 600 }, 3585 { 1024, 768 }, 3586 { 1280, 960 } 3587 }; 3588 /** @todo save the last resize hint sent before a VM shutdown in 3589 the XML and send that on next startup. */ 3591 CMachine cmachine = mConsole.GetMachine(); 3592 QString str = cmachine.GetExtraData (VBoxDefs::GUI_LastSizeHint); 3593 int w = 0, h = 0; 3594 bool ok = true; 3595 w = str.section (',', 0, 0).toInt (&ok); 3596 if (ok) 3597 h = str.section (',', 1, 1).toInt (&ok); 3590 3598 QRect screen = QApplication::desktop()->screenGeometry (this); 3591 unsigned i = 0; 3592 /* Find a size that is smaller than three quarters of the reported 3593 screen geometry. */ 3594 while ( (i + 1 < NUM_RES) 3595 && (sizeList[i + 1][0] < screen.width() * 3 / 4) 3596 && (sizeList[i + 1][1] < screen.height() * 3 / 4)) 3597 ++i; 3598 LogFlowFunc (("Will suggest %d x %d\n", sizeList[i][0], sizeList[i][1])); 3599 mConsole.GetDisplay().SetVideoModeHint (sizeList[i][0], sizeList[i][1], 0, 0); 3599 if (!ok || w > screen.width() || h > screen.height()) 3600 { 3601 enum { NUM_RES = 4 }; 3602 const int sizeList[NUM_RES][2] = 3603 { 3604 { 640, 480 }, 3605 { 800, 600 }, 3606 { 1024, 768 }, 3607 { 1280, 960 } 3608 }; 3609 unsigned i = 0; 3610 3611 /* Find a size that is smaller than three quarters of the reported 3612 screen geometry. */ 3613 while ( (i + 1 < NUM_RES) 3614 && (sizeList[i + 1][0] < screen.width() * 3 / 4) 3615 && (sizeList[i + 1][1] < screen.height() * 3 / 4)) 3616 ++i; 3617 w = sizeList[i][0]; 3618 h = sizeList[i][1]; 3619 } 3620 LogFlowFunc (("Will suggest %d x %d\n", w, h)); 3621 mConsole.GetDisplay().SetVideoModeHint (w, h, 0, 0); 3600 3622 } 3601 3623 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxDefs.cpp
r7188 r7335 36 36 const char* VBoxDefs::GUI_LastVMSelected = "GUI/LastVMSelected"; 37 37 const char* VBoxDefs::GUI_InfoDlgState = "GUI/InfoDlgState"; 38 const char* VBoxDefs::GUI_LastSizeHint = "GUI/LastSizeHint";
Note:
See TracChangeset
for help on using the changeset viewer.