VirtualBox

Changeset 88408 in vbox


Ignore:
Timestamp:
Apr 8, 2021 9:22:28 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Refactoring font scale stuff.

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

Legend:

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

    r88401 r88408  
    6969
    7070static const int iBookmarkUrlDataType = 6;
    71 static int iFontPointSizeChangeStep = 2;
    72 const QPair<float, float> UIHelpBrowserWidget::fontScaleMinMax = QPair<float, float>(0.5f, 3.f);
    7371
    7472/*********************************************************************************************************************************
    75 *   UIContentZoomWidget definition.                                                                                         *
     73*   UIZoomWidget definition.                                                                                         *
    7674*********************************************************************************************************************************/
    77 class UIContentZoomWidget : public QIWithRetranslateUI<QWidget>
     75class UIZoomWidget : public QIWithRetranslateUI<QWidget>
    7876{
    7977
     
    8280signals:
    8381
    84     void sigFontPointSizeChanged(int iNewFontPointSize);
     82    void sigZoomChanged(UIHelpViewer::ZoomOperation enmOperation);
    8583
    8684public:
    8785
    88     UIContentZoomWidget(int iInitialFontPointSize, QWidget *pParent = 0);
    89     void setFontPointSize(int iFontPointSize);
    90     int fontPointSize() const;
     86
     87    UIZoomWidget(QWidget *pParent = 0);
     88    int zoomPercentage() const;
     89    void setZoomPercentage(int iZoomPercentage);
    9190
    9291protected:
     
    9695private slots:
    9796
    98     void sltSetFontPointSize();
     97    void sltZoomOperation();
    9998
    10099private:
    101100
    102101    void prepare();
    103     int fontPercentage() const;
     102    //int fontPercentage() const;
     103
    104104    QHBoxLayout  *m_pMainLayout;
    105105    QIToolButton *m_pMinusButton;
     
    107107    QIToolButton *m_pPlusButton;
    108108    QLabel *m_pValueLabel;
    109     int m_iInitialFontPointSize;
    110     int m_iFontPointSize;
    111109};
    112110
     
    190188    void sigOpenLinkInNewTab(const QUrl &url, bool fBackground);
    191189    void sigAddBookmark(const QUrl &url, const QString &strTitle);
    192     void sigFontPointSizeChanged(int iFontPointSize);
    193190    void sigLinkHighlighted(const QString &strLink);
    194191
     
    203200    void setToolBarVisible(bool fVisible);
    204201    void print(QPrinter &printer);
    205     int initialFontPointSize() const;
    206     void setFontPointSize(int iPointSize);
    207     int fontPointSize() const;
     202    void zoom(UIHelpViewer::ZoomOperation enmZoomOperation);
    208203
    209204private slots:
     
    226221    virtual void retranslateUi() /* override */;
    227222    void setActionTextAndToolTip(QAction *pAction, const QString &strText, const QString &strToolTip);
     223    // int initialFontPointSize() const;
     224    // void setFontPointSize(int iPointSize);
     225    // int fontPointSize() const;
    228226
    229227    QAction     *m_pHomeAction;
     
    260258public:
    261259
    262     enum ZoomOperation
    263     {
    264         ZoomOperation_In = 0,
    265         ZoomOperation_Out,
    266         ZoomOperation_Reset,
    267         ZoomOperation_Max
    268     };
    269 
    270260    UIHelpBrowserTabManager(const QHelpEngine  *pHelpEngine, const QUrl &homeUrl,
    271261                            const QStringList &urlList, QWidget *pParent = 0);
     
    281271    void setToolBarVisible(bool fVisible);
    282272    void printCurrent(QPrinter &printer);
    283     int  initialFontPointSize() const;
    284     void setFontPointSize(int iPointSize);
    285     int  fontPointSize() const;
    286     void setFontScaleWidgetVisible(bool fToggled);
     273    void setZoomWidgetVisible(bool fToggled);
    287274    void switchToTab(int iIndex);
    288275
     
    303290    void sltHandleContextMenuTabClose();
    304291    void sltHandleCurrentChanged(int iTabIndex);
    305     void sltHandleFontSizeChange(int iFontPointSize);
     292    void sltHandleZoomOperation(UIHelpViewer::ZoomOperation enmZoomOperation);
    306293    void sltShowTabBarContextMenu(const QPoint &pos);
    307294    void sltHandleCloseOtherTabsContextMenuAction();
     
    318305    /* Returns the tab index with @Url if there is one. Returns -1 otherwise. */
    319306    int  findTab(const QUrl &Url) const;
     307    // void setFontPointSize(int iPointSize);
     308    // int  initialFontPointSize() const;
     309    // int  fontPointSize() const;
     310
    320311    const QHelpEngine* m_pHelpEngine;
    321     UIContentZoomWidget *m_pFontScaleWidget;
     312    UIZoomWidget *m_pZoomWidget;
    322313    QUrl m_homeUrl;
    323314    QStringList m_savedUrlList;
     
    330321
    331322/*********************************************************************************************************************************
    332 *   UIContentZoomWidget implementation.                                                                                          *
     323*   UIZoomWidget implementation.                                                                                          *
    333324*********************************************************************************************************************************/
    334325
    335 UIContentZoomWidget::UIContentZoomWidget(int iInitialFontPointSize, QWidget *pParent /* = 0 */)
     326UIZoomWidget::UIZoomWidget(QWidget *pParent /* = 0 */)
    336327    :QIWithRetranslateUI<QWidget>(pParent)
    337328    , m_pMainLayout(0)
     
    340331    , m_pPlusButton(0)
    341332    , m_pValueLabel(0)
    342     , m_iInitialFontPointSize(iInitialFontPointSize)
    343     , m_iFontPointSize(iInitialFontPointSize)
    344333{
    345334    prepare();
    346335}
    347336
    348 void UIContentZoomWidget::setFontPointSize(int iFontPointSize)
    349 {
    350     if (m_iFontPointSize == iFontPointSize)
    351         return;
    352     m_iFontPointSize = iFontPointSize;
    353     if (m_pValueLabel && m_iInitialFontPointSize != 0)
    354         m_pValueLabel->setText(QString("%1%2").arg(QString::number(fontPercentage())).arg("%"));
    355 }
    356 
    357 int UIContentZoomWidget::fontPointSize() const
    358 {
    359     return m_iFontPointSize;
    360 }
    361 
    362 void UIContentZoomWidget::retranslateUi()
    363 {
    364 }
    365 
    366 void UIContentZoomWidget::prepare()
     337void UIZoomWidget::retranslateUi()
     338{
     339}
     340
     341void UIZoomWidget::prepare()
    367342{
    368343    setAutoFillBackground(true);
     
    380355                     m_pValueLabel);
    381356
    382     m_pValueLabel->setText(QString("%1%2").arg(QString::number(fontPercentage())).arg("%"));
     357    //m_pValueLabel->setText(QString("%1%2").arg(QString::number(fontPercentage())).arg("%"));
    383358
    384359    m_pMinusButton->setIcon(UIIconPool::iconSet(":/help_browser_minus_32px.png"));
     
    386361    m_pPlusButton->setIcon(UIIconPool::iconSet(":/help_browser_plus_32px.png"));
    387362
    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);
     363    connect(m_pPlusButton, &QIToolButton::pressed, this, &UIZoomWidget::sltZoomOperation);
     364    connect(m_pMinusButton, &QIToolButton::pressed, this, &UIZoomWidget::sltZoomOperation);
     365    connect(m_pResetButton, &QIToolButton::pressed, this, &UIZoomWidget::sltZoomOperation);
    391366
    392367    m_pMainLayout->addWidget(m_pResetButton);
     
    396371}
    397372
    398 int UIContentZoomWidget::fontPercentage() const
    399 {
    400     if (m_iInitialFontPointSize == 0)
    401         return 0;
    402     return 100 * m_iFontPointSize / m_iInitialFontPointSize;
    403 }
    404 
    405 void UIContentZoomWidget::sltSetFontPointSize()
     373void UIZoomWidget::setZoomPercentage(int iZoomPercentage)
     374{
     375    if (m_pValueLabel)
     376        m_pValueLabel->setText(QString("%1%2").arg(QString::number(iZoomPercentage)).arg("%"));
     377}
     378
     379void UIZoomWidget::sltZoomOperation()
    406380{
    407381    if (!sender())
    408382        return;
    409     int iNewSize = m_iFontPointSize;
     383    UIHelpViewer::ZoomOperation enmOperation = UIHelpViewer::ZoomOperation_In;
    410384    if (sender() == m_pMinusButton)
    411         iNewSize -= iFontPointSizeChangeStep;
     385        enmOperation = UIHelpViewer::ZoomOperation_Out;
    412386    else if (sender() == m_pPlusButton)
    413         iNewSize += iFontPointSizeChangeStep;
     387        enmOperation = UIHelpViewer::ZoomOperation_In;
    414388    else if (sender() == m_pResetButton)
    415         iNewSize = m_iInitialFontPointSize;
    416     if (iNewSize >= UIHelpBrowserWidget::fontScaleMinMax.second * m_iInitialFontPointSize ||
    417         iNewSize <= UIHelpBrowserWidget::fontScaleMinMax.first * m_iInitialFontPointSize)
    418         iNewSize = m_iFontPointSize;
    419     setFontPointSize(iNewSize);
    420     emit sigFontPointSizeChanged(m_iFontPointSize);
     389        enmOperation = UIHelpViewer::ZoomOperation_Reset;
     390    emit sigZoomChanged(enmOperation);
    421391}
    422392
     
    607577}
    608578
    609 int UIHelpBrowserTab::initialFontPointSize() const
     579void UIHelpBrowserTab::zoom(UIHelpViewer::ZoomOperation enmZoomOperation)
    610580{
    611581    if (m_pContentViewer)
    612         return m_pContentViewer->initialFontPointSize();
    613     return 0;
    614 }
    615 
    616 void UIHelpBrowserTab::setFontPointSize(int iPointSize)
    617 {
    618     if (m_pContentViewer)
    619     {
    620         if (m_pContentViewer->font().pointSize() == iPointSize)
    621             return;
    622         QFont mFont = m_pContentViewer->font();
    623         mFont.setPointSize(iPointSize);
    624         m_pContentViewer->setFont(mFont);
    625     }
    626 }
    627 
    628 int UIHelpBrowserTab::fontPointSize() const
    629 {
    630     if (!m_pContentViewer)
    631         return 0;
    632     return m_pContentViewer->font().pointSize();
    633 }
     582        m_pContentViewer->zoom(enmZoomOperation);
     583}
     584// void UIHelpBrowserTab::setZoomPercentage(int iZoomPercentage)
     585// {
     586//     if (m_pContentViewer)
     587//         m_pContentViewer->setZoomPercentage(iZoomPercentage);
     588// }
     589
     590// int UIHelpBrowserTab::initialFontPointSize() const
     591// {
     592//     if (m_pContentViewer)
     593//         return m_pContentViewer->initialFontPointSize();
     594//     return 0;
     595// }
     596
     597// void UIHelpBrowserTab::setFontPointSize(int iPointSize)
     598// {
     599//     if (m_pContentViewer)
     600//     {
     601//         if (m_pContentViewer->font().pointSize() == iPointSize)
     602//             return;
     603//         QFont mFont = m_pContentViewer->font();
     604//         mFont.setPointSize(iPointSize);
     605//         m_pContentViewer->setFont(mFont);
     606//     }
     607// }
     608
     609// int UIHelpBrowserTab::fontPointSize() const
     610// {
     611//     if (!m_pContentViewer)
     612//         return 0;
     613//     return m_pContentViewer->font().pointSize();
     614// }
    634615
    635616void UIHelpBrowserTab::prepare(const QUrl &initialUrl)
     
    661642    connect(m_pContentViewer, &UIHelpViewer::sigCloseFindInPageWidget,
    662643            this, &UIHelpBrowserTab::sltCloseFindInPageWidget);
    663     connect(m_pContentViewer, &UIHelpViewer::sigFontPointSizeChanged,
    664             this, &UIHelpBrowserTab::sigFontPointSizeChanged);
    665644    connect(m_pContentViewer, &UIHelpViewer::sigGoBackward,
    666645            this, &UIHelpBrowserTab::sltHandleBackwardAction);
     
    836815    : QITabWidget(pParent)
    837816    , m_pHelpEngine(pHelpEngine)
    838     , m_pFontScaleWidget(0)
     817    , m_pZoomWidget(0)
    839818    , m_homeUrl(homeUrl)
    840819    , m_savedUrlList(urlList)
     
    868847    connect(pTabWidget, &UIHelpBrowserTab::sigAddBookmark,
    869848            this, &UIHelpBrowserTabManager::sigAddBookmark);
    870     connect(pTabWidget, &UIHelpBrowserTab::sigFontPointSizeChanged,
    871             this, &UIHelpBrowserTabManager::sltHandleFontSizeChange);
     849    // connect(pTabWidget, &UIHelpBrowserTab::sigZoomPercentageChanged,
     850    //         this, &UIHelpBrowserTabManager::sltHandleZoomOperation);
    872851    connect(pTabWidget, &UIHelpBrowserTab::sigLinkHighlighted,
    873852            this, &UIHelpBrowserTabManager::sigLinkHighlighted);
     
    876855        setCurrentIndex(index);
    877856
    878     if (!m_pFontScaleWidget)
    879     {
    880         m_pFontScaleWidget = new UIContentZoomWidget(initialFontPointSize(), this);
    881         connect(m_pFontScaleWidget, &UIContentZoomWidget::sigFontPointSizeChanged,
    882                 this, &UIHelpBrowserTabManager::sltHandleFontSizeChange);
     857    if (!m_pZoomWidget)
     858    {
     859        m_pZoomWidget = new UIZoomWidget(this);
     860        connect(m_pZoomWidget, &UIZoomWidget::sigZoomChanged,
     861                this, &UIHelpBrowserTabManager::sltHandleZoomOperation);
    883862    }
    884863}
     
    1012991void UIHelpBrowserTabManager::paintEvent(QPaintEvent *pEvent)
    1013992{
    1014     if (m_pFontScaleWidget)
    1015     {
    1016         int iMargin = 20;
    1017         m_pFontScaleWidget->move(width() - m_pFontScaleWidget->width() - iMargin,
    1018                                  height() - m_pFontScaleWidget->height() - iMargin);
     993    if (m_pZoomWidget)
     994    {
     995        int iMargin = 1.5 * qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
     996        m_pZoomWidget->move(width() - m_pZoomWidget->width() - iMargin,
     997                            height() - m_pZoomWidget->height() - iMargin);
    1019998    }
    1020999    QITabWidget::paintEvent(pEvent);
    10211000}
    10221001
    1023 int UIHelpBrowserTabManager::initialFontPointSize() const
    1024 {
    1025     UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget());
    1026     if (!pTab)
    1027         return 0;
    1028     return pTab->initialFontPointSize();
    1029 }
    1030 
    1031 void UIHelpBrowserTabManager::setFontPointSize(int iPointSize)
    1032 {
    1033     for (int i = 0; i < count(); ++i)
    1034     {
    1035         UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(widget(i));
    1036         if (!pTab)
    1037             continue;
    1038         pTab->setFontPointSize(iPointSize);
    1039     }
    1040     if (m_pFontScaleWidget)
    1041         m_pFontScaleWidget->setFontPointSize(iPointSize);
    1042 }
    1043 
    1044 int UIHelpBrowserTabManager::fontPointSize() const
    1045 {
    1046     UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget());
    1047     if (!pTab)
    1048         return 0;
    1049     return pTab->fontPointSize();
    1050 }
    1051 
    1052 void UIHelpBrowserTabManager::setFontScaleWidgetVisible(bool fToggled)
    1053 {
    1054     if (m_pFontScaleWidget)
    1055         m_pFontScaleWidget->setVisible(fToggled);
     1002// int UIHelpBrowserTabManager::initialFontPointSize() const
     1003// {
     1004//     UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget());
     1005//     if (!pTab)
     1006//         return 0;
     1007//     return pTab->initialFontPointSize();
     1008// }
     1009
     1010// void UIHelpBrowserTabManager::setFontPointSize(int iPointSize)
     1011// {
     1012//     for (int i = 0; i < count(); ++i)
     1013//     {
     1014//         UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(widget(i));
     1015//         if (!pTab)
     1016//             continue;
     1017//         pTab->setFontPointSize(iPointSize);
     1018//     }
     1019//     // if (m_pZoomWidget)
     1020//     //     m_pZoomWidget->setFontPointSize(iPointSize);
     1021// }
     1022
     1023// int UIHelpBrowserTabManager::fontPointSize() const
     1024// {
     1025//     UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget());
     1026//     if (!pTab)
     1027//         return 0;
     1028//     return pTab->fontPointSize();
     1029// }
     1030
     1031void UIHelpBrowserTabManager::setZoomWidgetVisible(bool fToggled)
     1032{
     1033    if (m_pZoomWidget)
     1034        m_pZoomWidget->setVisible(fToggled);
    10561035}
    10571036
     
    11351114}
    11361115
    1137 void UIHelpBrowserTabManager::sltHandleFontSizeChange(int iFontPointSize)
    1138 {
    1139     setFontPointSize(iFontPointSize);
     1116void UIHelpBrowserTabManager::sltHandleZoomOperation(UIHelpViewer::ZoomOperation enmZoomOperation)
     1117{
     1118    for (int i = 0; i < count(); ++i)
     1119    {
     1120        UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(widget(i));
     1121        if (pTab)
     1122            pTab->zoom(enmZoomOperation);
     1123    }
    11401124}
    11411125
     
    12111195    , m_pShowHideSideBarAction(0)
    12121196    , m_pShowHideToolBarAction(0)
    1213     , m_pShowHideFontScaleWidgetAction(0)
     1197    , m_pShowHideZoomWidgetAction(0)
    12141198    , m_pShowHideStatusBarAction(0)
    1215     , m_pFontSizeLargerAction(0)
    1216     , m_pFontSizeSmallerAction(0)
     1199    , m_pZoomInAction(0)
     1200    , m_pZoomOutAction(0)
    12171201    , m_pFontSizeResetAction(0)
    12181202    , m_fModelContentCreated(false)
     
    12841268            this, &UIHelpBrowserWidget::sltHandleWidgetVisibilityToggle);
    12851269
    1286     m_pShowHideFontScaleWidgetAction = new QAction(this);
    1287     m_pShowHideFontScaleWidgetAction->setCheckable(true);
    1288     m_pShowHideFontScaleWidgetAction->setChecked(true);
    1289     connect(m_pShowHideFontScaleWidgetAction, &QAction::toggled,
     1270    m_pShowHideZoomWidgetAction = new QAction(this);
     1271    m_pShowHideZoomWidgetAction->setCheckable(true);
     1272    m_pShowHideZoomWidgetAction->setChecked(true);
     1273    connect(m_pShowHideZoomWidgetAction, &QAction::toggled,
    12901274            this, &UIHelpBrowserWidget::sltHandleWidgetVisibilityToggle);
    12911275
     
    13061290
    13071291    /* For size control actions: */
    1308     m_pFontSizeLargerAction = new QAction(this);
    1309     m_pFontSizeLargerAction->setIcon(UIIconPool::iconSet(":/help_browser_plus_32px.png"));
    1310 
    1311     m_pFontSizeSmallerAction = new QAction(this);
    1312     m_pFontSizeSmallerAction->setIcon(UIIconPool::iconSet(":/help_browser_minus_32px.png"));
     1292    m_pZoomInAction = new QAction(this);
     1293    m_pZoomInAction->setIcon(UIIconPool::iconSet(":/help_browser_plus_32px.png"));
     1294
     1295    m_pZoomOutAction = new QAction(this);
     1296    m_pZoomOutAction->setIcon(UIIconPool::iconSet(":/help_browser_minus_32px.png"));
    13131297
    13141298    m_pFontSizeResetAction = new QAction(this);
    13151299    m_pFontSizeResetAction->setIcon(UIIconPool::iconSet(":/help_browser_reset_32px.png"));
    13161300
    1317     connect(m_pFontSizeLargerAction, &QAction::triggered,
     1301    connect(m_pZoomInAction, &QAction::triggered,
    13181302            this, &UIHelpBrowserWidget::sltHandleZoomActions);
    1319     connect(m_pFontSizeSmallerAction, &QAction::triggered,
     1303    connect(m_pZoomOutAction, &QAction::triggered,
    13201304            this, &UIHelpBrowserWidget::sltHandleZoomActions);
    13211305    connect(m_pFontSizeResetAction, &QAction::triggered,
     
    14631447        m_pFileMenu->addAction(m_pCloseDialogAction);
    14641448
    1465     if (m_pFontSizeLargerAction)
    1466         m_pViewMenu->addAction(m_pFontSizeLargerAction);
    1467     if (m_pFontSizeSmallerAction)
    1468         m_pViewMenu->addAction(m_pFontSizeSmallerAction);
     1449    if (m_pZoomInAction)
     1450        m_pViewMenu->addAction(m_pZoomInAction);
     1451    if (m_pZoomOutAction)
     1452        m_pViewMenu->addAction(m_pZoomOutAction);
    14691453    if (m_pFontSizeResetAction)
    14701454        m_pViewMenu->addAction(m_pFontSizeResetAction);
     
    14741458    if (m_pShowHideToolBarAction)
    14751459        m_pViewMenu->addAction(m_pShowHideToolBarAction);
    1476     if (m_pShowHideFontScaleWidgetAction)
    1477         m_pViewMenu->addAction(m_pShowHideFontScaleWidgetAction);
     1460    if (m_pShowHideZoomWidgetAction)
     1461        m_pViewMenu->addAction(m_pShowHideZoomWidgetAction);
    14781462    if (m_pShowHideStatusBarAction)
    14791463        m_pViewMenu->addAction(m_pShowHideStatusBarAction);
     
    15931577    if (m_pShowHideToolBarAction)
    15941578        m_pShowHideToolBarAction->setText(tr("Show Tool Bar"));
    1595     if (m_pShowHideFontScaleWidgetAction)
    1596         m_pShowHideFontScaleWidgetAction->setText(tr("Show Font Scale Widget"));
     1579    if (m_pShowHideZoomWidgetAction)
     1580        m_pShowHideZoomWidgetAction->setText(tr("Show Font Scale Widget"));
    15971581    if (m_pShowHideStatusBarAction)
    15981582        m_pShowHideStatusBarAction->setText(tr("Show Status Bar"));
     
    16041588        m_pCloseDialogAction->setText(tr("Close"));
    16051589
    1606     if (m_pFontSizeLargerAction)
    1607         m_pFontSizeLargerAction->setText(tr("Zoom &In"));
    1608     if (m_pFontSizeSmallerAction)
    1609         m_pFontSizeSmallerAction->setText(tr("Zoom &Out"));
     1590    if (m_pZoomInAction)
     1591        m_pZoomInAction->setText(tr("Zoom &In"));
     1592    if (m_pZoomOutAction)
     1593        m_pZoomOutAction->setText(tr("Zoom &Out"));
    16101594    if (m_pFontSizeResetAction)
    16111595        m_pFontSizeResetAction->setText(tr("&Reset Zoom"));
     
    16491633            m_pTabManager->setToolBarVisible(fToggled);
    16501634    }
    1651     else if (sender() == m_pShowHideFontScaleWidgetAction)
     1635    else if (sender() == m_pShowHideZoomWidgetAction)
    16521636    {
    16531637        if (m_pTabManager)
    1654             m_pTabManager->setFontScaleWidgetVisible(fToggled);
     1638            m_pTabManager->setZoomWidgetVisible(fToggled);
    16551639    }
    16561640    else if (sender() == m_pShowHideStatusBarAction)
     
    18801864void UIHelpBrowserWidget::sltHandleZoomActions()
    18811865{
    1882     if (!sender() || !m_pTabManager)
    1883         return;
    1884     int iFontPointSize = m_pTabManager->fontPointSize();
    1885     if (sender() == m_pFontSizeResetAction)
    1886         iFontPointSize = m_pTabManager->initialFontPointSize();
    1887     else if (sender() == m_pFontSizeLargerAction)
    1888         iFontPointSize += iFontPointSizeChangeStep;
    1889     else if (sender() == m_pFontSizeSmallerAction)
    1890         iFontPointSize -= iFontPointSizeChangeStep;
    1891 
    1892     if (iFontPointSize >= fontScaleMinMax.second * m_pTabManager->initialFontPointSize() ||
    1893         iFontPointSize <= fontScaleMinMax.first * m_pTabManager->initialFontPointSize())
    1894         return;
    1895     m_pTabManager->setFontPointSize(iFontPointSize);
     1866    // if (!sender() || !m_pTabManager)
     1867    //     return;
     1868    // int iFontPointSize = m_pTabManager->fontPointSize();
     1869    // if (sender() == m_pFontSizeResetAction)
     1870    //     iFontPointSize = m_pTabManager->initialFontPointSize();
     1871    // else if (sender() == m_pZoomInAction)
     1872    //     iFontPointSize += iZoomPercentageStep;
     1873    // else if (sender() == m_pZoomOutAction)
     1874    //     iFontPointSize -= iZoomPercentageStep;
     1875
     1876    // if (iFontPointSize >= zoomPercentageMinMax.second * m_pTabManager->initialFontPointSize() ||
     1877    //     iFontPointSize <= zoomPercentageMinMax.first * m_pTabManager->initialFontPointSize())
     1878    //     return;
     1879    // m_pTabManager->setFontPointSize(iFontPointSize);
    18961880}
    18971881
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r88401 r88408  
    6767    QIToolBar *toolbar() const { return m_pToolBar; }
    6868#endif
    69 
    70     static const QPair<float, float> fontScaleMinMax;
    7169
    7270protected:
     
    167165    QAction             *m_pShowHideSideBarAction;
    168166    QAction             *m_pShowHideToolBarAction;
    169     QAction             *m_pShowHideFontScaleWidgetAction;
     167    QAction             *m_pShowHideZoomWidgetAction;
    170168    QAction             *m_pShowHideStatusBarAction;
    171     QAction             *m_pFontSizeLargerAction;
    172     QAction             *m_pFontSizeSmallerAction;
     169    QAction             *m_pZoomInAction;
     170    QAction             *m_pZoomOutAction;
    173171    QAction             *m_pFontSizeResetAction;
    174172
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r88401 r88408  
    4949
    5050#ifdef VBOX_WITH_QHELP_VIEWER
     51
     52//static int iZoomPercentageStep = 20;
     53const QPair<int, int> UIHelpViewer::zoomPercentageMinMax = QPair<int, int>(20, 300);
    5154
    5255
     
    436439}
    437440
     441void UIHelpViewer::zoom(ZoomOperation enmZoomOperation)
     442{
     443    Q_UNUSED(enmZoomOperation);
     444}
     445
     446
    438447void UIHelpViewer::contextMenuEvent(QContextMenuEvent *event)
    439448{
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.h

    r88393 r88408  
    5050public:
    5151
     52    enum ZoomOperation
     53    {
     54        ZoomOperation_In = 0,
     55        ZoomOperation_Out,
     56        ZoomOperation_Reset,
     57        ZoomOperation_Max
     58    };
     59
    5260    UIHelpViewer(const QHelpEngine *pHelpEngine, QWidget *pParent = 0);
    5361    virtual QVariant loadResource(int type, const QUrl &name) /* override */;
     
    5765    void setFont(const QFont &);
    5866    bool isFindInPageWidgetVisible() const;
     67    void zoom(ZoomOperation enmZoomOperation);
     68
     69    static const QPair<int, int> zoomPercentageMinMax;
    5970
    6071public slots:
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