Changeset 60708 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 26, 2016 4:00:22 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r60697 r60708 42 42 : QIWithRetranslateUI<QWidget>(pParent) 43 43 { 44 /* Register CGuestOSType type: */ 45 qRegisterMetaType<CGuestOSType>(); 46 44 /* Prepare: */ 45 prepare(); 46 } 47 48 void UINameAndSystemEditor::prepare() 49 { 50 /* Prepare this: */ 51 prepareThis(); 52 /* Prepare widgets: */ 53 prepareWidgets(); 54 /* Prepare connections: */ 55 prepareConnections(); 56 /* Retranslate: */ 57 retranslateUi(); 58 } 59 60 void UINameAndSystemEditor::prepareThis() 61 { 62 /* Check if host supports (AMD-V or VT-x) and long mode: */ 63 CHost host = vboxGlobal().host(); 64 m_fSupportsHWVirtEx = host.GetProcessorFeature(KProcessorFeature_HWVirtEx); 65 m_fSupportsLongMode = host.GetProcessorFeature(KProcessorFeature_LongMode); 66 } 67 68 void UINameAndSystemEditor::prepareWidgets() 69 { 47 70 /* Create main-layout: */ 48 71 QGridLayout *pMainLayout = new QGridLayout(this); 72 AssertPtrReturnVoid(pMainLayout); 49 73 { 50 74 /* Configure main-layout: */ … … 53 77 /* Create VM name label: */ 54 78 m_pLabelName = new QLabel; 79 AssertPtrReturnVoid(m_pLabelName); 55 80 { 56 81 /* Configure VM name label: */ … … 63 88 /* Create VM name editor: */ 64 89 m_pEditorName = new QLineEdit; 90 AssertPtrReturnVoid(m_pEditorName); 65 91 { 66 92 /* Configure VM name editor: */ … … 73 99 /* Create VM OS family label: */ 74 100 m_pLabelFamily = new QLabel; 101 AssertPtrReturnVoid(m_pLabelFamily); 75 102 { 76 103 /* Configure VM OS family label: */ … … 83 110 /* Create VM OS family combo: */ 84 111 m_pComboFamily = new QComboBox; 112 AssertPtrReturnVoid(m_pComboFamily); 85 113 { 86 114 /* Configure VM OS family combo: */ … … 93 121 /* Create VM OS type label: */ 94 122 m_pLabelType = new QLabel; 123 AssertPtrReturnVoid(m_pLabelType); 95 124 { 96 125 /* Configure VM OS type label: */ … … 103 132 /* Create VM OS type combo: */ 104 133 m_pComboType = new QComboBox; 134 AssertPtrReturnVoid(m_pComboType); 105 135 { 106 136 /* Configure VM OS type combo: */ … … 113 143 /* Create sub-layout: */ 114 144 QVBoxLayout *pLayoutIcon = new QVBoxLayout; 145 AssertPtrReturnVoid(pLayoutIcon); 115 146 { 116 147 /* Create VM OS type icon: */ 117 148 m_pIconType = new QLabel; 149 AssertPtrReturnVoid(m_pIconType); 118 150 { 119 151 /* Configure VM OS type icon: */ … … 122 154 pLayoutIcon->addWidget(m_pIconType); 123 155 } 156 124 157 /* Add stretch to sub-layout: */ 125 158 pLayoutIcon->addStretch(); … … 129 162 } 130 163 131 /* Check if host supports (AMD-V or VT-x) and long mode: */ 132 CHost host = vboxGlobal().host(); 133 m_fSupportsHWVirtEx = host.GetProcessorFeature(KProcessorFeature_HWVirtEx); 134 m_fSupportsLongMode = host.GetProcessorFeature(KProcessorFeature_LongMode); 135 136 /* Fill OS family selector: */ 164 /* Initialize VM OS family combo 165 * after all widgets were created: */ 166 prepareFamilyCombo(); 167 } 168 169 void UINameAndSystemEditor::prepareFamilyCombo() 170 { 171 /* Populate VM OS family combo: */ 137 172 const QList<CGuestOSType> families = vboxGlobal().vmGuestOSFamilyList(); 138 173 for (int i = 0; i < families.size(); ++i) … … 142 177 m_pComboFamily->setItemData(i, families.at(i).GetFamilyId(), TypeID); 143 178 } 179 180 /* Choose the 1st item to be the current: */ 144 181 m_pComboFamily->setCurrentIndex(0); 182 /* And update the linked widgets accordingly: */ 145 183 sltFamilyChanged(m_pComboFamily->currentIndex()); 146 147 /* Setup connections: */ 184 } 185 186 void UINameAndSystemEditor::prepareConnections() 187 { 188 /* Prepare connections: */ 148 189 connect(m_pEditorName, SIGNAL(textChanged(const QString &)), this, SIGNAL(sigNameChanged(const QString &))); 149 190 connect(m_pComboFamily, SIGNAL(currentIndexChanged(int)), this, SLOT(sltFamilyChanged(int))); 150 191 connect(m_pComboType, SIGNAL(currentIndexChanged(int)), this, SLOT(sltTypeChanged(int))); 151 152 /* Retranslate: */153 retranslateUi();154 192 } 155 193 … … 261 299 void UINameAndSystemEditor::sltTypeChanged(int iIndex) 262 300 { 263 /* Save the new selected OS Type: */301 /* Save the new selected OS type: */ 264 302 m_type = vboxGlobal().vmGuestOSType(m_pComboType->itemData(iIndex, TypeID).toString(), 265 303 m_pComboFamily->itemData(m_pComboFamily->currentIndex(), TypeID).toString()); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
r60696 r60708 66 66 protected: 67 67 68 /** @name Prepare cascade. 69 * @{ */ 70 /** Prepares all. */ 71 void prepare(); 72 /** Prepares this. */ 73 void prepareThis(); 74 /** Prepares widgets. */ 75 void prepareWidgets(); 76 /** Prepares VM OS family combo. */ 77 void prepareFamilyCombo(); 78 /** Prepares connections. */ 79 void prepareConnections(); 80 /** @} */ 81 68 82 /** Handles translation event. */ 69 83 virtual void retranslateUi() /* override */;
Note:
See TracChangeset
for help on using the changeset viewer.