Changeset 22318 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 18, 2009 10:56:49 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 51201
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r22304 r22318 1419 1419 mHWData.backup(); 1420 1420 mHWData->mAccelerate2DVideoEnabled = enable; 1421 1422 // this feature may require an XML version bump1423 if (enable)1424 mData->m_pMachineConfigFile->setRequiredSettingsVersion(SettingsVersion_v1_8);1425 1421 1426 1422 return S_OK; -
trunk/src/VBox/Main/xml/Settings.cpp
r22302 r22318 379 379 * root "VirtualBox" element set up. This is used by both 380 380 * MainConfigFile and MachineConfigFile when writing out their XML. 381 * 382 * Before calling this, it is the responsibility of the caller to 383 * set the "sv" member to the required settings version that is to 384 * be written. For newly created files, the settings version will be 385 * the latest (1.8); for files read in from disk earlier, it will be 386 * the settings version indicated in the file. However, this method 387 * will silently make sure that the settings version is always 388 * at least 1.7 and change it if necessary, since there is no write 389 * support for earlier settings versions. 381 390 */ 382 391 void ConfigFileBase::createStubDocument() … … 388 397 m->pelmRoot->setAttribute("xmlns", VBOX_XML_NAMESPACE); 389 398 390 // we always write at least version 1.7; we write 1.8391 // if that was requested thru setRequiredSettingsVersion().392 // we make no attempt at writing earlier versions.393 // Writing 1.6 would be messy for machine files because394 // of the hard disk attachment changes which are not395 // necessarily backwards compatible and we don't want to396 // introduce complex logic to see whether they are.397 399 const char *pcszVersion = NULL; 398 400 switch (m->sv) … … 403 405 404 406 default: 407 // silently upgrade if necessary 405 408 pcszVersion = "1.7"; 406 409 m->sv = SettingsVersion_v1_7; … … 2197 2200 void MachineConfigFile::write(const com::Utf8Str &strFilename) 2198 2201 { 2202 // createStubDocument() sets the settings version to at least 1.7; however, 2203 // we might need to enfore a later settings version if incompatible settings 2204 // are present: 2205 if (m->sv < SettingsVersion_v1_8) 2206 { 2207 if (hardwareMachine.fAccelerate2DVideo) 2208 m->sv = SettingsVersion_v1_8; 2209 } 2210 2199 2211 m->strFilename = strFilename; 2200 2212 createStubDocument(); … … 2238 2250 clearDocument(); 2239 2251 } 2240 2241 /**2242 * Called from Main code if settings are enabled that require a new settings2243 * version. For example, if someone enables 2D video acceleration, which is a2244 * new feature with VirtualBox 3.1 and which requires settings version 1.8,2245 * COMSETTER(Accelerate2DVideoEnabled) calls this method to make sure2246 * at least settings version 1.8 is enabled.2247 *2248 * This allows us to preserve the settings format for older machines and2249 * break it only if necessary, on a per-machine basis.2250 * @param sv2251 */2252 void MachineConfigFile::setRequiredSettingsVersion(SettingsVersion_T sv)2253 {2254 if (m->sv < sv)2255 m->sv = sv;2256 }
Note:
See TracChangeset
for help on using the changeset viewer.