- Timestamp:
- Jul 24, 2007 11:17:40 AM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r3736 r3807 210 210 bool hostkey_in_capture : 1; 211 211 212 bool ignore_mainwnd_resize : 1;212 bool mIgnoreMainwndResize : 1; 213 213 bool mAutoresizeGuest : 1; 214 214 … … 248 248 #endif 249 249 250 VBoxFrameBuffer * fb;251 CConsoleCallback callback;250 VBoxFrameBuffer *mFrameBuf; 251 CConsoleCallback mCallback; 252 252 253 253 friend class VBoxConsoleCallback; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h
r3718 r3807 54 54 // helpers 55 55 56 int message ( 57 QWidget *parent, Type type, const QString &msg, 58 const QString &details = QString::null, 59 const char *autoConfirmId = 0, 60 int b1 = 0, int b2 = 0, int b3 = 0, 61 const char *name = 0 62 ); 63 64 int message ( 65 QWidget *parent, Type type, const QString &msg, 66 const char *autoConfirmId, 67 int b1 = 0, int b2 = 0, int b3 = 0, 68 const char *name = 0 69 ) { 56 int message (QWidget *parent, Type type, const QString &msg, 57 const QString &details = QString::null, 58 const char *autoConfirmId = NULL, 59 int b1 = 0, int b2 = 0, int b3 = 0, 60 const char *name = 0); 61 62 int message (QWidget *parent, Type type, const QString &msg, 63 const char *autoConfirmId, 64 int b1 = 0, int b2 = 0, int b3 = 0, 65 const char *name = 0) 66 { 70 67 return message (parent, type, msg, QString::null, autoConfirmId, 71 68 b1, b2, b3, name); 72 69 } 73 70 74 bool messageYesNo ( 75 QWidget *parent, Type type, const QString &msg, 76 const QString &details = QString::null, 77 const char *autoConfirmId = 0, 78 const char *name = 0 79 ); 80 81 bool messageYesNo ( 82 QWidget *parent, Type type, const QString &msg, 83 const char *autoConfirmId, 84 const char *name = 0 85 ) { 71 bool messageYesNo (QWidget *parent, Type type, const QString &msg, 72 const QString &details = QString::null, 73 const char *autoConfirmId = 0, 74 const char *name = 0); 75 76 bool messageYesNo (QWidget *parent, Type type, const QString &msg, 77 const char *autoConfirmId, 78 const char *name = 0) 79 { 86 80 return messageYesNo (parent, type, msg, QString::null, autoConfirmId, name); 87 81 } 88 82 89 bool showModalProgressDialog ( 90 CProgress &aProgress, const QString &aTitle, QWidget *aParent, 91 int aMinDuration = 2000 92 ); 83 bool showModalProgressDialog (CProgress &aProgress, const QString &aTitle, 84 QWidget *aParent, int aMinDuration = 2000); 93 85 94 86 QWidget *mainWindowShown(); … … 219 211 const QString &hostKey); 220 212 213 void remindAboutWrongColorDepth (ulong aRealBPP, ulong aWantedBPP); 214 221 215 void cannotRunInSelectorMode(); 222 216 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r3767 r3807 518 518 , hostkey_pressed (false) 519 519 , hostkey_alone (false) 520 , ignore_mainwnd_resize (true)520 , mIgnoreMainwndResize (true) 521 521 , mAutoresizeGuest (false) 522 522 , mIsAdditionsActive (false) … … 576 576 tid = 0; 577 577 #endif 578 fb= 0;578 mFrameBuf = 0; 579 579 580 580 LogFlowFunc (("Rendering mode: %d\n", mode)); … … 590 590 #if defined (VBOX_GUI_USE_QIMAGE) 591 591 case VBoxDefs::QImageMode: 592 fb= new VBoxQImageFrameBuffer (this);592 mFrameBuf = new VBoxQImageFrameBuffer (this); 593 593 break; 594 594 #endif 595 595 #if defined (VBOX_GUI_USE_SDL) 596 596 case VBoxDefs::SDLMode: 597 fb= new VBoxSDLFrameBuffer (this);597 mFrameBuf = new VBoxSDLFrameBuffer (this); 598 598 /* 599 599 * disable scrollbars because we cannot correctly draw in a … … 606 606 #if defined (VBOX_GUI_USE_DDRAW) 607 607 case VBoxDefs::DDRAWMode: 608 fb= new VBoxDDRAWFrameBuffer (this);608 mFrameBuf = new VBoxDDRAWFrameBuffer (this); 609 609 break; 610 610 #endif … … 617 617 618 618 #if defined (VBOX_GUI_USE_DDRAW) 619 if (! fb || fb->address () == NULL)620 { 621 if ( fb)622 delete fb;619 if (!mFrameBuf || mFrameBuf->address () == NULL) 620 { 621 if (mFrameBuf) 622 delete mFrameBuf; 623 623 mode = VBoxDefs::QImageMode; 624 fb= new VBoxQImageFrameBuffer (this);625 } 626 #endif 627 628 if ( fb)629 { 630 fb->AddRef();631 display.RegisterExternalFramebuffer (CFramebuffer ( fb));624 mFrameBuf = new VBoxQImageFrameBuffer (this); 625 } 626 #endif 627 628 if (mFrameBuf) 629 { 630 mFrameBuf->AddRef(); 631 display.RegisterExternalFramebuffer (CFramebuffer (mFrameBuf)); 632 632 } 633 633 634 634 /* setup the callback */ 635 callback = CConsoleCallback (new VBoxConsoleCallback (this));636 cconsole.RegisterCallback ( callback);635 mCallback = CConsoleCallback (new VBoxConsoleCallback (this)); 636 cconsole.RegisterCallback (mCallback); 637 637 AssertWrapperOk (cconsole); 638 638 … … 671 671 killTimer (tid); 672 672 #endif 673 if ( fb)673 if (mFrameBuf) 674 674 { 675 675 /* detach our framebuffer from Display */ … … 678 678 display.SetupInternalFramebuffer (0); 679 679 /* release the reference */ 680 fb->Release();681 } 682 683 cconsole.UnregisterCallback ( callback);680 mFrameBuf->Release(); 681 } 682 683 cconsole.UnregisterCallback (mCallback); 684 684 } 685 685 … … 700 700 #endif 701 701 { 702 return QSize ( fb->width() + frameWidth() * 2,703 fb->height() + frameWidth() * 2);702 return QSize (mFrameBuf->width() + frameWidth() * 2, 703 mFrameBuf->height() + frameWidth() * 2); 704 704 } 705 705 } … … 874 874 void VBoxConsoleView::onViewOpened() 875 875 { 876 /* Variable <ignore_mainwnd_resize> is initially "true" to ignore QT876 /* Variable mIgnoreMainwndResize was initially "true" to ignore QT 877 877 * initial resize event in case of auto-resize feature is on. 878 * Currently initial resize event is already processed, so switching879 * the ignore_mainwnd_resize to "false" to process all further resize880 * events as user resize events. */881 ignore_mainwnd_resize = false;878 * Currently, initial resize event is already processed, so we set 879 * mIgnoreMainwndResize to "false" to process all further resize 880 * events as user-initiated window resize events. */ 881 mIgnoreMainwndResize = false; 882 882 } 883 883 … … 906 906 case VBoxDefs::ResizeEventType: 907 907 { 908 bool old _ignore_mainwnd_resize = ignore_mainwnd_resize;909 ignore_mainwnd_resize = true;908 bool oldIgnoreMainwndResize = mIgnoreMainwndResize; 909 mIgnoreMainwndResize = true; 910 910 911 911 VBoxResizeEvent *re = (VBoxResizeEvent *) e; 912 LogFlow (("VBoxDefs::ResizeEventType: %d ,%d\n",913 re->width(), re->height() ));912 LogFlow (("VBoxDefs::ResizeEventType: %d x %d x %d bpp\n", 913 re->width(), re->height(), re->bitsPerPixel())); 914 914 915 915 /* do frame buffer dependent resize */ 916 fb->resizeEvent (re);916 mFrameBuf->resizeEvent (re); 917 917 viewport()->unsetCursor(); 918 918 … … 947 947 cconsole.GetDisplay().ResizeCompleted(0); 948 948 949 ignore_mainwnd_resize = old_ignore_mainwnd_resize;949 mIgnoreMainwndResize = oldIgnoreMainwndResize; 950 950 951 951 return true; … … 1235 1235 * in order to possibly adjust the direct screen blitting. 1236 1236 */ 1237 if ( fb)1238 fb->moveEvent( (QMoveEvent *) e);1237 if (mFrameBuf) 1238 mFrameBuf->moveEvent ((QMoveEvent *) e); 1239 1239 break; 1240 1240 } … … 1276 1276 case QEvent::Resize: 1277 1277 { 1278 if (! ignore_mainwnd_resize)1278 if (!mIgnoreMainwndResize) 1279 1279 { 1280 1280 if (mIsAdditionsActive && mAutoresizeGuest) 1281 1281 resize_hint_timer->start (300, TRUE); 1282 /// @todo disabled for the time being since seems to be not 1283 // necessary anymore 1284 #if 0 1282 1285 /* During window maximization WindowStateChange event is 1283 * processed before Resize event, so the ignore_mainwnd_resize1286 * processed before Resize event, so the mIgnoreMainwndResize 1284 1287 * variable should be set to true here in case of mainwnd is 1285 1288 * maximized or in fullscreen state. */ 1286 1289 /* Not sure if it is really required */ 1287 //if (mainwnd->isMaximized() || mainwnd->isTrueFullscreen() 1288 // || mainwnd->isTrueSeamless()) 1289 // ignore_mainwnd_resize = true; 1290 if (mainwnd->isMaximized() || mainwnd->isTrueFullscreen() 1291 || mainwnd->isTrueSeamless()) 1292 mIgnoreMainwndResize = true; 1293 #endif 1290 1294 } 1291 1295 break; … … 1868 1872 } 1869 1873 1870 ignore_mainwnd_resize = false;1874 mIgnoreMainwndResize = false; 1871 1875 } 1872 1876 … … 2348 2352 case CEnums::Paused: 2349 2353 { 2350 if (mode != VBoxDefs::TimerMode && fb)2354 if (mode != VBoxDefs::TimerMode && mFrameBuf) 2351 2355 { 2352 2356 /* … … 2354 2358 * needs a 32bpp image 2355 2359 */ 2356 QImage shot = QImage ( fb->width(), fb->height(), 32, 0);2360 QImage shot = QImage (mFrameBuf->width(), mFrameBuf->height(), 32, 0); 2357 2361 CDisplay dsp = cconsole.GetDisplay(); 2358 2362 dsp.TakeScreenShot (shot.bits(), shot.width(), shot.height()); … … 2379 2383 if (last_state == CEnums::Paused) 2380 2384 { 2381 if (mode != VBoxDefs::TimerMode && fb)2385 if (mode != VBoxDefs::TimerMode && mFrameBuf) 2382 2386 { 2383 2387 /* reset the pixmap to free memory */ … … 2459 2463 { 2460 2464 /* delegate the paint function to the VBoxFrameBuffer interface */ 2461 fb->paintEvent (pe);2465 mFrameBuf->paintEvent (pe); 2462 2466 return; 2463 2467 } … … 3052 3056 QSize sz (mainwnd->centralWidget()->size()); 3053 3057 sz -= QSize (frameWidth() * 2, frameWidth() * 2); 3054 LogFlowFunc (("Will suggest %d ,%d\n", sz.width(), sz.height()));3058 LogFlowFunc (("Will suggest %d x %d\n", sz.width(), sz.height())); 3055 3059 3056 3060 cconsole.GetDisplay().SetVideoModeHint (sz.width(), sz.height(), 0, 0); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.cpp
r3763 r3807 24 24 25 25 #include "VBoxConsoleView.h" 26 #include "VBoxProblemReporter.h" 27 #include "VBoxGlobal.h" 26 28 27 29 #include <qapplication.h> … … 375 377 mHgt = re->height(); 376 378 379 bool remind = false; 377 380 bool fallback = false; 378 381 … … 382 385 switch (re->bitsPerPixel()) 383 386 { 387 /* 32-, 8- and 1-bpp are the only depths suported by QImage */ 384 388 case 32: 385 case 24: 386 case 16: 389 break; 390 case 8: 391 case 1: 392 remind = true; 387 393 break; 388 394 default: 395 remind = true; 389 396 fallback = true; 390 397 break; … … 397 404 ((mWdt * re->bitsPerPixel() + 31) / 32) * 4; 398 405 Assert (!fallback); 399 400 406 if (!fallback) 401 407 { 402 408 mImg = QImage ((uchar *) re->VRAM(), mWdt, mHgt, 403 409 re->bitsPerPixel(), NULL, 0, QImage::LittleEndian); 404 mPixelFormat = re->pixelFormat();410 mPixelFormat = FramebufferPixelFormat_FOURCC_RGB; 405 411 mUsesGuestVRAM = true; 406 412 } … … 419 425 mPixelFormat = FramebufferPixelFormat_FOURCC_RGB; 420 426 mUsesGuestVRAM = false; 427 } 428 429 if (remind) 430 { 431 class RemindEvent : public VBoxAsyncEvent 432 { 433 ulong mRealBPP; 434 public: 435 RemindEvent (ulong aRealBPP) 436 : mRealBPP (aRealBPP) {} 437 void handle() 438 { 439 vboxProblem().remindAboutWrongColorDepth (mRealBPP, 32); 440 } 441 }; 442 (new RemindEvent (re->bitsPerPixel()))->post(); 421 443 } 422 444 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r3802 r3807 267 267 * third button code or 0, see QIMessageBox 268 268 * @param name 269 * name of the underlying QIMessageBox object. If null, a value of269 * name of the underlying QIMessageBox object. If NULL, a value of 270 270 * autoConfirmId is used. 271 271 * … … 273 273 * code of the button pressed by the user 274 274 */ 275 int VBoxProblemReporter::message ( 276 QWidget *parent, Type type, const QString &msg, 277 const QString &details, 278 const char *autoConfirmId, 279 int b1, int b2, int b3, 280 const char *name 281 ) { 275 int VBoxProblemReporter::message (QWidget *parent, Type type, const QString &msg, 276 const QString &details, 277 const char *autoConfirmId, 278 int b1, int b2, int b3, 279 const char *name) 280 { 282 281 if (b1 == 0 && b2 == 0 && b3 == 0) 283 282 b1 = QIMessageBox::Ok | QIMessageBox::Default; … … 1353 1352 bool VBoxProblemReporter::remindAboutMouseIntegration (bool supportsAbsolute) 1354 1353 { 1355 static const char * names [2] =1354 static const char *kNames [2] = 1356 1355 { 1357 1356 "remindAboutMouseIntegrationOff", … … 1359 1358 }; 1360 1359 1361 /* close the previous reminder if it is still active -- already outdated 1362 * (the name of the modal window will correspond to autoConfirmId if 1363 * it is our reminder) */ 1364 QWidget *modal = QApplication::activeModalWidget(); 1365 if (modal && !strcmp (modal->name(), names [int (!supportsAbsolute)])) 1366 modal->close(); 1360 /* Close the previous (outdated) window if any. We use kName as 1361 * autoConfirmId which is also used as the widget name by default. */ 1362 { 1363 QWidget *outdated = 1364 VBoxGlobal::findWidget (NULL, kNames [int (!supportsAbsolute)], 1365 "QIMessageBox"); 1366 if (outdated) 1367 outdated->close(); 1368 } 1367 1369 1368 1370 if (supportsAbsolute) … … 1388 1390 "corresponding action from the menu bar." 1389 1391 "</p>"), 1390 names [1] /* autoConfirmId */);1392 kNames [1] /* autoConfirmId */); 1391 1393 1392 1394 return !(rc & AutoConfirmed); … … 1400 1402 "display or pressing the host key) in order to use the " 1401 1403 "mouse inside the guest OS.</p>"), 1402 names [0] /* autoConfirmId */);1404 kNames [0] /* autoConfirmId */); 1403 1405 1404 1406 return !(rc & AutoConfirmed); … … 1483 1485 .arg (hotKey).arg (hostKey), 1484 1486 "remindAboutGoingSeamless"); 1487 NOREF(rc); 1488 } 1489 1490 void VBoxProblemReporter::remindAboutWrongColorDepth (ulong aRealBPP, 1491 ulong aWantedBPP) 1492 { 1493 const char *kName = "remindAboutWrongColorDepth"; 1494 1495 /* Close the previous (outdated) window if any. We use kName as 1496 * autoConfirmId which is also used as the widget name by default. */ 1497 { 1498 QWidget *outdated = VBoxGlobal::findWidget (NULL, kName, "QIMessageBox"); 1499 if (outdated) 1500 outdated->close(); 1501 } 1502 1503 int rc = message (&vboxGlobal().consoleWnd(), Info, 1504 tr ("<p>The virtual machine window is optimized to work in " 1505 "<b>%1 bit</b> color mode but the color quality of the " 1506 "virtual display is currently set to <b>%2 bit</b>.</p>" 1507 "<p>Please open the display properties dialog of the guest OS and " 1508 "select a <b>%3 bit</b> color mode to gain maximum " 1509 "performance of the virtual video subsystem.</p>") 1510 .arg (aWantedBPP).arg (aRealBPP).arg (aWantedBPP), 1511 kName); 1485 1512 NOREF(rc); 1486 1513 }
Note:
See TracChangeset
for help on using the changeset viewer.