Changeset 73326 in vbox
- Timestamp:
- Jul 23, 2018 2:20:24 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp
r73320 r73326 364 364 m_enmVSDType == KVirtualSystemDescriptionType_USBController || 365 365 m_enmVSDType == KVirtualSystemDescriptionType_SoundCard || 366 m_enmVSDType == KVirtualSystemDescriptionType_NetworkAdapter) 366 m_enmVSDType == KVirtualSystemDescriptionType_NetworkAdapter || 367 m_enmVSDType == KVirtualSystemDescriptionType_CloudOCIPublicIP) 367 368 enmFlags |= Qt::ItemIsUserCheckable; 368 369 /* Some items are editable */ … … 384 385 m_enmVSDType == KVirtualSystemDescriptionType_SettingsFile || 385 386 m_enmVSDType == KVirtualSystemDescriptionType_BaseFolder || 386 m_enmVSDType == KVirtualSystemDescriptionType_PrimaryGroup) && 387 m_enmVSDType == KVirtualSystemDescriptionType_PrimaryGroup || 388 m_enmVSDType == KVirtualSystemDescriptionType_CloudOCIInstanceShape || 389 m_enmVSDType == KVirtualSystemDescriptionType_CloudOCIDomain || 390 m_enmVSDType == KVirtualSystemDescriptionType_CloudOCIBootDiskSize || 391 m_enmVSDType == KVirtualSystemDescriptionType_CloudOCIBucket || 392 m_enmVSDType == KVirtualSystemDescriptionType_CloudOCIVCN) && 387 393 m_checkState == Qt::Checked) /* Item has to be enabled */ 388 394 enmFlags |= Qt::ItemIsEditable; … … 403 409 m_enmVSDType == KVirtualSystemDescriptionType_USBController || 404 410 m_enmVSDType == KVirtualSystemDescriptionType_SoundCard || 405 m_enmVSDType == KVirtualSystemDescriptionType_NetworkAdapter)) 411 m_enmVSDType == KVirtualSystemDescriptionType_NetworkAdapter || 412 m_enmVSDType == KVirtualSystemDescriptionType_CloudOCIPublicIP)) 406 413 { 407 414 m_checkState = static_cast<Qt::CheckState>(value.toInt()); … … 466 473 case KVirtualSystemDescriptionType_BaseFolder: value = UIApplianceEditorWidget::tr("Base Folder"); break; 467 474 case KVirtualSystemDescriptionType_PrimaryGroup: value = UIApplianceEditorWidget::tr("Primary Group"); break; 475 case KVirtualSystemDescriptionType_CloudOCIInstanceShape: 476 case KVirtualSystemDescriptionType_CloudOCIDomain: 477 case KVirtualSystemDescriptionType_CloudOCIBootDiskSize: 478 case KVirtualSystemDescriptionType_CloudOCIBucket: 479 case KVirtualSystemDescriptionType_CloudOCIVCN: 480 case KVirtualSystemDescriptionType_CloudOCIPublicIP: value = UIApplianceEditorWidget::tr(m_pParent->nameHint(m_enmVSDType).toUtf8().constData()); break; 468 481 default: value = UIApplianceEditorWidget::tr("Unknown Hardware Item"); break; 469 482 } … … 533 546 case KVirtualSystemDescriptionType_BaseFolder: value = vboxGlobal().icon(QFileIconProvider::Folder); break; 534 547 case KVirtualSystemDescriptionType_PrimaryGroup: value = UIIconPool::iconSet(":/vm_group_name_16px.png"); break; 548 case KVirtualSystemDescriptionType_CloudOCIInstanceShape: 549 case KVirtualSystemDescriptionType_CloudOCIDomain: 550 case KVirtualSystemDescriptionType_CloudOCIBootDiskSize: 551 case KVirtualSystemDescriptionType_CloudOCIBucket: 552 case KVirtualSystemDescriptionType_CloudOCIVCN: 553 case KVirtualSystemDescriptionType_CloudOCIPublicIP: value = UIIconPool::iconSet(":/session_info_16px.png"); break; 535 554 default: break; 536 555 } … … 570 589 m_enmVSDType == KVirtualSystemDescriptionType_USBController || 571 590 m_enmVSDType == KVirtualSystemDescriptionType_SoundCard || 572 m_enmVSDType == KVirtualSystemDescriptionType_NetworkAdapter)) 591 m_enmVSDType == KVirtualSystemDescriptionType_NetworkAdapter || 592 m_enmVSDType == KVirtualSystemDescriptionType_CloudOCIPublicIP)) 573 593 value = m_checkState; 574 594 break; … … 716 736 break; 717 737 } 738 case KVirtualSystemDescriptionType_CloudOCIInstanceShape: 739 case KVirtualSystemDescriptionType_CloudOCIDomain: 740 case KVirtualSystemDescriptionType_CloudOCIBootDiskSize: 741 case KVirtualSystemDescriptionType_CloudOCIBucket: 742 case KVirtualSystemDescriptionType_CloudOCIVCN: 743 { 744 const QVariant get = m_pParent->getHint(m_enmVSDType); 745 switch (m_pParent->kindHint(m_enmVSDType)) 746 { 747 case ParameterKind_Double: 748 { 749 AbstractVSDParameterDouble value = get.value<AbstractVSDParameterDouble>(); 750 QSpinBox *pSpinBox = new QSpinBox(pParent); 751 pSpinBox->setRange(value.minimum, value.maximum); 752 pSpinBox->setSuffix(QString(" %1").arg(VBoxGlobal::tr(value.unit.toUtf8().constData()))); 753 pEditor = pSpinBox; 754 break; 755 } 756 case ParameterKind_String: 757 { 758 QLineEdit *pLineEdit = new QLineEdit(pParent); 759 pEditor = pLineEdit; 760 break; 761 } 762 case ParameterKind_Array: 763 { 764 AbstractVSDParameterArray value = get.value<AbstractVSDParameterArray>(); 765 QComboBox *pComboBox = new QComboBox(pParent); 766 pComboBox->addItems(value.values); 767 pEditor = pComboBox; 768 break; 769 } 770 default: 771 break; 772 } 773 break; 774 } 718 775 default: break; 719 776 } … … 810 867 pGroupCombo->setCurrentText(m_strConfigValue); 811 868 fDone = true; 869 } 870 break; 871 } 872 case KVirtualSystemDescriptionType_CloudOCIInstanceShape: 873 case KVirtualSystemDescriptionType_CloudOCIDomain: 874 case KVirtualSystemDescriptionType_CloudOCIBootDiskSize: 875 case KVirtualSystemDescriptionType_CloudOCIBucket: 876 case KVirtualSystemDescriptionType_CloudOCIVCN: 877 { 878 switch (m_pParent->kindHint(m_enmVSDType)) 879 { 880 case ParameterKind_Double: 881 { 882 if (QSpinBox *pSpinBox = qobject_cast<QSpinBox*>(pEditor)) 883 { 884 pSpinBox->setValue(m_strConfigValue.toInt()); 885 fDone = true; 886 } 887 break; 888 } 889 case ParameterKind_String: 890 { 891 if (QLineEdit *pLineEdit = qobject_cast<QLineEdit*>(pEditor)) 892 { 893 pLineEdit->setText(m_strConfigValue); 894 fDone = true; 895 } 896 break; 897 } 898 case ParameterKind_Array: 899 { 900 if (QComboBox *pComboBox = qobject_cast<QComboBox*>(pEditor)) 901 { 902 pComboBox->setCurrentText(m_strConfigValue); 903 fDone = true; 904 } 905 break; 906 } 907 default: 908 break; 812 909 } 813 910 break; … … 950 1047 break; 951 1048 } 1049 case KVirtualSystemDescriptionType_CloudOCIInstanceShape: 1050 case KVirtualSystemDescriptionType_CloudOCIDomain: 1051 case KVirtualSystemDescriptionType_CloudOCIBootDiskSize: 1052 case KVirtualSystemDescriptionType_CloudOCIBucket: 1053 case KVirtualSystemDescriptionType_CloudOCIVCN: 1054 { 1055 switch (m_pParent->kindHint(m_enmVSDType)) 1056 { 1057 case ParameterKind_Double: 1058 { 1059 if (QSpinBox *pSpinBox = qobject_cast<QSpinBox*>(pEditor)) 1060 { 1061 m_strConfigValue = QString::number(pSpinBox->value()); 1062 fDone = true; 1063 } 1064 break; 1065 } 1066 case ParameterKind_String: 1067 { 1068 if (QLineEdit *pLineEdit = qobject_cast<QLineEdit*>(pEditor)) 1069 { 1070 m_strConfigValue = pLineEdit->text(); 1071 fDone = true; 1072 } 1073 break; 1074 } 1075 case ParameterKind_Array: 1076 { 1077 if (QComboBox *pComboBox = qobject_cast<QComboBox*>(pEditor)) 1078 { 1079 m_strConfigValue = pComboBox->currentText(); 1080 fDone = true; 1081 } 1082 break; 1083 } 1084 default: 1085 break; 1086 } 1087 } 952 1088 default: break; 953 1089 } … … 1201 1337 } 1202 1338 } 1339 } 1340 1341 void UIApplianceModel::setVsdHints(const QList<AbstractVSDParameter> &hints) 1342 { 1343 m_listVsdHints = hints; 1344 } 1345 1346 QString UIApplianceModel::nameHint(KVirtualSystemDescriptionType enmType) const 1347 { 1348 foreach (const AbstractVSDParameter ¶meter, m_listVsdHints) 1349 if (parameter.type == enmType) 1350 return parameter.name; 1351 return QString(); 1352 } 1353 1354 AbstractVSDParameterKind UIApplianceModel::kindHint(KVirtualSystemDescriptionType enmType) const 1355 { 1356 foreach (const AbstractVSDParameter ¶meter, m_listVsdHints) 1357 if (parameter.type == enmType) 1358 return parameter.kind; 1359 return ParameterKind_Invalid; 1360 } 1361 1362 QVariant UIApplianceModel::getHint(KVirtualSystemDescriptionType enmType) const 1363 { 1364 foreach (const AbstractVSDParameter ¶meter, m_listVsdHints) 1365 if (parameter.type == enmType) 1366 return parameter.get; 1367 return QVariant(); 1203 1368 } 1204 1369 … … 1488 1653 } 1489 1654 1655 void UIApplianceEditorWidget::setVsdHints(const QList<AbstractVSDParameter> &hints) 1656 { 1657 /* Save here as well: */ 1658 m_listVsdHints = hints; 1659 1660 /* Make sure model exists, it's being created in sub-classes: */ 1661 if (m_pModel) 1662 m_pModel->setVsdHints(m_listVsdHints); 1663 } 1664 1490 1665 void UIApplianceEditorWidget::restoreDefaults() 1491 1666 { -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.h
r73319 r73326 189 189 void setVirtualSystemBaseFolder(const QString& path); 190 190 191 /** Defines the list of VSD @a hints. */ 192 void setVsdHints(const QList<AbstractVSDParameter> &hints); 193 /** Returns a name hint for certain VSD @a enmType. */ 194 QString nameHint(KVirtualSystemDescriptionType enmType) const; 195 /** Returns a kind hint for certain VSD @a enmType. */ 196 AbstractVSDParameterKind kindHint(KVirtualSystemDescriptionType enmType) const; 197 /** Returns a value hint for certain VSD @a enmType. */ 198 QVariant getHint(KVirtualSystemDescriptionType enmType) const; 199 191 200 private: 201 202 /** Holds the list of VSD hints. */ 203 QList<AbstractVSDParameter> m_listVsdHints; 192 204 193 205 /** Holds the root item reference. */ … … 273 285 /** Constructs the Appliance Editor widget passing @a pParent to the base-class. */ 274 286 UIApplianceEditorWidget(QWidget *pParent = 0); 287 288 /** Defines the list of VSD @a hints. */ 289 void setVsdHints(const QList<AbstractVSDParameter> &hints); 275 290 276 291 /** Returns whether the Appliance Editor has valid state. */ … … 300 315 void setVirtualSystemBaseFolder(const QString& path); 301 316 317 /** Holds the list of VSD hints. */ 318 QList<AbstractVSDParameter> m_listVsdHints; 319 302 320 /** Holds the currently set appliance reference. */ 303 321 CAppliance *m_pAppliance; -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.cpp
r69500 r73326 87 87 88 88 m_pModel = new UIApplianceModel(vsds, m_pTreeViewSettings); 89 m_pModel->setVsdHints(m_listVsdHints); 89 90 90 91 ExportSortProxyModel *pProxy = new ExportSortProxyModel(this); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp
r73319 r73326 242 242 if (comMachine.isOk() && comVsd.isNotNull()) 243 243 { 244 /* Now add some new fields the user may change: */ 245 comVsd.AddDescription(KVirtualSystemDescriptionType_Product, "", ""); 246 comVsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", ""); 247 comVsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", ""); 248 comVsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", ""); 249 comVsd.AddDescription(KVirtualSystemDescriptionType_Version, "", ""); 250 comVsd.AddDescription(KVirtualSystemDescriptionType_License, "", ""); 244 if (fieldImp("format").toString() == "csp-1.0") 245 { 246 /* Populate Cloud Client parameters: */ 247 populateCloudClientParameters(); 248 /* Pass them as a list of hints to help editor with names/values: */ 249 m_pApplianceWidget->setVsdHints(m_listCloudClientParameters); 250 /* Add corresponding Cloud Client fields with default values: */ 251 foreach (const AbstractVSDParameter ¶meter, m_listCloudClientParameters) 252 { 253 QString strValue; 254 switch (parameter.kind) 255 { 256 case ParameterKind_Bool: 257 strValue = QString(); 258 break; 259 case ParameterKind_Double: 260 strValue = QString::number(parameter.get.value<AbstractVSDParameterDouble>().minimum); 261 break; 262 case ParameterKind_String: 263 strValue = parameter.get.value<AbstractVSDParameterString>().value; 264 break; 265 case ParameterKind_Array: 266 strValue = parameter.get.value<AbstractVSDParameterArray>().values.value(0); 267 break; 268 default: 269 break; 270 } 271 comVsd.AddDescription(parameter.type, strValue, ""); 272 } 273 } 274 else 275 { 276 /* Add some additional fields the user may change: */ 277 comVsd.AddDescription(KVirtualSystemDescriptionType_Product, "", ""); 278 comVsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", ""); 279 comVsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", ""); 280 comVsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", ""); 281 comVsd.AddDescription(KVirtualSystemDescriptionType_Version, "", ""); 282 comVsd.AddDescription(KVirtualSystemDescriptionType_License, "", ""); 283 } 251 284 } 252 285 else -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp
r73325 r73326 604 604 refreshManifestCheckBoxAccess(); 605 605 refreshIncludeISOsCheckBoxAccess(); 606 refreshApplianceSettingsWidget(); 606 607 } 607 608
Note:
See TracChangeset
for help on using the changeset viewer.