VirtualBox

Changeset 73917 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Aug 27, 2018 2:35:32 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8472. Don't re-enumerate the medium tree when just retranslation would suffice

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r73702 r73917  
    24452445}
    24462446
     2447void VBoxGlobal::refreshMediums()
     2448{
     2449    /* Make sure VBoxGlobal is already valid: */
     2450    AssertReturnVoid(m_fValid);
     2451
     2452    /* Make sure medium-enumerator is already created: */
     2453    if (!m_pMediumEnumerator)
     2454        return;
     2455
     2456    /* Make sure enumeration is not already started: */
     2457    if (isMediumEnumerationInProgress())
     2458        return;
     2459
     2460    /* Ignore the request during VBoxGlobal cleanup: */
     2461    if (s_fCleaningUp)
     2462        return;
     2463
     2464    /* If asked to restore snapshot, don't do this till *after* we're done
     2465     * restoring or the code with have a heart attack. */
     2466    if (shouldRestoreCurrentSnapshot())
     2467        return;
     2468
     2469    /* We assume it's safe to call it without locking,
     2470     * since we are performing blocking operation here. */
     2471    m_pMediumEnumerator->refreshMediums();
     2472}
     2473
    24472474bool VBoxGlobal::isMediumEnumerationInProgress() const
    24482475{
     
    36843711    /* Re-enumerate uimedium since they contain some translations too: */
    36853712    if (m_fValid)
    3686         startMediumEnumeration();
     3713        refreshMediums();
    36873714
    36883715#ifdef VBOX_WS_X11
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r73196 r73917  
    478478        /** Starts medium enumeration. */
    479479        void startMediumEnumeration();
     480        /** Calls refresh for each medium which has been already enumerated. */
     481        void refreshMediums();
    480482        /** Returns whether medium enumeration is in progress. */
    481483        bool isMediumEnumerationInProgress() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r72667 r73917  
    172172        if (!strMediumID.isNull() && strMediumID != UIMedium::nullID())
    173173            createMediumEnumerationTask(m_mediums[strMediumID]);
     174}
     175
     176void UIMediumEnumerator::refreshMediums()
     177{
     178    /* Make sure we are not already in progress: */
     179    AssertReturnVoid(!m_fMediumEnumerationInProgress);
     180
     181    /* Refresh all known media we have: */
     182    foreach (const QString &strMediumID, m_mediums.keys())
     183        m_mediums[strMediumID].refresh();
    174184}
    175185
     
    579589
    580590#include "UIMediumEnumerator.moc"
    581 
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r71630 r73917  
    6666    bool isMediumEnumerationInProgress() const { return m_fMediumEnumerationInProgress; }
    6767    void enumerateMediums();
     68    void refreshMediums();
    6869
    6970private slots:
     
    105106
    106107#endif /* !___UIMediumEnumerator_h___ */
    107 
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