VirtualBox

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


Ignore:
Timestamp:
Nov 3, 2020 11:21:51 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Some refactoring

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

Legend:

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

    r86764 r86791  
    239239
    240240/* Help Browser */
    241 const char *UIExtraDataDefs::GUI_HelpBrowserLastURL = "GUI/HelpBrowserLastURL";
     241const char *UIExtraDataDefs::GUI_HelpBrowserLastURLList = "GUI/HelpBrowserLastURLList";
    242242const char *UIExtraDataDefs::GUI_HelpBrowserDialogGeometry = "GUI/HelpBrowserDialogGeomety";
    243243
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r86764 r86791  
    438438    /** @name Help Browser
    439439      * @{ */
    440         SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserLastURL;
     440        SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserLastURLList;
    441441        SHARED_LIBRARY_STUFF extern const char *GUI_HelpBrowserDialogGeometry;
    442442    /** @} */
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r86764 r86791  
    19821982           << GUI_ExtraDataManager_Geometry << GUI_ExtraDataManager_SplitterHints
    19831983           << GUI_LogWindowGeometry
    1984            << GUI_HelpBrowserLastURL
     1984           << GUI_HelpBrowserLastURLList
    19851985           << GUI_HelpBrowserDialogGeometry;
    19861986}
     
    45944594}
    45954595
    4596 void UIExtraDataManager::setHelpBrowserLastUrl(const QString &url)
    4597 {
    4598     setExtraDataString(GUI_HelpBrowserLastURL, url);
    4599 }
    4600 
    4601 QString UIExtraDataManager::helpBrowserLastUrl()
    4602 {
    4603     return extraDataString(GUI_HelpBrowserLastURL);
     4596void UIExtraDataManager::setHelpBrowserLastUrlList(const QStringList &urlList)
     4597{
     4598    setExtraDataStringList(GUI_HelpBrowserLastURLList, urlList);
     4599}
     4600
     4601QStringList UIExtraDataManager::helpBrowserLastUrlList()
     4602{
     4603    return extraDataStringList(GUI_HelpBrowserLastURLList);
    46044604}
    46054605
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r86764 r86791  
    787787    /** @name Help Browser
    788788      * @{ */
    789         void setHelpBrowserLastUrl(const QString &url);
    790         QString helpBrowserLastUrl();
     789        void setHelpBrowserLastUrlList(const QStringList &urlList);
     790        QStringList helpBrowserLastUrlList();
    791791        QRect helpBrowserDialogGeometry(QWidget *pWidget, QWidget *pParentWidget, const QRect &defaultGeometry);
    792792        void setHelpBrowserDialogGeometry(const QRect &geometry, bool fMaximized);
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserDialog.cpp

    r86764 r86791  
    6767void UIHelpBrowserDialog::retranslateUi()
    6868{
     69#if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    6970    setWindowTitle(UIHelpBrowserWidget::tr("User Manual"));
    70 
    71     /* Translate buttons: */
    7271    button(ButtonType_Close)->setText(UIHelpBrowserWidget::tr("Close"));
     72#endif
    7373}
    7474
     
    8181void UIHelpBrowserDialog::configureCentralWidget()
    8282{
    83     /* Create widget: */
    84     UIHelpBrowserWidget *pWidget = 0;
    85 
    86 #ifdef RT_OS_LINUX
    87     pWidget = new UIHelpBrowserWidget(EmbedTo_Dialog, m_strHelpFilePath, true /* show toolbar */, this);
    88 #endif
    89 
     83#if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
     84    UIHelpBrowserWidget *pWidget = new UIHelpBrowserWidget(EmbedTo_Dialog, m_strHelpFilePath, true /* show toolbar */, this);
    9085    if (pWidget)
    9186    {
     
    10297        centralWidget()->layout()->addWidget(pWidget);
    10398    }
     99#endif
    104100}
    105101
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r86781 r86791  
    4949#include "UIMessageCenter.h"
    5050#include "UIHelpBrowserWidget.h"
     51#include "QITabWidget.h"
    5152#include "QIToolBar.h"
    5253#include "UICommon.h"
     
    5556/* COM includes: */
    5657#include "CSystemProperties.h"
     58
     59#if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    5760
    5861enum HelpBrowserTabs
     
    6669Q_DECLARE_METATYPE(HelpBrowserTabs);
    6770
    68 class UIHelpBrowserAddressBar : public QComboBox
    69 {
    70     Q_OBJECT;
    71 
    72 public:
    73     UIHelpBrowserAddressBar(QWidget *pParent = 0);
    74 
    75 };
     71
     72/*********************************************************************************************************************************
     73*   UIHelpBrowserViewer definition.                                                                                        *
     74*********************************************************************************************************************************/
    7675
    7776class UIHelpBrowserViewer : public QTextBrowser
     
    9190private:
    9291
    93 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    9492    const QHelpEngine* m_pHelpEngine;
    95 #endif
    9693};
    9794
    98 UIHelpBrowserAddressBar::UIHelpBrowserAddressBar(QWidget *pParent /* = 0 */)
    99     :QComboBox(pParent)
    100 {
    101 }
     95/*********************************************************************************************************************************
     96*   UIHelpBrowserTab definition.                                                                                        *
     97*********************************************************************************************************************************/
     98
     99class UIHelpBrowserTab : public QWidget
     100{
     101    Q_OBJECT;
     102
     103signals:
     104
     105    void sigSourceChanged(const QUrl &url);
     106
     107public:
     108
     109    UIHelpBrowserTab(const QHelpEngine  *pHelpEngine, const QUrl &homeUrl,
     110                     const QUrl &initialUrl, QWidget *pParent = 0);
     111
     112    QUrl source() const;
     113    void setSource(const QUrl &url);
     114
     115private slots:
     116
     117    void sltHandleHomeAction();
     118    void sltHandleForwardAction();
     119    void sltHandleBackwardAction();
     120    void sltHandleHistoryChanged();
     121    void sltHandleAddressBarIndexChanged(int index);
     122    void sltHandleAddBookmarkAction();
     123    void sltAnchorClicked(const QUrl &link);
     124
     125private:
     126
     127    void prepare(const QUrl &initialUrl);
     128    void prepareWidgets(const QUrl &initialUrl);
     129    void prepareToolBarAndAddressBar();
     130    virtual void retranslateUi() /* override */;
     131
     132    QAction     *m_pHomeAction;
     133    QAction     *m_pForwardAction;
     134    QAction     *m_pBackwardAction;
     135    QAction     *m_pAddBookmarkAction;
     136
     137    QVBoxLayout *m_pMainLayout;
     138    QIToolBar   *m_pToolBar;
     139    QComboBox *m_pAddressBar;
     140    UIHelpBrowserViewer *m_pContentViewer;
     141    const QHelpEngine* m_pHelpEngine;
     142    QString              m_strPageNotFoundText;
     143    QUrl m_homeUrl;
     144};
     145
     146
     147/*********************************************************************************************************************************
     148*   UIHelpBrowserTabManager definition.                                                                                          *
     149*********************************************************************************************************************************/
     150
     151class UIHelpBrowserTabManager : public QITabWidget
     152{
     153    Q_OBJECT;
     154
     155public:
     156
     157    UIHelpBrowserTabManager(const QHelpEngine  *pHelpEngine, const QUrl &homeUrl,
     158                            const QStringList &urlList, QWidget *pParent = 0);
     159    QStringList tabUrlList() const;
     160    void initilizeTabs();
     161    /* Url of the current tab. */
     162    QUrl currentSource() const;
     163    void setCurrentSource(const QUrl &url);
     164    /* Return the list of urls of all open tabs as QStringList. */
     165    QStringList tabUrlList();
     166
     167private:
     168
     169    void prepare();
     170    void clearAndDeleteTabs();
     171    const QHelpEngine* m_pHelpEngine;
     172    QUrl m_homeUrl;
     173    QStringList m_savedUrlList;
     174};
     175
     176/*********************************************************************************************************************************
     177*   UIHelpBrowserTab implementation.                                                                                        *
     178*********************************************************************************************************************************/
     179
     180UIHelpBrowserTab::UIHelpBrowserTab(const QHelpEngine  *pHelpEngine, const QUrl &homeUrl,
     181                                   const QUrl &initialUrl, QWidget *pParent /* = 0 */)
     182    :QWidget(pParent)
     183    , m_pHomeAction(0)
     184    , m_pForwardAction(0)
     185    , m_pBackwardAction(0)
     186    , m_pAddBookmarkAction(0)
     187    , m_pMainLayout(0)
     188    , m_pToolBar(0)
     189    , m_pAddressBar(0)
     190    , m_pContentViewer(0)
     191    , m_pHelpEngine(pHelpEngine)
     192    , m_homeUrl(homeUrl)
     193{
     194    if (initialUrl.isValid())
     195        prepare(initialUrl);
     196    else
     197        prepare(m_homeUrl);
     198}
     199
     200QUrl UIHelpBrowserTab::source() const
     201{
     202    if (!m_pContentViewer)
     203        return QUrl();
     204    return m_pContentViewer->source();
     205}
     206
     207void UIHelpBrowserTab::setSource(const QUrl &url)
     208{
     209    if (m_pContentViewer)
     210    {
     211        m_pContentViewer->blockSignals(true);
     212        m_pContentViewer->setSource(url);
     213        m_pContentViewer->blockSignals(false);
     214        /* emit historyChanged signal explicitly since we have blocked the signals: */
     215        m_pContentViewer->emitHistoryChangedSignal();
     216    }
     217}
     218
     219void UIHelpBrowserTab::prepare(const QUrl &initialUrl)
     220{
     221    m_pMainLayout = new QVBoxLayout(this);
     222    AssertReturnVoid(m_pMainLayout);
     223    prepareToolBarAndAddressBar();
     224    prepareWidgets(initialUrl);
     225}
     226
     227void UIHelpBrowserTab::prepareWidgets(const QUrl &initialUrl)
     228{
     229    m_pContentViewer = new UIHelpBrowserViewer(m_pHelpEngine);
     230    AssertReturnVoid(m_pContentViewer);
     231    m_pMainLayout->setContentsMargins(0, 0, 0, 0);
     232    m_pMainLayout->setSpacing(0);
     233
     234    m_pMainLayout->addWidget(m_pContentViewer);
     235    m_pContentViewer->setOpenExternalLinks(false);
     236
     237    connect(m_pContentViewer, &UIHelpBrowserViewer::sourceChanged,
     238        this, &UIHelpBrowserTab::sigSourceChanged);
     239    connect(m_pContentViewer, &UIHelpBrowserViewer::historyChanged,
     240        this, &UIHelpBrowserTab::sltHandleHistoryChanged);
     241    connect(m_pContentViewer, &UIHelpBrowserViewer::anchorClicked,
     242        this, &UIHelpBrowserTab::sltAnchorClicked);
     243
     244    m_pContentViewer->setSource(initialUrl);
     245}
     246
     247void UIHelpBrowserTab::prepareToolBarAndAddressBar()
     248{
     249    m_pHomeAction =
     250        new QAction(UIIconPool::iconSet(":/help_browser_home_32px.png"), QString(), this);
     251    m_pForwardAction =
     252        new QAction(UIIconPool::iconSet(":/help_browser_forward_32px.png", ":/help_browser_forward_disabled_32px.png"), QString(), this);
     253    m_pBackwardAction =
     254        new QAction(UIIconPool::iconSet(":/help_browser_backward_32px.png", ":/help_browser_backward_disabled_32px.png"), QString(), this);
     255    m_pAddBookmarkAction =
     256        new QAction(UIIconPool::iconSet(":/help_browser_add_bookmark.png"), QString(), this);
     257
     258    connect(m_pHomeAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleHomeAction);
     259    connect(m_pBackwardAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleAddBookmarkAction);
     260    connect(m_pForwardAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleForwardAction);
     261    connect(m_pBackwardAction, &QAction::triggered, this, &UIHelpBrowserTab::sltHandleBackwardAction);
     262    AssertReturnVoid(m_pHomeAction && m_pForwardAction && m_pBackwardAction && m_pAddBookmarkAction);
     263    m_pForwardAction->setEnabled(false);
     264    m_pBackwardAction->setEnabled(false);
     265
     266    m_pToolBar = new QIToolBar;
     267    AssertReturnVoid(m_pToolBar);
     268    m_pToolBar->addAction(m_pBackwardAction);
     269    m_pToolBar->addAction(m_pForwardAction);
     270    m_pToolBar->addAction(m_pHomeAction);
     271    m_pToolBar->addAction(m_pAddBookmarkAction);
     272
     273    m_pAddressBar = new QComboBox();
     274    m_pAddressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
     275    connect(m_pAddressBar, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     276            this, &UIHelpBrowserTab::sltHandleAddressBarIndexChanged);
     277
     278
     279    QHBoxLayout *pTopLayout = new QHBoxLayout;
     280    pTopLayout->addWidget(m_pToolBar);
     281    pTopLayout->addWidget(m_pAddressBar);
     282    m_pMainLayout->addLayout(pTopLayout);
     283}
     284
     285void UIHelpBrowserTab::retranslateUi()
     286{
     287    m_strPageNotFoundText = tr("<div><p><h3>404. Not found.</h3>The page <b>%1</b> could not be found.</p></div>");
     288
     289    if (m_pHomeAction)
     290    {
     291        m_pHomeAction->setText(tr("Home"));
     292        m_pHomeAction->setToolTip(tr("Return to start page"));
     293    }
     294
     295    if (m_pBackwardAction)
     296    {
     297        m_pBackwardAction->setText(tr("Backward"));
     298        m_pBackwardAction->setToolTip(tr("Navigate to previous page"));
     299    }
     300
     301    if (m_pForwardAction)
     302    {
     303        m_pForwardAction->setText(tr("Forward"));
     304        m_pForwardAction->setToolTip(tr("Navigate to next page"));
     305    }
     306}
     307
     308
     309void UIHelpBrowserTab::sltHandleHomeAction()
     310{
     311    if (!m_pContentViewer)
     312        return;
     313    if (m_homeUrl.isValid())
     314        m_pContentViewer->setSource(m_homeUrl);
     315}
     316
     317void UIHelpBrowserTab::sltHandleForwardAction()
     318{
     319    if (m_pContentViewer)
     320        m_pContentViewer->forward();
     321}
     322
     323void UIHelpBrowserTab::sltHandleBackwardAction()
     324{
     325    if (m_pContentViewer)
     326        m_pContentViewer->backward();
     327}
     328
     329void UIHelpBrowserTab::sltHandleHistoryChanged()
     330{
     331    if (!m_pContentViewer)
     332        return;
     333    int iCurrentIndex = 0;
     334    /* QTextBrower history has negative and positive indices for bacward and forward items, respectively.
     335     * 0 is the current item: */
     336    m_pAddressBar->blockSignals(true);
     337    m_pAddressBar->clear();
     338    for (int i = -1 * m_pContentViewer->backwardHistoryCount(); i <= m_pContentViewer->forwardHistoryCount(); ++i)
     339    {
     340        QString strItem = QString("%1 (%2)").arg(m_pContentViewer->historyTitle(i)).arg(m_pContentViewer->historyUrl(i).toString());
     341        m_pAddressBar->addItem(strItem, i);
     342        if (i == 0)
     343            iCurrentIndex = m_pAddressBar->count();
     344    }
     345    /* Make sure address bar show the current item: */
     346    m_pAddressBar->setCurrentIndex(iCurrentIndex - 1);
     347    m_pAddressBar->blockSignals(false);
     348
     349    if (m_pBackwardAction)
     350        m_pBackwardAction->setEnabled(m_pContentViewer->isBackwardAvailable());
     351    if (m_pForwardAction)
     352        m_pForwardAction->setEnabled(m_pContentViewer->isForwardAvailable());
     353
     354}
     355
     356void UIHelpBrowserTab::sltHandleAddressBarIndexChanged(int iIndex)
     357{
     358    if (!m_pAddressBar && iIndex >= m_pAddressBar->count())
     359        return;
     360    int iHistoryIndex = m_pAddressBar->itemData(iIndex).toInt();
     361    /* There seems to be no way to one-step-jump to a history item: */
     362    if (iHistoryIndex == 0)
     363        return;
     364    else if (iHistoryIndex > 0)
     365        for (int i = 0; i < iHistoryIndex; ++i)
     366            m_pContentViewer->forward();
     367    else
     368        for (int i = 0; i > iHistoryIndex ; --i)
     369            m_pContentViewer->backward();
     370}
     371
     372void UIHelpBrowserTab::sltHandleAddBookmarkAction()
     373{
     374}
     375
     376
     377void UIHelpBrowserTab::sltAnchorClicked(const QUrl &link)
     378{
     379    Q_UNUSED(link);
     380}
     381
     382
     383/*********************************************************************************************************************************
     384*   UIHelpBrowserViewer implementation.                                                                                          *
     385*********************************************************************************************************************************/
    102386
    103387UIHelpBrowserViewer::UIHelpBrowserViewer(const QHelpEngine *pHelpEngine, QWidget *pParent /* = 0 */)
    104388    :QTextBrowser(pParent)
    105 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    106389    , m_pHelpEngine(pHelpEngine)
    107 #endif
    108 {
    109 #if !defined(RT_OS_LINUX) || !defined(VBOX_WITH_DOCS_QHELP) || !(QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
     390{
    110391    Q_UNUSED(pHelpEngine);
    111 #endif
    112392}
    113393
    114394QVariant UIHelpBrowserViewer::loadResource(int type, const QUrl &name)
    115395{
    116 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    117396    if (name.scheme() == "qthelp" && m_pHelpEngine)
    118397        return QVariant(m_pHelpEngine->fileData(name));
    119398    else
    120399        return QTextBrowser::loadResource(type, name);
    121 #else
    122     return QTextBrowser::loadResource(type, name);
    123 #endif
    124400}
    125401
     
    129405    emit backwardAvailable(true);
    130406}
     407
     408
     409/*********************************************************************************************************************************
     410*   UIHelpBrowserTabManager definition.                                                                                          *
     411*********************************************************************************************************************************/
     412
     413UIHelpBrowserTabManager::UIHelpBrowserTabManager(const QHelpEngine  *pHelpEngine, const QUrl &homeUrl,
     414                                                 const QStringList &urlList, QWidget *pParent /* = 0 */)
     415    : QITabWidget(pParent)
     416    , m_pHelpEngine(pHelpEngine)
     417    , m_homeUrl(homeUrl)
     418    , m_savedUrlList(urlList)
     419{
     420    prepare();
     421}
     422
     423void UIHelpBrowserTabManager::initilizeTabs()
     424{
     425    clearAndDeleteTabs();
     426    /* Add a single tab with m_homeUrl: */
     427    if (m_savedUrlList.isEmpty())
     428    {
     429        addTab(new  UIHelpBrowserTab(m_pHelpEngine, m_homeUrl, QUrl()), QString());
     430    }
     431    else
     432    {
     433        addTab(new  UIHelpBrowserTab(m_pHelpEngine, m_homeUrl, m_savedUrlList[0]), QString());
     434
     435    }
     436}
     437
     438QUrl UIHelpBrowserTabManager::currentSource() const
     439{
     440    UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget());
     441    if (!pTab)
     442        return QUrl();
     443    return pTab->source();
     444}
     445
     446void UIHelpBrowserTabManager::setCurrentSource(const QUrl &url)
     447{
     448    UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget());
     449    if (!pTab)
     450        return;
     451    pTab->setSource(url);
     452}
     453
     454QStringList UIHelpBrowserTabManager::tabUrlList()
     455{
     456    QStringList list;
     457    for (int i = 0; i < count(); ++i)
     458    {
     459        UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget());
     460        if (!pTab || !pTab->source().isValid())
     461            continue;
     462        list << pTab->source().toString();
     463    }
     464    return list;
     465}
     466
     467void UIHelpBrowserTabManager::prepare()
     468{
     469    setTabsClosable(true);
     470    //setTabBarAutoHide(true);
     471}
     472
     473void UIHelpBrowserTabManager::clearAndDeleteTabs()
     474{
     475    QList<QWidget*> tabList;
     476    for (int i = 0; i < count(); ++i)
     477        tabList << widget(i);
     478    /* QTabWidget::clear() does not delete tab widgets: */
     479    clear();
     480    foreach (QWidget *pWidget, tabList)
     481        delete pWidget;
     482}
     483
     484
     485/*********************************************************************************************************************************
     486*   UIHelpBrowserWidget implementation.                                                                                          *
     487*********************************************************************************************************************************/
    131488
    132489UIHelpBrowserWidget::UIHelpBrowserWidget(EmbedTo enmEmbedding,
     
    143500    , m_pToolBar(0)
    144501    , m_strHelpFilePath(strHelpFilePath)
    145 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    146502    , m_pHelpEngine(0)
    147 #endif
    148     , m_pAddressBar(0)
    149     , m_pContentViewer(0)
    150503    , m_pSplitter(0)
    151504    , m_pMenu(0)
     
    153506    , m_pIndexWidget(0)
    154507    , m_pContentModel(0)
    155     , m_pHelpSearchEngine(0)
    156     , m_pHelpSearchQueryWidget(0)
    157     , m_pHelpSearchResultWidget(0)
     508    , m_pSearchEngine(0)
     509    , m_pSearchQueryWidget(0)
     510    , m_pSearchResultWidget(0)
     511    , m_pTabManager(0)
    158512    , m_pBookmarksWidget(0)
    159513    , m_pSearchContainerWidget(0)
    160514    , m_pShowHideSideBarAction(0)
    161515    , m_pShowHideToolBarAction(0)
    162     , m_pHomeAction(0)
    163     , m_pForwardAction(0)
    164     , m_pBackwardAction(0)
    165     , m_pAddBookmarkAction(0)
    166516    , m_fModelContentCreated(false)
    167517{
     
    195545
    196546    prepareActions();
    197     prepareToolBar();
     547    //prepareToolBar();
    198548    prepareWidgets();
    199549    prepareSearchWidgets();
     
    215565
    216566
    217     m_pHomeAction =
    218         new QAction(UIIconPool::iconSet(":/help_browser_home_32px.png"), QString(), this);
    219     connect(m_pHomeAction, &QAction::triggered, this, &UIHelpBrowserWidget::sltHandleHomeAction);
    220 
    221     m_pForwardAction =
    222         new QAction(UIIconPool::iconSet(":/help_browser_forward_32px.png", ":/help_browser_forward_disabled_32px.png"), QString(), this);
    223     connect(m_pForwardAction, &QAction::triggered, this, &UIHelpBrowserWidget::sltHandleForwardAction);
    224     sltHandleForwardAvailable(false);
    225 
    226     m_pBackwardAction =
    227         new QAction(UIIconPool::iconSet(":/help_browser_backward_32px.png", ":/help_browser_backward_disabled_32px.png"), QString(), this);
    228     connect(m_pBackwardAction, &QAction::triggered, this, &UIHelpBrowserWidget::sltHandleBackwardAction);
    229     sltHandleBackwardAvailable(false);
    230 
    231     m_pAddBookmarkAction =
    232         new QAction(UIIconPool::iconSet(":/help_browser_add_bookmark.png"), QString(), this);
    233     connect(m_pBackwardAction, &QAction::triggered, this, &UIHelpBrowserWidget::sltHandleAddBookmarkAction);
    234567}
    235568
     
    240573
    241574    m_pMainLayout->addWidget(m_pSplitter);
    242 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    243575    m_pHelpEngine = new QHelpEngine(m_strHelpFilePath, this);
    244576    m_pBookmarksWidget = new QWidget(this);
    245577    m_pTabWidget = new QITabWidget;
     578    m_pTabManager = new UIHelpBrowserTabManager(m_pHelpEngine, findIndexHtml(), loadSavedUrlList());
     579
    246580    AssertReturnVoid(m_pTabWidget &&
    247581                     m_pHelpEngine &&
    248                      m_pBookmarksWidget);
     582                     m_pBookmarksWidget &&
     583                     m_pTabManager);
    249584
    250585    m_pContentWidget = m_pHelpEngine->contentWidget();
     
    259594    m_pTabWidget->insertTab(HelpBrowserTabs_Bookmarks, m_pBookmarksWidget, QString());
    260595
    261     m_pContentViewer = new UIHelpBrowserViewer(m_pHelpEngine);
    262     AssertReturnVoid(m_pContentViewer);
    263 
    264     m_pContentViewer->setOpenExternalLinks(false);
    265 
    266     connect(m_pContentViewer, &UIHelpBrowserViewer::sourceChanged,
    267         this, &UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange);
    268     connect(m_pContentViewer, &UIHelpBrowserViewer::forwardAvailable,
    269         this, &UIHelpBrowserWidget::sltHandleForwardAvailable);
    270     connect(m_pContentViewer, &UIHelpBrowserViewer::backwardAvailable,
    271         this, &UIHelpBrowserWidget::sltHandleBackwardAvailable);
    272     connect(m_pContentViewer, &UIHelpBrowserViewer::sourceChanged,
    273         this, &UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange);
    274     connect(m_pContentViewer, &UIHelpBrowserViewer::historyChanged,
    275         this, &UIHelpBrowserWidget::sltHandleHistoryChanged);
    276     connect(m_pContentViewer, &UIHelpBrowserViewer::anchorClicked,
    277         this, &UIHelpBrowserWidget::sltAnchorClicked);
    278 
    279 
    280     m_pSplitter->addWidget(m_pContentViewer);
     596    m_pSplitter->addWidget(m_pTabManager);
    281597
    282598    m_pSplitter->setStretchFactor(0, 1);
     
    286602    connect(m_pHelpEngine, &QHelpEngine::setupFinished,
    287603            this, &UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished);
    288     connect(m_pContentWidget, &QHelpContentWidget::linkActivated,
    289             m_pContentViewer, &UIHelpBrowserViewer::setSource);
     604    // connect(m_pContentWidget, &QHelpContentWidget::linkActivated,
     605    //         m_pContentViewer, &UIHelpBrowserViewer::setSource);
    290606    connect(m_pContentWidget, &QHelpContentWidget::clicked,
    291607            this, &UIHelpBrowserWidget::sltHandleContentWidgetItemClicked);
    292     connect(m_pIndexWidget, &QHelpIndexWidget::linkActivated,
    293             m_pContentViewer, &UIHelpBrowserViewer::setSource);
     608    // connect(m_pIndexWidget, &QHelpIndexWidget::linkActivated,
     609    //         m_pContentViewer, &UIHelpBrowserViewer::setSource);
    294610    connect(m_pContentModel, &QHelpContentModel::contentsCreated,
    295611            this, &UIHelpBrowserWidget::sltHandleContentsCreated);
     
    297613    if (QFile(m_strHelpFilePath).exists() && m_pHelpEngine)
    298614        m_pHelpEngine->setupData();
    299 #endif
    300615}
    301616
    302617void UIHelpBrowserWidget::prepareSearchWidgets()
    303618{
    304 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    305 # if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
    306 
    307619    AssertReturnVoid(m_pTabWidget && m_pHelpEngine);
    308620
     
    310622    m_pTabWidget->insertTab(HelpBrowserTabs_Search, m_pSearchContainerWidget, QString());
    311623
    312     m_pHelpSearchEngine = m_pHelpEngine->searchEngine();
    313     AssertReturnVoid(m_pHelpSearchEngine);
    314 
    315     m_pHelpSearchQueryWidget = m_pHelpSearchEngine->queryWidget();
    316     m_pHelpSearchResultWidget = m_pHelpSearchEngine->resultWidget();
    317     AssertReturnVoid(m_pHelpSearchQueryWidget && m_pHelpSearchResultWidget);
     624    m_pSearchEngine = m_pHelpEngine->searchEngine();
     625    AssertReturnVoid(m_pSearchEngine);
     626
     627    m_pSearchQueryWidget = m_pSearchEngine->queryWidget();
     628    m_pSearchResultWidget = m_pSearchEngine->resultWidget();
     629    AssertReturnVoid(m_pSearchQueryWidget && m_pSearchResultWidget);
    318630
    319631    QVBoxLayout *pSearchLayout = new QVBoxLayout(m_pSearchContainerWidget);
    320     pSearchLayout->addWidget(m_pHelpSearchQueryWidget);
    321     pSearchLayout->addWidget(m_pHelpSearchResultWidget);
    322     m_pHelpSearchQueryWidget->expandExtendedSearch();
    323 
    324     connect(m_pHelpSearchQueryWidget, &QHelpSearchQueryWidget::search,
     632    pSearchLayout->addWidget(m_pSearchQueryWidget);
     633    pSearchLayout->addWidget(m_pSearchResultWidget);
     634    m_pSearchQueryWidget->expandExtendedSearch();
     635
     636    connect(m_pSearchQueryWidget, &QHelpSearchQueryWidget::search,
    325637            this, &UIHelpBrowserWidget::sltHandleSearchStart);
    326     connect(m_pHelpSearchResultWidget, &QHelpSearchResultWidget::requestShowLink,
    327             m_pContentViewer, &UIHelpBrowserViewer::setSource);
     638    // connect(m_pSearchResultWidget, &QHelpSearchResultWidget::requestShowLink,
     639    //         m_pContentViewer, &UIHelpBrowserViewer::setSource);
    328640
    329641    // connect(searchEngine, &QHelpSearchEngine::searchingStarted,
     
    333645
    334646
    335     connect(m_pHelpSearchEngine, &QHelpSearchEngine::indexingStarted,
     647    connect(m_pSearchEngine, &QHelpSearchEngine::indexingStarted,
    336648            this, &UIHelpBrowserWidget::sltHandleIndexingStarted);
    337     connect(m_pHelpSearchEngine, &QHelpSearchEngine::indexingFinished,
     649    connect(m_pSearchEngine, &QHelpSearchEngine::indexingFinished,
    338650            this, &UIHelpBrowserWidget::sltHandleIndexingFinished);
    339651
    340     connect(m_pHelpSearchEngine, &QHelpSearchEngine::searchingStarted,
     652    connect(m_pSearchEngine, &QHelpSearchEngine::searchingStarted,
    341653            this, &UIHelpBrowserWidget::sltHandleSearchingStarted);
    342654
    343     m_pHelpSearchEngine->reindexDocumentation();
    344 # endif//if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
    345 #endif
     655    m_pSearchEngine->reindexDocumentation();
    346656}
    347657
     
    357667        const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize));
    358668        m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
    359         m_pToolBar->addAction(m_pBackwardAction);
    360         m_pToolBar->addAction(m_pForwardAction);
    361         m_pToolBar->addAction(m_pHomeAction);
    362         m_pToolBar->addAction(m_pAddBookmarkAction);
     669        // m_pToolBar->addAction(m_pBackwardAction);
     670        // m_pToolBar->addAction(m_pForwardAction);
     671        // m_pToolBar->addAction(m_pHomeAction);
     672        // m_pToolBar->addAction(m_pAddBookmarkAction);
    363673
    364674#ifdef VBOX_WS_MAC
     
    376686#endif
    377687    }
    378     m_pAddressBar = new UIHelpBrowserAddressBar();
    379     m_pAddressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    380     m_pTopLayout->addWidget(m_pAddressBar);
    381     connect(m_pAddressBar, static_cast<void(UIHelpBrowserAddressBar::*)(int)>(&UIHelpBrowserAddressBar::currentIndexChanged),
    382             this, &UIHelpBrowserWidget::sltHandleAddressBarIndexChanged);
    383 
    384     //m_pTopLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed));
    385688}
    386689
     
    397700void UIHelpBrowserWidget::loadOptions()
    398701{
    399 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    400     if (m_pContentViewer && m_pHelpEngine)
    401     {
    402         QUrl url(gEDataManager->helpBrowserLastUrl());
    403         if (url.isEmpty())
    404             return;
    405         if (url.isValid())
     702    // if (m_pContentViewer && m_pHelpEngine)
     703    // {
     704    //     QUrl url(gEDataManager->helpBrowserLastUrl());
     705    //     if (url.isEmpty())
     706    //         return;
     707    //     if (url.isValid())
     708    //     {
     709    //         if (m_pHelpEngine->findFile(url).isValid())
     710    //         {
     711    //             m_pContentViewer->setSource(url);
     712    //             m_pContentViewer->clearHistory();
     713    //         }
     714    //         else
     715    //             show404Error(url);
     716    //     }
     717    // }
     718}
     719
     720QStringList UIHelpBrowserWidget::loadSavedUrlList()
     721{
     722    return gEDataManager->helpBrowserLastUrlList();
     723}
     724
     725void UIHelpBrowserWidget::saveOptions()
     726{
     727    if (m_pTabManager)
     728        gEDataManager->setHelpBrowserLastUrlList(m_pTabManager->tabUrlList());
     729}
     730
     731QUrl UIHelpBrowserWidget::findIndexHtml() const
     732{
     733    QList<QUrl> files = m_pHelpEngine->files(m_pHelpEngine->namespaceName(m_strHelpFilePath), QStringList());
     734    int iIndex = -1;
     735    for (int i = 0; i < files.size(); ++i)
     736    {
     737        if (files[i].toString().contains("index.html", Qt::CaseInsensitive))
    406738        {
    407             if (m_pHelpEngine->findFile(url).isValid())
     739            iIndex = i;
     740            break;
     741        }
     742    }
     743    if (iIndex == -1)
     744    {
     745        /* If index html/htm could not be found try to find a html file at least: */
     746        for (int i = 0; i < files.size(); ++i)
     747        {
     748            if (files[i].toString().contains(".html", Qt::CaseInsensitive) ||
     749                files[i].toString().contains(".htm", Qt::CaseInsensitive))
    408750            {
    409                 m_pContentViewer->setSource(url);
    410                 m_pContentViewer->clearHistory();
     751                iIndex = i;
     752                break;
    411753            }
    412             else
    413                 show404Error(url);
    414754        }
    415755    }
    416 #endif
    417 }
    418 
    419 void UIHelpBrowserWidget::saveOptions()
    420 {
    421     if (m_pContentViewer)
    422     {
    423         gEDataManager->setHelpBrowserLastUrl(m_pContentViewer->source().toString());
    424     }
     756    if (iIndex != -1 && files.size() > iIndex)
     757        return files[iIndex];
     758    else
     759        return QUrl();
    425760}
    426761
     
    455790    if (m_pShowHideToolBarAction)
    456791        m_pShowHideToolBarAction->setText(tr("Show/Hide Tool Bar"));
    457 
    458     m_strPageNotFoundText = tr("<div><p><h3>404. Not found.</h3>The page <b>%1</b> could not be found.</p></div>");
    459 
    460     if (m_pHomeAction)
    461     {
    462         m_pHomeAction->setText(tr("Home"));
    463         m_pHomeAction->setToolTip(tr("Return to start page"));
    464     }
    465 
    466     if (m_pBackwardAction)
    467     {
    468         m_pBackwardAction->setText(tr("Backward"));
    469         m_pBackwardAction->setToolTip(tr("Navigate to previous page"));
    470     }
    471 
    472     if (m_pForwardAction)
    473     {
    474         m_pForwardAction->setText(tr("Forward"));
    475         m_pForwardAction->setToolTip(tr("Navigate to next page"));
    476     }
    477 }
     792}
     793
    478794
    479795void UIHelpBrowserWidget::showEvent(QShowEvent *pEvent)
     
    510826}
    511827
    512 QUrl UIHelpBrowserWidget::findIndexHtml() const
    513 {
    514 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    515     QList<QUrl> files = m_pHelpEngine->files(m_pHelpEngine->namespaceName(m_strHelpFilePath), QStringList());
    516     int iIndex = -1;
    517     for (int i = 0; i < files.size(); ++i)
    518     {
    519         if (files[i].toString().contains("index.html", Qt::CaseInsensitive))
    520         {
    521             iIndex = i;
    522             break;
    523         }
    524     }
    525     if (iIndex == -1)
    526     {
    527         /* If index html/htm could not be found try to find a html file at least: */
    528         for (int i = 0; i < files.size(); ++i)
    529         {
    530             if (files[i].toString().contains(".html", Qt::CaseInsensitive) ||
    531                 files[i].toString().contains(".htm", Qt::CaseInsensitive))
    532             {
    533                 iIndex = i;
    534                 break;
    535             }
    536         }
    537     }
    538     if (iIndex != -1 && files.size() > iIndex)
    539         return files[iIndex];
    540     return QUrl();
    541 #else
    542     return QUrl();
    543 #endif
    544 }
    545 
    546 void UIHelpBrowserWidget::show404Error(const QUrl &url)
    547 {
    548     if (m_pContentWidget)
    549         m_pContentViewer->setText(m_strPageNotFoundText.arg(url.toString()));
     828void UIHelpBrowserWidget::show404Error(const QUrl & /*url*/)
     829{
     830//     QList<QUrl> files = m_pHelpEngine->files(m_pHelpEngine->namespaceName(m_strHelpFilePath), QStringList());
     831//     int iIndex = -1;
     832//     for (int i = 0; i < files.size(); ++i)
     833//     {
     834//         if (files[i].toString().contains("index.html", Qt::CaseInsensitive))
     835//         {
     836//             iIndex = i;
     837//             break;
     838//         }
     839//     }
     840//     if (iIndex == -1)
     841//     {
     842//         /* If index html/htm could not be found try to find a html file at least: */
     843//         for (int i = 0; i < files.size(); ++i)
     844//         {
     845//             if (files[i].toString().contains(".html", Qt::CaseInsensitive) ||
     846//                 files[i].toString().contains(".htm", Qt::CaseInsensitive))
     847//             {
     848//                 iIndex = i;
     849//                 break;
     850//             }
     851//         }
     852//     }
     853//     if (iIndex != -1 && files.size() > iIndex)
     854//         return files[iIndex];
     855//     return QUrl();
     856// #else
     857//     return QUrl();
    550858}
    551859
    552860void UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished()
    553861{
    554 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    555     AssertReturnVoid(m_pContentViewer && m_pHelpEngine);
     862    AssertReturnVoid(m_pTabManager && m_pHelpEngine);
     863    m_pTabManager->initilizeTabs();
    556864    /* Search for the index of the index.htnl: */
    557     QUrl url = findIndexHtml();
    558     if (url.isValid())
    559         m_pContentViewer->setSource(url);
    560     else
    561         show404Error(url);
    562 #endif
    563 }
    564 
    565 void sltHandleHomeAction();
    566 
    567 void UIHelpBrowserWidget::sltHandleContentWidgetItemClicked(const QModelIndex &index)
    568 {
    569 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    570     AssertReturnVoid(m_pContentViewer && m_pHelpEngine && m_pContentWidget);
     865    // QUrl url = findIndexHtml();
     866    // if (url.isValid())
     867    //     m_pContentViewer->setSource(url);
     868    // else
     869    //     show404Error(url);
     870}
     871
     872
     873void UIHelpBrowserWidget::sltHandleContentWidgetItemClicked(const QModelIndex & index)
     874{
     875    AssertReturnVoid(m_pTabManager && m_pHelpEngine && m_pContentWidget);
    571876    QHelpContentModel *pContentModel =
    572877        qobject_cast<QHelpContentModel*>(m_pContentWidget->model());
     
    577882        return;
    578883    const QUrl &url = pItem->url();
    579     m_pContentViewer->blockSignals(true);
    580     m_pContentViewer->setSource(url);
    581     m_pContentViewer->blockSignals(false);
    582     /* emit historyChanged signal explicitly since we have blocked the signals: */
    583     m_pContentViewer->emitHistoryChangedSignal();
    584 #else
    585     Q_UNUSED(index);
    586 #endif
    587 }
     884    m_pTabManager->setCurrentSource(url);
     885}
     886
    588887
    589888void UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange(const QUrl &source)
    590889{
    591 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    592890    if (m_fModelContentCreated && m_pContentWidget && source.isValid() && m_pContentModel)
    593891    {
     
    603901        }
    604902    }
    605 #else
    606     Q_UNUSED(source);
    607 #endif
    608903}
    609904
     
    611906{
    612907    m_fModelContentCreated = true;
    613     if (m_pContentViewer)
    614         sltHandleHelpBrowserViewerSourceChange(m_pContentViewer->source());
    615 }
    616 
    617 void UIHelpBrowserWidget::sltHandleHomeAction()
    618 {
    619     if (!m_pContentViewer)
    620         return;
    621 
    622     QUrl homeUrl = findIndexHtml();
    623     if (!homeUrl.isValid())
    624         return;
    625     m_pContentViewer->setSource(homeUrl);
    626 }
    627 
    628 void UIHelpBrowserWidget::sltHandleForwardAction()
    629 {
    630     if (m_pContentViewer)
    631         m_pContentViewer->forward();
    632 }
    633 
    634 void UIHelpBrowserWidget::sltHandleBackwardAction()
    635 {
    636     if (m_pContentViewer)
    637         m_pContentViewer->backward();
    638 }
    639 
    640 void UIHelpBrowserWidget::sltHandleForwardAvailable(bool fAvailable)
    641 {
    642     if (m_pForwardAction)
    643         m_pForwardAction->setEnabled(fAvailable);
    644 }
    645 
    646 void UIHelpBrowserWidget::sltHandleBackwardAvailable(bool fAvailable)
    647 {
    648     if (m_pBackwardAction)
    649         m_pBackwardAction->setEnabled(fAvailable);
    650 }
    651 
    652 void UIHelpBrowserWidget::sltHandleHistoryChanged()
    653 {
    654     if (!m_pContentViewer)
    655         return;
    656     int iCurrentIndex = 0;
    657     /* QTextBrower history has negative and positive indices for bacward and forward items, respectively.
    658      * 0 is the current item: */
    659     m_pAddressBar->blockSignals(true);
    660     m_pAddressBar->clear();
    661     for (int i = -1 * m_pContentViewer->backwardHistoryCount(); i <= m_pContentViewer->forwardHistoryCount(); ++i)
    662     {
    663         QString strItem = QString("%1 (%2)").arg(m_pContentViewer->historyTitle(i)).arg(m_pContentViewer->historyUrl(i).toString());
    664         m_pAddressBar->addItem(strItem, i);
    665         if (i == 0)
    666             iCurrentIndex = m_pAddressBar->count();
    667     }
    668     /* Make sure address bar show the current item: */
    669     m_pAddressBar->setCurrentIndex(iCurrentIndex - 1);
    670     m_pAddressBar->blockSignals(false);
    671 }
    672 
    673 void UIHelpBrowserWidget::sltHandleAddressBarIndexChanged(int iIndex)
    674 {
    675     if (!m_pAddressBar && iIndex >= m_pAddressBar->count())
    676         return;
    677     int iHistoryIndex = m_pAddressBar->itemData(iIndex).toInt();
    678     /* There seems to be no way to one-step-jump to a history item: */
    679     if (iHistoryIndex == 0)
    680         return;
    681     else if (iHistoryIndex > 0)
    682         for (int i = 0; i < iHistoryIndex; ++i)
    683             m_pContentViewer->forward();
    684     else
    685         for (int i = 0; i > iHistoryIndex ; --i)
    686             m_pContentViewer->backward();
    687 
    688 }
    689 
    690 void UIHelpBrowserWidget::sltHandleAddBookmarkAction()
    691 {
     908    if (m_pTabManager)
     909        sltHandleHelpBrowserViewerSourceChange(m_pTabManager->currentSource());
    692910}
    693911
     
    714932void UIHelpBrowserWidget::sltHandleSearchStart()
    715933{
    716 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    717     AssertReturnVoid(m_pHelpSearchEngine && m_pHelpSearchQueryWidget);
    718     m_pHelpSearchEngine->search(m_pHelpSearchQueryWidget->searchInput());
    719 #endif
    720 }
    721 
    722 void UIHelpBrowserWidget::sltAnchorClicked(const QUrl &link)
    723 {
    724     Q_UNUSED(link);
    725 }
     934    AssertReturnVoid(m_pSearchEngine && m_pSearchQueryWidget);
     935    m_pSearchEngine->search(m_pSearchQueryWidget->searchInput());
     936}
     937
    726938
    727939#include "UIHelpBrowserWidget.moc"
     940
     941#endif /*#if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))*/
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r86781 r86791  
    5252class UIActionPool;
    5353class UIDialogPanel;
    54 class UIHelpBrowserAddressBar;
    55 class UIHelpBrowserViewer;
     54class UIHelpBrowserTabManager;
    5655
     56#if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    5757class SHARED_LIBRARY_STUFF UIHelpBrowserWidget  : public QIWithRetranslateUI<QWidget>
    5858{
     
    8787    void sltHandleSideBarVisibility(bool togggled);
    8888    void sltHandleToolBarVisibility(bool togggled);
    89     void sltHandleHelpBrowserViewerSourceChange(const QUrl &source);
    9089    void sltHandleContentsCreated();
    91     void sltHandleHomeAction();
    92     void sltHandleForwardAction();
    93     void sltHandleBackwardAction();
    94     void sltHandleForwardAvailable(bool fAvailable);
    95     void sltHandleBackwardAvailable(bool fAvailable);
    96     void sltHandleHistoryChanged();
    97     void sltHandleAddressBarIndexChanged(int index);
    98     void sltHandleAddBookmarkAction();
    9990    void sltHandleIndexingStarted();
    10091    void sltHandleIndexingFinished();
    10192    void sltHandleSearchingStarted();
    10293    void sltHandleSearchStart();
    103     void sltAnchorClicked(const QUrl &link);
     94    void sltHandleHelpBrowserViewerSourceChange(const QUrl &source);
     95
    10496private:
    10597
     
    111103    void prepareMenu();
    112104    void loadOptions();
    113 
     105    QStringList loadSavedUrlList();
    114106    void saveOptions();
    115107    void cleanup();
     
    117109    void show404Error(const QUrl &url);
    118110    /** @name Event handling stuff.
    119       * @{ */
    120         /** Handles translation event. */
    121         virtual void retranslateUi() /* override */;
     111     * @{ */
     112    /** Handles translation event. */
     113    virtual void retranslateUi() /* override */;
    122114
    123         /** Handles Qt show @a pEvent. */
    124         virtual void showEvent(QShowEvent *pEvent) /* override */;
    125         /** Handles Qt key-press @a pEvent. */
    126         virtual void keyPressEvent(QKeyEvent *pEvent) /* override */;
     115    /** Handles Qt show @a pEvent. */
     116    virtual void showEvent(QShowEvent *pEvent) /* override */;
     117    /** Handles Qt key-press @a pEvent. */
     118    virtual void keyPressEvent(QKeyEvent *pEvent) /* override */;
    127119    /** @} */
    128120
     
    143135    QITabWidget *m_pTabWidget;
    144136    /** @name Toolbar and menu variables.
    145       * @{ */
    146         QIToolBar *m_pToolBar;
     137     * @{ */
     138    QIToolBar *m_pToolBar;
    147139    /** @} */
    148140
    149141    QString       m_strHelpFilePath;
    150 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
    151142    QHelpEngine  *m_pHelpEngine;
    152 #endif
    153     UIHelpBrowserAddressBar *m_pAddressBar;
    154     UIHelpBrowserViewer *m_pContentViewer;
    155143    QSplitter           *m_pSplitter;
    156144    QMenu               *m_pMenu;
     
    158146    QHelpIndexWidget    *m_pIndexWidget;
    159147    QHelpContentModel   *m_pContentModel;
    160     QHelpSearchEngine   *m_pHelpSearchEngine;
    161     QHelpSearchQueryWidget *m_pHelpSearchQueryWidget;
    162     QHelpSearchResultWidget *m_pHelpSearchResultWidget;
     148    QHelpSearchEngine   *m_pSearchEngine;
     149    QHelpSearchQueryWidget *m_pSearchQueryWidget;
     150    QHelpSearchResultWidget *m_pSearchResultWidget;
     151    UIHelpBrowserTabManager *m_pTabManager;
    163152    QWidget             *m_pBookmarksWidget;
    164153    QWidget             *m_pSearchContainerWidget;
    165154    QAction             *m_pShowHideSideBarAction;
    166155    QAction             *m_pShowHideToolBarAction;
    167     QAction             *m_pHomeAction;
    168     QAction             *m_pForwardAction;
    169     QAction             *m_pBackwardAction;
    170     QAction             *m_pAddBookmarkAction;
    171     QString              m_strPageNotFoundText;
    172156    /* This is set t true when handling QHelpContentModel::contentsCreated signal. */
    173157    bool                 m_fModelContentCreated;
    174158};
    175159
     160#endif /* #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) */
    176161#endif /* !FEQT_INCLUDED_SRC_helpbrowser_UIHelpBrowserWidget_h */
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