VirtualBox

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


Ignore:
Timestamp:
Nov 18, 2020 10:41:44 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141387
Message:

FE/Qt: bugref:9831. Working on context sensitive help of machine settings dialog

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp

    r86233 r86907  
    118118{
    119119    const int iIndex = m_pages.value(cId);
    120 
     120    setHelpButtonHelpTag(iIndex);
    121121#ifdef VBOX_WS_MAC
    122122    /* If index is within the stored size list bounds: */
     
    426426}
    427427
     428void UISettingsDialog::enableHelpButton()
     429{
     430    if (m_pButtonBox)
     431    {
     432        QPushButton *pHelpButton = m_pButtonBox->addButton(QDialogButtonBox::Help);
     433        if (pHelpButton)
     434            connect(pHelpButton, &QAbstractButton::pressed,
     435                    &(msgCenter()), &UIMessageCenter::sltHandleDialogHelpButtonPress);
     436    }
     437}
     438
     439void UISettingsDialog::setHelpButtonHelpTag(int iPageType)
     440{
     441    if (m_pButtonBox && m_pButtonBox->button(QDialogButtonBox::Help))
     442        m_pButtonBox->button(QDialogButtonBox::Help)->setProperty("helptag", m_pageHelpTags[iPageType]);
     443}
     444
     445void UISettingsDialog::addPageHelpTag(int iPageType, const QString &strHelpTag)
     446{
     447    m_pageHelpTags[iPageType] = strHelpTag;
     448}
     449
    428450void UISettingsDialog::revalidate(UIPageValidator *pValidator)
    429451{
     
    667689    {
    668690        m_pButtonBox->button(QDialogButtonBox::Ok)->setDefault(true);
    669         connect(m_pButtonBox, &QIDialogButtonBox::helpRequested,
    670                 &msgCenter(), &UIMessageCenter::sltShowHelpHelpDialog);
    671691
    672692        /* Create status-bar: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h

    r86081 r86907  
    136136    virtual void recorrelate(UISettingsPage *pSettingsPage) { Q_UNUSED(pSettingsPage); }
    137137
     138    /** Inserts the standard help button to the button box of the dialog and make a connection to the appropirate slot. */
     139    void enableHelpButton();
     140    /** Set/change/reset the help tag of the help buttons help tag. Possibly used as tabs are changed. Searches the map
     141     * m_pageHelpTags for the help tag for the page with @iPageType (GlobalSettingsPageType or MachineSettingsPageType) */
     142    void setHelpButtonHelpTag(int iPageType);
     143    /** Inserts an item to the map m_pageHelpTags. */
     144    void addPageHelpTag(int iPageType, const QString &strHelpTag);
     145
    138146    /** Validates data correctness using certain @a pValidator. */
    139147    void revalidate(UIPageValidator *pValidator);
     
    203211    /** Holds the map of settings pages. */
    204212    QMap<int, int>  m_pages;
     213    /** Stores the help tag per page. Key is the page type (either GlobalSettingsPageType or MachineSettingsPageType)
     214      * and value is the help tag. Used in context sensitive help: */
     215    QMap<int, QString> m_pageHelpTags;
    205216
    206217#ifdef VBOX_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r85711 r86907  
    703703                    addItem(":/machine_32px.png", ":/machine_24px.png", ":/machine_16px.png",
    704704                            iPageIndex, "#general", pSettingsPage);
     705                    addPageHelpTag(iPageIndex, "generalsettings");
    705706                    break;
    706707                }
     
    711712                    addItem(":/chipset_32px.png", ":/chipset_24px.png", ":/chipset_16px.png",
    712713                            iPageIndex, "#system", pSettingsPage);
     714                    addPageHelpTag(iPageIndex, "settings-system");
    713715                    break;
    714716                }
     
    831833    else
    832834        m_pSelector->selectById(MachineSettingsPageType_General);
     835
     836    /* Enabled the 'Help' button of the button box for the context senstive help: */
     837    enableHelpButton();
    833838}
    834839
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.cpp

    r86906 r86907  
    5151    /* Make sure custom buttons shown even if final page is first to show: */
    5252    sltCurrentIdChanged(startId());
    53 
    54     /* If help button is enabled by the subclass, connect it to proper slot: */
    55     if (button(QWizard::HelpButton))
    56         connect(button(QWizard::HelpButton), &QAbstractButton::pressed,
    57                 &(msgCenter()), &UIMessageCenter::sltHandleDialogHelpButtonPress);
    5853}
    5954
     
    273268#endif
    274269
     270void UIWizard::enableHelpButton(const QString &strHelpTag /* = QString() */)
     271{
     272    setOptions(options() | QWizard::HaveHelpButton);
     273    if (button(QWizard::HelpButton))
     274    {
     275        button(QWizard::HelpButton)->setProperty("helptag", strHelpTag);
     276        connect(button(QWizard::HelpButton), &QAbstractButton::pressed,
     277                &(msgCenter()), &UIMessageCenter::sltHandleDialogHelpButtonPress);
     278    }
     279}
     280
     281void UIWizard::setHelpButtonHelpTag(const QString &strHelpTag /* = QString() */)
     282{
     283    if (button(QWizard::HelpButton))
     284        button(QWizard::HelpButton)->setProperty("helptag", strHelpTag);
     285}
     286
    275287void UIWizard::sltCurrentIdChanged(int iId)
    276288{
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.h

    r82968 r86907  
    7878    void assignBackground(const QString &strBackground);
    7979#endif
     80    /** Inserts the standard help button to the button box of the wizard. Optional @param strHelpTag
     81      * is set as property. This is used for context sensitive help. */
     82    void enableHelpButton(const QString &strHelpTag = QString());
     83    void setHelpButtonHelpTag(const QString &strHelpTag = QString());
    8084
    8185protected slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r86906 r86907  
    5757    , m_iUSBCount(0)
    5858{
    59     setOptions(options() | QWizard::HaveHelpButton);
    60     if (button(QWizard::HelpButton))
    61         button(QWizard::HelpButton)->setProperty("helptag", "gui-createvm");
    6259#ifndef VBOX_WS_MAC
    6360    /* Assign watermark: */
     
    9794        }
    9895    }
     96    enableHelpButton("gui-createvm");
    9997    /* Call to base-class: */
    10098    UIWizard::prepare();
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette