VirtualBox

Ignore:
Timestamp:
Jun 13, 2019 1:17:48 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131293
Message:

FE/Qt: bugref:7127: More refactoring: Rework r131292 to use machine ID instead of machine itself.

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

Legend:

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

    r79128 r79129  
    760760#else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    761761
    762 void UIMediumEnumerator::parseMachine(CMachine comMachine, QList<QUuid> &result)
    763 {
    764     /* Acquire machine ID: */
    765     const QUuid uMachineId = comMachine.GetId();
    766     if (!comMachine.isOk())
    767     {
    768         LogRel2(("GUI: UIMediumEnumerator:  Unable to acquire machine ID!\n"));
    769         msgCenter().cannotAcquireMachineParameter(comMachine);
    770     }
    771     else
    772     {
    773         /* For each the cached UIMedium we have: */
    774         foreach (const QUuid &uMediumId, mediumIDs())
    775         {
    776             /* Check if medium isn't NULL, used by our
    777              * machine and wasn't already enumerated. */
    778             const UIMedium guiMedium = medium(uMediumId);
    779             if (   !guiMedium.isNull()
    780                 && guiMedium.machineIds().contains(uMachineId)
    781                 && !result.contains(uMediumId))
    782             {
    783                 /* Enumerate corresponding UIMedium: */
    784                 LogRel2(("GUI: UIMediumEnumerator:  Medium {%s} of machine {%s} will be enumerated..\n",
    785                          uMediumId.toString().toUtf8().constData(),
    786                          uMachineId.toString().toUtf8().constData()));
    787                 createMediumEnumerationTask(guiMedium);
    788                 result << uMediumId;
    789             }
     762void UIMediumEnumerator::parseMachineId(const QUuid &uMachineId, QList<QUuid> &result)
     763{
     764    /* For each the cached UIMedium we have: */
     765    foreach (const QUuid &uMediumId, mediumIDs())
     766    {
     767        /* Check if medium isn't NULL, used by our
     768         * machine and wasn't already enumerated. */
     769        const UIMedium guiMedium = medium(uMediumId);
     770        if (   !guiMedium.isNull()
     771            && guiMedium.machineIds().contains(uMachineId)
     772            && !result.contains(uMediumId))
     773        {
     774            /* Enumerate corresponding UIMedium: */
     775            LogRel2(("GUI: UIMediumEnumerator:  Medium {%s} of machine {%s} will be enumerated..\n",
     776                     uMediumId.toString().toUtf8().constData(),
     777                     uMachineId.toString().toUtf8().constData()));
     778            createMediumEnumerationTask(guiMedium);
     779            result << uMediumId;
    790780        }
    791781    }
     
    829819            else
    830820            {
    831                 /* Parse machine: */
    832                 parseMachine(comMachine, result);
     821                /* Acquire machine ID: */
     822                const QUuid uMachineId = comMachine.GetId();
     823                if (!comMachine.isOk())
     824                {
     825                    LogRel2(("GUI: UIMediumEnumerator:  Unable to acquire machine ID!\n"));
     826                    msgCenter().cannotAcquireMachineParameter(comMachine);
     827                }
     828                else
     829                {
     830                    /* Parse machine ID: */
     831                    parseMachineId(uMachineId, result);
     832                }
    833833            }
    834834        }
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r79128 r79129  
    183183                                const QList<QUuid> &currentCMediumIDs);
    184184#else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    185     /** Parses incoming @a comMachine, enumerating ONLY KNOWN media it has.
     185    /** Parses machine with incoming @a uMachineId, enumerating ONLY KNOWN media it has.
    186186      * @param  result  Brings the list of previously enumerated media
    187187      *                 IDs to be appended with newly enumerated. */
    188     void parseMachine(CMachine comMachine, QList<QUuid> &result);
     188    void parseMachineId(const QUuid &uMachineId, QList<QUuid> &result);
    189189    /** Parses incoming @a comAttachment, enumerating the media it has attached.
    190190      * @param  result  Brings the list of previously enumerated media
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette