VirtualBox

Changeset 69568 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 3, 2017 2:56:45 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8400: Media Manager: Options/Details widget: Do not propose medium type change to Writethrough or Shareable for disks with children.

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

Legend:

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

    r69500 r69568  
    102102    m_strHardDiskType = other.hardDiskType();
    103103    m_strHardDiskFormat = other.hardDiskFormat();
     104    m_fHasChildren = other.hasChildren();
    104105    m_strStorageDetails = other.storageDetails();
    105106    m_strEncryptionPasswordID = other.encryptionPasswordID();
     
    169170    m_strHardDiskType = QString();
    170171    m_strHardDiskFormat = QString();
     172    m_fHasChildren = false;
    171173    m_strStorageDetails = QString();
    172174    m_strEncryptionPasswordID = QString();
     
    253255            /* Refresh hard drive format: */
    254256            m_strHardDiskFormat = m_medium.GetFormat();
     257
     258            /* Refresh hard drive parental status: */
     259            m_fHasChildren = m_medium.GetChildren().size();
    255260
    256261            /* Refresh hard drive storage details: */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h

    r69500 r69568  
    217217    QString hardDiskFormat(bool fNoDiffs = false) const { return fNoDiffs ? root().m_strHardDiskFormat : m_strHardDiskFormat; }
    218218
     219    /** Returns whether the hard drive medium disk has childred.
     220      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
     221      * @note  In "don't show diffs" mode, this method returns the disk format of root in the given hard drive chain. */
     222    bool hasChildren(bool fNoDiffs = false) const { return fNoDiffs ? root().m_fHasChildren : m_fHasChildren; }
     223
    219224    /** Returns the hard drive medium storage details. */
    220225    QString storageDetails() const { return m_strStorageDetails; }
     
    379384    /** Holds the hard drive medium disk format. */
    380385    QString m_strHardDiskFormat;
     386    /** Holds whether the hard drive medium disk has children. */
     387    bool m_fHasChildren;
    381388    /** Holds the hard drive medium storage details. */
    382389    QString m_strStorageDetails;
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp

    r69540 r69568  
    280280                    /* Configure editor: */
    281281                    m_pLabelType->setBuddy(m_pComboBoxType);
     282                    m_pComboBoxType->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    282283                    m_pComboBoxType->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    283284                    connect(m_pComboBoxType, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated),
     
    630631                    m_pComboBoxType->addItem(QString(), QVariant::fromValue(KMediumType_Normal));
    631632                    m_pComboBoxType->addItem(QString(), QVariant::fromValue(KMediumType_Immutable));
    632                     m_pComboBoxType->addItem(QString(), QVariant::fromValue(KMediumType_Writethrough));
    633                     m_pComboBoxType->addItem(QString(), QVariant::fromValue(KMediumType_Shareable));
     633                    if (!m_newData.m_fHasChildren)
     634                    {
     635                        m_pComboBoxType->addItem(QString(), QVariant::fromValue(KMediumType_Writethrough));
     636                        m_pComboBoxType->addItem(QString(), QVariant::fromValue(KMediumType_Shareable));
     637                    }
    634638                    m_pComboBoxType->addItem(QString(), QVariant::fromValue(KMediumType_MultiAttach));
    635639                }
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h

    r69526 r69568  
    122122        , m_enmType(UIMediumType_Invalid)
    123123        , m_enmVariant(KMediumVariant_Max)
     124        , m_fHasChildren(false)
    124125        , m_options(UIDataMediumOptions())
    125126        , m_details(UIDataMediumDetails())
     
    131132        , m_enmType(enmType)
    132133        , m_enmVariant(KMediumVariant_Max)
     134        , m_fHasChildren(false)
    133135        , m_options(UIDataMediumOptions())
    134136        , m_details(UIDataMediumDetails())
     
    142144               && (m_enmType == other.m_enmType)
    143145               && (m_enmVariant == other.m_enmVariant)
     146               && (m_fHasChildren == other.m_fHasChildren)
    144147               && (m_options == other.m_options)
    145148               && (m_details == other.m_details)
     
    158161    /** Holds the medium variant. */
    159162    KMediumVariant m_enmVariant;
     163    /** Holds whether medium has children. */
     164    bool m_fHasChildren;
    160165
    161166    /** Holds the medium options. */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r69553 r69568  
    400400    m_enmType = m_guiMedium.type();
    401401    m_enmVariant = m_guiMedium.mediumVariant();
     402    m_fHasChildren = m_guiMedium.hasChildren();
    402403    /* Gather medium options data: */
    403404    m_options.m_enmType = m_guiMedium.mediumType();
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