VirtualBox

Changeset 67921 in vbox


Ignore:
Timestamp:
Jul 12, 2017 10:04:35 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8400: Caching actual/logical numeric size values in UIMedium.

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

Legend:

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

    r67854 r67921  
    8888    m_strLocation = other.location();
    8989
     90    m_uSize = other.sizeInBytes();
     91    m_uLogicalSize = other.logicalSizeInBytes();
    9092    m_strSize = other.size();
    9193    m_strLogicalSize = other.logicalSize();
     
    152154    m_strName = VBoxGlobal::tr("Empty", "medium");
    153155    m_strLocation = m_strSize = m_strLogicalSize = QString("--");
     156    m_uSize = m_uLogicalSize = 0;
    154157
    155158    /* Reset medium type parameter: */
     
    211214            if (m_state != KMediumState_Inaccessible && m_state != KMediumState_NotCreated)
    212215            {
    213                 m_strSize = vboxGlobal().formatSize(m_medium.GetSize());
     216                m_uSize = m_medium.GetSize();
     217                m_strSize = vboxGlobal().formatSize(m_uSize);
    214218                if (m_type == UIMediumType_HardDisk)
    215                     m_strLogicalSize = vboxGlobal().formatSize(m_medium.GetLogicalSize());
     219                {
     220                    m_uLogicalSize = m_medium.GetLogicalSize();
     221                    m_strLogicalSize = vboxGlobal().formatSize(m_uLogicalSize);
     222                }
    216223                else
     224                {
     225                    m_uLogicalSize = m_uSize;
    217226                    m_strLogicalSize = m_strSize;
     227                }
    218228            }
    219229        }
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h

    r67854 r67921  
    178178    QString location(bool fNoDiffs = false) const { return fNoDiffs ? root().m_strLocation : m_strLocation; }
    179179
     180    /** Returns the medium size in bytes.
     181      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
     182      * @note  In "don't show diffs" mode, this method returns the size of root in the given hard drive chain. */
     183    qulonglong sizeInBytes(bool fNoDiffs = false) const { return fNoDiffs ? root().m_uSize : m_uSize; }
     184    /** Returns the logical medium size in bytes.
     185      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
     186      * @note  In "don't show diffs" mode, this method returns the size of root in the given hard drive chain. */
     187    qulonglong logicalSizeInBytes(bool fNoDiffs = false) const { return fNoDiffs ? root().m_uLogicalSize : m_uLogicalSize; }
    180188    /** Returns the medium size.
    181189      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
     
    343351    QString m_strLocation;
    344352
     353    /** Holds the medium size in bytes. */
     354    qulonglong m_uSize;
     355    /** Holds the logical medium size in bytes. */
     356    qulonglong m_uLogicalSize;
    345357    /** Holds the medium size. */
    346358    QString m_strSize;
    347     /** Holds the medium logical size. */
     359    /** Holds the logical medium size. */
    348360    QString m_strLogicalSize;
    349361
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