Changeset 87015 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 30, 2020 4:15:43 PM (4 years ago)
- 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 21 21 #endif 22 22 #include <QMenuBar> 23 #include <QStatusBar> 23 24 24 25 /* GUI includes: */ … … 46 47 setWindowIcon(UIIconPool::iconSetFull(":/vm_show_logs_32px.png", ":/vm_show_logs_16px.png")); 47 48 prepareCentralWidget(); 49 statusBar()->show(); 48 50 loadSettings(); 49 51 retranslateUi(); … … 85 87 connect(m_pWidget, &UIHelpBrowserWidget::sigCloseDialog, 86 88 this, &UIHelpBrowserDialog::close); 89 connect(m_pWidget, &UIHelpBrowserWidget::sigLinkHighlighted, 90 this, &UIHelpBrowserDialog::sltHandleLinkHighlighted); 91 connect(m_pWidget, &UIHelpBrowserWidget::sigStatusBarVisible, 92 this, &UIHelpBrowserDialog::sltHandleStatusBarVisibilityChange); 87 93 88 94 const QList<QMenu*> menuList = m_pWidget->menus(); … … 113 119 return gEDataManager->helpBrowserDialogShouldBeMaximized(); 114 120 } 121 122 void UIHelpBrowserDialog::sltHandleLinkHighlighted(const QString& strLink) 123 { 124 statusBar()->showMessage(strLink); 125 } 126 127 void UIHelpBrowserDialog::sltHandleStatusBarVisibilityChange(bool fVisible) 128 { 129 statusBar()->setVisible(fVisible); 130 } -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserDialog.h
r86964 r87015 58 58 private slots: 59 59 60 void sltHandleLinkHighlighted(const QString& strLink); 61 void sltHandleStatusBarVisibilityChange(bool fVisible); 62 60 63 private: 61 64 -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp
r87000 r87015 162 162 163 163 /********************************************************************************************************************************* 164 * UIBookmarksList Containerdefinition. *164 * UIBookmarksListWidget definition. * 165 165 *********************************************************************************************************************************/ 166 166 class UIBookmarksListWidget : public QListWidget … … 180 180 181 181 void mouseDoubleClickEvent(QMouseEvent *event) /* override */; 182 182 void mousePressEvent(QMouseEvent *pEvent) /* override */; 183 183 }; 184 184 … … 205 205 QUrl currentBookmarkUrl(); 206 206 207 public: 208 209 void sltDeleteSelectedBookmark(); 210 207 211 protected: 208 212 209 213 void retranslateUi() /* override */; 214 215 private slots: 216 217 void sltHandleContextMenuRequest(const QPoint &listWidgetLocalPos); 210 218 211 219 private: … … 289 297 protected: 290 298 291 v oid contextMenuEvent(QContextMenuEvent *event) /* override */;299 virtual void contextMenuEvent(QContextMenuEvent *event) /* override */; 292 300 virtual void resizeEvent(QResizeEvent *pEvent) /* override */; 293 301 virtual void wheelEvent(QWheelEvent *pEvent) /* override */; … … 338 346 void sigAddBookmark(const QUrl &url, const QString &strTitle); 339 347 void sigFontPointSizeChanged(int iFontPointSize); 348 void sigLinkHighlighted(const QString &strLink); 340 349 341 350 public: … … 402 411 /** list.first is tab title and list.second is tab's index. */ 403 412 void sigTabsListChanged(const QStringList &titleList); 413 void sigLinkHighlighted(const QString &strLink); 404 414 405 415 public: … … 633 643 :QListWidget(pParent) 634 644 { 645 setSelectionMode(QAbstractItemView::SingleSelection); 635 646 } 636 647 … … 644 655 } 645 656 657 void UIBookmarksListWidget::mousePressEvent(QMouseEvent *pEvent) 658 { 659 if (!indexAt(pEvent->pos()).isValid()) 660 { 661 clearSelection(); 662 setCurrentItem(0); 663 } 664 QListWidget::mousePressEvent(pEvent); 665 } 646 666 647 667 /********************************************************************************************************************************* … … 688 708 return QUrl(); 689 709 return m_pListWidget->currentItem()->data(iBookmarkUrlDataType).toUrl(); 710 } 711 712 void 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 690 721 } 691 722 … … 707 738 this, &UIBookmarksListContainer::sigBookmarkDoubleClick); 708 739 connect(m_pListWidget, &UIBookmarksListWidget::customContextMenuRequested, 709 this, &UIBookmarksListContainer::sigListWidgetContextMenuRequest); 740 this, &UIBookmarksListContainer::sltHandleContextMenuRequest); 741 } 742 743 void UIBookmarksListContainer::sltHandleContextMenuRequest(const QPoint &listWidgetLocalPos) 744 { 745 if (!m_pListWidget || !m_pListWidget->currentItem()) 746 return; 747 emit sigListWidgetContextMenuRequest(listWidgetLocalPos); 710 748 } 711 749 … … 963 1001 connect(m_pContentViewer, &UIHelpBrowserViewer::sigAddBookmark, 964 1002 this, &UIHelpBrowserTab::sltHandleAddBookmarkAction); 1003 connect(m_pContentViewer, static_cast<void(UIHelpBrowserViewer::*)(const QString&)>(&UIHelpBrowserViewer::highlighted), 1004 this, &UIHelpBrowserTab::sigLinkHighlighted); 965 1005 966 1006 m_pContentViewer->setSource(initialUrl); … … 1491 1531 connect(pTabWidget, &UIHelpBrowserTab::sigFontPointSizeChanged, 1492 1532 this, &UIHelpBrowserTabManager::sltHandleFontSizeChange); 1533 connect(pTabWidget, &UIHelpBrowserTab::sigLinkHighlighted, 1534 this, &UIHelpBrowserTabManager::sigLinkHighlighted); 1493 1535 1494 1536 if (m_fSwitchToNewTab) … … 1818 1860 , m_pShowHideSideBarAction(0) 1819 1861 , m_pShowHideToolBarAction(0) 1820 , m_pShowHideFontScaleWidget(0) 1862 , m_pShowHideFontScaleWidgetAction(0) 1863 , m_pShowHideStatusBarAction(0) 1821 1864 , m_pFontSizeLargerAction(0) 1822 1865 , m_pFontSizeSmallerAction(0) … … 1890 1933 this, &UIHelpBrowserWidget::sltHandleWidgetVisibilityToggle); 1891 1934 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, 1896 1939 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 1897 1947 1898 1948 m_pPrintAction = new QAction(this); … … 1959 2009 this, &UIHelpBrowserWidget::sltHandleHelpBrowserViewerSourceChange); 1960 2010 connect(m_pTabManager, &UIHelpBrowserTabManager::sigAddBookmark, 1961 this, &UIHelpBrowserWidget::sltAddNewBookmark);2011 this, &UIHelpBrowserWidget::sltAddNewBookmark); 1962 2012 connect(m_pTabManager, &UIHelpBrowserTabManager::sigTabsListChanged, 1963 this, &UIHelpBrowserWidget::sltHandleTabListChanged);2013 this, &UIHelpBrowserWidget::sltHandleTabListChanged); 1964 2014 connect(m_pTabManager, &UIHelpBrowserTabManager::currentChanged, 1965 this, &UIHelpBrowserWidget::sltHandleCurrentTabChanged); 2015 this, &UIHelpBrowserWidget::sltHandleCurrentTabChanged); 2016 connect(m_pTabManager, &UIHelpBrowserTabManager::sigLinkHighlighted, 2017 this, &UIHelpBrowserWidget::sigLinkHighlighted); 2018 1966 2019 connect(m_pHelpEngine, &QHelpEngine::setupFinished, 1967 2020 this, &UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished); … … 2070 2123 if (m_pShowHideToolBarAction) 2071 2124 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); 2074 2129 } 2075 2130 … … 2187 2242 if (m_pShowHideToolBarAction) 2188 2243 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 2191 2249 2192 2250 if (m_pPrintAction) … … 2240 2298 m_pTabManager->setToolBarVisible(fToggled); 2241 2299 } 2242 else if (sender() == m_pShowHideFontScaleWidget )2300 else if (sender() == m_pShowHideFontScaleWidgetAction) 2243 2301 { 2244 2302 if (m_pTabManager) 2245 2303 m_pTabManager->setFontScaleWidgetVisible(fToggled); 2246 2304 } 2305 else if (sender() == m_pShowHideStatusBarAction) 2306 emit sigStatusBarVisible(fToggled); 2247 2307 } 2248 2308 … … 2370 2430 pOpenInNewTab->setData(url); 2371 2431 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 } 2378 2443 2379 2444 menu.exec(pSender->mapToGlobal(pos)); … … 2502 2567 } 2503 2568 2569 2504 2570 #include "UIHelpBrowserWidget.moc" 2505 2571 -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h
r86965 r87015 65 65 66 66 void sigCloseDialog(); 67 void sigLinkHighlighted(const QString &strLink); 68 void sigStatusBarVisible(bool fToggled); 67 69 68 70 public: … … 174 176 QAction *m_pShowHideSideBarAction; 175 177 QAction *m_pShowHideToolBarAction; 176 QAction *m_pShowHideFontScaleWidget; 178 QAction *m_pShowHideFontScaleWidgetAction; 179 QAction *m_pShowHideStatusBarAction; 177 180 QAction *m_pFontSizeLargerAction; 178 181 QAction *m_pFontSizeSmallerAction;
Note:
See TracChangeset
for help on using the changeset viewer.