VirtualBox

Changeset 78297 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 25, 2019 5:05:03 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7127: Heavy cleanup for UIMediumEnumerator classes: Refactoring, coding-style.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r76774 r78297  
    3232
    3333
    34 template<class T>
    35 static QStringList toStringList(const QList<T> &list)
     34template<class T> static QStringList toStringList(const QList<T> &list)
    3635{
    3736    QStringList l;
     
    6059
    6160    /** Contains medium enumeration task body. */
    62     void run()
     61    virtual void run() /* override */
    6362    {
    6463        /* Get medium: */
    65         UIMedium medium = property("medium").value<UIMedium>();
     64        UIMedium guiMedium = property("medium").value<UIMedium>();
    6665        /* Enumerate it: */
    67         medium.blockAndQueryState();
     66        guiMedium.blockAndQueryState();
    6867        /* Put it back: */
    69         setProperty("medium", QVariant::fromValue(medium));
     68        setProperty("medium", QVariant::fromValue(guiMedium));
    7069    }
    7170};
     
    7978
    8079    /* Prepare Main event handlers: */
    81     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineDataChange, this, &UIMediumEnumerator::sltHandleMachineUpdate);
    82     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotTake,      this, &UIMediumEnumerator::sltHandleMachineUpdate);
    83     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotDelete,    this, &UIMediumEnumerator::sltHandleSnapshotDeleted);
    84     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotChange,    this, &UIMediumEnumerator::sltHandleMachineUpdate);
    85     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotRestore,   this, &UIMediumEnumerator::sltHandleSnapshotDeleted);
    86     connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineRegistered, this, &UIMediumEnumerator::sltHandleMachineRegistration);
     80    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineDataChange,
     81            this, &UIMediumEnumerator::sltHandleMachineUpdate);
     82    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotTake,
     83            this, &UIMediumEnumerator::sltHandleMachineUpdate);
     84    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotDelete,
     85            this, &UIMediumEnumerator::sltHandleSnapshotDeleted);
     86    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotChange,
     87            this, &UIMediumEnumerator::sltHandleMachineUpdate);
     88    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSnapshotRestore,
     89            this, &UIMediumEnumerator::sltHandleSnapshotDeleted);
     90    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineRegistered,
     91            this, &UIMediumEnumerator::sltHandleMachineRegistration);
    8792
    8893    /* Listen for global thread-pool: */
    89     connect(vboxGlobal().threadPool(), &UIThreadPool::sigTaskComplete, this, &UIMediumEnumerator::sltHandleMediumEnumerationTaskComplete);
     94    connect(vboxGlobal().threadPool(), &UIThreadPool::sigTaskComplete,
     95            this, &UIMediumEnumerator::sltHandleMediumEnumerationTaskComplete);
    9096}
    9197
     
    96102}
    97103
    98 UIMedium UIMediumEnumerator::medium(const QUuid &uMediumID)
     104UIMedium UIMediumEnumerator::medium(const QUuid &uMediumID) const
    99105{
    100106    /* Search through current medium-map for the medium with passed ID: */
    101107    if (m_media.contains(uMediumID))
    102         return m_media[uMediumID];
     108        return m_media.value(uMediumID);
    103109    /* Return NULL medium otherwise: */
    104110    return UIMedium();
    105111}
    106112
    107 void UIMediumEnumerator::createMedium(const UIMedium &medium)
     113void UIMediumEnumerator::createMedium(const UIMedium &guiMedium)
    108114{
    109115    /* Get medium ID: */
    110     const QUuid uMediumID = medium.id();
     116    const QUuid uMediumID = guiMedium.id();
    111117
    112118    /* Do not create UIMedium(s) with incorrect ID: */
    113119    AssertReturnVoid(!uMediumID.isNull());
    114     AssertReturnVoid(uMediumID != UIMedium::nullID());
    115120    /* Make sure medium doesn't exists already: */
    116121    AssertReturnVoid(!m_media.contains(uMediumID));
    117122
    118123    /* Insert medium: */
    119     m_media[uMediumID] = medium;
     124    m_media[uMediumID] = guiMedium;
    120125    LogRel(("GUI: UIMediumEnumerator: Medium with key={%s} created\n", uMediumID.toString().toUtf8().constData()));
    121126
     
    128133    /* Do not delete UIMedium(s) with incorrect ID: */
    129134    AssertReturnVoid(!uMediumID.isNull());
    130     AssertReturnVoid(uMediumID != UIMedium::nullID());
    131135    /* Make sure medium still exists: */
    132136    AssertReturnVoid(m_media.contains(uMediumID));
     
    140144}
    141145
    142 void UIMediumEnumerator::enumerateMedia(const CMediumVector &mediaList /* = CMediumVector() */)
     146void UIMediumEnumerator::enumerateMedia(const CMediumVector &inputMedia /* = CMediumVector() */)
    143147{
    144148    /* Make sure we are not already in progress: */
     
    150154    addNullMediumToMap(media);
    151155    /* If @p mediaList is empty we start the media enumeration with all known media: */
    152     if (mediaList.isEmpty())
     156    if (inputMedia.isEmpty())
    153157    {
    154158        addMediaToMap(vboxGlobal().virtualBox().GetHardDisks(), media);
     
    162166        addMediaToMap(vboxGlobal().host().GetDVDDrives(), media);
    163167        addMediaToMap(vboxGlobal().virtualBox().GetDVDImages(), media);
    164         addMediaToMap(mediaList, media);
     168        addMediaToMap(inputMedia, media);
    165169    }
    166170    if (VBoxGlobal::isCleaningUp())
     
    184188    /* Start enumeration for UIMedium(s) with correct ID: */
    185189    foreach (const QUuid &uMediumID, m_media.keys())
    186         if (!uMediumID.isNull() && uMediumID != UIMedium::nullID())
     190        if (!uMediumID.isNull())
    187191            createMediumEnumerationTask(m_media[uMediumID]);
    188192}
     
    305309
    306310    /* Get enumerated UIMedium: */
    307     const UIMedium uimedium = pTask->property("medium").value<UIMedium>();
    308     const QUuid uUIMediumKey = uimedium.key();
    309     LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} enumerated\n", uUIMediumKey.toString().toUtf8().constData()));
     311    const UIMedium guiMedium = pTask->property("medium").value<UIMedium>();
     312    const QUuid uMediumKey = guiMedium.key();
     313    LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} enumerated\n",
     314             uMediumKey.toString().toUtf8().constData()));
    310315
    311316    /* Remove task from internal set: */
     
    313318
    314319    /* Make sure such UIMedium still exists: */
    315     if (!m_media.contains(uUIMediumKey))
    316     {
    317         LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} already deleted by a third party\n", uUIMediumKey.toString().toUtf8().constData()));
     320    if (!m_media.contains(uMediumKey))
     321    {
     322        LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} already deleted by a third party\n",
     323                 uMediumKey.toString().toUtf8().constData()));
    318324        return;
    319325    }
    320326
    321327    /* Check if UIMedium ID was changed: */
    322     const QUuid uUIMediumID = uimedium.id();
     328    const QUuid uMediumID = guiMedium.id();
    323329    /* UIMedium ID was changed to nullID: */
    324     if (uUIMediumID == UIMedium::nullID())
     330    if (uMediumID == UIMedium::nullID())
    325331    {
    326332        /* Delete this medium: */
    327         m_media.remove(uUIMediumKey);
    328         LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} closed and deleted (after enumeration)\n", uUIMediumKey.toString().toUtf8().constData()));
     333        m_media.remove(uMediumKey);
     334        LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} closed and deleted (after enumeration)\n",
     335                 uMediumKey.toString().toUtf8().constData()));
    329336
    330337        /* And notify listener about delete: */
    331         emit sigMediumDeleted(uUIMediumKey);
     338        emit sigMediumDeleted(uMediumKey);
    332339    }
    333340    /* UIMedium ID was changed to something proper: */
    334     else if (uUIMediumID != uUIMediumKey)
     341    else if (uMediumID != uMediumKey)
    335342    {
    336343        /* We have to reinject enumerated medium: */
    337         m_media.remove(uUIMediumKey);
    338         m_media[uUIMediumID] = uimedium;
    339         m_media[uUIMediumID].setKey(uUIMediumID);
    340         LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} has it changed to {%s}\n", uUIMediumKey.toString().toUtf8().constData(),
    341                                                                                            uUIMediumID.toString().toUtf8().constData()));
     344        m_media.remove(uMediumKey);
     345        m_media[uMediumID] = guiMedium;
     346        m_media[uMediumID].setKey(uMediumID);
     347        LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} has it changed to {%s}\n",
     348                 uMediumKey.toString().toUtf8().constData(),
     349                 uMediumID.toString().toUtf8().constData()));
    342350
    343351        /* And notify listener about delete/create: */
    344         emit sigMediumDeleted(uUIMediumKey);
    345         emit sigMediumCreated(uUIMediumID);
     352        emit sigMediumDeleted(uMediumKey);
     353        emit sigMediumCreated(uMediumID);
    346354    }
    347355    /* UIMedium ID was not changed: */
     
    349357    {
    350358        /* Just update enumerated medium: */
    351         m_media[uUIMediumID] = uimedium;
    352         LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} updated\n", uUIMediumID.toString().toUtf8().constData()));
     359        m_media[uMediumID] = guiMedium;
     360        LogRel2(("GUI: UIMediumEnumerator: Medium with key={%s} updated\n",
     361                 uMediumID.toString().toUtf8().constData()));
    353362
    354363        /* And notify listener about update: */
    355         emit sigMediumEnumerated(uUIMediumID);
     364        emit sigMediumEnumerated(uMediumID);
    356365    }
    357366
     
    373382}
    374383
    375 void UIMediumEnumerator::createMediumEnumerationTask(const UIMedium &medium)
     384void UIMediumEnumerator::createMediumEnumerationTask(const UIMedium &guiMedium)
    376385{
    377386    /* Prepare medium-enumeration task: */
    378     UITask *pTask = new UITaskMediumEnumeration(medium);
     387    UITask *pTask = new UITaskMediumEnumeration(guiMedium);
    379388    /* Append to internal set: */
    380389    m_tasks << pTask;
     
    387396    /* Insert NULL uimedium to the passed uimedium map.
    388397     * Get existing one from the previous map if any. */
    389     QUuid uNullMediumID = UIMedium::nullID();
    390     UIMedium uimedium = m_media.contains(uNullMediumID) ? m_media[uNullMediumID] : UIMedium();
    391     media.insert(uNullMediumID, uimedium);
     398    const UIMedium guiMedium = m_media.contains(UIMedium::nullID())
     399                             ? m_media[UIMedium::nullID()]
     400                             : UIMedium();
     401    media.insert(UIMedium::nullID(), guiMedium);
    392402}
    393403
     
    396406    /* Insert hard-disks to the passed uimedium map.
    397407     * Get existing one from the previous map if any. */
    398     foreach (CMedium medium, inputMedia)
     408    foreach (const CMedium &comMedium, inputMedia)
    399409    {
    400410        /* If VBoxGlobal is cleaning up, abort immediately: */
     
    403413
    404414        /* Prepare uimedium on the basis of current medium: */
    405         QUuid uMediumID = medium.GetId();
    406         UIMedium uimedium = m_media.contains(uMediumID) ? m_media[uMediumID] :
    407             UIMedium(medium, UIMediumDefs::mediumTypeToLocal(medium.GetDeviceType()));
    408 
     415        const QUuid uMediumID = comMedium.GetId();
     416        const UIMedium guiMedium = m_media.contains(uMediumID)
     417                                 ? m_media.value(uMediumID)
     418                                 : UIMedium(comMedium, UIMediumDefs::mediumTypeToLocal(comMedium.GetDeviceType()));
    409419        /* Insert uimedium into map: */
    410         outputMedia.insert(uimedium.id(), uimedium);
     420        outputMedia.insert(guiMedium.id(), guiMedium);
    411421
    412422        /* Insert medium children into map too: */
    413         addMediaToMap(medium.GetChildren(), outputMedia);
     423        addMediaToMap(comMedium.GetChildren(), outputMedia);
    414424    }
    415425}
     
    421431 * @param fTakeIntoAccountCurrentStateOnly defines whether we should take into accound current VM state only.
    422432 */
    423 void UIMediumEnumerator::calculateCachedUsage(const QUuid &uMachineID, QList<QUuid> &previousUIMediumIDs, const bool fTakeIntoAccountCurrentStateOnly) const
     433void UIMediumEnumerator::calculateCachedUsage(const QUuid &uMachineID,
     434                                              QList<QUuid> &previousUIMediumIDs,
     435                                              const bool fTakeIntoAccountCurrentStateOnly) const
    424436{
    425437    /* For each the UIMedium ID cache have: */
    426     foreach (const QUuid &uMediumID, mediumIDs())
     438    foreach (const QUuid &uUIMediumID, mediumIDs())
    427439    {
    428440        /* Get corresponding UIMedium: */
    429         const UIMedium &uimedium = m_media[uMediumID];
     441        const UIMedium &guiMedium = m_media[uUIMediumID];
    430442        /* Get the list of the machines this UIMedium attached to.
    431443         * Take into account current-state only if necessary. */
    432         const QList<QUuid> &machineIDs = fTakeIntoAccountCurrentStateOnly ?
    433                                            uimedium.curStateMachineIds() : uimedium.machineIds();
     444        const QList<QUuid> &machineIDs = fTakeIntoAccountCurrentStateOnly
     445                                       ? guiMedium.curStateMachineIds()
     446                                       : guiMedium.machineIds();
    434447        /* Add this UIMedium ID to previous usage if necessary: */
    435448        if (machineIDs.contains(uMachineID))
    436             previousUIMediumIDs.append(uMediumID);
     449            previousUIMediumIDs.append(uUIMediumID);
    437450    }
    438451}
     
    445458 * @param fTakeIntoAccountCurrentStateOnly defines whether we should take into accound current VM state only.
    446459 */
    447 void UIMediumEnumerator::calculateActualUsage(const QUuid &uMachineID, CMediumMap &currentCMediums, QList<QUuid> &currentCMediumIDs, const bool fTakeIntoAccountCurrentStateOnly) const
     460void UIMediumEnumerator::calculateActualUsage(const QUuid &uMachineID,
     461                                              CMediumMap &currentCMediums,
     462                                              QList<QUuid> &currentCMediumIDs,
     463                                              const bool fTakeIntoAccountCurrentStateOnly) const
    448464{
    449465    /* Search for corresponding machine: */
    450     CMachine machine = vboxGlobal().virtualBox().FindMachine(uMachineID.toString());
    451     if (machine.isNull())
     466    CMachine comMachine = vboxGlobal().virtualBox().FindMachine(uMachineID.toString());
     467    if (comMachine.isNull())
    452468    {
    453469        /* Usually means the machine is already gone, not harmful. */
     
    457473    /* Calculate actual usage starting from root-snapshot if necessary: */
    458474    if (!fTakeIntoAccountCurrentStateOnly)
    459         calculateActualUsage(machine.FindSnapshot(QString()), currentCMediums, currentCMediumIDs);
     475        calculateActualUsage(comMachine.FindSnapshot(QString()), currentCMediums, currentCMediumIDs);
     476
    460477    /* Calculate actual usage for current machine state: */
    461     calculateActualUsage(machine, currentCMediums, currentCMediumIDs);
     478    calculateActualUsage(comMachine, currentCMediums, currentCMediumIDs);
    462479}
    463480
     
    468485 * @param currentCMediumIDs receives CMedium IDs used in actual data.
    469486 */
    470 void UIMediumEnumerator::calculateActualUsage(const CSnapshot &snapshot, CMediumMap &currentCMediums, QList<QUuid> &currentCMediumIDs) const
     487void UIMediumEnumerator::calculateActualUsage(const CSnapshot &comSnapshot,
     488                                              CMediumMap &currentCMediums,
     489                                              QList<QUuid> &currentCMediumIDs) const
    471490{
    472491    /* Check passed snapshot: */
    473     if (snapshot.isNull())
     492    if (comSnapshot.isNull())
    474493        return;
    475494
    476495    /* Calculate actual usage for passed snapshot machine: */
    477     calculateActualUsage(snapshot.GetMachine(), currentCMediums, currentCMediumIDs);
     496    calculateActualUsage(comSnapshot.GetMachine(), currentCMediums, currentCMediumIDs);
    478497
    479498    /* Iterate through passed snapshot children: */
    480     foreach (const CSnapshot &childSnapshot, snapshot.GetChildren())
    481         calculateActualUsage(childSnapshot, currentCMediums, currentCMediumIDs);
     499    foreach (const CSnapshot &comChildSnapshot, comSnapshot.GetChildren())
     500        calculateActualUsage(comChildSnapshot, currentCMediums, currentCMediumIDs);
    482501}
    483502
     
    488507 * @param currentCMediumIDs receives CMedium IDs used in actual data.
    489508 */
    490 void UIMediumEnumerator::calculateActualUsage(const CMachine &machine, CMediumMap &currentCMediums, QList<QUuid> &currentCMediumIDs) const
     509void UIMediumEnumerator::calculateActualUsage(const CMachine &comMachine,
     510                                              CMediumMap &currentCMediums,
     511                                              QList<QUuid> &currentCMediumIDs) const
    491512{
    492513    /* Check passed machine: */
    493     AssertReturnVoid(!machine.isNull());
     514    AssertReturnVoid(!comMachine.isNull());
    494515
    495516    /* For each the attachment machine have: */
    496     foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments())
     517    foreach (const CMediumAttachment &comAttachment, comMachine.GetMediumAttachments())
    497518    {
    498519        /* Get corresponding CMedium: */
    499         CMedium cmedium = attachment.GetMedium();
    500         if (!cmedium.isNull())
     520        CMedium comMedium = comAttachment.GetMedium();
     521        if (!comMedium.isNull())
    501522        {
    502523            /* Make sure that CMedium was not yet closed: */
    503             const QUuid uCMediumID = cmedium.GetId();
    504             if (cmedium.isOk() && !uCMediumID.isNull())
     524            const QUuid &uCMediumID = comMedium.GetId();
     525            if (comMedium.isOk() && !uCMediumID.isNull())
    505526            {
    506527                /* Add this CMedium to current usage: */
    507                 currentCMediums.insert(uCMediumID, cmedium);
     528                currentCMediums.insert(uCMediumID, comMedium);
    508529                currentCMediumIDs.append(uCMediumID);
    509530            }
     
    519540{
    520541    /* For each of previously used UIMedium ID: */
    521     foreach (const QUuid &uMediumID, previousUIMediumIDs)
     542    foreach (const QUuid &uUIMediumID, previousUIMediumIDs)
    522543    {
    523544        /* Make sure this ID still in our map: */
    524         if (m_media.contains(uMediumID))
     545        if (m_media.contains(uUIMediumID))
    525546        {
    526547            /* Get corresponding UIMedium: */
    527             UIMedium &uimedium = m_media[uMediumID];
     548            UIMedium &guiMedium = m_media[uUIMediumID];
    528549
    529550            /* If corresponding CMedium still exists: */
    530             CMedium cmedium = uimedium.medium();
    531             if (!cmedium.GetId().isNull() && cmedium.isOk())
     551            CMedium comMedium = guiMedium.medium();
     552            if (!comMedium.GetId().isNull() && comMedium.isOk())
    532553            {
    533554                /* Refresh UIMedium parent first of all: */
    534                 uimedium.updateParentID();
     555                guiMedium.updateParentID();
    535556                /* Enumerate corresponding UIMedium: */
    536                 createMediumEnumerationTask(uimedium);
     557                createMediumEnumerationTask(guiMedium);
    537558            }
    538559            /* If corresponding CMedium was closed already: */
     
    540561            {
    541562                /* Uncache corresponding UIMedium: */
    542                 m_media.remove(uMediumID);
    543                 LogRel2(("GUI: UIMediumEnumerator:  Medium with key={%s} uncached\n", uMediumID.toString().toUtf8().constData()));
     563                m_media.remove(uUIMediumID);
     564                LogRel2(("GUI: UIMediumEnumerator:  Medium with key={%s} uncached\n",
     565                         uUIMediumID.toString().toUtf8().constData()));
    544566
    545567                /* And notify listeners: */
    546                 emit sigMediumDeleted(uMediumID);
     568                emit sigMediumDeleted(uUIMediumID);
    547569            }
    548570        }
     
    555577 * @param currentCMediumIDs reflects CMedium IDs used in actual data.
    556578 */
    557 void UIMediumEnumerator::recacheFromActualUsage(const CMediumMap &currentCMediums, const QList<QUuid> &currentCMediumIDs)
     579void UIMediumEnumerator::recacheFromActualUsage(const CMediumMap &currentCMediums,
     580                                                const QList<QUuid> &currentCMediumIDs)
    558581{
    559582    /* For each of currently used CMedium ID: */
     
    564587        {
    565588            /* Create new UIMedium: */
    566             const CMedium &cmedium = currentCMediums[uCMediumID];
    567             UIMedium uimedium(cmedium, UIMediumDefs::mediumTypeToLocal(cmedium.GetDeviceType()));
    568             QUuid uUIMediumKey = uimedium.key();
     589            const CMedium &comMedium = currentCMediums[uCMediumID];
     590            const UIMedium guiMedium(comMedium, UIMediumDefs::mediumTypeToLocal(comMedium.GetDeviceType()));
     591            const QUuid &uUIMediumKey = guiMedium.key();
    569592
    570593            /* Cache created UIMedium: */
    571             m_media.insert(uUIMediumKey, uimedium);
    572             LogRel2(("GUI: UIMediumEnumerator:  Medium with key={%s} cached\n", uUIMediumKey.toString().toUtf8().constData()));
     594            m_media.insert(uUIMediumKey, guiMedium);
     595            LogRel2(("GUI: UIMediumEnumerator:  Medium with key={%s} cached\n",
     596                     uUIMediumKey.toString().toUtf8().constData()));
    573597
    574598            /* And notify listeners: */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r76581 r78297  
    6262    /* API: Medium-access stuff: */
    6363    QList<QUuid> mediumIDs() const;
    64     UIMedium medium(const QUuid &uMediumID);
    65     void createMedium(const UIMedium &medium);
     64    UIMedium medium(const QUuid &uMediumID) const;
     65    void createMedium(const UIMedium &guiMedium);
    6666    void deleteMedium(const QUuid &uMediumID);
    6767
    6868    /* API: Medium-enumeration stuff: */
    6969    bool isMediumEnumerationInProgress() const { return m_fMediumEnumerationInProgress; }
    70     void enumerateMedia(const CMediumVector &mediaList = CMediumVector());
     70    void enumerateMedia(const CMediumVector &inputMedia = CMediumVector());
    7171    void refreshMedia();
    7272
     
    8989
    9090    /* Helpers: Medium-enumeration stuff: */
    91     void createMediumEnumerationTask(const UIMedium &medium);
    92     void addNullMediumToMap(UIMediumMap &media);
     91    void createMediumEnumerationTask(const UIMedium &guiMedium);
     92    void addNullMediumToMap(UIMediumMap &outputMedia);
    9393    void addMediaToMap(const CMediumVector &inputMedia, UIMediumMap &outputMedia);
    9494
    9595    /* Helpers: Medium re-caching stuff: */
    96     void calculateCachedUsage(const QUuid &uMachineID, QList<QUuid> &previousUIMediumIDs, const bool fTakeIntoAccountCurrentStateOnly) const;
    97     void calculateActualUsage(const QUuid &uMachineID, CMediumMap &currentCMediums, QList<QUuid> &currentCMediumIDs, const bool fTakeIntoAccountCurrentStateOnly) const;
    98     void calculateActualUsage(const CSnapshot &snapshot, CMediumMap &currentCMediums, QList<QUuid> &currentCMediumIDs) const;
    99     void calculateActualUsage(const CMachine &machine, CMediumMap &currentCMediums, QList<QUuid> &currentCMediumIDs) const;
     96    void calculateCachedUsage(const QUuid &uMachineID,
     97                              QList<QUuid> &previousUIMediumIDs,
     98                              const bool fTakeIntoAccountCurrentStateOnly) const;
     99    void calculateActualUsage(const QUuid &uMachineID,
     100                              CMediumMap &currentCMediums,
     101                              QList<QUuid> &currentCMediumIDs,
     102                              const bool fTakeIntoAccountCurrentStateOnly) const;
     103    void calculateActualUsage(const CSnapshot &comSnapshot,
     104                              CMediumMap &currentCMediums,
     105                              QList<QUuid> &currentCMediumIDs) const;
     106    void calculateActualUsage(const CMachine &comMachine,
     107                              CMediumMap &currentCMediums,
     108                              QList<QUuid> &currentCMediumIDs) const;
    100109    void recacheFromCachedUsage(const QList<QUuid> &previousUIMediumIDs);
    101     void recacheFromActualUsage(const CMediumMap &currentCMediums, const QList<QUuid> &currentCMediumIDs);
     110    void recacheFromActualUsage(const CMediumMap &currentCMediums,
     111                                const QList<QUuid> &currentCMediumIDs);
    102112
    103113    /* Variables: */
    104     bool m_fMediumEnumerationInProgress;
    105     QSet<UITask*> m_tasks;
    106     UIMediumMap m_media;
     114    bool  m_fMediumEnumerationInProgress;
     115    QSet<UITask*>  m_tasks;
     116    UIMediumMap  m_media;
    107117};
    108118
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