VirtualBox

Changeset 75813 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 29, 2018 12:57:51 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9314. Adding a combo box to machine settings->display->settings to change machine's graphics controller type

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h

    r75626 r75813  
    142142template<> SHARED_LIBRARY_STUFF bool canConvert<KAudioControllerType>();
    143143template<> SHARED_LIBRARY_STUFF bool canConvert<KAuthType>();
     144template<> SHARED_LIBRARY_STUFF bool canConvert<KGraphicsControllerType>();
    144145template<> SHARED_LIBRARY_STUFF bool canConvert<KStorageBus>();
    145146template<> SHARED_LIBRARY_STUFF bool canConvert<KStorageControllerType>();
     
    287288template<> SHARED_LIBRARY_STUFF QString toString(const KAuthType &type);
    288289template<> SHARED_LIBRARY_STUFF KAuthType fromString<KAuthType>(const QString &strType);
     290template<> SHARED_LIBRARY_STUFF QString toString(const KGraphicsControllerType &type);
     291template<> SHARED_LIBRARY_STUFF KGraphicsControllerType fromString<KGraphicsControllerType>(const QString &strType);
    289292template<> SHARED_LIBRARY_STUFF QString toString(const KStorageBus &bus);
    290293template<> SHARED_LIBRARY_STUFF QString toString(const KStorageControllerType &type);
     
    297300
    298301#endif /* !___UIConverterBackend_h___ */
    299 
  • trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp

    r73716 r75813  
    5555template<> bool canConvert<KAudioControllerType>() { return true; }
    5656template<> bool canConvert<KAuthType>() { return true; }
     57template<> bool canConvert<KGraphicsControllerType>() { return true; }
    5758template<> bool canConvert<KStorageBus>() { return true; }
    5859template<> bool canConvert<KStorageControllerType>() { return true; }
     
    542543}
    543544
     545/* QString <= KGraphicsControllerType: */
     546template<> QString toString(const KGraphicsControllerType &type)
     547{
     548    switch (type)
     549    {
     550        case KGraphicsControllerType_Null:     return QApplication::translate("VBoxGlobal", "Null",     "GraphicsControllerType");
     551        case KGraphicsControllerType_VBoxVGA:  return QApplication::translate("VBoxGlobal", "VBoxVGA",  "GraphicsControllerType");
     552        case KGraphicsControllerType_VMSVGA:   return QApplication::translate("VBoxGlobal", "VMSVGA",   "GraphicsControllerType");
     553        case KGraphicsControllerType_VBoxSVGA: return QApplication::translate("VBoxGlobal", "VBoxSVGA", "GraphicsControllerType");
     554        default: AssertMsgFailed(("No text for %d", type)); break;
     555    }
     556    return QString();
     557}
     558
     559/* KGraphicsControllerType <= QString: */
     560template<> KGraphicsControllerType fromString<KGraphicsControllerType>(const QString &strType)
     561{
     562    QHash<QString, KGraphicsControllerType> list;
     563    list.insert(QApplication::translate("VBoxGlobal", "Null",     "GraphicsControllerType"), KGraphicsControllerType_Null);
     564    list.insert(QApplication::translate("VBoxGlobal", "VBoxVGA",  "GraphicsControllerType"), KGraphicsControllerType_VBoxVGA);
     565    list.insert(QApplication::translate("VBoxGlobal", "VMSVGA",  "GraphicsControllerType"), KGraphicsControllerType_VMSVGA);
     566    list.insert(QApplication::translate("VBoxGlobal", "VBoxSVGA", "GraphicsControllerType"), KGraphicsControllerType_VBoxSVGA);
     567    if (!list.contains(strType))
     568    {
     569        AssertMsgFailed(("No value for '%s'", strType.toUtf8().constData()));
     570    }
     571    return list.value(strType, KGraphicsControllerType_Null);
     572}
     573
    544574/* QString <= KStorageBus: */
    545575template<> QString toString(const KStorageBus &bus)
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r75368 r75813  
    5353        , m_f2dAccelerationEnabled(false)
    5454#endif /* VBOX_WITH_VIDEOHWACCEL */
     55        , m_graphicsControllerType(KGraphicsControllerType_Null)
    5556        , m_fRemoteDisplayServerSupported(false)
    5657        , m_fRemoteDisplayServerEnabled(false)
     
    8081               && (m_f2dAccelerationEnabled == other.m_f2dAccelerationEnabled)
    8182#endif /* VBOX_WITH_VIDEOHWACCEL */
     83               && (m_graphicsControllerType == other.m_graphicsControllerType)
    8284               && (m_fRemoteDisplayServerSupported == other.m_fRemoteDisplayServerSupported)
    8385               && (m_fRemoteDisplayServerEnabled == other.m_fRemoteDisplayServerEnabled)
     
    252254    bool    m_f2dAccelerationEnabled;
    253255#endif /* VBOX_WITH_VIDEOHWACCEL */
    254 
     256    /** Holds the graphics controller type of the virtual machine. */
     257    KGraphicsControllerType m_graphicsControllerType;
    255258    /** Holds whether the remote display server is supported. */
    256259    bool       m_fRemoteDisplayServerSupported;
     
    368371    oldDisplayData.m_f2dAccelerationEnabled = m_machine.GetAccelerate2DVideoEnabled();
    369372#endif
    370 
     373    oldDisplayData.m_graphicsControllerType = m_machine.GetGraphicsControllerType();
    371374    /* Check whether remote display server is valid: */
    372375    const CVRDEServer &vrdeServer = m_machine.GetVRDEServer();
     
    432435    m_pCheckbox2DVideo->setChecked(oldDisplayData.m_f2dAccelerationEnabled);
    433436#endif
     437    m_pComboGraphicsControllerType->setCurrentIndex((int)oldDisplayData.m_graphicsControllerType);
    434438    // Should be the last one for this tab:
    435439    m_pEditorVideoMemorySize->setValue(oldDisplayData.m_iCurrentVRAM);
     
    490494    newDisplayData.m_f2dAccelerationEnabled = m_pCheckbox2DVideo->isChecked();
    491495#endif
    492 
     496    newDisplayData.m_graphicsControllerType = (KGraphicsControllerType) m_pComboGraphicsControllerType->currentIndex();
    493497    /* If remote display server is supported: */
    494498    newDisplayData.m_fRemoteDisplayServerSupported = m_pCache->base().m_fRemoteDisplayServerSupported;
     
    680684#ifdef VBOX_WITH_VIDEOHWACCEL
    681685    setTabOrder(m_pCheckbox3D, m_pCheckbox2DVideo);
    682     setTabOrder(m_pCheckbox2DVideo, m_pCheckboxRemoteDisplay);
     686    setTabOrder(m_pCheckbox2DVideo, m_pComboGraphicsControllerType);
    683687#else /* VBOX_WITH_VIDEOHWACCEL */
    684     setTabOrder(m_pCheckbox3D, m_pCheckboxRemoteDisplay);
     688    setTabOrder(m_pCheckbox3D, m_pComboGraphicsControllerType);
    685689#endif /* !VBOX_WITH_VIDEOHWACCEL */
     690    setTabOrder(m_pComboGraphicsControllerType, m_pCheckboxRemoteDisplay);
    686691
    687692    /* Remote Display tab-order: */
     
    760765    m_pCheckbox2DVideo->hide();
    761766#endif /* !VBOX_WITH_VIDEOHWACCEL */
     767    m_pComboGraphicsControllerType->setEnabled(isMachineOffline());
    762768
    763769    /* Polish 'Remote Display' availability: */
     
    10441050            m_pComboRemoteDisplayAuthMethod->insertItem(1, ""); /* KAuthType_External */
    10451051            m_pComboRemoteDisplayAuthMethod->insertItem(2, ""); /* KAuthType_Guest */
     1052        }
     1053        AssertPtrReturnVoid(m_pComboGraphicsControllerType);
     1054        {
     1055            m_pComboGraphicsControllerType->insertItem((int)KGraphicsControllerType_Null, gpConverter->toString(KGraphicsControllerType_Null));
     1056            m_pComboGraphicsControllerType->insertItem((int)KGraphicsControllerType_VBoxVGA, gpConverter->toString(KGraphicsControllerType_VBoxVGA));
     1057            m_pComboGraphicsControllerType->insertItem((int)KGraphicsControllerType_VMSVGA, gpConverter->toString(KGraphicsControllerType_VMSVGA));
     1058            m_pComboGraphicsControllerType->insertItem((int)KGraphicsControllerType_VBoxSVGA, gpConverter->toString(KGraphicsControllerType_VBoxSVGA));
    10461059        }
    10471060    }
     
    14131426        }
    14141427#endif
     1428        /* Save the Graphics Controller Type: */
     1429        if (fSuccess && isMachineOffline() && newDisplayData.m_graphicsControllerType != oldDisplayData.m_graphicsControllerType)
     1430        {
     1431            m_machine.SetGraphicsControllerType(newDisplayData.m_graphicsControllerType);
     1432            fSuccess = m_machine.isOk();
     1433        }
    14151434
    14161435        /* Get machine ID for further activities: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui

    r74872 r75813  
    211211            </property>
    212212           </widget>
     213          </item>
     214          <item row="8" column="0">
     215           <widget class="QLabel" name="m_pLabelGraphicsControllerType">
     216            <property name="text">
     217             <string>&amp;Graphics Controller:</string>
     218            </property>
     219            <property name="alignment">
     220             <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
     221            </property>
     222            <property name="buddy">
     223             <cstring>m_pComboGraphicsControllerType</cstring>
     224            </property>
     225           </widget>
     226          </item>
     227          <item row="8" column="1" colspan="3">
     228           <layout class="QHBoxLayout">
     229            <item>
     230             <widget class="QComboBox" name="m_pComboGraphicsControllerType" >
     231              <property name="sizePolicy" >
     232               <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
     233                <horstretch>0</horstretch>
     234                <verstretch>0</verstretch>
     235               </sizepolicy>
     236              </property>
     237              <property name="whatsThis" >
     238               <string>Selects the graphics adapter type the virtual machine will use.</string>
     239              </property>
     240             </widget>
     241            </item>
     242            <item>
     243             <spacer name="m_pSpacerHorizontalGraphicsAdapterType">
     244              <property name="orientation">
     245               <enum>Qt::Horizontal</enum>
     246              </property>
     247              <property name="sizeHint" stdset="0">
     248               <size>
     249                <width>0</width>
     250                <height>0</height>
     251               </size>
     252              </property>
     253             </spacer>
     254            </item>
     255           </layout>
    213256          </item>
    214257         </layout>
Note: See TracChangeset for help on using the changeset viewer.

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