VirtualBox

Changeset 91564 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 5, 2021 11:13:23 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996: UIWizardImportApp: A bit of paranoia for retranslateUi; Simplifies debugging.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance
Files:
3 edited

Legend:

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

    r91563 r91564  
    559559
    560560    /* Translate main label: */
    561     m_pLabelMain->setText(UIWizardImportApp::tr("Please choose the source to import appliance from.  This can be a "
    562                                                 "local file system to import OVF archive or one of known cloud "
    563                                                 "service providers to import cloud VM from."));
     561    if (m_pLabelMain)
     562        m_pLabelMain->setText(UIWizardImportApp::tr("Please choose the source to import appliance from.  This can be a "
     563                                                    "local file system to import OVF archive or one of known cloud "
     564                                                    "service providers to import cloud VM from."));
    564565
    565566    /* Translate source label: */
    566     m_pSourceLabel->setText(UIWizardImportApp::tr("&Source:"));
    567     /* Translate hardcoded values of Source combo-box: */
    568     m_pSourceComboBox->setItemText(0, UIWizardImportApp::tr("Local File System"));
    569     m_pSourceComboBox->setItemData(0, UIWizardImportApp::tr("Import from local file system."), Qt::ToolTipRole);
    570     /* Translate received values of Source combo-box.
    571      * We are enumerating starting from 0 for simplicity: */
    572     for (int i = 0; i < m_pSourceComboBox->count(); ++i)
    573         if (isSourceCloudOne(i))
    574         {
    575             m_pSourceComboBox->setItemText(i, m_pSourceComboBox->itemData(i, SourceData_Name).toString());
    576             m_pSourceComboBox->setItemData(i, UIWizardImportApp::tr("Import from cloud service provider."), Qt::ToolTipRole);
    577         }
     567    if (m_pSourceLabel)
     568        m_pSourceLabel->setText(UIWizardImportApp::tr("&Source:"));
     569    if (m_pSourceComboBox)
     570    {
     571        /* Translate hardcoded values of Source combo-box: */
     572        m_pSourceComboBox->setItemText(0, UIWizardImportApp::tr("Local File System"));
     573        m_pSourceComboBox->setItemData(0, UIWizardImportApp::tr("Import from local file system."), Qt::ToolTipRole);
     574
     575        /* Translate received values of Source combo-box.
     576         * We are enumerating starting from 0 for simplicity: */
     577        for (int i = 0; i < m_pSourceComboBox->count(); ++i)
     578            if (isSourceCloudOne(i))
     579            {
     580                m_pSourceComboBox->setItemText(i, m_pSourceComboBox->itemData(i, SourceData_Name).toString());
     581                m_pSourceComboBox->setItemData(i, UIWizardImportApp::tr("Import from cloud service provider."), Qt::ToolTipRole);
     582            }
     583    }
    578584
    579585    /* Translate local stuff: */
    580     m_pFileLabel->setText(UIWizardImportApp::tr("&File:"));
    581     m_pFileSelector->setChooseButtonToolTip(UIWizardImportApp::tr("Choose a virtual appliance file to import..."));
    582     m_pFileSelector->setFileDialogTitle(UIWizardImportApp::tr("Please choose a virtual appliance file to import"));
    583     m_pFileSelector->setFileFilters(UIWizardImportApp::tr("Open Virtualization Format (%1)").arg("*.ova *.ovf"));
     586    if (m_pFileLabel)
     587        m_pFileLabel->setText(UIWizardImportApp::tr("&File:"));
     588    if (m_pFileSelector)
     589    {
     590        m_pFileSelector->setChooseButtonToolTip(UIWizardImportApp::tr("Choose a virtual appliance file to import..."));
     591        m_pFileSelector->setFileDialogTitle(UIWizardImportApp::tr("Please choose a virtual appliance file to import"));
     592        m_pFileSelector->setFileFilters(UIWizardImportApp::tr("Open Virtualization Format (%1)").arg("*.ova *.ovf"));
     593    }
    584594
    585595    /* Translate profile stuff: */
    586     m_pProfileLabel->setText(UIWizardImportApp::tr("&Profile:"));
    587     m_pProfileToolButton->setToolTip(UIWizardImportApp::tr("Open Cloud Profile Manager..."));
    588     m_pProfileInstanceLabel->setText(UIWizardImportApp::tr("&Machines:"));
     596    if (m_pProfileLabel)
     597        m_pProfileLabel->setText(UIWizardImportApp::tr("&Profile:"));
     598    if (m_pProfileToolButton)
     599        m_pProfileToolButton->setToolTip(UIWizardImportApp::tr("Open Cloud Profile Manager..."));
     600    if (m_pProfileInstanceLabel)
     601        m_pProfileInstanceLabel->setText(UIWizardImportApp::tr("&Machines:"));
    589602
    590603    /* Adjust label widths: */
    591604    QList<QWidget*> labels;
    592     labels << m_pFileLabel;
    593     labels << m_pSourceLabel;
    594     labels << m_pProfileLabel;
    595     labels << m_pProfileInstanceLabel;
     605    if (m_pFileLabel)
     606        labels << m_pFileLabel;
     607    if (m_pSourceLabel)
     608        labels << m_pSourceLabel;
     609    if (m_pProfileLabel)
     610        labels << m_pProfileLabel;
     611    if (m_pProfileInstanceLabel)
     612        labels << m_pProfileInstanceLabel;
    596613    int iMaxWidth = 0;
    597614    foreach (QWidget *pLabel, labels)
    598615        iMaxWidth = qMax(iMaxWidth, pLabel->minimumSizeHint().width());
    599     m_pSourceLayout->setColumnMinimumWidth(0, iMaxWidth);
    600     m_pLocalContainerLayout->setColumnMinimumWidth(0, iMaxWidth);
    601     m_pCloudContainerLayout->setColumnMinimumWidth(0, iMaxWidth);
     616    if (m_pSourceLayout)
     617        m_pSourceLayout->setColumnMinimumWidth(0, iMaxWidth);
     618    if (m_pLocalContainerLayout)
     619    {
     620        m_pLocalContainerLayout->setColumnMinimumWidth(0, iMaxWidth);
     621        m_pCloudContainerLayout->setColumnMinimumWidth(0, iMaxWidth);
     622    }
    602623
    603624    /* Update page appearance: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp

    r91561 r91564  
    151151
    152152    /* Translate the certificate label: */
    153     switch (m_enmCertText)
    154     {
    155         case kCertText_Unsigned:
    156             m_pCertLabel->setText(UIWizardImportApp::tr("Appliance is not signed"));
    157             break;
    158         case kCertText_IssuedTrusted:
    159             m_pCertLabel->setText(UIWizardImportApp::tr("Appliance signed by %1 (trusted)").arg(m_strSignedBy));
    160             break;
    161         case kCertText_IssuedExpired:
    162             m_pCertLabel->setText(UIWizardImportApp::tr("Appliance signed by %1 (expired!)").arg(m_strSignedBy));
    163             break;
    164         case kCertText_IssuedUnverified:
    165             m_pCertLabel->setText(UIWizardImportApp::tr("Unverified signature by %1!").arg(m_strSignedBy));
    166             break;
    167         case kCertText_SelfSignedTrusted:
    168             m_pCertLabel->setText(UIWizardImportApp::tr("Self signed by %1 (trusted)").arg(m_strSignedBy));
    169             break;
    170         case kCertText_SelfSignedExpired:
    171             m_pCertLabel->setText(UIWizardImportApp::tr("Self signed by %1 (expired!)").arg(m_strSignedBy));
    172             break;
    173         case kCertText_SelfSignedUnverified:
    174             m_pCertLabel->setText(UIWizardImportApp::tr("Unverified self signed signature by %1!").arg(m_strSignedBy));
    175             break;
    176         default:
    177             AssertFailed();
    178             RT_FALL_THRU();
    179         case kCertText_Uninitialized:
    180             m_pCertLabel->setText("<uninitialized page>");
    181             break;
     153    if (m_pCertLabel)
     154    {
     155        switch (m_enmCertText)
     156        {
     157            case kCertText_Unsigned:
     158                m_pCertLabel->setText(UIWizardImportApp::tr("Appliance is not signed"));
     159                break;
     160            case kCertText_IssuedTrusted:
     161                m_pCertLabel->setText(UIWizardImportApp::tr("Appliance signed by %1 (trusted)").arg(m_strSignedBy));
     162                break;
     163            case kCertText_IssuedExpired:
     164                m_pCertLabel->setText(UIWizardImportApp::tr("Appliance signed by %1 (expired!)").arg(m_strSignedBy));
     165                break;
     166            case kCertText_IssuedUnverified:
     167                m_pCertLabel->setText(UIWizardImportApp::tr("Unverified signature by %1!").arg(m_strSignedBy));
     168                break;
     169            case kCertText_SelfSignedTrusted:
     170                m_pCertLabel->setText(UIWizardImportApp::tr("Self signed by %1 (trusted)").arg(m_strSignedBy));
     171                break;
     172            case kCertText_SelfSignedExpired:
     173                m_pCertLabel->setText(UIWizardImportApp::tr("Self signed by %1 (expired!)").arg(m_strSignedBy));
     174                break;
     175            case kCertText_SelfSignedUnverified:
     176                m_pCertLabel->setText(UIWizardImportApp::tr("Unverified self signed signature by %1!").arg(m_strSignedBy));
     177                break;
     178            default:
     179                AssertFailed();
     180                RT_FALL_THRU();
     181            case kCertText_Uninitialized:
     182                m_pCertLabel->setText("<uninitialized page>");
     183                break;
     184        }
    182185    }
    183186}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.cpp

    r91563 r91564  
    242242{
    243243    /* Translate appliance container: */
    244     m_pCntSource->setTitle(UIWizardImportApp::tr("Source"));
     244    if (m_pCntSource)
     245        m_pCntSource->setTitle(UIWizardImportApp::tr("Source"));
    245246
    246247    /* Translate hardcoded values of Source combo-box: */
    247     m_pSourceComboBox->setItemText(0, UIWizardImportApp::tr("Local File System"));
    248     m_pSourceComboBox->setItemData(0, UIWizardImportApp::tr("Import from local file system."), Qt::ToolTipRole);
    249     /* Translate received values of Source combo-box.
    250      * We are enumerating starting from 0 for simplicity: */
    251     for (int i = 0; i < m_pSourceComboBox->count(); ++i)
    252         if (isSourceCloudOne(i))
    253         {
    254             m_pSourceComboBox->setItemText(i, m_pSourceComboBox->itemData(i, SourceData_Name).toString());
    255             m_pSourceComboBox->setItemData(i, UIWizardImportApp::tr("Import from cloud service provider."), Qt::ToolTipRole);
    256         }
     248    if (m_pSourceComboBox)
     249    {
     250        m_pSourceComboBox->setItemText(0, UIWizardImportApp::tr("Local File System"));
     251        m_pSourceComboBox->setItemData(0, UIWizardImportApp::tr("Import from local file system."), Qt::ToolTipRole);
     252        /* Translate received values of Source combo-box.
     253         * We are enumerating starting from 0 for simplicity: */
     254        for (int i = 0; i < m_pSourceComboBox->count(); ++i)
     255            if (isSourceCloudOne(i))
     256            {
     257                m_pSourceComboBox->setItemText(i, m_pSourceComboBox->itemData(i, SourceData_Name).toString());
     258                m_pSourceComboBox->setItemData(i, UIWizardImportApp::tr("Import from cloud service provider."), Qt::ToolTipRole);
     259            }
     260    }
    257261
    258262    /* Translate file selector: */
    259     m_pFileSelector->setChooseButtonToolTip(UIWizardImportApp::tr("Choose a virtual appliance file to import..."));
    260     m_pFileSelector->setFileDialogTitle(UIWizardImportApp::tr("Please choose a virtual appliance file to import"));
    261     m_pFileSelector->setFileFilters(UIWizardImportApp::tr("Open Virtualization Format (%1)").arg("*.ova *.ovf"));
     263    if (m_pFileSelector)
     264    {
     265        m_pFileSelector->setChooseButtonToolTip(UIWizardImportApp::tr("Choose a virtual appliance file to import..."));
     266        m_pFileSelector->setFileDialogTitle(UIWizardImportApp::tr("Please choose a virtual appliance file to import"));
     267        m_pFileSelector->setFileFilters(UIWizardImportApp::tr("Open Virtualization Format (%1)").arg("*.ova *.ovf"));
     268    }
    262269
    263270    /* Translate profile stuff: */
    264     m_pProfileToolButton->setToolTip(UIWizardImportApp::tr("Open Cloud Profile Manager..."));
     271    if (m_pProfileToolButton)
     272        m_pProfileToolButton->setToolTip(UIWizardImportApp::tr("Open Cloud Profile Manager..."));
    265273
    266274    /* Translate settings container: */
    267     m_pSettingsCnt->setTitle(UIWizardImportApp::tr("Settings"));
     275    if (m_pSettingsCnt)
     276        m_pSettingsCnt->setTitle(UIWizardImportApp::tr("Settings"));
    268277
    269278    /* Update page appearance: */
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