Changeset 73130 in vbox
- Timestamp:
- Jul 13, 2018 4:29:34 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123718
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r73117 r73130 303 303 #ifdef VBOX_WITH_VIDEOHWACCEL 304 304 /* Check if 2D video acceleration supported by the guest OS type: */ 305 const QString strGuestOSTypeFamily = m_comGuestOSType. GetFamilyId();305 const QString strGuestOSTypeFamily = m_comGuestOSType.isNotNull() ? m_comGuestOSType.GetFamilyId() : QString(); 306 306 m_f2DVideoAccelerationSupported = strGuestOSTypeFamily == "Windows"; 307 307 #endif 308 308 #ifdef VBOX_WITH_CRHGSMI 309 309 /* Check if WDDM mode supported by the guest OS type: */ 310 const QString strGuestOSTypeId = m_comGuestOSType. GetId();310 const QString strGuestOSTypeId = m_comGuestOSType.isNotNull() ? m_comGuestOSType.GetId() : QString(); 311 311 m_fWddmModeSupported = VBoxGlobal::isWddmCompatibleOsType(strGuestOSTypeId); 312 312 #endif … … 1259 1259 QStringList excludingOSList = QStringList() 1260 1260 << "Other" << "DOS" << "Netware" << "L4" << "QNX" << "JRockitVE"; 1261 if ( excludingOSList.contains(m_comGuestOSType.GetId()))1261 if (m_comGuestOSType.isNull() || excludingOSList.contains(m_comGuestOSType.GetId())) 1262 1262 fResult = false; 1263 1263 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r72177 r73130 143 143 { 144 144 AssertPtrReturn(m_pNameAndSystemEditor, false); 145 return m_pNameAndSystemEditor->type().GetIs64Bit(); 145 return m_pNameAndSystemEditor->type().isNotNull() 146 ? m_pNameAndSystemEditor->type().GetIs64Bit() 147 : false; 146 148 } 147 149 … … 150 152 { 151 153 AssertPtrReturn(m_pNameAndSystemEditor, false); 152 return m_pNameAndSystemEditor-> type().GetFamilyId() == "Windows";154 return m_pNameAndSystemEditor->familyId() == "Windows"; 153 155 } 154 156 #endif /* VBOX_WITH_VIDEOHWACCEL */ … … 248 250 AssertPtrReturnVoid(m_pNameAndSystemEditor); 249 251 m_pNameAndSystemEditor->setName(oldGeneralData.m_strName); 250 m_pNameAndSystemEditor->setType (vboxGlobal().vmGuestOSType(oldGeneralData.m_strGuestOsTypeId));252 m_pNameAndSystemEditor->setTypeId(oldGeneralData.m_strGuestOsTypeId); 251 253 252 254 /* Load old 'Advanced' data from the cache: */ … … 286 288 AssertPtrReturnVoid(m_pNameAndSystemEditor); 287 289 newGeneralData.m_strName = m_pNameAndSystemEditor->name(); 288 newGeneralData.m_strGuestOsTypeId = m_pNameAndSystemEditor->type ().GetId();290 newGeneralData.m_strGuestOsTypeId = m_pNameAndSystemEditor->typeId(); 289 291 290 292 /* Gather new 'Advanced' data: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r73129 r73130 85 85 } 86 86 87 void UINameAndSystemEditor::setTypeId(const QString &strTypeId, const QString &strFamilyId /* = QString() */) 88 { 89 AssertMsgReturnVoid(!strTypeId.isNull(), ("Null guest OS type ID")); 90 91 /* Save values: */ 92 m_strTypeId = strTypeId; 93 m_strFamilyId = strFamilyId; 94 95 /* If family ID isn't null: */ 96 if (!m_strFamilyId.isNull()) 97 { 98 /* Serch for corresponding family ID index: */ 99 int iFamilyIndex = m_pComboFamily->findData(m_strFamilyId, TypeID); 100 101 /* If that family ID isn't present, we have to add it: */ 102 if (iFamilyIndex == -1) 103 { 104 /* Append family ID to corresponding combo: */ 105 m_pComboFamily->addItem(m_strFamilyId); 106 m_pComboFamily->setItemData(m_pComboFamily->count() - 1, m_strFamilyId, TypeID); 107 108 /* Serch for corresponding family ID index again: */ 109 iFamilyIndex = m_pComboFamily->findData(m_strFamilyId, TypeID); 110 111 /* Append the type cache: */ 112 m_types[m_strFamilyId] = QList<UIGuestOSType>(); 113 UIGuestOSType guiType; 114 guiType.typeId = m_strTypeId; 115 guiType.typeDescription = m_strTypeId; 116 guiType.is64bit = false; 117 m_types[m_strFamilyId] << guiType; 118 } 119 120 /* Choose if we have something to: */ 121 if (iFamilyIndex != -1) 122 { 123 m_pComboFamily->setCurrentIndex(iFamilyIndex); 124 sltFamilyChanged(m_pComboFamily->currentIndex()); 125 } 126 } 127 128 /* Serch for corresponding type ID index: */ 129 int iTypeIndex = m_pComboType->findData(m_strTypeId, TypeID); 130 131 /* If that type ID isn't present, we have to add it: */ 132 if (iTypeIndex == -1) 133 { 134 /* Serch for "Other" family ID index: */ 135 m_strFamilyId = "Other"; 136 int iFamilyIndex = m_pComboFamily->findData(m_strFamilyId, TypeID); 137 138 /* If that family ID is present: */ 139 if (iFamilyIndex != -1) 140 { 141 /* Append the type cache: */ 142 UIGuestOSType guiType; 143 guiType.typeId = m_strTypeId; 144 guiType.typeDescription = m_strTypeId; 145 guiType.is64bit = false; 146 m_types[m_strFamilyId] << guiType; 147 148 /* Choose required element: */ 149 m_pComboFamily->setCurrentIndex(iFamilyIndex); 150 sltFamilyChanged(m_pComboFamily->currentIndex()); 151 } 152 153 /* Serch for corresponding type ID index again: */ 154 iTypeIndex = m_pComboType->findData(m_strTypeId, TypeID); 155 } 156 157 /* Choose if we have something to: */ 158 if (iTypeIndex != -1) 159 { 160 m_pComboType->setCurrentIndex(iTypeIndex); 161 sltTypeChanged(m_pComboType->currentIndex()); 162 } 163 } 164 165 QString UINameAndSystemEditor::typeId() const 166 { 167 return m_strTypeId; 168 } 169 170 QString UINameAndSystemEditor::familyId() const 171 { 172 return m_strFamilyId; 173 } 174 87 175 CGuestOSType UINameAndSystemEditor::type() const 88 176 { 89 return m_enmType;177 return vboxGlobal().vmGuestOSType(typeId(), familyId()); 90 178 } 91 179 … … 99 187 return; 100 188 101 /* Initialize variables: */ 102 const QString strFamilyId = enmType.GetFamilyId(); 103 const QString strTypeId = enmType.GetId(); 104 105 /* Get/check family index: */ 106 const int iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID); 107 AssertMsg(iFamilyIndex != -1, ("Invalid family ID: '%s'", strFamilyId.toLatin1().constData())); 108 if (iFamilyIndex != -1) 109 m_pComboFamily->setCurrentIndex(iFamilyIndex); 110 111 /* Get/check type index: */ 112 const int iTypeIndex = m_pComboType->findData(strTypeId, TypeID); 113 AssertMsg(iTypeIndex != -1, ("Invalid type ID: '%s'", strTypeId.toLatin1().constData())); 114 if (iTypeIndex != -1) 115 m_pComboType->setCurrentIndex(iTypeIndex); 189 /* Pass to function above: */ 190 setTypeId(enmType.GetId(), enmType.GetFamilyId()); 116 191 } 117 192 … … 141 216 142 217 /* Populate combo-box with OS types related to currently selected family id: */ 143 foreach (const CGuestOSType &comType, vboxGlobal().vmGuestOSTypeList(strFamilyId))218 foreach (const UIGuestOSType &guiType, m_types.value(strFamilyId)) 144 219 { 145 220 /* Skip 64bit OS types if hardware virtualization or long mode is not supported: */ 146 if ( comType.GetIs64Bit()&& (!m_fSupportsHWVirtEx || !m_fSupportsLongMode))221 if (guiType.is64bit && (!m_fSupportsHWVirtEx || !m_fSupportsLongMode)) 147 222 continue; 148 223 const int iIndex = m_pComboType->count(); 149 m_pComboType->insertItem(iIndex, comType.GetDescription());150 m_pComboType->setItemData(iIndex, comType.GetId(), TypeID);224 m_pComboType->insertItem(iIndex, guiType.typeDescription); 225 m_pComboType->setItemData(iIndex, guiType.typeId, TypeID); 151 226 } 152 227 … … 195 270 const QString strTypeId = m_pComboType->itemData(iIndex, TypeID).toString(); 196 271 const QString strFamilyId = m_pComboFamily->itemData(m_pComboFamily->currentIndex(), TypeID).toString(); 197 198 /* Save the new selected OS type: */199 m_enmType = vboxGlobal().vmGuestOSType(strTypeId, strFamilyId);200 272 201 273 /* Update selected type pixmap: */ … … 364 436 void UINameAndSystemEditor::prepareFamilyCombo() 365 437 { 366 /* Populate VM OS family combo: */ 367 const QList<QString> &familyIDs = vboxGlobal().vmGuestOSFamilyIDs(); 368 for (int i = 0; i < familyIDs.size(); ++i) 369 { 370 const QString &strFamilyId = familyIDs.at(i); 438 /* Acquire family IDs: */ 439 m_familyIDs = vboxGlobal().vmGuestOSFamilyIDs(); 440 441 /* For each known family ID: */ 442 for (int i = 0; i < m_familyIDs.size(); ++i) 443 { 444 const QString &strFamilyId = m_familyIDs.at(i); 445 446 /* Append VM OS family combo: */ 371 447 m_pComboFamily->insertItem(i, vboxGlobal().vmGuestOSFamilyDescription(strFamilyId)); 372 448 m_pComboFamily->setItemData(i, strFamilyId, TypeID); 449 450 /* Fill in the type cache: */ 451 m_types[strFamilyId] = QList<UIGuestOSType>(); 452 foreach (const CGuestOSType &comType, vboxGlobal().vmGuestOSTypeList(strFamilyId)) 453 { 454 UIGuestOSType guiType; 455 guiType.typeId = comType.GetId(); 456 guiType.typeDescription = comType.GetDescription(); 457 guiType.is64bit = comType.GetIs64Bit(); 458 m_types[strFamilyId] << guiType; 459 } 373 460 } 374 461 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
r73129 r73130 44 44 Q_PROPERTY(CGuestOSType type READ type WRITE setType); 45 45 46 /** Simple struct representing CGuestOSType cache. */ 47 struct UIGuestOSType 48 { 49 QString typeId; 50 QString typeDescription; 51 bool is64bit; 52 }; 53 46 54 signals: 47 55 … … 66 74 /** Defines the VM @a strName. */ 67 75 void setName(const QString &strName); 76 77 /** Defines the VM OS @a strTypeId and @a strFamilyId if passed. */ 78 void setTypeId(const QString &strTypeId, const QString &strFamilyId = QString()); 79 /** Returns the VM OS type ID. */ 80 QString typeId() const; 81 /** Returns the VM OS family ID. */ 82 QString familyId() const; 68 83 69 84 /** Returns the VM OS type. */ … … 104 119 /** @} */ 105 120 106 /** Holds the VM OS type. */ 107 CGuestOSType m_enmType; 121 /** Holds the current family ID list. */ 122 QStringList m_familyIDs; 123 124 /** Holds the current type cache. */ 125 QMap<QString, QList<UIGuestOSType> > m_types; 126 127 /** Holds the VM OS type ID. */ 128 QString m_strTypeId; 129 /** Holds the VM OS family ID. */ 130 QString m_strFamilyId; 131 108 132 /** Holds the currently chosen OS type IDs on per-family basis. */ 109 133 QMap<QString, QString> m_currentIds;
Note:
See TracChangeset
for help on using the changeset viewer.