VirtualBox

Changeset 51047 in vbox


Ignore:
Timestamp:
Apr 11, 2014 11:21:25 AM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: 6660: Advanced extra-data management framework: Prepare/cleanup routines encapsulation.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r51038 r51047  
    4949    /** Notifies about HID LED sync state change. */
    5050    void sigHIDLedsSyncStateChange(bool fEnabled);
     51
    5152#ifdef RT_OS_DARWIN
    5253    /** Mac OS X: Notifies about 'presentation mode' status change. */
     
    172173UIExtraDataManager* UIExtraDataManager::instance()
    173174{
    174     /* Create instance if not yet exists: */
     175    /* Create/prepare instance if not yet exists: */
    175176    if (!m_pInstance)
    176         m_pInstance = new UIExtraDataManager();
     177    {
     178        new UIExtraDataManager;
     179        m_pInstance->prepare();
     180    }
    177181    /* Return instance: */
    178182    return m_pInstance;
     
    182186void UIExtraDataManager::destroy()
    183187{
    184     /* Destroy instance if still exists: */
     188    /* Destroy/cleanup instance if still exists: */
    185189    if (m_pInstance)
    186190    {
     191        m_pInstance->cleanup();
    187192        delete m_pInstance;
    188         m_pInstance = 0;
    189193    }
    190194}
     
    192196UIExtraDataManager::UIExtraDataManager()
    193197    : m_pHandler(new UIExtraDataEventHandler(this))
     198{
     199    /* Connect to static instance: */
     200    m_pInstance = this;
     201}
     202
     203UIExtraDataManager::~UIExtraDataManager()
     204{
     205    /* Disconnect from static instance: */
     206    m_pInstance = 0;
     207}
     208
     209void UIExtraDataManager::prepare()
     210{
     211    /* Prepare Main event-listener: */
     212    prepareMainEventListener();
     213    /* Prepare extra-data event-handler: */
     214    prepareExtraDataEventHandler();
     215}
     216
     217void UIExtraDataManager::prepareMainEventListener()
    194218{
    195219    /* Register Main event-listener:  */
     
    214238            m_pHandler, SLOT(sltExtraDataChange(QString, QString, QString)),
    215239            Qt::DirectConnection);
    216 
     240}
     241
     242void UIExtraDataManager::prepareExtraDataEventHandler()
     243{
    217244    /* Language change signal: */
    218245    connect(m_pHandler, SIGNAL(sigLanguageChange(QString)),
     
    246273}
    247274
    248 UIExtraDataManager::~UIExtraDataManager()
     275void UIExtraDataManager::cleanup()
     276{
     277    /* Cleanup Main event-listener: */
     278    cleanupMainEventListener();
     279}
     280
     281void UIExtraDataManager::cleanupMainEventListener()
    249282{
    250283    /* Unregister Main event-listener:  */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r51038 r51047  
    6868    ~UIExtraDataManager();
    6969
     70    /** Prepare Extra-data Manager. */
     71    void prepare();
     72    /** Prepare Main event-listener. */
     73    void prepareMainEventListener();
     74    /** Prepare extra-data event-handler. */
     75    void prepareExtraDataEventHandler();
     76
     77    /** Cleanup Extra-data Manager. */
     78    void cleanup();
     79    /** Cleanup Main event-listener. */
     80    void cleanupMainEventListener();
     81    // /** Cleanup extra-data event-handler. */
     82    // void cleanupExtraDataEventHandler() {}
     83
    7084    /** Singleton Extra-data Manager instance. */
    7185    static UIExtraDataManager *m_pInstance;
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