VirtualBox

Changeset 88401 in vbox for trunk


Ignore:
Timestamp:
Apr 7, 2021 2:39:51 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Some refactoring.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r88392 r88401  
    7373
    7474/*********************************************************************************************************************************
    75 *   UIFontScaleWidget definition.                                                                                         *
     75*   UIContentZoomWidget definition.                                                                                         *
    7676*********************************************************************************************************************************/
    77 class UIFontScaleWidget : public QIWithRetranslateUI<QWidget>
     77class UIContentZoomWidget : public QIWithRetranslateUI<QWidget>
    7878{
    7979
     
    8686public:
    8787
    88     UIFontScaleWidget(int iInitialFontPointSize, QWidget *pParent = 0);
     88    UIContentZoomWidget(int iInitialFontPointSize, QWidget *pParent = 0);
    8989    void setFontPointSize(int iFontPointSize);
    9090    int fontPointSize() const;
     
    259259
    260260public:
     261
     262    enum ZoomOperation
     263    {
     264        ZoomOperation_In = 0,
     265        ZoomOperation_Out,
     266        ZoomOperation_Reset,
     267        ZoomOperation_Max
     268    };
    261269
    262270    UIHelpBrowserTabManager(const QHelpEngine  *pHelpEngine, const QUrl &homeUrl,
     
    311319    int  findTab(const QUrl &Url) const;
    312320    const QHelpEngine* m_pHelpEngine;
    313     UIFontScaleWidget *m_pFontScaleWidget;
     321    UIContentZoomWidget *m_pFontScaleWidget;
    314322    QUrl m_homeUrl;
    315323    QStringList m_savedUrlList;
     
    322330
    323331/*********************************************************************************************************************************
    324 *   UIFontScaleWidget implementation.                                                                                            *
     332*   UIContentZoomWidget implementation.                                                                                          *
    325333*********************************************************************************************************************************/
    326334
    327 UIFontScaleWidget::UIFontScaleWidget(int iInitialFontPointSize, QWidget *pParent /* = 0 */)
     335UIContentZoomWidget::UIContentZoomWidget(int iInitialFontPointSize, QWidget *pParent /* = 0 */)
    328336    :QIWithRetranslateUI<QWidget>(pParent)
    329337    , m_pMainLayout(0)
     
    338346}
    339347
    340 void UIFontScaleWidget::setFontPointSize(int iFontPointSize)
     348void UIContentZoomWidget::setFontPointSize(int iFontPointSize)
    341349{
    342350    if (m_iFontPointSize == iFontPointSize)
     
    347355}
    348356
    349 int UIFontScaleWidget::fontPointSize() const
     357int UIContentZoomWidget::fontPointSize() const
    350358{
    351359    return m_iFontPointSize;
    352360}
    353361
    354 void UIFontScaleWidget::retranslateUi()
    355 {
    356 }
    357 
    358 void UIFontScaleWidget::prepare()
     362void UIContentZoomWidget::retranslateUi()
     363{
     364}
     365
     366void UIContentZoomWidget::prepare()
    359367{
    360368    setAutoFillBackground(true);
     
    378386    m_pPlusButton->setIcon(UIIconPool::iconSet(":/help_browser_plus_32px.png"));
    379387
    380     connect(m_pPlusButton, &QIToolButton::pressed, this, &UIFontScaleWidget::sltSetFontPointSize);
    381     connect(m_pMinusButton, &QIToolButton::pressed, this, &UIFontScaleWidget::sltSetFontPointSize);
    382     connect(m_pResetButton, &QIToolButton::pressed, this, &UIFontScaleWidget::sltSetFontPointSize);
     388    connect(m_pPlusButton, &QIToolButton::pressed, this, &UIContentZoomWidget::sltSetFontPointSize);
     389    connect(m_pMinusButton, &QIToolButton::pressed, this, &UIContentZoomWidget::sltSetFontPointSize);
     390    connect(m_pResetButton, &QIToolButton::pressed, this, &UIContentZoomWidget::sltSetFontPointSize);
    383391
    384392    m_pMainLayout->addWidget(m_pResetButton);
     
    388396}
    389397
    390 int UIFontScaleWidget::fontPercentage() const
     398int UIContentZoomWidget::fontPercentage() const
    391399{
    392400    if (m_iInitialFontPointSize == 0)
     
    395403}
    396404
    397 void UIFontScaleWidget::sltSetFontPointSize()
     405void UIContentZoomWidget::sltSetFontPointSize()
    398406{
    399407    if (!sender())
     
    870878    if (!m_pFontScaleWidget)
    871879    {
    872         m_pFontScaleWidget = new UIFontScaleWidget(initialFontPointSize(), this);
    873         connect(m_pFontScaleWidget, &UIFontScaleWidget::sigFontPointSizeChanged,
     880        m_pFontScaleWidget = new UIContentZoomWidget(initialFontPointSize(), this);
     881        connect(m_pFontScaleWidget, &UIContentZoomWidget::sigFontPointSizeChanged,
    874882                this, &UIHelpBrowserTabManager::sltHandleFontSizeChange);
    875883    }
     
    13081316
    13091317    connect(m_pFontSizeLargerAction, &QAction::triggered,
    1310             this, &UIHelpBrowserWidget::sltHandleFontSizeActions);
     1318            this, &UIHelpBrowserWidget::sltHandleZoomActions);
    13111319    connect(m_pFontSizeSmallerAction, &QAction::triggered,
    1312             this, &UIHelpBrowserWidget::sltHandleFontSizeActions);
     1320            this, &UIHelpBrowserWidget::sltHandleZoomActions);
    13131321    connect(m_pFontSizeResetAction, &QAction::triggered,
    1314             this, &UIHelpBrowserWidget::sltHandleFontSizeActions);
     1322            this, &UIHelpBrowserWidget::sltHandleZoomActions);
    13151323}
    13161324
     
    15971605
    15981606    if (m_pFontSizeLargerAction)
    1599         m_pFontSizeLargerAction->setText(tr("Increase Font Size"));
     1607        m_pFontSizeLargerAction->setText(tr("Zoom &In"));
    16001608    if (m_pFontSizeSmallerAction)
    1601         m_pFontSizeSmallerAction->setText(tr("Decrease Font Size"));
     1609        m_pFontSizeSmallerAction->setText(tr("Zoom &Out"));
    16021610    if (m_pFontSizeResetAction)
    1603         m_pFontSizeResetAction->setText(tr("Reset Font Size"));
     1611        m_pFontSizeResetAction->setText(tr("&Reset Zoom"));
    16041612}
    16051613
     
    18701878}
    18711879
    1872 void UIHelpBrowserWidget::sltHandleFontSizeActions()
     1880void UIHelpBrowserWidget::sltHandleZoomActions()
    18731881{
    18741882    if (!sender() || !m_pTabManager)
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r87656 r88401  
    9393    void sltCopyLink();
    9494    void sltAddNewBookmark(const QUrl &url, const QString &strTitle);
    95     void sltHandleFontSizeActions();
     95    void sltHandleZoomActions();
    9696    void sltHandleTabListChanged(const QStringList &titleList);
    9797    void sltHandleTabChoose();
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r88398 r88401  
    375375    QTextBrowser::setSource(url);
    376376    QTextDocument *pDocument = document();
    377     //iterateDocumentImages();
     377    iterateDocumentImages();
    378378    if (!pDocument || pDocument->isEmpty())
    379379    {
     
    508508void UIHelpViewer::wheelEvent(QWheelEvent *pEvent)
    509509{
     510    Q_UNUSED(pEvent);
     511    /* Disable wheel scaling for now: */
     512#if 0
    510513    int iPreviousSize = font().pointSize();
     514    /* QTextBrowser::wheelEvent sets a new font size: */
    511515    QTextBrowser::wheelEvent(pEvent);
    512516    /* Don't allow font size to get too large or small: */
     
    520524    else
    521525        emit sigFontPointSizeChanged(font().pointSize());
     526#endif
    522527}
    523528
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