Changeset 26773 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 25, 2010 1:53:19 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 58030
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIStateIndicator.h
r26758 r26773 49 49 public slots: 50 50 51 v oid setState (int aState);52 v oid setState (bool aState) { setState ((int) aState); }51 virtual void setState (int aState); 52 virtual void setState (bool aState) { setState ((int) aState); } 53 53 54 54 signals: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r26758 r26773 26 26 #include "VBoxGlobal.h" 27 27 #include "COMDefs.h" 28 #include "UIMachineDefs.h" 28 29 #include "QIWithRetranslateUI.h" 29 30 … … 551 552 } 552 553 554 public slots: 555 556 void setState(int iState) 557 { 558 if ((iState & UIMouseStateType_MouseAbsoluteDisabled) && 559 (iState & UIMouseStateType_MouseAbsolute) && 560 !(iState & UIMouseStateType_MouseCaptured)) 561 { 562 QIStateIndicator::setState(4); 563 } 564 else 565 { 566 QIStateIndicator::setState(iState & (UIMouseStateType_MouseAbsolute | UIMouseStateType_MouseCaptured)); 567 } 568 } 569 553 570 protected: 554 571 /* For compatibility reason we do it here, later this should be moved to -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r26754 r26773 243 243 }; 244 244 245 #if 0 245 #if 0 // TODO: Rework additions downloader logic! 246 246 class UIAdditionsDownloader : public VBoxDownloaderWgt 247 247 { … … 369 369 UIActionsPool *pActionsPool, 370 370 UIVisualStateType visualStateType) 371 /* Initialize parent class: */372 371 : QObject(pParent) 373 /* Initialize protected members: */374 , m_pMachineWindowContainer(0)375 /* Initialize private members: */376 372 , m_pSession(pSession) 377 373 , m_pActionsPool(pActionsPool) 378 374 , m_machineState(KMachineState_Null) 379 375 , m_visualStateType(visualStateType) 380 /* Action groups: */376 , m_pMachineWindowWrapper(0) 381 377 , m_pRunningActions(0) 382 378 , m_pRunningOrPausedActions(0) 383 /* Bool flags: */ 384 , m_bIsFirstTimeStarted(false) 385 , m_bIsOpenViewFinished(false) 386 , m_bIsGraphicsSupported(false) 387 , m_bIsSeamlessSupported(false) 388 , m_bIsAutoSaveMedia(true) 389 , m_bIsPreventAutoClose(false) 379 , m_fIsFirstTimeStarted(false) 380 , m_fIsIgnoringRutimeMediums(false) 381 , m_fIsAdditionsActive(false) 382 , m_fIsGuestSupportsGraphics(false) 383 , m_fIsGuestSupportsSeamless(false) 384 , m_fIsMouseSupportsAbsolute(false) 385 , m_fIsHostCursorNeeded(false) 386 , m_fIsPreventAutoClose(false) 390 387 { 391 388 } … … 399 396 } 400 397 398 CSession& UIMachineLogic::session() 399 { 400 return m_pSession->session(); 401 } 402 401 403 void UIMachineLogic::prepareConsoleConnections() 402 404 { 405 /* Machine state-change updater: */ 403 406 connect(uisession(), SIGNAL(sigStateChange(KMachineState)), this, SLOT(sltMachineStateChanged(KMachineState))); 407 408 /* Guest additions state-change updater: */ 404 409 connect(uisession(), SIGNAL(sigAdditionsStateChange()), this, SLOT(sltAdditionsStateChanged())); 410 411 /* Mouse capability state-change updater: */ 412 connect(uisession(), SIGNAL(sigMouseCapabilityChange(bool, bool)), this, SLOT(sltMouseCapabilityChanged(bool, bool))); 413 414 /* USB devices state-change updater: */ 405 415 connect(uisession(), SIGNAL(sigUSBDeviceStateChange(const CUSBDevice &, bool, const CVirtualBoxErrorInfo &)), 406 416 this, SLOT(sltUSBDeviceStateChange(const CUSBDevice &, bool, const CVirtualBoxErrorInfo &))); 417 418 /* Runtime errors notifier: */ 407 419 connect(uisession(), SIGNAL(sigRuntimeError(bool, const QString &, const QString &)), 408 420 this, SLOT(sltRuntimeError(bool, const QString &, const QString &))); … … 423 435 m_pRunningOrPausedActions->setExclusive(false); 424 436 425 /* Move actions into firstgroup: */437 /* Move actions into running actions group: */ 426 438 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_Fullscreen)); 427 439 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_Seamless)); 440 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize)); 428 441 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Simple_AdjustWindow)); 429 442 m_pRunningActions->addAction(actionsPool()->action(UIActionIndex_Simple_TypeCAD)); … … 439 452 #endif 440 453 441 /* Move actions into second group: */ 442 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize)); 454 /* Move actions into running-n-paused actions group: */ 443 455 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Menu_MouseIntegration)); 444 456 m_pRunningOrPausedActions->addAction(actionsPool()->action(UIActionIndex_Toggle_MouseIntegration)); … … 460 472 void UIMachineLogic::prepareActionConnections() 461 473 { 462 /* "Machine" actions connections */474 /* "Machine" actions connections: */ 463 475 connect(actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize), SIGNAL(toggled(bool)), 464 476 this, SLOT(sltToggleGuestAutoresize(bool))); … … 486 498 this, SLOT(sltClose())); 487 499 488 /* "Devices" actions connections */500 /* "Devices" actions connections: */ 489 501 connect(actionsPool()->action(UIActionIndex_Menu_OpticalDevices)->menu(), SIGNAL(aboutToShow()), 490 502 this, SLOT(sltPrepareStorageMenu())); … … 503 515 504 516 #ifdef VBOX_WITH_DEBUGGER_GUI 505 /* "Debug" actions connections */517 /* "Debug" actions connections: */ 506 518 connect(actionsPool()->action(UIActionIndex_Menu_Debug)->menu(), SIGNAL(aboutToShow()), 507 519 this, SLOT(sltPrepareDebugMenu())); … … 566 578 strSettings = machine.GetExtraData(VBoxDefs::GUI_FirstRun); 567 579 if (strSettings == "yes") 568 m_ bIsFirstTimeStarted = true;580 m_fIsFirstTimeStarted = true; 569 581 570 582 strSettings = machine.GetExtraData(VBoxDefs::GUI_SaveMountedAtRuntime); 571 583 if (strSettings == "no") 572 m_ bIsAutoSaveMedia = false;584 m_fIsIgnoringRutimeMediums = true; 573 585 } 574 586 … … 615 627 } 616 628 } 629 630 #if 0 631 /* Dynamical property settings: */ 632 { 633 /* Load dynamical properties: */ 634 m_machineState = uisession()->property("MachineLogic/MachineState").value<KMachineState>(); 635 m_fIsAdditionsActive = uisession()->property("MachineLogic/IsAdditionsActive").toBool(); 636 m_fIsGuestSupportsGraphics = uisession()->property("MachineLogic/IsGuestSupportsGraphics").toBool(); 637 m_fIsGuestSupportsSeamless = uisession()->property("MachineLogic/IsGuestSupportsSeamless").toBool(); 638 m_fIsMouseSupportsAbsolute = uisession()->property("MachineLogic/IsMouseSupportsAbsolute").toBool(); 639 m_fIsHostCursorNeeded = uisession()->property("MachineLogic/IsHostCursorNeeded").toBool(); 640 641 /* Update relative things: */ 642 updateMachineState(); 643 updateAdditionsState(); 644 updateMouseCapability(); 645 } 646 #endif 617 647 } 618 648 … … 632 662 //machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAutoHide, mMiniToolBar->isAutoHide() ? "on" : "off"); 633 663 } 634 } 635 636 CSession& UIMachineLogic::session() 637 { 638 return m_pSession->session(); 639 } 640 641 void UIMachineLogic::sltMachineStateChanged(KMachineState newMachineState) 642 { 643 if (m_machineState != newMachineState) 644 { 645 /* Variable flags: */ 646 bool bIsRunning = newMachineState == KMachineState_Running || 647 newMachineState == KMachineState_Teleporting || 648 newMachineState == KMachineState_LiveSnapshotting; 649 bool bIsRunningOrPaused = bIsRunning || 650 newMachineState == KMachineState_Paused; 651 652 /* Update action groups: */ 653 m_pRunningActions->setEnabled(bIsRunning); 654 m_pRunningOrPausedActions->setEnabled(bIsRunningOrPaused); 655 656 /* Do we have GURU? */ 657 bool bIsGuruMeditation = false; 658 659 switch (newMachineState) 660 { 661 case KMachineState_Stuck: 664 665 #if 0 666 /* Dynamical property settings: */ 667 { 668 /* Save dynamical properties: */ 669 uisession()->setProperty("MachineLogic/MachineState", QVariant::fromValue(machineState())); 670 uisession()->setProperty("MachineLogic/IsAdditionsActive", m_fIsAdditionsActive); 671 uisession()->setProperty("MachineLogic/IsGuestSupportsGraphics", m_fIsGuestSupportsGraphics); 672 uisession()->setProperty("MachineLogic/IsGuestSupportsSeamless", m_fIsGuestSupportsSeamless); 673 uisession()->setProperty("MachineLogic/IsMouseSupportsAbsolute", m_fIsMouseSupportsAbsolute); 674 uisession()->setProperty("MachineLogic/IsHostCursorNeeded", m_fIsHostCursorNeeded); 675 } 676 #endif 677 } 678 679 void UIMachineLogic::updateMachineState() 680 { 681 /* State flags: */ 682 bool fIsRunning = machineState() == KMachineState_Running || 683 machineState() == KMachineState_Teleporting || 684 machineState() == KMachineState_LiveSnapshotting; 685 bool fIsRunningOrPaused = fIsRunning || 686 machineState() == KMachineState_Paused; 687 688 /* Update action groups: */ 689 m_pRunningActions->setEnabled(fIsRunning); 690 m_pRunningOrPausedActions->setEnabled(fIsRunningOrPaused); 691 692 /* Do we have GURU? */ 693 bool fIsGuruMeditation = false; 694 695 switch (machineState()) 696 { 697 case KMachineState_Stuck: 698 { 699 /* We will handle GURU later: */ 700 fIsGuruMeditation = true; 701 break; 702 } 703 case KMachineState_Paused: 704 { 705 QAction *pPauseAction = actionsPool()->action(UIActionIndex_Toggle_Pause); 706 if (!pPauseAction->isChecked()) 662 707 { 663 bIsGuruMeditation = true; 664 break; 708 /* Was paused from CSession side: */ 709 pPauseAction->blockSignals(true); 710 pPauseAction->setChecked(true); 711 pPauseAction->blockSignals(false); 665 712 } 666 case KMachineState_Paused: 713 break; 714 } 715 case KMachineState_Running: 716 case KMachineState_Teleporting: 717 case KMachineState_LiveSnapshotting: 718 { 719 QAction *pPauseAction = actionsPool()->action(UIActionIndex_Toggle_Pause); 720 if (pPauseAction->isChecked()) 667 721 { 668 /* Was paused from CMachine side? */ 669 QAction *pPauseAction = actionsPool()->action(UIActionIndex_Toggle_Pause); 670 if (!pPauseAction->isChecked()) 671 { 672 pPauseAction->blockSignals(true); 673 pPauseAction->setChecked(true); 674 pPauseAction->blockSignals(false); 675 } 676 break; 722 /* Was resumed from CSession side: */ 723 pPauseAction->blockSignals(true); 724 pPauseAction->setChecked(false); 725 pPauseAction->blockSignals(false); 677 726 } 678 case KMachineState_Running: 679 case KMachineState_Teleporting: 680 case KMachineState_LiveSnapshotting: 681 { 682 /* Was started from CMachine side? */ 683 QAction *pPauseAction = actionsPool()->action(UIActionIndex_Toggle_Pause); 684 if (isPaused() && pPauseAction->isChecked()) 685 { 686 pPauseAction->blockSignals(true); 687 pPauseAction->setChecked(false); 688 pPauseAction->blockSignals(false); 689 } 690 break; 691 } 727 break; 728 } 692 729 #ifdef Q_WS_X11 693 case KMachineState_Starting: 694 case KMachineState_Restoring: 695 case KMachineState_TeleportingIn: 696 { 697 /* The keyboard handler may wish to do some release logging on startup. 698 * Tell it that the logger is now active. */ 699 doXKeyboardLogging(QX11Info::display()); 700 break; 701 } 702 #endif 703 default: 704 break; 705 } 706 707 /* Now storing new state: */ 708 m_machineState = newMachineState; 709 710 /* Close VM if was closed someway: */ 711 if (m_machineState == KMachineState_PoweredOff || m_machineState == KMachineState_Saved || 712 m_machineState == KMachineState_Teleported || m_machineState == KMachineState_Aborted) 713 { 714 /* VM has been powered off or saved or aborted, no matter internally or externally. 715 * We must *safely* close the console window unless auto closure is disabled: */ 716 if (!m_bIsPreventAutoClose) 717 machineWindowWrapper()->sltTryClose(); 718 } 719 720 /* Process GURU: */ 721 if (bIsGuruMeditation) 722 { 723 if (machineWindowWrapper()->machineView()) 724 machineWindowWrapper()->machineView()->setIgnoreGuestResize(true); 725 726 CConsole console = session().GetConsole(); 727 QString strLogFolder = console.GetMachine().GetLogFolder(); 728 729 /* Take the screenshot for debugging purposes and save it */ 730 QString strFileName = strLogFolder + "/VBox.png"; 731 CDisplay display = console.GetDisplay(); 732 QImage shot = QImage(display.GetWidth(), display.GetHeight(), QImage::Format_RGB32); 733 display.TakeScreenShot(shot.bits(), shot.width(), shot.height()); 734 shot.save(QFile::encodeName(strFileName), "PNG"); 735 736 /* Warn the user about GURU: */ 737 if (vboxProblem().remindAboutGuruMeditation(console, QDir::toNativeSeparators(strLogFolder))) 738 { 739 qApp->processEvents(); 740 console.PowerDown(); 741 if (!console.isOk()) 742 vboxProblem().cannotStopMachine(console); 743 } 744 } 730 case KMachineState_Starting: 731 case KMachineState_Restoring: 732 case KMachineState_TeleportingIn: 733 { 734 /* The keyboard handler may wish to do some release logging on startup. 735 * Tell it that the logger is now active. */ 736 doXKeyboardLogging(QX11Info::display()); 737 break; 738 } 739 #endif 740 default: 741 break; 742 } 743 744 /* Close VM if was closed someway: */ 745 if (machineState() == KMachineState_PoweredOff || machineState() == KMachineState_Saved || 746 machineState() == KMachineState_Teleported || machineState() == KMachineState_Aborted) 747 { 748 /* VM has been powered off or saved or aborted, no matter internally or externally. 749 * We must *safely* close the console window unless auto closure is disabled: */ 750 sltClose(); 751 return; 752 } 753 754 /* Process GURU: */ 755 if (fIsGuruMeditation) 756 { 757 if (machineWindowWrapper()->machineView()) 758 machineWindowWrapper()->machineView()->setIgnoreGuestResize(true); 759 760 CConsole console = session().GetConsole(); 761 QString strLogFolder = console.GetMachine().GetLogFolder(); 762 763 /* Take the screenshot for debugging purposes and save it */ 764 QString strFileName = strLogFolder + "/VBox.png"; 765 CDisplay display = console.GetDisplay(); 766 QImage shot = QImage(display.GetWidth(), display.GetHeight(), QImage::Format_RGB32); 767 display.TakeScreenShot(shot.bits(), shot.width(), shot.height()); 768 shot.save(QFile::encodeName(strFileName), "PNG"); 769 770 /* Warn the user about GURU: */ 771 if (vboxProblem().remindAboutGuruMeditation(console, QDir::toNativeSeparators(strLogFolder))) 772 { 773 qApp->processEvents(); 774 console.PowerDown(); 775 if (!console.isOk()) 776 vboxProblem().cannotStopMachine(console); 777 } 778 } 745 779 746 780 #ifdef Q_WS_MAC 747 /* Update Dock Overlay: */ 748 if ( machineWindowWrapper() 749 && machineWindowWrapper()->machineView()) 750 machineWindowWrapper()->machineView()->updateDockOverlay(); 781 /* Update Dock Overlay: */ 782 if (machineWindowWrapper() && machineWindowWrapper()->machineView()) 783 machineWindowWrapper()->machineView()->updateDockOverlay(); 751 784 #endif /* Q_WS_MAC */ 752 } 753 } 754 755 void UIMachineLogic::sltAdditionsStateChanged() 756 { 757 /* Get console guest: */ 785 } 786 787 void UIMachineLogic::updateAdditionsState() 788 { 789 /* Update action groups: */ 790 actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize)->setEnabled(m_fIsAdditionsActive && m_fIsGuestSupportsGraphics); 791 actionsPool()->action(UIActionIndex_Toggle_Seamless)->setEnabled(m_fIsAdditionsActive && m_fIsGuestSupportsGraphics && m_fIsGuestSupportsSeamless); 792 793 #if 0 // TODO: Enter seamless if necessary! 794 /* If seamless mode should be enabled then check if it is enabled currently and re-enable it if open-view procedure is finished */ 795 if (actionsPool()->action(UIActionIndex_Toggle_Seamless)->isChecked() && 796 m_fIsAdditionsActive && m_fIsGuestSupportsGraphics && m_fIsGuestSupportsSeamless) 797 toggleFullscreenMode(true, true); 798 #endif 799 800 /* Check the GA version only in case of additions are active: */ 801 if (!m_fIsAdditionsActive) 802 return; 803 804 /* Check the Guest Additions version and warn the user about possible compatibility issues in case if the installed version is outdated. */ 758 805 CGuest guest = session().GetConsole().GetGuest(); 759 760 /* Variable flags: */761 bool bIsActive = guest.GetAdditionsActive();762 bool bIsGraphicsSupported = guest.GetSupportsGraphics();763 bool bIsSeamlessSupported = guest.GetSupportsSeamless();764 765 /* Update action groups: */766 actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize)->setEnabled(bIsActive && bIsGraphicsSupported);767 actionsPool()->action(UIActionIndex_Toggle_Seamless)->setEnabled(bIsActive && bIsGraphicsSupported && bIsSeamlessSupported);768 769 /* Store new values: */770 m_bIsSeamlessSupported = bIsSeamlessSupported;771 m_bIsGraphicsSupported = bIsGraphicsSupported;772 773 #if 0 // TODO: Re-activate seamless if necessary!774 /* If seamless mode should be enabled then check if it is enabled currently and re-enable it if open-view procedure is finished */775 if ((m_bIsSeamlessSupported != bIsSeamlessSupported) || (m_bIsGraphicsSupported != bIsGraphicsSupported))776 {777 if (actionsPool()->action(UIActionIndex_Toggle_Seamless)->isChecked() && m_bIsOpenViewFinished && bIsGraphicsSupported && bIsSeamlessSupported)778 toggleFullscreenMode(true, true);779 }780 #endif781 782 /* Check the GA version only in case of additions are active: */783 if (!bIsActive)784 return;785 786 /* Check the Guest Additions version and warn the user about possible compatibility issues in case if the installed version is outdated. */787 806 QString strVersion = guest.GetAdditionsVersion(); 788 807 uint uVersion = strVersion.toUInt(); … … 804 823 } 805 824 825 void UIMachineLogic::updateMouseCapability() 826 { 827 /* Update related things: */ 828 QAction *pAction = actionsPool()->action(UIActionIndex_Toggle_MouseIntegration); 829 pAction->setEnabled(m_fIsMouseSupportsAbsolute && !m_fIsHostCursorNeeded); 830 pAction->setChecked(m_fIsHostCursorNeeded || pAction->isChecked()); 831 } 832 833 void UIMachineLogic::sltMachineStateChanged(KMachineState state) 834 { 835 /* Check if something had changed: */ 836 if (m_machineState != state) 837 { 838 /* Store new data: */ 839 m_machineState = state; 840 841 /* Update machine state: */ 842 updateMachineState(); 843 } 844 } 845 846 void UIMachineLogic::sltAdditionsStateChanged() 847 { 848 /* Get our guest: */ 849 CGuest guest = session().GetConsole().GetGuest(); 850 851 /* Variable flags: */ 852 bool fIsAdditionsActive = guest.GetAdditionsActive(); 853 bool fIsGuestSupportsGraphics = guest.GetSupportsGraphics(); 854 bool fIsGuestSupportsSeamless = guest.GetSupportsSeamless(); 855 856 /* Check if something had changed: */ 857 if (m_fIsAdditionsActive != fIsAdditionsActive || 858 m_fIsGuestSupportsGraphics != fIsGuestSupportsGraphics || 859 m_fIsGuestSupportsSeamless != fIsGuestSupportsSeamless) 860 { 861 /* Store new data: */ 862 m_fIsAdditionsActive = fIsAdditionsActive; 863 m_fIsGuestSupportsGraphics = fIsGuestSupportsGraphics; 864 m_fIsGuestSupportsSeamless = fIsGuestSupportsSeamless; 865 866 /* Update additions state: */ 867 updateAdditionsState(); 868 } 869 } 870 871 void UIMachineLogic::sltMouseCapabilityChanged(bool fIsSupportsAbsolute, bool fIsHostCursorNeeded) 872 { 873 /* Check if something is changed: */ 874 if (m_fIsMouseSupportsAbsolute != fIsSupportsAbsolute || m_fIsHostCursorNeeded != fIsHostCursorNeeded) 875 { 876 /* Store new data: */ 877 m_fIsMouseSupportsAbsolute = fIsSupportsAbsolute; 878 m_fIsHostCursorNeeded = fIsHostCursorNeeded; 879 880 /* Update mouse capability: */ 881 updateMouseCapability(); 882 } 883 } 884 806 885 void UIMachineLogic::sltUSBDeviceStateChange(const CUSBDevice &device, bool bIsAttached, const CVirtualBoxErrorInfo &error) 807 886 { … … 822 901 } 823 902 824 void UIMachineLogic::sltToggleGuestAutoresize(bool /* bEnabled */)903 void UIMachineLogic::sltToggleGuestAutoresize(bool bEnabled) 825 904 { 826 905 /* Do not process if window or view is missing! */ … … 828 907 return; 829 908 830 // TODO: Enable/Disable guest-autoresize for machine view! */909 machineWindowWrapper()->machineView()->setGuestAutoresizeEnabled(bEnabled); 831 910 } 832 911 … … 887 966 888 967 /* Remember the paused state. */ 889 bool bWasPaused = m _machineState== KMachineState_Paused;968 bool bWasPaused = machineState() == KMachineState_Paused; 890 969 if (!bWasPaused) 891 970 { … … 978 1057 979 1058 /* Close machine window: */ 980 machineWindowWrapper()-> machineWindow()->close();1059 machineWindowWrapper()->sltTryClose(); 981 1060 } 982 1061 … … 1230 1309 1231 1310 /* Save medium mounted at runtime */ 1232 if (wasMounted && m_bIsAutoSaveMedia)1311 if (wasMounted && !m_fIsIgnoringRutimeMediums) 1233 1312 { 1234 1313 machine.SaveSettings(); … … 1440 1519 } 1441 1520 #endif 1442 1443 void UIMachineLogic::sltMouseStateChanged(int iState)1444 {1445 actionsPool()->action(UIActionIndex_Toggle_MouseIntegration)->setEnabled(iState & UIMouseStateType_MouseAbsolute);1446 }1447 1521 1448 1522 bool UIMachineLogic::pause(bool bOn) … … 1545 1619 1546 1620 /* Save medium mounted at runtime */ 1547 if (isMounted && m_bIsAutoSaveMedia)1621 if (isMounted && !m_fIsIgnoringRutimeMediums) 1548 1622 { 1549 1623 machine.SaveSettings(); … … 1753 1827 mIsFullscreen = aOn; 1754 1828 mVmAdjustWindowAction->setEnabled (!aOn); 1755 mVmSeamlessAction->setEnabled (!aOn && m_ bIsSeamlessSupported && m_bIsGraphicsSupported);1829 mVmSeamlessAction->setEnabled (!aOn && m_fIsGuestSupportsSeamless && m_fIsGuestSupportsGraphics); 1756 1830 } 1757 1831 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r26754 r26773 55 55 UIActionsPool* actionsPool() { return m_pActionsPool; } 56 56 UIVisualStateType visualStateType() const { return m_visualStateType; } 57 UIMachineWindow* machineWindowWrapper() { return m_pMachineWindow Container; }57 UIMachineWindow* machineWindowWrapper() { return m_pMachineWindowWrapper; } 58 58 KMachineState machineState() const { return m_machineState; } 59 bool isPaused() const { return m_machineState == KMachineState_Paused || 60 m_machineState == KMachineState_TeleportingPausedVM; } 59 bool isPaused() const { return machineState() == KMachineState_Paused || 60 machineState() == KMachineState_TeleportingPausedVM; } 61 bool isPreventAutoClose() const { return m_fIsPreventAutoClose; } 62 63 /* Public setters: */ 64 void setPreventAutoClose(bool fIsPreventAutoClose) { m_fIsPreventAutoClose = fIsPreventAutoClose; } 61 65 62 66 protected: … … 69 73 virtual ~UIMachineLogic(); 70 74 75 /* Protected getters: */ 76 CSession& session(); 77 bool isFirstTimeStarted() const { return m_fIsFirstTimeStarted; } 78 79 /* Protected setters: */ 80 void setMachineWindowWrapper(UIMachineWindow *pMachineWindowWrapper) { m_pMachineWindowWrapper = pMachineWindowWrapper; } 81 82 /* Console related routines: */ 83 bool pause() { return pause(true); } 84 bool unpause() { return pause(false); } 85 71 86 /* Prepare helpers: */ 72 87 virtual void prepareConsoleConnections(); … … 78 93 /* Cleanup helpers: */ 79 94 virtual void saveLogicSettings(); 80 //virtual void cleanupRequiredFeatures(); 81 //virtual void cleanupActionConnections(); 82 //virtual void cleanupActionGroups(); 83 //virtual void cleanupConsoleConnections(); 84 85 /* Protected getters: */ 86 CSession& session(); 87 bool isFirstTimeStarted() const { return m_bIsFirstTimeStarted; } 88 bool isPreventAutoClose() const { return m_bIsPreventAutoClose; } 89 90 /* Pretected setters: */ 91 void setMachineState(KMachineState state) { m_machineState = state; } 92 void setPreventAutoClose(bool bIsPreventAutoClose) { m_bIsPreventAutoClose = bIsPreventAutoClose; } 93 void setOpenViewFinished(bool bIsOpenViewFinished) { m_bIsOpenViewFinished = bIsOpenViewFinished; } 94 95 /* Console related routines: */ 96 bool pause() { return pause(true); } 97 bool unpause() { return pause(false); } 98 99 /* Protected variables: */ 100 UIMachineWindow *m_pMachineWindowContainer; 95 virtual void cleanupRequiredFeatures() {} 96 virtual void cleanupActionConnections() {} 97 virtual void cleanupActionGroups() {} 98 virtual void cleanupConsoleConnections() {} 99 100 /* Update helpers: */ 101 virtual void updateMachineState(); 102 virtual void updateAdditionsState(); 103 virtual void updateMouseCapability(); 104 105 protected slots: 106 107 /* Console callback handlers: */ 108 virtual void sltMachineStateChanged(KMachineState machineState); 109 virtual void sltAdditionsStateChanged(); 110 virtual void sltMouseCapabilityChanged(bool fIsSupportsAbsolute, bool fNeedsHostCursor); 111 virtual void sltUSBDeviceStateChange(const CUSBDevice &device, bool bIsAttached, const CVirtualBoxErrorInfo &error); 112 virtual void sltRuntimeError(bool bIsFatal, const QString &strErrorId, const QString &strMessage); 101 113 102 114 private slots: 103 104 /* Console callback handlers: */105 void sltMachineStateChanged(KMachineState newMachineState);106 void sltAdditionsStateChanged();107 void sltUSBDeviceStateChange(const CUSBDevice &device, bool bIsAttached, const CVirtualBoxErrorInfo &error);108 void sltRuntimeError(bool bIsFatal, const QString &strErrorId, const QString &strMessage);109 115 110 116 /* "Machine" menu funtionality */ … … 140 146 #endif 141 147 142 /* Machine view handlers: */143 void sltMouseStateChanged(int iState);144 145 148 private: 146 149 … … 157 160 KMachineState m_machineState; 158 161 UIVisualStateType m_visualStateType; 162 UIMachineWindow *m_pMachineWindowWrapper; 159 163 160 164 QActionGroup *m_pRunningActions; 161 165 QActionGroup *m_pRunningOrPausedActions; 162 166 163 bool m_bIsFirstTimeStarted : 1; 164 bool m_bIsOpenViewFinished : 1; 165 bool m_bIsGraphicsSupported : 1; 166 bool m_bIsSeamlessSupported : 1; 167 bool m_bIsAutoSaveMedia : 1; 168 bool m_bIsPreventAutoClose : 1; 169 170 /* Friend classes: */ 171 friend class UIMachineWindow; 167 bool m_fIsFirstTimeStarted : 1; 168 bool m_fIsIgnoringRutimeMediums : 1; 169 bool m_fIsAdditionsActive : 1; 170 bool m_fIsGuestSupportsGraphics : 1; 171 bool m_fIsGuestSupportsSeamless : 1; 172 bool m_fIsMouseSupportsAbsolute : 1; 173 bool m_fIsHostCursorNeeded : 1; 174 bool m_fIsPreventAutoClose : 1; 172 175 173 176 #ifdef VBOX_WITH_DEBUGGER_GUI … … 182 185 #endif 183 186 187 /* Friend classes: */ 188 friend class UIMachineWindow; 189 184 190 #if 0 // TODO: Where to move that? 185 191 # ifdef Q_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r26754 r26773 85 85 #endif /* defined (Q_WS_MAC) */ 86 86 87 /* *Menu activation event */87 /* Menu activation event */ 88 88 class ActivateMenuEvent : public QEvent 89 89 { 90 90 public: 91 91 92 ActivateMenuEvent (QAction * aData)92 ActivateMenuEvent (QAction *pAction) 93 93 : QEvent((QEvent::Type)VBoxDefs::ActivateMenuEventType) 94 , m Action(aData) {}95 QAction *action() const { return mAction; }94 , m_pAction(pAction) {} 95 QAction* action() const { return m_pAction; } 96 96 97 97 private: 98 98 99 QAction *m Action;99 QAction *m_pAction; 100 100 }; 101 101 … … 106 106 VBoxViewport(QWidget *pParent) : QWidget(pParent) 107 107 { 108 /* No need for background drawing */108 /* No need for background drawing: */ 109 109 setAttribute(Qt::WA_OpaquePaintEvent); 110 110 } … … 160 160 } 161 161 return view; 162 } 163 164 int UIMachineView::keyboardState() const 165 { 166 return (m_bIsKeyboardCaptured ? UIViewStateType_KeyboardCaptured : 0) | 167 (m_bIsHostkeyPressed ? UIViewStateType_HostKeyPressed : 0); 168 } 169 170 int UIMachineView::mouseState() const 171 { 172 return (m_bIsMouseCaptured ? UIMouseStateType_MouseCaptured : 0) | 173 (m_bIsMouseAbsolute ? UIMouseStateType_MouseAbsolute : 0) | 174 (m_bIsMouseIntegrated ? 0 : UIMouseStateType_MouseAbsoluteDisabled); 162 175 } 163 176 … … 200 213 ) 201 214 : QAbstractScrollArea(pMachineWindow->machineWindow()) 202 /* Private members: */203 215 , m_pMachineWindow(pMachineWindow) 204 216 , m_console(pMachineWindow->machineLogic()->uisession()->session().GetConsole()) … … 218 230 , m_bIsMouseAbsolute(false) 219 231 , m_bIsMouseIntegrated(true) 232 , m_fIsHideHostPointer(true) 220 233 , m_bIsHostkeyPressed(false) 221 234 , m_bIsHostkeyAlone (false) 235 , m_bIsHostkeyInCapture(false) 222 236 , m_bIsGuestSupportsGraphics(false) 223 237 , m_bIsMachineWindowResizeIgnored(true) 224 238 , m_bIsFrameBufferResizeIgnored(false) 225 239 , m_bIsGuestResizeIgnored(false) 226 , m_numLock(false) 227 , m_scrollLock(false) 228 , m_capsLock(false) 229 , m_fPassCAD (false) 230 , m_fHideHostPointer(true) 240 , m_fNumLock(false) 241 , m_fCapsLock(false) 242 , m_fScrollLock(false) 243 , m_fPassCAD(false) 231 244 #ifdef VBOX_WITH_VIDEOHWACCEL 232 245 , m_fAccelerate2DVideo(bAccelerate2DVideo) … … 239 252 , m_darwinEventHandlerRef(NULL) 240 253 # endif /* !QT_MAC_USE_COCOA */ 241 , m_darwinKeyModifiers 254 , m_darwinKeyModifiers(0) 242 255 , m_fKeyboardGrabbed (false) 243 , mDockIconEnabled 256 , mDockIconEnabled(true) 244 257 #endif 245 258 , m_desktopGeometryType(DesktopGeo_Invalid) … … 255 268 { 256 269 #ifdef VBOX_WITH_DEBUGGER 257 /** @todo figure out a more proper fix. */ 258 /* HACK ALERT! Really ugly workaround for the resizing to 9x1 done 259 * by DevVGA if provoked before power on. */ 270 // TODO: Fix all DEBUGGER stuff! 271 /* HACK ALERT! Really ugly workaround for the resizing to 9x1 done by DevVGA if provoked before power on. */ 260 272 QSize fb(m_pFrameBuffer->width(), m_pFrameBuffer->height()); 261 273 if ((fb.width() < 16 || fb.height() < 16) && (vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled())) … … 305 317 case DesktopGeo_Automatic: 306 318 geometry = QRect(0, 0, 307 qMax(m_desktopGeometry.width(), m_storedConsoleSize.width()),308 qMax(m_desktopGeometry.height(), m_storedConsoleSize.height()));319 qMax(m_desktopGeometry.width(), m_storedConsoleSize.width()), 320 qMax(m_desktopGeometry.height(), m_storedConsoleSize.height())); 309 321 break; 310 322 case DesktopGeo_Any: … … 339 351 * (or at least its width and height) is a constant. */ 340 352 m_desktopGeometry = QRect(0, 0, desktop.width() - frame.width() + window.width(), 341 desktop.height() - frame.height() + window.height());342 } 343 } 344 345 void UIMachineView::setDesktopGeometry(DesktopGeo aGeo, int aWidth, int aHeight)346 { 347 switch ( aGeo)353 desktop.height() - frame.height() + window.height()); 354 } 355 } 356 357 void UIMachineView::setDesktopGeometry(DesktopGeo geometry, int aWidth, int aHeight) 358 { 359 switch (geometry) 348 360 { 349 361 case DesktopGeo_Fixed: … … 365 377 break; 366 378 default: 367 AssertMsgFailed(("Invalid desktop geometry type %d\n", aGeo));379 AssertMsgFailed(("Invalid desktop geometry type %d\n", geometry)); 368 380 m_desktopGeometryType = DesktopGeo_Invalid; 369 381 } … … 476 488 { 477 489 /* Prepare view frame: */ 478 setFrameStyle(QFrame::NoFrame);490 //setFrameStyle(QFrame::NoFrame); 479 491 480 492 /* Pressed keys: */ … … 573 585 void UIMachineView::prepareConsoleConnections() 574 586 { 587 /* UISession notifier: */ 575 588 UISession *sender = machineWindowWrapper()->machineLogic()->uisession(); 589 590 /* Machine state-change updater: */ 591 connect(sender, SIGNAL(sigStateChange(KMachineState)), this, SLOT(sltMachineStateChanged(KMachineState))); 592 593 /* Guest additions state-change updater: */ 594 connect(sender, SIGNAL(sigAdditionsStateChange()), this, SLOT(sltAdditionsStateChanged())); 595 596 /* Keyboard LEDs state-change updater: */ 597 connect(sender, SIGNAL(sigKeyboardLedsChange(bool, bool, bool)), this, SLOT(sltKeyboardLedsChanged(bool, bool, bool))); 598 599 /* Mouse pointer shape state-change updater: */ 576 600 connect(sender, SIGNAL(sigMousePointerShapeChange(bool, bool, uint, uint, uint, uint, const uchar *)), 577 this, SLOT(sltMousePointerShapeChange(bool, bool, uint, uint, uint, uint, const uchar *))); 578 connect(sender, SIGNAL(sigMouseCapabilityChange(bool, bool)), this, SLOT(sltMouseCapabilityChange(bool, bool))); 579 connect(sender, SIGNAL(sigKeyboardLedsChange(bool, bool, bool)), this, SLOT(sltKeyboardLedsChange(bool, bool, bool))); 580 connect(sender, SIGNAL(sigStateChange(KMachineState)), this, SLOT(sltStateChange(KMachineState))); 581 connect(sender, SIGNAL(sigAdditionsStateChange()), this, SLOT(sltAdditionsStateChange())); 601 this, SLOT(sltMousePointerShapeChanged(bool, bool, uint, uint, uint, uint, const uchar *))); 602 603 /* Mouse capability state-change updater: */ 604 connect(sender, SIGNAL(sigMouseCapabilityChange(bool, bool)), this, SLOT(sltMouseCapabilityChanged(bool, bool))); 582 605 } 583 606 … … 599 622 setDesktopGeometry(DesktopGeo_Fixed, width, height); 600 623 } 601 connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT( doResizeDesktop(int)));624 connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltDesktopResized())); 602 625 603 626 #ifdef Q_WS_X11 … … 614 637 m_fPassCAD = true; 615 638 } 639 640 #if 0 641 /* Dynamical property settings: */ 642 { 643 /* Get loader: */ 644 UISession *loader = machineWindowWrapper()->machineLogic()->uisession(); 645 646 /* Load dynamical properties: */ 647 m_machineState = loader->property("MachineView/MachineState").value<KMachineState>(); 648 m_uNumLockAdaptionCnt = loader->property("MachineView/NumLockAdaptionCnt").toUInt(); 649 m_uCapsLockAdaptionCnt = loader->property("MachineView/CapsLockAdaptionCnt").toUInt(); 650 m_bIsAutoCaptureDisabled = loader->property("MachineView/IsAutoCaptureDisabled").toBool(); 651 m_bIsKeyboardCaptured = loader->property("MachineView/IsKeyboardCaptured").toBool(); 652 m_bIsMouseCaptured = loader->property("MachineView/IsMouseCaptured").toBool(); 653 m_bIsMouseAbsolute = loader->property("MachineView/IsMouseAbsolute").toBool(); 654 m_bIsMouseIntegrated = loader->property("MachineView/IsMouseIntegrated").toBool(); 655 m_fIsHideHostPointer = loader->property("MachineView/IsHideHostPointer").toBool(); 656 m_bIsHostkeyInCapture = loader->property("MachineView/IsHostkeyInCapture").toBool(); 657 m_bIsGuestSupportsGraphics = loader->property("MachineView/IsGuestSupportsGraphics").toBool(); 658 m_fNumLock = loader->property("MachineView/IsNumLock").toBool(); 659 m_fCapsLock = loader->property("MachineView/IsCapsLock").toBool(); 660 m_fScrollLock = loader->property("MachineView/IsScrollLock").toBool(); 661 662 /* Update related things: */ 663 updateMachineState(); 664 updateAdditionsState(); 665 updateMousePointerShape(); 666 updateMouseCapability(); 667 } 668 #endif 669 } 670 671 void UIMachineView::saveMachineViewSettings() 672 { 673 #if 0 674 /* Dynamical property settings: */ 675 { 676 /* Get saver: */ 677 UISession *saver = machineWindowWrapper()->machineLogic()->uisession(); 678 679 /* Save dynamical properties: */ 680 saver->setProperty("MachineView/MachineState", QVariant::fromValue(machineState())); 681 saver->setProperty("MachineView/NumLockAdaptionCnt", m_uNumLockAdaptionCnt); 682 saver->setProperty("MachineView/CapsLockAdaptionCnt", m_uCapsLockAdaptionCnt); 683 saver->setProperty("MachineView/IsAutoCaptureDisabled", m_bIsAutoCaptureDisabled); 684 saver->setProperty("MachineView/IsKeyboardCaptured", m_bIsKeyboardCaptured); 685 saver->setProperty("MachineView/IsMouseCaptured", m_bIsMouseCaptured); 686 saver->setProperty("MachineView/IsMouseAbsolute", m_bIsMouseAbsolute); 687 saver->setProperty("MachineView/IsMouseIntegrated", m_bIsMouseIntegrated); 688 saver->setProperty("MachineView/IsHideHostPointer", m_fIsHideHostPointer); 689 saver->setProperty("MachineView/IsHostkeyInCapture", m_bIsHostkeyInCapture); 690 saver->setProperty("MachineView/IsGuestSupportsGraphics", m_bIsGuestSupportsGraphics); 691 saver->setProperty("MachineView/IsNumLock", m_fNumLock); 692 saver->setProperty("MachineView/IsCapsLock", m_fCapsLock); 693 saver->setProperty("MachineView/IsScrollLock", m_fScrollLock); 694 } 695 #endif 616 696 } 617 697 … … 647 727 void UIMachineView::cleanupFrameBuffer() 648 728 { 649 /* Cleanup: */650 729 if (m_pFrameBuffer) 651 730 { … … 659 738 } 660 739 661 void UIMachineView::sltMousePointerShapeChange(bool fIsVisible, bool fHasAlpha, 662 uint uXHot, uint uYHot, uint uWidth, uint uHeight, 663 const uchar *pShapeData) 664 { 665 if (m_bIsMouseAbsolute) 666 { 667 /* Do we have new shape data? */ 668 if (pShapeData) 669 setPointerShape(pShapeData, fHasAlpha, uXHot, uYHot, uWidth, uHeight); 670 671 /* Should we hide/show pointer? */ 672 if (fIsVisible) 673 viewport()->setCursor(m_lastCursor); 674 else 675 viewport()->setCursor(Qt::BlankCursor); 676 } 677 m_fHideHostPointer = !fIsVisible; 678 } 679 680 void UIMachineView::sltMouseCapabilityChange(bool bIsSupportsAbsolute, bool bNeedsHostCursor) 681 { 682 if (m_bIsMouseAbsolute != bIsSupportsAbsolute) 683 { 684 m_bIsMouseAbsolute = bIsSupportsAbsolute; 685 /* Correct the mouse capture state and reset the cursor to the default shape if necessary: */ 686 if (m_bIsMouseAbsolute) 687 { 688 CMouse mouse = m_console.GetMouse(); 689 mouse.PutMouseEventAbsolute(-1, -1, 0, 0 /* Horizontal wheel */, 0); 690 captureMouse(false, false); 691 } 692 else 693 viewport()->unsetCursor(); 694 emitMouseStateChanged(); 695 vboxProblem().remindAboutMouseIntegration(m_bIsMouseAbsolute); 696 } 697 if (bNeedsHostCursor) 698 setMouseIntegrationLocked(false); 699 else 700 setMouseIntegrationLocked(true); 701 } 702 703 void UIMachineView::sltKeyboardLedsChange(bool bNumLock, bool bCapsLock, bool bScrollLock) 704 { 705 if (bNumLock != m_numLock) 706 m_uNumLockAdaptionCnt = 2; 707 if (bCapsLock != m_capsLock) 708 m_uCapsLockAdaptionCnt = 2; 709 m_numLock = bNumLock; 710 m_capsLock = bCapsLock; 711 m_scrollLock = bScrollLock; 712 } 713 714 void UIMachineView::sltStateChange(KMachineState state) 715 { 716 switch (state) 740 void UIMachineView::updateMachineState() 741 { 742 switch (machineState()) 717 743 { 718 744 case KMachineState_Paused: … … 720 746 { 721 747 if (mode() != VBoxDefs::TimerMode && m_pFrameBuffer && 722 ( state != KMachineState_TeleportingPausedVM || m_machineState!= KMachineState_Teleporting))748 (machineState() != KMachineState_TeleportingPausedVM || machineState() != KMachineState_Teleporting)) 723 749 { 724 750 /* Take a screen snapshot. Note that TakeScreenShot() always needs a 32bpp image: */ … … 746 772 case KMachineState_Running: 747 773 { 748 if (m _machineState == KMachineState_Paused || m_machineState== KMachineState_TeleportingPausedVM)774 if (machineState() == KMachineState_Paused || machineState() == KMachineState_TeleportingPausedVM) 749 775 { 750 776 if (mode() != VBoxDefs::TimerMode && m_pFrameBuffer) … … 766 792 break; 767 793 } 768 769 m_machineState = state; 770 } 771 772 void UIMachineView::sltAdditionsStateChange() 773 { 774 CGuest guest = console().GetGuest(); 775 bool fIsGuestSupportsGraphics = guest.GetSupportsGraphics(); 794 } 795 796 void UIMachineView::updateAdditionsState() 797 { 798 /* Check if we should restrict minimum size: */ 799 maybeRestrictMinimumSize(); 776 800 777 801 #if 0 // TODO: Do we need this? … … 779 803 (machineWindowWrapper()->isTrueSeamless() || machineWindowWrapper()->isTrueFullscreen())) 780 804 mDoResize = true; 781 #endif782 m_bIsGuestSupportsGraphics = fIsGuestSupportsGraphics;783 784 maybeRestrictMinimumSize();785 786 #if 0 // TODO: Do we need this?787 805 /* This will only be acted upon if mDoResize is true: */ 788 doResizeHint(); 789 #endif 806 sltPerformGuestResize(); 807 #endif 808 } 809 810 void UIMachineView::updateMousePointerShape() 811 { 812 if (m_bIsMouseAbsolute) 813 { 814 /* Should we hide/show pointer? */ 815 if (m_fIsHideHostPointer) 816 viewport()->setCursor(Qt::BlankCursor); 817 else 818 viewport()->setCursor(m_lastCursor); 819 } 820 } 821 822 void UIMachineView::updateMouseCapability() 823 { 824 /* Correct the mouse capture state and reset the cursor to the default shape if necessary: */ 825 if (m_bIsMouseAbsolute) 826 { 827 CMouse mouse = m_console.GetMouse(); 828 mouse.PutMouseEventAbsolute(-1, -1, 0, 0 /* Horizontal wheel */, 0); 829 captureMouse(false, false); 830 } 831 else 832 viewport()->unsetCursor(); 833 834 /* Notify user about mouse integration state: */ 835 vboxProblem().remindAboutMouseIntegration(m_bIsMouseAbsolute); 836 837 /* Notify all watchers: */ 838 emitMouseStateChanged(); 839 } 840 841 void UIMachineView::sltMachineStateChanged(KMachineState state) 842 { 843 /* Check if something had changed: */ 844 if (m_machineState != state) 845 { 846 /* Set new data: */ 847 m_machineState = state; 848 849 /* Update depending things: */ 850 updateMachineState(); 851 } 852 } 853 854 void UIMachineView::sltAdditionsStateChanged() 855 { 856 /* Get new values: */ 857 CGuest guest = console().GetGuest(); 858 bool bIsGuestSupportsGraphics = guest.GetSupportsGraphics(); 859 860 /* Check if something had changed: */ 861 if (m_bIsGuestSupportsGraphics != bIsGuestSupportsGraphics) 862 { 863 /* Get new data: */ 864 m_bIsGuestSupportsGraphics = bIsGuestSupportsGraphics; 865 866 /* Update depending things: */ 867 updateAdditionsState(); 868 } 869 } 870 871 void UIMachineView::sltKeyboardLedsChanged(bool bNumLock, bool bCapsLock, bool bScrollLock) 872 { 873 /* Update num lock status: */ 874 if (m_fNumLock != bNumLock) 875 { 876 m_fNumLock = bNumLock; 877 m_uNumLockAdaptionCnt = 2; 878 } 879 880 /* Update caps lock status: */ 881 if (m_fCapsLock != bCapsLock) 882 { 883 m_fCapsLock = bCapsLock; 884 m_uCapsLockAdaptionCnt = 2; 885 } 886 887 /* Update scroll lock status: */ 888 if (m_fScrollLock != bScrollLock) 889 m_fScrollLock = bScrollLock; 890 } 891 892 void UIMachineView::sltMousePointerShapeChanged(bool fIsVisible, bool fHasAlpha, 893 uint uXHot, uint uYHot, uint uWidth, uint uHeight, 894 const uchar *pShapeData) 895 { 896 /* Should we show cursor anyway? */ 897 m_fIsHideHostPointer = !fIsVisible; 898 899 /* Should we cache shape data? */ 900 if (pShapeData) 901 setPointerShape(pShapeData, fHasAlpha, uXHot, uYHot, uWidth, uHeight); 902 903 /* Perform cursor update: */ 904 updateMousePointerShape(); 905 } 906 907 void UIMachineView::sltMouseCapabilityChanged(bool bIsSupportsAbsolute, bool /* bNeedsHostCursor */) 908 { 909 /* Check if something had changed: */ 910 if (m_bIsMouseAbsolute != bIsSupportsAbsolute) 911 { 912 /* Get new data: */ 913 m_bIsMouseAbsolute = bIsSupportsAbsolute; 914 915 /* Update depending things: */ 916 updateMouseCapability(); 917 } 918 } 919 920 /* If the desktop geometry is set automatically, this will update it: */ 921 void UIMachineView::sltDesktopResized() 922 { 923 calculateDesktopGeometry(); 790 924 } 791 925 … … 927 1061 calculateDesktopGeometry(); 928 1062 929 /* Enable frame-buffer resize watching only now: */1063 /* Enable frame-buffer resize watching: */ 930 1064 if (m_bIsFrameBufferResizeIgnored) 931 1065 m_bIsFrameBufferResizeIgnored = false; … … 1243 1377 mDoResize = isGuestSupportsGraphics() || machineWindowWrapper()->isTrueFullscreen(); 1244 1378 if (!m_bIsMachineWindowResizeIgnored && isGuestSupportsGraphics() && m_bIsGuestAutoresizeEnabled) 1245 QTimer::singleShot(300, this, SLOT( doResizeHint()));1379 QTimer::singleShot(300, this, SLOT(sltPerformGuestResize())); 1246 1380 break; 1247 1381 } … … 1469 1603 { 1470 1604 /* Currently this is used in winLowKeyboardEvent() only: */ 1471 m_b HostkeyInCapture = m_bIsKeyboardCaptured;1605 m_bIsHostkeyInCapture = m_bIsKeyboardCaptured; 1472 1606 } 1473 1607 … … 1991 2125 uint8_t what_pressed = (event.flags & 0x01) && (event.vkCode != VK_RSHIFT) ? IsExtKeyPressed : IsKeyPressed; 1992 2126 if ((event.flags & 0x80) /* released */ && 1993 ((event.vkCode == m_globalSettings.hostKey() && !m_b HostkeyInCapture) ||2127 ((event.vkCode == m_globalSettings.hostKey() && !m_bIsHostkeyInCapture) || 1994 2128 (m_pressedKeys[event.scanCode] & (IsKbdCaptured | what_pressed)) == what_pressed)) 1995 2129 return false; … … 2491 2625 XFreeModifiermap(map); 2492 2626 2493 if (m_uNumLockAdaptionCnt && (m_ numLock ^ !!(uMask & uKeyMaskNum)))2627 if (m_uNumLockAdaptionCnt && (m_fNumLock ^ !!(uMask & uKeyMaskNum))) 2494 2628 { 2495 2629 -- m_uNumLockAdaptionCnt; … … 2497 2631 piCodes[(*puCount)++] = 0x45 | 0x80; 2498 2632 } 2499 if (m_uCapsLockAdaptionCnt && (m_ capsLock ^ !!(uMask & uKeyMaskCaps)))2633 if (m_uCapsLockAdaptionCnt && (m_fCapsLock ^ !!(uMask & uKeyMaskCaps))) 2500 2634 { 2501 2635 m_uCapsLockAdaptionCnt--; … … 2505 2639 * capslock. For simplicity, only do this if shift is not 2506 2640 * already held down. */ 2507 if (m_ capsLock && !(m_pressedKeys[0x2a] & IsKeyPressed))2641 if (m_fCapsLock && !(m_pressedKeys[0x2a] & IsKeyPressed)) 2508 2642 { 2509 2643 piCodes[(*puCount)++] = 0x2a; … … 2514 2648 #elif defined(Q_WS_WIN32) 2515 2649 2516 if (m_uNumLockAdaptionCnt && (m_ numLock ^ !!(GetKeyState(VK_NUMLOCK))))2650 if (m_uNumLockAdaptionCnt && (m_fNumLock ^ !!(GetKeyState(VK_NUMLOCK)))) 2517 2651 { 2518 2652 m_uNumLockAdaptionCnt--; … … 2520 2654 piCodes[(*puCount)++] = 0x45 | 0x80; 2521 2655 } 2522 if (m_uCapsLockAdaptionCnt && (m_ capsLock ^ !!(GetKeyState(VK_CAPITAL))))2656 if (m_uCapsLockAdaptionCnt && (m_fCapsLock ^ !!(GetKeyState(VK_CAPITAL)))) 2523 2657 { 2524 2658 m_uCapsLockAdaptionCnt--; … … 2528 2662 * capslock. For simplicity, only do this if shift is not 2529 2663 * already held down. */ 2530 if (m_ capsLock && !(m_pressedKeys[0x2a] & IsKeyPressed))2664 if (m_fCapsLock && !(m_pressedKeys[0x2a] & IsKeyPressed)) 2531 2665 { 2532 2666 piCodes[(*puCount)++] = 0x2a; … … 2538 2672 2539 2673 /* if (m_uNumLockAdaptionCnt) ... - NumLock isn't implemented by Mac OS X so ignore it. */ 2540 if (m_uCapsLockAdaptionCnt && (m_ capsLock ^ !!(::GetCurrentEventKeyModifiers() & alphaLock)))2674 if (m_uCapsLockAdaptionCnt && (m_fCapsLock ^ !!(::GetCurrentEventKeyModifiers() & alphaLock))) 2541 2675 { 2542 2676 m_uCapsLockAdaptionCnt--; … … 2546 2680 * capslock. For simplicity, only do this if shift is not 2547 2681 * already held down. */ 2548 if (m_ capsLock && !(m_pressedKeys[0x2a] & IsKeyPressed))2682 if (m_fCapsLock && !(m_pressedKeys[0x2a] & IsKeyPressed)) 2549 2683 { 2550 2684 piCodes[(*puCount)++] = 0x2a; … … 2600 2734 void UIMachineView::emitKeyboardStateChanged() 2601 2735 { 2602 emit keyboardStateChanged((m_bIsKeyboardCaptured ? UIViewStateType_KeyboardCaptured : 0) | 2603 (m_bIsHostkeyPressed ? UIViewStateType_HostKeyPressed : 0)); 2736 emit keyboardStateChanged(keyboardState()); 2604 2737 } 2605 2738 2606 2739 void UIMachineView::emitMouseStateChanged() 2607 2740 { 2608 emit mouseStateChanged((m_bIsMouseCaptured ? UIMouseStateType_MouseCaptured : 0) | 2609 (m_bIsMouseAbsolute ? UIMouseStateType_MouseAbsolute : 0) | 2610 (!m_bIsMouseIntegrated ? UIMouseStateType_MouseAbsoluteDisabled : 0)); 2741 emit mouseStateChanged(mouseState()); 2611 2742 } 2612 2743 … … 3078 3209 } 3079 3210 3080 void UIMachineView::setMouseIntegrationLocked(bool bDisabled)3081 {3082 machineWindowWrapper()->machineLogic()->actionsPool()->action(UIActionIndex_Toggle_MouseIntegration)->setChecked(false);3083 machineWindowWrapper()->machineLogic()->actionsPool()->action(UIActionIndex_Toggle_MouseIntegration)->setEnabled(bDisabled);3084 }3085 3086 3211 void UIMachineView::dimImage(QImage &img) 3087 3212 { … … 3156 3281 * the overlay stuff only. */ 3157 3282 if (mDockIconEnabled && 3158 (m _machineState== KMachineState_Running ||3159 m _machineState== KMachineState_Paused ||3160 m _machineState== KMachineState_Teleporting ||3161 m _machineState== KMachineState_LiveSnapshotting ||3162 m _machineState== KMachineState_Restoring ||3163 m _machineState== KMachineState_TeleportingPausedVM ||3164 m _machineState== KMachineState_TeleportingIn ||3165 m _machineState== KMachineState_Saving))3283 (machineState() == KMachineState_Running || 3284 machineState() == KMachineState_Paused || 3285 machineState() == KMachineState_Teleporting || 3286 machineState() == KMachineState_LiveSnapshotting || 3287 machineState() == KMachineState_Restoring || 3288 machineState() == KMachineState_TeleportingPausedVM || 3289 machineState() == KMachineState_TeleportingIn || 3290 machineState() == KMachineState_Saving)) 3166 3291 updateDockIcon(); 3167 3292 else -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r26754 r26773 64 64 virtual void normalizeGeometry(bool bAdjustPosition = false) = 0; 65 65 66 /* Public getters: */ 67 int keyboardState() const; 68 int mouseState() const; 69 66 70 /* Public setters: */ 67 71 void setIgnoreGuestResize(bool bIgnore) { m_bIsGuestResizeIgnored = bIgnore; } 68 void setMouseIntegrationEnabled(bool bEnabled); 72 virtual void setGuestAutoresizeEnabled(bool bEnabled) = 0; 73 virtual void setMouseIntegrationEnabled(bool bEnabled); 69 74 //void setMachineViewFinalized(bool fTrue = true) { m_bIsMachineWindowResizeIgnored = !fTrue; } 70 75 … … 85 90 void resizeHintDone(); 86 91 87 protected slots:88 89 /* Initiate resize request to guest: */90 virtual void doResizeHint(const QSize &aSize = QSize()) = 0;91 92 92 protected: 93 93 94 /* Machine view constructor/destructor: */ 94 95 UIMachineView( UIMachineWindow *pMachineWindow 95 96 , VBoxDefs::RenderMode renderMode … … 108 109 109 110 /* Protected getters: */ 111 KMachineState machineState() const { return m_machineState; } 110 112 VBoxDefs::RenderMode mode() const { return m_mode; } 111 113 QSize sizeHint() const; … … 136 138 137 139 /* Cleanup routines: */ 138 //virtual void saveMachineViewSettings();139 //virtual void cleanupConsoleConnections();140 //virtual void cleanupFilters();140 virtual void saveMachineViewSettings(); 141 virtual void cleanupConsoleConnections() {} 142 virtual void cleanupFilters() {} 141 143 virtual void cleanupCommon(); 142 144 virtual void cleanupFrameBuffer(); 143 145 146 /* Update routines: */ 147 virtual void updateMachineState(); 148 virtual void updateAdditionsState(); 149 virtual void updateMousePointerShape(); 150 virtual void updateMouseCapability(); 151 152 protected slots: 153 154 /* Console callback handlers: */ 155 virtual void sltMachineStateChanged(KMachineState state); 156 virtual void sltAdditionsStateChanged(); 157 virtual void sltKeyboardLedsChanged(bool bNumLock, bool bCapsLock, bool bScrollLock); 158 virtual void sltMousePointerShapeChanged(bool fIsVisible, bool fHasAlpha, 159 uint uXHot, uint uYHot, uint uWidth, uint uHeight, 160 const uchar *pShapeData); 161 virtual void sltMouseCapabilityChanged(bool bIsSupportsAbsolute, bool bNeedsHostCursor); 162 163 /* Initiate resize request to guest: */ 164 virtual void sltPerformGuestResize(const QSize &aSize = QSize()) = 0; 165 144 166 private slots: 145 167 146 void sltMousePointerShapeChange(bool fIsVisible, bool fHasAlpha, 147 uint uXHot, uint uYHot, uint uWidth, uint uHeight, 148 const uchar *pShapeData); 149 void sltMouseCapabilityChange(bool bIsSupportsAbsolute, bool bNeedsHostCursor); 150 void sltKeyboardLedsChange(bool bNumLock, bool bCapsLock, bool bScrollLock); 151 void sltStateChange(KMachineState state); 152 void sltAdditionsStateChange(); 168 /* Watch dog for desktop resizes: */ 169 void sltDesktopResized(); 153 170 154 171 #ifdef Q_WS_MAC … … 213 230 void setPointerShape(const uchar *pShapeData, bool fHasAlpha, 214 231 uint uXHot, uint uYHot, uint uWidth, uint uHeight); 215 void setMouseIntegrationLocked(bool fDisabled);216 232 217 233 /* Private getters: */ 218 234 bool isRunning() { return m_machineState == KMachineState_Running || m_machineState == KMachineState_Teleporting || m_machineState == KMachineState_LiveSnapshotting; } 219 bool shouldHideHostPointer() const { return m_bIsMouseCaptured || (m_bIsMouseAbsolute && m_f HideHostPointer); }235 bool shouldHideHostPointer() const { return m_bIsMouseCaptured || (m_bIsMouseAbsolute && m_fIsHideHostPointer); } 220 236 221 237 static void dimImage(QImage &img); … … 240 256 uint8_t m_pressedKeysCopy[128]; 241 257 242 longm_uNumLockAdaptionCnt;243 longm_uCapsLockAdaptionCnt;258 uint m_uNumLockAdaptionCnt; 259 uint m_uCapsLockAdaptionCnt; 244 260 245 261 bool m_bIsAutoCaptureDisabled : 1; … … 248 264 bool m_bIsMouseAbsolute : 1; 249 265 bool m_bIsMouseIntegrated : 1; 266 bool m_fIsHideHostPointer; 250 267 bool m_bIsHostkeyPressed : 1; 251 268 bool m_bIsHostkeyAlone : 1; 252 bool m_b HostkeyInCapture : 1;269 bool m_bIsHostkeyInCapture : 1; 253 270 bool m_bIsGuestSupportsGraphics : 1; 254 271 bool m_bIsMachineWindowResizeIgnored : 1; 255 272 bool m_bIsFrameBufferResizeIgnored : 1; 256 273 bool m_bIsGuestResizeIgnored : 1; 257 bool m_ numLock : 1;258 bool m_ scrollLock : 1;259 bool m_ capsLock : 1;274 bool m_fNumLock : 1; 275 bool m_fCapsLock : 1; 276 bool m_fScrollLock : 1; 260 277 bool m_fPassCAD; 261 bool m_fHideHostPointer;262 278 #ifdef VBOX_WITH_VIDEOHWACCEL 263 279 bool m_fAccelerate2DVideo; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r26730 r26773 32 32 33 33 #include "UISession.h" 34 #include "UIActionsPool.h" 34 35 #include "UIMachineLogic.h" 35 36 #include "UIMachineWindow.h" … … 66 67 void UIMachineWindow::sltTryClose() 67 68 { 69 /* Do not try to close if restricted: */ 70 if (machineLogic()->isPreventAutoClose()) 71 return; 72 68 73 /* First close any open modal & popup widgets. 69 74 * Use a single shot with timeout 0 to allow the widgets to cleany close and test then again. … … 93 98 } 94 99 100 CSession UIMachineWindow::session() 101 { 102 return m_pMachineLogic->uisession()->session(); 103 } 104 95 105 void UIMachineWindow::retranslateUi() 96 106 { … … 105 115 .arg(RTBldCfgRevisionStr()) 106 116 .arg(VBOX_BLEEDING_EDGE); 107 #endif108 }109 110 void UIMachineWindow::updateAppearanceOf(int iElement)111 {112 CMachine machine = session().GetMachine();113 114 if (iElement & UIVisualElement_WindowCaption)115 {116 QString strSnapshotName;117 if (machine.GetSnapshotCount() > 0)118 {119 CSnapshot snapshot = machine.GetCurrentSnapshot();120 strSnapshotName = " (" + snapshot.GetName() + ")";121 }122 QString strMachineName = machine.GetName() + strSnapshotName;123 if (machineLogic()->machineState() != KMachineState_Null)124 strMachineName += " [" + vboxGlobal().toString(machineLogic()->machineState()) + "] - ";125 strMachineName += m_strWindowTitlePrefix;126 machineWindow()->setWindowTitle(strMachineName);127 128 // TODO: Move that to fullscreen/seamless update routine:129 // mMiniToolBar->setDisplayText(machine.GetName() + strSnapshotName);130 }131 }132 133 void UIMachineWindow::prepareWindowIcon()134 {135 #if !(defined (Q_WS_WIN) || defined (Q_WS_MAC))136 /* The default application icon (will be changed to VM-specific icon little bit later):137 * 1. On Win32, it's built-in to the executable;138 * 2. On Mac OS X the icon referenced in info.plist is used. */139 machineWindow()->setWindowIcon(QIcon(":/VirtualBox_48px.png"));140 #endif141 142 #ifndef Q_WS_MAC143 /* Set the VM-specific application icon except Mac OS X: */144 machineWindow()->setWindowIcon(vboxGlobal().vmGuestOSTypeIcon(session().GetMachine().GetOSTypeId()));145 #endif146 }147 148 void UIMachineWindow::prepareConsoleConnections()149 {150 QObject::connect(machineLogic()->uisession(), SIGNAL(sigStateChange(KMachineState)),151 machineWindow(), SLOT(sltMachineStateChanged(KMachineState)));152 }153 154 void UIMachineWindow::loadWindowSettings()155 {156 #ifdef Q_WS_MAC157 QString testStr = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled).toLower();158 /* Default to true if it is an empty value */159 bool bIsDockIconEnabled = testStr.isEmpty() || testStr == "true";160 if (machineView())161 {162 machineView()->setDockIconEnabled(bIsDockIconEnabled);163 machineView()->updateDockOverlay();164 }165 117 #endif 166 118 } … … 271 223 /* Disable auto closure because we want to have a chance to show 272 224 * the error dialog on save state / power off failure. */ 273 // TODO: process for multiple windows! 274 //m_bNoAutoClose = true; 225 machineLogic()->setPreventAutoClose(true); 275 226 276 227 CConsole console = session().GetConsole(); … … 377 328 } 378 329 379 // TODO: process for multiple windows! 380 //m_bNoAutoClose = false; 330 machineLogic()->setPreventAutoClose(false); 381 331 382 332 if (machineLogic()->machineState() == KMachineState_PoweredOff || … … 421 371 /* Notify all the top-level dialogs about closing */ 422 372 // TODO: Notify about closing! 423 // emit closing(); 424 } 425 } 426 427 CSession UIMachineWindow::session() 428 { 429 return m_pMachineLogic->uisession()->session(); 373 //emit closing(); 374 } 375 } 376 377 void UIMachineWindow::prepareWindowIcon() 378 { 379 #if !(defined (Q_WS_WIN) || defined (Q_WS_MAC)) 380 /* The default application icon (will be changed to VM-specific icon little bit later): 381 * 1. On Win32, it's built-in to the executable; 382 * 2. On Mac OS X the icon referenced in info.plist is used. */ 383 machineWindow()->setWindowIcon(QIcon(":/VirtualBox_48px.png")); 384 #endif 385 386 #ifndef Q_WS_MAC 387 /* Set the VM-specific application icon except Mac OS X: */ 388 machineWindow()->setWindowIcon(vboxGlobal().vmGuestOSTypeIcon(session().GetMachine().GetOSTypeId())); 389 #endif 390 } 391 392 void UIMachineWindow::prepareConsoleConnections() 393 { 394 /* Machine state-change updater: */ 395 QObject::connect(machineLogic()->uisession(), SIGNAL(sigStateChange(KMachineState)), 396 machineWindow(), SLOT(sltMachineStateChanged(KMachineState))); 397 } 398 399 void UIMachineWindow::loadWindowSettings() 400 { 401 #ifdef Q_WS_MAC 402 QString testStr = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled).toLower(); 403 /* Default to true if it is an empty value */ 404 bool bIsDockIconEnabled = testStr.isEmpty() || testStr == "true"; 405 if (machineView()) 406 { 407 machineView()->setDockIconEnabled(bIsDockIconEnabled); 408 machineView()->updateDockOverlay(); 409 } 410 #endif 411 } 412 413 void UIMachineWindow::updateAppearanceOf(int iElement) 414 { 415 CMachine machine = session().GetMachine(); 416 417 if (iElement & UIVisualElement_WindowCaption) 418 { 419 QString strSnapshotName; 420 if (machine.GetSnapshotCount() > 0) 421 { 422 CSnapshot snapshot = machine.GetCurrentSnapshot(); 423 strSnapshotName = " (" + snapshot.GetName() + ")"; 424 } 425 QString strMachineName = machine.GetName() + strSnapshotName; 426 if (machineLogic()->machineState() != KMachineState_Null) 427 strMachineName += " [" + vboxGlobal().toString(machineLogic()->machineState()) + "] - "; 428 strMachineName += m_strWindowTitlePrefix; 429 machineWindow()->setWindowTitle(strMachineName); 430 431 // TODO: Move that to fullscreen/seamless update routine: 432 //mMiniToolBar->setDisplayText(machine.GetName() + strSnapshotName); 433 } 430 434 } 431 435 … … 435 439 } 436 440 441 void UIMachineWindow::sltPrepareMenuMachine() 442 { 443 QMenu *menu = machineLogic()->actionsPool()->action(UIActionIndex_Menu_Machine)->menu(); 444 445 menu->clear(); 446 447 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_Fullscreen)); 448 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_Seamless)); 449 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize)); 450 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_AdjustWindow)); 451 menu->addSeparator(); 452 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_MouseIntegration)); 453 menu->addSeparator(); 454 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_TypeCAD)); 455 #ifdef Q_WS_X11 456 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_TypeCABS)); 457 #endif 458 menu->addSeparator(); 459 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_TakeSnapshot)); 460 menu->addSeparator(); 461 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_InformationDialog)); 462 menu->addSeparator(); 463 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_Pause)); 464 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_Reset)); 465 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_Shutdown)); 466 #ifndef Q_WS_MAC 467 menu->addSeparator(); 468 #endif /* Q_WS_MAC */ 469 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_Close)); 470 } 471 472 void UIMachineWindow::sltPrepareMenuDevices() 473 { 474 QMenu *menu = machineLogic()->actionsPool()->action(UIActionIndex_Menu_Devices)->menu(); 475 476 menu->clear(); 477 478 /* Devices submenu */ 479 menu->addMenu(machineLogic()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices)->menu()); 480 menu->addMenu(machineLogic()->actionsPool()->action(UIActionIndex_Menu_FloppyDevices)->menu()); 481 menu->addMenu(machineLogic()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->menu()); 482 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_NetworkAdaptersDialog)); 483 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_SharedFoldersDialog)); 484 menu->addSeparator(); 485 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_VRDP)); 486 menu->addSeparator(); 487 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_InstallGuestTools)); 488 } 489 490 #ifdef VBOX_WITH_DEBUGGER_GUI 491 void UIMachineWindow::sltPrepareMenuDebug() 492 { 493 QMenu *menu = machineLogic()->actionsPool()->action(UIActionIndex_Menu_Debug)->menu(); 494 495 menu->clear(); 496 497 /* Debug submenu */ 498 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_Statistics)); 499 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_CommandLine)); 500 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_Logging)); 501 } 502 #endif /* VBOX_WITH_DEBUGGER_GUI */ 503 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
r26709 r26773 54 54 protected: 55 55 56 /* Common machine window constructor: */56 /* Machine window constructor/destructor: */ 57 57 UIMachineWindow(UIMachineLogic *pMachineLogic); 58 58 virtual ~UIMachineWindow(); 59 60 /* Protected getters: */ 61 CSession session(); 62 const QString& defaultWindowTitle() const { return m_strWindowTitlePrefix; } 59 63 60 64 /* Translate routine: */ 61 65 virtual void retranslateUi(); 62 66 63 /* Update routines: */64 v irtual void updateAppearanceOf(int iElement);67 /* Common machine window event handlers: */ 68 void closeEvent(QCloseEvent *pEvent); 65 69 66 70 /* Prepare helpers: */ … … 70 74 71 75 /* Cleanup helpers: */ 72 //virtual void saveWindowSettings();73 //virtual void cleanupConsoleConnections();74 //virtual void cleanupWindowIcon();76 virtual void saveWindowSettings() {} 77 virtual void cleanupConsoleConnections() {} 78 virtual void cleanupWindowIcon() {} 75 79 76 /* Common machine window event handlers: */77 v oid closeEvent(QCloseEvent *pEvent);80 /* Update routines: */ 81 virtual void updateAppearanceOf(int iElement); 78 82 79 /* Protected getters: */ 80 CSession session(); 81 const QString& defaultWindowTitle() const { return m_strWindowTitlePrefix; } 82 83 /* Protected signals: */ 83 /* Protected slots: */ 84 84 void sltMachineStateChanged(KMachineState machineState); 85 void sltPrepareMenuMachine(); 86 void sltPrepareMenuDevices(); 87 #ifdef VBOX_WITH_DEBUGGER_GUI 88 void sltPrepareMenuDebug(); 89 #endif 85 90 86 91 /* Protected variables: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
r26709 r26773 55 55 prepareRequiredFeatures(); 56 56 57 /* Load common logic settings: */ 58 loadLogicSettings(); 59 57 60 /* Prepare normal machine window: */ 58 61 prepareMachineWindow(); 59 60 /* Load common logic settings: */61 loadLogicSettings();62 62 } 63 63 64 64 UIMachineLogicNormal::~UIMachineLogicNormal() 65 65 { 66 /* Cleanup normal machine window: */ 67 cleanupMachineWindow(); 68 66 69 /* Save common logic settings: */ 67 70 saveLogicSettings(); 68 69 /* Cleanup normal machine window: */70 cleanupMachineWindow();71 71 } 72 72 … … 74 74 { 75 75 QMenu *menu = qobject_cast<QMenu*>(sender()); 76 AssertMsg(menu, ("This slot should be called only on Network Adapters Menu show!\n"));76 AssertMsg(menu, ("This slot should be called only on Network Adapters menu show!\n")); 77 77 menu->clear(); 78 78 menu->addAction(actionsPool()->action(UIActionIndex_Simple_NetworkAdaptersDialog)); … … 82 82 { 83 83 QMenu *menu = qobject_cast<QMenu*>(sender()); 84 AssertMsg(menu, ("This slot should be called only on Shared Folders Menu show!\n"));84 AssertMsg(menu, ("This slot should be called only on Shared Folders menu show!\n")); 85 85 menu->clear(); 86 86 menu->addAction(actionsPool()->action(UIActionIndex_Simple_SharedFoldersDialog)); … … 97 97 void UIMachineLogicNormal::prepareActionConnections() 98 98 { 99 /* Parentclass connections: */99 /* Base-class connections: */ 100 100 UIMachineLogic::prepareActionConnections(); 101 101 … … 122 122 123 123 /* Create machine window: */ 124 m_pMachineWindowContainer = UIMachineWindow::create(this, visualStateType()); 125 126 /* Get the correct initial machineState() value */ 127 setMachineState(session().GetConsole().GetState()); 124 setMachineWindowWrapper(UIMachineWindow::create(this, visualStateType())); 128 125 129 126 bool bIsSaved = machineState() == KMachineState_Saved; … … 222 219 #endif 223 220 } 224 225 /* Configure view connections: */226 if (machineWindowWrapper()->machineView())227 {228 connect(machineWindowWrapper()->machineView(), SIGNAL(mouseStateChanged(int)),229 this, SLOT(sltMouseStateChanged(int)));230 }231 232 /* Set what view opened: */233 setOpenViewFinished(true);234 221 } 235 222 … … 241 228 242 229 /* Cleanup machine window: */ 243 UIMachineWindow::destroy(m _pMachineWindowContainer);244 m_pMachineWindowContainer = 0;245 } 246 230 UIMachineWindow::destroy(machineWindowWrapper()); 231 setMachineWindowWrapper(0); 232 } 233 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h
r26709 r26773 54 54 void prepareActionConnections(); 55 55 void prepareMachineWindow(); 56 //void loadLogicSettings();57 56 58 57 /* Cleanup helpers: */ 59 //void saveLogicSettings();60 58 void cleanupMachineWindow(); 61 //void cleanupActionConnections();59 void cleanupActionConnections() {} 62 60 63 61 /* Friend classes: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
r26754 r26773 73 73 } 74 74 75 void UIMachineViewNormal::normalizeGeometry(bool bAdjustPosition /* = false */) 76 { 77 /* Make no normalizeGeometry in case we are in manual resize mode or main window is maximized */ 78 if (machineWindowWrapper()->machineWindow()->isMaximized()) 79 return; 80 81 QWidget *pTopLevelWidget = window(); 82 83 /* calculate client window offsets */ 84 QRect fr = pTopLevelWidget->frameGeometry(); 85 QRect r = pTopLevelWidget->geometry(); 86 int dl = r.left() - fr.left(); 87 int dt = r.top() - fr.top(); 88 int dr = fr.right() - r.right(); 89 int db = fr.bottom() - r.bottom(); 90 91 /* get the best size w/o scroll bars */ 92 QSize s = pTopLevelWidget->sizeHint(); 93 94 /* resize the frame to fit the contents */ 95 s -= pTopLevelWidget->size(); 96 fr.setRight(fr.right() + s.width()); 97 fr.setBottom(fr.bottom() + s.height()); 98 99 if (bAdjustPosition) 100 { 101 QRegion ar; 102 QDesktopWidget *dwt = QApplication::desktop(); 103 if (dwt->isVirtualDesktop()) 104 /* Compose complex available region */ 105 for (int i = 0; i < dwt->numScreens(); ++ i) 106 ar += dwt->availableGeometry(i); 107 else 108 /* Get just a simple available rectangle */ 109 ar = dwt->availableGeometry(pTopLevelWidget->pos()); 110 111 fr = VBoxGlobal::normalizeGeometry(fr, ar, mode() != VBoxDefs::SDLMode /* canResize */); 112 } 113 114 #if 0 115 /* Center the frame on the desktop: */ 116 fr.moveCenter(ar.center()); 117 #endif 118 119 /* Finally, set the frame geometry */ 120 pTopLevelWidget->setGeometry(fr.left() + dl, fr.top() + dt, fr.width() - dl - dr, fr.height() - dt - db); 121 } 122 123 void UIMachineViewNormal::maybeRestrictMinimumSize() 124 { 125 /* Sets the minimum size restriction depending on the auto-resize feature state and the current rendering mode. 126 * Currently, the restriction is set only in SDL mode and only when the auto-resize feature is inactive. 127 * We need to do that because we cannot correctly draw in a scrolled window in SDL mode. 128 * In all other modes, or when auto-resize is in force, this function does nothing. */ 129 if (mode() == VBoxDefs::SDLMode) 130 { 131 if (!isGuestSupportsGraphics() || !m_bIsGuestAutoresizeEnabled) 132 setMinimumSize(sizeHint()); 133 else 134 setMinimumSize(0, 0); 135 } 136 } 137 138 void UIMachineViewNormal::doResizeHint(const QSize & /*toSize*/) 75 void UIMachineViewNormal::sltPerformGuestResize(const QSize & /* toSize */) 139 76 { 140 77 #if 0 // TODO: fix that logic! … … 171 108 } 172 109 173 /* If the desktop geometry is set automatically, this will update it. */ 174 void UIMachineViewNormal::doResizeDesktop(int) 175 { 176 calculateDesktopGeometry(); 177 } 178 179 void UIMachineViewNormal::sltToggleGuestAutoresize(bool bOn) 180 { 181 if (m_bIsGuestAutoresizeEnabled != bOn) 182 { 183 m_bIsGuestAutoresizeEnabled = bOn; 184 185 maybeRestrictMinimumSize(); 186 187 if (isGuestSupportsGraphics() && m_bIsGuestAutoresizeEnabled) 188 doResizeHint(); 189 } 190 } 191 192 void UIMachineViewNormal::sltAdditionsStateChanged(const QString & /* strVersion */, bool /* bIsActive */, 193 bool /* bIsSeamlessSupported */, bool bIsGraphicsSupported) 194 { 110 void UIMachineViewNormal::sltAdditionsStateChanged() 111 { 112 /* Base-class additions state-change-handler: */ 113 UIMachineView::sltAdditionsStateChanged(); 114 195 115 /* Enable/Disable guest auto-resizing depending on advanced graphics availablability: */ 196 s ltToggleGuestAutoresize(bIsGraphicsSupported&& m_bIsGuestAutoresizeEnabled);116 setGuestAutoresizeEnabled(isGuestSupportsGraphics() && m_bIsGuestAutoresizeEnabled); 197 117 } 198 118 199 119 void UIMachineViewNormal::prepareFilters() 200 120 { 201 /* P arentclass filters: */121 /* Prepare base-class filters: */ 202 122 UIMachineView::prepareFilters(); 203 123 … … 206 126 } 207 127 128 void UIMachineViewNormal::setGuestAutoresizeEnabled(bool fEnabled) 129 { 130 if (m_bIsGuestAutoresizeEnabled != fEnabled) 131 { 132 m_bIsGuestAutoresizeEnabled = fEnabled; 133 134 maybeRestrictMinimumSize(); 135 136 if (isGuestSupportsGraphics() && m_bIsGuestAutoresizeEnabled) 137 sltPerformGuestResize(); 138 } 139 } 140 141 void UIMachineViewNormal::normalizeGeometry(bool bAdjustPosition /* = false */) 142 { 143 QWidget *pTopLevelWidget = window(); 144 145 /* Make no normalizeGeometry in case we are in manual resize mode or main window is maximized: */ 146 if (pTopLevelWidget->isMaximized()) 147 return; 148 149 /* Calculate client window offsets: */ 150 QRect frameGeo = pTopLevelWidget->frameGeometry(); 151 QRect geo = pTopLevelWidget->geometry(); 152 int dl = geo.left() - frameGeo.left(); 153 int dt = geo.top() - frameGeo.top(); 154 int dr = frameGeo.right() - geo.right(); 155 int db = frameGeo.bottom() - geo.bottom(); 156 157 /* Get the best size w/o scroll bars: */ 158 QSize s = pTopLevelWidget->sizeHint(); 159 160 /* Resize the frame to fit the contents: */ 161 s -= pTopLevelWidget->size(); 162 frameGeo.setRight(frameGeo.right() + s.width()); 163 frameGeo.setBottom(frameGeo.bottom() + s.height()); 164 165 if (bAdjustPosition) 166 { 167 QRegion availableGeo; 168 QDesktopWidget *dwt = QApplication::desktop(); 169 if (dwt->isVirtualDesktop()) 170 /* Compose complex available region */ 171 for (int i = 0; i < dwt->numScreens(); ++ i) 172 availableGeo += dwt->availableGeometry(i); 173 else 174 /* Get just a simple available rectangle */ 175 availableGeo = dwt->availableGeometry(pTopLevelWidget->pos()); 176 177 frameGeo = VBoxGlobal::normalizeGeometry(frameGeo, availableGeo, mode() != VBoxDefs::SDLMode /* canResize */); 178 } 179 180 #if 0 181 /* Center the frame on the desktop: */ 182 frameGeo.moveCenter(availableGeo.center()); 183 #endif 184 185 /* Finally, set the frame geometry */ 186 pTopLevelWidget->setGeometry(frameGeo.left() + dl, frameGeo.top() + dt, frameGeo.width() - dl - dr, frameGeo.height() - dt - db); 187 } 188 189 void UIMachineViewNormal::maybeRestrictMinimumSize() 190 { 191 /* Sets the minimum size restriction depending on the auto-resize feature state and the current rendering mode. 192 * Currently, the restriction is set only in SDL mode and only when the auto-resize feature is inactive. 193 * We need to do that because we cannot correctly draw in a scrolled window in SDL mode. 194 * In all other modes, or when auto-resize is in force, this function does nothing. */ 195 if (mode() == VBoxDefs::SDLMode) 196 { 197 if (!isGuestSupportsGraphics() || !m_bIsGuestAutoresizeEnabled) 198 setMinimumSize(sizeHint()); 199 else 200 setMinimumSize(0, 0); 201 } 202 } 203 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h
r26754 r26773 33 33 protected: 34 34 35 /* Normal machine view constructor/destructor: */ 35 36 UIMachineViewNormal( UIMachineWindow *pMachineWindow 36 37 , VBoxDefs::RenderMode renderMode … … 41 42 virtual ~UIMachineViewNormal(); 42 43 43 void normalizeGeometry(bool bAdjustPosition = false);44 45 void maybeRestrictMinimumSize();46 47 44 private slots: 48 45 49 void doResizeHint(const QSize &aSize = QSize()); 46 /* Console callback handlers: */ 47 void sltAdditionsStateChanged(); 50 48 51 void doResizeDesktop(int); 49 /* Slot to perform guest resize: */ 50 void sltPerformGuestResize(const QSize &aSize = QSize()); 52 51 53 void sltToggleGuestAutoresize(bool bOn);54 55 void sltAdditionsStateChanged(const QString &strVersion, bool bIsActive,56 bool bIsSeamlessSupported, bool bIsGraphicsSupported);57 52 private: 58 53 … … 60 55 void prepareFilters(); 61 56 57 /* Private setters: */ 58 void setGuestAutoresizeEnabled(bool bEnabled); 59 60 /* Private helpers: */ 61 void normalizeGeometry(bool bAdjustPosition = false); 62 void maybeRestrictMinimumSize(); 63 64 /* Private members: */ 62 65 bool m_bIsGuestAutoresizeEnabled : 1; 63 66 67 /* Friend classes: */ 64 68 friend class UIMachineView; 65 69 }; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r26758 r26773 68 68 prepareConnections(); 69 69 70 /* Load normal window settings: */ 71 loadWindowSettings(); 72 73 /* Retranslate normal window finally: */ 74 retranslateUi(); 75 70 76 /* Prepare normal machine view: */ 71 77 prepareMachineView(); 72 78 73 /* Load normal window settings: */74 loadWindowSettings();75 76 /* Retranslate normal window finally: */77 retranslateUi();78 79 79 /* Update all the elements: */ 80 80 updateAppearanceOf(UIVisualElement_AllStuff); … … 93 93 } 94 94 95 void UIMachineWindowNormal::sltTryClose()96 {97 UIMachineWindow::sltTryClose();98 }99 100 95 void UIMachineWindowNormal::sltMachineStateChanged(KMachineState machineState) 101 96 { … … 106 101 { 107 102 KDeviceType type = attachment.GetType(); 108 Assert(type == KDeviceType_DVD || type == KDeviceType_Floppy); 109 updateAppearanceOf(type == KDeviceType_DVD ? UIVisualElement_CDStuff : 110 type == KDeviceType_Floppy ? UIVisualElement_FDStuff : 111 UIVisualElement_AllStuff); 103 if (type == KDeviceType_HardDisk) 104 updateAppearanceOf(UIVisualElement_HDStuff); 105 if (type == KDeviceType_DVD) 106 updateAppearanceOf(UIVisualElement_CDStuff); 107 if (type == KDeviceType_Floppy) 108 updateAppearanceOf(UIVisualElement_FDStuff); 112 109 } 113 110 … … 134 131 void UIMachineWindowNormal::sltPrepareMenuMachine() 135 132 { 136 QMenu *menu = qobject_cast<QMenu*>(sender()); 137 AssertMsg(menu == machineLogic()->actionsPool()->action(UIActionIndex_Menu_Machine)->menu(), 138 ("This slot should only be called on 'Machine' menu hovering!\n")); 139 140 menu->clear(); 141 142 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_Fullscreen)); 143 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_Seamless)); 144 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_GuestAutoresize)); 145 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_AdjustWindow)); 146 menu->addSeparator(); 147 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_MouseIntegration)); 148 menu->addSeparator(); 149 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_TypeCAD)); 150 #ifdef Q_WS_X11 151 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_TypeCABS)); 152 #endif 153 menu->addSeparator(); 154 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_TakeSnapshot)); 155 menu->addSeparator(); 156 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_InformationDialog)); 157 menu->addSeparator(); 158 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_Pause)); 159 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_Reset)); 160 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_Shutdown)); 161 #ifndef Q_WS_MAC 162 menu->addSeparator(); 163 #endif /* Q_WS_MAC */ 164 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_Close)); 133 UIMachineWindow::sltPrepareMenuMachine(); 165 134 } 166 135 167 136 void UIMachineWindowNormal::sltPrepareMenuDevices() 168 137 { 169 QMenu *menu = qobject_cast<QMenu*>(sender()); 170 AssertMsg(menu == machineLogic()->actionsPool()->action(UIActionIndex_Menu_Devices)->menu(), 171 ("This slot should only be called on 'Devices' menu hovering!\n")); 172 173 menu->clear(); 174 175 /* Devices submenu */ 176 menu->addMenu(machineLogic()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices)->menu()); 177 menu->addMenu(machineLogic()->actionsPool()->action(UIActionIndex_Menu_FloppyDevices)->menu()); 178 menu->addMenu(machineLogic()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->menu()); 179 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_NetworkAdaptersDialog)); 180 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_SharedFoldersDialog)); 181 menu->addSeparator(); 182 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_VRDP)); 183 menu->addSeparator(); 184 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_InstallGuestTools)); 138 UIMachineWindow::sltPrepareMenuDevices(); 185 139 } 186 140 … … 188 142 void UIMachineWindowNormal::sltPrepareMenuDebug() 189 143 { 190 QMenu *menu = qobject_cast<QMenu*>(sender()); 191 AssertMsg(menu == machineLogic()->actionsPool()->action(UIActionIndex_Menu_Debug)->menu(), 192 ("This slot should only be called on 'Debug' menu hovering!\n")); 193 194 menu->clear(); 195 196 /* Debug submenu */ 197 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_Statistics)); 198 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Simple_CommandLine)); 199 menu->addAction(machineLogic()->actionsPool()->action(UIActionIndex_Toggle_Logging)); 200 } 201 #endif /* VBOX_WITH_DEBUGGER_GUI */ 144 UIMachineWindow::sltPrepareMenuDebug(); 145 } 146 #endif 147 148 void UIMachineWindowNormal::sltTryClose() 149 { 150 UIMachineWindow::sltTryClose(); 151 } 202 152 203 153 void UIMachineWindowNormal::sltUpdateIndicators() … … 275 225 { 276 226 m_pNameHostkey->setText(QIHotKeyEdit::keyName(vboxGlobal().settings().hostKey())); 277 }278 279 void UIMachineWindowNormal::sltUpdateMouseState(int iState)280 {281 if ((iState & UIMouseStateType_MouseAbsoluteDisabled) &&282 (iState & UIMouseStateType_MouseAbsolute) &&283 !(iState & UIMouseStateType_MouseCaptured))284 {285 indicatorsPool()->indicator(UIIndicatorIndex_Mouse)->setState(4);286 }287 else288 {289 indicatorsPool()->indicator(UIIndicatorIndex_Mouse)->setState(290 iState & (UIMouseStateType_MouseAbsolute | UIMouseStateType_MouseCaptured));291 }292 227 } 293 228 … … 322 257 if (iElement & UIVisualElement_CDStuff) 323 258 indicatorsPool()->indicator(UIIndicatorIndex_OpticalDisks)->updateAppearance(); 324 #if 0 /* TODO: Allow to setup status-bar! */ 325 if (iElement & UIVisualElement_FDStuff) 326 indicatorsPool()->indicator(UIIndicatorIndex_FloppyDisks)->updateAppearance(); 327 #endif 328 if ( iElement & UIVisualElement_USBStuff 329 && !indicatorsPool()->indicator(UIIndicatorIndex_USBDevices)->isHidden()) 330 indicatorsPool()->indicator(UIIndicatorIndex_USBDevices)->updateAppearance(); 259 if (iElement & UIVisualElement_USBStuff && 260 !indicatorsPool()->indicator(UIIndicatorIndex_USBDevices)->isHidden()) 261 indicatorsPool()->indicator(UIIndicatorIndex_USBDevices)->updateAppearance(); 331 262 if (iElement & UIVisualElement_NetworkStuff) 332 263 indicatorsPool()->indicator(UIIndicatorIndex_NetworkAdapters)->updateAppearance(); 333 264 if (iElement & UIVisualElement_SharedFolderStuff) 334 265 indicatorsPool()->indicator(UIIndicatorIndex_SharedFolders)->updateAppearance(); 335 #if 0 /* TODO: Allow to setup status-bar! */336 if (iElement & UIVisualElement_VRDPStuff)337 indicatorsPool()->indicator(UIIndicatorIndex_VRDP)->updateAppearance();338 #endif339 266 if (iElement & UIVisualElement_VirtualizationStuff) 340 267 indicatorsPool()->indicator(UIIndicatorIndex_Virtualization)->updateAppearance(); … … 347 274 case QEvent::Resize: 348 275 { 349 QResizeEvent *pResizeEvent = (QResizeEvent*)pEvent; 350 276 QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent); 351 277 if (!isMaximized()) 352 278 { … … 406 332 void UIMachineWindowNormal::prepareConsoleConnections() 407 333 { 408 /* Parentclass connections: */334 /* Base-class connections: */ 409 335 UIMachineWindow::prepareConsoleConnections(); 410 /* Other console connections: */ 336 337 /* Medium change updater: */ 411 338 connect(machineLogic()->uisession(), SIGNAL(sigMediumChange(const CMediumAttachment &)), 412 339 this, SLOT(sltMediumChange(const CMediumAttachment &))); 340 341 /* USB controller change updater: */ 413 342 connect(machineLogic()->uisession(), SIGNAL(sigUSBControllerChange()), 414 343 this, SLOT(sltUSBControllerChange())); 344 345 /* USB device state-change updater: */ 415 346 connect(machineLogic()->uisession(), SIGNAL(sigUSBDeviceStateChange(const CUSBDevice &, bool, const CVirtualBoxErrorInfo &)), 416 347 this, SLOT(sltUSBDeviceStateChange())); 348 349 /* Network adapter change updater: */ 417 350 connect(machineLogic()->uisession(), SIGNAL(sigNetworkAdapterChange(const CNetworkAdapter &)), 418 351 this, SLOT(sltNetworkAdapterChange())); 352 353 /* Shared folder change updater: */ 419 354 connect(machineLogic()->uisession(), SIGNAL(sigSharedFolderChange()), 420 355 this, SLOT(sltSharedFolderChange())); … … 519 454 void UIMachineWindowNormal::prepareConnections() 520 455 { 521 /* Setup global settings <-> indicators connections: */456 /* Setup global settings change updater: */ 522 457 connect(&vboxGlobal().settings(), SIGNAL(propertyChanged(const char *, const char *)), 523 458 this, SLOT(sltProcessGlobalSettingChange(const char *, const char *))); … … 540 475 , machineLogic()->visualStateType()); 541 476 542 //qobject_cast<QGridLayout*>(centralWidget()->layout())->addWidget(m_pMachineView, 1, 1, Qt::AlignVCenter | Qt::AlignHCenter);543 477 setCentralWidget(m_pMachineView); 544 478 545 /* Setup machine view <-> indicators connections: */ 546 connect(machineView(), SIGNAL(keyboardStateChanged(int)), indicatorsPool()->indicator(UIIndicatorIndex_Hostkey), SLOT(setState(int))); 547 connect(machineView(), SIGNAL(mouseStateChanged(int)), this, SLOT(sltUpdateMouseState(int))); 479 /* Setup machine view connections: */ 480 if (machineView()) 481 { 482 /* Keyboard state-change updater: */ 483 connect(machineView(), SIGNAL(keyboardStateChanged(int)), indicatorsPool()->indicator(UIIndicatorIndex_Hostkey), SLOT(setState(int))); 484 485 /* Mouse state-change updater: */ 486 connect(machineView(), SIGNAL(mouseStateChanged(int)), indicatorsPool()->indicator(UIIndicatorIndex_Mouse), SLOT(setState(int))); 487 488 /* Early initialize required connections: */ 489 indicatorsPool()->indicator(UIIndicatorIndex_Hostkey)->setState(machineView()->keyboardState()); 490 indicatorsPool()->indicator(UIIndicatorIndex_Mouse)->setState(machineView()->mouseState()); 491 } 548 492 } 549 493 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
r26709 r26773 46 46 protected: 47 47 48 /* Normal machine window constructor/destructor: */ 48 49 UIMachineWindowNormal(UIMachineLogic *pMachineLogic); 49 50 virtual ~UIMachineWindowNormal(); … … 51 52 private slots: 52 53 53 void sltTryClose(); 54 54 /* Console callback handlers: */ 55 55 void sltMachineStateChanged(KMachineState machineState); 56 56 void sltMediumChange(const CMediumAttachment &attachment); … … 60 60 void sltSharedFolderChange(); 61 61 62 /* Runtime menus: */ 62 63 void sltPrepareMenuMachine(); 63 64 void sltPrepareMenuDevices(); … … 66 67 #endif 67 68 69 /* LED connections: */ 68 70 void sltUpdateIndicators(); 69 71 void sltShowIndicatorsContextMenu(QIStateIndicator *pIndicator, QContextMenuEvent *pEvent); 70 71 72 void sltProcessGlobalSettingChange(const char *aPublicName, const char *aName); 72 73 73 void sltUpdateMouseState(int iState); 74 /* Close window reimplementation: */ 75 void sltTryClose(); 74 76 75 77 private: … … 96 98 void prepareStatusBar(); 97 99 void prepareConnections(); 100 void loadWindowSettings(); 98 101 void prepareMachineView(); 99 void loadWindowSettings();100 102 101 103 /* Cleanup helpers: */ 104 void cleanupMachineView() {} 102 105 void saveWindowSettings(); 103 //void cleanupMachineView(); 104 //void cleanupConnections(); 106 void cleanupConnections() {} 105 107 void cleanupStatusBar(); 106 //void cleanupMenu();107 void cleanupConsoleConnections() ;108 void cleanupMenu() {} 109 void cleanupConsoleConnections() {} 108 110 109 111 /* Indicators pool: */
Note:
See TracChangeset
for help on using the changeset viewer.