VirtualBox

Changeset 87301 in vbox


Ignore:
Timestamp:
Jan 18, 2021 5:29:25 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515. Using UIToolBox instead of QToolBox

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

Legend:

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

    r87276 r87301  
    899899        src/widgets/UIStatusBarEditorWindow.h \
    900900        src/widgets/UISearchLineEdit.h \
     901        src/widgets/UIToolBox.h \
    901902        src/widgets/UIWarningPane.h \
    902903        src/wizards/UIWizard.h \
     
    10161017        src/widgets/UIFilmContainer.cpp \
    10171018        src/widgets/UIPortForwardingTable.cpp \
    1018         src/widgets/UIStatusBarEditorWindow.cpp
     1019        src/widgets/UIStatusBarEditorWindow.cpp \
     1020        src/widgets/UIToolBox.cpp
    10191021
    10201022ifdef VBOX_GUI_WITH_NETWORK_MANAGER
     
    14291431        src/widgets/UISpecialControls.cpp \
    14301432        src/widgets/UIStatusBarEditorWindow.cpp \
     1433        src/widgets/UIToolBox.cpp \
    14311434        src/widgets/UIWarningPane.cpp \
    14321435        src/wizards/UIWizard.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBox.cpp

    r87293 r87301  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIUserNamePasswordEditor class implementation.
     3 * VBox Qt GUI - UIToolBox class implementation.
    44 */
    55
     
    1717
    1818/* Qt includes: */
    19 #include <QGridLayout>
    2019#include <QLabel>
    2120#include <QStyle>
     
    2726#include "UICommon.h"
    2827#include "UIIconPool.h"
    29 #include "UIUserNamePasswordEditor.h"
     28#include "UIToolBox.h"
    3029#include "UIWizardNewVM.h"
    3130
    32 UIPasswordLineEdit::UIPasswordLineEdit(QWidget *pParent /*= 0 */)
    33     : QLineEdit(pParent)
    34     , m_pTextVisibilityButton(0)
     31class UITest : public QWidget
     32{
     33    Q_OBJECT;
     34public:
     35    UITest(QWidget *pParent = 0)
     36        :QWidget(pParent)
     37    {}
     38    ~UITest(){}
     39};
     40
     41/*********************************************************************************************************************************
     42*   UIToolTitleWidget definition.                                                                                    *
     43*********************************************************************************************************************************/
     44
     45class UIToolBoxTitleWidget : public QWidget
     46{
     47
     48    Q_OBJECT;
     49
     50signals:
     51
     52    void sigShowPageWidget();
     53
     54public:
     55
     56    UIToolBoxTitleWidget(QWidget *pParent = 0);
     57    void setText(const QString &strText);
     58
     59private:
     60
     61    void prepare();
     62    QHBoxLayout *m_pLayout;
     63    QLabel      *m_pTitleLabel;
     64};
     65
     66/*********************************************************************************************************************************
     67*   UIToolBoxPage definition.                                                                                    *
     68*********************************************************************************************************************************/
     69
     70class UIToolBoxPage : public QWidget
     71{
     72
     73    Q_OBJECT;
     74
     75signals:
     76
     77    void sigShowPageWidget();
     78
     79public:
     80
     81    UIToolBoxPage(QWidget *pParent = 0);
     82    void setTitle(const QString &strTitle);
     83    /* @p pWidget's ownership is transferred to the page. */
     84    void setWidget(QWidget *pWidget);
     85    void setTitleBackgroundColor(const QColor &color);
     86    void setPageWidgetVisible(bool fVisible);
     87    int index() const;
     88    void setIndex(int iIndex);
     89
     90protected:
     91
     92    virtual bool eventFilter(QObject *pWatched, QEvent *pEvent) /* override */;
     93
     94private:
     95
     96    void prepare();
     97    QVBoxLayout *m_pLayout;
     98    UIToolBoxTitleWidget      *m_pTitleWidget;
     99    QWidget     *m_pWidget;
     100    int          m_iIndex;
     101};
     102
     103/*********************************************************************************************************************************
     104*   UIToolTitleWidget implementation.                                                                                    *
     105*********************************************************************************************************************************/
     106
     107UIToolBoxTitleWidget::UIToolBoxTitleWidget(QWidget *pParent /* = 0 */)
     108    :QWidget(pParent)
    35109{
    36110    prepare();
    37111}
    38112
    39 void UIPasswordLineEdit::toggleTextVisibility(bool fTextVisible)
    40 {
    41     AssertPtrReturnVoid(m_pTextVisibilityButton);
    42 
    43     if (fTextVisible)
    44     {
    45         setEchoMode(QLineEdit::Normal);
    46         if (m_pTextVisibilityButton)
    47             m_pTextVisibilityButton->setIcon(UIIconPool::iconSet(":/eye_closed_10px.png"));
    48     }
    49     else
    50     {
    51         setEchoMode(QLineEdit::Password);
    52         if (m_pTextVisibilityButton)
    53             m_pTextVisibilityButton->setIcon(UIIconPool::iconSet(":/eye_10px.png"));
    54     }
    55 }
    56 
    57 void UIPasswordLineEdit::prepare()
    58 {
    59     /* Prepare text visibility button: */
    60     m_pTextVisibilityButton = new QIToolButton(this);
    61     if (m_pTextVisibilityButton)
    62     {
    63         m_pTextVisibilityButton->setIconSize(QSize(10, 10));
    64         m_pTextVisibilityButton->setFocusPolicy(Qt::ClickFocus);
    65         m_pTextVisibilityButton->setCursor(Qt::ArrowCursor);
    66         m_pTextVisibilityButton->show();
    67         connect(m_pTextVisibilityButton, &QToolButton::clicked, this, &UIPasswordLineEdit::sltHandleTextVisibilityChange);
    68     }
    69 
    70     toggleTextVisibility(false);
    71     adjustTextVisibilityButtonGeometry();
    72 }
    73 
    74 void UIPasswordLineEdit::adjustTextVisibilityButtonGeometry()
    75 {
    76     AssertPtrReturnVoid(m_pTextVisibilityButton);
    77 
    78 #ifdef VBOX_WS_MAC
    79     /* Do not forget to update QIToolButton size on macOS, it's FIXED: */
    80     m_pTextVisibilityButton->setFixedSize(m_pTextVisibilityButton->minimumSizeHint());
    81     /* Calculate suitable position for a QIToolButton, it's FRAMELESS: */
    82     const int iWidth = m_pTextVisibilityButton->width();
    83     const int iMinHeight = qMin(height(), m_pTextVisibilityButton->height());
    84     const int iMaxHeight = qMax(height(), m_pTextVisibilityButton->height());
    85     const int iHalfHeightDiff = (iMaxHeight - iMinHeight) / 2;
    86     m_pTextVisibilityButton->setGeometry(width() - iWidth - iHalfHeightDiff, iHalfHeightDiff, iWidth, iWidth);
    87 #else
    88     int iFrameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
    89     int iSize = height() - 2 * iFrameWidth;
    90     m_pTextVisibilityButton->setGeometry(width() - iSize, iFrameWidth, iSize, iSize);
    91 #endif
    92 }
    93 
    94 void UIPasswordLineEdit::resizeEvent(QResizeEvent *pEvent)
    95 {
    96     /* Call to base-class: */
    97     QLineEdit::resizeEvent(pEvent);
    98 
    99     adjustTextVisibilityButtonGeometry();
    100 }
    101 
    102 void UIPasswordLineEdit::sltHandleTextVisibilityChange()
    103 {
    104     bool fTextVisible = false;
    105     if (echoMode() == QLineEdit::Normal)
    106         fTextVisible = false;
    107     else
    108         fTextVisible = true;
    109     toggleTextVisibility(fTextVisible);
    110     emit sigTextVisibilityToggled(fTextVisible);
    111 }
    112 
    113 UIUserNamePasswordEditor::UIUserNamePasswordEditor(QWidget *pParent /*  = 0 */)
    114     : QIWithRetranslateUI<QWidget>(pParent)
    115     , m_pUserNameLineEdit(0)
    116     , m_pPasswordLineEdit(0)
    117     , m_pPasswordRepeatLineEdit(0)
    118     , m_pUserNameLabel(0)
    119     , m_pPasswordLabel(0)
    120     , m_pPasswordRepeatLabel(0)
    121     , m_fForceUnmark(false)
     113void UIToolBoxTitleWidget::setText(const QString &strText)
     114{
     115    if (m_pTitleLabel)
     116        m_pTitleLabel->setText(strText);
     117}
     118
     119void UIToolBoxTitleWidget::prepare()
     120{
     121    m_pLayout = new QHBoxLayout(this);
     122    m_pLayout->setContentsMargins(1.f * qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
     123                                  .4f * qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin),
     124                                  1.f * qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin),
     125                                  .4f * qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin));
     126
     127    m_pTitleLabel = new QLabel;
     128    m_pLayout->addWidget(m_pTitleLabel);
     129}
     130
     131/*********************************************************************************************************************************
     132*   UIToolBoxPage implementation.                                                                                    *
     133*********************************************************************************************************************************/
     134
     135UIToolBoxPage::UIToolBoxPage(QWidget *pParent /* = 0 */)
     136    :QWidget(pParent)
     137    , m_pLayout(0)
     138    , m_pTitleWidget(0)
     139    , m_pWidget(0)
     140    , m_iIndex(0)
     141
    122142{
    123143    prepare();
    124144}
    125145
    126 QString UIUserNamePasswordEditor::userName() const
    127 {
    128     if (m_pUserNameLineEdit)
    129         return m_pUserNameLineEdit->text();
    130     return QString();
    131 }
    132 
    133 void UIUserNamePasswordEditor::setUserName(const QString &strUserName)
    134 {
    135     if (m_pUserNameLineEdit)
    136         return m_pUserNameLineEdit->setText(strUserName);
    137 }
    138 
    139 QString UIUserNamePasswordEditor::password() const
    140 {
    141     if (m_pPasswordLineEdit)
    142         return m_pPasswordLineEdit->text();
    143     return QString();
    144 }
    145 
    146 void UIUserNamePasswordEditor::setPassword(const QString &strPassword)
    147 {
    148     if (m_pPasswordLineEdit)
    149         m_pPasswordLineEdit->setText(strPassword);
    150     if (m_pPasswordRepeatLineEdit)
    151         m_pPasswordRepeatLineEdit->setText(strPassword);
    152 }
    153 
    154 bool UIUserNamePasswordEditor::isUserNameComplete()
    155 {
    156     bool fComplete = (m_pUserNameLineEdit && !m_pUserNameLineEdit->text().isEmpty());
    157     markLineEdit(m_pUserNameLineEdit, !fComplete);
    158     return fComplete;
    159 }
    160 
    161 bool UIUserNamePasswordEditor::isPasswordComplete()
    162 {
    163     bool fPasswordOK = true;
    164     if (m_pPasswordLineEdit && m_pPasswordRepeatLineEdit)
    165     {
    166         if (m_pPasswordLineEdit->text() != m_pPasswordRepeatLineEdit->text())
    167             fPasswordOK = false;
    168         if (m_pPasswordLineEdit->text().isEmpty())
    169             fPasswordOK = false;
    170     }
    171     markLineEdit(m_pPasswordLineEdit, !fPasswordOK);
    172     markLineEdit(m_pPasswordRepeatLineEdit, !fPasswordOK);
    173     return fPasswordOK;
    174 }
    175 
    176 bool UIUserNamePasswordEditor::isComplete()
    177 {
    178     bool fUserNameField = isUserNameComplete();
    179     bool fPasswordField = isPasswordComplete();
    180     return fUserNameField && fPasswordField;
    181 }
    182 
    183 void UIUserNamePasswordEditor::setForceUnmark(bool fForceUnmark)
    184 {
    185     m_fForceUnmark = fForceUnmark;
    186     isUserNameComplete();
    187     isPasswordComplete();
    188 }
    189 
    190 void UIUserNamePasswordEditor::retranslateUi()
    191 {
    192     if (m_pUserNameLabel)
    193     {
    194         m_pUserNameLabel->setText(UIWizardNewVM::tr("User Name:"));
    195         m_pUserNameLabel->setToolTip(UIWizardNewVM::tr("Type the user name which will be used in attended install:"));
    196 
    197     }
    198     if (m_pPasswordLabel)
    199     {
    200         m_pPasswordLabel->setText(UIWizardNewVM::tr("Password:"));
    201         m_pPasswordLabel->setToolTip(UIWizardNewVM::tr("Type the password for the user name"));
    202 
    203     }
    204     if (m_pPasswordRepeatLabel)
    205     {
    206         m_pPasswordRepeatLabel->setText(UIWizardNewVM::tr("Repeat Password:"));
    207         m_pPasswordRepeatLabel->setToolTip(UIWizardNewVM::tr("Retype the password:"));
    208     }
    209 }
    210 
    211 template <class T>
    212 void UIUserNamePasswordEditor::addLineEdit(int &iRow, QLabel *&pLabel, T *&pLineEdit, QGridLayout *pLayout)
    213 {
    214     if (!pLayout || pLabel || pLineEdit)
    215         return;
    216     pLabel = new QLabel;
    217     if (!pLabel)
    218         return;
    219     pLabel->setAlignment(Qt::AlignRight);
    220     pLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
    221 
    222     pLayout->addWidget(pLabel, iRow, 0, 1, 1);
    223 
    224 
    225     pLineEdit = new T;
    226     if (!pLineEdit)
    227         return;
    228     pLayout->addWidget(pLineEdit, iRow, 1, 1, 3);
    229 
    230     pLabel->setBuddy(pLineEdit);
    231     ++iRow;
    232     connect(pLineEdit, &T::textChanged, this, &UIUserNamePasswordEditor::sltSomeTextChanged);
    233     return;
    234 }
    235 
    236 void UIUserNamePasswordEditor::markLineEdit(QLineEdit *pLineEdit, bool fError)
    237 {
    238     if (!pLineEdit)
    239         return;
    240     QPalette palette = pLineEdit->palette();
    241     if (!fError || m_fForceUnmark)
    242         palette.setColor(QPalette::Base, m_orginalLineEditBaseColor);
    243     else
    244         palette.setColor(QPalette::Base, QColor(255, 180, 180));
    245     pLineEdit->setPalette(palette);
    246 }
    247 
    248 void UIUserNamePasswordEditor::prepare()
    249 {
    250     QGridLayout *pMainLayout = new QGridLayout;
    251     pMainLayout->setContentsMargins(0, 0, 0, 0);
    252     if (!pMainLayout)
    253         return;
    254     setLayout(pMainLayout);
    255     int iRow = 0;
    256     addLineEdit<QLineEdit>(iRow, m_pUserNameLabel, m_pUserNameLineEdit, pMainLayout);
    257     addLineEdit<UIPasswordLineEdit>(iRow, m_pPasswordLabel, m_pPasswordLineEdit, pMainLayout);
    258     addLineEdit<UIPasswordLineEdit>(iRow, m_pPasswordRepeatLabel, m_pPasswordRepeatLineEdit, pMainLayout);
    259 
    260     connect(m_pPasswordLineEdit, &UIPasswordLineEdit::sigTextVisibilityToggled,
    261             this, &UIUserNamePasswordEditor::sltHandlePasswordVisibility);
    262     connect(m_pPasswordRepeatLineEdit, &UIPasswordLineEdit::sigTextVisibilityToggled,
    263             this, &UIUserNamePasswordEditor::sltHandlePasswordVisibility);
    264     /* Cache the original back color of the line edit to restore it correctly: */
    265     if (m_pUserNameLineEdit)
    266         m_orginalLineEditBaseColor = m_pUserNameLineEdit->palette().color(QPalette::Base);
     146void UIToolBoxPage::setTitle(const QString &strTitle)
     147{
     148    if (!m_pTitleWidget)
     149        return;
     150    m_pTitleWidget->setText(strTitle);
     151}
     152
     153void UIToolBoxPage::prepare()
     154{
     155    m_pLayout = new QVBoxLayout(this);
     156    m_pLayout->setContentsMargins(0, 0, 0, 0);
     157    m_pTitleWidget = new UIToolBoxTitleWidget;
     158    m_pTitleWidget->installEventFilter(this);
     159    m_pLayout->addWidget(m_pTitleWidget);
     160}
     161
     162void UIToolBoxPage::setWidget(QWidget *pWidget)
     163{
     164    if (!m_pLayout || !pWidget)
     165        return;
     166    m_pWidget = pWidget;
     167    m_pLayout->addWidget(m_pWidget);
     168    m_pWidget->hide();
     169}
     170
     171void UIToolBoxPage::setTitleBackgroundColor(const QColor &color)
     172{
     173    if (!m_pTitleWidget)
     174        return;
     175    QPalette palette = m_pTitleWidget->palette();
     176    palette.setColor(QPalette::Window, color);
     177    m_pTitleWidget->setPalette(palette);
     178    m_pTitleWidget->setAutoFillBackground(true);
     179}
     180
     181void UIToolBoxPage::setPageWidgetVisible(bool fVisible)
     182{
     183    if (m_pWidget)
     184        m_pWidget->setVisible(fVisible);
     185}
     186
     187int UIToolBoxPage::index() const
     188{
     189    return m_iIndex;
     190}
     191
     192void UIToolBoxPage::setIndex(int iIndex)
     193{
     194    m_iIndex = iIndex;
     195}
     196
     197bool UIToolBoxPage::eventFilter(QObject *pWatched, QEvent *pEvent)
     198{
     199    if (pWatched == m_pTitleWidget && pEvent->type() == QEvent::MouseButtonPress)
     200        emit sigShowPageWidget();
     201    return QWidget::eventFilter(pWatched, pEvent);
     202
     203}
     204
     205/*********************************************************************************************************************************
     206*   UIToolBox implementation.                                                                                    *
     207*********************************************************************************************************************************/
     208
     209UIToolBox::UIToolBox(QWidget *pParent /*  = 0 */)
     210    : QIWithRetranslateUI<QFrame>(pParent)
     211{
     212    prepare();
     213}
     214
     215bool UIToolBox::insertItem(int iIndex, QWidget *pWidget, const QString &strTitle)
     216{
     217    if (m_pages.contains(iIndex))
     218        return false;
     219    UIToolBoxPage *pNewPage = new UIToolBoxPage;
     220
     221    pNewPage->setWidget(pWidget);
     222    pNewPage->setIndex(iIndex);
     223    pNewPage->setTitle(strTitle);
     224
     225    const QPalette pal = palette();
     226    QColor tabBackgroundColor = pal.color(QPalette::Active, QPalette::Highlight).lighter(110);
     227    pNewPage->setTitleBackgroundColor(tabBackgroundColor);
     228
     229    m_pages[iIndex] = pNewPage;
     230    m_pMainLayout->insertWidget(iIndex, pNewPage);
     231
     232    connect(pNewPage, &UIToolBoxPage::sigShowPageWidget,
     233            this, &UIToolBox::sltHandleShowPageWidget);
     234
     235    return iIndex;
     236}
     237
     238void UIToolBox::setItemEnabled(int iIndex, bool fEnabled)
     239{
     240    Q_UNUSED(fEnabled);
     241    Q_UNUSED(iIndex);
     242}
     243
     244void UIToolBox::setItemText(int iIndex, const QString &strTitle)
     245{
     246    QMap<int, UIToolBoxPage*>::iterator iterator = m_pages.find(iIndex);
     247    if (iterator == m_pages.end())
     248        return;
     249    iterator.value()->setTitle(strTitle);
     250}
     251
     252void UIToolBox::setItemIcon(int iIndex, const QIcon &icon)
     253{
     254    Q_UNUSED(iIndex);
     255    Q_UNUSED(icon);
     256}
     257
     258void UIToolBox::setPageVisible(int iIndex)
     259{
     260    QMap<int, UIToolBoxPage*>::iterator iterator = m_pages.find(iIndex);
     261    if (iterator == m_pages.end())
     262        return;
     263    foreach(UIToolBoxPage *pPage, m_pages)
     264        pPage->setPageWidgetVisible(false);
     265
     266    iterator.value()->setPageWidgetVisible(true);
     267}
     268
     269void UIToolBox::retranslateUi()
     270{
     271}
     272
     273void UIToolBox::prepare()
     274{
     275    m_pMainLayout = new QVBoxLayout(this);
     276    //m_pMainLayout->setContentsMargins(0, 0, 0, 0);
    267277
    268278    retranslateUi();
    269279}
    270280
    271 void UIUserNamePasswordEditor::sltHandlePasswordVisibility(bool fPasswordVisible)
    272 {
    273     if (m_pPasswordLineEdit)
    274         m_pPasswordLineEdit->toggleTextVisibility(fPasswordVisible);
    275     if (m_pPasswordRepeatLineEdit)
    276         m_pPasswordRepeatLineEdit->toggleTextVisibility(fPasswordVisible);
    277 }
    278 
    279 void UIUserNamePasswordEditor::sltSomeTextChanged()
    280 {
    281     /* Check text lines edits and mark them accordingly: */
    282     isComplete();
    283     emit sigSomeTextChanged();
    284 }
     281void UIToolBox::sltHandleShowPageWidget()
     282{
     283    UIToolBoxPage *pPage = qobject_cast<UIToolBoxPage*>(sender());
     284    if (!pPage)
     285        return;
     286    setPageVisible(pPage->index());
     287}
     288
     289#include "UIToolBox.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBox.h

    r87293 r87301  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIUserNamePasswordEditor class declaration.
     3 * VBox Qt GUI - UIToolBox class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_widgets_UIUserNamePasswordEditor_h
    19 #define FEQT_INCLUDED_SRC_widgets_UIUserNamePasswordEditor_h
     18#ifndef FEQT_INCLUDED_SRC_widgets_UIToolBox_h
     19#define FEQT_INCLUDED_SRC_widgets_UIToolBox_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    2323
    2424/* Qt includes: */
    25 #include <QLineEdit>
    26 #include <QWidget>
     25#include <QFrame>
     26#include <QMap>
    2727
    2828/* Local includes: */
     
    3030
    3131/* Forward declarations: */
    32 class QGridLayout;
     32class QVBoxLayout;
    3333class QLabel;
    34 class QIToolButton;
     34class UIToolBoxPage;
    3535
    36 class UIPasswordLineEdit : public QLineEdit
    37 {
    38     Q_OBJECT;
    39 
    40 signals:
    41 
    42     void sigTextVisibilityToggled(bool fTextVisible);
    43 
    44 public:
    45 
    46     UIPasswordLineEdit(QWidget *pParent = 0);
    47     void toggleTextVisibility(bool fTextVisible);
    48 
    49 protected:
    50 
    51     virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
    52 
    53 private:
    54 
    55     void prepare();
    56     void adjustTextVisibilityButtonGeometry();
    57 
    58     QIToolButton *m_pTextVisibilityButton;
    59 
    60 private slots:
    61 
    62     void sltHandleTextVisibilityChange();
    63 };
    64 
    65 class UIUserNamePasswordEditor : public QIWithRetranslateUI<QWidget>
     36class  SHARED_LIBRARY_STUFF UIToolBox : public QIWithRetranslateUI<QFrame>
    6637{
    6738
     
    7041signals:
    7142
    72     /** this is emitted whenever the content of one of the line edits is changed. */
    73     void sigSomeTextChanged();
    7443
    7544public:
    7645
    77     UIUserNamePasswordEditor(QWidget *pParent = 0);
    78 
    79     QString userName() const;
    80     void setUserName(const QString &strUserName);
    81 
    82     QString password() const;
    83     void setPassword(const QString &strPassword);
    84 
    85     /** Returns false if username or password fields are empty, or password fields do not match. */
    86     bool isComplete();
    87     /** Sets m_fForceUnmark flag. see it for more info. */
    88     void setForceUnmark(bool fForceUnmark);
     46    UIToolBox(QWidget *pParent = 0);
     47    bool insertItem(int iIndex, QWidget *pWidget, const QString &strTitle);
     48    void setItemEnabled(int iIndex, bool fEnabled);
     49    void setItemText(int iIndex, const QString &strTitle);
     50    void setItemIcon(int iIndex, const QIcon &icon);
     51    void setPageVisible(int iIndex);
    8952
    9053protected:
     
    9457private slots:
    9558
    96     void sltHandlePasswordVisibility(bool fPasswordVisible);
    97     void sltSomeTextChanged();
     59    void sltHandleShowPageWidget();
    9860
    9961private:
    10062
    10163    void prepare();
    102     template <class T>
    103     void addLineEdit(int &iRow, QLabel *&pLabel, T *&pLineEdit, QGridLayout *pLayout);
    104     /** Changes @p pLineEdit's base color to indicate an error or reverts it to the original color. */
    105     void markLineEdit(QLineEdit *pLineEdit, bool fError);
    10664
    107     bool isUserNameComplete();
    108     bool isPasswordComplete();
    109 
    110     QLineEdit          *m_pUserNameLineEdit;
    111     UIPasswordLineEdit *m_pPasswordLineEdit;
    112     UIPasswordLineEdit *m_pPasswordRepeatLineEdit;
    113 
    114     QLabel *m_pUserNameLabel;
    115     QLabel *m_pPasswordLabel;
    116     QLabel *m_pPasswordRepeatLabel;
    117     QColor m_orginalLineEditBaseColor;
    118     /** When true line edits are not marked even if they have to be. */
    119     bool m_fForceUnmark;
     65    QVBoxLayout *m_pMainLayout;
     66    QMap<int, UIToolBoxPage*> m_pages;
    12067};
    12168
    122 #endif /* !FEQT_INCLUDED_SRC_widgets_UIUserNamePasswordEditor_h */
     69#endif /* !FEQT_INCLUDED_SRC_widgets_UIToolBox_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp

    r87294 r87301  
    2525#include <QSpacerItem>
    2626#include <QSpinBox>
    27 #include <QToolBox>
    2827#include <QVBoxLayout>
    2928
     
    3736#include "UIMedium.h"
    3837#include "UINameAndSystemEditor.h"
     38#include "UIToolBox.h"
    3939#include "UIUserNamePasswordEditor.h"
    4040#include "UIWizardNewVM.h"
     
    4949    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    5050    {
    51         m_pToolBox = new QToolBox;
     51        m_pToolBox = new UIToolBox;
    5252        m_pToolBox->insertItem(ExpertToolboxItems_NameAndOSType, createNameOSTypeWidgets(/* fIncreaseLeftIndent */ true,
    5353                                                                                         /* fCreateLabels */ false), "");
     
    5757        m_pToolBox->insertItem(ExpertToolboxItems_GAInstall, createGAInstallWidgets(/* fIncreaseLeftIndent */ true), "");
    5858        m_pToolBox->insertItem(ExpertToolboxItems_ProductKey, createProductKeyWidgets(/* fIncreaseLeftIndent */ true), "");
     59
     60        m_pToolBox->setPageVisible(ExpertToolboxItems_NameAndOSType);
    5961        pMainLayout->addWidget(m_pToolBox);
     62
    6063
    6164        pMainLayout->addStretch();
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h

    r87244 r87301  
    2828
    2929/* Forward declarations: */
    30 class QToolBox;
     30class UIToolBox;
    3131
    3232/** Expert page of the New Virtual Machine wizard. */
     
    111111    void markWidgets() const;
    112112
    113     QToolBox  *m_pToolBox;
     113    UIToolBox  *m_pToolBox;
    114114};
    115115
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