VirtualBox

Changeset 54145 in vbox


Ignore:
Timestamp:
Feb 11, 2015 3:42:49 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 7115: Use cached COM objects in UIIndicatorPool.

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

Legend:

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

    r53320 r54145  
    6969
    7070    /** Constructor which remembers passed @a session object. */
    71     UISessionStateStatusBarIndicator(CSession &session) : m_session(session) {}
     71    UISessionStateStatusBarIndicator(UISession *pSession) : m_pSession(pSession) {}
    7272
    7373    /** Abstract update routine. */
     
    7676protected:
    7777
    78     /** Holds the session reference. */
    79     CSession &m_session;
     78    /** Holds the session UI reference. */
     79    UISession *m_pSession;
    8080};
    8181
     
    8787public:
    8888
    89     /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
    90     UIIndicatorHardDrive(CSession &session)
    91         : UISessionStateStatusBarIndicator(session)
     89    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
     90    UIIndicatorHardDrive(UISession *pSession)
     91        : UISessionStateStatusBarIndicator(pSession)
    9292    {
    9393        /* Assign state-icons: */
     
    112112    {
    113113        /* Get machine: */
    114         const CMachine machine = m_session.GetMachine();
     114        const CMachine machine = m_pSession->machine();
    115115
    116116        /* Prepare tool-tip: */
     
    160160public:
    161161
    162     /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
    163     UIIndicatorOpticalDisks(CSession &session)
    164         : UISessionStateStatusBarIndicator(session)
     162    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
     163    UIIndicatorOpticalDisks(UISession *pSession)
     164        : UISessionStateStatusBarIndicator(pSession)
    165165    {
    166166        /* Assign state-icons: */
     
    185185    {
    186186        /* Get machine: */
    187         const CMachine machine = m_session.GetMachine();
     187        const CMachine machine = m_pSession->machine();
    188188
    189189        /* Prepare tool-tip: */
     
    237237public:
    238238
    239     /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
    240     UIIndicatorFloppyDisks(CSession &session)
    241         : UISessionStateStatusBarIndicator(session)
     239    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
     240    UIIndicatorFloppyDisks(UISession *pSession)
     241        : UISessionStateStatusBarIndicator(pSession)
    242242    {
    243243        /* Assign state-icons: */
     
    262262    {
    263263        /* Get machine: */
    264         const CMachine machine = m_session.GetMachine();
     264        const CMachine machine = m_pSession->machine();
    265265
    266266        /* Prepare tool-tip: */
     
    314314public:
    315315
    316     /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
     316    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
    317317    UIIndicatorNetwork(UISession *pSession)
    318         : UISessionStateStatusBarIndicator(pSession->session())
    319         , m_pSession(pSession)
     318        : UISessionStateStatusBarIndicator(pSession)
    320319        , m_pTimerAutoUpdate(0)
    321320    {
     
    374373    {
    375374        /* Get machine: */
    376         const CMachine machine = m_session.GetMachine();
     375        const CMachine machine = m_pSession->machine();
    377376
    378377        /* Prepare tool-tip: */
     
    452451    }
    453452
    454     /** Holds the session UI reference. */
    455     UISession *m_pSession;
    456453    /** Holds the auto-update timer instance. */
    457454    QTimer *m_pTimerAutoUpdate;
     
    465462public:
    466463
    467     /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
    468     UIIndicatorUSB(CSession &session)
    469         : UISessionStateStatusBarIndicator(session)
     464    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
     465    UIIndicatorUSB(UISession *pSession)
     466        : UISessionStateStatusBarIndicator(pSession)
    470467    {
    471468        /* Assign state-icons: */
     
    490487    {
    491488        /* Get machine: */
    492         const CMachine machine = m_session.GetMachine();
     489        const CMachine machine = m_pSession->machine();
    493490
    494491        /* Prepare tool-tip: */
     
    505502        {
    506503            /* Enumerate all the USB devices: */
    507             const CConsole &console = m_session.GetConsole();
     504            const CConsole console = m_pSession->console();
    508505            foreach (const CUSBDevice &usbDevice, console.GetUSBDevices())
    509506                strFullData += QString("<br><b><nobr>%1</nobr></b>").arg(vboxGlobal().details(usbDevice));
     
    531528public:
    532529
    533     /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
    534     UIIndicatorSharedFolders(CSession &session)
    535         : UISessionStateStatusBarIndicator(session)
     530    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
     531    UIIndicatorSharedFolders(UISession *pSession)
     532        : UISessionStateStatusBarIndicator(pSession)
    536533    {
    537534        /* Assign state-icons: */
     
    555552    void updateAppearance()
    556553    {
    557         /* Get machine: */
    558         const CMachine machine = m_session.GetMachine();
    559         const CConsole console = m_session.GetConsole();
     554        /* Get objects: */
     555        const CMachine machine = m_pSession->machine();
     556        const CConsole console = m_pSession->console();
     557        const CGuest guest = m_pSession->guest();
    560558
    561559        /* Prepare tool-tip: */
     
    576574        {
    577575            /* Select slashes depending on the OS type: */
    578             if (VBoxGlobal::isDOSType(console.GetGuest().GetOSTypeId()))
     576            if (VBoxGlobal::isDOSType(guest.GetOSTypeId()))
    579577                strFullData += QString("<br><nobr><b>\\\\vboxsvr\\%1&nbsp;</b></nobr><nobr>%2</nobr>")
    580578                                       .arg(it.key(), it.value());
     
    601599public:
    602600
    603     /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
    604     UIIndicatorDisplay(CSession &session)
    605         : UISessionStateStatusBarIndicator(session)
     601    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
     602    UIIndicatorDisplay(UISession *pSession)
     603        : UISessionStateStatusBarIndicator(pSession)
    606604    {
    607605        /* Assign state-icons: */
     
    625623    {
    626624        /* Get machine: */
    627         const CMachine machine = m_session.GetMachine();
     625        const CMachine machine = m_pSession->machine();
    628626
    629627        /* Prepare tool-tip: */
     
    683681public:
    684682
    685     /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
    686     UIIndicatorVideoCapture(CSession &session)
    687         : UISessionStateStatusBarIndicator(session)
     683    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
     684    UIIndicatorVideoCapture(UISession *pSession)
     685        : UISessionStateStatusBarIndicator(pSession)
    688686        , m_pAnimation(0)
    689687        , m_dRotationAngle(0)
     
    756754    {
    757755        /* Get machine: */
    758         const CMachine machine = m_session.GetMachine();
     756        const CMachine machine = m_pSession->machine();
    759757
    760758        /* Prepare tool-tip: */
     
    805803public:
    806804
    807     /** Constructor, passes @a session to the UISessionStateStatusBarIndicator constructor. */
    808     UIIndicatorFeatures(CSession &session)
    809         : UISessionStateStatusBarIndicator(session)
     805    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
     806    UIIndicatorFeatures(UISession *pSession)
     807        : UISessionStateStatusBarIndicator(pSession)
    810808    {
    811809        /* Assign state-icons: */
     
    827825    void updateAppearance()
    828826    {
    829         /* Get console: */
    830         const CConsole console = m_session.GetConsole();
    831         if (console.isNull())
    832             return;
    833 
    834         /* Get debugger: */
    835         const CMachineDebugger debugger = console.GetDebugger();
    836         if (debugger.isNull())
    837             return;
     827        /* Get objects: */
     828        const CMachine machine = m_pSession->machine();
     829        const CMachineDebugger debugger = m_pSession->debugger();
    838830
    839831        /* VT-x/AMD-V feature: */
     
    854846            VBoxGlobal::tr("Enabled", "details report (Unrestricted Execution)") :
    855847            VBoxGlobal::tr("Disabled", "details report (Unrestricted Execution)");
    856 
    857         /* Get machine: */
    858         const CMachine machine = console.GetMachine();
    859         if (machine.isNull())
    860             return;
    861848
    862849        /* CPU Execution Cap feature: */
     
    898885    /** Constructor, using @a pSession for state-update routine. */
    899886    UIIndicatorMouse(UISession *pSession)
    900         : UISessionStateStatusBarIndicator(pSession->session())
     887        : UISessionStateStatusBarIndicator(pSession)
    901888    {
    902889        /* Assign state-icons: */
     
    958945    /** Constructor, using @a pSession for state-update routine. */
    959946    UIIndicatorKeyboard(UISession *pSession)
    960         : UISessionStateStatusBarIndicator(pSession->session())
     947        : UISessionStateStatusBarIndicator(pSession)
    961948    {
    962949        /* Assign state-icons: */
     
    10291016    : QWidget(pParent)
    10301017    , m_pSession(pSession)
    1031     , m_session(m_pSession->session())
    10321018    , m_fEnabled(false)
    10331019    , m_pTimerAutoUpdate(0)
     
    11031089
    11041090    /* Acquire current states from the console: */
    1105     CConsole console = m_session.GetConsole();
    1106     if (!m_session.isOk() || console.isNull())
     1091    CConsole console = m_pSession->console();
     1092    if (console.isNull() || !console.isOk())
    11071093        return;
    11081094    const QVector<KDeviceActivity> states = console.GetDeviceActivity(deviceTypes);
     
    12581244            switch (indicatorType)
    12591245            {
    1260                 case IndicatorType_HardDisks:         m_pool[indicatorType] = new UIIndicatorHardDrive(m_session);     break;
    1261                 case IndicatorType_OpticalDisks:      m_pool[indicatorType] = new UIIndicatorOpticalDisks(m_session);  break;
    1262                 case IndicatorType_FloppyDisks:       m_pool[indicatorType] = new UIIndicatorFloppyDisks(m_session);   break;
     1246                case IndicatorType_HardDisks:         m_pool[indicatorType] = new UIIndicatorHardDrive(m_pSession);     break;
     1247                case IndicatorType_OpticalDisks:      m_pool[indicatorType] = new UIIndicatorOpticalDisks(m_pSession);  break;
     1248                case IndicatorType_FloppyDisks:       m_pool[indicatorType] = new UIIndicatorFloppyDisks(m_pSession);   break;
    12631249                case IndicatorType_Network:           m_pool[indicatorType] = new UIIndicatorNetwork(m_pSession);       break;
    1264                 case IndicatorType_USB:               m_pool[indicatorType] = new UIIndicatorUSB(m_session);           break;
    1265                 case IndicatorType_SharedFolders:     m_pool[indicatorType] = new UIIndicatorSharedFolders(m_session); break;
    1266                 case IndicatorType_Display:           m_pool[indicatorType] = new UIIndicatorDisplay(m_session);       break;
    1267                 case IndicatorType_VideoCapture:      m_pool[indicatorType] = new UIIndicatorVideoCapture(m_session);  break;
    1268                 case IndicatorType_Features:          m_pool[indicatorType] = new UIIndicatorFeatures(m_session);      break;
    1269                 case IndicatorType_Mouse:             m_pool[indicatorType] = new UIIndicatorMouse(m_pSession);        break;
    1270                 case IndicatorType_Keyboard:          m_pool[indicatorType] = new UIIndicatorKeyboard(m_pSession);     break;
    1271                 case IndicatorType_KeyboardExtension: m_pool[indicatorType] = new UIIndicatorKeyboardExtension;        break;
     1250                case IndicatorType_USB:               m_pool[indicatorType] = new UIIndicatorUSB(m_pSession);           break;
     1251                case IndicatorType_SharedFolders:     m_pool[indicatorType] = new UIIndicatorSharedFolders(m_pSession); break;
     1252                case IndicatorType_Display:           m_pool[indicatorType] = new UIIndicatorDisplay(m_pSession);       break;
     1253                case IndicatorType_VideoCapture:      m_pool[indicatorType] = new UIIndicatorVideoCapture(m_pSession);  break;
     1254                case IndicatorType_Features:          m_pool[indicatorType] = new UIIndicatorFeatures(m_pSession);      break;
     1255                case IndicatorType_Mouse:             m_pool[indicatorType] = new UIIndicatorMouse(m_pSession);         break;
     1256                case IndicatorType_Keyboard:          m_pool[indicatorType] = new UIIndicatorKeyboard(m_pSession);      break;
     1257                case IndicatorType_KeyboardExtension: m_pool[indicatorType] = new UIIndicatorKeyboardExtension;         break;
    12721258                default: break;
    12731259            }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h

    r53320 r54145  
    106106    /** Holds the UI session reference. */
    107107    UISession *m_pSession;
    108     /** Holds the session reference. */
    109     CSession &m_session;
    110108    /** Holds whether status-bar is enabled. */
    111109    bool m_fEnabled;
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