VirtualBox

Changeset 78421 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 7, 2019 9:47:29 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7127: UIMediumEnumerator: Implement OnStorageDeviceChanged, OnMediumChanged and OnMediumConfigChanged event handlers.

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

Legend:

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

    r78398 r78421  
    366366             fRemoved, fSilent));
    367367
    368     Q_UNUSED(comAttachment);
     368    /* Parse attachment: */
     369    parseAttachment(comAttachment);
    369370}
    370371
     
    374375    LogRel2(("GUI: UIMediumEnumerator: OnMediumChanged event received\n"));
    375376
    376     Q_UNUSED(comAttachment);
     377    /* Parse attachment: */
     378    parseAttachment(comAttachment);
    377379}
    378380
     
    382384    LogRel2(("GUI: UIMediumEnumerator: OnMediumConfigChanged event received\n"));
    383385
    384     Q_UNUSED(comMedium);
     386    /* Parse medium: */
     387    parseMedium(comMedium);
    385388}
    386389
     
    728731}
    729732
    730 #endif /* !VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
     733#else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
     734
     735void UIMediumEnumerator::parseAttachment(CMediumAttachment &comAttachment)
     736{
     737    /* Make sure attachment is valid: */
     738    if (comAttachment.isNull())
     739    {
     740        LogRel2(("GUI: UIMediumEnumerator:  Attachment is NULL!\n"));
     741        /// @todo is this possible case?
     742        AssertFailed();
     743    }
     744    else
     745    {
     746        /* Acquire attachment medium: */
     747        CMedium comMedium = comAttachment.GetMedium();
     748        if (!comAttachment.isOk())
     749        {
     750            LogRel2(("GUI: UIMediumEnumerator:  Unable to acquire attachment medium!\n"));
     751            msgCenter().cannotAcquireAttachmentMedium(comAttachment);
     752        }
     753        else
     754        {
     755            /* Parse medium: */
     756            parseMedium(comMedium);
     757        }
     758    }
     759}
     760
     761void UIMediumEnumerator::parseMedium(CMedium &comMedium)
     762{
     763    /* Make sure medium is valid: */
     764    if (comMedium.isNull())
     765    {
     766        LogRel2(("GUI: UIMediumEnumerator:  Medium is NULL!\n"));
     767        /// @todo is this possible case?
     768        AssertFailed();
     769    }
     770    else
     771    {
     772        /* Acquire medium ID: */
     773        const QUuid uMediumId = comMedium.GetId();
     774        if (!comMedium.isOk())
     775        {
     776            LogRel2(("GUI: UIMediumEnumerator:  Unable to acquire medium ID!\n"));
     777            msgCenter().cannotAcquireMediumAttribute(comMedium);
     778        }
     779        else
     780        {
     781            //printf(" Medium to recache: %s\n", uMediumId.toString().toUtf8().constData());
     782
     783            /* Make sure this medium is already cached: */
     784            if (medium(uMediumId).isNull())
     785            {
     786                LogRel2(("GUI: UIMediumEnumerator:  Medium {%s} isn't cached yet!\n",
     787                         uMediumId.toString().toUtf8().constData()));
     788                /// @todo is this valid case?
     789                AssertFailed();
     790            }
     791            else
     792            {
     793                /* Enumerate corresponding UIMedium: */
     794                LogRel2(("GUI: UIMediumEnumerator:  Medium {%s} will be enumerated..\n",
     795                         uMediumId.toString().toUtf8().constData()));
     796                createMediumEnumerationTask(m_media.value(uMediumId));
     797            }
     798        }
     799    }
     800}
     801
     802#endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    731803
    732804
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r78397 r78421  
    177177    void recacheFromActualUsage(const CMediumMap &currentCMediums,
    178178                                const QList<QUuid> &currentCMediumIDs);
    179 #endif /* !VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
     179#else /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
     180    /** Parses incoming @a comAttachment. */
     181    void parseAttachment(CMediumAttachment &comAttachment);
     182    /** Parses incoming @a comMedium. */
     183    void parseMedium(CMedium &comMedium);
     184#endif /* VBOX_GUI_WITH_NEW_MEDIA_EVENTS */
    180185
    181186    /** Holds whether consolidated medium-enumeration process is in progress. */
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