VirtualBox

Changeset 94515 in vbox


Ignore:
Timestamp:
Apr 7, 2022 2:13:41 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt/Ds: bugref:6899: Machine settings: General page and particularly Disk Encryption stuff cleanup; Also a bit for Audio page.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIDiskEncryptionSettingsEditor.cpp

    r94498 r94515  
    3434    , m_pCheckboxFeature(0)
    3535    , m_pWidgetSettings(0)
    36     , m_pLabelCipher(0)
    37     , m_pComboCipher(0)
    38     , m_pLabelEncryptionPassword(0)
    39     , m_pEditorEncryptionPassword(0)
    40     , m_pLabelEncryptionPasswordConfirm(0)
    41     , m_pEditorEncryptionPasswordConfirm(0)
     36    , m_pLabelCipherType(0)
     37    , m_pComboCipherType(0)
     38    , m_pLabelPassword1(0)
     39    , m_pEditorPassword1(0)
     40    , m_pLabelPassword2(0)
     41    , m_pEditorPassword2(0)
    4242{
    4343    prepare();
     
    7777UIDiskEncryptionCipherType UIDiskEncryptionSettingsEditor::cipherType() const
    7878{
    79     return m_pComboCipher ? m_pComboCipher->currentData().value<UIDiskEncryptionCipherType>() : m_enmCipherType;
     79    return m_pComboCipherType ? m_pComboCipherType->currentData().value<UIDiskEncryptionCipherType>() : m_enmCipherType;
    8080}
    8181
    8282QString UIDiskEncryptionSettingsEditor::password1() const
    8383{
    84     return m_pEditorEncryptionPassword ? m_pEditorEncryptionPassword->text() : m_strPassword1;
     84    return m_pEditorPassword1 ? m_pEditorPassword1->text() : m_strPassword1;
    8585}
    8686
    8787QString UIDiskEncryptionSettingsEditor::password2() const
    8888{
    89     return m_pEditorEncryptionPasswordConfirm ? m_pEditorEncryptionPasswordConfirm->text() : m_strPassword2;
     89    return m_pEditorPassword2 ? m_pEditorPassword2->text() : m_strPassword2;
    9090}
    9191
     
    9898    }
    9999
    100     if (m_pLabelCipher)
    101         m_pLabelCipher->setText(tr("Disk Encryption C&ipher:"));
    102     if (m_pComboCipher)
    103     {
    104         for (int iIndex = 0; iIndex < m_pComboCipher->count(); ++iIndex)
     100    if (m_pLabelCipherType)
     101        m_pLabelCipherType->setText(tr("Disk Encryption C&ipher:"));
     102    if (m_pComboCipherType)
     103    {
     104        for (int iIndex = 0; iIndex < m_pComboCipherType->count(); ++iIndex)
    105105        {
    106             const UIDiskEncryptionCipherType enmType = m_pComboCipher->itemData(iIndex).value<UIDiskEncryptionCipherType>();
    107             m_pComboCipher->setItemText(iIndex, gpConverter->toString(enmType));
     106            const UIDiskEncryptionCipherType enmType = m_pComboCipherType->itemData(iIndex).value<UIDiskEncryptionCipherType>();
     107            m_pComboCipherType->setItemText(iIndex, gpConverter->toString(enmType));
    108108        }
    109         m_pComboCipher->setToolTip(tr("Holds the cipher to be used for encrypting the virtual machine disks."));
    110     }
    111 
    112     if (m_pLabelEncryptionPassword)
    113         m_pLabelEncryptionPassword->setText(tr("E&nter New Password:"));
    114     if (m_pEditorEncryptionPassword)
    115         m_pEditorEncryptionPassword->setToolTip(tr("Holds the encryption password for disks attached to this virtual machine."));
    116     if (m_pLabelEncryptionPasswordConfirm)
    117         m_pLabelEncryptionPasswordConfirm->setText(tr("C&onfirm New Password:"));
    118     if (m_pEditorEncryptionPasswordConfirm)
    119         m_pEditorEncryptionPasswordConfirm->setToolTip(tr("Confirms the disk encryption password."));
     109        m_pComboCipherType->setToolTip(tr("Holds the cipher to be used for encrypting the virtual machine disks."));
     110    }
     111
     112    if (m_pLabelPassword1)
     113        m_pLabelPassword1->setText(tr("E&nter New Password:"));
     114    if (m_pEditorPassword1)
     115        m_pEditorPassword1->setToolTip(tr("Holds the encryption password for disks attached to this virtual machine."));
     116    if (m_pLabelPassword2)
     117        m_pLabelPassword2->setText(tr("C&onfirm New Password:"));
     118    if (m_pEditorPassword2)
     119        m_pEditorPassword2->setToolTip(tr("Confirms the disk encryption password."));
    120120
    121121    /* Translate Cipher type combo: */
    122     m_pComboCipher->setItemText(0, tr("Leave Unchanged", "cipher type"));
     122    m_pComboCipherType->setItemText(0, tr("Leave Unchanged", "cipher type"));
    123123}
    124124
     
    173173
    174174                /* Prepare encryption cipher label: */
    175                 m_pLabelCipher = new QLabel(m_pWidgetSettings);
    176                 if (m_pLabelCipher)
    177                 {
    178                     m_pLabelCipher->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    179                     m_pLayoutSettings->addWidget(m_pLabelCipher, 0, 0);
     175                m_pLabelCipherType = new QLabel(m_pWidgetSettings);
     176                if (m_pLabelCipherType)
     177                {
     178                    m_pLabelCipherType->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     179                    m_pLayoutSettings->addWidget(m_pLabelCipherType, 0, 0);
    180180                }
    181181                /* Prepare encryption cipher combo: */
    182                 m_pComboCipher = new QComboBox(m_pWidgetSettings);
    183                 if (m_pComboCipher)
    184                 {
    185                     if (m_pLabelCipher)
    186                         m_pLabelCipher->setBuddy(m_pComboCipher);
    187                     m_pLayoutSettings->addWidget(m_pComboCipher, 0, 1);
     182                m_pComboCipherType = new QComboBox(m_pWidgetSettings);
     183                if (m_pComboCipherType)
     184                {
     185                    if (m_pLabelCipherType)
     186                        m_pLabelCipherType->setBuddy(m_pComboCipherType);
     187                    m_pLayoutSettings->addWidget(m_pComboCipherType, 0, 1);
    188188                }
    189189
    190190                /* Prepare encryption password label: */
    191                 m_pLabelEncryptionPassword = new QLabel(m_pWidgetSettings);
    192                 if (m_pLabelEncryptionPassword)
    193                 {
    194                     m_pLabelEncryptionPassword->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    195                     m_pLayoutSettings->addWidget(m_pLabelEncryptionPassword, 1, 0);
     191                m_pLabelPassword1 = new QLabel(m_pWidgetSettings);
     192                if (m_pLabelPassword1)
     193                {
     194                    m_pLabelPassword1->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     195                    m_pLayoutSettings->addWidget(m_pLabelPassword1, 1, 0);
    196196                }
    197197                /* Prepare encryption password editor: */
    198                 m_pEditorEncryptionPassword = new QLineEdit(m_pWidgetSettings);
    199                 if (m_pEditorEncryptionPassword)
    200                 {
    201                     if (m_pLabelEncryptionPassword)
    202                         m_pLabelEncryptionPassword->setBuddy(m_pEditorEncryptionPassword);
    203                     m_pEditorEncryptionPassword->setEchoMode(QLineEdit::Password);
    204 
    205                     m_pLayoutSettings->addWidget(m_pEditorEncryptionPassword, 1, 1);
     198                m_pEditorPassword1 = new QLineEdit(m_pWidgetSettings);
     199                if (m_pEditorPassword1)
     200                {
     201                    if (m_pLabelPassword1)
     202                        m_pLabelPassword1->setBuddy(m_pEditorPassword1);
     203                    m_pEditorPassword1->setEchoMode(QLineEdit::Password);
     204
     205                    m_pLayoutSettings->addWidget(m_pEditorPassword1, 1, 1);
    206206                }
    207207
    208208                /* Prepare encryption confirm password label: */
    209                 m_pLabelEncryptionPasswordConfirm = new QLabel(m_pWidgetSettings);
    210                 if (m_pLabelEncryptionPasswordConfirm)
    211                 {
    212                     m_pLabelEncryptionPasswordConfirm->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    213                     m_pLayoutSettings->addWidget(m_pLabelEncryptionPasswordConfirm, 2, 0);
     209                m_pLabelPassword2 = new QLabel(m_pWidgetSettings);
     210                if (m_pLabelPassword2)
     211                {
     212                    m_pLabelPassword2->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     213                    m_pLayoutSettings->addWidget(m_pLabelPassword2, 2, 0);
    214214                }
    215215                /* Prepare encryption confirm password editor: */
    216                 m_pEditorEncryptionPasswordConfirm = new QLineEdit(m_pWidgetSettings);
    217                 if (m_pEditorEncryptionPasswordConfirm)
    218                 {
    219                     if (m_pLabelEncryptionPasswordConfirm)
    220                         m_pLabelEncryptionPasswordConfirm->setBuddy(m_pEditorEncryptionPasswordConfirm);
    221                     m_pEditorEncryptionPasswordConfirm->setEchoMode(QLineEdit::Password);
    222 
    223                     m_pLayoutSettings->addWidget(m_pEditorEncryptionPasswordConfirm, 2, 1);
     216                m_pEditorPassword2 = new QLineEdit(m_pWidgetSettings);
     217                if (m_pEditorPassword2)
     218                {
     219                    if (m_pLabelPassword2)
     220                        m_pLabelPassword2->setBuddy(m_pEditorPassword2);
     221                    m_pEditorPassword2->setEchoMode(QLineEdit::Password);
     222
     223                    m_pLayoutSettings->addWidget(m_pEditorPassword2, 2, 1);
    224224                }
    225225            }
     
    239239        connect(m_pCheckboxFeature, &QCheckBox::toggled,
    240240                this, &UIDiskEncryptionSettingsEditor::sltHandleFeatureToggled);
    241     if (m_pComboCipher)
    242         connect(m_pComboCipher, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     241    if (m_pComboCipherType)
     242        connect(m_pComboCipherType, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
    243243                this, &UIDiskEncryptionSettingsEditor::sigCipherChanged);
    244     if (m_pEditorEncryptionPassword)
    245         connect(m_pEditorEncryptionPassword, &QLineEdit::textEdited,
     244    if (m_pEditorPassword1)
     245        connect(m_pEditorPassword1, &QLineEdit::textEdited,
    246246                this, &UIDiskEncryptionSettingsEditor::sigPasswordChanged);
    247     if (m_pEditorEncryptionPasswordConfirm)
    248         connect(m_pEditorEncryptionPasswordConfirm, &QLineEdit::textEdited,
     247    if (m_pEditorPassword2)
     248        connect(m_pEditorPassword2, &QLineEdit::textEdited,
    249249                this, &UIDiskEncryptionSettingsEditor::sigPasswordChanged);
    250250}
     
    252252void UIDiskEncryptionSettingsEditor::repopulateCombo()
    253253{
    254     if (m_pComboCipher)
     254    if (m_pComboCipherType)
    255255    {
    256256        /* Clear combo first of all: */
    257         m_pComboCipher->clear();
     257        m_pComboCipherType->clear();
    258258
    259259        /// @todo get supported auth types (API not implemented), not hardcoded!
     
    269269        /* Populate combo finally: */
    270270        foreach (const UIDiskEncryptionCipherType &enmType, cipherTypes)
    271             m_pComboCipher->addItem(gpConverter->toString(enmType), QVariant::fromValue(enmType));
     271            m_pComboCipherType->addItem(gpConverter->toString(enmType), QVariant::fromValue(enmType));
    272272
    273273        /* Look for proper index to choose: */
    274         const int iIndex = m_pComboCipher->findData(QVariant::fromValue(m_enmCipherType));
     274        const int iIndex = m_pComboCipherType->findData(QVariant::fromValue(m_enmCipherType));
    275275        if (iIndex != -1)
    276             m_pComboCipher->setCurrentIndex(iIndex);
    277     }
    278 }
     276            m_pComboCipherType->setCurrentIndex(iIndex);
     277    }
     278}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIDiskEncryptionSettingsEditor.h

    r94498 r94515  
    110110        QWidget   *m_pWidgetSettings;
    111111        /** Holds the cipher type label instance. */
    112         QLabel    *m_pLabelCipher;
     112        QLabel    *m_pLabelCipherType;
    113113        /** Holds the cipher type combo instance. */
    114         QComboBox *m_pComboCipher;
    115         /** Holds the enter password label instance. */
    116         QLabel    *m_pLabelEncryptionPassword;
    117         /** Holds the enter password editor instance. */
    118         QLineEdit *m_pEditorEncryptionPassword;
    119         /** Holds the confirm password label instance. */
    120         QLabel    *m_pLabelEncryptionPasswordConfirm;
    121         /** Holds the confirm password editor instance. */
    122         QLineEdit *m_pEditorEncryptionPasswordConfirm;
     114        QComboBox *m_pComboCipherType;
     115        /** Holds the password 1 label instance. */
     116        QLabel    *m_pLabelPassword1;
     117        /** Holds the password 1 editor instance. */
     118        QLineEdit *m_pEditorPassword1;
     119        /** Holds the password 2 label instance. */
     120        QLabel    *m_pLabelPassword2;
     121        /** Holds the password 2 editor instance. */
     122        QLineEdit *m_pEditorPassword2;
    123123    /** @} */
    124124};
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMachineAudioFeaturesEditor.cpp

    r94395 r94515  
    2323/* GUI includes: */
    2424#include "UIMachineAudioFeaturesEditor.h"
    25 #ifdef VBOX_WS_X11
    26 # include "VBoxUtils-x11.h"
    27 #endif
    2825
    2926
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r94498 r94515  
    1717
    1818/* Qt includes: */
    19 #include <QCheckBox>
    20 #include <QComboBox>
    21 #include <QDir>
    22 #include <QLabel>
    23 #include <QLineEdit>
    24 #include <QTextEdit>
     19#include <QFileInfo>
    2520#include <QVBoxLayout>
    2621
    2722/* GUI includes: */
    2823#include "QITabWidget.h"
    29 #include "QIWidgetValidator.h"
    3024#include "UIAddDiskEncryptionPasswordDialog.h"
    3125#include "UICommon.h"
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