Changeset 96638 in vbox
- Timestamp:
- Sep 7, 2022 4:51:44 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMNameOSTypePage.cpp
r96430 r96638 64 64 { QRegularExpression( "(Wi.*NT)|(NT[-._v]*4)", QRegularExpression::CaseInsensitiveOption), "WindowsNT4" }, 65 65 { QRegularExpression( "NT[-._v]*3[.,]*[51x]", QRegularExpression::CaseInsensitiveOption), "WindowsNT3x" }, 66 /* Note: Do not automatically set WindowsXP_64 on 64-bit hosts, as Windows XP 64-bit 67 * is extremely rare -- most users never heard of it even. So always default to 32-bit. */ 68 { QRegularExpression("((Wi.*XP)|(XP)).*", QRegularExpression::CaseInsensitiveOption), "WindowsXP" }, 66 { QRegularExpression("(Wi.*XP.*64)|(XP.*64)", QRegularExpression::CaseInsensitiveOption), "WindowsXP_64" }, 67 { QRegularExpression("(XP)", QRegularExpression::CaseInsensitiveOption), "WindowsXP" }, 69 68 { QRegularExpression("((Wi.*2003)|(W2K3)|(Win2K3)).*64", QRegularExpression::CaseInsensitiveOption), "Windows2003_64" }, 70 69 { QRegularExpression("((Wi.*2003)|(W2K3)|(Win2K3)).*32", QRegularExpression::CaseInsensitiveOption), "Windows2003" }, … … 260 259 }; 261 260 261 static const QRegularExpression gs_Prefer32BitNamePatterns = QRegularExpression("(XP)", QRegularExpression::CaseInsensitiveOption); 262 263 262 264 bool UIWizardNewVMNameOSTypeCommon::guessOSTypeFromName(UINameAndSystemEditor *pNameAndSystemEditor, QString strNewName) 263 265 { 264 266 AssertReturn(pNameAndSystemEditor, false); 265 /* Append default architecture bit-count (64/32) if not already in the name: */ 266 if (!strNewName.contains("32") && !strNewName.contains("64")) 267 268 /* Append default architecture bit-count (64/32) if not already in the name, unless 269 it's XP or similar which is predominantly 32-bit: */ 270 if (!strNewName.contains("32") && !strNewName.contains("64") && !strNewName.contains(gs_Prefer32BitNamePatterns)) 267 271 { 268 272 /** @todo cache this result, no need to re-query it for each keystroke... */ … … 288 292 { 289 293 AssertReturn(pNameAndSystemEditor, false); 290 if (strDetectedOSType.isEmpty()) 291 { 292 pNameAndSystemEditor->setType(uiCommon().vmGuestOSType("Other")); 293 /* Return false to allow OS type guessing from name. See caller code: */ 294 return false; 295 } 296 /* Append 32 as bit-count if the name has no 64 and 32 in the name since API returns a type name with no arch bit count for 32-bit OSs: */ 297 if (!strDetectedOSType.contains("32") && !strDetectedOSType.contains("64")) 298 strDetectedOSType += "32"; 299 300 /* Search for a matching OS type based on the string the user typed already. */ 301 for (size_t i = 0; i < RT_ELEMENTS(gs_OSTypePattern); ++i) 302 { 303 if (strDetectedOSType.contains(gs_OSTypePattern[i].pattern)) 294 if (!strDetectedOSType.isEmpty()) 295 { 296 CGuestOSType const osType = uiCommon().vmGuestOSType(strDetectedOSType); 297 if (!osType.isNull()) 304 298 { 305 306 pNameAndSystemEditor->setType(uiCommon().vmGuestOSType(gs_OSTypePattern[i].pcstId)); 299 pNameAndSystemEditor->setType(osType); 307 300 return true; 308 301 } 309 } 302 /* The detectedOSType shall be a valid OS type ID. So, unless the UI is 303 out of sync with the types in main this shouldn't ever happen. */ 304 AssertFailed(); 305 } 306 pNameAndSystemEditor->setType(uiCommon().vmGuestOSType("Other")); 307 /* Return false to allow OS type guessing from name. See caller code: */ 308 /** @todo the caller doesn't actually re-guess from the name, which leaves it 309 * with this annoying 'other' selection. */ 310 310 return false; 311 311 } … … 617 617 if (m_pNameAndSystemEditor) 618 618 m_pNameAndSystemEditor->setEditionNameAndIndices(pWizard->detectedWindowsImageNames(), 619 pWizard->detectedWindowsImageIndices());619 pWizard->detectedWindowsImageIndices()); 620 620 621 621 setSkipCheckBoxEnable();
Note:
See TracChangeset
for help on using the changeset viewer.

