Changeset 91538 in vbox for trunk/src/VBox
- Timestamp:
- Oct 4, 2021 10:43:43 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.cpp
r91537 r91538 29 29 30 30 31 //////////////////////////////////////////////////////////////////////////////// 32 // ExportSortProxyModel 31 /********************************************************************************************************************************* 32 * Class ExportSortProxyModel implementation. * 33 *********************************************************************************************************************************/ 33 34 34 35 class ExportSortProxyModel: public UIApplianceSortProxyModel 35 36 { 36 37 public: 37 ExportSortProxyModel(QObject *pParent = NULL) 38 : UIApplianceSortProxyModel(pParent) 38 39 ExportSortProxyModel(QObject *pParent = 0) 40 : UIApplianceSortProxyModel(pParent) 39 41 { 40 42 m_aFilteredList … … 55 57 }; 56 58 57 ////////////////////////////////////////////////////////////////////////////////58 // UIApplianceExportEditorWidget59 59 60 UIApplianceExportEditorWidget::UIApplianceExportEditorWidget(QWidget *pParent /* = NULL */) 61 : UIApplianceEditorWidget(pParent) 60 /********************************************************************************************************************************* 61 * Class UIApplianceExportEditorWidget implementation. * 62 *********************************************************************************************************************************/ 63 64 UIApplianceExportEditorWidget::UIApplianceExportEditorWidget(QWidget *pParent /* = 0 */) 65 : UIApplianceEditorWidget(pParent) 62 66 { 63 67 } 64 68 65 CAppliance *UIApplianceExportEditorWidget::init()69 CAppliance *UIApplianceExportEditorWidget::init() 66 70 { 67 71 if (m_pAppliance) 68 72 delete m_pAppliance; 69 CVirtualBox vbox = uiCommon().virtualBox(); 70 /* Create a appliance object */ 71 m_pAppliance = new CAppliance(vbox.CreateAppliance()); 72 // bool fResult = m_pAppliance->isOk(); 73 CVirtualBox comVBox = uiCommon().virtualBox(); 74 /* Create a appliance object: */ 75 m_pAppliance = new CAppliance(comVBox.CreateAppliance()); 73 76 return m_pAppliance; 74 77 } … … 76 79 void UIApplianceExportEditorWidget::populate() 77 80 { 81 /* Cleanup previous stuff: */ 78 82 if (m_pModel) 79 83 delete m_pModel; 80 84 85 /* Prepare model: */ 81 86 QVector<CVirtualSystemDescription> vsds = m_pAppliance->GetVirtualSystemDescriptions(); 87 m_pModel = new UIApplianceModel(vsds, m_pTreeViewSettings); 88 if (m_pModel) 89 { 90 m_pModel->setVsdHints(m_listVsdHints); 82 91 83 m_pModel = new UIApplianceModel(vsds, m_pTreeViewSettings); 84 m_pModel->setVsdHints(m_listVsdHints); 92 /* Create proxy model: */ 93 ExportSortProxyModel *pProxy = new ExportSortProxyModel(m_pModel); 94 if (pProxy) 95 { 96 pProxy->setSourceModel(m_pModel); 97 pProxy->sort(ApplianceViewSection_Description, Qt::DescendingOrder); 85 98 86 ExportSortProxyModel *pProxy = new ExportSortProxyModel(this); 87 pProxy->setSourceModel(m_pModel); 88 pProxy->sort(ApplianceViewSection_Description, Qt::DescendingOrder); 99 /* Set our own model: */ 100 m_pTreeViewSettings->setModel(pProxy); 101 /* Set our own delegate: */ 102 UIApplianceDelegate *pDelegate = new UIApplianceDelegate(pProxy); 103 if (pDelegate) 104 m_pTreeViewSettings->setItemDelegate(pDelegate); 89 105 90 UIApplianceDelegate *pDelegate = new UIApplianceDelegate(pProxy); 106 /* For now we hide the original column. This data is displayed as tooltip also. */ 107 m_pTreeViewSettings->setColumnHidden(ApplianceViewSection_OriginalValue, true); 108 m_pTreeViewSettings->expandAll(); 109 /* Set model root index and make it current: */ 110 m_pTreeViewSettings->setRootIndex(pProxy->mapFromSource(m_pModel->root())); 111 m_pTreeViewSettings->setCurrentIndex(pProxy->mapFromSource(m_pModel->root())); 112 } 113 } 91 114 92 /* Set our own model */ 93 m_pTreeViewSettings->setModel(pProxy); 94 /* Set our own delegate */ 95 m_pTreeViewSettings->setItemDelegate(pDelegate); 96 /* For now we hide the original column. This data is displayed as tooltip 97 also. */ 98 m_pTreeViewSettings->setColumnHidden(ApplianceViewSection_OriginalValue, true); 99 m_pTreeViewSettings->expandAll(); 100 /* Set model root index and make it current: */ 101 m_pTreeViewSettings->setRootIndex(pProxy->mapFromSource(m_pModel->root())); 102 m_pTreeViewSettings->setCurrentIndex(pProxy->mapFromSource(m_pModel->root())); 103 104 /* Check for warnings & if there are one display them. */ 105 bool fWarningsEnabled = false; 106 QVector<QString> warnings = m_pAppliance->GetWarnings(); 107 if (warnings.size() > 0) 108 { 109 foreach (const QString& text, warnings) 110 m_pTextEditWarning->append("- " + text); 111 fWarningsEnabled = true; 112 } 115 /* Check for warnings & if there are one display them: */ 116 const QVector<QString> warnings = m_pAppliance->GetWarnings(); 117 const bool fWarningsEnabled = warnings.size() > 0; 118 foreach (const QString &strText, warnings) 119 m_pTextEditWarning->append("- " + strText); 113 120 m_pPaneWarning->setVisible(fWarningsEnabled); 114 121 } … … 119 126 m_pModel->putBack(); 120 127 } 121 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.h
r82968 r91538 5 5 6 6 /* 7 * Copyright (C) 2009-202 0Oracle Corporation7 * Copyright (C) 2009-2021 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 25 #include "UIApplianceEditorWidget.h" 26 26 27 /* Forward declarations: */ 28 class CAppliance; 29 30 /** UIApplianceEditorWidget subclass for Export Appliance wizard. */ 27 31 class UIApplianceExportEditorWidget: public UIApplianceEditorWidget 28 32 { … … 30 34 31 35 public: 32 UIApplianceExportEditorWidget(QWidget *pParent = NULL);33 36 37 /** Constructs widget passing @a pParent to the base-class. */ 38 UIApplianceExportEditorWidget(QWidget *pParent = 0); 39 40 /** Inits the widget by creating appliance instance. */ 34 41 CAppliance *init(); 35 42 43 /** Populates widget contents. */ 36 44 void populate(); 45 46 /** Prepares export by pushing edited data back to appliance. */ 37 47 void prepareExport(); 38 48 }; 39 49 40 50 #endif /* !FEQT_INCLUDED_SRC_widgets_UIApplianceExportEditorWidget_h */ 41
Note:
See TracChangeset
for help on using the changeset viewer.