VirtualBox

Changeset 103094 in vbox for trunk


Ignore:
Timestamp:
Jan 26, 2024 5:09:05 PM (13 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161340
Message:

FE/Qt: UIWelcomePane: bugref:10513: Extending UIWelcomePane with some info regarding Experience mode; Adding one-time choice as well.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIWelcomePane.cpp

    r103093 r103094  
    2727
    2828/* Qt includes: */
     29#include <QButtonGroup>
    2930#include <QGridLayout>
    3031#include <QLabel>
     32#include <QPushButton>
    3133#include <QStyle>
    3234#include <QUrl>
     
    3739#include "UICommon.h"
    3840#include "UIDesktopWidgetWatchdog.h"
     41#include "UIExtraDataManager.h"
    3942#include "UIIconPool.h"
    4043#include "UIWelcomePane.h"
     
    4851    : QIWithRetranslateUI<QWidget>(pParent)
    4952    , m_pLabelGreetings(0)
     53    , m_pLabelMode(0)
    5054    , m_pLabelIcon(0)
    5155{
     
    8892                                      "for more information and latest news.</p>")
    8993                                      .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText)));
     94
     95    /* Translate experience mode stuff: */
     96    if (m_pLabelMode)
     97        m_pLabelMode->setText(tr("<h3>Please choose Experience Mode!</h3>"
     98                                 "By default, the VirtualBox GUI is hiding some options, tools and wizards. "
     99                                 "<p>The <b>Basic Mode</b> is intended for a users who are not interested in advanced "
     100                                 "functionality and prefer a simpler, cleaner interface.</p>"
     101                                 "<p>The <b>Expert Mode</b> is intended for experienced users who wish to utilize all "
     102                                 "VirtualBox functionality.</p>"
     103                                 "<p>You can choose whether you are a beginner or experienced user by selecting required "
     104                                 "option at the right. This choice can always be changed in Global Preferences or Machine "
     105                                 "Settings windows.</p>"));
     106    if (m_buttons.contains(false))
     107        m_buttons.value(false)->setText(tr("Basic Mode"));
     108    if (m_buttons.contains(true))
     109        m_buttons.value(true)->setText(tr("Expert Mode"));
    90110}
    91111
     
    93113{
    94114    uiCommon().openURL(urlLink.toString());
     115}
     116
     117void UIWelcomePane::sltHandleButtonClicked(QAbstractButton *pButton)
     118{
     119    /* Make sure one of buttons was really pressed: */
     120    AssertReturnVoid(m_buttons.contains(pButton));
     121
     122    /* Hide everything related to experience mode: */
     123    if (m_pLabelMode)
     124        m_pLabelMode->hide();
     125    if (m_buttons.contains(false))
     126        m_buttons.value(false)->hide();
     127    if (m_buttons.contains(true))
     128        m_buttons.value(true)->hide();
     129
     130    /* Check which button was pressed actually and save the value: */
     131    const bool fExpertMode = m_buttons.key(pButton, false);
     132    gEDataManager->setSettingsInExpertMode(fExpertMode);
    95133}
    96134
     
    115153        pMainLayout->setContentsMargins(iL, iT, iR, iB);
    116154        pMainLayout->setSpacing(iSpacing);
    117         pMainLayout->setRowStretch(1, 1);
     155        pMainLayout->setRowStretch(2, 1);
    118156
    119157        /* Prepare greetings label: */
     
    132170            m_pLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    133171            pMainLayout->addWidget(m_pLabelIcon, 0, 1);
     172        }
     173
     174        /* This block for the case if experienced mode is NOT defined yet: */
     175        if (gEDataManager->extraDataString(UIExtraDataDefs::GUI_Settings_ExpertMode).isNull())
     176        {
     177            /* Prepare experience mode label: */
     178            m_pLabelMode = new QIRichTextLabel(this);
     179            if (m_pLabelMode)
     180            {
     181                m_pLabelMode->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
     182                pMainLayout->addWidget(m_pLabelMode, 1, 0);
     183            }
     184
     185            /* Prepare button layout: */
     186            QVBoxLayout *pLayoutButton = new QVBoxLayout;
     187            if (pLayoutButton)
     188            {
     189                pLayoutButton->setSpacing(iSpacing / 2);
     190
     191                /* Prepare button group: */
     192                QButtonGroup *pButtonGroup = new QButtonGroup(this);
     193                if (pButtonGroup)
     194                {
     195                    /* Prepare Basic button ('false' means 'not Expert'): */
     196                    m_buttons[false] = new QPushButton(this);
     197                    QAbstractButton *pButtonBasic = m_buttons.value(false);
     198                    if (pButtonBasic)
     199                    {
     200                        pButtonGroup->addButton(pButtonBasic);
     201                        pLayoutButton->addWidget(pButtonBasic);
     202                    }
     203
     204                    /* Prepare Expert button ('true' means 'is Expert'): */
     205                    m_buttons[true] = new QPushButton(this);
     206                    QAbstractButton *pButtonExpert = m_buttons[true];
     207                    if (pButtonExpert)
     208                    {
     209                        pButtonGroup->addButton(pButtonExpert);
     210                        pLayoutButton->addWidget(pButtonExpert);
     211                    }
     212
     213                    connect(pButtonGroup, &QButtonGroup::buttonClicked,
     214                            this, &UIWelcomePane::sltHandleButtonClicked);
     215                }
     216
     217                pLayoutButton->addStretch();
     218                pMainLayout->addLayout(pLayoutButton, 1, 1);
     219            }
    134220        }
    135221    }
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIWelcomePane.h

    r103068 r103094  
    4040
    4141/* Forward declarations: */
     42class QAbstractButton;
    4243class QLabel;
    4344class QIRichTextLabel;
     
    6667    void sltHandleLinkActivated(const QUrl &urlLink);
    6768
     69    /** Handles @a pButton click. */
     70    void sltHandleButtonClicked(QAbstractButton *pButton);
     71
    6872private:
    6973
     
    8084
    8185    /** Holds the greetings label instance. */
    82     QIRichTextLabel *m_pLabelGreetings;
     86    QIRichTextLabel              *m_pLabelGreetings;
     87    /** Holds the mode label instance. */
     88    QIRichTextLabel              *m_pLabelMode;
     89    /** Holds a list of experience mode button instances. */
     90    QMap<bool, QAbstractButton*>  m_buttons;
    8391    /** Holds the icon label instance. */
    84     QLabel          *m_pLabelIcon;
     92    QLabel                       *m_pLabelIcon;
    8593};
    8694
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