Changeset 5803 in vbox for trunk/src/VBox
- Timestamp:
- Nov 20, 2007 1:55:28 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r5759 r5803 208 208 QPoint captured_pos; 209 209 210 bool mDisableAutoCapture : 1; 211 210 212 enum { IsKeyPressed = 0x01, IsExtKeyPressed = 0x02, IsKbdCaptured = 0x80 }; 211 213 uint8_t mPressedKeys [128]; … … 214 216 bool mIsHostkeyPressed : 1; 215 217 bool mIsHostkeyAlone : 1; 218 216 219 /** kbd_captured value during the the last host key press or release */ 217 220 bool hostkey_in_capture : 1; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r5544 r5803 117 117 void updateAppearanceOf (int element); 118 118 119 voidtoggleFullscreenMode (bool, bool);119 bool toggleFullscreenMode (bool, bool); 120 120 121 121 private slots: -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
r5774 r5803 242 242 void cannotDownloadGuestAdditions (const QString &aURL, 243 243 const QString &aReason); 244 intconfirmDownloadAdditions (const QString &aURL, ulong aSize);245 intconfirmMountAdditions (const QString &aURL, const QString &aSrc);244 bool confirmDownloadAdditions (const QString &aURL, ulong aSize); 245 bool confirmMountAdditions (const QString &aURL, const QString &aSrc); 246 246 void warnAboutTooOldAdditions (QWidget *, const QString &, const QString &); 247 247 void warnAboutOldAdditions (QWidget *, const QString &, const QString &); … … 254 254 const QString &aResult); 255 255 256 bool remindAboutInputCapture();257 boolremindAboutAutoCapture();258 bool remindAboutMouseIntegration (bool supportsAbsolute);256 bool confirmInputCapture(); 257 void remindAboutAutoCapture(); 258 void remindAboutMouseIntegration (bool aSupportsAbsolute); 259 259 bool remindAboutPausedVMInput(); 260 260 261 261 bool remindAboutInaccessibleMedia(); 262 262 263 void remindAboutGoingFullscreen (const QString &hotKey, 264 const QString &hostKey); 265 void remindAboutGoingSeamless (const QString &hotKey, 266 const QString &hostKey); 263 bool confirmGoingFullscreen (const QString &aHotKey); 264 bool confirmGoingSeamless (const QString &aHotKey); 267 265 268 266 void remindAboutWrongColorDepth (ulong aRealBPP, ulong aWantedBPP); … … 273 271 bool confirmVMReset (QWidget *aParent); 274 272 275 int remindAboutUnsetHD(QWidget *aParent);273 bool confirmHardDisklessMachine (QWidget *aParent); 276 274 277 275 void cannotRunInSelectorMode(); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r5761 r5803 604 604 , mouse_absolute (false) 605 605 , mouse_integration (true) 606 , mDisableAutoCapture (false) 606 607 , mIsHostkeyPressed (false) 607 608 , mIsHostkeyAlone (false) … … 1935 1936 1936 1937 /** 1937 * Called on every focus change 1938 * and also to forcibly capture/uncapture the input in situations similar 1939 * to gaining or losing focus. 1938 * Called on every focus change and also to forcibly capture/uncapture the 1939 * input in situations similar to gaining or losing focus. 1940 1940 * 1941 1941 * @param aHasFocus True if the window got focus and false otherwise. … … 1946 1946 { 1947 1947 #ifdef RT_OS_WINDOWS 1948 if ( gs.autoCapture()1948 if ( !mDisableAutoCapture && gs.autoCapture() 1949 1949 && GetAncestor (winId(), GA_ROOT) == GetForegroundWindow()) 1950 1950 #else 1951 if ( gs.autoCapture())1951 if (!mDisableAutoCapture && gs.autoCapture()) 1952 1952 #endif /* RT_OS_WINDOWS */ 1953 1953 { … … 2212 2212 { 2213 2213 mIsHostkeyPressed = false; 2214 2214 2215 if (mIsHostkeyAlone) 2215 2216 { … … 2222 2223 { 2223 2224 bool captured = kbd_captured; 2225 bool ok = true; 2224 2226 if (!captured) 2225 vboxProblem().remindAboutInputCapture(); 2226 captureKbd (!captured, false); 2227 if (!(mouse_absolute && mouse_integration)) 2228 captureMouse (kbd_captured); 2227 { 2228 /* temporarily disable auto capture that will take 2229 * place after this dialog is dismissed because 2230 * the capture state is to be defined by the 2231 * dialog result itself */ 2232 mDisableAutoCapture = true; 2233 ok = vboxProblem().confirmInputCapture(); 2234 mDisableAutoCapture = false; 2235 } 2236 if (ok) 2237 { 2238 captureKbd (!captured, false); 2239 if (!(mouse_absolute && mouse_integration)) 2240 captureMouse (kbd_captured); 2241 } 2229 2242 } 2230 2243 } 2244 2231 2245 if (isRunning()) 2232 2246 sendChangedKeyStates(); 2247 2233 2248 emitSignal = true; 2234 2249 } … … 2552 2567 else if (isRunning()) 2553 2568 { 2554 vboxProblem().remindAboutInputCapture(); 2555 captureKbd (true); 2556 captureMouse (true); 2569 /* temporarily disable auto capture that will take 2570 * place after this dialog is dismissed because 2571 * the capture state is to be defined by the 2572 * dialog result itself */ 2573 mDisableAutoCapture = true; 2574 bool ok = vboxProblem().confirmInputCapture(); 2575 mDisableAutoCapture = false; 2576 if (ok) 2577 { 2578 captureKbd (true); 2579 captureMouse (true); 2580 } 2557 2581 } 2558 2582 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r5648 r5803 1902 1902 } 1903 1903 1904 void VBoxConsoleWnd::toggleFullscreenMode (bool aOn, bool aSeamless) 1904 /** 1905 * @return @c true if successfully performed the requested operation and false 1906 * otherwise. 1907 */ 1908 bool VBoxConsoleWnd::toggleFullscreenMode (bool aOn, bool aSeamless) 1905 1909 { 1906 1910 if (aSeamless) 1907 1911 { 1908 /* Check if it is necessary to enter/leave seamless mode. */ 1909 if (aOn && (!mIsSeamlessSupported || mIsFullscreen) || 1910 !aOn && !mIsSeamless) 1911 return; 1912 /* Check if it is necessary to enter/leave seamless mode. We assert 1913 * here because the corresponding actions must be properly disabled by 1914 * the below code to give the user an adequate feedback and prevent 1915 * from calling this method. */ 1916 AssertReturn (aOn && mIsSeamlessSupported && !mIsFullscreen || 1917 !aOn && mIsSeamless, 1918 false); 1912 1919 1913 1920 /* Check if the Guest Video RAM enough for the seamless mode. */ … … 1927 1934 screen.height(), QColor::numBitPlanes()); 1928 1935 vmSeamlessAction->setOn (false); 1929 return; 1930 } 1931 } 1932 1933 AssertReturnVoid (console); 1934 AssertReturnVoid ((hidden_children.isEmpty() == aOn)); 1935 if (aSeamless) 1936 AssertReturnVoid (mIsSeamless != aOn); 1937 else 1938 AssertReturnVoid (mIsFullscreen != aOn); 1936 return false; 1937 } 1938 } 1939 1940 AssertReturn (console, false); 1941 AssertReturn ((hidden_children.isEmpty() == aOn), false); 1942 AssertReturn (aSeamless && mIsSeamless != aOn || 1943 !aSeamless && mIsFullscreen != aOn, false); 1939 1944 1940 1945 if (aOn) … … 1945 1950 hotKey = QStringList::split ('\t', hotKey) [1]; 1946 1951 Assert (!hotKey.isEmpty()); 1947 /* Get the host key name. */ 1948 QString hostKey = QIHotKeyEdit::keyName (vboxGlobal().settings() 1949 .hostKey()); 1952 1950 1953 /* Show the info message. */ 1951 aSeamless ? vboxProblem().remindAboutGoingSeamless (hotKey, hostKey) : 1952 vboxProblem().remindAboutGoingFullscreen (hotKey, hostKey); 1954 bool ok = aSeamless ? 1955 vboxProblem().confirmGoingSeamless (hotKey) : 1956 vboxProblem().confirmGoingFullscreen (hotKey); 1957 if (!ok) 1958 return false; 1953 1959 } 1954 1960 … … 2109 2115 console->toggleFSMode(); 2110 2116 } 2117 2111 2118 if (wasHidden) 2112 2119 hide(); 2120 2121 return true; 2113 2122 } 2114 2123 … … 2119 2128 void VBoxConsoleWnd::vmFullscreen (bool aOn) 2120 2129 { 2121 toggleFullscreenMode (aOn, false); 2130 bool ok = toggleFullscreenMode (aOn, false /* aSeamless */); 2131 if (!ok) 2132 { 2133 /* on failure, restore the previous button state */ 2134 vmFullscreenAction->blockSignals (true); 2135 vmFullscreenAction->setOn (!aOn); 2136 vmFullscreenAction->blockSignals (false); 2137 } 2122 2138 } 2123 2139 2124 2140 void VBoxConsoleWnd::vmSeamless (bool aOn) 2125 2141 { 2126 toggleFullscreenMode (aOn, true); 2142 bool ok = toggleFullscreenMode (aOn, true /* aSeamless */); 2143 if (!ok) 2144 { 2145 /* on failure, restore the previous button state */ 2146 vmSeamlessAction->blockSignals (true); 2147 vmSeamlessAction->setOn (!aOn); 2148 vmSeamlessAction->blockSignals (false); 2149 } 2127 2150 } 2128 2151 … … 3074 3097 * at the point of code where it is not expected at all (example: 3075 3098 * VBoxConsoleView::mouseEvent() calling 3076 * VBoxProblemReporter:: remindAboutInputCapture()). Instead, an attempt to3099 * VBoxProblemReporter::confirmInputCapture()). Instead, an attempt to 3077 3100 * close the current modal widget is done and tryClose() is rescheduled for 3078 3101 * later execution using a single-shot zero timer. -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxDownloaderWgt.cpp
r5154 r5803 249 249 // emit a signal when it is done saving the downloaded file 250 250 // (succeeded or failed). 251 i nt rc = vboxProblem().confirmMountAdditions (mUrl.toString(),252 QDir::convertSeparators (mTarget));253 if (rc == QIMessageBox::Yes)251 if (vboxProblem() 252 .confirmMountAdditions (mUrl.toString(), 253 QDir::convertSeparators (mTarget))) 254 254 vboxGlobal().consoleWnd().installGuestAdditionsFrom (mTarget); 255 255 QTimer::singleShot (0, this, SLOT (suicide())); … … 350 350 351 351 /* Ask user about GA image downloading */ 352 int rc = vboxProblem().confirmDownloadAdditions (mUrl.toString(), aSize); 353 if (rc == QIMessageBox::Yes) 352 if (vboxProblem().confirmDownloadAdditions (mUrl.toString(), aSize)) 354 353 { 355 354 mIsChecking = false; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r5802 r5803 24 24 25 25 #include "VBoxAboutDlg.h" 26 27 #include "QIHotKeyEdit.h" 26 28 27 29 #include <qmessagebox.h> … … 1339 1341 } 1340 1342 1341 intVBoxProblemReporter::confirmDownloadAdditions (const QString &aURL,1343 bool VBoxProblemReporter::confirmDownloadAdditions (const QString &aURL, 1342 1344 ulong aSize) 1343 1345 { … … 1351 1353 } 1352 1354 1353 intVBoxProblemReporter::confirmMountAdditions (const QString &aURL,1355 bool VBoxProblemReporter::confirmMountAdditions (const QString &aURL, 1354 1356 const QString &aSrc) 1355 1357 { … … 1443 1445 } 1444 1446 1445 /** @return false if the dialog wasn't actually shown (i.e. it was autoconfirmed) */ 1446 bool VBoxProblemReporter::remindAboutInputCapture() 1447 { 1448 int rc = message (&vboxGlobal().consoleWnd(), Info, 1447 /** 1448 * @return @c true if the user has confirmed input capture (this is always 1449 * the case if the dialog was autoconfirmed). 1450 */ 1451 bool VBoxProblemReporter::confirmInputCapture() 1452 { 1453 return messageOkCancel (&vboxGlobal().consoleWnd(), Info, 1449 1454 tr ("<p>You have <b>clicked the mouse</b> inside the Virtual Machine display " 1450 1455 "or pressed the <b>host key</b>. This will cause the Virtual Machine to " … … 1461 1466 "with the mouse icon placed nearby, indicate the current keyboard " 1462 1467 "and mouse capture state." 1463 "</p>"), 1464 "remindAboutInputCapture"); 1465 1466 return !(rc & AutoConfirmed); 1467 } 1468 1469 /** @return false if the dialog wasn't actually shown (i.e. it was autoconfirmed) */ 1470 bool VBoxProblemReporter::remindAboutAutoCapture() 1471 { 1472 int rc = message ( &vboxGlobal().consoleWnd(), Info, 1468 "</p>") + 1469 tr ("<p>The host key is currently defined as <b>%1</b>.</p>", 1470 "additional message box paragraph") 1471 .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())), 1472 "confirmInputCapture", 1473 tr ("Capture", "do input capture")); 1474 } 1475 1476 void VBoxProblemReporter::remindAboutAutoCapture() 1477 { 1478 message (&vboxGlobal().consoleWnd(), Info, 1473 1479 tr ("<p>You have the <b>Auto capture keyboard</b> option turned on. " 1474 1480 "This will cause the Virtual Machine to automatically <b>capture</b> " … … 1485 1491 "with the mouse icon placed nearby, indicate the current keyboard " 1486 1492 "and mouse capture state." 1487 "</p>"), 1493 "</p>") + 1494 tr ("<p>The host key is currently defined as <b>%1</b>.</p>", 1495 "additional message box paragraph") 1496 .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())), 1488 1497 "remindAboutAutoCapture"); 1489 1490 return !(rc & AutoConfirmed); 1491 } 1492 1493 /** @return false if the dialog wasn't actually shown (i.e. it was autoconfirmed) */ 1494 bool VBoxProblemReporter::remindAboutMouseIntegration (bool supportsAbsolute) 1498 } 1499 1500 void VBoxProblemReporter::remindAboutMouseIntegration (bool aSupportsAbsolute) 1495 1501 { 1496 1502 static const char *kNames [2] = … … 1504 1510 { 1505 1511 QWidget *outdated = 1506 VBoxGlobal::findWidget (NULL, kNames [int (! supportsAbsolute)],1512 VBoxGlobal::findWidget (NULL, kNames [int (!aSupportsAbsolute)], 1507 1513 "QIMessageBox"); 1508 1514 if (outdated) … … 1510 1516 } 1511 1517 1512 if ( supportsAbsolute)1513 { 1514 int rc =message (&vboxGlobal().consoleWnd(), Info,1518 if (aSupportsAbsolute) 1519 { 1520 message (&vboxGlobal().consoleWnd(), Info, 1515 1521 tr ("<p>The Virtual Machine reports that the guest OS supports " 1516 1522 "<b>mouse pointer integration</b>. This means that you do not " … … 1533 1539 "</p>"), 1534 1540 kNames [1] /* aAutoConfirmId */); 1535 1536 return !(rc & AutoConfirmed);1537 1541 } 1538 1542 else 1539 1543 { 1540 int rc =message (&vboxGlobal().consoleWnd(), Info,1544 message (&vboxGlobal().consoleWnd(), Info, 1541 1545 tr ("<p>The Virtual Machine reports that the guest OS does not " 1542 1546 "support <b>mouse pointer integration</b> in the current video " … … 1545 1549 "mouse inside the guest OS.</p>"), 1546 1550 kNames [0] /* aAutoConfirmId */); 1547 1548 return !(rc & AutoConfirmed); 1549 } 1550 } 1551 1552 /** @return false if the dialog wasn't actually shown (i.e. it was autoconfirmed) */ 1551 } 1552 } 1553 1554 /** 1555 * @return @c false if the dialog wasn't actually shown (i.e. it was 1556 * autoconfirmed). 1557 */ 1553 1558 bool VBoxProblemReporter::remindAboutPausedVMInput() 1554 1559 { … … 1589 1594 1590 1595 /** 1591 * @param fullscreen hot key as defined in the menu 1592 * @param current host key as in the global settings 1593 * @return true if the user has chosen to go fullscreen. 1596 * @param aHotKey Fullscreen hot key as defined in the menu. 1597 * 1598 * @return @c true if the user has chosen to go fullscreen (this is always 1599 * the case if the dialog was autoconfirmed). 1594 1600 */ 1595 void VBoxProblemReporter::remindAboutGoingFullscreen (const QString &hotKey, 1596 const QString &hostKey) 1597 { 1598 int rc = message (&vboxGlobal().consoleWnd(), Info, 1601 bool VBoxProblemReporter::confirmGoingFullscreen (const QString &aHotKey) 1602 { 1603 return messageOkCancel (&vboxGlobal().consoleWnd(), Info, 1599 1604 tr ("<p>The virtual machine window will be now switched to " 1600 1605 "<b>fullscreen</b> mode. " … … 1604 1609 "<p>Note that the main menu bar is hidden in fullscreen mode. You " 1605 1610 "can access it by pressing <b>Host+Home</b>.</p>") 1606 .arg (hotKey).arg (hostKey), 1607 "remindAboutGoingFullscreen"); 1608 NOREF(rc); 1611 .arg (aHotKey) 1612 .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())), 1613 "confirmGoingFullscreen", 1614 tr ("Switch", "fullscreen")); 1609 1615 } 1610 1616 1611 1617 /** 1612 * @param fullscreen hot key as defined in the menu 1613 * @param current host key as in the global settings 1614 * @return true if the user has chosen to go fullscreen. 1618 * @param aHotKey Seamless hot key as defined in the menu. 1619 * 1620 * @return @c true if the user has chosen to go seamless (this is always 1621 * the case if the dialog was autoconfirmed). 1615 1622 */ 1616 void VBoxProblemReporter::remindAboutGoingSeamless (const QString &hotKey, 1617 const QString &hostKey) 1618 { 1619 int rc = message (&vboxGlobal().consoleWnd(), Info, 1623 bool VBoxProblemReporter::confirmGoingSeamless (const QString &aHotKey) 1624 { 1625 return messageOkCancel (&vboxGlobal().consoleWnd(), Info, 1620 1626 tr ("<p>The virtual machine window will be now switched to " 1621 1627 "<b>Seamless</b> mode. " … … 1625 1631 "<p>Note that the main menu bar is hidden in seamless mode. You " 1626 1632 "can access it by pressing <b>Host+Home</b>.</p>") 1627 .arg (hotKey).arg (hostKey), 1628 "remindAboutGoingSeamless"); 1629 NOREF(rc); 1633 .arg (aHotKey) 1634 .arg (QIHotKeyEdit::keyName (vboxGlobal().settings().hostKey())), 1635 "confirmGoingSeamless", 1636 tr ("Switch", "seamless")); 1630 1637 } 1631 1638 … … 1698 1705 1699 1706 /** 1700 * Returns@c true if the user has selected to reset the machine.1707 * @return @c true if the user has selected to reset the machine. 1701 1708 */ 1702 1709 bool VBoxProblemReporter::confirmVMReset (QWidget *aParent) … … 1710 1717 } 1711 1718 1712 int VBoxProblemReporter::remindAboutUnsetHD (QWidget *aParent) 1719 /** 1720 * @return @c true if the user has selected to continue without attaching a 1721 * hard disk. 1722 */ 1723 bool VBoxProblemReporter::confirmHardDisklessMachine (QWidget *aParent) 1713 1724 { 1714 1725 return message (aParent, Warning, … … 1719 1730 "Run Wizard.</p><p>Do you want to continue?</p>"), 1720 1731 0, /* aAutoConfirmId */ 1721 QIMessageBox::Yes, 1722 QIMessageBox::No | QIMessageBox::Default | QIMessageBox::Escape); 1732 QIMessageBox::Ok, 1733 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape, 1734 0, 1735 tr ("Continue", "no hard disk attached"), 1736 tr ("Go Back", "no hard disk attached")) == QIMessageBox::Ok; 1723 1737 } 1724 1738 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui.h
r5292 r5803 241 241 if (!mediaCombo->currentItem()) 242 242 { 243 int result = vboxProblem().remindAboutUnsetHD (this); 244 if (result == QIMessageBox::No) 243 if (!vboxProblem().confirmHardDisklessMachine (this)) 245 244 return; 246 245 }
Note:
See TracChangeset
for help on using the changeset viewer.