VirtualBox

Changeset 67625 in vbox


Ignore:
Timestamp:
Jun 27, 2017 9:20:27 AM (8 years ago)
Author:
vboxsync
Message:

Main/Machine+Main/xml: use default hardware version from XML schema for settings

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r67618 r67625  
    154154{
    155155    /* default values for a newly created machine */
    156     mHWVersion = "2"; /** @todo get the default from the schema if that is possible. */
     156    mHWVersion = Utf8StrFmt("%d", SchemaDefs::DefaultHardwareVersion)
    157157    mMemorySize = 128;
    158158    mCPUCount = 1;
     
    13851385    Utf8Str hwVersion = aHardwareVersion;
    13861386    if (    hwVersion.compare("1") != 0
    1387         &&  hwVersion.compare("2") != 0)
     1387        &&  hwVersion.compare("2") != 0)    // VBox 2.1.x and later (VMMDev heap)
    13881388        return setError(E_INVALIDARG,
    13891389                        tr("Invalid hardware version: %s\n"), aHardwareVersion.c_str());
     
    1028610286    {
    1028710287        /* The hardware version attribute (optional).
    10288             Automatically upgrade from 1 to 2 when there is no saved state. (ugly!) */
     10288           Automatically upgrade from 1 to current default hardware version
     10289           when there is no saved state. (ugly!) */
    1028910290        if (    mHWData->mHWVersion == "1"
    1029010291             && mSSData->strStateFilePath.isEmpty()
    1029110292           )
    10292             mHWData->mHWVersion = "2";  /** @todo Is this safe, to update mHWVersion here? If not some
    10293                                             other point needs to be found where this can be done. */
     10293            mHWData->mHWVersion = Utf8StrFmt("%d", SchemaDefs::DefaultHardwareVersion);
    1029410294
    1029510295        data.strVersion = mHWData->mHWVersion;
  • trunk/src/VBox/Main/xml/SchemaDefs.xsl

    r59925 r67625  
    4343    <xsl:param name="select"/>
    4444    <xsl:if test="$select">
    45       <xsl:value-of select="concat($member, ' = ', $select, ',&#x0A;')"/>
     45      <xsl:value-of select="concat('        ', $member, ' = ', $select, ',&#x0A;')"/>
    4646    </xsl:if>
    4747</xsl:template>
     
    125125
    126126  <xsl:call-template name="defineEnumMember">
    127     <xsl:with-param name="member" select="'        MinGuestRAM'"/>
     127    <xsl:with-param name="member" select="'MinGuestRAM'"/>
    128128    <xsl:with-param name="select" select="
    129129      xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:minInclusive/@value
     
    131131  </xsl:call-template>
    132132  <xsl:call-template name="defineEnumMember">
    133     <xsl:with-param name="member" select="'        MaxGuestRAM'"/>
     133    <xsl:with-param name="member" select="'MaxGuestRAM'"/>
    134134    <xsl:with-param name="select" select="
    135135      xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:maxInclusive/@value
     
    138138
    139139  <xsl:call-template name="defineEnumMember">
    140     <xsl:with-param name="member" select="'        MinGuestVRAM'"/>
     140    <xsl:with-param name="member" select="'MinGuestVRAM'"/>
    141141    <xsl:with-param name="select" select="
    142142      xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:minInclusive/@value
     
    144144  </xsl:call-template>
    145145  <xsl:call-template name="defineEnumMember">
    146     <xsl:with-param name="member" select="'        MaxGuestVRAM'"/>
     146    <xsl:with-param name="member" select="'MaxGuestVRAM'"/>
    147147    <xsl:with-param name="select" select="
    148148      xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:maxInclusive/@value
     
    151151
    152152  <xsl:call-template name="defineEnumMember">
    153     <xsl:with-param name="member" select="'        MinCPUCount'"/>
     153    <xsl:with-param name="member" select="'MinCPUCount'"/>
    154154    <xsl:with-param name="select" select="
    155155      xsd:simpleType[@name='TCPUCount']//xsd:minInclusive/@value
     
    157157  </xsl:call-template>
    158158  <xsl:call-template name="defineEnumMember">
    159     <xsl:with-param name="member" select="'        MaxCPUCount'"/>
     159    <xsl:with-param name="member" select="'MaxCPUCount'"/>
    160160    <xsl:with-param name="select" select="
    161161      xsd:simpleType[@name='TCPUCount']//xsd:maxInclusive/@value
     
    164164
    165165  <xsl:call-template name="defineEnumMember">
    166     <xsl:with-param name="member" select="'        MaxGuestMonitors'"/>
     166    <xsl:with-param name="member" select="'MaxGuestMonitors'"/>
    167167    <xsl:with-param name="select" select="
    168168      xsd:simpleType[@name='TMonitorCount']//xsd:maxInclusive/@value
     
    171171
    172172  <xsl:call-template name="defineEnumMember">
    173     <xsl:with-param name="member" select="'        SerialPortCount'"/>
     173    <xsl:with-param name="member" select="'SerialPortCount'"/>
    174174    <xsl:with-param name="select" select="
    175175      xsd:complexType[@name='TUARTPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
     
    178178
    179179  <xsl:call-template name="defineEnumMember">
    180     <xsl:with-param name="member" select="'        ParallelPortCount'"/>
     180    <xsl:with-param name="member" select="'ParallelPortCount'"/>
    181181    <xsl:with-param name="select" select="
    182182      xsd:complexType[@name='TLPTPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value
     
    185185
    186186  <xsl:call-template name="defineEnumMember">
    187     <xsl:with-param name="member" select="'        MaxBootPosition'"/>
     187    <xsl:with-param name="member" select="'MaxBootPosition'"/>
    188188    <xsl:with-param name="select" select="
    189189      xsd:complexType[@name='TBoot']//xsd:element[@name='Order']//xsd:attribute[@name='position']//xsd:maxInclusive/@value
     190    "/>
     191  </xsl:call-template>
     192
     193  <xsl:call-template name="defineEnumMember">
     194    <xsl:with-param name="member" select="'DefaultHardwareVersion'"/>
     195    <xsl:with-param name="select" select="
     196      xsd:complexType[@name='THardware']/xsd:attribute[@name='version']/@default
    190197    "/>
    191198  </xsl:call-template>
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