VirtualBox

Changeset 88411 in vbox for trunk


Ignore:
Timestamp:
Apr 8, 2021 11:25:05 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Saving/loading zoom percentage.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp

    r88205 r88411  
    242242const char *UIExtraDataDefs::GUI_HelpBrowserDialogGeometry = "GUI/HelpBrowserDialogGeomety";
    243243const char *UIExtraDataDefs::GUI_HelpBrowserBookmarks = "GUI/HelpBrowserBookmarks";
     244const char *UIExtraDataDefs::GUI_HelpBrowserZoomPercentage = "GUI/HelpBrowserZoomPercentage";
    244245
    245246/* VM Activity Overview: */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r88205 r88411  
    441441        SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserDialogGeometry;
    442442        SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserBookmarks;
     443        SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserZoomPercentage;
    443444    /** @} */
    444445
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r88205 r88411  
    19841984           << GUI_HelpBrowserLastURLList
    19851985           << GUI_HelpBrowserDialogGeometry
    1986            << GUI_HelpBrowserBookmarks;
     1986           << GUI_HelpBrowserBookmarks
     1987           << GUI_HelpBrowserZoomPercentage;
    19871988}
    19881989
     
    46034604{
    46044605    return extraDataStringList(GUI_HelpBrowserLastURLList);
     4606}
     4607
     4608void UIExtraDataManager::setHelpBrowserZoomPercentage(int iZoomPercentage)
     4609{
     4610    setExtraDataString(GUI_HelpBrowserZoomPercentage, QString::number(iZoomPercentage));
     4611}
     4612
     4613int UIExtraDataManager::helpBrowserZoomPercentage()
     4614{
     4615    return extraDataString(GUI_HelpBrowserZoomPercentage).toInt();
    46054616}
    46064617
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r88205 r88411  
    789789        void setHelpBrowserLastUrlList(const QStringList &urlList);
    790790        QStringList helpBrowserLastUrlList();
     791        void setHelpBrowserZoomPercentage(int iZoomPercentage);
     792        int helpBrowserZoomPercentage();
    791793        QRect helpBrowserDialogGeometry(QWidget *pWidget, QWidget *pParentWidget, const QRect &defaultGeometry);
    792794        void setHelpBrowserDialogGeometry(const QRect &geometry, bool fMaximized);
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r88410 r88411  
    201201    void print(QPrinter &printer);
    202202    void zoom(UIHelpViewer::ZoomOperation enmZoomOperation);
     203    int zoomPercentage() const;
     204    void setZoomPercentage(int iZoomPercentage);
    203205
    204206private slots:
     
    270272    void setZoomWidgetVisible(bool fToggled);
    271273    void switchToTab(int iIndex);
     274    /** returns the zoom percentage of 0th tab. */
     275    int zoomPercentage() const;
     276    /** Sets the zoom percentage of all tabs. */
     277    void setZoomPercentage(int iZoomPercentage);
    272278
    273279public slots:
     
    574580    if (m_pContentViewer)
    575581        m_pContentViewer->zoom(enmZoomOperation);
     582}
     583
     584void UIHelpBrowserTab::setZoomPercentage(int iZoomPercentage)
     585{
     586    if (m_pContentViewer)
     587        m_pContentViewer->setZoomPercentage(iZoomPercentage);
     588}
     589
     590int UIHelpBrowserTab::zoomPercentage() const
     591{
     592    if (m_pContentViewer)
     593        return m_pContentViewer->zoomPercentage();
     594    return 100;
    576595}
    577596
     
    977996    setCurrentIndex(iIndex);
    978997}
     998
     999int UIHelpBrowserTabManager::zoomPercentage() const
     1000{
     1001    UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(widget(0));
     1002    if (pTab)
     1003        return pTab->zoomPercentage();
     1004    return 100;
     1005}
     1006
     1007void UIHelpBrowserTabManager::setZoomPercentage(int iZoomPercentage)
     1008{
     1009    for (int i = 0; i < count(); ++i)
     1010    {
     1011        UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(widget(i));
     1012        if (pTab)
     1013            pTab->setZoomPercentage(iZoomPercentage);
     1014    }
     1015}
     1016
    9791017
    9801018void UIHelpBrowserTabManager::sltHandletabTitleChange(const QString &strTitle)
     
    14081446void UIHelpBrowserWidget::loadOptions()
    14091447{
     1448    if (m_pTabManager)
     1449        m_pTabManager->setZoomPercentage(gEDataManager->helpBrowserZoomPercentage());
    14101450}
    14111451
     
    14431483{
    14441484    if (m_pTabManager)
     1485    {
    14451486        gEDataManager->setHelpBrowserLastUrlList(m_pTabManager->tabUrlList());
     1487        gEDataManager->setHelpBrowserZoomPercentage(m_pTabManager->zoomPercentage());
     1488    }
    14461489}
    14471490
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp

    r88410 r88411  
    441441    {
    442442        case ZoomOperation_In:
    443             m_iZoomPercentage += iZoomPercentageStep;
     443            iPrevZoom += iZoomPercentageStep;
    444444            break;
    445445        case ZoomOperation_Out:
    446             m_iZoomPercentage -= iZoomPercentageStep;
     446            iPrevZoom -= iZoomPercentageStep;
    447447            break;
    448448        case ZoomOperation_Reset:
    449449        default:
    450             m_iZoomPercentage = 100;
     450            iPrevZoom = 100;
    451451            break;
    452452    }
    453 
    454     if (m_iZoomPercentage > zoomPercentageMinMax.second ||
    455         m_iZoomPercentage < zoomPercentageMinMax.first)
    456         m_iZoomPercentage = iPrevZoom;
     453    setZoomPercentage(iPrevZoom);
     454}
     455
     456void UIHelpViewer::setZoomPercentage(int iZoomPercentage)
     457{
     458    if (iZoomPercentage > zoomPercentageMinMax.second ||
     459        iZoomPercentage < zoomPercentageMinMax.first ||
     460        m_iZoomPercentage == iZoomPercentage)
     461        return;
     462
     463    m_iZoomPercentage = iZoomPercentage;
    457464    scaleFont();
    458 
    459465    emit sigZoomPercentageChanged(m_iZoomPercentage);
     466}
     467
     468
     469int UIHelpViewer::zoomPercentage() const
     470{
     471    return m_iZoomPercentage;
    460472}
    461473
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.h

    r88410 r88411  
    6767    bool isFindInPageWidgetVisible() const;
    6868    void zoom(ZoomOperation enmZoomOperation);
     69    int zoomPercentage() const;
     70    void setZoomPercentage(int iZoomPercentage);
    6971
    7072    static const QPair<int, int> zoomPercentageMinMax;
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