VirtualBox

Changeset 80895 in vbox for trunk


Ignore:
Timestamp:
Sep 18, 2019 4:21:48 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8472: Let the short enumeration routine to emit start/finish signals if appropriate; Sync code between full and short enumeration routines.

File:
1 edited

Legend:

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

    r80894 r80895  
    197197    m_media = guiMedia;
    198198
    199     /* Notify listener about enumeration started: */
    200     LogRel(("GUI: UIMediumEnumerator: Medium-enumeration started...\n"));
    201     m_fMediumEnumerationInProgress = true;
    202     emit sigMediumEnumerationStarted();
    203 
    204     /* Make sure we really have more than one UIMedium (which is NULL): */
    205     if (   m_media.size() == 1
    206         && m_media.first().id() == UIMedium::nullID())
    207     {
    208         /* Notify listener about enumeration finished instantly: */
    209         LogRel(("GUI: UIMediumEnumerator: Medium-enumeration finished!\n"));
    210         m_fMediumEnumerationInProgress = false;
    211         emit sigMediumEnumerationFinished();
     199    /* If enumeration hasn't yet started: */
     200    if (!m_fMediumEnumerationInProgress)
     201    {
     202        /* Notify listener about enumeration started: */
     203        LogRel(("GUI: UIMediumEnumerator: Medium-enumeration started...\n"));
     204        m_fMediumEnumerationInProgress = true;
     205        emit sigMediumEnumerationStarted();
     206
     207        /* Make sure we really have more than one UIMedium (which is NULL): */
     208        if (   guiMedia.size() == 1
     209            && guiMedia.first().id() == UIMedium::nullID())
     210        {
     211            /* Notify listener about enumeration finished instantly: */
     212            LogRel(("GUI: UIMediumEnumerator: Medium-enumeration finished!\n"));
     213            m_fMediumEnumerationInProgress = false;
     214            emit sigMediumEnumerationFinished();
     215        }
    212216    }
    213217
    214218    /* Start enumeration for media with non-NULL ID: */
    215     foreach (const QUuid &uMediumID, m_media.keys())
     219    foreach (const QUuid &uMediumID, guiMedia.keys())
    216220        if (!uMediumID.isNull())
    217             createMediumEnumerationTask(m_media[uMediumID]);
     221            createMediumEnumerationTask(guiMedia[uMediumID]);
    218222}
    219223
     
    232236    foreach (const QUuid &uMediumId, guiMedia.keys())
    233237        m_media[uMediumId] = guiMedia.value(uMediumId);
     238
     239    /* If enumeration hasn't yet started: */
     240    if (!m_fMediumEnumerationInProgress)
     241    {
     242        /* Notify listener about enumeration started: */
     243        LogRel(("GUI: UIMediumEnumerator: Medium-enumeration started...\n"));
     244        m_fMediumEnumerationInProgress = true;
     245        emit sigMediumEnumerationStarted();
     246
     247        /* Make sure we really have more than one UIMedium (which is NULL): */
     248        if (   guiMedia.size() == 1
     249            && guiMedia.first().id() == UIMedium::nullID())
     250        {
     251            /* Notify listener about enumeration finished instantly: */
     252            LogRel(("GUI: UIMediumEnumerator: Medium-enumeration finished!\n"));
     253            m_fMediumEnumerationInProgress = false;
     254            emit sigMediumEnumerationFinished();
     255        }
     256    }
    234257
    235258    /* Start enumeration for media with non-NULL ID: */
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