VirtualBox

Changeset 73189 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 17, 2018 4:38:03 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123792
Message:

FE/Qt: bugref:9152: Export Appliance wizard: Appliance page: Integrating CCloudUserProfileList properties/descriptions.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp

    r73187 r73189  
    135135    /* Acquire Cloud User-profile List: */
    136136    CCloudUserProfileList comProfiles = m_comCloudUserProfileManager.GetProfilesByProvider(provider());
    137     AssertMsgReturnVoid(m_comCloudUserProfileManager.isOk() && comProfiles.isNotNull(),
    138                         ("Unable to acquire Cloud User-profile List"));
     137    /* Return if we have nothing to populate (file missing?): */
     138    if (comProfiles.isNull())
     139        return;
    139140
    140141    /* Clear combo initially: */
     
    151152void UIWizardExportAppPage3::populateProfileSettings()
    152153{
    153     /* Acquire current profile table: */
    154     // Here goes the experiamental lists with
    155     // arbitrary contents for testing purposes.
    156     QStringList keys;
    157     QStringList values;
    158     keys << "Dummy Key 1";
    159     keys << "Dummy Key 2";
    160     keys << "Dummy Key 3";
    161     keys << "Dummy Key 4";
    162     values << "Dummy Value 1";
    163     values << "Dummy Value 2";
    164     values << "Dummy Value 3";
    165     values << "Dummy Value 4";
     154    /* Acquire Cloud User-profile List: */
     155    CCloudUserProfileList comProfiles = m_comCloudUserProfileManager.GetProfilesByProvider(provider());
     156    /* Return if we have nothing to populate (file missing?): */
     157    if (comProfiles.isNull())
     158        return;
     159
     160    /* Clear table initially: */
    166161    m_pProfileSettingsTable->clear();
    167     m_pProfileSettingsTable->setRowCount(4);
     162
     163    /* Acquire profile properties: */
     164    QVector<QString> keys;
     165    QVector<QString> values;
     166    values = comProfiles.GetProfileProperties(profile(), keys);
     167
     168    /* Configure profile table: */
     169    m_pProfileSettingsTable->setRowCount(keys.size());
    168170    m_pProfileSettingsTable->setColumnCount(2);
    169171
     
    171173    for (int i = 0; i < m_pProfileSettingsTable->rowCount(); ++i)
    172174    {
    173         QTableWidgetItem *pItem1 = new QTableWidgetItem(keys.at(i));
    174         pItem1->setFlags(pItem1->flags() & ~Qt::ItemIsEditable);
    175         pItem1->setFlags(pItem1->flags() & ~Qt::ItemIsSelectable);
    176         QTableWidgetItem *pItem2 = new QTableWidgetItem(values.at(i));
    177         pItem2->setFlags(pItem2->flags() & ~Qt::ItemIsEditable);
    178         pItem2->setFlags(pItem2->flags() & ~Qt::ItemIsSelectable);
    179         m_pProfileSettingsTable->setItem(i, 0, pItem1);
    180         m_pProfileSettingsTable->setItem(i, 1, pItem2);
    181     }
     175        /* Create key item: */
     176        QTableWidgetItem *pItemK = new QTableWidgetItem(keys.at(i));
     177        if (pItemK)
     178        {
     179            /* Non-editable for sure, but non-selectable? */
     180            pItemK->setFlags(pItemK->flags() & ~Qt::ItemIsEditable);
     181            pItemK->setFlags(pItemK->flags() & ~Qt::ItemIsSelectable);
     182
     183            /* Use non-translated description as tool-tip: */
     184            const QString strToolTip = comProfiles.GetPropertyDescription(keys.at(i));
     185            pItemK->setData(Qt::UserRole, strToolTip);
     186
     187            /* Insert into table: */
     188            m_pProfileSettingsTable->setItem(i, 0, pItemK);
     189        }
     190
     191        /* Create value item: */
     192        QTableWidgetItem *pItemV = new QTableWidgetItem(values.at(i));
     193        if (pItemV)
     194        {
     195            /* Non-editable for sure, but non-selectable? */
     196            pItemV->setFlags(pItemV->flags() & ~Qt::ItemIsEditable);
     197            pItemV->setFlags(pItemV->flags() & ~Qt::ItemIsSelectable);
     198
     199            /* Use the value as tool-tip, there can be quite long values: */
     200            const QString strToolTip = values.at(i);
     201            pItemV->setToolTip(strToolTip);
     202
     203            /* Insert into table: */
     204            m_pProfileSettingsTable->setItem(i, 1, pItemV);
     205        }
     206    }
     207
     208    /* Update translateable tool-tips: */
     209    updateProfilePropertyTableToolTips();
    182210
    183211    /* Adjust the table: */
     
    298326    AssertMsg(!strCurrentToolTip.isEmpty(), ("Data not found!"));
    299327    m_pProviderComboBox->setToolTip(strCurrentToolTip);
     328}
     329
     330void UIWizardExportAppPage3::updateProfilePropertyTableToolTips()
     331{
     332    /* Iterate through all the key items: */
     333    for (int i = 0; i < m_pProfileSettingsTable->rowCount(); ++i)
     334    {
     335        /* Acquire current key item: */
     336        QTableWidgetItem *pItemK = m_pProfileSettingsTable->item(i, 0);
     337        if (pItemK)
     338        {
     339            const QString strToolTip = pItemK->data(Qt::UserRole).toString();
     340            pItemK->setToolTip(QApplication::translate("UIWizardExportAppPageBasic3", strToolTip.toUtf8().constData()));
     341        }
     342    }
    300343}
    301344
     
    735778    updateMACAddressPolicyComboToolTip();
    736779    updateProviderComboToolTip();
     780    updateProfilePropertyTableToolTips();
    737781}
    738782
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h

    r73176 r73189  
    9090    /** Updates provider combo tool-tips. */
    9191    void updateProviderComboToolTip();
     92    /** Updates profile property tool-tips. */
     93    void updateProfilePropertyTableToolTips();
    9294
    9395    /** Adjusts profile settings table. */
Note: See TracChangeset for help on using the changeset viewer.

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