VirtualBox

Changeset 51048 in vbox


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

FE/Qt: 6660: Advanced extra-data management framework: Caching extra-data values.

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

Legend:

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

    r51047 r51048  
    2929#include "COMEnums.h"
    3030#include "CEventSource.h"
     31#include "CVirtualBox.h"
     32#include "CMachine.h"
    3133
    3234
     
    213215    /* Prepare extra-data event-handler: */
    214216    prepareExtraDataEventHandler();
     217    /* Prepare extra-data map: */
     218    prepareExtraDataMap();
    215219}
    216220
     
    273277}
    274278
     279void UIExtraDataManager::prepareExtraDataMap()
     280{
     281    /* Get CVirtualBox: */
     282    CVirtualBox vbox = vboxGlobal().virtualBox();
     283    /* Load extra-data map: */
     284    if (!vboxGlobal().isVMConsoleProcess())
     285    {
     286        /* From CVirtualBox for Selector UI: */
     287        foreach (const QString &strKey, vbox.GetExtraDataKeys())
     288            m_data[strKey] = vbox.GetExtraData(strKey);
     289    }
     290    else
     291    {
     292        /* From CMachine for Runtime UI: */
     293        const QString strMachineID = vboxGlobal().managedVMUuid();
     294        CMachine machine = vbox.FindMachine(strMachineID);
     295        AssertMsgReturnVoid(vbox.isOk() && !machine.isNull(),
     296                            ("Machine with ID={%s} was not found!\n",
     297                             strMachineID.toAscii().constData()));
     298        foreach (const QString &strKey, machine.GetExtraDataKeys())
     299            m_data[strKey] = machine.GetExtraData(strKey);
     300    }
     301}
     302
    275303void UIExtraDataManager::cleanup()
    276304{
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r51047 r51048  
    2020/* Qt includes: */
    2121#include <QObject>
     22#include <QMap>
    2223
    2324/* COM includes: */
     
    7475    /** Prepare extra-data event-handler. */
    7576    void prepareExtraDataEventHandler();
     77    /** Prepare extra-data map. */
     78    void prepareExtraDataMap();
    7679
    7780    /** Cleanup Extra-data Manager. */
     
    8083    void cleanupMainEventListener();
    8184    // /** Cleanup extra-data event-handler. */
    82     // void cleanupExtraDataEventHandler() {}
     85    // void cleanupExtraDataEventHandler();
     86    // /** Cleanup extra-data map. */
     87    // void cleanupExtraDataMap();
    8388
    8489    /** Singleton Extra-data Manager instance. */
     
    8994    /** Extra-data event-handler instance. */
    9095    UIExtraDataEventHandler *m_pHandler;
     96
     97    /** Extra-data map. */
     98    QMap<QString, QString> m_data;
    9199};
    92100
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