VirtualBox

Changeset 71037 in vbox for trunk


Ignore:
Timestamp:
Feb 16, 2018 12:46:20 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699 Remove UIGuestSessionsEventHandler class

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r71005 r71037  
    378378        src/runtime/information/guestctrl/UIGuestControlConsole.h \
    379379        src/runtime/information/guestctrl/UIGuestControlInterface.h \
    380         src/runtime/information/guestctrl/UIGuestSessionsEventHandler.h \
    381380        src/runtime/information/guestctrl/UIGuestSessionTreeItem.h \
    382381        src/runtime/information/guestctrl/UIInformationGuestSession.h \
     
    566565        src/runtime/UIIndicatorsPool.cpp \
    567566        src/runtime/UIStatusBarEditorWindow.cpp \
    568        src/runtime/information/guestctrl/UIGuestSessionsEventHandler.cpp \
    569567        src/selector/UIActionPoolSelector.cpp \
    570568        src/selector/UIDesktopPane.cpp \
     
    710708        src/runtime/information/guestctrl/UIGuestControlInterface.cpp \
    711709        src/runtime/information/guestctrl/UIInformationGuestSession.cpp \
    712         src/runtime/information/guestctrl/UIGuestSessionsEventHandler.cpp \
    713710        src/runtime/information/guestctrl/UIGuestSessionTreeItem.cpp \
    714711        src/runtime/normal/UIKeyboardHandlerNormal.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.cpp

    r70899 r71037  
    243243        }
    244244
    245         UIInformationGuestSession *pGuestSessionWidget =
    246             new UIInformationGuestSession(this, m_pMachineWindow->console());
    247         if (pGuestSessionWidget)
    248         {
    249             m_tabs.insert(2, pGuestSessionWidget);
    250             m_pTabWidget->addTab(m_tabs.value(2), QString());
    251         }
    252 
     245        if(m_pMachineWindow->console().isOk())
     246        {
     247            UIInformationGuestSession *pGuestSessionWidget =
     248                new UIInformationGuestSession(this, m_pMachineWindow->console().GetGuest());
     249            if (pGuestSessionWidget)
     250            {
     251                m_tabs.insert(2, pGuestSessionWidget);
     252                m_pTabWidget->addTab(m_tabs.value(2), QString());
     253            }
     254        }
    253255        /* Set Runtime Information tab as default: */
    254256        m_pTabWidget->setCurrentIndex(1);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestSessionTreeItem.cpp

    r71025 r71037  
    2222/* GUI includes: */
    2323# include "UIGuestSessionTreeItem.h"
    24 # include "UIGuestSessionsEventHandler.h"
    2524# include "VBoxGlobal.h"
    2625
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIInformationGuestSession.cpp

    r71025 r71037  
    2727/* GUI includes: */
    2828# include "QITreeWidget.h"
     29# include "UIExtraDataManager.h"
    2930# include "UIGuestControlConsole.h"
    3031# include "UIGuestControlInterface.h"
    3132# include "UIGuestSessionTreeItem.h"
    32 # include "UIGuestSessionsEventHandler.h"
    3333# include "UIInformationGuestSession.h"
     34
    3435# include "VBoxGlobal.h"
    3536
    3637/* COM includes: */
    3738# include "CGuest.h"
     39# include "CEventSource.h"
    3840
    3941#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    4042
    41 UIInformationGuestSession::UIInformationGuestSession(QWidget *pParent, const CConsole &console)
     43UIInformationGuestSession::UIInformationGuestSession(QWidget *pParent, const CGuest &comGuest)
    4244    : QWidget(pParent)
    43     , m_comConsole(console)
     45    , m_comGuest(comGuest)
    4446    , m_pMainLayout(0)
    4547    , m_pSplitter(0)
    46     , m_pGuestSessionsEventHandler(0)
    4748    , m_pTreeWidget(0)
    4849    , m_pConsole(0)
    4950    , m_pControlInterface(0)
    50 {
     51    , m_pQtListener(0)
     52{
     53    prepareListener();
    5154    prepareObjects();
    5255    prepareConnections();
    53 
    54     // if(m_pControlInterface)
    55     //     m_pControlInterface->unitTest();
    5656}
    5757
    5858void UIInformationGuestSession::prepareObjects()
    5959{
    60     m_pGuestSessionsEventHandler = new UIGuestSessionsEventHandler(this, m_comConsole.GetGuest());
    61     m_pControlInterface = new UIGuestControlInterface(this, m_comConsole.GetGuest());
     60    m_pControlInterface = new UIGuestControlInterface(this, m_comGuest);
    6261
    6362    /* Create layout: */
     
    101100    if (!m_pTreeWidget)
    102101        return;
    103     if (!m_pGuestSessionsEventHandler)
    104         return;
    105102
    106103    m_pTreeWidget->clear();
    107104    QVector<QITreeWidgetItem> treeItemVector;
    108     m_pGuestSessionsEventHandler->populateGuestSessionsTree(m_pTreeWidget);
    109105    update();
    110106}
     
    116112    connect(m_pConsole, &UIGuestControlConsole::commandEntered,
    117113            this, &UIInformationGuestSession::sltConsoleCommandEntered);
    118     connect(m_pGuestSessionsEventHandler, &UIGuestSessionsEventHandler::sigGuestSessionsUpdated,
    119             this, &UIInformationGuestSession::sltGuestSessionsUpdated);
     114    if(m_pQtListener)
     115    {
     116        connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigGuestSessionRegistered,
     117                this, &UIInformationGuestSession::sltGuestSessionRegistered, Qt::DirectConnection);
     118        connect(m_pQtListener->getWrapped(), &UIMainEventListener::sigGuestSessionUnregistered,
     119                this, &UIInformationGuestSession::sltGuestSessionUnregistered, Qt::DirectConnection);
     120    }
    120121}
    121122
     
    140141    }
    141142}
     143
     144void UIInformationGuestSession::prepareListener()
     145{
     146    /* Create event listener instance: */
     147    m_pQtListener.createObject();
     148    m_pQtListener->init(new UIMainEventListener, this);
     149    m_comEventListener = CEventListener(m_pQtListener);
     150
     151    /* Get CProgress event source: */
     152    CEventSource comEventSource = m_comGuest.GetEventSource();
     153    AssertWrapperOk(comEventSource);
     154
     155    /* Enumerate all the required event-types: */
     156    QVector<KVBoxEventType> eventTypes;
     157    eventTypes << KVBoxEventType_OnGuestSessionRegistered;
     158
     159
     160    /* Register event listener for CProgress event source: */
     161    comEventSource.RegisterListener(m_comEventListener, eventTypes,
     162        gEDataManager->eventHandlingType() == EventHandlingType_Active ? TRUE : FALSE);
     163    AssertWrapperOk(comEventSource);
     164
     165    /* If event listener registered as passive one: */
     166    if (gEDataManager->eventHandlingType() == EventHandlingType_Passive)
     167    {
     168        /* Register event sources in their listeners as well: */
     169        m_pQtListener->getWrapped()->registerSource(comEventSource, m_comEventListener);
     170    }
     171}
     172
     173void UIInformationGuestSession::cleanupListener()
     174{
     175    /* If event listener registered as passive one: */
     176    if (gEDataManager->eventHandlingType() == EventHandlingType_Passive)
     177    {
     178        /* Unregister everything: */
     179        m_pQtListener->getWrapped()->unregisterSources();
     180    }
     181
     182    /* Make sure VBoxSVC is available: */
     183    if (!vboxGlobal().isVBoxSVCAvailable())
     184        return;
     185
     186    /* Get CProgress event source: */
     187    CEventSource comEventSource = m_comGuest.GetEventSource();
     188    AssertWrapperOk(comEventSource);
     189
     190    /* Unregister event listener for CProgress event source: */
     191    comEventSource.UnregisterListener(m_comEventListener);
     192}
     193
     194
     195void UIInformationGuestSession::sltGuestSessionRegistered(CGuestSession guestSession)
     196{
     197    if (!guestSession.isOk())
     198        return;
     199    //printf("sltGuestSessionRegistered \n");
     200    // addGuestSession(guestSession);
     201    // emit sigGuestSessionUpdated();
     202}
     203
     204void UIInformationGuestSession::sltGuestSessionUnregistered(CGuestSession guestSession)
     205{
     206    if (!guestSession.isOk())
     207        return;
     208    // removeGuestSession(guestSession);
     209    // emit sigGuestSessionUpdated();
     210}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIInformationGuestSession.h

    r71025 r71037  
    2424/* COM includes: */
    2525#include "COMEnums.h"
    26 #include "CConsole.h"
     26#include "CGuest.h"
     27#include "CEventListener.h"
     28
     29/* GUI includes: */
     30#include "UIMainEventListener.h"
    2731
    2832/* Forward declarations: */
     
    3337class UIGuestControlInterface;
    3438class UIGuestSessionsEventHandler;
     39
     40
    3541
    3642/** QWidget extension
     
    4450public:
    4551
    46     UIInformationGuestSession(QWidget *pParent, const CConsole &console);
     52    UIInformationGuestSession(QWidget *pParent, const CGuest &comGuest);
    4753
    4854private slots:
     
    5258    void sltConsoleOutputReceived(const QString &strOutput);
    5359
     60    void sltGuestSessionRegistered(CGuestSession guestSession);
     61    void sltGuestSessionUnregistered(CGuestSession guestSession);
     62
    5463private:
    5564
    5665    void prepareObjects();
    5766    void prepareConnections();
     67    void prepareListener();
    5868    void updateTreeWidget();
    59 
    60     CConsole                 m_comConsole;
     69    void cleanupListener();
     70    CGuest                   m_comGuest;
    6171    QVBoxLayout             *m_pMainLayout;
    6272    QSplitter               *m_pSplitter;
    63     UIGuestSessionsEventHandler *m_pGuestSessionsEventHandler;
    6473    QITreeWidget            *m_pTreeWidget;
    6574    UIGuestControlConsole   *m_pConsole;
    6675    UIGuestControlInterface *m_pControlInterface;
     76
     77                /** Holds the Qt event listener instance. */
     78    ComObjPtr<UIMainEventListenerImpl> m_pQtListener;
     79    /** Holds the COM event listener instance. */
     80    CEventListener m_comEventListener;
    6781};
    6882
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