VirtualBox

Changeset 86735 in vbox


Ignore:
Timestamp:
Oct 28, 2020 11:43:16 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Adding forward/backward actions

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc

    r85613 r86735  
    379379        <file alias="hd_warning_16px.png">images/hd_warning_16px.png</file>
    380380        <file alias="hd_write_16px.png">images/hd_write_16px.png</file>
     381        <file alias="help_browser_add_bookmark.png">images/help_browser_add_bookmark.png</file>
     382        <file alias="help_browser_backward_32px.png">images/help_browser_backward_32px.png</file>
     383        <file alias="help_browser_backward_disabled_32px.png">images/help_browser_backward_disabled_32px.png</file>
     384        <file alias="help_browser_forward_disabled_32px.png">images/help_browser_forward_disabled_32px.png</file>
     385        <file alias="help_browser_forward_32px.png">images/help_browser_forward_32px.png</file>
     386        <file alias="help_browser_home_32px.png">images/help_browser_home_32px.png</file>
     387        <file alias="help_browser_search.png">images/help_browser_search.png</file>
    381388        <file alias="help_16px.png">images/help_16px.png</file>
    382389        <file alias="help_button_normal_mac_24px.png">images/help_button_normal_mac_24px.png</file>
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r86724 r86735  
    123123    , m_pBookmarksWidget(0)
    124124    , m_pShowHideTabWidgetAction(0)
    125     , m_pGoHomeAction(0)
     125    , m_pHomeAction(0)
     126    , m_pForwardAction(0)
     127    , m_pBackwardAction(0)
    126128    , m_fModelContentCreated(false)
    127129{
     
    167169    m_pShowHideTabWidgetAction->setChecked(true);
    168170    connect(m_pShowHideTabWidgetAction, &QAction::toggled, this, &UIHelpBrowserWidget::sltHandleTabVisibility);
    169     m_pGoHomeAction = new QAction(UIIconPool::iconSet(":/file_manager_go_home_16px.png"), "", this);
    170     connect(m_pGoHomeAction, &QAction::triggered, this, &UIHelpBrowserWidget::sltHandleGoHomeAction);
     171    m_pHomeAction =
     172        new QAction(UIIconPool::iconSet(":/help_browser_home_32px.png"), QString(), this);
     173    connect(m_pHomeAction, &QAction::triggered, this, &UIHelpBrowserWidget::sltHandleHomeAction);
     174
     175    m_pForwardAction =
     176        new QAction(UIIconPool::iconSet(":/help_browser_forward_32px.png", ":/help_browser_forward_disabled_32px.png"), QString(), this);
     177    connect(m_pForwardAction, &QAction::triggered, this, &UIHelpBrowserWidget::sltHandleForwardAction);
     178    sltHandleForwardAvailable(false);
     179
     180    m_pBackwardAction =
     181        new QAction(UIIconPool::iconSet(":/help_browser_backward_32px.png", ":/help_browser_backward_disabled_32px.png"), QString(), this);
     182    connect(m_pBackwardAction, &QAction::triggered, this, &UIHelpBrowserWidget::sltHandleBackwardAction);
     183    sltHandleBackwardAvailable(false);
    171184}
    172185
     
    198211    AssertReturnVoid(m_pContentViewer);
    199212
    200 
    201213    connect(m_pContentViewer, &UIHelpBrowserViewer::sourceChanged,
    202214        this, &UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange);
     215    connect(m_pContentViewer, &UIHelpBrowserViewer::forwardAvailable,
     216        this, &UIHelpBrowserWidget::sltHandleForwardAvailable);
     217    connect(m_pContentViewer, &UIHelpBrowserViewer::backwardAvailable,
     218        this, &UIHelpBrowserWidget::sltHandleBackwardAvailable);
     219    connect(m_pContentViewer, &UIHelpBrowserViewer::sourceChanged,
     220        this, &UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange);
     221
    203222    m_pSplitter->addWidget(m_pContentViewer);
    204223
     
    230249    {
    231250        /* Configure toolbar: */
     251        m_pToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
    232252        const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize));
    233253        m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
    234         m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    235         m_pToolBar->addAction(m_pGoHomeAction);
     254        m_pToolBar->addAction(m_pBackwardAction);
     255        m_pToolBar->addAction(m_pForwardAction);
     256        m_pToolBar->addAction(m_pHomeAction);
    236257
    237258#ifdef VBOX_WS_MAC
     
    312333
    313334    m_strPageNotFoundText = tr("<div><p><h3>404. Not found.</h3>The page <b>%1</b> could not be found.</p></div>");
     335
     336    if (m_pHomeAction)
     337    {
     338        m_pHomeAction->setText(tr("Home"));
     339        m_pHomeAction->setToolTip(tr("Return to start page"));
     340    }
     341
     342    if (m_pBackwardAction)
     343    {
     344        m_pBackwardAction->setText(tr("Backward"));
     345        m_pBackwardAction->setToolTip(tr("Navigate to previous page"));
     346    }
     347
     348    if (m_pForwardAction)
     349    {
     350        m_pForwardAction->setText(tr("Forward"));
     351        m_pForwardAction->setToolTip(tr("Navigate to next page"));
     352    }
    314353}
    315354
     
    395434}
    396435
    397 void sltHandleGoHomeAction();
     436void sltHandleHomeAction();
    398437
    399438void UIHelpBrowserWidget::sltHandleContentWidgetItemClicked(const QModelIndex &index)
     
    445484}
    446485
    447 void UIHelpBrowserWidget::sltHandleGoHomeAction()
     486void UIHelpBrowserWidget::sltHandleHomeAction()
    448487{
    449488    if (!m_pContentViewer)
     
    456495}
    457496
     497void UIHelpBrowserWidget::sltHandleForwardAction()
     498{
     499    if (m_pContentViewer)
     500        m_pContentViewer->forward();
     501}
     502
     503void UIHelpBrowserWidget::sltHandleBackwardAction()
     504{
     505    if (m_pContentViewer)
     506        m_pContentViewer->backward();
     507}
     508
     509void UIHelpBrowserWidget::sltHandleForwardAvailable(bool fAvailable)
     510{
     511    if (m_pForwardAction)
     512        m_pForwardAction->setEnabled(fAvailable);
     513}
     514
     515void UIHelpBrowserWidget::sltHandleBackwardAvailable(bool fAvailable)
     516{
     517    if (m_pBackwardAction)
     518        m_pBackwardAction->setEnabled(fAvailable);
     519}
     520
    458521#include "UIHelpBrowserWidget.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r86724 r86735  
    8383    void sltHandleHelpBrowserViewerSourceChange(const QUrl &source);
    8484    void sltHandleContentsCreated();
    85     void sltHandleGoHomeAction();
     85    void sltHandleHomeAction();
     86    void sltHandleForwardAction();
     87    void sltHandleBackwardAction();
     88    void sltHandleForwardAvailable(bool fAvailable);
     89    void sltHandleBackwardAvailable(bool fAvailable);
    8690
    8791private:
     
    139143    QWidget             *m_pBookmarksWidget;
    140144    QAction             *m_pShowHideTabWidgetAction;
    141     QAction             *m_pGoHomeAction;
     145    QAction             *m_pHomeAction;
     146    QAction             *m_pForwardAction;
     147    QAction             *m_pBackwardAction;
    142148    QString              m_strPageNotFoundText;
    143149    /* This is set t true when handling QHelpContentModel::contentsCreated signal. */
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