VirtualBox

Changeset 81457 in vbox for trunk


Ignore:
Timestamp:
Oct 22, 2019 4:47:06 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134177
Message:

FE/Qt: bugref:9314: VM settings / Display page: Warn user if current graphics controller type doesn't match recommended one; This also implies auto-correction upon settings being confirmed in case when 3D acceleration was enabled.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r79365 r81457  
    450450    if (m_machine.isOk())
    451451    {
    452         /* Guest OS type & VT-x/AMD-V option correlation auto-fix: */
    453452        UIMachineSettingsGeneral *pGeneralPage =
    454453            qobject_cast<UIMachineSettingsGeneral*>(m_pSelector->idToPage(MachineSettingsPageType_General));
    455454        UIMachineSettingsSystem *pSystemPage =
    456455            qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(MachineSettingsPageType_System));
     456#if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_3D_ACCELERATION)
     457        UIMachineSettingsDisplay *pDisplayPage =
     458            qobject_cast<UIMachineSettingsDisplay*>(m_pSelector->idToPage(MachineSettingsPageType_Display));
     459#endif /* VBOX_WITH_VIDEOHWACCEL || VBOX_WITH_3D_ACCELERATION */
     460
     461        /* Guest OS type & VT-x/AMD-V option correlation auto-fix: */
    457462        if (pGeneralPage && pSystemPage &&
    458463            pGeneralPage->is64BitOSTypeSelected() && !pSystemPage->isHWVirtExEnabled())
     
    463468        if (pGeneralPage && !pGeneralPage->isWindowsOSTypeSelected())
    464469        {
    465             UIMachineSettingsDisplay *pDisplayPage =
    466                 qobject_cast<UIMachineSettingsDisplay*>(m_pSelector->idToPage(MachineSettingsPageType_Display));
    467470            if (pDisplayPage && pDisplayPage->isAcceleration2DVideoSelected())
    468471                m_machine.SetAccelerate2DVideoEnabled(false);
    469472        }
    470473#endif /* VBOX_WITH_VIDEOHWACCEL */
     474
     475#ifdef VBOX_WITH_3D_ACCELERATION
     476        /* Adjust graphics controller type if necessary: */
     477        if (   pDisplayPage
     478            && pDisplayPage->isAcceleration3DSelected()
     479            && pDisplayPage->graphicsControllerTypeCurrent() != pDisplayPage->graphicsControllerTypeRecommended())
     480            m_machine.SetGraphicsControllerType(pDisplayPage->graphicsControllerTypeRecommended());
     481#endif /* VBOX_WITH_3D_ACCELERATION */
    471482
    472483        /* Enable OHCI controller if HID is enabled but no USB controllers present: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r80720 r81457  
    293293    , m_f2DVideoAccelerationSupported(false)
    294294#endif
     295    , m_enmGraphicsControllerTypeRecommended(KGraphicsControllerType_Null)
    295296    , m_pCache(0)
    296297{
     
    327328    m_pVideoMemoryEditor->set2DVideoAccelerationSupported(m_f2DVideoAccelerationSupported);
    328329#endif
     330    /* Acquire recommended graphics controller type: */
     331    m_enmGraphicsControllerTypeRecommended = m_comGuestOSType.GetRecommendedGraphicsController();
    329332
    330333    /* Revalidate: */
     
    332335}
    333336
     337#ifdef VBOX_WITH_3D_ACCELERATION
     338bool UIMachineSettingsDisplay::isAcceleration3DSelected() const
     339{
     340    return m_pCheckbox3D->isChecked();
     341}
     342#endif /* VBOX_WITH_3D_ACCELERATION */
     343
    334344#ifdef VBOX_WITH_VIDEOHWACCEL
    335345bool UIMachineSettingsDisplay::isAcceleration2DVideoSelected() const
     
    338348}
    339349#endif /* VBOX_WITH_VIDEOHWACCEL */
     350
     351KGraphicsControllerType UIMachineSettingsDisplay::graphicsControllerTypeCurrent() const
     352{
     353    return m_pGraphicsControllerEditor->value();
     354}
    340355
    341356bool UIMachineSettingsDisplay::changed() const
     
    636651        }
    637652#endif /* VBOX_WITH_VIDEOHWACCEL */
     653
     654        /* Graphics controller type test: */
     655        if (!m_comGuestOSType.isNull())
     656        {
     657            if (m_pGraphicsControllerEditor->value() != m_enmGraphicsControllerTypeRecommended)
     658            {
     659#ifdef VBOX_WITH_3D_ACCELERATION
     660                if (m_pCheckbox3D->isChecked())
     661                    message.second << tr("The virtual machine is configured to use 3D acceleration. This will work only if you "
     662                                         "pick a different graphics controller (%1). Either disable 3D acceleration or switch "
     663                                         "to required graphics controller type. The latter will be done automatically if you "
     664                                         "confirm your changes.")
     665                                         .arg(gpConverter->toString(m_enmGraphicsControllerTypeRecommended));
     666                else
     667#endif /* VBOX_WITH_3D_ACCELERATION */
     668                    message.second << tr("The virtual machine is configured to use a graphics controller other than the "
     669                                         "recommended one (%1). Please consider switching unless you have a reason to keep the "
     670                                         "currently selected graphics controller.")
     671                                         .arg(gpConverter->toString(m_enmGraphicsControllerTypeRecommended));
     672            }
     673        }
    638674
    639675        /* Serialize message: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r80394 r81457  
    5050    void setGuestOSType(CGuestOSType comGuestOSType);
    5151
     52#ifdef VBOX_WITH_3D_ACCELERATION
     53    /** Returns whether 3D Acceleration is enabled. */
     54    bool isAcceleration3DSelected() const;
     55#endif
    5256#ifdef VBOX_WITH_VIDEOHWACCEL
    5357    /** Returns whether 2D Video Acceleration is enabled. */
    5458    bool isAcceleration2DVideoSelected() const;
    5559#endif
     60
     61    /** Returns recommended graphics controller type. */
     62    KGraphicsControllerType graphicsControllerTypeRecommended() const { return m_enmGraphicsControllerTypeRecommended; }
     63    /** Returns current graphics controller type. */
     64    KGraphicsControllerType graphicsControllerTypeCurrent() const;
    5665
    5766protected:
     
    172181    bool          m_f2DVideoAccelerationSupported;
    173182#endif
     183    /** Holds recommended graphics controller type. */
     184    KGraphicsControllerType  m_enmGraphicsControllerTypeRecommended;
    174185
    175186    /** Holds the page data cache instance. */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette