VirtualBox

Changeset 44014 in vbox for trunk


Ignore:
Timestamp:
Dec 3, 2012 2:37:33 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: VM group UI: Details-view: Set-item cleanup (part 2).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp

    r44013 r44014  
    6262    m_fFullSet = fFullSet;
    6363    m_settings = settings;
     64
     65    /* Cleanup superfluous items: */
     66    if (!m_fFullSet)
     67        for (int i = DetailsElementType_Display; i <= DetailsElementType_Description; ++i)
     68            if (m_elements.contains(i))
     69                delete m_elements[i];
     70
     71    /* Choose last-step number: */
     72    m_iLastStep = m_fFullSet ? DetailsElementType_Description : DetailsElementType_Preview;
     73
     74    /* Fetch USB controller restrictions: */
     75    const CUSBController &ctl = m_machine.GetUSBController();
     76    if (ctl.isNull() || !ctl.GetProxyAvailable())
     77    {
     78        QString strElementTypeOpened = gpConverter->toInternalString(DetailsElementType_USB);
     79        QString strElementTypeClosed = strElementTypeOpened + "Closed";
     80        m_settings.removeAll(strElementTypeOpened);
     81        m_settings.removeAll(strElementTypeClosed);
     82    }
    6483
    6584    /* Create elements step-by-step: */
     
    457476void UIGDetailsSet::prepareElements()
    458477{
    459     /* Which will be the last step? */
    460     m_iLastStep = m_fFullSet ? DetailsElementType_Description : DetailsElementType_Preview;
    461     /* Cleanup superfluous elements: */
    462     if (!m_fFullSet)
    463         for (int i = DetailsElementType_Display; i <= DetailsElementType_Description; ++i)
    464             if (m_elements.contains(i))
    465                 delete m_elements[i];
    466 
    467     /* Per-set configuration: */
    468     {
    469         /* USB controller restrictions: */
    470         const CUSBController &ctl = machine().GetUSBController();
    471         if (ctl.isNull() || !ctl.GetProxyAvailable())
    472         {
    473             QString strElementTypeOpened = gpConverter->toInternalString(DetailsElementType_USB);
    474             QString strElementTypeClosed = strElementTypeOpened + "Closed";
    475             m_settings.removeAll(strElementTypeOpened);
    476             m_settings.removeAll(strElementTypeClosed);
    477         }
    478     }
    479 
    480478    /* Cleanup step: */
    481479    delete m_pStep;
     
    566564UIGDetailsElement* UIGDetailsSet::createElement(DetailsElementType elementType, bool fOpen)
    567565{
    568     UIGDetailsElement *pElement = 0;
     566    /* Element factory: */
    569567    switch (elementType)
    570568    {
    571         case DetailsElementType_General:
    572         {
    573             /* Create 'general' element: */
    574             pElement = new UIGDetailsElementGeneral(this, fOpen);
    575             break;
    576         }
    577         case DetailsElementType_System:
    578         {
    579             /* Create 'system' element: */
    580             pElement = new UIGDetailsElementSystem(this, fOpen);
    581             break;
    582         }
    583         case DetailsElementType_Preview:
    584         {
    585             /* Create 'preview' element: */
    586             pElement = new UIGDetailsElementPreview(this, fOpen);
    587             break;
    588         }
    589         case DetailsElementType_Display:
    590         {
    591             /* Create 'display' element: */
    592             pElement = new UIGDetailsElementDisplay(this, fOpen);
    593             break;
    594         }
    595         case DetailsElementType_Storage:
    596         {
    597             /* Create 'storage' element: */
    598             pElement = new UIGDetailsElementStorage(this, fOpen);
    599             break;
    600         }
    601         case DetailsElementType_Audio:
    602         {
    603             /* Create 'audio' element: */
    604             pElement = new UIGDetailsElementAudio(this, fOpen);
    605             break;
    606         }
    607         case DetailsElementType_Network:
    608         {
    609             /* Create 'network' element: */
    610             pElement = new UIGDetailsElementNetwork(this, fOpen);
    611             break;
    612         }
    613         case DetailsElementType_Serial:
    614         {
    615             /* Create 'serial' element: */
    616             pElement = new UIGDetailsElementSerial(this, fOpen);
    617             break;
    618         }
     569        case DetailsElementType_General:     return new UIGDetailsElementGeneral(this, fOpen);
     570        case DetailsElementType_System:      return new UIGDetailsElementSystem(this, fOpen);
     571        case DetailsElementType_Preview:     return new UIGDetailsElementPreview(this, fOpen);
     572        case DetailsElementType_Display:     return new UIGDetailsElementDisplay(this, fOpen);
     573        case DetailsElementType_Storage:     return new UIGDetailsElementStorage(this, fOpen);
     574        case DetailsElementType_Audio:       return new UIGDetailsElementAudio(this, fOpen);
     575        case DetailsElementType_Network:     return new UIGDetailsElementNetwork(this, fOpen);
     576        case DetailsElementType_Serial:      return new UIGDetailsElementSerial(this, fOpen);
    619577#ifdef VBOX_WITH_PARALLEL_PORTS
    620         case DetailsElementType_Parallel:
    621         {
    622             /* Create 'parallel' element: */
    623             pElement = new UIGDetailsElementParallel(this, fOpen);
    624             break;
    625         }
     578        case DetailsElementType_Parallel:    return new UIGDetailsElementParallel(this, fOpen);
    626579#endif /* VBOX_WITH_PARALLEL_PORTS */
    627         case DetailsElementType_USB:
    628         {
    629             /* Create 'usb' element: */
    630             pElement = new UIGDetailsElementUSB(this, fOpen);
    631             break;
    632         }
    633         case DetailsElementType_SF:
    634         {
    635             /* Create 'sf' element: */
    636             pElement = new UIGDetailsElementSF(this, fOpen);
    637             break;
    638         }
    639         case DetailsElementType_Description:
    640         {
    641             /* Create 'description' element: */
    642             pElement = new UIGDetailsElementDescription(this, fOpen);
    643             break;
    644         }
    645     }
    646     return pElement;
    647 }
    648 
     580        case DetailsElementType_USB:         return new UIGDetailsElementUSB(this, fOpen);
     581        case DetailsElementType_SF:          return new UIGDetailsElementSF(this, fOpen);
     582        case DetailsElementType_Description: return new UIGDetailsElementDescription(this, fOpen);
     583    }
     584    return 0;
     585}
     586
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