VirtualBox

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


Ignore:
Timestamp:
Nov 30, 2020 4:15:43 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9831. Status bar update

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

Legend:

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

    r86966 r87015  
    2121#endif
    2222#include <QMenuBar>
     23#include <QStatusBar>
    2324
    2425/* GUI includes: */
     
    4647    setWindowIcon(UIIconPool::iconSetFull(":/vm_show_logs_32px.png", ":/vm_show_logs_16px.png"));
    4748    prepareCentralWidget();
     49    statusBar()->show();
    4850    loadSettings();
    4951    retranslateUi();
     
    8587    connect(m_pWidget, &UIHelpBrowserWidget::sigCloseDialog,
    8688            this, &UIHelpBrowserDialog::close);
     89    connect(m_pWidget, &UIHelpBrowserWidget::sigLinkHighlighted,
     90            this, &UIHelpBrowserDialog::sltHandleLinkHighlighted);
     91    connect(m_pWidget, &UIHelpBrowserWidget::sigStatusBarVisible,
     92            this, &UIHelpBrowserDialog::sltHandleStatusBarVisibilityChange);
    8793
    8894    const QList<QMenu*> menuList = m_pWidget->menus();
     
    113119    return gEDataManager->helpBrowserDialogShouldBeMaximized();
    114120}
     121
     122void UIHelpBrowserDialog::sltHandleLinkHighlighted(const QString& strLink)
     123{
     124    statusBar()->showMessage(strLink);
     125}
     126
     127void UIHelpBrowserDialog::sltHandleStatusBarVisibilityChange(bool fVisible)
     128{
     129    statusBar()->setVisible(fVisible);
     130}
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserDialog.h

    r86964 r87015  
    5858private slots:
    5959
     60    void sltHandleLinkHighlighted(const QString& strLink);
     61    void sltHandleStatusBarVisibilityChange(bool fVisible);
     62
    6063private:
    6164
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp

    r87000 r87015  
    162162
    163163/*********************************************************************************************************************************
    164 *   UIBookmarksListContainer definition.                                                                                         *
     164*   UIBookmarksListWidget definition.                                                                                         *
    165165*********************************************************************************************************************************/
    166166class UIBookmarksListWidget : public QListWidget
     
    180180
    181181    void mouseDoubleClickEvent(QMouseEvent *event) /* override */;
    182 
     182    void mousePressEvent(QMouseEvent *pEvent) /* override */;
    183183};
    184184
     
    205205    QUrl currentBookmarkUrl();
    206206
     207public:
     208
     209    void sltDeleteSelectedBookmark();
     210
    207211protected:
    208212
    209213    void retranslateUi() /* override */;
     214
     215private slots:
     216
     217    void sltHandleContextMenuRequest(const QPoint &listWidgetLocalPos);
    210218
    211219private:
     
    289297protected:
    290298
    291     void contextMenuEvent(QContextMenuEvent *event) /* override */;
     299    virtual void contextMenuEvent(QContextMenuEvent *event) /* override */;
    292300    virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
    293301    virtual void wheelEvent(QWheelEvent *pEvent) /* override */;
     
    338346    void sigAddBookmark(const QUrl &url, const QString &strTitle);
    339347    void sigFontPointSizeChanged(int iFontPointSize);
     348    void sigLinkHighlighted(const QString &strLink);
    340349
    341350public:
     
    402411    /** list.first is tab title and list.second is tab's index. */
    403412    void sigTabsListChanged(const QStringList &titleList);
     413    void sigLinkHighlighted(const QString &strLink);
    404414
    405415public:
     
    633643    :QListWidget(pParent)
    634644{
     645    setSelectionMode(QAbstractItemView::SingleSelection);
    635646}
    636647
     
    644655}
    645656
     657void UIBookmarksListWidget::mousePressEvent(QMouseEvent *pEvent)
     658{
     659    if (!indexAt(pEvent->pos()).isValid())
     660    {
     661        clearSelection();
     662        setCurrentItem(0);
     663    }
     664    QListWidget::mousePressEvent(pEvent);
     665}
    646666
    647667/*********************************************************************************************************************************
     
    688708        return QUrl();
    689709    return m_pListWidget->currentItem()->data(iBookmarkUrlDataType).toUrl();
     710}
     711
     712void UIBookmarksListContainer::sltDeleteSelectedBookmark()
     713{
     714    if (!m_pListWidget || !m_pListWidget->currentItem())
     715        return;
     716    QListWidgetItem *pCurrentItem = m_pListWidget->takeItem(m_pListWidget->currentRow());
     717
     718    delete pCurrentItem;
     719
     720
    690721}
    691722
     
    707738            this, &UIBookmarksListContainer::sigBookmarkDoubleClick);
    708739    connect(m_pListWidget, &UIBookmarksListWidget::customContextMenuRequested,
    709             this, &UIBookmarksListContainer::sigListWidgetContextMenuRequest);
     740            this, &UIBookmarksListContainer::sltHandleContextMenuRequest);
     741}
     742
     743void UIBookmarksListContainer::sltHandleContextMenuRequest(const QPoint &listWidgetLocalPos)
     744{
     745    if (!m_pListWidget || !m_pListWidget->currentItem())
     746        return;
     747    emit sigListWidgetContextMenuRequest(listWidgetLocalPos);
    710748}
    711749
     
    9631001    connect(m_pContentViewer, &UIHelpBrowserViewer::sigAddBookmark,
    9641002            this, &UIHelpBrowserTab::sltHandleAddBookmarkAction);
     1003    connect(m_pContentViewer, static_cast<void(UIHelpBrowserViewer::*)(const QString&)>(&UIHelpBrowserViewer::highlighted),
     1004            this, &UIHelpBrowserTab::sigLinkHighlighted);
    9651005
    9661006    m_pContentViewer->setSource(initialUrl);
     
    14911531   connect(pTabWidget, &UIHelpBrowserTab::sigFontPointSizeChanged,
    14921532           this, &UIHelpBrowserTabManager::sltHandleFontSizeChange);
     1533   connect(pTabWidget, &UIHelpBrowserTab::sigLinkHighlighted,
     1534           this, &UIHelpBrowserTabManager::sigLinkHighlighted);
    14931535
    14941536   if (m_fSwitchToNewTab)
     
    18181860    , m_pShowHideSideBarAction(0)
    18191861    , m_pShowHideToolBarAction(0)
    1820     , m_pShowHideFontScaleWidget(0)
     1862    , m_pShowHideFontScaleWidgetAction(0)
     1863    , m_pShowHideStatusBarAction(0)
    18211864    , m_pFontSizeLargerAction(0)
    18221865    , m_pFontSizeSmallerAction(0)
     
    18901933            this, &UIHelpBrowserWidget::sltHandleWidgetVisibilityToggle);
    18911934
    1892     m_pShowHideFontScaleWidget = new QAction(this);
    1893     m_pShowHideFontScaleWidget->setCheckable(true);
    1894     m_pShowHideFontScaleWidget->setChecked(true);
    1895     connect(m_pShowHideFontScaleWidget, &QAction::toggled,
     1935    m_pShowHideFontScaleWidgetAction = new QAction(this);
     1936    m_pShowHideFontScaleWidgetAction->setCheckable(true);
     1937    m_pShowHideFontScaleWidgetAction->setChecked(true);
     1938    connect(m_pShowHideFontScaleWidgetAction, &QAction::toggled,
    18961939            this, &UIHelpBrowserWidget::sltHandleWidgetVisibilityToggle);
     1940
     1941    m_pShowHideStatusBarAction = new QAction(this);
     1942    m_pShowHideStatusBarAction->setCheckable(true);
     1943    m_pShowHideStatusBarAction->setChecked(true);
     1944    connect(m_pShowHideStatusBarAction, &QAction::toggled,
     1945            this, &UIHelpBrowserWidget::sltHandleWidgetVisibilityToggle);
     1946
    18971947
    18981948    m_pPrintAction = new QAction(this);
     
    19592009            this, &UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange);
    19602010    connect(m_pTabManager, &UIHelpBrowserTabManager::sigAddBookmark,
    1961            this, &UIHelpBrowserWidget::sltAddNewBookmark);
     2011            this, &UIHelpBrowserWidget::sltAddNewBookmark);
    19622012    connect(m_pTabManager, &UIHelpBrowserTabManager::sigTabsListChanged,
    1963            this, &UIHelpBrowserWidget::sltHandleTabListChanged);
     2013            this, &UIHelpBrowserWidget::sltHandleTabListChanged);
    19642014    connect(m_pTabManager, &UIHelpBrowserTabManager::currentChanged,
    1965            this, &UIHelpBrowserWidget::sltHandleCurrentTabChanged);
     2015            this, &UIHelpBrowserWidget::sltHandleCurrentTabChanged);
     2016    connect(m_pTabManager, &UIHelpBrowserTabManager::sigLinkHighlighted,
     2017            this, &UIHelpBrowserWidget::sigLinkHighlighted);
     2018
    19662019    connect(m_pHelpEngine, &QHelpEngine::setupFinished,
    19672020            this, &UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished);
     
    20702123    if (m_pShowHideToolBarAction)
    20712124        m_pViewMenu->addAction(m_pShowHideToolBarAction);
    2072     if (m_pShowHideFontScaleWidget)
    2073         m_pViewMenu->addAction(m_pShowHideFontScaleWidget);
     2125    if (m_pShowHideFontScaleWidgetAction)
     2126        m_pViewMenu->addAction(m_pShowHideFontScaleWidgetAction);
     2127    if (m_pShowHideStatusBarAction)
     2128        m_pViewMenu->addAction(m_pShowHideStatusBarAction);
    20742129}
    20752130
     
    21872242    if (m_pShowHideToolBarAction)
    21882243        m_pShowHideToolBarAction->setText(tr("Show Tool Bar"));
    2189     if (m_pShowHideFontScaleWidget)
    2190         m_pShowHideFontScaleWidget->setText(tr("Show Font Scale Widget"));
     2244    if (m_pShowHideFontScaleWidgetAction)
     2245        m_pShowHideFontScaleWidgetAction->setText(tr("Show Font Scale Widget"));
     2246    if (m_pShowHideStatusBarAction)
     2247        m_pShowHideStatusBarAction->setText(tr("Show Status Bar"));
     2248
    21912249
    21922250    if (m_pPrintAction)
     
    22402298            m_pTabManager->setToolBarVisible(fToggled);
    22412299    }
    2242     else if (sender() == m_pShowHideFontScaleWidget)
     2300    else if (sender() == m_pShowHideFontScaleWidgetAction)
    22432301    {
    22442302        if (m_pTabManager)
    22452303            m_pTabManager->setFontScaleWidgetVisible(fToggled);
    22462304    }
     2305    else if (sender() == m_pShowHideStatusBarAction)
     2306        emit sigStatusBarVisible(fToggled);
    22472307}
    22482308
     
    23702430    pOpenInNewTab->setData(url);
    23712431    pCopyLink->setData(url);
    2372     connect(pOpenInNewTab, &QAction::triggered,
    2373             this, &UIHelpBrowserWidget::sltOpenLinkInNewTab);
    2374     connect(pOpen, &QAction::triggered,
    2375             this, &UIHelpBrowserWidget::sltOpenLink);
    2376     connect(pCopyLink, &QAction::triggered,
    2377             this, &UIHelpBrowserWidget::sltCopyLink);
     2432
     2433    connect(pOpenInNewTab, &QAction::triggered, this, &UIHelpBrowserWidget::sltOpenLinkInNewTab);
     2434    connect(pOpen, &QAction::triggered, this, &UIHelpBrowserWidget::sltOpenLink);
     2435    connect(pCopyLink, &QAction::triggered, this, &UIHelpBrowserWidget::sltCopyLink);
     2436
     2437    if (pSender == m_pBookmarksWidget)
     2438    {
     2439        menu.addSeparator();
     2440        QAction *pDeleteBookmark = menu.addAction(tr("Delete Bookmark"));
     2441        connect(pDeleteBookmark, &QAction::triggered, m_pBookmarksWidget, &UIBookmarksListContainer::sltDeleteSelectedBookmark);
     2442    }
    23782443
    23792444    menu.exec(pSender->mapToGlobal(pos));
     
    25022567}
    25032568
     2569
    25042570#include "UIHelpBrowserWidget.moc"
    25052571
  • trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h

    r86965 r87015  
    6565
    6666    void sigCloseDialog();
     67    void sigLinkHighlighted(const QString &strLink);
     68    void sigStatusBarVisible(bool fToggled);
    6769
    6870public:
     
    174176    QAction             *m_pShowHideSideBarAction;
    175177    QAction             *m_pShowHideToolBarAction;
    176     QAction             *m_pShowHideFontScaleWidget;
     178    QAction             *m_pShowHideFontScaleWidgetAction;
     179    QAction             *m_pShowHideStatusBarAction;
    177180    QAction             *m_pFontSizeLargerAction;
    178181    QAction             *m_pFontSizeSmallerAction;
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