VirtualBox

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


Ignore:
Timestamp:
Jun 19, 2013 4:24:52 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: UI status-bar indicator-pool interface: Cleanup (part 2).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r46676 r46677  
    739739    , m_pool(UIIndicatorIndex_End)
    740740{
     741    /* Prepare: */
     742    prepare();
    741743}
    742744
    743745UIIndicatorsPool::~UIIndicatorsPool()
    744746{
    745     for (int i = 0; i < m_pool.size(); ++i)
    746     {
    747         delete m_pool[i];
    748         m_pool[i] = 0;
    749     }
    750     m_pool.clear();
     747    /* Cleanup: */
     748    cleanup();
    751749}
    752750
    753751QIStateIndicator* UIIndicatorsPool::indicator(UIIndicatorIndex index)
    754752{
    755     if (!m_pool.at(index))
    756     {
     753    /* Just return what already exists: */
     754    return m_pool[index];
     755}
     756
     757void UIIndicatorsPool::prepare()
     758{
     759    /* Populate indicator-pool: */
     760    for (int iIndex = 0; iIndex < UIIndicatorIndex_End; ++iIndex)
     761    {
     762        /* Prepare indicator: */
     763        UIIndicatorIndex index = static_cast<UIIndicatorIndex>(iIndex);
    757764        switch (index)
    758765        {
     
    770777        }
    771778    }
    772     return m_pool.at(index);
    773779}
    774780
     781void UIIndicatorsPool::cleanup()
     782{
     783    /* Wipe-out indicator-pool: */
     784    for (int iIndex = 0; iIndex < UIIndicatorIndex_End; ++iIndex)
     785    {
     786        /* Wipe-out indicator: */
     787        delete m_pool[iIndex];
     788        m_pool[iIndex] = 0;
     789    }
     790}
     791
    775792#include "UIIndicatorsPool.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h

    r46676 r46677  
    5858private:
    5959
     60    /* Helpers: Prepare/cleanup stuff: */
     61    void prepare();
     62    void cleanup();
     63
    6064    /* Variables: */
    6165    CSession &m_session;
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