- Timestamp:
- May 21, 2007 2:41:11 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 21337
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r2700 r2736 49 49 class QMenuData; 50 50 51 /** Auto-resize event.52 * Useful for posting into events queue to be processed just after all53 * QEvent::Resize & QEvent::WindowStateChange events currently posted.54 * This is necessary due to these two events - QEvent::Resize &55 * QEvent::WindowStateChange are processed in different sequence56 * under Win32 and X11. */57 class AutoResizeEvent : public QEvent58 {59 public:60 AutoResizeEvent () :61 QEvent ((QEvent::Type) VBoxDefs::AutoResizeEventType) {}62 };63 64 51 class VBoxConsoleView : public QScrollView 65 52 { … … 183 170 static void dimImage (QImage &img); 184 171 185 void performAutoResize();186 187 172 private slots: 173 174 void exitFullScreen(); 188 175 189 176 void doResizeHint(); … … 218 205 219 206 bool ignore_mainwnd_resize : 1; 220 bool autoresize_guest : 1; 207 bool mAutoresizeGuest : 1; 208 209 bool mIsAdditionsActive; 221 210 222 211 bool mfNumLock : 1; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r2700 r2736 249 249 CSession csession; 250 250 251 bool mIsAutoresizeEnabled;252 253 251 // widgets 254 252 VBoxConsoleView *console; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
r2700 r2736 129 129 MachineStateChangeEventType, 130 130 AdditionsStateChangeEventType, 131 AutoResizeEventType,132 131 MachineDataChangeEventType, 133 132 MachineRegisteredEventType, -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
r2671 r2736 200 200 bool confirmReleaseImage (QWidget*, QString); 201 201 202 void warnAboutOldAdditions (QWidget*, const QString &); 203 void warnAboutNewAdditions (QWidget*, const QString &); 204 202 205 bool remindAboutInputCapture(); 203 206 bool remindAboutAutoCapture(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r2722 r2736 458 458 , hostkey_alone (false) 459 459 , ignore_mainwnd_resize (false) 460 , autoresize_guest (false) 460 , mAutoresizeGuest (false) 461 , mIsAdditionsActive (false) 461 462 , mfNumLock (false) 462 463 , mfScrollLock (false) … … 769 770 void VBoxConsoleView::setAutoresizeGuest (bool on) 770 771 { 771 if (autoresize_guest != on) 772 { 773 autoresize_guest = on; 774 775 if (on) 776 { 777 if (mode == VBoxDefs::SDLMode) 772 if (mAutoresizeGuest != on) 773 { 774 mAutoresizeGuest = on; 775 776 if (mode == VBoxDefs::SDLMode) 777 { 778 /* restrict minimum size because we cannot correctly draw 779 * in a scrolled window using SDL */ 780 if (!mAutoresizeGuest) 781 setMinimumSize (sizeHint()); 782 else 778 783 setMinimumSize (0, 0); 779 784 } 785 786 if (mIsAdditionsActive && mAutoresizeGuest) 780 787 doResizeHint(); 781 }782 else783 {784 /* restrict minimum size because we cannot correctly draw in a785 * scrolled window using SDL */786 if (mode == VBoxDefs::SDLMode)787 setMinimumSize (sizeHint());788 }789 788 } 790 789 } … … 848 847 /* restrict minimum size because we cannot correctly draw 849 848 * in a scrolled window using SDL */ 850 if (! autoresize_guest)849 if (!mAutoresizeGuest) 851 850 setMinimumSize (sizeHint()); 852 851 else … … 938 937 GuestAdditionsEvent *ge = (GuestAdditionsEvent *) e; 939 938 LogFlowFunc (("AdditionsStateChangeEventType\n")); 939 mIsAdditionsActive = ge->additionActive(); 940 940 emit additionsStateChanged (ge->additionVersion(), ge->additionActive()); 941 941 return true; … … 1031 1031 } 1032 1032 1033 case VBoxDefs::AutoResizeEventType:1034 {1035 performAutoResize();1036 return true;1037 }1038 1039 1033 default: 1040 1034 break; … … 1136 1130 if (!ignore_mainwnd_resize) 1137 1131 { 1138 if ( autoresize_guest)1132 if (mIsAdditionsActive && mAutoresizeGuest) 1139 1133 resize_hint_timer->start (300, TRUE); 1140 1134 /* During window maximization WindowStateChange event is … … 1155 1149 !mainwnd->isMaximized() && 1156 1150 !mainwnd->isTrueFullscreen()) 1157 Q Application::postEvent (this, new AutoResizeEvent ());1151 QTimer::singleShot (0, this, SLOT (exitFullScreen())); 1158 1152 } 1159 1153 … … 1705 1699 } 1706 1700 1707 void VBoxConsoleView::performAutoResize() 1708 { 1709 if (autoresize_guest) 1701 /** 1702 * Called on every exit from fullscreen and maximized mode. 1703 */ 1704 void VBoxConsoleView::exitFullScreen() 1705 { 1706 if (mIsAdditionsActive && mAutoresizeGuest) 1710 1707 { 1711 1708 doResizeHint(); … … 2878 2875 void VBoxConsoleView::doResizeHint() 2879 2876 { 2880 if ( autoresize_guest)2877 if (mIsAdditionsActive && mAutoresizeGuest) 2881 2878 { 2882 2879 /* Get the available size for the guest display. -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r2703 r2736 216 216 , dbgMenu (NULL) 217 217 #endif 218 , mIsAutoresizeEnabled (false)219 218 , console (0) 220 219 , mUsbLedTip (0) … … 726 725 str = cmachine.GetExtraData (GUI_AutoresizeGuest); 727 726 if (str != "off") 728 mIsAutoresizeEnabled = true;727 vmAutoresizeGuestAction->setOn (true); 729 728 730 729 str = cmachine.GetExtraData (GUI_LastWindowPosition); … … 1711 1710 bool wasHidden = isHidden(); 1712 1711 1712 static QSize prevMinimumSize; 1713 1713 if (on) 1714 1714 { 1715 /* Save previous scroll-view minimum size before entering fullscreen 1716 * state to make return to this minimum size before the exiting 1717 * fullscreen. Required for correct scroll-view update in SDL mode. */ 1718 prevMinimumSize = console->minimumSize(); 1719 console->setMinimumSize (0, 0); 1720 1715 1721 /* memorize the maximized state */ 1716 1722 was_max = isMaximized(); … … 1760 1766 else 1761 1767 { 1768 /* Returns to previous scroll-view minimum size before the exiting 1769 * fullscreen. Required for correct scroll-view update in SDL mode. */ 1770 console->setMinimumSize (prevMinimumSize); 1771 1762 1772 /* hide early to avoid extra flicker */ 1763 1773 #ifdef Q_WS_MAC … … 1788 1798 if (was_max) 1789 1799 setWindowState (windowState() | WindowMaximized); 1790 Q Application::postEvent (console, new AutoResizeEvent());1800 QTimer::singleShot (0, console, SLOT (exitFullScreen())); 1791 1801 } 1792 1802 … … 2503 2513 void VBoxConsoleWnd::updateAdditionsState (const QString &aVersion, bool aActive) 2504 2514 { 2505 /* mIsAutoresizeEnabled flag stores the auto-resize status loaded from the2506 * settings and used for the activation of the autoresize feature2507 * if the additions state told us here it is activated. */2508 2515 vmAutoresizeGuestAction->setEnabled (aActive); 2509 vmAutoresizeGuestAction->setOn (aActive && mIsAutoresizeEnabled);2510 2516 2511 2517 /* Checking for the Guest Additions version to warn user about possible … … 2516 2522 2517 2523 if (RT_HIWORD (version) < RT_HIWORD (VMMDEV_VERSION)) 2518 vboxProblem().message (this, VBoxProblemReporter::Warning, 2519 tr ("<p>Your Guest Additions are outdated (current version: %1).</p>" 2520 "<p>You must update to the latest version by choosing Devices " 2521 "- Install Guest Additions.</p>").arg (fullVersion)); 2524 vboxProblem().warnAboutOldAdditions (this, fullVersion); 2522 2525 else if (RT_HIWORD (version) == RT_HIWORD (VMMDEV_VERSION) && 2523 2526 RT_LOWORD (version) < RT_LOWORD (VMMDEV_VERSION)) 2524 vboxProblem().message (this, VBoxProblemReporter::Warning, 2525 tr ("<p>Your Guest Additions are outdated (current version: %1).</p>" 2526 "<p>There is a newer Guest Additions version. You should update " 2527 "to the latest version by choosing Devices " 2528 "- Install Guest Additions.</p>").arg (fullVersion)); 2527 vboxProblem().warnAboutNewAdditions (this, fullVersion); 2529 2528 } 2530 2529 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r2671 r2736 37 37 #ifdef Q_WS_MAC 38 38 # include <qpushbutton.h> 39 #endif 39 #endif 40 40 41 41 #include <iprt/err.h> … … 1097 1097 } 1098 1098 1099 void VBoxProblemReporter::warnAboutOldAdditions (QWidget *aParent, 1100 const QString &aVersion) 1101 { 1102 message (aParent, VBoxProblemReporter::Warning, 1103 tr ("<p>Your Guest Additions are outdated (current version: %1).</p>" 1104 "<p>You must update to the latest version by choosing Devices " 1105 "- Install Guest Additions.</p>").arg (aVersion)); 1106 } 1107 1108 void VBoxProblemReporter::warnAboutNewAdditions (QWidget *aParent, 1109 const QString &aVersion) 1110 { 1111 message (aParent, VBoxProblemReporter::Warning, 1112 tr ("<p>Your Guest Additions are outdated (current version: %1).</p>" 1113 "<p>There is a newer Guest Additions version. You should update " 1114 "to the latest version by choosing Devices " 1115 "- Install Guest Additions.</p>").arg (aVersion)); 1116 } 1117 1099 1118 #if defined Q_WS_WIN 1100 1119
Note:
See TracChangeset
for help on using the changeset viewer.