VirtualBox

Changeset 78173 in vbox


Ignore:
Timestamp:
Apr 17, 2019 4:18:52 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9434: Import Appliance wizard: Form Editor widget: A possibility to recache table values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIFormEditorWidget.cpp

    r78167 r78173  
    115115
    116116    /** 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());
    118118
    119119    /** Returns the cell text. */
    120120    virtual QString text() const /* override */ { return m_strText; }
     121
     122    /** Defines the cell @a strText. */
     123    void setText(const QString &strText) { m_strText = strText; }
    121124
    122125private:
     
    169172    /** Cleanups all. */
    170173    void cleanup();
     174
     175    /** Updates value cells. */
     176    void updateValueCells();
    171177
    172178    /** Holds the row value. */
     
    251257*********************************************************************************************************************************/
    252258
    253 UIFormEditorCell::UIFormEditorCell(QITableViewRow *pParent, const QString &strText)
     259UIFormEditorCell::UIFormEditorCell(QITableViewRow *pParent, const QString &strText /* = QString() */)
    254260    : QITableViewCell(pParent)
    255261    , m_strText(strText)
     
    324330    /* Cache value type: */
    325331    m_enmValueType = m_comValue.GetType();
     332    /// @todo check for errors
    326333
    327334    /* Create cells on the basis of variables we have: */
    328335    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();
    354341}
    355342
     
    359346    qDeleteAll(m_cells);
    360347    m_cells.clear();
     348}
     349
     350void 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    }
    361379}
    362380
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette