VirtualBox

Changeset 60223 in vbox


Ignore:
Timestamp:
Mar 28, 2016 3:13:10 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: ​​​bugref:8308: Event handlers rework/cleanup (part 02): Basic prepare/cleanup cascade sync, styling.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

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

    r60222 r60223  
    4343{
    4444    if (!m_spInstance)
    45     {
    4645        m_spInstance = new UIConsoleEventHandler(pSession);
    47         m_spInstance->prepare();
    48     }
    4946}
    5047
     
    5451    if (m_spInstance)
    5552    {
    56         m_spInstance->cleanup();
    5753        delete m_spInstance;
    5854        m_spInstance = 0;
     
    8682    : m_pSession(pSession)
    8783{
     84    /* Prepare: */
     85    prepare();
     86}
     87
     88UIConsoleEventHandler::~UIConsoleEventHandler()
     89{
     90    /* Cleanup: */
     91    cleanup();
    8892}
    8993
     
    176180            this, SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
    177181            Qt::QueuedConnection);
    178 
    179182    connect(pListener->getWrapped(), SIGNAL(sigRuntimeError(bool, QString, QString)),
    180183            this, SIGNAL(sigRuntimeError(bool, QString, QString)),
     
    182185
    183186    /* Create direct (sync) connections for waitable signals: */
    184     connect(pListener->getWrapped(), SIGNAL(sigCanShowWindow(bool&, QString&)),
    185             this, SLOT(sltCanShowWindow(bool&, QString&)),
     187    connect(pListener->getWrapped(), SIGNAL(sigCanShowWindow(bool &, QString &)),
     188            this, SLOT(sltCanShowWindow(bool &, QString &)),
    186189            Qt::DirectConnection);
    187     connect(pListener->getWrapped(), SIGNAL(sigShowWindow(qint64&)),
    188             this, SLOT(sltShowWindow(qint64&)),
     190    connect(pListener->getWrapped(), SIGNAL(sigShowWindow(qint64 &)),
     191            this, SLOT(sltShowWindow(qint64 &)),
    189192            Qt::DirectConnection);
    190193}
     
    192195void UIConsoleEventHandler::cleanup()
    193196{
     197    /* Make sure session is passed: */
     198    AssertPtrReturnVoid(m_pSession);
     199
    194200    /* Get console: */
    195201    const CConsole console = m_pSession->session().GetConsole();
     
    198204    /* Get event-source: */
    199205    CEventSource eventSource = console.GetEventSource();
    200     AssertReturnVoid(!eventSource.isNull() || eventSource.isOk());
     206    AssertWrapperOk(eventSource);
    201207    /* Unregister listener: */
    202208    eventSource.UnregisterListener(m_mainEventListener);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h

    r60222 r60223  
    3636/** Singleton QObject extension
    3737  * providing GUI with the CConsole event-source. */
    38 class UIConsoleEventHandler: public QObject
     38class UIConsoleEventHandler : public QObject
    3939{
    4040    Q_OBJECT;
     
    9999    /** Constructs console event handler for passed @a pSession. */
    100100    UIConsoleEventHandler(UISession *pSession);
     101    /** Destructs console event handler. */
     102    ~UIConsoleEventHandler();
    101103
    102104    /** Prepares all. */
     
    108110    static UIConsoleEventHandler *m_spInstance;
    109111
     112    /** Holds the COM event listener instance. */
     113    CEventListener m_mainEventListener;
     114
    110115    /** Holds the UI session reference. */
    111116    UISession *m_pSession;
    112 
    113     /** Holds the main event listener instance. */
    114     CEventListener m_mainEventListener;
    115117};
    116118
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.cpp

    r60222 r60223  
    3232
    3333/* static */
    34 UIVirtualBoxEventHandler *UIVirtualBoxEventHandler::m_pInstance = 0;
     34UIVirtualBoxEventHandler *UIVirtualBoxEventHandler::m_spInstance = 0;
    3535
    3636/* static */
    3737UIVirtualBoxEventHandler* UIVirtualBoxEventHandler::instance()
    3838{
    39     if (!m_pInstance)
    40         m_pInstance = new UIVirtualBoxEventHandler;
    41     return m_pInstance;
     39    if (!m_spInstance)
     40        m_spInstance = new UIVirtualBoxEventHandler;
     41    return m_spInstance;
    4242}
    4343
     
    4545void UIVirtualBoxEventHandler::destroy()
    4646{
    47     if (m_pInstance)
     47    if (m_spInstance)
    4848    {
    49         delete m_pInstance;
    50         m_pInstance = 0;
     49        delete m_spInstance;
     50        m_spInstance = 0;
    5151    }
    5252}
    5353
    5454UIVirtualBoxEventHandler::UIVirtualBoxEventHandler()
     55{
     56    /* Prepare: */
     57    prepare();
     58}
     59
     60UIVirtualBoxEventHandler::~UIVirtualBoxEventHandler()
     61{
     62    /* Cleanup: */
     63    cleanup();
     64}
     65
     66void UIVirtualBoxEventHandler::prepare()
    5567{
    5668    /* Create Main event listener instance: */
     
    124136}
    125137
    126 UIVirtualBoxEventHandler::~UIVirtualBoxEventHandler()
     138void UIVirtualBoxEventHandler::cleanup()
    127139{
    128140    /* Get VirtualBox: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.h

    r60222 r60223  
    6969    ~UIVirtualBoxEventHandler();
    7070
     71    /** Prepares all. */
     72    void prepare();
     73    /** Cleanups all. */
     74    void cleanup();
     75
    7176    /** Holds the singleton static VirtualBox event handler instance. */
    72     static UIVirtualBoxEventHandler *m_pInstance;
     77    static UIVirtualBoxEventHandler *m_spInstance;
    7378
    7479    /** Holds the COM event listener instance. */
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