VirtualBox

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


Ignore:
Timestamp:
Apr 17, 2020 12:37:15 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
137268
Message:

FE/Qt: bugref:9653: Details generator: Rework to use ICloudMachine::GetDetailsForm instead of ICloudMachine::GetSettingsForm; This is static content form faster to acquire.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDetailsGenerator.cpp

    r83719 r83747  
    148148    }
    149149
    150     // WORKAROUND:
    151     // While we are waiting for GetDetailsForm implementation we will be using GetSettingsForm.
    152     // This requires to wait for progress to complete and handle out all possible value types.
    153     CForm comForm;
    154     CProgress comProgress = comCloudMachine.GetSettingsForm(comForm);
     150    /* Acquire details form: */
     151    CForm comForm = comCloudMachine.GetDetailsForm();
    155152    /* Ignore cloud machine errors: */
    156153    if (comCloudMachine.isOk())
    157154    {
    158         /* Wait for progress to complete: */
    159         comProgress.WaitForCompletion(-1);
    160         /* Ignore progress errors: */
    161         if (comProgress.isOk() && comProgress.GetResultCode() == 0)
    162         {
    163             /* For each form value: */
    164             QVector<CFormValue> values = comForm.GetValues();
    165             foreach (const CFormValue &comIteratedValue, values)
    166             {
    167                 /* Handle possible value type: */
    168                 switch (comIteratedValue.GetType())
     155        /* For each form value: */
     156        const QVector<CFormValue> values = comForm.GetValues();
     157        foreach (const CFormValue &comIteratedValue, values)
     158        {
     159            /* Ignore invisible values: */
     160            if (!comIteratedValue.GetVisible())
     161                continue;
     162            /* Handle possible value type: */
     163            switch (comIteratedValue.GetType())
     164            {
     165                case KFormValueType_Boolean:
    169166                {
    170                     case KFormValueType_Boolean:
    171                     {
    172                         CBooleanFormValue comValue(comIteratedValue);
    173                         const bool fBool = comValue.GetSelected();
    174                         table << UITextTableLine(comValue.GetLabel(),
    175                                                  fBool ? QApplication::translate("UIDetails", "Enabled", "details (cloud value)")
    176                                                        : QApplication::translate("UIDetails", "Disabled", "details (cloud value)"));
    177                         break;
    178                     }
    179                     case KFormValueType_String:
    180                     {
    181                         CStringFormValue comValue(comIteratedValue);
    182                         table << UITextTableLine(comValue.GetLabel(), comValue.GetString());
    183                         break;
    184                     }
    185                     case KFormValueType_Choice:
    186                     {
    187                         CChoiceFormValue comValue(comIteratedValue);
    188                         const QVector<QString> possibleValues = comValue.GetValues();
    189                         const int iCurrentIndex = comValue.GetSelectedIndex();
    190                         table << UITextTableLine(comValue.GetLabel(), possibleValues.at(iCurrentIndex));
    191                         break;
    192                     }
    193                     case KFormValueType_RangedInteger:
    194                     {
    195                         CRangedIntegerFormValue comValue(comIteratedValue);
    196                         table << UITextTableLine(comValue.GetLabel(),
    197                                                  QString("%1 %2").arg(comValue.GetInteger()).arg(comValue.GetSuffix()));
    198                         break;
    199                     }
    200                     default:
    201                         break;
     167                    CBooleanFormValue comValue(comIteratedValue);
     168                    const bool fBool = comValue.GetSelected();
     169                    table << UITextTableLine(comValue.GetLabel(),
     170                                             fBool ? QApplication::translate("UIDetails", "Enabled", "details (cloud value)")
     171                                                   : QApplication::translate("UIDetails", "Disabled", "details (cloud value)"));
     172                    break;
    202173                }
     174                case KFormValueType_String:
     175                {
     176                    CStringFormValue comValue(comIteratedValue);
     177                    table << UITextTableLine(comValue.GetLabel(), comValue.GetString());
     178                    break;
     179                }
     180                case KFormValueType_Choice:
     181                {
     182                    AssertMsgFailed(("Aren't we decided to convert all choices to strings?\n"));
     183                    CChoiceFormValue comValue(comIteratedValue);
     184                    const QVector<QString> possibleValues = comValue.GetValues();
     185                    const int iCurrentIndex = comValue.GetSelectedIndex();
     186                    table << UITextTableLine(comValue.GetLabel(), possibleValues.at(iCurrentIndex));
     187                    break;
     188                }
     189                case KFormValueType_RangedInteger:
     190                {
     191                    CRangedIntegerFormValue comValue(comIteratedValue);
     192                    table << UITextTableLine(comValue.GetLabel(),
     193                                             QString("%1 %2").arg(comValue.GetInteger()).arg(comValue.GetSuffix()));
     194                    break;
     195                }
     196                default:
     197                    break;
    203198            }
    204199        }
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