Changeset 60697 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 25, 2016 6:41:42 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r60696 r60697 45 45 qRegisterMetaType<CGuestOSType>(); 46 46 47 /* Create widgets: */47 /* Create main-layout: */ 48 48 QGridLayout *pMainLayout = new QGridLayout(this); 49 49 { 50 /* Configure main-layout: */ 50 51 pMainLayout->setContentsMargins(0, 0, 0, 0); 51 m_pLabelName = new QLabel(this); 52 { 52 53 /* Create VM name label: */ 54 m_pLabelName = new QLabel; 55 { 56 /* Configure VM name label: */ 53 57 m_pLabelName->setAlignment(Qt::AlignRight); 54 58 m_pLabelName->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 55 } 56 m_pEditorName = new QLineEdit(this); 57 { 59 /* Add VM name label into main-layout: */ 60 pMainLayout->addWidget(m_pLabelName, 0, 0); 61 } 62 63 /* Create VM name editor: */ 64 m_pEditorName = new QLineEdit; 65 { 66 /* Configure VM name editor: */ 58 67 m_pEditorName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 59 68 m_pLabelName->setBuddy(m_pEditorName); 60 } 61 m_pLabelFamily = new QLabel(this); 62 { 69 /* Add VM name editor into main-layout: */ 70 pMainLayout->addWidget(m_pEditorName, 0, 1, 1, 2); 71 } 72 73 /* Create VM OS family label: */ 74 m_pLabelFamily = new QLabel; 75 { 76 /* Configure VM OS family label: */ 63 77 m_pLabelFamily->setAlignment(Qt::AlignRight); 64 78 m_pLabelFamily->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 65 } 66 m_pComboFamily = new QComboBox(this); 67 { 79 /* Add VM OS family label into main-layout: */ 80 pMainLayout->addWidget(m_pLabelFamily, 1, 0); 81 } 82 83 /* Create VM OS family combo: */ 84 m_pComboFamily = new QComboBox; 85 { 86 /* Configure VM OS family combo: */ 68 87 m_pComboFamily->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 69 88 m_pLabelFamily->setBuddy(m_pComboFamily); 70 } 71 m_pLabelType = new QLabel(this); 72 { 89 /* Add VM OS family combo into main-layout: */ 90 pMainLayout->addWidget(m_pComboFamily, 1, 1); 91 } 92 93 /* Create VM OS type label: */ 94 m_pLabelType = new QLabel; 95 { 96 /* Configure VM OS type label: */ 73 97 m_pLabelType->setAlignment(Qt::AlignRight); 74 98 m_pLabelType->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 75 } 76 m_pComboType = new QComboBox(this); 77 { 99 /* Add VM OS type label into main-layout: */ 100 pMainLayout->addWidget(m_pLabelType, 2, 0); 101 } 102 103 /* Create VM OS type combo: */ 104 m_pComboType = new QComboBox; 105 { 106 /* Configure VM OS type combo: */ 78 107 m_pComboType->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 79 108 m_pLabelType->setBuddy(m_pComboType); 80 } 109 /* Add VM OS type combo into main-layout: */ 110 pMainLayout->addWidget(m_pComboType, 2, 1); 111 } 112 113 /* Create sub-layout: */ 81 114 QVBoxLayout *pLayoutIcon = new QVBoxLayout; 82 115 { 83 m_pIconType = new QLabel(this); 116 /* Create VM OS type icon: */ 117 m_pIconType = new QLabel; 84 118 { 119 /* Configure VM OS type icon: */ 85 120 m_pIconType->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 121 /* Add VM OS type icon into sub-layout: */ 122 pLayoutIcon->addWidget(m_pIconType); 86 123 } 87 pLayoutIcon->addWidget(m_pIconType);124 /* Add stretch to sub-layout: */ 88 125 pLayoutIcon->addStretch(); 89 } 90 pMainLayout->addWidget(m_pLabelName, 0, 0); 91 pMainLayout->addWidget(m_pEditorName, 0, 1, 1, 2); 92 pMainLayout->addWidget(m_pLabelFamily, 1, 0); 93 pMainLayout->addWidget(m_pComboFamily, 1, 1); 94 pMainLayout->addWidget(m_pLabelType, 2, 0); 95 pMainLayout->addWidget(m_pComboType, 2, 1); 96 pMainLayout->addLayout(pLayoutIcon, 1, 2, 2, 1); 126 /* Add sub-layout into main-layout: */ 127 pMainLayout->addLayout(pLayoutIcon, 1, 2, 2, 1); 128 } 97 129 } 98 130 … … 103 135 104 136 /* Fill OS family selector: */ 105 QList<CGuestOSType> families(vboxGlobal().vmGuestOSFamilyList());137 const QList<CGuestOSType> families = vboxGlobal().vmGuestOSFamilyList(); 106 138 for (int i = 0; i < families.size(); ++i) 107 139 { 108 QString strFamilyName(families[i].GetFamilyDescription());140 const QString strFamilyName = families.at(i).GetFamilyDescription(); 109 141 m_pComboFamily->insertItem(i, strFamilyName); 110 m_pComboFamily->setItemData(i, families [i].GetFamilyId(), TypeID);142 m_pComboFamily->setItemData(i, families.at(i).GetFamilyId(), TypeID); 111 143 } 112 144 m_pComboFamily->setCurrentIndex(0); … … 140 172 { 141 173 /* Initialize variables: */ 142 QString strFamilyId(type.GetFamilyId());143 QString strTypeId(type.GetId());174 const QString strFamilyId = type.GetFamilyId(); 175 const QString strTypeId = type.GetId(); 144 176 145 177 /* Get/check family index: */ 146 int iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID);178 const int iFamilyIndex = m_pComboFamily->findData(strFamilyId, TypeID); 147 179 AssertMsg(iFamilyIndex != -1, ("Invalid family ID: '%s'", strFamilyId.toLatin1().constData())); 148 180 if (iFamilyIndex != -1) … … 150 182 151 183 /* Get/check type index: */ 152 int iTypeIndex = m_pComboType->findData(strTypeId, TypeID);184 const int iTypeIndex = m_pComboType->findData(strTypeId, TypeID); 153 185 AssertMsg(iTypeIndex != -1, ("Invalid type ID: '%s'", strTypeId.toLatin1().constData())); 154 186 if (iTypeIndex != -1) … … 176 208 177 209 /* Populate combo-box with OS types related to currently selected family id: */ 178 QString strFamilyId(m_pComboFamily->itemData(iIndex, TypeID).toString());179 QList<CGuestOSType> types(vboxGlobal().vmGuestOSTypeList(strFamilyId));210 const QString strFamilyId = m_pComboFamily->itemData(iIndex, TypeID).toString(); 211 const QList<CGuestOSType> types = vboxGlobal().vmGuestOSTypeList(strFamilyId); 180 212 for (int i = 0; i < types.size(); ++i) 181 213 { 182 if (types[i].GetIs64Bit() && (!m_fSupportsHWVirtEx || !m_fSupportsLongMode)) 214 /* Skip 64bit OS types is hardware virtualization or long mode is not supported: */ 215 if (types.at(i).GetIs64Bit() && (!m_fSupportsHWVirtEx || !m_fSupportsLongMode)) 183 216 continue; 184 int iIndex = m_pComboType->count();217 const int iIndex = m_pComboType->count(); 185 218 m_pComboType->insertItem(iIndex, types[i].GetDescription()); 186 219 m_pComboType->setItemData(iIndex, types[i].GetId(), TypeID); … … 190 223 if (m_currentIds.contains(strFamilyId)) 191 224 { 192 QString strTypeId(m_currentIds[strFamilyId]);193 int iTypeIndex = m_pComboType->findData(strTypeId, TypeID);225 const QString strTypeId = m_currentIds.value(strFamilyId); 226 const int iTypeIndex = m_pComboType->findData(strTypeId, TypeID); 194 227 if (iTypeIndex != -1) 195 228 m_pComboType->setCurrentIndex(iTypeIndex); … … 201 234 if (ARCH_BITS == 64 && m_fSupportsHWVirtEx && m_fSupportsLongMode) 202 235 strDefaultID += "_64"; 203 int iIndexWin7 = m_pComboType->findData(strDefaultID, TypeID);236 const int iIndexWin7 = m_pComboType->findData(strDefaultID, TypeID); 204 237 if (iIndexWin7 != -1) 205 238 m_pComboType->setCurrentIndex(iIndexWin7); … … 211 244 if (ARCH_BITS == 64 && m_fSupportsHWVirtEx && m_fSupportsLongMode) 212 245 strDefaultID += "_64"; 213 int iIndexUbuntu = m_pComboType->findData(strDefaultID, TypeID);246 const int iIndexUbuntu = m_pComboType->findData(strDefaultID, TypeID); 214 247 if (iIndexUbuntu != -1) 215 248 m_pComboType->setCurrentIndex(iIndexUbuntu); 216 249 } 217 250 /* Else simply select the first one present: */ 218 else m_pComboType->setCurrentIndex(0); 251 else 252 m_pComboType->setCurrentIndex(0); 219 253 220 254 /* Update all the stuff: */
Note:
See TracChangeset
for help on using the changeset viewer.