VirtualBox

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


Ignore:
Timestamp:
Oct 30, 2020 6:29:07 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Making sure that there is only one help browser instance at one time

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r86721 r86776  
    32273227
    32283228UIMessageCenter::UIMessageCenter()
     3229    : m_pHelpBrowserDialog(0)
    32293230{
    32303231    /* Assign instance: */
     
    33973398void UIMessageCenter::showHelpBrowser(const QString strHelpFilePath, QWidget *pParent /* = 0 */)
    33983399{
    3399     QWidget *pDialogParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
    3400     AssertReturnVoid(pDialogParent);
    3401 
    3402 
    3403     QIManagerDialog *pHelpBrowserDialog;
    3404     UIHelpBrowserDialogFactory dialogFactory(strHelpFilePath);
    3405 
    3406     dialogFactory.prepare(pHelpBrowserDialog);
    3407     AssertReturnVoid(pHelpBrowserDialog);
    3408 
    3409     connect(pHelpBrowserDialog, &QIManagerDialog::sigClose,
    3410             this, &UIMessageCenter::sltCloseHelpBrowser);
    3411 
    3412     pHelpBrowserDialog->show();
    3413     pHelpBrowserDialog->setWindowState(pHelpBrowserDialog->windowState() & ~Qt::WindowMinimized);
    3414     pHelpBrowserDialog->activateWindow();
     3400    Q_UNUSED(pParent);
     3401    if (!m_pHelpBrowserDialog)
     3402    {
     3403
     3404        UIHelpBrowserDialogFactory dialogFactory(strHelpFilePath);
     3405        dialogFactory.prepare(m_pHelpBrowserDialog);
     3406        AssertReturnVoid(m_pHelpBrowserDialog);
     3407        connect(m_pHelpBrowserDialog, &QIManagerDialog::sigClose,
     3408                this, &UIMessageCenter::sltCloseHelpBrowser);
     3409    }
     3410    m_pHelpBrowserDialog->show();
     3411    m_pHelpBrowserDialog->setWindowState(m_pHelpBrowserDialog->windowState() & ~Qt::WindowMinimized);
     3412    m_pHelpBrowserDialog->activateWindow();
    34153413}
    34163414
    34173415void UIMessageCenter::sltCloseHelpBrowser()
    34183416{
    3419     QIManagerDialog *pDialog = qobject_cast<QIManagerDialog*>(sender());
    3420     if (!pDialog)
     3417    QIManagerDialog* pDialog = qobject_cast<QIManagerDialog*>(sender());
     3418    if (m_pHelpBrowserDialog != pDialog || !pDialog)
    34213419        return;
    34223420
     3421    m_pHelpBrowserDialog = 0;
     3422    pDialog->close();
    34233423    UIHelpBrowserDialogFactory().cleanup(pDialog);
    34243424}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r86672 r86776  
    3434
    3535/* Forward declarations: */
     36class QIManagerDialog;
    3637class UIMedium;
    3738struct StorageSlot;
     
    604605    mutable QStringList m_warnings;
    605606
     607    /** Holds UIHelpBrowserDialog instance. */
     608    QIManagerDialog *m_pHelpBrowserDialog;
     609
    606610    /** Holds the singleton message-center instance. */
    607611    static UIMessageCenter *s_pInstance;
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r86764 r86776  
    262262    AssertReturnVoid(m_pContentViewer);
    263263
     264    m_pContentViewer->setOpenExternalLinks(false);
     265
    264266    connect(m_pContentViewer, &UIHelpBrowserViewer::sourceChanged,
    265267        this, &UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange);
     
    272274    connect(m_pContentViewer, &UIHelpBrowserViewer::historyChanged,
    273275        this, &UIHelpBrowserWidget::sltHandleHistoryChanged);
     276    connect(m_pContentViewer, &UIHelpBrowserViewer::anchorClicked,
     277        this, &UIHelpBrowserWidget::sltAnchorClicked);
     278
    274279
    275280    m_pSplitter->addWidget(m_pContentViewer);
     
    336341            this, &UIHelpBrowserWidget::sltHandleSearchingStarted);
    337342
    338 
     343    m_pHelpSearchEngine->reindexDocumentation();
    339344# endif//if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
    340345#endif
     
    656661    for (int i = -1 * m_pContentViewer->backwardHistoryCount(); i <= m_pContentViewer->forwardHistoryCount(); ++i)
    657662    {
    658         m_pAddressBar->addItem(m_pContentViewer->historyTitle(i), i);
     663        QString strItem = QString("%1 (%2)").arg(m_pContentViewer->historyTitle(i)).arg(m_pContentViewer->historyUrl(i).toString());
     664        m_pAddressBar->addItem(strItem, i);
    659665        if (i == 0)
    660666            iCurrentIndex = m_pAddressBar->count();
     
    713719#endif
    714720}
     721
     722void UIHelpBrowserWidget::sltAnchorClicked(const QUrl &link)
     723{
     724    Q_UNUSED(link);
     725}
     726
    715727#include "UIHelpBrowserWidget.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r86757 r86776  
    101101    void sltHandleSearchingStarted();
    102102    void sltHandleSearchStart();
    103 
     103    void sltAnchorClicked(const QUrl &link);
    104104private:
    105105
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