VirtualBox

Changeset 94445 in vbox


Ignore:
Timestamp:
Apr 1, 2022 5:19:37 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt/Ds: bugref:6899: Machine settings: General page accessibility improvements for Name, System and Description tabs; Get rid of excessive stuff in name editor; Moving description stuff to separate editor.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r94436 r94445  
    908908        src/settings/editors/UIMachineAudioFeaturesEditor.h \
    909909        src/settings/editors/UIMachineDisplayScreenFeaturesEditor.h \
     910        src/settings/editors/UIMachineDescriptionEditor.h \
    910911        src/settings/editors/UIMaximumGuestScreenSizeEditor.h \
    911912        src/settings/editors/UIMonitorCountEditor.h \
     
    14681469        src/settings/editors/UIMachineAudioFeaturesEditor.cpp \
    14691470        src/settings/editors/UIMachineDisplayScreenFeaturesEditor.cpp \
     1471        src/settings/editors/UIMachineDescriptionEditor.cpp \
    14701472        src/settings/editors/UIMaximumGuestScreenSizeEditor.cpp \
    14711473        src/settings/editors/UIMonitorCountEditor.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMachineDescriptionEditor.cpp

    r94444 r94445  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIAutoCaptureKeyboardEditor class implementation.
     3 * VBox Qt GUI - UIMachineDescriptionEditor class implementation.
    44 */
    55
     
    1717
    1818/* Qt includes: */
    19 #include <QCheckBox>
    20 #include <QGridLayout>
    21 #include <QLabel>
     19#include <QTextEdit>
     20#include <QVBoxLayout>
    2221
    2322/* GUI includes: */
    24 #include "UIAutoCaptureKeyboardEditor.h"
     23#include "UIMachineDescriptionEditor.h"
    2524
    2625
    27 UIAutoCaptureKeyboardEditor::UIAutoCaptureKeyboardEditor(QWidget *pParent /* = 0 */)
     26UIMachineDescriptionEditor::UIMachineDescriptionEditor(QWidget *pParent /* = 0 */)
    2827    : QIWithRetranslateUI<QWidget>(pParent)
    29     , m_fValue(false)
    30     , m_pLabel(0)
    31     , m_pCheckBox(0)
     28    , m_pTextEdit(0)
    3229{
    3330    prepare();
    3431}
    3532
    36 void UIAutoCaptureKeyboardEditor::setValue(bool fValue)
     33void UIMachineDescriptionEditor::setValue(const QString &strValue)
    3734{
    3835    /* Update cached value and
    39      * check-box if value has changed: */
    40     if (m_fValue != fValue)
     36     * text-edit if value has changed: */
     37    if (m_strValue != strValue)
    4138    {
    42         m_fValue = fValue;
    43         if (m_pCheckBox)
    44             m_pCheckBox->setCheckState(m_fValue ? Qt::Checked : Qt::Unchecked);
     39        m_strValue = strValue;
     40        if (m_pTextEdit)
     41            m_pTextEdit->setPlainText(strValue);
    4542    }
    4643}
    4744
    48 bool UIAutoCaptureKeyboardEditor::value() const
     45QString UIMachineDescriptionEditor::value() const
    4946{
    50     return m_pCheckBox ? m_pCheckBox->checkState() == Qt::Checked : m_fValue;
     47    return m_pTextEdit ? m_pTextEdit->toPlainText() : m_strValue;
    5148}
    5249
    53 void UIAutoCaptureKeyboardEditor::retranslateUi()
     50void UIMachineDescriptionEditor::retranslateUi()
    5451{
    55     if (m_pLabel)
    56         m_pLabel->setText(tr("Extended Features:"));
    57     if (m_pCheckBox)
    58     {
    59         m_pCheckBox->setText(tr("&Auto Capture Keyboard"));
    60         m_pCheckBox->setToolTip(tr("When checked, the keyboard is automatically captured every time the VM window is "
    61                                    "activated. When the keyboard is captured, all keystrokes (including system ones like "
    62                                    "Alt-Tab) are directed to the VM."));
    63     }
     52    if (m_pTextEdit)
     53        m_pTextEdit->setToolTip(tr("Holds the description of the virtual machine. The description field is useful "
     54                                   "for commenting on configuration details of the installed guest OS."));
    6455}
    6556
    66 void UIAutoCaptureKeyboardEditor::prepare()
     57void UIMachineDescriptionEditor::prepare()
    6758{
    6859    /* Prepare main layout: */
    69     QGridLayout *pLayout = new QGridLayout(this);
     60    QVBoxLayout *pLayout = new QVBoxLayout(this);
    7061    if (pLayout)
    7162    {
    7263        pLayout->setContentsMargins(0, 0, 0, 0);
    73         pLayout->setColumnStretch(1, 1);
    7464
    75         /* Prepare label: */
    76         m_pLabel = new QLabel(this);
    77         if (m_pLabel)
    78             pLayout->addWidget(m_pLabel, 0, 0);
    79         /* Prepare check-box: */
    80         m_pCheckBox = new QCheckBox(this);
    81         if (m_pCheckBox)
    82             pLayout->addWidget(m_pCheckBox, 0, 1);
     65        /* Prepare text-edit: */
     66        m_pTextEdit = new QTextEdit(this);
     67        if (m_pTextEdit)
     68        {
     69            setFocusProxy(m_pTextEdit);
     70            m_pTextEdit->setAcceptRichText(false);
     71#ifdef VBOX_WS_MAC
     72            m_pTextEdit->setMinimumHeight(150);
     73#endif
     74
     75            pLayout->addWidget(m_pTextEdit);
     76        }
    8377    }
    8478
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMachineDescriptionEditor.h

    r94444 r94445  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIAutoCaptureKeyboardEditor class declaration.
     3 * VBox Qt GUI - UIMachineDescriptionEditor class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UIAutoCaptureKeyboardEditor_h
    19 #define FEQT_INCLUDED_SRC_settings_editors_UIAutoCaptureKeyboardEditor_h
     18#ifndef FEQT_INCLUDED_SRC_settings_editors_UIMachineDescriptionEditor_h
     19#define FEQT_INCLUDED_SRC_settings_editors_UIMachineDescriptionEditor_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    2626
    2727/* Forward declarations: */
    28 class QCheckBox;
    29 class QLabel;
     28class QTextEdit;
    3029
    31 /** QWidget subclass used as an auto capture keyboard editor. */
    32 class SHARED_LIBRARY_STUFF UIAutoCaptureKeyboardEditor : public QIWithRetranslateUI<QWidget>
     30/** QWidget subclass used as machine description editor. */
     31class SHARED_LIBRARY_STUFF UIMachineDescriptionEditor : public QIWithRetranslateUI<QWidget>
    3332{
    3433    Q_OBJECT;
     
    3736
    3837    /** Constructs editor passing @a pParent to the base-class. */
    39     UIAutoCaptureKeyboardEditor(QWidget *pParent = 0);
     38    UIMachineDescriptionEditor(QWidget *pParent = 0);
    4039
    41     /** Defines editor @a fValue. */
    42     void setValue(bool fValue);
     40    /** Defines editor @a strValue. */
     41    void setValue(const QString &strValue);
    4342    /** Returns editor value. */
    44     bool value() const;
     43    QString value() const;
    4544
    4645protected:
     
    5554
    5655    /** Holds the value to be set. */
    57     bool  m_fValue;
     56    QString  m_strValue;
    5857
    59     /** Holds the label instance. */
    60     QLabel    *m_pLabel;
    6158    /** Holds the check-box instance. */
    62     QCheckBox *m_pCheckBox;
     59    QTextEdit *m_pTextEdit;
    6360};
    6461
    65 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UIAutoCaptureKeyboardEditor_h */
     62#endif /* !FEQT_INCLUDED_SRC_settings_editors_UIMachineDescriptionEditor_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.cpp

    r94030 r94445  
    2020#include <QGridLayout>
    2121#include <QLabel>
    22 #include <QRegularExpressionValidator>
    2322#include <QVBoxLayout>
    2423
     
    264263}
    265264
    266 void UINameAndSystemEditor::setNameFieldValidator(const QString &strValidator)
    267 {
    268     if (!m_pEditorName)
    269         return;
    270     m_pEditorName->setValidator(new QRegularExpressionValidator(QRegularExpression(strValidator), this));
    271 }
    272 
    273265void UINameAndSystemEditor::markNameEditor(bool fError)
    274266{
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINameAndSystemEditor.h

    r94395 r94445  
    123123    /** Returns the VM OS type. */
    124124    CGuestOSType type() const;
    125 
    126     /** Defines the name-field @a strValidator. */
    127     void setNameFieldValidator(const QString &strValidator);
    128125
    129126    /** Passes the @p fError to QILineEdit::mark(bool) effectively marking it for error. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r94333 r94445  
    3232#include "UIErrorString.h"
    3333#include "UIFilePathSelector.h"
     34#include "UIMachineDescriptionEditor.h"
    3435#include "UIMachineSettingsGeneral.h"
    3536#include "UIModalWindowManager.h"
     
    148149    , m_pEditorEncryptionPasswordConfirm(0)
    149150{
    150     /* Prepare: */
    151151    prepare();
    152152}
     
    154154UIMachineSettingsGeneral::~UIMachineSettingsGeneral()
    155155{
    156     /* Cleanup: */
    157156    cleanup();
    158157}
     
    286285    /* Load old 'Description' data from cache: */
    287286    AssertPtrReturnVoid(m_pEditorDescription);
    288     m_pEditorDescription->setPlainText(oldGeneralData.m_strDescription);
     287    m_pEditorDescription->setValue(oldGeneralData.m_strDescription);
    289288
    290289    /* Load old 'Encryption' data from cache: */
     
    323322    /* Gather new 'Description' data: */
    324323    AssertPtrReturnVoid(m_pEditorDescription);
    325     newGeneralData.m_strDescription = m_pEditorDescription->toPlainText().isEmpty() ?
    326                                       QString() : m_pEditorDescription->toPlainText();
     324    newGeneralData.m_strDescription = m_pEditorDescription->value().isEmpty() ?
     325                                      QString() : m_pEditorDescription->value();
    327326
    328327    /* Gather new 'Encryption' data: */
     
    494493                                       "This feature requires Guest Additions to be installed in the guest OS."));
    495494    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabAdvanced), tr("A&dvanced"));
    496     m_pEditorDescription->setToolTip(tr("Holds the description of the virtual machine. The description field is useful for "
    497                                         "commenting on configuration details of the installed guest OS."));
    498495    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabDescription), tr("D&escription"));
    499496    m_pCheckBoxEncryption->setToolTip(tr("When checked, disks attached to this virtual machine will be encrypted."));
     
    614611            m_pEditorNameAndSystem = new UINameAndSystemEditor(m_pTabBasic);
    615612            if (m_pEditorNameAndSystem)
    616             {
    617                 m_pEditorNameAndSystem->setNameFieldValidator(".+");
    618613                pLayoutBasic->addWidget(m_pEditorNameAndSystem);
    619             }
    620 
    621             /* Add vertical strech: */
     614
    622615            pLayoutBasic->addStretch();
    623616        }
     
    704697        {
    705698            /* Prepare description editor: */
    706             m_pEditorDescription = new QTextEdit(m_pTabDescription);
     699            m_pEditorDescription = new UIMachineDescriptionEditor(m_pTabDescription);
    707700            if (m_pEditorDescription)
    708701            {
    709702                m_pEditorDescription->setObjectName(QStringLiteral("m_pEditorDescription"));
    710                 m_pEditorDescription->setAcceptRichText(false);
    711 #ifdef VBOX_WS_MAC
    712                 m_pEditorDescription->setMinimumHeight(150);
    713 #endif
    714 
    715703                pLayoutDescription->addWidget(m_pEditorDescription);
    716704            }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h

    r94333 r94445  
    3030class QComboBox;
    3131class QLineEdit;
    32 class QTextEdit;
    3332class QITabWidget;
     33class UIMachineDescriptionEditor;
    3434class UINameAndSystemEditor;
    3535
     
    176176
    177177        /** Holds the 'Description' tab instance. */
    178         QWidget   *m_pTabDescription;
     178        QWidget                    *m_pTabDescription;
    179179        /** Holds the description editor instance. */
    180         QTextEdit *m_pEditorDescription;
     180        UIMachineDescriptionEditor *m_pEditorDescription;
    181181
    182182        /** Holds the 'Encryption' tab instance. */
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