Changeset 86881 in vbox
- Timestamp:
- Nov 13, 2020 11:47:47 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp
r86879 r86881 82 82 static int iFontPointSizeChangeStep = 2; 83 83 84 85 /********************************************************************************************************************************* 86 * UIContextMenuNavigationAction definition. * 87 *********************************************************************************************************************************/ 88 class UIContextMenuNavigationAction : public QWidgetAction 89 { 90 91 Q_OBJECT; 92 93 signals: 94 95 void sigGoBackward(); 96 void sigGoForward(); 97 void sigGoHome(); 98 void sigAddBookmark(); 99 100 public: 101 102 UIContextMenuNavigationAction(QObject *pParent = 0); 103 void setBackwardAvailable(bool fAvailable); 104 void setForwardAvailable(bool fAvailable); 105 106 protected: 107 108 109 private slots: 110 111 112 private: 113 114 void prepare(); 115 QIToolButton *m_pBackwardButton; 116 QIToolButton *m_pForwardButton; 117 QIToolButton *m_pHomeButton; 118 QIToolButton *m_pAddBookmarkButton; 119 }; 120 84 121 /********************************************************************************************************************************* 85 122 * UIFontScaleWidget definition. * … … 229 266 void sigCloseFindInPageWidget(); 230 267 void sigFontPointSizeChanged(int iFontPointSize); 268 void sigGoBackward(); 269 void sigGoForward(); 270 void sigGoHome(); 271 void sigAddBookmark(); 231 272 232 273 public: … … 397 438 bool m_fSwitchToNewTab; 398 439 }; 440 441 442 /********************************************************************************************************************************* 443 * UIContextMenuNavigationAction implementation. * 444 *********************************************************************************************************************************/ 445 UIContextMenuNavigationAction::UIContextMenuNavigationAction(QObject *pParent /* = 0 */) 446 :QWidgetAction(pParent) 447 , m_pBackwardButton(0) 448 , m_pForwardButton(0) 449 , m_pHomeButton(0) 450 , m_pAddBookmarkButton(0) 451 { 452 prepare(); 453 } 454 455 void UIContextMenuNavigationAction::setBackwardAvailable(bool fAvailable) 456 { 457 if (m_pBackwardButton) 458 m_pBackwardButton->setEnabled(fAvailable); 459 } 460 461 void UIContextMenuNavigationAction::setForwardAvailable(bool fAvailable) 462 { 463 if (m_pForwardButton) 464 m_pForwardButton->setEnabled(fAvailable); 465 } 466 467 void UIContextMenuNavigationAction::prepare() 468 { 469 QWidget *pWidget = new QWidget; 470 setDefaultWidget(pWidget); 471 QHBoxLayout *pMainLayout = new QHBoxLayout(pWidget); 472 AssertReturnVoid(pMainLayout); 473 474 m_pBackwardButton = new QIToolButton; 475 m_pForwardButton = new QIToolButton; 476 m_pHomeButton = new QIToolButton; 477 m_pAddBookmarkButton = new QIToolButton; 478 479 AssertReturnVoid(m_pBackwardButton && 480 m_pForwardButton && 481 m_pHomeButton); 482 m_pForwardButton->setEnabled(false); 483 m_pBackwardButton->setEnabled(false); 484 m_pHomeButton->setIcon(UIIconPool::iconSet(":/help_browser_home_32px.png")); 485 m_pForwardButton->setIcon(UIIconPool::iconSet(":/help_browser_forward_32px.png", ":/help_browser_forward_disabled_32px.png")); 486 m_pBackwardButton->setIcon(UIIconPool::iconSet(":/help_browser_backward_32px.png", ":/help_browser_backward_disabled_32px.png")); 487 m_pAddBookmarkButton->setIcon(UIIconPool::iconSet(":/help_browser_add_bookmark.png")); 488 489 pMainLayout->addWidget(m_pBackwardButton); 490 pMainLayout->addWidget(m_pForwardButton); 491 pMainLayout->addWidget(m_pHomeButton); 492 pMainLayout->addWidget(m_pAddBookmarkButton); 493 pMainLayout->setContentsMargins(0, 0, 0, 0); 494 //pMainLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed)); 495 496 connect(m_pBackwardButton, &QIToolButton::pressed, 497 this, &UIContextMenuNavigationAction::sigGoBackward); 498 connect(m_pForwardButton, &QIToolButton::pressed, 499 this, &UIContextMenuNavigationAction::sigGoForward); 500 connect(m_pHomeButton, &QIToolButton::pressed, 501 this, &UIContextMenuNavigationAction::sigGoHome); 502 connect(m_pAddBookmarkButton, &QIToolButton::pressed, 503 this, &UIContextMenuNavigationAction::sigAddBookmark); 504 } 399 505 400 506 … … 808 914 connect(m_pContentViewer, &UIHelpBrowserViewer::sigFontPointSizeChanged, 809 915 this, &UIHelpBrowserTab::sigFontPointSizeChanged); 916 connect(m_pContentViewer, &UIHelpBrowserViewer::sigGoBackward, 917 this, &UIHelpBrowserTab::sltHandleBackwardAction); 918 connect(m_pContentViewer, &UIHelpBrowserViewer::sigGoForward, 919 this, &UIHelpBrowserTab::sltHandleForwardAction); 920 connect(m_pContentViewer, &UIHelpBrowserViewer::sigGoHome, 921 this, &UIHelpBrowserTab::sltHandleHomeAction); 922 connect(m_pContentViewer, &UIHelpBrowserViewer::sigAddBookmark, 923 this, &UIHelpBrowserTab::sltHandleAddBookmarkAction); 810 924 811 925 m_pContentViewer->setSource(initialUrl, m_strPageNotFoundText); … … 1046 1160 { 1047 1161 QMenu pMenu; 1162 1163 UIContextMenuNavigationAction *pNavigationActions = new UIContextMenuNavigationAction; 1164 pNavigationActions->setBackwardAvailable(isBackwardAvailable()); 1165 pNavigationActions->setForwardAvailable(isForwardAvailable()); 1166 1167 connect(pNavigationActions, &UIContextMenuNavigationAction::sigGoBackward, 1168 this, &UIHelpBrowserViewer::sigGoBackward); 1169 connect(pNavigationActions, &UIContextMenuNavigationAction::sigGoForward, 1170 this, &UIHelpBrowserViewer::sigGoForward); 1171 connect(pNavigationActions, &UIContextMenuNavigationAction::sigGoHome, 1172 this, &UIHelpBrowserViewer::sigGoHome); 1173 connect(pNavigationActions, &UIContextMenuNavigationAction::sigAddBookmark, 1174 this, &UIHelpBrowserViewer::sigAddBookmark); 1175 1048 1176 QAction *pOpenLinkAction = new QAction(UIHelpBrowserWidget::tr("Open Link")); 1049 1177 connect(pOpenLinkAction, &QAction::triggered, … … 1054 1182 this, &UIHelpBrowserViewer::sltHandleOpenLinkInNewTab); 1055 1183 1184 pMenu.addAction(pNavigationActions); 1056 1185 pMenu.addAction(pOpenLinkAction); 1057 1186 pMenu.addAction(pOpenInNewTabAction);
Note:
See TracChangeset
for help on using the changeset viewer.

