VirtualBox

Changeset 94378 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Mar 25, 2022 7:34:56 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
150685
Message:

FE/Qt/Ds: bugref:6899: Machine settings: Display page accessibility improvements for Remote Display tab; Moving remote display stuff to separate editor.

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

Legend:

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

    r94362 r94378  
    918918        src/settings/editors/UIVisualStateEditor.h \
    919919        src/settings/editors/UIVRDEAuthLibraryEditor.h \
     920        src/settings/editors/UIVRDESettingsEditor.h \
    920921        src/settings/global/UIGlobalSettingsGeneral.h \
    921922        src/settings/global/UIGlobalSettingsInput.h \
     
    14761477        src/settings/editors/UIVisualStateEditor.cpp \
    14771478        src/settings/editors/UIVRDEAuthLibraryEditor.cpp \
     1479        src/settings/editors/UIVRDESettingsEditor.cpp \
    14781480        src/settings/global/UIGlobalSettingsGeneral.cpp \
    14791481        src/settings/global/UIGlobalSettingsInput.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVRDESettingsEditor.cpp

    r94377 r94378  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIUpdateSettingsEditor class implementation.
     3 * VBox Qt GUI - UIVRDESettingsEditor class implementation.
    44 */
    55
     
    1717
    1818/* Qt includes: */
    19 #include <QButtonGroup>
    2019#include <QCheckBox>
    2120#include <QComboBox>
    2221#include <QGridLayout>
    2322#include <QLabel>
    24 #include <QRadioButton>
     23#include <QLineEdit>
    2524
    2625/* GUI includes: */
    27 #include "UIUpdateSettingsEditor.h"
    28 
    29 
    30 UIUpdateSettingsEditor::UIUpdateSettingsEditor(QWidget *pParent /* = 0 */)
     26#include "UIConverter.h"
     27#include "UIVRDESettingsEditor.h"
     28
     29
     30UIVRDESettingsEditor::UIVRDESettingsEditor(QWidget *pParent /* = 0 */)
    3131    : QIWithRetranslateUI<QWidget>(pParent)
    32     , m_pCheckBox(0)
    33     , m_pWidgetUpdateSettings(0)
    34     , m_pLabelUpdatePeriod(0)
    35     , m_pComboUpdatePeriod(0)
    36     , m_pLabelUpdateDate(0)
    37     , m_pFieldUpdateDate(0)
    38     , m_pLabelUpdateFilter(0)
    39     , m_pRadioButtonGroup(0)
     32    , m_fFeatureEnabled(false)
     33    , m_enmAuthType(KAuthType_Max)
     34    , m_fMultipleConnectionsAllowed(false)
     35    , m_pCheckboxFeature(0)
     36    , m_pWidgetSettings(0)
     37    , m_pLabelPort(0)
     38    , m_pEditorPort(0)
     39    , m_pLabelAuthMethod(0)
     40    , m_pComboAuthType(0)
     41    , m_pLabelTimeout(0)
     42    , m_pEditorTimeout(0)
     43    , m_pLabelOptions(0)
     44    , m_pCheckboxMultipleConnections(0)
    4045{
    4146    prepare();
    4247}
    4348
    44 void UIUpdateSettingsEditor::setValue(const VBoxUpdateData &guiValue)
    45 {
    46     /* Update value if changed: */
    47     if (m_guiValue != guiValue)
    48     {
    49         /* Update value itself: */
    50         m_guiValue = guiValue;
    51 
    52         /* Update check-box if present: */
    53         if (m_pCheckBox)
     49void UIVRDESettingsEditor::setFeatureEnabled(bool fEnabled)
     50{
     51    if (m_fFeatureEnabled != fEnabled)
     52    {
     53        m_fFeatureEnabled = fEnabled;
     54        if (m_pCheckboxFeature)
    5455        {
    55             m_pCheckBox->setChecked(!m_guiValue.isNoNeedToCheck());
    56 
    57             if (m_pCheckBox->isChecked())
    58             {
    59                 /* Update period combo if present: */
    60                 if (m_pComboUpdatePeriod)
    61                     m_pComboUpdatePeriod->setCurrentIndex(m_guiValue.periodIndex());
    62 
    63                 /* Update branch radio-buttons if present: */
    64                 if (m_mapRadioButtons.value(m_guiValue.branchIndex()))
    65                     m_mapRadioButtons.value(m_guiValue.branchIndex())->setChecked(true);
    66             }
    67 
    68             /* Update other related widgets: */
    69             sltHandleUpdateToggle(m_pCheckBox->isChecked());
     56            m_pCheckboxFeature->setChecked(m_fFeatureEnabled);
     57            sltHandleFeatureToggled(m_pCheckboxFeature->isChecked());
    7058        }
    7159    }
    7260}
    7361
    74 VBoxUpdateData UIUpdateSettingsEditor::value() const
    75 {
    76     return m_pCheckBox ? VBoxUpdateData(periodType(), branchType()) : m_guiValue;
    77 }
    78 
    79 void UIUpdateSettingsEditor::retranslateUi()
    80 {
    81     /* Translate check-box: */
    82     if (m_pCheckBox)
    83     {
    84         m_pCheckBox->setToolTip(tr("When checked, the application will periodically connect to the VirtualBox "
    85                                    "website and check whether a new VirtualBox version is available."));
    86         m_pCheckBox->setText(tr("&Check for Updates"));
    87     }
    88 
    89     /* Translate period widgets: */
    90     if (m_pLabelUpdatePeriod)
    91         m_pLabelUpdatePeriod->setText(tr("&Once per:"));
    92     if (m_pComboUpdatePeriod)
    93     {
    94         m_pComboUpdatePeriod->setToolTip(tr("Selects how often the new version check should be performed."));
    95         const int iCurrenIndex = m_pComboUpdatePeriod->currentIndex();
    96         m_pComboUpdatePeriod->clear();
    97         VBoxUpdateData::populate();
    98         m_pComboUpdatePeriod->insertItems(0, VBoxUpdateData::list());
    99         m_pComboUpdatePeriod->setCurrentIndex(iCurrenIndex == -1 ? 0 : iCurrenIndex);
    100     }
    101     if (m_pLabelUpdateDate)
    102         m_pLabelUpdateDate->setText(tr("Next Check:"));
    103     if (m_pLabelUpdateFilter)
    104         m_pLabelUpdateFilter->setText(tr("Check for:"));
    105 
    106     /* Translate branch widgets: */
    107     if (m_mapRadioButtons.value(VBoxUpdateData::BranchStable))
    108     {
    109         m_mapRadioButtons.value(VBoxUpdateData::BranchStable)->setToolTip(tr("When chosen, you will be notified "
    110                                                                              "about stable updates to VirtualBox."));
    111         m_mapRadioButtons.value(VBoxUpdateData::BranchStable)->setText(tr("&Stable Release Versions"));
    112     }
    113     if (m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease))
    114     {
    115         m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease)->setToolTip(tr("When chosen, you will be notified "
    116                                                                                  "about all new VirtualBox releases."));
    117         m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease)->setText(tr("&All New Releases"));
    118     }
    119     if (m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas))
    120     {
    121         m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas)->setToolTip(tr("When chosen, you will be notified "
    122                                                                                 "about all new VirtualBox releases and "
    123                                                                                 "pre-release versions of VirtualBox."));
    124         m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas)->setText(tr("All New Releases and &Pre-Releases"));
    125     }
    126 }
    127 
    128 void UIUpdateSettingsEditor::sltHandleUpdateToggle(bool fEnabled)
    129 {
    130     /* Update activity status: */
    131     if (m_pWidgetUpdateSettings)
    132         m_pWidgetUpdateSettings->setEnabled(fEnabled);
    133 
    134     /* Update time of next check: */
    135     sltHandleUpdatePeriodChange();
    136 
    137     /* Choose stable branch if update enabled but branch isn't chosen: */
    138     if (   fEnabled
    139         && m_pRadioButtonGroup
    140         && !m_pRadioButtonGroup->checkedButton()
    141         && m_mapRadioButtons.value(VBoxUpdateData::BranchStable))
    142         m_mapRadioButtons.value(VBoxUpdateData::BranchStable)->setChecked(true);
    143 }
    144 
    145 void UIUpdateSettingsEditor::sltHandleUpdatePeriodChange()
    146 {
    147     if (m_pFieldUpdateDate)
    148         m_pFieldUpdateDate->setText(VBoxUpdateData(periodType(), branchType()).date());
    149 }
    150 
    151 void UIUpdateSettingsEditor::prepare()
     62bool UIVRDESettingsEditor::isFeatureEnabled() const
     63{
     64    return m_pCheckboxFeature ? m_pCheckboxFeature->isChecked() : m_fFeatureEnabled;
     65}
     66
     67void UIVRDESettingsEditor::setVRDEOptionsAvailable(bool fAvailable)
     68{
     69    if (m_pLabelOptions)
     70        m_pLabelOptions->setEnabled(fAvailable);
     71    if (m_pCheckboxMultipleConnections)
     72        m_pCheckboxMultipleConnections->setEnabled(fAvailable);
     73}
     74
     75void UIVRDESettingsEditor::setPort(const QString &strPort)
     76{
     77    if (m_strPort != strPort)
     78    {
     79        m_strPort = strPort;
     80        if (m_pEditorPort)
     81            m_pEditorPort->setText(m_strPort);
     82    }
     83}
     84
     85QString UIVRDESettingsEditor::port() const
     86{
     87    return m_pEditorPort ? m_pEditorPort->text() : m_strPort;
     88}
     89
     90void UIVRDESettingsEditor::setAuthType(const KAuthType &enmType)
     91{
     92    if (m_enmAuthType != enmType)
     93    {
     94        m_enmAuthType = enmType;
     95        if (m_pComboAuthType)
     96        {
     97            /* We are doing that *now* because this combo have
     98             * dynamical content which depends on cashed value: */
     99            repopulateComboAuthType();
     100
     101            const int iAuthTypePosition = m_pComboAuthType->findData(enmType);
     102            m_pComboAuthType->setCurrentIndex(iAuthTypePosition == -1 ? 0 : iAuthTypePosition);
     103        }
     104    }
     105}
     106
     107KAuthType UIVRDESettingsEditor::authType() const
     108{
     109    return m_pComboAuthType ? m_pComboAuthType->currentData().value<KAuthType>() : m_enmAuthType;
     110}
     111
     112void UIVRDESettingsEditor::setTimeout(const QString &strTimeout)
     113{
     114    if (m_strTimeout != strTimeout)
     115    {
     116        m_strTimeout = strTimeout;
     117        if (m_pEditorTimeout)
     118            m_pEditorTimeout->setText(m_strTimeout);
     119    }
     120}
     121
     122QString UIVRDESettingsEditor::timeout() const
     123{
     124    return m_pEditorTimeout ? m_pEditorTimeout->text() : m_strTimeout;
     125}
     126
     127void UIVRDESettingsEditor::setMultipleConnectionsAllowed(bool fAllowed)
     128{
     129    if (m_fMultipleConnectionsAllowed != fAllowed)
     130    {
     131        m_fMultipleConnectionsAllowed = fAllowed;
     132        if (m_pCheckboxMultipleConnections)
     133            m_pCheckboxMultipleConnections->setChecked(m_fMultipleConnectionsAllowed);
     134    }
     135}
     136
     137bool UIVRDESettingsEditor::isMultipleConnectionsAllowed() const
     138{
     139    return m_pCheckboxMultipleConnections ? m_pCheckboxMultipleConnections->isChecked() : m_fMultipleConnectionsAllowed;
     140}
     141
     142void UIVRDESettingsEditor::retranslateUi()
     143{
     144    if (m_pCheckboxFeature)
     145    {
     146        m_pCheckboxFeature->setText(tr("&Enable Server"));
     147        m_pCheckboxFeature->setToolTip(tr("When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing "
     148                                          "remote clients to connect and operate the VM (when it is running) using a standard "
     149                                          "RDP client."));
     150    }
     151
     152    if (m_pLabelPort)
     153        m_pLabelPort->setText(tr("Server &Port:"));
     154    if (m_pEditorPort)
     155        m_pEditorPort->setToolTip(tr("Holds the VRDP Server port number. You may specify 0 (zero), to select port 3389, the "
     156                                     "standard port for RDP."));
     157
     158    if (m_pLabelAuthMethod)
     159        m_pLabelAuthMethod->setText(tr("Authentication &Method:"));
     160    if (m_pComboAuthType)
     161    {
     162        for (int iIndex = 0; iIndex < m_pComboAuthType->count(); ++iIndex)
     163        {
     164            const KAuthType enmType = m_pComboAuthType->itemData(iIndex).value<KAuthType>();
     165            m_pComboAuthType->setItemText(iIndex, gpConverter->toString(enmType));
     166        }
     167        m_pComboAuthType->setToolTip(tr("Selects the VRDP authentication method."));
     168    }
     169
     170    if (m_pLabelTimeout)
     171        m_pLabelTimeout->setText(tr("Authentication &Timeout:"));
     172    if (m_pEditorTimeout)
     173        m_pEditorTimeout->setToolTip(tr("Holds the timeout for guest authentication, in milliseconds."));
     174
     175    if (m_pLabelOptions)
     176        m_pLabelOptions->setText(tr("Extended Features:"));
     177    if (m_pCheckboxMultipleConnections)
     178    {
     179        m_pCheckboxMultipleConnections->setText(tr("&Allow Multiple Connections"));
     180        m_pCheckboxMultipleConnections->setToolTip(tr("When checked, multiple simultaneous connections to the VM are "
     181                                                      "permitted."));
     182    }
     183}
     184
     185void UIVRDESettingsEditor::sltHandleFeatureToggled(bool fEnabled)
     186{
     187    /* Update widget availability: */
     188    if (m_pWidgetSettings)
     189        m_pWidgetSettings->setEnabled(fEnabled);
     190
     191    /* Notify listeners: */
     192    emit sigChanged();
     193}
     194
     195void UIVRDESettingsEditor::prepare()
    152196{
    153197    /* Prepare everything: */
     
    159203}
    160204
    161 void UIUpdateSettingsEditor::prepareWidgets()
     205void UIVRDESettingsEditor::prepareWidgets()
    162206{
    163207    /* Prepare main layout: */
    164     QGridLayout *pLayoutMain = new QGridLayout(this);
    165     if (pLayoutMain)
    166     {
    167         pLayoutMain->setContentsMargins(0, 0, 0, 0);
    168         pLayoutMain->setRowStretch(2, 1);
    169 
    170         /* Prepare update check-box: */
    171         m_pCheckBox = new QCheckBox(this);
    172         if (m_pCheckBox)
    173             pLayoutMain->addWidget(m_pCheckBox, 0, 0, 1, 2);
     208    QGridLayout *pLayout = new QGridLayout(this);
     209    if (pLayout)
     210    {
     211        pLayout->setContentsMargins(0, 0, 0, 0);
     212        pLayout->setColumnStretch(1, 1);
     213
     214        /* Prepare 'feature' check-box: */
     215        m_pCheckboxFeature = new QCheckBox(this);
     216        if (m_pCheckboxFeature)
     217            pLayout->addWidget(m_pCheckboxFeature, 0, 0, 1, 2);
    174218
    175219        /* Prepare 20-px shifting spacer: */
    176220        QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum);
    177221        if (pSpacerItem)
    178             pLayoutMain->addItem(pSpacerItem, 1, 0);
    179 
    180         /* Prepare update settings widget: */
    181         m_pWidgetUpdateSettings = new QWidget(this);
    182         if (m_pWidgetUpdateSettings)
     222            pLayout->addItem(pSpacerItem, 1, 0);
     223
     224        /* Prepare 'settings' widget: */
     225        m_pWidgetSettings = new QWidget(this);
     226        if (m_pWidgetSettings)
    183227        {
    184             /* Prepare update settings widget layout: */
    185             QGridLayout *pLayoutUpdateSettings = new QGridLayout(m_pWidgetUpdateSettings);
    186             if (pLayoutUpdateSettings)
     228            /* Update widget availability: */
     229            sltHandleFeatureToggled(m_pCheckboxFeature->isChecked());
     230
     231            /* Prepare 'settings' layout: */
     232            QGridLayout *pLayoutRemoteDisplaySettings = new QGridLayout(m_pWidgetSettings);
     233            if (pLayoutRemoteDisplaySettings)
    187234            {
    188                 pLayoutUpdateSettings->setContentsMargins(0, 0, 0, 0);
    189                 pLayoutUpdateSettings->setColumnStretch(2, 1);
    190                 pLayoutUpdateSettings->setRowStretch(5, 1);
    191 
    192                 /* Prepare update period label: */
    193                 m_pLabelUpdatePeriod = new QLabel(m_pWidgetUpdateSettings);
    194                 if (m_pLabelUpdatePeriod)
    195                 {
    196                     m_pLabelUpdatePeriod->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    197                     pLayoutUpdateSettings->addWidget(m_pLabelUpdatePeriod, 0, 0);
    198                 }
    199                 /* Prepare update period combo: */
    200                 m_pComboUpdatePeriod = new QComboBox(m_pWidgetUpdateSettings);
    201                 if (m_pComboUpdatePeriod)
    202                 {
    203                     if (m_pLabelUpdatePeriod)
    204                         m_pLabelUpdatePeriod->setBuddy(m_pComboUpdatePeriod);
    205                     m_pComboUpdatePeriod->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    206                     m_pComboUpdatePeriod->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    207 
    208                     pLayoutUpdateSettings->addWidget(m_pComboUpdatePeriod, 0, 1);
    209                 }
    210 
    211                 /* Prepare update date label: */
    212                 m_pLabelUpdateDate = new QLabel(m_pWidgetUpdateSettings);
    213                 if (m_pLabelUpdateDate)
    214                 {
    215                     m_pLabelUpdateDate->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    216                     pLayoutUpdateSettings->addWidget(m_pLabelUpdateDate, 1, 0);
    217                 }
    218                 /* Prepare update date field: */
    219                 m_pFieldUpdateDate = new QLabel(m_pWidgetUpdateSettings);
    220                 if (m_pFieldUpdateDate)
    221                     pLayoutUpdateSettings->addWidget(m_pFieldUpdateDate, 1, 1);
    222 
    223                 /* Prepare update date label: */
    224                 m_pLabelUpdateFilter = new QLabel(m_pWidgetUpdateSettings);
    225                 if (m_pLabelUpdateFilter)
    226                 {
    227                     m_pLabelUpdateFilter->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    228                     pLayoutUpdateSettings->addWidget(m_pLabelUpdateFilter, 2, 0);
    229                 }
    230                 /* Prepare radio-button group: */
    231                 m_pRadioButtonGroup = new QButtonGroup(m_pWidgetUpdateSettings);
    232                 if (m_pRadioButtonGroup)
    233                 {
    234                     /* Prepare 'update to "stable"' radio-button: */
    235                     m_mapRadioButtons[VBoxUpdateData::BranchStable] = new QRadioButton(m_pWidgetUpdateSettings);
    236                     if (m_mapRadioButtons.value(VBoxUpdateData::BranchStable))
    237                     {
    238                         m_pRadioButtonGroup->addButton(m_mapRadioButtons.value(VBoxUpdateData::BranchStable));
    239                         pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value(VBoxUpdateData::BranchStable), 2, 1);
    240                     }
    241                     /* Prepare 'update to "all release"' radio-button: */
    242                     m_mapRadioButtons[VBoxUpdateData::BranchAllRelease] = new QRadioButton(m_pWidgetUpdateSettings);
    243                     if (m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease))
    244                     {
    245                         m_pRadioButtonGroup->addButton(m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease));
    246                         pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value(VBoxUpdateData::BranchAllRelease), 3, 1);
    247                     }
    248                     /* Prepare 'update to "with betas"' radio-button: */
    249                     m_mapRadioButtons[VBoxUpdateData::BranchWithBetas] = new QRadioButton(m_pWidgetUpdateSettings);
    250                     if (m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas))
    251                     {
    252                         m_pRadioButtonGroup->addButton(m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas));
    253                         pLayoutUpdateSettings->addWidget(m_mapRadioButtons.value(VBoxUpdateData::BranchWithBetas), 4, 1);
    254                     }
    255                 }
     235                pLayoutRemoteDisplaySettings->setContentsMargins(0, 0, 0, 0);
     236                pLayoutRemoteDisplaySettings->setColumnStretch(1, 1);
     237
     238                /* Prepare 'port' label: */
     239                m_pLabelPort = new QLabel(m_pWidgetSettings);
     240                if (m_pLabelPort)
     241                {
     242                    m_pLabelPort->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     243                    pLayoutRemoteDisplaySettings->addWidget(m_pLabelPort, 0, 0);
     244                }
     245                /* Prepare 'port' editor: */
     246                m_pEditorPort = new QLineEdit(m_pWidgetSettings);
     247                if (m_pEditorPort)
     248                {
     249                    if (m_pLabelPort)
     250                        m_pLabelPort->setBuddy(m_pEditorPort);
     251                    m_pEditorPort->setValidator(new QRegularExpressionValidator(
     252                        QRegularExpression("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this));
     253
     254                    pLayoutRemoteDisplaySettings->addWidget(m_pEditorPort, 0, 1, 1, 2);
     255                }
     256
     257                /* Prepare 'auth type' label: */
     258                m_pLabelAuthMethod = new QLabel(m_pWidgetSettings);
     259                if (m_pLabelAuthMethod)
     260                {
     261                    m_pLabelAuthMethod->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     262                    pLayoutRemoteDisplaySettings->addWidget(m_pLabelAuthMethod, 1, 0);
     263                }
     264                /* Prepare 'auth type' combo: */
     265                m_pComboAuthType = new QComboBox(m_pWidgetSettings);
     266                if (m_pComboAuthType)
     267                {
     268                    if (m_pLabelAuthMethod)
     269                        m_pLabelAuthMethod->setBuddy(m_pComboAuthType);
     270                    m_pComboAuthType->setSizeAdjustPolicy(QComboBox::AdjustToContents);
     271
     272                    pLayoutRemoteDisplaySettings->addWidget(m_pComboAuthType, 1, 1, 1, 2);
     273                }
     274
     275                /* Prepare 'timeout' label: */
     276                m_pLabelTimeout = new QLabel(m_pWidgetSettings);
     277                if (m_pLabelTimeout)
     278                {
     279                    m_pLabelTimeout->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     280                    pLayoutRemoteDisplaySettings->addWidget(m_pLabelTimeout, 2, 0);
     281                }
     282                /* Prepare 'timeout' editor: */
     283                m_pEditorTimeout = new QLineEdit(m_pWidgetSettings);
     284                if (m_pEditorTimeout)
     285                {
     286                    if (m_pLabelTimeout)
     287                        m_pLabelTimeout->setBuddy(m_pEditorTimeout);
     288                    m_pEditorTimeout->setValidator(new QIntValidator(this));
     289
     290                    pLayoutRemoteDisplaySettings->addWidget(m_pEditorTimeout, 2, 1, 1, 2);
     291                }
     292
     293                /* Prepare 'options' label: */
     294                m_pLabelOptions = new QLabel(m_pWidgetSettings);
     295                if (m_pLabelOptions)
     296                {
     297                    m_pLabelOptions->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     298                    pLayoutRemoteDisplaySettings->addWidget(m_pLabelOptions, 3, 0);
     299                }
     300                /* Prepare 'multiple connections' check-box: */
     301                m_pCheckboxMultipleConnections = new QCheckBox(m_pWidgetSettings);
     302                if (m_pCheckboxMultipleConnections)
     303                    pLayoutRemoteDisplaySettings->addWidget(m_pCheckboxMultipleConnections, 3, 1);
    256304            }
    257305
    258             pLayoutMain->addWidget(m_pWidgetUpdateSettings, 1, 1);
     306            pLayout->addWidget(m_pWidgetSettings, 1, 1, 1, 2);
    259307        }
    260308    }
    261309}
    262310
    263 void UIUpdateSettingsEditor::prepareConnections()
    264 {
    265     if (m_pCheckBox)
    266         connect(m_pCheckBox, &QCheckBox::toggled, this, &UIUpdateSettingsEditor::sltHandleUpdateToggle);
    267     if (m_pComboUpdatePeriod)
    268         connect(m_pComboUpdatePeriod, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated),
    269                 this, &UIUpdateSettingsEditor::sltHandleUpdatePeriodChange);
    270 }
    271 
    272 VBoxUpdateData::PeriodType UIUpdateSettingsEditor::periodType() const
    273 {
    274     const VBoxUpdateData::PeriodType enmResult = m_pCheckBox && m_pCheckBox->isChecked() && m_pComboUpdatePeriod
    275                                                ? (VBoxUpdateData::PeriodType)m_pComboUpdatePeriod->currentIndex()
    276                                                : VBoxUpdateData::PeriodNever;
    277     return enmResult == VBoxUpdateData::PeriodUndefined ? VBoxUpdateData::Period1Day : enmResult;
    278 }
    279 
    280 VBoxUpdateData::BranchType UIUpdateSettingsEditor::branchType() const
    281 {
    282     QAbstractButton *pCheckedButton = m_pRadioButtonGroup ? m_pRadioButtonGroup->checkedButton() : 0;
    283     return pCheckedButton ? m_mapRadioButtons.key(pCheckedButton, VBoxUpdateData::BranchStable) : VBoxUpdateData::BranchStable;
    284 }
     311void UIVRDESettingsEditor::prepareConnections()
     312{
     313    if (m_pCheckboxFeature)
     314        connect(m_pCheckboxFeature, &QCheckBox::toggled, this, &UIVRDESettingsEditor::sltHandleFeatureToggled);
     315    if (m_pEditorPort)
     316        connect(m_pEditorPort, &QLineEdit::textChanged, this, &UIVRDESettingsEditor::sigChanged);
     317    if (m_pEditorTimeout)
     318        connect(m_pEditorTimeout, &QLineEdit::textChanged, this, &UIVRDESettingsEditor::sigChanged);
     319}
     320
     321void UIVRDESettingsEditor::repopulateComboAuthType()
     322{
     323    if (m_pComboAuthType)
     324    {
     325        /* Clear combo first of all: */
     326        m_pComboAuthType->clear();
     327
     328        /// @todo get supported auth types (API not implemented), not hardcoded!
     329        QVector<KAuthType> authTypes = QVector<KAuthType>() << KAuthType_Null
     330                                                            << KAuthType_External
     331                                                            << KAuthType_Guest;
     332
     333        /* Take into account currently cached value: */
     334        if (!authTypes.contains(m_enmAuthType))
     335            authTypes.prepend(m_enmAuthType);
     336
     337        /* Populate combo finally: */
     338        foreach (const KAuthType &enmType, authTypes)
     339            m_pComboAuthType->addItem(gpConverter->toString(enmType), QVariant::fromValue(enmType));
     340    }
     341}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVRDESettingsEditor.h

    r94377 r94378  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIUpdateSettingsEditor class declaration.
     3 * VBox Qt GUI - UIVRDESettingsEditor class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_settings_editors_UIUpdateSettingsEditor_h
    19 #define FEQT_INCLUDED_SRC_settings_editors_UIUpdateSettingsEditor_h
     18#ifndef FEQT_INCLUDED_SRC_settings_editors_UIVRDESettingsEditor_h
     19#define FEQT_INCLUDED_SRC_settings_editors_UIVRDESettingsEditor_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    2929#include "UIUpdateDefs.h"
    3030
     31/* COM includes: */
     32#include "COMEnums.h"
     33
    3134/* Forward declarations: */
    32 class QAbstractButton;
    33 class QButtonGroup;
    3435class QCheckBox;
    3536class QComboBox;
    3637class QLabel;
     38class QLineEdit;
     39class QWidget;
    3740
    38 /** QWidget subclass used as a update settings editor. */
    39 class SHARED_LIBRARY_STUFF UIUpdateSettingsEditor : public QIWithRetranslateUI<QWidget>
     41/** QWidget subclass used as a VRDE settings editor. */
     42class SHARED_LIBRARY_STUFF UIVRDESettingsEditor : public QIWithRetranslateUI<QWidget>
    4043{
    4144    Q_OBJECT;
    4245
     46signals:
     47
     48    /** Notify listeners about some status changed. */
     49    void sigChanged();
     50
    4351public:
    4452
    45     /** Constructs update settings editor passing @a pParent to the base-class. */
    46     UIUpdateSettingsEditor(QWidget *pParent = 0);
     53    /** Constructs VRDE settings editor passing @a pParent to the base-class. */
     54    UIVRDESettingsEditor(QWidget *pParent = 0);
    4755
    48     /** Defines editor @a guiValue. */
    49     void setValue(const VBoxUpdateData &guiValue);
    50     /** Returns editor value. */
    51     VBoxUpdateData value() const;
     56    /** Defines whether feature is @a fEnabled. */
     57    void setFeatureEnabled(bool fEnabled);
     58    /** Returns whether feature is enabled. */
     59    bool isFeatureEnabled() const;
     60
     61    /** Defines whether VRDE options are @a fAvailable. */
     62    void setVRDEOptionsAvailable(bool fAvailable);
     63
     64    /** Defines @a strPort. */
     65    void setPort(const QString &strPort);
     66    /** Returns port. */
     67    QString port() const;
     68
     69    /** Defines auth @a enmType. */
     70    void setAuthType(const KAuthType &enmType);
     71    /** Returns auth type. */
     72    KAuthType authType() const;
     73
     74    /** Defines @a strTimeout. */
     75    void setTimeout(const QString &strTimeout);
     76    /** Returns timeout. */
     77    QString timeout() const;
     78
     79    /** Defines whether multiple connections @a fAllowed. */
     80    void setMultipleConnectionsAllowed(bool fAllowed);
     81    /** Returns whether multiple connections allowed. */
     82    bool isMultipleConnectionsAllowed() const;
    5283
    5384protected:
     
    5889private slots:
    5990
    60     /** Handles whether update is @a fEnabled. */
    61     void sltHandleUpdateToggle(bool fEnabled);
    62     /** Handles update period change. */
    63     void sltHandleUpdatePeriodChange();
     91    /** Handles whether VRDE is @a fEnabled. */
     92    void sltHandleFeatureToggled(bool fEnabled);
    6493
    6594private:
     
    72101    void prepareConnections();
    73102
    74     /** Returns period type. */
    75     VBoxUpdateData::PeriodType periodType() const;
    76     /** Returns branch type. */
    77     VBoxUpdateData::BranchType branchType() const;
     103    /** Repopulates auth type combo-box. */
     104    void repopulateComboAuthType();
    78105
    79     /** Holds the value to be set. */
    80     VBoxUpdateData  m_guiValue;
     106    /** @name Variables
     107     * @{ */
     108        /** Holds whether feature is enabled. */
     109        bool       m_fFeatureEnabled;
     110        /** Holds the port. */
     111        QString    m_strPort;
     112        /** Holds the auth type. */
     113        KAuthType  m_enmAuthType;
     114        /** Holds the timeout. */
     115        QString    m_strTimeout;
     116        /** Returns whether multiple connections allowed. */
     117        bool       m_fMultipleConnectionsAllowed;
     118    /** @} */
    81119
    82120    /** @name Widgets
    83121     * @{ */
    84         /** Holds the update check-box instance. */
    85         QCheckBox *m_pCheckBox;
    86         /** Holds the update settings widget instance. */
    87         QWidget   *m_pWidgetUpdateSettings;
    88         /** Holds the update period label instance. */
    89         QLabel    *m_pLabelUpdatePeriod;
    90         /** Holds the update period combo instance. */
    91         QComboBox *m_pComboUpdatePeriod;
    92         /** Holds the update date label instance. */
    93         QLabel    *m_pLabelUpdateDate;
    94         /** Holds the update date field instance. */
    95         QLabel    *m_pFieldUpdateDate;
    96         /** Holds the update filter label instance. */
    97         QLabel    *m_pLabelUpdateFilter;
    98 
    99         /** Holds the radio button group instance. */
    100         QButtonGroup                                       *m_pRadioButtonGroup;
    101         /** Holds the radio button map instance. */
    102         QMap<VBoxUpdateData::BranchType, QAbstractButton*>  m_mapRadioButtons;
     122        /** Holds the feature check-box instance. */
     123        QCheckBox *m_pCheckboxFeature;
     124        /** Holds the settings widget instance. */
     125        QWidget   *m_pWidgetSettings;
     126        /** Holds the port label instance. */
     127        QLabel    *m_pLabelPort;
     128        /** Holds the port editor instance. */
     129        QLineEdit *m_pEditorPort;
     130        /** Holds the port auth method label instance. */
     131        QLabel    *m_pLabelAuthMethod;
     132        /** Holds the port auth method combo instance. */
     133        QComboBox *m_pComboAuthType;
     134        /** Holds the timeout label instance. */
     135        QLabel    *m_pLabelTimeout;
     136        /** Holds the timeout editor instance. */
     137        QLineEdit *m_pEditorTimeout;
     138        /** Holds the options label instance. */
     139        QLabel    *m_pLabelOptions;
     140        /** Holds the multiple connection check-box instance. */
     141        QCheckBox *m_pCheckboxMultipleConnections;
    103142    /** @} */
    104143};
    105144
    106 #endif /* !FEQT_INCLUDED_SRC_settings_editors_UIUpdateSettingsEditor_h */
     145#endif /* !FEQT_INCLUDED_SRC_settings_editors_UIVRDESettingsEditor_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r94362 r94378  
    4646#include "UITranslator.h"
    4747#include "UIVideoMemoryEditor.h"
     48#include "UIVRDESettingsEditor.h"
    4849
    4950/* COM includes: */
     
    314315#endif
    315316    , m_pTabRemoteDisplay(0)
    316     , m_pCheckboxRemoteDisplay(0)
    317     , m_pWidgetRemoteDisplaySettings(0)
    318     , m_pLabelRemoteDisplayPort(0)
    319     , m_pEditorRemoteDisplayPort(0)
    320     , m_pLabelRemoteDisplayAuthMethod(0)
    321     , m_pComboRemoteDisplayAuthMethod(0)
    322     , m_pLabelRemoteDisplayTimeout(0)
    323     , m_pEditorRemoteDisplayTimeout(0)
    324     , m_pLabelRemoteDisplayOptions(0)
    325     , m_pCheckboxMultipleConn(0)
     317    , m_pEditorVRDESettings(0)
    326318    , m_pTabRecording(0)
    327319    , m_pCheckboxRecording(0)
     
    490482    const UIDataSettingsMachineDisplay &oldDisplayData = m_pCache->base();
    491483
    492     /* We are doing that *now* because these combos have
    493      * dynamical content which depends on cashed value: */
    494     repopulateComboAuthType();
    495 
    496484    /* Load old 'Screen' data from cache: */
    497485    m_pEditorMonitorCount->setValue(oldDisplayData.m_cGuestScreenCount);
     
    515503    {
    516504        /* Load old 'Remote Display' data from cache: */
    517         m_pCheckboxRemoteDisplay->setChecked(oldDisplayData.m_fRemoteDisplayServerEnabled);
    518         m_pEditorRemoteDisplayPort->setText(oldDisplayData.m_strRemoteDisplayPort);
    519         const int iAuthTypePosition = m_pComboRemoteDisplayAuthMethod->findData(oldDisplayData.m_remoteDisplayAuthType);
    520         m_pComboRemoteDisplayAuthMethod->setCurrentIndex(iAuthTypePosition == -1 ? 0 : iAuthTypePosition);
    521         m_pEditorRemoteDisplayTimeout->setText(QString::number(oldDisplayData.m_uRemoteDisplayTimeout));
    522         m_pCheckboxMultipleConn->setChecked(oldDisplayData.m_fRemoteDisplayMultiConnAllowed);
     505        m_pEditorVRDESettings->setFeatureEnabled(oldDisplayData.m_fRemoteDisplayServerEnabled);
     506        m_pEditorVRDESettings->setPort(oldDisplayData.m_strRemoteDisplayPort);
     507        m_pEditorVRDESettings->setAuthType(oldDisplayData.m_remoteDisplayAuthType);
     508        m_pEditorVRDESettings->setTimeout(QString::number(oldDisplayData.m_uRemoteDisplayTimeout));
     509        m_pEditorVRDESettings->setMultipleConnectionsAllowed(oldDisplayData.m_fRemoteDisplayMultiConnAllowed);
    523510    }
    524511
     
    572559    {
    573560        /* Gather new 'Remote Display' data: */
    574         newDisplayData.m_fRemoteDisplayServerEnabled = m_pCheckboxRemoteDisplay->isChecked();
    575         newDisplayData.m_strRemoteDisplayPort = m_pEditorRemoteDisplayPort->text();
    576         newDisplayData.m_remoteDisplayAuthType = m_pComboRemoteDisplayAuthMethod->currentData().value<KAuthType>();
    577         newDisplayData.m_uRemoteDisplayTimeout = m_pEditorRemoteDisplayTimeout->text().toULong();
    578         newDisplayData.m_fRemoteDisplayMultiConnAllowed = m_pCheckboxMultipleConn->isChecked();
     561        newDisplayData.m_fRemoteDisplayServerEnabled = m_pEditorVRDESettings->isFeatureEnabled();
     562        newDisplayData.m_strRemoteDisplayPort = m_pEditorVRDESettings->port();
     563        newDisplayData.m_remoteDisplayAuthType = m_pEditorVRDESettings->authType();
     564        newDisplayData.m_uRemoteDisplayTimeout = m_pEditorVRDESettings->timeout().toULong();
     565        newDisplayData.m_fRemoteDisplayMultiConnAllowed = m_pEditorVRDESettings->isMultipleConnectionsAllowed();
    579566    }
    580567
     
    705692        message.first = UITranslator::removeAccelMark(m_pTabWidget->tabText(1));
    706693
    707         /* VRDE Extension Pack presence test: */
    708         if (m_pCheckboxRemoteDisplay->isChecked())
     694        /* Extension Pack presence test: */
     695        if (m_pEditorVRDESettings->isFeatureEnabled())
    709696        {
    710697            CExtPackManager extPackManager = uiCommon().virtualBox().GetExtensionPackManager();
     
    720707
    721708        /* Check VRDE server port: */
    722         if (m_pEditorRemoteDisplayPort->text().trimmed().isEmpty())
     709        if (m_pEditorVRDESettings->port().trimmed().isEmpty())
    723710        {
    724711            message.second << tr("The VRDE server port value is not currently specified.");
     
    727714
    728715        /* Check VRDE server timeout: */
    729         if (m_pEditorRemoteDisplayTimeout->text().trimmed().isEmpty())
     716        if (m_pEditorVRDESettings->timeout().trimmed().isEmpty())
    730717        {
    731718            message.second << tr("The VRDE authentication timeout value is not currently specified.");
     
    750737    setTabOrder(m_pEditorMonitorCount, m_pEditorScaleFactor);
    751738    setTabOrder(m_pEditorScaleFactor, m_pEditorGraphicsController);
     739#ifdef VBOX_WITH_3D_ACCELERATION
     740    setTabOrder(m_pEditorGraphicsController, m_pEditorDisplayScreenFeatures);
     741    setTabOrder(m_pEditorDisplayScreenFeatures, m_pEditorVRDESettings);
     742#else
     743    setTabOrder(m_pEditorGraphicsController, m_pEditorVRDESettings);
     744#endif
    752745
    753746    /* Remote Display tab-order: */
    754     setTabOrder(m_pCheckboxRemoteDisplay, m_pEditorRemoteDisplayPort);
    755     setTabOrder(m_pEditorRemoteDisplayPort, m_pComboRemoteDisplayAuthMethod);
    756     setTabOrder(m_pComboRemoteDisplayAuthMethod, m_pEditorRemoteDisplayTimeout);
    757     setTabOrder(m_pEditorRemoteDisplayTimeout, m_pCheckboxMultipleConn);
     747    setTabOrder(m_pEditorVRDESettings, m_pCheckboxRecording);
    758748
    759749    /* Recording tab-order: */
    760     setTabOrder(m_pCheckboxMultipleConn, m_pCheckboxRecording);
    761750    setTabOrder(m_pCheckboxRecording, m_pEditorRecordingFilePath);
    762751    setTabOrder(m_pEditorRecordingFilePath, m_pComboRecordingFrameSize);
     
    772761{
    773762    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabScreen), tr("&Screen"));
    774     m_pCheckboxRemoteDisplay->setToolTip(tr("When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing "
    775                                             "remote clients to connect and operate the VM (when it is running) using a standard "
    776                                             "RDP client."));
    777     m_pCheckboxRemoteDisplay->setText(tr("&Enable Server"));
    778     m_pLabelRemoteDisplayPort->setText(tr("Server &Port:"));
    779     m_pEditorRemoteDisplayPort->setToolTip(tr("Holds the VRDP Server port number. You may specify <tt>0</tt> (zero), to select "
    780                                               "port 3389, the standard port for RDP."));
    781     m_pLabelRemoteDisplayAuthMethod->setText(tr("Authentication &Method:"));
    782     m_pComboRemoteDisplayAuthMethod->setToolTip(tr("Selects the VRDP authentication method."));
    783     m_pLabelRemoteDisplayTimeout->setText(tr("Authentication &Timeout:"));
    784     m_pEditorRemoteDisplayTimeout->setToolTip(tr("Holds the timeout for guest authentication, in milliseconds."));
    785     m_pLabelRemoteDisplayOptions->setText(tr("Extended Features:"));
    786     m_pCheckboxMultipleConn->setToolTip(tr("When checked, multiple simultaneous connections to the VM are permitted."));
    787     m_pCheckboxMultipleConn->setText(tr("&Allow Multiple Connections"));
    788763    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabRemoteDisplay), tr("&Remote Display"));
    789764    m_pCheckboxRecording->setToolTip(tr("When checked, VirtualBox will record the virtual machine session as a video file."));
     
    816791    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabRecording), tr("Re&cording"));
    817792
    818     /* Translate Remote Display auth method combo: */
    819     AssertPtrReturnVoid(m_pComboRemoteDisplayAuthMethod);
    820     for (int iIndex = 0; iIndex < m_pComboRemoteDisplayAuthMethod->count(); ++iIndex)
    821     {
    822         const KAuthType enmType = m_pComboRemoteDisplayAuthMethod->currentData().value<KAuthType>();
    823         m_pComboRemoteDisplayAuthMethod->setItemText(iIndex, gpConverter->toString(enmType));
    824     }
    825 
    826793    /* Recording stuff: */
    827794    m_pSpinboxRecordingFrameRate->setSuffix(QString(" %1").arg(tr("fps")));
     
    878845    m_pTabWidget->setTabEnabled(1, oldDisplayData.m_fRemoteDisplayServerSupported);
    879846    m_pTabRemoteDisplay->setEnabled(isMachineInValidMode());
    880     m_pWidgetRemoteDisplaySettings->setEnabled(m_pCheckboxRemoteDisplay->isChecked());
    881     m_pLabelRemoteDisplayOptions->setEnabled(isMachineOffline() || isMachineSaved());
    882     m_pCheckboxMultipleConn->setEnabled(isMachineOffline() || isMachineSaved());
     847    m_pEditorVRDESettings->setVRDEOptionsAvailable(isMachineOffline() || isMachineSaved());
    883848
    884849    /* Polish 'Recording' availability: */
    885     m_pWidgetRecordingSettings->setEnabled(isMachineInValidMode());
     850    m_pTabRecording->setEnabled(isMachineInValidMode());
    886851    sltHandleRecordingCheckboxToggle();
    887852}
     
    10981063    {
    10991064        /* Prepare 'Remote Display' tab layout: */
    1100         QGridLayout *pLayoutRemoteDisplay = new QGridLayout(m_pTabRemoteDisplay);
     1065        QVBoxLayout *pLayoutRemoteDisplay = new QVBoxLayout(m_pTabRemoteDisplay);
    11011066        if (pLayoutRemoteDisplay)
    11021067        {
    1103             pLayoutRemoteDisplay->setRowStretch(2, 1);
    1104 
    1105             /* Prepare remote display check-box: */
    1106             m_pCheckboxRemoteDisplay = new QCheckBox(m_pTabRemoteDisplay);
    1107             if (m_pCheckboxRemoteDisplay)
    1108                 pLayoutRemoteDisplay->addWidget(m_pCheckboxRemoteDisplay, 0, 0, 1, 2);
    1109 
    1110             /* Prepare 20-px shifting spacer: */
    1111             QSpacerItem *pSpacerItem = new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Minimum);
    1112             if (pSpacerItem)
    1113                 pLayoutRemoteDisplay->addItem(pSpacerItem, 1, 0);
    1114 
    1115             /* Prepare remote display settings widget: */
    1116             m_pWidgetRemoteDisplaySettings = new QWidget(m_pTabRemoteDisplay);
    1117             if (m_pWidgetRemoteDisplaySettings)
    1118             {
    1119                 /* Prepare remote display settings widget layout: */
    1120                 QGridLayout *pLayoutRemoteDisplaySettings = new QGridLayout(m_pWidgetRemoteDisplaySettings);
    1121                 if (pLayoutRemoteDisplaySettings)
    1122                 {
    1123                     pLayoutRemoteDisplaySettings->setContentsMargins(0, 0, 0, 0);
    1124 
    1125                     /* Prepare remote display port label: */
    1126                     m_pLabelRemoteDisplayPort = new QLabel(m_pWidgetRemoteDisplaySettings);
    1127                     if (m_pLabelRemoteDisplayPort)
    1128                     {
    1129                         m_pLabelRemoteDisplayPort->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    1130                         pLayoutRemoteDisplaySettings->addWidget(m_pLabelRemoteDisplayPort, 0, 0);
    1131                     }
    1132                     /* Prepare remote display port editor: */
    1133                     m_pEditorRemoteDisplayPort = new QLineEdit(m_pWidgetRemoteDisplaySettings);
    1134                     if (m_pEditorRemoteDisplayPort)
    1135                     {
    1136                         if (m_pLabelRemoteDisplayPort)
    1137                             m_pLabelRemoteDisplayPort->setBuddy(m_pEditorRemoteDisplayPort);
    1138                         m_pEditorRemoteDisplayPort->setValidator(new QRegularExpressionValidator(
    1139                             QRegularExpression("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this));
    1140 
    1141                         pLayoutRemoteDisplaySettings->addWidget(m_pEditorRemoteDisplayPort, 0, 1);
    1142                     }
    1143 
    1144                     /* Prepare remote display auth method label: */
    1145                     m_pLabelRemoteDisplayAuthMethod = new QLabel(m_pWidgetRemoteDisplaySettings);
    1146                     if (m_pLabelRemoteDisplayAuthMethod)
    1147                     {
    1148                         m_pLabelRemoteDisplayAuthMethod->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    1149                         pLayoutRemoteDisplaySettings->addWidget(m_pLabelRemoteDisplayAuthMethod, 1, 0);
    1150                     }
    1151                     /* Prepare remote display auth method combo: */
    1152                     m_pComboRemoteDisplayAuthMethod = new QComboBox(m_pWidgetRemoteDisplaySettings);
    1153                     if (m_pComboRemoteDisplayAuthMethod)
    1154                     {
    1155                         if (m_pLabelRemoteDisplayAuthMethod)
    1156                             m_pLabelRemoteDisplayAuthMethod->setBuddy(m_pComboRemoteDisplayAuthMethod);
    1157                         m_pComboRemoteDisplayAuthMethod->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    1158 
    1159                         pLayoutRemoteDisplaySettings->addWidget(m_pComboRemoteDisplayAuthMethod, 1, 1);
    1160                     }
    1161 
    1162                     /* Prepare remote display timeout label: */
    1163                     m_pLabelRemoteDisplayTimeout = new QLabel(m_pWidgetRemoteDisplaySettings);
    1164                     if (m_pLabelRemoteDisplayTimeout)
    1165                     {
    1166                         m_pLabelRemoteDisplayTimeout->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    1167                         pLayoutRemoteDisplaySettings->addWidget(m_pLabelRemoteDisplayTimeout, 2, 0);
    1168                     }
    1169                     /* Prepare remote display timeout editor: */
    1170                     m_pEditorRemoteDisplayTimeout = new QLineEdit(m_pWidgetRemoteDisplaySettings);
    1171                     if (m_pEditorRemoteDisplayTimeout)
    1172                     {
    1173                         if (m_pLabelRemoteDisplayTimeout)
    1174                             m_pLabelRemoteDisplayTimeout->setBuddy(m_pEditorRemoteDisplayTimeout);
    1175                         m_pEditorRemoteDisplayTimeout->setValidator(new QIntValidator(this));
    1176 
    1177                         pLayoutRemoteDisplaySettings->addWidget(m_pEditorRemoteDisplayTimeout, 2, 1);
    1178                     }
    1179 
    1180                     /* Prepare remote display options label: */
    1181                     m_pLabelRemoteDisplayOptions = new QLabel(m_pWidgetRemoteDisplaySettings);
    1182                     if (m_pLabelRemoteDisplayOptions)
    1183                     {
    1184                         m_pLabelRemoteDisplayOptions->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    1185                         pLayoutRemoteDisplaySettings->addWidget(m_pLabelRemoteDisplayOptions, 3, 0);
    1186                     }
    1187                     /* Prepare remote display multiple connections check-box: */
    1188                     m_pCheckboxMultipleConn = new QCheckBox(m_pWidgetRemoteDisplaySettings);
    1189                     if (m_pCheckboxMultipleConn)
    1190                         pLayoutRemoteDisplaySettings->addWidget(m_pCheckboxMultipleConn, 3, 1);
    1191                 }
    1192 
    1193                 pLayoutRemoteDisplay->addWidget(m_pWidgetRemoteDisplaySettings, 1, 1);
    1194             }
     1068            /* Prepare remote display settings editor: */
     1069            m_pEditorVRDESettings = new UIVRDESettingsEditor(m_pTabRemoteDisplay);
     1070            if (m_pEditorVRDESettings)
     1071                pLayoutRemoteDisplay->addWidget(m_pEditorVRDESettings);
     1072
     1073            pLayoutRemoteDisplay->addStretch();
    11951074        }
    11961075
     
    15801459
    15811460    /* Configure 'Remote Display' connections: */
    1582     connect(m_pCheckboxRemoteDisplay, &QCheckBox::toggled, m_pWidgetRemoteDisplaySettings, &QWidget::setEnabled);
    1583     connect(m_pCheckboxRemoteDisplay, &QCheckBox::toggled, this, &UIMachineSettingsDisplay::revalidate);
    1584     connect(m_pEditorRemoteDisplayPort, &QLineEdit::textChanged, this, &UIMachineSettingsDisplay::revalidate);
    1585     connect(m_pEditorRemoteDisplayTimeout, &QLineEdit::textChanged, this, &UIMachineSettingsDisplay::revalidate);
     1461    connect(m_pEditorVRDESettings, &UIVRDESettingsEditor::sigChanged,
     1462            this, &UIMachineSettingsDisplay::revalidate);
    15861463
    15871464    /* Configure 'Recording' connections: */
     
    16111488    delete m_pCache;
    16121489    m_pCache = 0;
    1613 }
    1614 
    1615 void UIMachineSettingsDisplay::repopulateComboAuthType()
    1616 {
    1617     AssertPtrReturnVoid(m_pComboRemoteDisplayAuthMethod);
    1618     {
    1619         /* Clear combo first of all: */
    1620         m_pComboRemoteDisplayAuthMethod->clear();
    1621 
    1622         /// @todo get supported auth types, not hardcoded!
    1623         QVector<KAuthType> authTypes = QVector<KAuthType>() << KAuthType_Null
    1624                                                             << KAuthType_External
    1625                                                             << KAuthType_Guest;
    1626 
    1627         /* Take into account currently cached value: */
    1628         const KAuthType enmCachedValue = m_pCache->base().m_remoteDisplayAuthType;
    1629         if (!authTypes.contains(enmCachedValue))
    1630             authTypes.prepend(enmCachedValue);
    1631 
    1632         /* Populate combo finally: */
    1633         foreach (const KAuthType &enmType, authTypes)
    1634             m_pComboRemoteDisplayAuthMethod->addItem(gpConverter->toString(enmType), QVariant::fromValue(enmType));
    1635     }
    16361490}
    16371491
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r94362 r94378  
    3232class QComboBox;
    3333class QLabel;
    34 class QLineEdit;
    3534class QSpinBox;
    36 class QStackedLayout;
    3735class QIAdvancedSlider;
    3836class QITabWidget;
    39 class UIActionPool;
    40 struct UIDataSettingsMachineDisplay;
    4137class UIFilePathSelector;
    4238class UIFilmContainer;
     
    4844class UIScaleFactorEditor;
    4945class UIVideoMemoryEditor;
     46class UIVRDESettingsEditor;
     47struct UIDataSettingsMachineDisplay;
    5048typedef UISettingsCache<UIDataSettingsMachineDisplay> UISettingsCacheMachineDisplay;
    5149
     
    151149    /** Cleanups all. */
    152150    void cleanup();
    153 
    154     /** Repopulates auth type combo-box. */
    155     void repopulateComboAuthType();
    156151
    157152    /** Returns whether the VRAM requirements are important. */
     
    214209
    215210        /** Holds the 'Remote Display' tab instance. */
    216         QWidget   *m_pTabRemoteDisplay;
    217         /** Holds the remote display check-box instance. */
    218         QCheckBox *m_pCheckboxRemoteDisplay;
    219         /** Holds the remote display settings widget instance. */
    220         QWidget   *m_pWidgetRemoteDisplaySettings;
    221         /** Holds the remote display port label instance. */
    222         QLabel    *m_pLabelRemoteDisplayPort;
    223         /** Holds the remote display port editor instance. */
    224         QLineEdit *m_pEditorRemoteDisplayPort;
    225         /** Holds the remote display port auth method label instance. */
    226         QLabel    *m_pLabelRemoteDisplayAuthMethod;
    227         /** Holds the remote display port auth method combo instance. */
    228         QComboBox *m_pComboRemoteDisplayAuthMethod;
    229         /** Holds the remote display timeout label instance. */
    230         QLabel    *m_pLabelRemoteDisplayTimeout;
    231         /** Holds the remote display timeout editor instance. */
    232         QLineEdit *m_pEditorRemoteDisplayTimeout;
    233         /** Holds the remote display options label instance. */
    234         QLabel    *m_pLabelRemoteDisplayOptions;
    235         /** Holds the remote display multiple connection check-box instance. */
    236         QCheckBox *m_pCheckboxMultipleConn;
     211        QWidget              *m_pTabRemoteDisplay;
     212        /** Holds the VRDE settings editor instance. */
     213        UIVRDESettingsEditor *m_pEditorVRDESettings;
    237214
    238215        /** Holds the 'Recording' 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