VirtualBox

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


Ignore:
Timestamp:
Nov 16, 2018 6:07:22 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9289: VirtualBox Manager / Details pane: Moving options from certain elements to model, there they can be reused.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/details
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp

    r75427 r75530  
    250250}
    251251
    252 QStringList UIDetailsElement::extraDataOptions() const
    253 {
    254     return gEDataManager->vboxManagerDetailsPaneElementOptions(elementType());
    255 }
    256 
    257252const CMachine &UIDetailsElement::machine()
    258253{
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.h

    r75427 r75530  
    155155        /** Returns the description of the item. */
    156156        virtual QString description() const /* override */;
    157 
    158         /** Returns extra-data options. */
    159         QStringList extraDataOptions() const;
    160157
    161158        /** Returns cached machine reference. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.cpp

    r75427 r75530  
    284284}
    285285
    286 UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral UIDetailsElementGeneral::parsedExtraDataOptions()
    287 {
    288     UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral options = UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Invalid;
    289     foreach (const QString &strOption, extraDataOptions())
    290     {
    291         const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral enmOption =
    292             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral>(strOption);
    293         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Invalid)
    294             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral>(options | enmOption);
    295     }
    296     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Invalid)
    297         options = UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Default;
    298     return options;
     286UITask *UIDetailsElementGeneral::createUpdateTask()
     287{
     288    return new UIDetailsUpdateTaskGeneral(machine(), model()->optionsGeneral());
    299289}
    300290
     
    423413}
    424414
    425 UIExtraDataMetaDefs::DetailsElementOptionTypeSystem UIDetailsElementSystem::parsedExtraDataOptions()
    426 {
    427     UIExtraDataMetaDefs::DetailsElementOptionTypeSystem options = UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Invalid;
    428     foreach (const QString &strOption, extraDataOptions())
    429     {
    430         const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem enmOption =
    431             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeSystem>(strOption);
    432         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Invalid)
    433             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSystem>(options | enmOption);
    434     }
    435     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Invalid)
    436         options = UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Default;
    437     return options;
     415UITask *UIDetailsElementSystem::createUpdateTask()
     416{
     417    return new UIDetailsUpdateTaskSystem(machine(), model()->optionsSystem());
    438418}
    439419
     
    547527}
    548528
    549 UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay UIDetailsElementDisplay::parsedExtraDataOptions()
    550 {
    551     UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay options = UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Invalid;
    552     foreach (const QString &strOption, extraDataOptions())
    553     {
    554         const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay enmOption =
    555             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay>(strOption);
    556         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Invalid)
    557             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay>(options | enmOption);
    558     }
    559     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Invalid)
    560         options = UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Default;
    561     return options;
     529UITask *UIDetailsElementDisplay::createUpdateTask()
     530{
     531    return new UIDetailsUpdateTaskDisplay(machine(), model()->optionsDisplay());
    562532}
    563533
     
    656626}
    657627
    658 UIExtraDataMetaDefs::DetailsElementOptionTypeStorage UIDetailsElementStorage::parsedExtraDataOptions()
    659 {
    660     UIExtraDataMetaDefs::DetailsElementOptionTypeStorage options = UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Invalid;
    661     foreach (const QString &strOption, extraDataOptions())
    662     {
    663         const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage enmOption =
    664             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeStorage>(strOption);
    665         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Invalid)
    666             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeStorage>(options | enmOption);
    667     }
    668     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Invalid)
    669         options = UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Default;
    670     return options;
     628UITask *UIDetailsElementStorage::createUpdateTask()
     629{
     630    return new UIDetailsUpdateTaskStorage(machine(), model()->optionsStorage());
    671631}
    672632
     
    725685}
    726686
    727 UIExtraDataMetaDefs::DetailsElementOptionTypeAudio UIDetailsElementAudio::parsedExtraDataOptions()
    728 {
    729     UIExtraDataMetaDefs::DetailsElementOptionTypeAudio options = UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Invalid;
    730     foreach (const QString &strOption, extraDataOptions())
    731     {
    732         const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio enmOption =
    733             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeAudio>(strOption);
    734         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Invalid)
    735             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeAudio>(options | enmOption);
    736     }
    737     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Invalid)
    738         options = UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Default;
    739     return options;
     687UITask *UIDetailsElementAudio::createUpdateTask()
     688{
     689    return new UIDetailsUpdateTaskAudio(machine(), model()->optionsAudio());
    740690}
    741691
     
    831781}
    832782
    833 UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork UIDetailsElementNetwork::parsedExtraDataOptions()
    834 {
    835     UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork options = UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Invalid;
    836     foreach (const QString &strOption, extraDataOptions())
    837     {
    838         const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork enmOption =
    839             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork>(strOption);
    840         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Invalid)
    841             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork>(options | enmOption);
    842     }
    843     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Invalid)
    844         options = UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Default;
    845     return options;
     783UITask *UIDetailsElementNetwork::createUpdateTask()
     784{
     785    return new UIDetailsUpdateTaskNetwork(machine(), model()->optionsNetwork());
    846786}
    847787
     
    936876}
    937877
    938 UIExtraDataMetaDefs::DetailsElementOptionTypeSerial UIDetailsElementSerial::parsedExtraDataOptions()
    939 {
    940     UIExtraDataMetaDefs::DetailsElementOptionTypeSerial options = UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Invalid;
    941     foreach (const QString &strOption, extraDataOptions())
    942     {
    943         const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial enmOption =
    944             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeSerial>(strOption);
    945         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Invalid)
    946             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSerial>(options | enmOption);
    947     }
    948     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Invalid)
    949         options = UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Default;
    950     return options;
     878UITask *UIDetailsElementSerial::createUpdateTask()
     879{
     880    return new UIDetailsUpdateTaskSerial(machine(), model()->optionsSerial());
    951881}
    952882
     
    1007937}
    1008938
    1009 UIExtraDataMetaDefs::DetailsElementOptionTypeUsb UIDetailsElementUSB::parsedExtraDataOptions()
    1010 {
    1011     UIExtraDataMetaDefs::DetailsElementOptionTypeUsb options = UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Invalid;
    1012     foreach (const QString &strOption, extraDataOptions())
    1013     {
    1014         const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb enmOption =
    1015             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeUsb>(strOption);
    1016         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Invalid)
    1017             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeUsb>(options | enmOption);
    1018     }
    1019     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Invalid)
    1020         options = UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Default;
    1021     return options;
     939UITask *UIDetailsElementUSB::createUpdateTask()
     940{
     941    return new UIDetailsUpdateTaskUSB(machine(), model()->optionsUsb());
    1022942}
    1023943
     
    1053973}
    1054974
    1055 UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders UIDetailsElementSF::parsedExtraDataOptions()
    1056 {
    1057     UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders options = UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Invalid;
    1058     foreach (const QString &strOption, extraDataOptions())
    1059     {
    1060         const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders enmOption =
    1061             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders>(strOption);
    1062         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Invalid)
    1063             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders>(options | enmOption);
    1064     }
    1065     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Invalid)
    1066         options = UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Default;
    1067     return options;
     975UITask *UIDetailsElementSF::createUpdateTask()
     976{
     977    return new UIDetailsUpdateTaskSF(machine(), model()->optionsSharedFolders());
    1068978}
    1069979
     
    11601070}
    11611071
    1162 UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface UIDetailsElementUI::parsedExtraDataOptions()
    1163 {
    1164     UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface options = UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Invalid;
    1165     foreach (const QString &strOption, extraDataOptions())
    1166     {
    1167         const UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface enmOption =
    1168             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>(strOption);
    1169         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Invalid)
    1170             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>(options | enmOption);
    1171     }
    1172     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Invalid)
    1173         options = UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Default;
    1174     return options;
     1072UITask *UIDetailsElementUI::createUpdateTask()
     1073{
     1074    return new UIDetailsUpdateTaskUI(machine(), model()->optionsUserInterface());
    11751075}
    11761076
     
    12061106}
    12071107
    1208 UIExtraDataMetaDefs::DetailsElementOptionTypeDescription UIDetailsElementDescription::parsedExtraDataOptions()
    1209 {
    1210     UIExtraDataMetaDefs::DetailsElementOptionTypeDescription options = UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Invalid;
    1211     foreach (const QString &strOption, extraDataOptions())
    1212     {
    1213         const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription enmOption =
    1214             gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(strOption);
    1215         if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Invalid)
    1216             options = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(options | enmOption);
    1217     }
    1218     if (options == UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Invalid)
    1219         options = UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Default;
    1220     return options;
    1221 }
     1108UITask *UIDetailsElementDescription::createUpdateTask()
     1109{
     1110    return new UIDetailsUpdateTaskDescription(machine(), model()->optionsDescription());
     1111}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h

    r75427 r75530  
    147147private:
    148148
    149     /** Returns parsed extra-data options. */
    150     UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral parsedExtraDataOptions();
    151 
    152     /** Creates update task for this element. */
    153     UITask *createUpdateTask() { return new UIDetailsUpdateTaskGeneral(machine(), parsedExtraDataOptions()); }
     149    /** Creates update task for this element. */
     150    virtual UITask *createUpdateTask() /* override */;
    154151};
    155152
     
    189186private:
    190187
    191     /** Returns parsed extra-data options. */
    192     UIExtraDataMetaDefs::DetailsElementOptionTypeSystem parsedExtraDataOptions();
    193 
    194     /** Creates update task for this element. */
    195     UITask *createUpdateTask() { return new UIDetailsUpdateTaskSystem(machine(), parsedExtraDataOptions()); }
     188    /** Creates update task for this element. */
     189    virtual UITask *createUpdateTask() /* override */;
    196190};
    197191
     
    231225private:
    232226
    233     /** Returns parsed extra-data options. */
    234     UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay parsedExtraDataOptions();
    235 
    236     /** Creates update task for this element. */
    237     UITask *createUpdateTask() { return new UIDetailsUpdateTaskDisplay(machine(), parsedExtraDataOptions()); }
     227    /** Creates update task for this element. */
     228    virtual UITask *createUpdateTask() /* override */;
    238229};
    239230
     
    273264private:
    274265
    275     /** Returns parsed extra-data options. */
    276     UIExtraDataMetaDefs::DetailsElementOptionTypeStorage parsedExtraDataOptions();
    277 
    278     /** Creates update task for this element. */
    279     UITask *createUpdateTask() { return new UIDetailsUpdateTaskStorage(machine(), parsedExtraDataOptions()); }
     266    /** Creates update task for this element. */
     267    virtual UITask *createUpdateTask() /* override */;
    280268};
    281269
     
    315303private:
    316304
    317     /** Returns parsed extra-data options. */
    318     UIExtraDataMetaDefs::DetailsElementOptionTypeAudio parsedExtraDataOptions();
    319 
    320     /** Creates update task for this element. */
    321     UITask *createUpdateTask() { return new UIDetailsUpdateTaskAudio(machine(), parsedExtraDataOptions()); }
     305    /** Creates update task for this element. */
     306    virtual UITask *createUpdateTask() /* override */;
    322307};
    323308
     
    360345private:
    361346
    362     /** Returns parsed extra-data options. */
    363     UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork parsedExtraDataOptions();
    364 
    365     /** Creates update task for this element. */
    366     UITask *createUpdateTask() { return new UIDetailsUpdateTaskNetwork(machine(), parsedExtraDataOptions()); }
     347    /** Creates update task for this element. */
     348    virtual UITask *createUpdateTask() /* override */;
    367349};
    368350
     
    402384private:
    403385
    404     /** Returns parsed extra-data options. */
    405     UIExtraDataMetaDefs::DetailsElementOptionTypeSerial parsedExtraDataOptions();
    406 
    407     /** Creates update task for this element. */
    408     UITask *createUpdateTask() { return new UIDetailsUpdateTaskSerial(machine(), parsedExtraDataOptions()); }
     386    /** Creates update task for this element. */
     387    virtual UITask *createUpdateTask() /* override */;
    409388};
    410389
     
    444423private:
    445424
    446     /** Returns parsed extra-data options. */
    447     UIExtraDataMetaDefs::DetailsElementOptionTypeUsb parsedExtraDataOptions();
    448 
    449     /** Creates update task for this element. */
    450     UITask *createUpdateTask() { return new UIDetailsUpdateTaskUSB(machine(), parsedExtraDataOptions()); }
     425    /** Creates update task for this element. */
     426    virtual UITask *createUpdateTask() /* override */;
    451427};
    452428
     
    486462private:
    487463
    488     /** Returns parsed extra-data options. */
    489     UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders parsedExtraDataOptions();
    490 
    491     /** Creates update task for this element. */
    492     UITask *createUpdateTask() { return new UIDetailsUpdateTaskSF(machine(), parsedExtraDataOptions()); }
     464    /** Creates update task for this element. */
     465    virtual UITask *createUpdateTask() /* override */;
    493466};
    494467
     
    528501private:
    529502
    530     /** Returns parsed extra-data options. */
    531     UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface parsedExtraDataOptions();
    532 
    533     /** Creates update task for this element. */
    534     UITask *createUpdateTask() { return new UIDetailsUpdateTaskUI(machine(), parsedExtraDataOptions()); }
     503    /** Creates update task for this element. */
     504    virtual UITask *createUpdateTask() /* override */;
    535505};
    536506
     
    570540private:
    571541
    572     /** Returns parsed extra-data options. */
    573     UIExtraDataMetaDefs::DetailsElementOptionTypeDescription parsedExtraDataOptions();
    574 
    575     /** Creates update task for this element. */
    576     UITask *createUpdateTask() { return new UIDetailsUpdateTaskDescription(machine(), parsedExtraDataOptions()); }
     542    /** Creates update task for this element. */
     543    virtual UITask *createUpdateTask() /* override */;
    577544};
    578545
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.cpp

    r75529 r75530  
    121121void UIDetailsModel::sltHandleExtraDataCategoriesChange()
    122122{
    123     m_categories = gEDataManager->selectorWindowDetailsElements();
     123    loadDetailsCategories();
    124124    m_pRoot->rebuildGroup();
    125125}
    126126
    127 void UIDetailsModel::sltHandleExtraDataOptionsChange(DetailsElementType)
    128 {
     127void UIDetailsModel::sltHandleExtraDataOptionsChange(DetailsElementType enmType)
     128{
     129    loadDetailsOptions(enmType);
    129130    m_pRoot->rebuildGroup();
    130131}
     
    243244void UIDetailsModel::loadSettings()
    244245{
     246    loadDetailsCategories();
     247    loadDetailsOptions();
     248}
     249
     250void UIDetailsModel::loadDetailsCategories()
     251{
    245252    m_categories = gEDataManager->selectorWindowDetailsElements();
     253}
     254
     255void UIDetailsModel::loadDetailsOptions(DetailsElementType enmType /* = DetailsElementType_Invalid */)
     256{
     257    /* We will handle DetailsElementType_Invalid as a request to load everything. */
     258
     259    if (enmType == DetailsElementType_General || enmType == DetailsElementType_Invalid)
     260    {
     261        m_fOptionsGeneral = UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Invalid;
     262        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_General))
     263        {
     264            const UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral enmOption =
     265                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral>(strOption);
     266            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Invalid)
     267                m_fOptionsGeneral = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral>(m_fOptionsGeneral | enmOption);
     268        }
     269        if (m_fOptionsGeneral == UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Invalid)
     270            m_fOptionsGeneral = UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral_Default;
     271    }
     272
     273    if (enmType == DetailsElementType_System || enmType == DetailsElementType_Invalid)
     274    {
     275        m_fOptionsSystem = UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Invalid;
     276        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_System))
     277        {
     278            const UIExtraDataMetaDefs::DetailsElementOptionTypeSystem enmOption =
     279                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeSystem>(strOption);
     280            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Invalid)
     281                m_fOptionsSystem = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSystem>(m_fOptionsSystem | enmOption);
     282        }
     283        if (m_fOptionsSystem == UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Invalid)
     284            m_fOptionsSystem = UIExtraDataMetaDefs::DetailsElementOptionTypeSystem_Default;
     285    }
     286
     287    if (enmType == DetailsElementType_Display || enmType == DetailsElementType_Invalid)
     288    {
     289        m_fOptionsDisplay = UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Invalid;
     290        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_Display))
     291        {
     292            const UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay enmOption =
     293                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay>(strOption);
     294            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Invalid)
     295                m_fOptionsDisplay = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay>(m_fOptionsDisplay | enmOption);
     296        }
     297        if (m_fOptionsDisplay == UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Invalid)
     298            m_fOptionsDisplay = UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay_Default;
     299    }
     300
     301    if (enmType == DetailsElementType_Storage || enmType == DetailsElementType_Invalid)
     302    {
     303        m_fOptionsStorage = UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Invalid;
     304        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_Storage))
     305        {
     306            const UIExtraDataMetaDefs::DetailsElementOptionTypeStorage enmOption =
     307                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeStorage>(strOption);
     308            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Invalid)
     309                m_fOptionsStorage = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeStorage>(m_fOptionsStorage | enmOption);
     310        }
     311        if (m_fOptionsStorage == UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Invalid)
     312            m_fOptionsStorage = UIExtraDataMetaDefs::DetailsElementOptionTypeStorage_Default;
     313    }
     314
     315    if (enmType == DetailsElementType_Audio || enmType == DetailsElementType_Invalid)
     316    {
     317        m_fOptionsAudio = UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Invalid;
     318        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_Audio))
     319        {
     320            const UIExtraDataMetaDefs::DetailsElementOptionTypeAudio enmOption =
     321                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeAudio>(strOption);
     322            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Invalid)
     323                m_fOptionsAudio = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeAudio>(m_fOptionsAudio | enmOption);
     324        }
     325        if (m_fOptionsAudio == UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Invalid)
     326            m_fOptionsAudio = UIExtraDataMetaDefs::DetailsElementOptionTypeAudio_Default;
     327    }
     328
     329    if (enmType == DetailsElementType_Network || enmType == DetailsElementType_Invalid)
     330    {
     331        m_fOptionsNetwork = UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Invalid;
     332        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_Network))
     333        {
     334            const UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork enmOption =
     335                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork>(strOption);
     336            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Invalid)
     337                m_fOptionsNetwork = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork>(m_fOptionsNetwork | enmOption);
     338        }
     339        if (m_fOptionsNetwork == UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Invalid)
     340            m_fOptionsNetwork = UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Default;
     341    }
     342
     343    if (enmType == DetailsElementType_Serial || enmType == DetailsElementType_Invalid)
     344    {
     345        m_fOptionsSerial = UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Invalid;
     346        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_Serial))
     347        {
     348            const UIExtraDataMetaDefs::DetailsElementOptionTypeSerial enmOption =
     349                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeSerial>(strOption);
     350            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Invalid)
     351                m_fOptionsSerial = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSerial>(m_fOptionsSerial | enmOption);
     352        }
     353        if (m_fOptionsSerial == UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Invalid)
     354            m_fOptionsSerial = UIExtraDataMetaDefs::DetailsElementOptionTypeSerial_Default;
     355    }
     356
     357    if (enmType == DetailsElementType_USB || enmType == DetailsElementType_Invalid)
     358    {
     359        m_fOptionsUsb = UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Invalid;
     360        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_USB))
     361        {
     362            const UIExtraDataMetaDefs::DetailsElementOptionTypeUsb enmOption =
     363                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeUsb>(strOption);
     364            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Invalid)
     365                m_fOptionsUsb = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeUsb>(m_fOptionsUsb | enmOption);
     366        }
     367        if (m_fOptionsUsb == UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Invalid)
     368            m_fOptionsUsb = UIExtraDataMetaDefs::DetailsElementOptionTypeUsb_Default;
     369    }
     370
     371    if (enmType == DetailsElementType_SF || enmType == DetailsElementType_Invalid)
     372    {
     373        m_fOptionsSharedFolders = UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Invalid;
     374        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_SF))
     375        {
     376            const UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders enmOption =
     377                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders>(strOption);
     378            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Invalid)
     379                m_fOptionsSharedFolders = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders>(m_fOptionsSharedFolders | enmOption);
     380        }
     381        if (m_fOptionsSharedFolders == UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Invalid)
     382            m_fOptionsSharedFolders = UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders_Default;
     383    }
     384
     385    if (enmType == DetailsElementType_UI || enmType == DetailsElementType_Invalid)
     386    {
     387        m_fOptionsUserInterface = UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Invalid;
     388        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_UI))
     389        {
     390            const UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface enmOption =
     391                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>(strOption);
     392            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Invalid)
     393                m_fOptionsUserInterface = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface>(m_fOptionsUserInterface | enmOption);
     394        }
     395        if (m_fOptionsUserInterface == UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Invalid)
     396            m_fOptionsUserInterface = UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface_Default;
     397    }
     398
     399    if (enmType == DetailsElementType_Description || enmType == DetailsElementType_Invalid)
     400    {
     401        m_fOptionsDescription = UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Invalid;
     402        foreach (const QString &strOption, gEDataManager->vboxManagerDetailsPaneElementOptions(DetailsElementType_Description))
     403        {
     404            const UIExtraDataMetaDefs::DetailsElementOptionTypeDescription enmOption =
     405                gpConverter->fromInternalString<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(strOption);
     406            if (enmOption != UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Invalid)
     407                m_fOptionsDescription = static_cast<UIExtraDataMetaDefs::DetailsElementOptionTypeDescription>(m_fOptionsDescription | enmOption);
     408        }
     409        if (m_fOptionsDescription == UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Invalid)
     410            m_fOptionsDescription = UIExtraDataMetaDefs::DetailsElementOptionTypeDescription_Default;
     411    }
    246412}
    247413
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.h

    r75529 r75530  
    9393    const QMap<DetailsElementType, bool> &categories() const { return m_categories; }
    9494
     95    /** Returns options for General element. */
     96    UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral        optionsGeneral()       const { return m_fOptionsGeneral; }
     97    /** Returns options for System element. */
     98    UIExtraDataMetaDefs::DetailsElementOptionTypeSystem         optionsSystem()        const { return m_fOptionsSystem; }
     99    /** Returns options for Display element. */
     100    UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay        optionsDisplay()       const { return m_fOptionsDisplay; }
     101    /** Returns options for Storage element. */
     102    UIExtraDataMetaDefs::DetailsElementOptionTypeStorage        optionsStorage()       const { return m_fOptionsStorage; }
     103    /** Returns options for Audio element. */
     104    UIExtraDataMetaDefs::DetailsElementOptionTypeAudio          optionsAudio()         const { return m_fOptionsAudio; }
     105    /** Returns options for Network element. */
     106    UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork        optionsNetwork()       const { return m_fOptionsNetwork; }
     107    /** Returns options for Serial element. */
     108    UIExtraDataMetaDefs::DetailsElementOptionTypeSerial         optionsSerial()        const { return m_fOptionsSerial; }
     109    /** Returns options for Usb element. */
     110    UIExtraDataMetaDefs::DetailsElementOptionTypeUsb            optionsUsb()           const { return m_fOptionsUsb; }
     111    /** Returns options for Shared Folders element. */
     112    UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders  optionsSharedFolders() const { return m_fOptionsSharedFolders; }
     113    /** Returns options for User Interface element. */
     114    UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface  optionsUserInterface() const { return m_fOptionsUserInterface; }
     115    /** Returns options for Description element. */
     116    UIExtraDataMetaDefs::DetailsElementOptionTypeDescription    optionsDescription()   const { return m_fOptionsDescription; }
     117
    95118public slots:
    96119
     
    137160        /** Loads settings. */
    138161        void loadSettings();
     162        /** Loads details categories. */
     163        void loadDetailsCategories();
     164        /** Loads details options for certain category @a enmType.
     165          * @note enmType equal to DetailsElementType_Invalid means load everything. */
     166        void loadDetailsOptions(DetailsElementType enmType = DetailsElementType_Invalid);
    139167
    140168        /** Saves settings. */
     
    163191    /** Holds the details categories. */
    164192    QMap<DetailsElementType, bool>  m_categories;
     193
     194    /** Holds the options for General element. */
     195    UIExtraDataMetaDefs::DetailsElementOptionTypeGeneral        m_fOptionsGeneral;
     196    /** Holds the options for System element. */
     197    UIExtraDataMetaDefs::DetailsElementOptionTypeSystem         m_fOptionsSystem;
     198    /** Holds the options for Display element. */
     199    UIExtraDataMetaDefs::DetailsElementOptionTypeDisplay        m_fOptionsDisplay;
     200    /** Holds the options for Storage element. */
     201    UIExtraDataMetaDefs::DetailsElementOptionTypeStorage        m_fOptionsStorage;
     202    /** Holds the options for Audio element. */
     203    UIExtraDataMetaDefs::DetailsElementOptionTypeAudio          m_fOptionsAudio;
     204    /** Holds the options for Network element. */
     205    UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork        m_fOptionsNetwork;
     206    /** Holds the options for Serial element. */
     207    UIExtraDataMetaDefs::DetailsElementOptionTypeSerial         m_fOptionsSerial;
     208    /** Holds the options for Usb element. */
     209    UIExtraDataMetaDefs::DetailsElementOptionTypeUsb            m_fOptionsUsb;
     210    /** Holds the options for Shared Folders element. */
     211    UIExtraDataMetaDefs::DetailsElementOptionTypeSharedFolders  m_fOptionsSharedFolders;
     212    /** Holds the options for User Interface element. */
     213    UIExtraDataMetaDefs::DetailsElementOptionTypeUserInterface  m_fOptionsUserInterface;
     214    /** Holds the options for Description element. */
     215    UIExtraDataMetaDefs::DetailsElementOptionTypeDescription    m_fOptionsDescription;
    165216};
    166217
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