VirtualBox

Changeset 84915 in vbox


Ignore:
Timestamp:
Jun 23, 2020 10:39:22 AM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515. Adding a tool button to toggle the visibility of password field.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc

    r84305 r84915  
    158158        <file alias="extension_pack_uninstall_disabled_16px.png">images/extension_pack_uninstall_disabled_16px.png</file>
    159159        <file alias="extension_pack_warning_16px.png">images/extension_pack_warning_16px.png</file>
     160        <file alias="eye-off.png">images/eye-off.png</file>
     161        <file alias="eye-on.png">images/eye-on.png</file>
    160162        <file alias="favorite_24px.png">images/favorite_24px.png</file>
    161163        <file alias="favorite_pressed_24px.png">images/favorite_pressed_24px.png</file>
     
    436438        <file alias="machine_details_manager_disabled_16px.png">images/machine_details_manager_disabled_16px.png</file>
    437439        <file alias="machine_details_manager_disabled_24px.png">images/machine_details_manager_disabled_24px.png</file>
    438         <file alias="machine_warning_16px.png">images/machine_warning_16px.png</file>
    439440    </qresource>
    440441</RCC>
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc

    r84309 r84915  
    11<RCC>
    22    <qresource suffix="/">
     3        <file alias="machine_warning_16px.png">images/machine_warning_16px.png</file>
    34        <file alias="media_manager_16px.png">images/media_manager_16px.png</file>
    45        <file alias="media_manager_24px.png">images/media_manager_24px.png</file>
     
    1415        <file alias="menubar_settings_disabled_16px.png">images/menubar_settings_disabled_16px.png</file>
    1516        <file alias="minimize_16px.png">images/minimize_16px.png</file>
     17        <file alias="monitor_glossy.png">images/monitor_glossy.png</file>
    1618        <file alias="monitor.png">images/monitor.png</file>
    17         <file alias="monitor_glossy.png">images/monitor_glossy.png</file>
    1819        <file alias="mouse_16px.png">images/mouse_16px.png</file>
    1920        <file alias="mouse_can_seamless_16px.png">images/mouse_can_seamless_16px.png</file>
     
    3738        <file alias="nw_write_16px.png">images/nw_write_16px.png</file>
    3839        <file alias="ok_16px.png">images/ok_16px.png</file>
     40        <file alias="os_archlinux_64.png">images/os_archlinux_64.png</file>
    3941        <file alias="os_archlinux.png">images/os_archlinux.png</file>
    40         <file alias="os_archlinux_64.png">images/os_archlinux_64.png</file>
    4142        <file alias="os_cloud.png">images/os_cloud.png</file>
     43        <file alias="os_debian_64.png">images/os_debian_64.png</file>
    4244        <file alias="os_debian.png">images/os_debian.png</file>
    43         <file alias="os_debian_64.png">images/os_debian_64.png</file>
    4445        <file alias="os_dos.png">images/os_dos.png</file>
     46        <file alias="os_fedora_64.png">images/os_fedora_64.png</file>
    4547        <file alias="os_fedora.png">images/os_fedora.png</file>
    46         <file alias="os_fedora_64.png">images/os_fedora_64.png</file>
     48        <file alias="os_freebsd_64.png">images/os_freebsd_64.png</file>
    4749        <file alias="os_freebsd.png">images/os_freebsd.png</file>
    48         <file alias="os_freebsd_64.png">images/os_freebsd_64.png</file>
     50        <file alias="os_gentoo_64.png">images/os_gentoo_64.png</file>
    4951        <file alias="os_gentoo.png">images/os_gentoo.png</file>
    50         <file alias="os_gentoo_64.png">images/os_gentoo_64.png</file>
    5152        <file alias="os_jrockitve.png">images/os_jrockitve.png</file>
    5253        <file alias="os_l4.png">images/os_l4.png</file>
     54        <file alias="os_linux22.png">images/os_linux22.png</file>
     55        <file alias="os_linux24_64.png">images/os_linux24_64.png</file>
     56        <file alias="os_linux24.png">images/os_linux24.png</file>
     57        <file alias="os_linux26_64.png">images/os_linux26_64.png</file>
     58        <file alias="os_linux26.png">images/os_linux26.png</file>
     59        <file alias="os_linux_64.png">images/os_linux_64.png</file>
    5360        <file alias="os_linux.png">images/os_linux.png</file>
    54         <file alias="os_linux22.png">images/os_linux22.png</file>
    55         <file alias="os_linux24.png">images/os_linux24.png</file>
    56         <file alias="os_linux24_64.png">images/os_linux24_64.png</file>
    57         <file alias="os_linux26.png">images/os_linux26.png</file>
    58         <file alias="os_linux26_64.png">images/os_linux26_64.png</file>
    59         <file alias="os_linux_64.png">images/os_linux_64.png</file>
     61        <file alias="os_macosx_64.png">images/os_macosx_64.png</file>
    6062        <file alias="os_macosx.png">images/os_macosx.png</file>
    61         <file alias="os_macosx_64.png">images/os_macosx_64.png</file>
     63        <file alias="os_mandriva_64.png">images/os_mandriva_64.png</file>
    6264        <file alias="os_mandriva.png">images/os_mandriva.png</file>
    63         <file alias="os_mandriva_64.png">images/os_mandriva_64.png</file>
     65        <file alias="os_netbsd_64.png">images/os_netbsd_64.png</file>
    6466        <file alias="os_netbsd.png">images/os_netbsd.png</file>
    65         <file alias="os_netbsd_64.png">images/os_netbsd_64.png</file>
    6667        <file alias="os_netware.png">images/os_netware.png</file>
     68        <file alias="os_openbsd_64.png">images/os_openbsd_64.png</file>
    6769        <file alias="os_openbsd.png">images/os_openbsd.png</file>
    68         <file alias="os_openbsd_64.png">images/os_openbsd_64.png</file>
     70        <file alias="os_opensuse_64.png">images/os_opensuse_64.png</file>
    6971        <file alias="os_opensuse.png">images/os_opensuse.png</file>
    70         <file alias="os_opensuse_64.png">images/os_opensuse_64.png</file>
     72        <file alias="os_oracle_64.png">images/os_oracle_64.png</file>
    7173        <file alias="os_oracle.png">images/os_oracle.png</file>
    72         <file alias="os_oracle_64.png">images/os_oracle_64.png</file>
     74        <file alias="os_oraclesolaris_64.png">images/os_oraclesolaris_64.png</file>
    7375        <file alias="os_oraclesolaris.png">images/os_oraclesolaris.png</file>
    74         <file alias="os_oraclesolaris_64.png">images/os_oraclesolaris_64.png</file>
     76        <file alias="os_os2ecs.png">images/os_os2ecs.png</file>
    7577        <file alias="os_os2_other.png">images/os_os2_other.png</file>
    76         <file alias="os_os2ecs.png">images/os_os2ecs.png</file>
    7778        <file alias="os_os2warp3.png">images/os_os2warp3.png</file>
     79        <file alias="os_os2warp45.png">images/os_os2warp45.png</file>
    7880        <file alias="os_os2warp4.png">images/os_os2warp4.png</file>
    79         <file alias="os_os2warp45.png">images/os_os2warp45.png</file>
     81        <file alias="os_other_64.png">images/os_other_64.png</file>
    8082        <file alias="os_other.png">images/os_other.png</file>
    81         <file alias="os_other_64.png">images/os_other_64.png</file>
    8283        <file alias="os_qnx.png">images/os_qnx.png</file>
     84        <file alias="os_redhat_64.png">images/os_redhat_64.png</file>
    8385        <file alias="os_redhat.png">images/os_redhat.png</file>
    84         <file alias="os_redhat_64.png">images/os_redhat_64.png</file>
     86        <file alias="os_solaris_64.png">images/os_solaris_64.png</file>
    8587        <file alias="os_solaris.png">images/os_solaris.png</file>
    86         <file alias="os_solaris_64.png">images/os_solaris_64.png</file>
     88        <file alias="os_turbolinux_64.png">images/os_turbolinux_64.png</file>
    8789        <file alias="os_turbolinux.png">images/os_turbolinux.png</file>
    88         <file alias="os_turbolinux_64.png">images/os_turbolinux_64.png</file>
     90        <file alias="os_ubuntu_64.png">images/os_ubuntu_64.png</file>
    8991        <file alias="os_ubuntu.png">images/os_ubuntu.png</file>
    90         <file alias="os_ubuntu_64.png">images/os_ubuntu_64.png</file>
     92        <file alias="os_win10_64.png">images/os_win10_64.png</file>
    9193        <file alias="os_win10.png">images/os_win10.png</file>
    92         <file alias="os_win10_64.png">images/os_win10_64.png</file>
    93         <file alias="os_win2k.png">images/os_win2k.png</file>
    9494        <file alias="os_win2k12_64.png">images/os_win2k12_64.png</file>
    9595        <file alias="os_win2k16_64.png">images/os_win2k16_64.png</file>
    9696        <file alias="os_win2k19_64.png">images/os_win2k19_64.png</file>
     97        <file alias="os_win2k3_64.png">images/os_win2k3_64.png</file>
    9798        <file alias="os_win2k3.png">images/os_win2k3.png</file>
    98         <file alias="os_win2k3_64.png">images/os_win2k3_64.png</file>
     99        <file alias="os_win2k8_64.png">images/os_win2k8_64.png</file>
    99100        <file alias="os_win2k8.png">images/os_win2k8.png</file>
    100         <file alias="os_win2k8_64.png">images/os_win2k8_64.png</file>
     101        <file alias="os_win2k.png">images/os_win2k.png</file>
    101102        <file alias="os_win31.png">images/os_win31.png</file>
     103        <file alias="os_win7_64.png">images/os_win7_64.png</file>
    102104        <file alias="os_win7.png">images/os_win7.png</file>
    103         <file alias="os_win7_64.png">images/os_win7_64.png</file>
     105        <file alias="os_win81_64.png">images/os_win81_64.png</file>
     106        <file alias="os_win81.png">images/os_win81.png</file>
     107        <file alias="os_win8_64.png">images/os_win8_64.png</file>
    104108        <file alias="os_win8.png">images/os_win8.png</file>
    105         <file alias="os_win81.png">images/os_win81.png</file>
    106         <file alias="os_win81_64.png">images/os_win81_64.png</file>
    107         <file alias="os_win8_64.png">images/os_win8_64.png</file>
    108109        <file alias="os_win95.png">images/os_win95.png</file>
    109110        <file alias="os_win98.png">images/os_win98.png</file>
    110         <file alias="os_win_other.png">images/os_win_other.png</file>
    111         <file alias="os_win_other_64.png">images/os_win_other_64.png</file>
    112111        <file alias="os_winme.png">images/os_winme.png</file>
    113112        <file alias="os_winnt4.png">images/os_winnt4.png</file>
     113        <file alias="os_win_other_64.png">images/os_win_other_64.png</file>
     114        <file alias="os_win_other.png">images/os_win_other.png</file>
     115        <file alias="os_winvista_64.png">images/os_winvista_64.png</file>
    114116        <file alias="os_winvista.png">images/os_winvista.png</file>
    115         <file alias="os_winvista_64.png">images/os_winvista_64.png</file>
     117        <file alias="os_winxp_64.png">images/os_winxp_64.png</file>
    116118        <file alias="os_winxp.png">images/os_winxp.png</file>
    117         <file alias="os_winxp_64.png">images/os_winxp_64.png</file>
     119        <file alias="os_xandros_64.png">images/os_xandros_64.png</file>
    118120        <file alias="os_xandros.png">images/os_xandros.png</file>
    119         <file alias="os_xandros_64.png">images/os_xandros_64.png</file>
    120121        <file alias="pcie_16px.png">images/pcie_16px.png</file>
    121122        <file alias="pcie_add_16px.png">images/pcie_add_16px.png</file>
     
    294295        <file alias="state_saving_16px.png">images/state_saving_16px.png</file>
    295296        <file alias="state_stuck_16px.png">images/state_stuck_16px.png</file>
    296         <file alias="status_check_16px.png">images/status_check_16px.png</file>
    297         <file alias="status_error_16px.png">images/status_error_16px.png</file>
    298297        <file alias="statusbar_16px.png">images/statusbar_16px.png</file>
    299298        <file alias="statusbar_disabled_16px.png">images/statusbar_disabled_16px.png</file>
     
    302301        <file alias="statusbar_settings_16px.png">images/statusbar_settings_16px.png</file>
    303302        <file alias="statusbar_settings_disabled_16px.png">images/statusbar_settings_disabled_16px.png</file>
     303        <file alias="status_check_16px.png">images/status_check_16px.png</file>
     304        <file alias="status_error_16px.png">images/status_error_16px.png</file>
    304305        <file alias="subnet_16px.png">images/subnet_16px.png</file>
    305306        <file alias="system_type_16px.png">images/system_type_16px.png</file>
     
    423424        <file alias="welcome_200px.png">images/welcome_200px.png</file>
    424425        <file alias="welcome_screen_24px.png">images/welcome_screen_24px.png</file>
     426        <file alias="wizard_clone_bg.png">images/wizard_clone_bg.png</file>
    425427        <file alias="wizard_clone.png">images/wizard_clone.png</file>
    426         <file alias="wizard_clone_bg.png">images/wizard_clone_bg.png</file>
     428        <file alias="wizard_first_run_bg.png">images/wizard_first_run_bg.png</file>
    427429        <file alias="wizard_first_run.png">images/wizard_first_run.png</file>
    428         <file alias="wizard_first_run_bg.png">images/wizard_first_run_bg.png</file>
     430        <file alias="wizard_new_cloud_vm_bg.png">images/wizard_new_cloud_vm_bg.png</file>
    429431        <file alias="wizard_new_cloud_vm.png">images/wizard_new_cloud_vm.png</file>
    430         <file alias="wizard_new_cloud_vm_bg.png">images/wizard_new_cloud_vm_bg.png</file>
     432        <file alias="wizard_new_harddisk_bg.png">images/wizard_new_harddisk_bg.png</file>
    431433        <file alias="wizard_new_harddisk.png">images/wizard_new_harddisk.png</file>
    432         <file alias="wizard_new_harddisk_bg.png">images/wizard_new_harddisk_bg.png</file>
     434        <file alias="wizard_new_welcome_bg.png">images/wizard_new_welcome_bg.png</file>
    433435        <file alias="wizard_new_welcome.png">images/wizard_new_welcome.png</file>
    434         <file alias="wizard_new_welcome_bg.png">images/wizard_new_welcome_bg.png</file>
     436        <file alias="wizard_ovf_export_bg.png">images/wizard_ovf_export_bg.png</file>
    435437        <file alias="wizard_ovf_export.png">images/wizard_ovf_export.png</file>
    436         <file alias="wizard_ovf_export_bg.png">images/wizard_ovf_export_bg.png</file>
     438        <file alias="wizard_ovf_import_bg.png">images/wizard_ovf_import_bg.png</file>
    437439        <file alias="wizard_ovf_import.png">images/wizard_ovf_import.png</file>
    438         <file alias="wizard_ovf_import_bg.png">images/wizard_ovf_import_bg.png</file>
    439440    </qresource>
    440441</RCC>
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r84906 r84915  
    382382}
    383383
    384 // int UIWizardNewVM::nextId() const
    385 // {
    386 //     switch (currentId())
    387 //     {
    388 //         case PageUnattended:
    389 //             return PageNameType;
    390 //             break;
    391 //         case PageNameType:
    392 //             if (!isUnattendedInstallEnabled())
    393 //                 return PageHardware;
    394 //             else
    395 //                 return PageInstallSetup;
    396 //             break;
    397 //         case PageInstallSetup:
    398 //                 return PageHardware;
    399 //         case PageHardware:
    400 //             return PageDisk;
    401 //             break;
    402 //         case PageDisk:
    403 //             return UIWizard::nextId();
    404 //         case PageMax:
    405 //         default:
    406 //             return PageUnattended;
    407 //             break;
    408 //     }
    409 //     return UIWizard::nextId();
    410 // }
    411 
    412384void UIWizardNewVM::sltHandleWizardCancel()
    413385{
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h

    r84892 r84915  
    8585    /* Attaches default devices: */
    8686    bool attachDefaultDevices(const CGuestOSType &comGuestType);
    87     //virtual int nextId() const /* override */;
    8887
    8988    /* Who will be able to create virtual-machine: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicInstallSetup.cpp

    r84906 r84915  
    2222#include <QSpacerItem>
    2323#include <QLabel>
    24 #include <QLineEdit>
    2524#include <QSpinBox>
     25#include <QStyle>
     26#include <QToolButton>
    2627
    2728/* GUI includes: */
     
    3031#include "UIBaseMemorySlider.h"
    3132#include "UICommon.h"
     33#include "UIIconPool.h"
    3234#include "UIVirtualCPUEditor.h"
    3335#include "UIWizardNewVMPageBasicInstallSetup.h"
    3436#include "UIWizardNewVM.h"
    3537
     38UIPasswordLineEdit::UIPasswordLineEdit(QWidget *pParent /*= 0 */)
     39    :QLineEdit(pParent)
     40    , m_pTextVisibilityButton(0)
     41{
     42    prepare();
     43}
     44
     45void UIPasswordLineEdit::toggleTextVisibility(bool fTextVisible)
     46{
     47    if (fTextVisible)
     48    {
     49        setEchoMode(QLineEdit::Normal);
     50        if(m_pTextVisibilityButton)
     51            m_pTextVisibilityButton->setIcon(UIIconPool::iconSet(":/eye-off.png"));
     52        return;
     53    }
     54    setEchoMode(QLineEdit::Password);
     55    if(m_pTextVisibilityButton)
     56        m_pTextVisibilityButton->setIcon(UIIconPool::iconSet(":/eye-on.png"));
     57}
     58
     59void UIPasswordLineEdit::prepare()
     60{
     61    m_pTextVisibilityButton = new QToolButton(this);
     62    m_pTextVisibilityButton->setAutoRaise(true);
     63    m_pTextVisibilityButton->setCursor(Qt::ArrowCursor);
     64    m_pTextVisibilityButton->show();
     65    connect(m_pTextVisibilityButton, &QToolButton::clicked, this, &UIPasswordLineEdit::sltHandleTextVisibilityChange);
     66    toggleTextVisibility(false);
     67}
     68
     69void UIPasswordLineEdit::paintEvent(QPaintEvent *pevent)
     70{
     71    QLineEdit::paintEvent(pevent);
     72    int iFrameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
     73    int iSize = height() - 2 * iFrameWidth;
     74    m_pTextVisibilityButton->setGeometry(width() - iSize, iFrameWidth, iSize, iSize);
     75
     76}
     77
     78void UIPasswordLineEdit::sltHandleTextVisibilityChange()
     79{
     80    bool fTextVisible = false;
     81    if (echoMode() == QLineEdit::Normal)
     82        fTextVisible = false;
     83    else
     84        fTextVisible = true;
     85    toggleTextVisibility(fTextVisible);
     86    emit sigTextVisibilityToggled(fTextVisible);
     87}
    3688
    3789UIUserNamePasswordEditor::UIUserNamePasswordEditor(QWidget *pParent /*  = 0 */)
    3890    : QIWithRetranslateUI<QWidget>(pParent)
    39     , m_pUserNameField(0)
    40     , m_pPasswordField(0)
    41     , m_pPasswordRepeatField(0)
    42     , m_pUserNameFieldLabel(0)
    43     , m_pPasswordFieldLabel(0)
    44     , m_pPasswordRepeatFieldLabel(0)
     91    , m_pUserNameLineEdit(0)
     92    , m_pPasswordLineEdit(0)
     93    , m_pPasswordRepeatLineEdit(0)
     94    , m_pUserNameLabel(0)
     95    , m_pPasswordLabel(0)
     96    , m_pPasswordRepeatLabel(0)
    4597{
    4698    prepare();
     
    49101QString UIUserNamePasswordEditor::userName() const
    50102{
    51     if (m_pUserNameField)
    52         return m_pUserNameField->text();
     103    if (m_pUserNameLineEdit)
     104        return m_pUserNameLineEdit->text();
    53105    return QString();
    54106}
     
    56108void UIUserNamePasswordEditor::setUserName(const QString &strUserName)
    57109{
    58     if (m_pUserNameField)
    59         return m_pUserNameField->setText(strUserName);
     110    if (m_pUserNameLineEdit)
     111        return m_pUserNameLineEdit->setText(strUserName);
    60112}
    61113
    62114QString UIUserNamePasswordEditor::password() const
    63115{
    64     if (m_pPasswordField)
    65         return m_pPasswordField->text();
     116    if (m_pPasswordLineEdit)
     117        return m_pPasswordLineEdit->text();
    66118    return QString();
    67119}
     
    69121void UIUserNamePasswordEditor::setPassword(const QString &strPassword)
    70122{
    71     if (m_pPasswordField)
    72         m_pPasswordField->setText(strPassword);
    73     if (m_pPasswordRepeatField)
    74         m_pPasswordRepeatField->setText(strPassword);
     123    if (m_pPasswordLineEdit)
     124        m_pPasswordLineEdit->setText(strPassword);
     125    if (m_pPasswordRepeatLineEdit)
     126        m_pPasswordRepeatLineEdit->setText(strPassword);
    75127}
    76128
    77129void UIUserNamePasswordEditor::retranslateUi()
    78130{
    79     if (m_pUserNameFieldLabel)
    80     {
    81         m_pUserNameFieldLabel->setText(UIWizardNewVM::tr("User Name:"));
    82         m_pUserNameFieldLabel->setToolTip(UIWizardNewVM::tr("Type the user name which will be used in attended install:"));
    83 
    84     }
    85     if (m_pPasswordFieldLabel)
    86     {
    87         m_pPasswordFieldLabel->setText(UIWizardNewVM::tr("Password:"));
    88         m_pPasswordFieldLabel->setToolTip(UIWizardNewVM::tr("Type the password for the user name"));
    89 
    90     }
    91     if (m_pPasswordRepeatFieldLabel)
    92     {
    93         m_pPasswordRepeatFieldLabel->setText(UIWizardNewVM::tr("Repeat Password:"));
    94         m_pPasswordRepeatFieldLabel->setToolTip(UIWizardNewVM::tr("Retype the password:"));
    95     }
    96 }
    97 
    98 void UIUserNamePasswordEditor::addLineEdit(QLabel *&pLabel, QLineEdit *&pLineEdit, QGridLayout *pLayout, bool fIsPasswordField /* = false */)
    99 {
    100     static int iRow = 0;
     131    if (m_pUserNameLabel)
     132    {
     133        m_pUserNameLabel->setText(UIWizardNewVM::tr("User Name:"));
     134        m_pUserNameLabel->setToolTip(UIWizardNewVM::tr("Type the user name which will be used in attended install:"));
     135
     136    }
     137    if (m_pPasswordLabel)
     138    {
     139        m_pPasswordLabel->setText(UIWizardNewVM::tr("Password:"));
     140        m_pPasswordLabel->setToolTip(UIWizardNewVM::tr("Type the password for the user name"));
     141
     142    }
     143    if (m_pPasswordRepeatLabel)
     144    {
     145        m_pPasswordRepeatLabel->setText(UIWizardNewVM::tr("Repeat Password:"));
     146        m_pPasswordRepeatLabel->setToolTip(UIWizardNewVM::tr("Retype the password:"));
     147    }
     148}
     149
     150template <class T>
     151void UIUserNamePasswordEditor::addLineEdit(int &iRow, QLabel *&pLabel, T *&pLineEdit, QGridLayout *pLayout)
     152{
    101153    if (!pLayout || pLabel || pLineEdit)
    102154        return;
     
    106158    pLayout->addWidget(pLabel, iRow, 0, 1, 1, Qt::AlignRight);
    107159
    108     pLineEdit = new QLineEdit;
     160    pLineEdit = new T;
    109161    if (!pLineEdit)
    110162        return;
     
    112164
    113165    pLabel->setBuddy(pLineEdit);
    114     if (fIsPasswordField)
    115         pLineEdit->setEchoMode(QLineEdit::Password);
    116166    ++iRow;
    117167    return;
     
    124174        return;
    125175    setLayout(pMainLayout);
    126 
    127     addLineEdit(m_pUserNameFieldLabel, m_pUserNameField, pMainLayout);
    128     addLineEdit(m_pPasswordFieldLabel, m_pPasswordField, pMainLayout, true);
    129     addLineEdit(m_pPasswordRepeatFieldLabel, m_pPasswordRepeatField, pMainLayout, true);
     176    int iRow = 0;
     177    addLineEdit<QLineEdit>(iRow, m_pUserNameLabel, m_pUserNameLineEdit, pMainLayout);
     178    addLineEdit<UIPasswordLineEdit>(iRow, m_pPasswordLabel, m_pPasswordLineEdit, pMainLayout);
     179    addLineEdit<UIPasswordLineEdit>(iRow, m_pPasswordRepeatLabel, m_pPasswordRepeatLineEdit, pMainLayout);
     180
     181    connect(m_pPasswordLineEdit, &UIPasswordLineEdit::sigTextVisibilityToggled,
     182            this, &UIUserNamePasswordEditor::sltHandlePasswordVisibility);
     183    connect(m_pPasswordRepeatLineEdit, &UIPasswordLineEdit::sigTextVisibilityToggled,
     184            this, &UIUserNamePasswordEditor::sltHandlePasswordVisibility);
    130185
    131186    retranslateUi();
     187}
     188
     189void UIUserNamePasswordEditor::sltHandlePasswordVisibility(bool fPasswordVisible)
     190{
     191    if (m_pPasswordLineEdit)
     192        m_pPasswordLineEdit->toggleTextVisibility(fPasswordVisible);
     193    if (m_pPasswordRepeatLineEdit)
     194        m_pPasswordRepeatLineEdit->toggleTextVisibility(fPasswordVisible);
    132195}
    133196
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicInstallSetup.h

    r84906 r84915  
    2323
    2424/* Qt includes: */
     25#include <QLineEdit>
    2526#include <QWidget>
    2627
     
    3233class QGridLayout;
    3334class QLabel;
    34 class QLineEdit;
    3535class QSpinBox;
    3636class QIRichTextLabel;
    3737struct UIUnattendedInstallData;
     38
     39class UIPasswordLineEdit : public QLineEdit
     40{
     41    Q_OBJECT;
     42
     43signals:
     44
     45    void sigTextVisibilityToggled(bool fTextVisible);
     46
     47public:
     48
     49    UIPasswordLineEdit(QWidget *pParent = 0);
     50    void toggleTextVisibility(bool fTextVisible);
     51
     52protected:
     53
     54    virtual void paintEvent(QPaintEvent *pevent) /* override */;
     55
     56private:
     57
     58    void prepare();
     59
     60    QToolButton *m_pTextVisibilityButton;
     61
     62private slots:
     63
     64    void sltHandleTextVisibilityChange();
     65};
    3866
    3967class UIUserNamePasswordEditor : public QIWithRetranslateUI<QWidget>
     
    5987
    6088    void prepare();
    61     void addLineEdit(QLabel *&pLabel, QLineEdit *&pLineEdit, QGridLayout *pLayout, bool fIsPasswordField = false);
     89    template <class T>
     90    void addLineEdit(int &iRow, QLabel *&pLabel, T *&pLineEdit, QGridLayout *pLayout);
    6291
    63     QLineEdit *m_pUserNameField;
    64     QLineEdit *m_pPasswordField;
    65     QLineEdit *m_pPasswordRepeatField;
     92    QLineEdit          *m_pUserNameLineEdit;
     93    UIPasswordLineEdit *m_pPasswordLineEdit;
     94    UIPasswordLineEdit *m_pPasswordRepeatLineEdit;
    6695
    67     QLabel *m_pUserNameFieldLabel;
    68     QLabel *m_pPasswordFieldLabel;
    69     QLabel *m_pPasswordRepeatFieldLabel;
     96    QLabel *m_pUserNameLabel;
     97    QLabel *m_pPasswordLabel;
     98    QLabel *m_pPasswordRepeatLabel;
    7099
     100private slots:
     101
     102    void sltHandlePasswordVisibility(bool fPasswordVisible);
    71103};
    72104
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicNameType.cpp

    r84890 r84915  
    347347int UIWizardNewVMPageBasicNameType::nextId() const
    348348{
    349     UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
    350     if (!pWizard || !pWizard->isUnattendedInstallEnabled())
    351         return UIWizardNewVM::PageHardware;
     349    // UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     350    // if (!pWizard || !pWizard->isUnattendedInstallEnabled())
     351    //     return UIWizardNewVM::PageHardware;
    352352    return UIWizardNewVM::PageInstallSetup;
    353353}
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