Changeset 73129 in vbox
- Timestamp:
- Jul 13, 2018 4:12:14 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123717
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r73119 r73129 137 137 m_pComboType->clear(); 138 138 139 /* Acquire family ID: */ 140 const QString strFamilyId = m_pComboFamily->itemData(iIndex, TypeID).toString(); 141 139 142 /* Populate combo-box with OS types related to currently selected family id: */ 140 const QString strFamilyId = m_pComboFamily->itemData(iIndex, TypeID).toString(); 141 const QList<CGuestOSType> types = vboxGlobal().vmGuestOSTypeList(strFamilyId); 142 for (int i = 0; i < types.size(); ++i) 143 { 144 /* Skip 64bit OS types is hardware virtualization or long mode is not supported: */ 145 if (types.at(i).GetIs64Bit() && (!m_fSupportsHWVirtEx || !m_fSupportsLongMode)) 143 foreach (const CGuestOSType &comType, vboxGlobal().vmGuestOSTypeList(strFamilyId)) 144 { 145 /* Skip 64bit OS types if hardware virtualization or long mode is not supported: */ 146 if (comType.GetIs64Bit() && (!m_fSupportsHWVirtEx || !m_fSupportsLongMode)) 146 147 continue; 147 148 const int iIndex = m_pComboType->count(); 148 m_pComboType->insertItem(iIndex, types[i].GetDescription());149 m_pComboType->setItemData(iIndex, types[i].GetId(), TypeID);149 m_pComboType->insertItem(iIndex, comType.GetDescription()); 150 m_pComboType->setItemData(iIndex, comType.GetId(), TypeID); 150 151 } 151 152 … … 191 192 void UINameAndSystemEditor::sltTypeChanged(int iIndex) 192 193 { 194 /* Acquire type/family IDs: */ 195 const QString strTypeId = m_pComboType->itemData(iIndex, TypeID).toString(); 196 const QString strFamilyId = m_pComboFamily->itemData(m_pComboFamily->currentIndex(), TypeID).toString(); 197 193 198 /* Save the new selected OS type: */ 194 m_enmType = vboxGlobal().vmGuestOSType(m_pComboType->itemData(iIndex, TypeID).toString(), 195 m_pComboFamily->itemData(m_pComboFamily->currentIndex(), TypeID).toString()); 196 m_pIconType->setPixmap(vboxGlobal().vmGuestOSTypePixmapDefault(m_enmType.GetId())); 199 m_enmType = vboxGlobal().vmGuestOSType(strTypeId, strFamilyId); 200 201 /* Update selected type pixmap: */ 202 m_pIconType->setPixmap(vboxGlobal().vmGuestOSTypePixmapDefault(strTypeId)); 197 203 198 204 /* Save the most recently used item: */ 199 m_currentIds[ m_enmType.GetFamilyId()] = m_enmType.GetId();205 m_currentIds[strFamilyId] = strTypeId; 200 206 201 207 /* Notifies listeners about OS type change: */ … … 211 217 /* Prepare connections: */ 212 218 prepareConnections(); 213 /* Retranslate: */219 /* Apply language settings: */ 214 220 retranslateUi(); 215 221 } … … 229 235 if (pMainLayout) 230 236 { 231 /* Configure main-layout: */232 237 pMainLayout->setContentsMargins(0, 0, 0, 0); 233 238 239 int iRow = 0; 240 241 /* Create name label: */ 234 242 m_pNameLabel = new QLabel; 235 int iRow = 0;236 243 if (m_pNameLabel) 237 244 { 238 245 m_pNameLabel->setAlignment(Qt::AlignRight); 239 246 m_pNameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 247 248 /* Add into layout: */ 240 249 pMainLayout->addWidget(m_pNameLabel, iRow, 0, 1, 1); 241 250 } 251 /* Create name editor: */ 242 252 m_pNameLineEdit = new QILineEdit; 243 253 if (m_pNameLineEdit) 244 254 { 245 pMainLayout->addWidget(m_pNameLineEdit, iRow++, 1, 1, 2); 246 } 255 /* Add into layout: */ 256 pMainLayout->addWidget(m_pNameLineEdit, iRow, 1, 1, 2); 257 } 258 259 ++iRow; 247 260 248 261 if (m_fChooseLocation) 249 262 { 263 /* Create path label: */ 250 264 m_pPathLabel = new QLabel; 251 265 if (m_pPathLabel) … … 253 267 m_pPathLabel->setAlignment(Qt::AlignRight); 254 268 m_pPathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 269 270 /* Add into layout: */ 255 271 pMainLayout->addWidget(m_pPathLabel, iRow, 0, 1, 1); 256 272 } 257 273 /* Create path selector: */ 258 274 m_pPathSelector = new UIFilePathSelector; 259 275 if (m_pPathSelector) 260 276 { 261 pMainLayout->addWidget(m_pPathSelector, iRow++, 1, 1, 2);262 277 QString strDefaultMachineFolder = vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder(); 263 278 m_pPathSelector->setPath(strDefaultMachineFolder); 264 279 m_pPathSelector->setDefaultPath(strDefaultMachineFolder); 280 281 /* Add into layout: */ 282 pMainLayout->addWidget(m_pPathSelector, iRow, 1, 1, 2); 265 283 } 284 285 ++iRow; 266 286 } 267 287 … … 270 290 if (m_pLabelFamily) 271 291 { 272 /* Configure VM OS family label: */273 292 m_pLabelFamily->setAlignment(Qt::AlignRight); 274 293 m_pLabelFamily->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 275 /* Add VM OS family label into main-layout: */ 294 295 /* Add into layout: */ 276 296 pMainLayout->addWidget(m_pLabelFamily, iRow, 0); 277 297 } 298 278 299 int iIconRow = iRow; 300 279 301 /* Create VM OS family combo: */ 280 302 m_pComboFamily = new QComboBox; 281 303 if (m_pComboFamily) 282 304 { 283 /* Configure VM OS family combo: */284 305 m_pComboFamily->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 285 306 m_pLabelFamily->setBuddy(m_pComboFamily); 286 /* Add VM OS family combo into main-layout: */ 287 pMainLayout->addWidget(m_pComboFamily, iRow++, 1); 288 } 307 308 /* Add into layout: */ 309 pMainLayout->addWidget(m_pComboFamily, iRow, 1); 310 } 311 312 ++iRow; 289 313 290 314 /* Create VM OS type label: */ … … 292 316 if (m_pLabelType) 293 317 { 294 /* Configure VM OS type label: */295 318 m_pLabelType->setAlignment(Qt::AlignRight); 296 319 m_pLabelType->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 297 /* Add VM OS type label into main-layout: */ 320 321 /* Add into layout: */ 298 322 pMainLayout->addWidget(m_pLabelType, iRow, 0); 299 323 } 300 301 324 /* Create VM OS type combo: */ 302 325 m_pComboType = new QComboBox; 303 326 if (m_pComboType) 304 327 { 305 /* Configure VM OS type combo: */306 328 m_pComboType->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 307 329 m_pLabelType->setBuddy(m_pComboType); 308 /* Add VM OS type combo into main-layout: */ 309 pMainLayout->addWidget(m_pComboType, iRow++, 1); 310 } 330 331 /* Add into layout: */ 332 pMainLayout->addWidget(m_pComboType, iRow, 1); 333 } 334 335 ++iRow; 311 336 312 337 /* Create sub-layout: */ … … 318 343 if (m_pIconType) 319 344 { 320 /* Configure VM OS type icon: */321 345 m_pIconType->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 322 /* Add VM OS type icon into sub-layout: */ 346 347 /* Add into layout: */ 323 348 pLayoutIcon->addWidget(m_pIconType); 324 349 } 350 325 351 /* Add stretch to sub-layout: */ 326 352 pLayoutIcon->addStretch(); 327 /* Add sub-layout into main-layout: */ 353 354 /* Add into layout: */ 328 355 pMainLayout->addLayout(pLayoutIcon, iIconRow, 2, 2, 1); 329 356 } … … 366 393 } 367 394 368 void UINameAndSystemEditor::setNameFieldValidator(const QString &strValidator String)395 void UINameAndSystemEditor::setNameFieldValidator(const QString &strValidator) 369 396 { 370 397 if (!m_pNameLineEdit) 371 398 return; 372 m_pNameLineEdit->setValidator(new QRegExpValidator(QRegExp(strValidator String), this));373 } 399 m_pNameLineEdit->setValidator(new QRegExpValidator(QRegExp(strValidator), this)); 400 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
r72603 r73129 72 72 void setType(const CGuestOSType &enmType); 73 73 74 void setNameFieldValidator(const QString &strValidatorString); 74 /** Defines the name-field @a strValidator. */ 75 void setNameFieldValidator(const QString &strValidator); 75 76 76 77 protected:
Note:
See TracChangeset
for help on using the changeset viewer.