Changeset 78173 in vbox
- Timestamp:
- Apr 17, 2019 4:18:52 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIFormEditorWidget.cpp
r78167 r78173 115 115 116 116 /** Constructs table cell on the basis of certain @a strText, passing @a pParent to the base-class. */ 117 UIFormEditorCell(QITableViewRow *pParent, const QString &strText );117 UIFormEditorCell(QITableViewRow *pParent, const QString &strText = QString()); 118 118 119 119 /** Returns the cell text. */ 120 120 virtual QString text() const /* override */ { return m_strText; } 121 122 /** Defines the cell @a strText. */ 123 void setText(const QString &strText) { m_strText = strText; } 121 124 122 125 private: … … 169 172 /** Cleanups all. */ 170 173 void cleanup(); 174 175 /** Updates value cells. */ 176 void updateValueCells(); 171 177 172 178 /** Holds the row value. */ … … 251 257 *********************************************************************************************************************************/ 252 258 253 UIFormEditorCell::UIFormEditorCell(QITableViewRow *pParent, const QString &strText )259 UIFormEditorCell::UIFormEditorCell(QITableViewRow *pParent, const QString &strText /* = QString() */) 254 260 : QITableViewCell(pParent) 255 261 , m_strText(strText) … … 324 330 /* Cache value type: */ 325 331 m_enmValueType = m_comValue.GetType(); 332 /// @todo check for errors 326 333 327 334 /* Create cells on the basis of variables we have: */ 328 335 m_cells.resize(UIFormEditorDataType_Max); 329 m_cells[UIFormEditorDataType_Name] = new UIFormEditorCell(this, m_comValue.GetLabel()); 330 switch (m_enmValueType) 331 { 332 case KFormValueType_Boolean: 333 { 334 CBooleanFormValue comValue(m_comValue); 335 m_cells[UIFormEditorDataType_Value] = new UIFormEditorCell(this, comValue.GetSelected() ? "True" : "False"); 336 break; 337 } 338 case KFormValueType_String: 339 { 340 CStringFormValue comValue(m_comValue); 341 m_cells[UIFormEditorDataType_Value] = new UIFormEditorCell(this, comValue.GetString()); 342 break; 343 } 344 case KFormValueType_Choice: 345 { 346 CChoiceFormValue comValue(m_comValue); 347 const QVector<QString> values = comValue.GetValues(); 348 m_cells[UIFormEditorDataType_Value] = new UIFormEditorCell(this, values.at(comValue.GetSelectedIndex())); 349 break; 350 } 351 default: 352 break; 353 } 336 const QString strName = m_comValue.GetLabel(); 337 /// @todo check for errors 338 m_cells[UIFormEditorDataType_Name] = new UIFormEditorCell(this, strName); 339 m_cells[UIFormEditorDataType_Value] = new UIFormEditorCell(this); 340 updateValueCells(); 354 341 } 355 342 … … 359 346 qDeleteAll(m_cells); 360 347 m_cells.clear(); 348 } 349 350 void UIFormEditorRow::updateValueCells() 351 { 352 switch (m_enmValueType) 353 { 354 case KFormValueType_Boolean: 355 { 356 CBooleanFormValue comValue(m_comValue); 357 m_cells[UIFormEditorDataType_Value]->setText(comValue.GetSelected() ? "True" : "False"); 358 /// @todo check for errors 359 break; 360 } 361 case KFormValueType_String: 362 { 363 CStringFormValue comValue(m_comValue); 364 m_cells[UIFormEditorDataType_Value]->setText(comValue.GetString()); 365 /// @todo check for errors 366 break; 367 } 368 case KFormValueType_Choice: 369 { 370 CChoiceFormValue comValue(m_comValue); 371 const QVector<QString> values = comValue.GetValues(); 372 m_cells[UIFormEditorDataType_Value]->setText(values.at(comValue.GetSelectedIndex())); 373 /// @todo check for errors 374 break; 375 } 376 default: 377 break; 378 } 361 379 } 362 380
Note:
See TracChangeset
for help on using the changeset viewer.

