Changeset 15582 in vbox for trunk/src/VBox/Main/MachineImpl.cpp
- Timestamp:
- Dec 16, 2008 1:22:33 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r15496 r15582 187 187 { 188 188 /* default values for a newly created machine */ 189 mHWVersion = "2"; /** @todo get the default from the schema if that is possible. */ 189 190 mMemorySize = 128; 190 191 mCPUCount = 1; … … 220 221 return true; 221 222 222 if (mMemorySize != that.mMemorySize || 223 if (mHWVersion != that.mHWVersion || 224 mMemorySize != that.mMemorySize || 223 225 mMemoryBalloonSize != that.mMemoryBalloonSize || 224 226 mStatisticsUpdateInterval != that.mStatisticsUpdateInterval || … … 907 909 mUserData.backup(); 908 910 mUserData->mOSTypeId = aOSTypeId; 911 912 return S_OK; 913 } 914 915 STDMETHODIMP Machine::COMGETTER(HardwareVersion) (BSTR *aHWVersion) 916 { 917 if (!aHWVersion) 918 return E_POINTER; 919 920 AutoCaller autoCaller (this); 921 CheckComRCReturnRC (autoCaller.rc()); 922 923 AutoReadLock alock (this); 924 925 mHWData->mHWVersion.cloneTo (aHWVersion); 926 927 return S_OK; 928 } 929 930 STDMETHODIMP Machine::COMSETTER(HardwareVersion) (IN_BSTR aHWVersion) 931 { 932 /* check known version */ 933 Utf8Str hwVersion = aHWVersion; 934 if ( hwVersion.compare ("1") != 0 935 && hwVersion.compare ("2") != 0) 936 return setError (E_INVALIDARG, 937 tr ("Invalid hardware version: %ls\n"), aHWVersion); 938 939 AutoCaller autoCaller (this); 940 CheckComRCReturnRC (autoCaller.rc()); 941 942 AutoWriteLock alock (this); 943 944 HRESULT rc = checkStateDependency (MutableStateDep); 945 CheckComRCReturnRC (rc); 946 947 mHWData.backup(); 948 mHWData->mHWVersion = hwVersion; 909 949 910 950 return S_OK; … … 4969 5009 HRESULT rc = S_OK; 4970 5010 5011 /* The hardware version attribute (optional). */ 5012 mHWData->mHWVersion = aNode.stringValue ("version"); 5013 4971 5014 /* CPU node (currently not required) */ 4972 5015 { … … 6357 6400 6358 6401 HRESULT rc = S_OK; 6402 6403 /* The hardware version attribute (optional). 6404 Automatically upgrade from 1 to 2 when there is no saved state. (ugly!) */ 6405 { 6406 Utf8Str hwVersion = mHWData->mHWVersion; 6407 if ( hwVersion.compare ("1") == 0 6408 && mSSData->mStateFilePath.isEmpty()) 6409 mHWData->mHWVersion = hwVersion = "2"; /** @todo Is this safe, to update mHWVersion here? If not some other point needs to be found where this can be done. */ 6410 if (hwVersion.compare ("2") == 0) /** @todo get the default from the schema if possible. */ 6411 aNode.zapValue ("version"); 6412 else 6413 aNode.setStringValue ("version", hwVersion.raw()); 6414 } 6359 6415 6360 6416 /* CPU (optional, but always created atm) */
Note:
See TracChangeset
for help on using the changeset viewer.