VirtualBox

Changeset 62082 in vbox for trunk/src


Ignore:
Timestamp:
Jul 6, 2016 5:54:09 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
108554
Message:

FE/Qt: bugref:8399: Medium Type Change dialog cleanup/rework (part 05): Extending the dialog with the details-pane describing currently selected medium-type.

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

Legend:

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

    r62081 r62082  
    8888    for (int i = 0; i < buttons.size(); ++i)
    8989        buttons[i]->setText(gpConverter->toString(buttons[i]->property("mediumType").value<KMediumType>()));
     90
     91    /* Translate details-pane: */
     92    updateDetailsPane();
    9093}
    9194
     
    111114     * for now only the previous type is restricted, others are free to choose: */
    112115    m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_enmMediumTypeOld != m_enmMediumTypeNew);
     116
     117    /* Update details-pane: */
     118    updateDetailsPane();
    113119}
    114120
     
    190196
    191197    /* Create group-box layout: */
    192     m_pGroupBoxLayout = new QVBoxLayout(m_pGroupBox);
    193     AssertPtrReturnVoid(m_pGroupBoxLayout);
    194     {
    195         /* Populate radio-buttons: */
    196         prepareMediumTypeButton(KMediumType_Normal);
    197         prepareMediumTypeButton(KMediumType_Immutable);
    198         prepareMediumTypeButton(KMediumType_Writethrough);
    199         prepareMediumTypeButton(KMediumType_Shareable);
    200         prepareMediumTypeButton(KMediumType_MultiAttach);
    201         /* Make sure button reflecting current type is checked: */
    202         QList<QRadioButton*> buttons = m_pGroupBox->findChildren<QRadioButton*>();
    203         for (int i = 0; i < buttons.size(); ++i)
    204         {
    205             if (buttons[i]->property("mediumType").value<KMediumType>() == m_enmMediumTypeOld)
     198    QHBoxLayout *pGroupBoxLayout = new QHBoxLayout(m_pGroupBox);
     199    AssertPtrReturnVoid(pGroupBoxLayout);
     200    {
     201        /* Create button layout: */
     202        m_pButtonLayout = new QVBoxLayout;
     203        AssertPtrReturnVoid(m_pButtonLayout);
     204        {
     205            /* Populate radio-buttons: */
     206            prepareMediumTypeButton(KMediumType_Normal);
     207            prepareMediumTypeButton(KMediumType_Immutable);
     208            prepareMediumTypeButton(KMediumType_Writethrough);
     209            prepareMediumTypeButton(KMediumType_Shareable);
     210            prepareMediumTypeButton(KMediumType_MultiAttach);
     211            /* Make sure button reflecting current type is checked: */
     212            QList<QRadioButton*> buttons = m_pGroupBox->findChildren<QRadioButton*>();
     213            for (int i = 0; i < buttons.size(); ++i)
    206214            {
    207                 buttons[i]->setChecked(true);
    208                 buttons[i]->setFocus();
    209                 break;
     215                if (buttons[i]->property("mediumType").value<KMediumType>() == m_enmMediumTypeOld)
     216                {
     217                    buttons[i]->setChecked(true);
     218                    buttons[i]->setFocus();
     219                    break;
     220                }
    210221            }
    211         }
     222
     223            /* Add stretch into button layout: */
     224            m_pButtonLayout->addStretch();
     225        }
     226        /* Add button layout into group-box layout: */
     227        pGroupBoxLayout->addLayout(m_pButtonLayout);
     228
     229        /* Create details layout: */
     230        QVBoxLayout *pDetailsLayout = new QVBoxLayout;
     231        AssertPtrReturnVoid(pDetailsLayout);
     232        {
     233            /* Create details-pane: */
     234            m_pDetailsPane = new QILabel;
     235            AssertPtrReturnVoid(m_pDetailsPane);
     236            {
     237                /* Configure details-pane: */
     238                m_pDetailsPane->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
     239                m_pDetailsPane->setMargin(2);
     240                m_pDetailsPane->setWordWrap(true);
     241                m_pDetailsPane->useSizeHintForWidth(320);
     242                m_pDetailsPane->updateGeometry();
     243            }
     244            /* Add details-pane into details layout: */
     245            pDetailsLayout->addWidget(m_pDetailsPane);
     246
     247            /* Add stretch into details layout: */
     248            pDetailsLayout->addStretch();
     249        }
     250        /* Add details layout into group-box layout: */
     251        pGroupBoxLayout->addLayout(pDetailsLayout);
    212252    }
    213253}
     
    224264    }
    225265    /* Add radio-button into layout: */
    226     m_pGroupBoxLayout->addWidget(pRadioButton);
    227 }
    228 
     266    m_pButtonLayout->addWidget(pRadioButton);
     267}
     268
     269void UIMediumTypeChangeDialog::updateDetailsPane()
     270{
     271    switch (m_enmMediumTypeNew)
     272    {
     273        case KMediumType_Normal:
     274            m_pDetailsPane->setText(tr("This type of medium is attached directly or indirectly, preserved when taking snapshots."));
     275            break;
     276        case KMediumType_Immutable:
     277            m_pDetailsPane->setText(tr("This type of medium is attached indirectly, changes are wiped out the next time the "
     278                                       "virtual machine is started."));
     279            break;
     280        case KMediumType_Writethrough:
     281            m_pDetailsPane->setText(tr("This type of medium is attached directly, ignored when taking snapshots."));
     282            break;
     283        case KMediumType_Shareable:
     284            m_pDetailsPane->setText(tr("This type of medium is attached directly, allowed to be used concurrently by several machines."));
     285            break;
     286        case KMediumType_Readonly:
     287            m_pDetailsPane->setText(tr("This type of medium is attached directly, and can be used by several machines."));
     288            break;
     289        case KMediumType_MultiAttach:
     290            m_pDetailsPane->setText(tr("This type of medium is attached indirectly, so that one base medium can be used for several "
     291                                       "VMs which have their own differencing medium to store their modifications."));
     292            break;
     293        default:
     294            break;
     295    }
     296}
     297
  • trunk/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.h

    r62080 r62082  
    7171    void prepareMediumTypeButton(KMediumType mediumType);
    7272
     73    /** Updates the details-pane. */
     74    void updateDetailsPane();
     75
    7376    /** Holds the medium ID reference. */
    7477    const QString &m_strMediumID;
     
    8588    QGroupBox *m_pGroupBox;
    8689    /** Holds the button layout instance. */
    87     QVBoxLayout *m_pGroupBoxLayout;
     90    QVBoxLayout *m_pButtonLayout;
     91    /** Holds the details-pane instance. */
     92    QILabel *m_pDetailsPane;
    8893    /** Holds the button-box instance. */
    8994    QIDialogButtonBox *m_pButtonBox;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette