Changeset 89409 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 31, 2021 5:20:54 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/UIHelpBrowserWidget.cpp
r89390 r89409 214 214 215 215 void sltFindInPageAction(bool fToggled); 216 217 private slots:218 219 216 void sltHomeAction(); 220 217 void sltForwardAction(); 221 218 void sltBackwardAction(); 219 void sltAddBookmarkAction(); 220 void sltReloadPageAction(); 221 222 private slots: 223 222 224 void sltHistoryChanged(); 223 225 void sltAddressBarIndexChanged(int index); 224 void sltAddBookmarkAction();225 226 void sltAnchorClicked(const QUrl &link); 226 227 void sltFindInPageWidgetVisibilityChanged(bool fVisible); 227 void sltReloadPageAction();228 228 229 229 private: … … 303 303 void sltCloseOtherTabs(); 304 304 void sltZoomOperation(UIHelpViewer::ZoomOperation enmZoomOperation); 305 void sltHomeAction(); 306 void sltAddBookmarkAction(); 307 void sltForwardAction(); 308 void sltBackwardAction(); 309 void sltReloadPageAction(); 305 310 306 311 private slots: 307 312 308 void slt tabTitleChange(const QString &strTitle);313 void sltTabTitleChange(const QString &strTitle); 309 314 void sltOpenLinkInNewTab(const QUrl &url, bool fBackground); 310 315 void sltTabClose(int iTabIndex); … … 549 554 , m_pAddBookmarkAction(0) 550 555 , m_pFindInPageAction(0) 556 , m_pReloadPageAction(0) 551 557 , m_pMainLayout(0) 552 558 , m_pToolBar(0) … … 768 774 { 769 775 setActionTextAndToolTip(m_pHomeAction, tr("Home"), tr("Return to Start Page")); 770 setActionTextAndToolTip(m_pBackwardAction, tr("Backward"), tr("Navigate to Previous Page")); 771 setActionTextAndToolTip(m_pForwardAction, tr("Forward"), tr("Navigate to Next Page")); 772 setActionTextAndToolTip(m_pAddBookmarkAction, tr("Bookmark"), tr("Add a New Bookmark")); 776 setActionTextAndToolTip(m_pBackwardAction, tr("Backward"), tr("Go Back to Previous Page")); 777 setActionTextAndToolTip(m_pForwardAction, tr("Forward"), tr("Go Froward to Next Page")); 778 setActionTextAndToolTip(m_pAddBookmarkAction, tr("Add Bookmark"), tr("Add a New Bookmark")); 779 setActionTextAndToolTip(m_pReloadPageAction, tr("Reload"), tr("Reload the Current Page")); 773 780 setActionTextAndToolTip(m_pFindInPageAction, tr("Find in Page"), tr("Find a String in the Current Page")); 774 781 } … … 906 913 this, &UIHelpBrowserTabManager::sigSourceChanged); 907 914 connect(pTabWidget, &UIHelpBrowserTab::sigTitleUpdate, 908 this, &UIHelpBrowserTabManager::slt tabTitleChange);915 this, &UIHelpBrowserTabManager::sltTabTitleChange); 909 916 connect(pTabWidget, &UIHelpBrowserTab::sigOpenLinkInNewTab, 910 917 this, &UIHelpBrowserTabManager::sltOpenLinkInNewTab); … … 1127 1134 } 1128 1135 1129 void UIHelpBrowserTabManager::slt tabTitleChange(const QString &strTitle)1136 void UIHelpBrowserTabManager::sltTabTitleChange(const QString &strTitle) 1130 1137 { 1131 1138 for (int i = 0; i < count(); ++i) … … 1231 1238 1232 1239 menu.exec(tabBar()->mapToGlobal(pos)); 1240 } 1241 1242 void UIHelpBrowserTabManager::sltHomeAction() 1243 { 1244 UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget()); 1245 if (pTab) 1246 pTab->sltHomeAction(); 1247 } 1248 1249 void UIHelpBrowserTabManager::sltAddBookmarkAction() 1250 { 1251 UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget()); 1252 if (pTab) 1253 pTab->sltAddBookmarkAction(); 1254 } 1255 1256 void UIHelpBrowserTabManager::sltForwardAction() 1257 { 1258 UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget()); 1259 if (pTab) 1260 pTab->sltForwardAction(); 1261 } 1262 1263 void UIHelpBrowserTabManager::sltBackwardAction() 1264 { 1265 UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget()); 1266 if (pTab) 1267 pTab->sltBackwardAction(); 1268 } 1269 1270 void UIHelpBrowserTabManager::sltReloadPageAction() 1271 { 1272 UIHelpBrowserTab *pTab = qobject_cast<UIHelpBrowserTab*>(currentWidget()); 1273 if (pTab) 1274 pTab->sltReloadPageAction(); 1233 1275 } 1234 1276 … … 1277 1319 , m_pViewMenu(0) 1278 1320 , m_pTabsMenu(0) 1321 , m_pNavigationMenu(0) 1279 1322 , m_pContentWidget(0) 1280 1323 , m_pIndexWidget(0) … … 1294 1337 , m_pFindNextInPageAction(0) 1295 1338 , m_pFindPreviousInPageAction(0) 1339 , m_pBackwardAction(0) 1340 , m_pForwardAction(0) 1341 , m_pHomeAction(0) 1342 , m_pReloadPageAction(0) 1343 , m_pAddBookmarkAction(0) 1296 1344 , m_pZoomMenuAction(0) 1297 1345 , m_fModelContentCreated(false) … … 1314 1362 << m_pFileMenu 1315 1363 << m_pEditMenu 1364 << m_pNavigationMenu 1316 1365 << m_pViewMenu 1317 1366 << m_pTabsMenu; … … 1352 1401 prepareMenu(); 1353 1402 prepareWidgets(); 1403 prepareConnections(); 1354 1404 prepareSearchWidgets(); 1355 1405 loadBookmarks(); … … 1411 1461 m_pQuitAction->setShortcut(QString("Ctrl+Q")); 1412 1462 1463 m_pBackwardAction = new QAction(this); 1464 connect(m_pBackwardAction, &QAction::triggered, 1465 this, &UIHelpBrowserWidget::sigGoBackward); 1466 1467 m_pForwardAction = new QAction(this); 1468 connect(m_pForwardAction, &QAction::triggered, 1469 this, &UIHelpBrowserWidget::sigGoForward); 1470 1471 m_pHomeAction = new QAction(this); 1472 connect(m_pHomeAction, &QAction::triggered, 1473 this, &UIHelpBrowserWidget::sigGoHome); 1474 1475 m_pReloadPageAction = new QAction(this); 1476 connect(m_pReloadPageAction, &QAction::triggered, 1477 this, &UIHelpBrowserWidget::sigReloadPage); 1478 1479 m_pAddBookmarkAction = new QAction(this); 1480 connect(m_pAddBookmarkAction, &QAction::triggered, 1481 this, &UIHelpBrowserWidget::sigAddBookmark); 1482 1413 1483 m_pZoomMenuAction = new UIZoomMenuAction(this); 1414 1484 connect(m_pZoomMenuAction, &UIZoomMenuAction::sigZoomChanged, 1415 1485 this, &UIHelpBrowserWidget::sltZoomActions); 1486 } 1487 1488 void UIHelpBrowserWidget::prepareConnections() 1489 { 1490 if (m_pTabManager) 1491 { 1492 connect(m_pHomeAction, &QAction::triggered, m_pTabManager, &UIHelpBrowserTabManager::sltHomeAction); 1493 connect(m_pAddBookmarkAction, &QAction::triggered, m_pTabManager, &UIHelpBrowserTabManager::sltAddBookmarkAction); 1494 connect(m_pForwardAction, &QAction::triggered, m_pTabManager, &UIHelpBrowserTabManager::sltForwardAction); 1495 connect(m_pBackwardAction, &QAction::triggered, m_pTabManager, &UIHelpBrowserTabManager::sltBackwardAction); 1496 connect(m_pReloadPageAction, &QAction::triggered, m_pTabManager, &UIHelpBrowserTabManager::sltReloadPageAction); 1497 } 1416 1498 } 1417 1499 … … 1556 1638 m_pFileMenu = new QMenu(tr("&File"), this); 1557 1639 m_pEditMenu = new QMenu(tr("&Edit"), this); 1640 m_pNavigationMenu = new QMenu(tr("&Navigation"), this); 1558 1641 m_pViewMenu = new QMenu(tr("&View"), this); 1559 1642 m_pTabsMenu = new QMenu(tr("&Tabs"), this); 1560 1643 1561 AssertReturnVoid(m_pFileMenu && m_pViewMenu && m_pTabsMenu); 1562 1563 if (m_pPrintAction) 1564 m_pFileMenu->addAction(m_pPrintAction); 1565 if (m_pQuitAction) 1566 m_pFileMenu->addAction(m_pQuitAction); 1567 1568 if (m_pCopySelectedTextAction) 1569 m_pEditMenu->addAction(m_pCopySelectedTextAction); 1570 if(m_pFindInPageAction) 1571 m_pEditMenu->addAction(m_pFindInPageAction); 1572 if(m_pFindNextInPageAction) 1573 m_pEditMenu->addAction(m_pFindNextInPageAction); 1574 if(m_pFindPreviousInPageAction) 1575 m_pEditMenu->addAction(m_pFindPreviousInPageAction); 1576 1577 if (m_pZoomMenuAction) 1578 m_pViewMenu->addAction(m_pZoomMenuAction); 1579 if (m_pShowHideSideBarAction) 1580 m_pViewMenu->addAction(m_pShowHideSideBarAction); 1581 if (m_pShowHideToolBarAction) 1582 m_pViewMenu->addAction(m_pShowHideToolBarAction); 1583 if (m_pShowHideStatusBarAction) 1584 m_pViewMenu->addAction(m_pShowHideStatusBarAction); 1644 AssertReturnVoid(m_pFileMenu && m_pViewMenu && 1645 m_pTabsMenu && m_pNavigationMenu); 1646 1647 addActionToMenu(m_pFileMenu, m_pPrintAction); 1648 addActionToMenu(m_pFileMenu, m_pQuitAction); 1649 1650 addActionToMenu(m_pEditMenu, m_pCopySelectedTextAction); 1651 addActionToMenu(m_pEditMenu, m_pFindInPageAction); 1652 addActionToMenu(m_pEditMenu, m_pFindNextInPageAction); 1653 addActionToMenu(m_pEditMenu, m_pFindPreviousInPageAction); 1654 1655 addActionToMenu(m_pViewMenu, m_pZoomMenuAction); 1656 addActionToMenu(m_pViewMenu, m_pShowHideSideBarAction); 1657 addActionToMenu(m_pViewMenu, m_pShowHideToolBarAction); 1658 addActionToMenu(m_pViewMenu, m_pShowHideStatusBarAction); 1659 1660 addActionToMenu(m_pNavigationMenu, m_pBackwardAction); 1661 addActionToMenu(m_pNavigationMenu, m_pForwardAction); 1662 addActionToMenu(m_pNavigationMenu, m_pHomeAction); 1663 addActionToMenu(m_pNavigationMenu, m_pReloadPageAction); 1664 addActionToMenu(m_pNavigationMenu, m_pAddBookmarkAction); 1585 1665 } 1586 1666 … … 1719 1799 if (m_pFindPreviousInPageAction) 1720 1800 m_pFindPreviousInPageAction->setText(tr("&Find Previous")); 1801 1802 if (m_pBackwardAction) 1803 m_pBackwardAction->setText(tr("Go Backward")); 1804 if (m_pForwardAction) 1805 m_pForwardAction->setText(tr("Go Forward")); 1806 if (m_pHomeAction) 1807 m_pHomeAction->setText(tr("Go to Start Page")); 1808 if (m_pReloadPageAction) 1809 m_pReloadPageAction->setText(tr("Reload Page")); 1810 if (m_pAddBookmarkAction) 1811 m_pAddBookmarkAction->setText(tr("Add Bookmark")); 1721 1812 } 1722 1813 … … 2090 2181 } 2091 2182 2183 void UIHelpBrowserWidget::addActionToMenu(QMenu *pMenu, QAction *pAction) 2184 { 2185 if (!pMenu || !pAction) 2186 return; 2187 pMenu->addAction(pAction); 2188 } 2092 2189 2093 2190 #include "UIHelpBrowserWidget.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h
r89318 r89409 59 59 void sigStatusBarVisible(bool fToggled); 60 60 void sigZoomPercentageChanged(int iPercentage); 61 void sigGoBackward(); 62 void sigGoForward(); 63 void sigGoHome(); 64 void sigReloadPage(); 65 void sigAddBookmark(); 61 66 62 67 public: … … 114 119 void prepareToolBar(); 115 120 void prepareMenu(); 121 void prepareConnections(); 122 116 123 void loadOptions(); 117 124 QStringList loadSavedUrlList(); … … 139 146 /* Looks for Url for the keyword using QHelpEngine API and shows it in a new tab whne successful. */ 140 147 void findAndShowUrlForKeyword(const QString &strKeyword); 148 void addActionToMenu(QMenu *pMenu, QAction *pAction); 141 149 142 150 /** Holds the widget's embedding type. */ … … 163 171 QMenu *m_pViewMenu; 164 172 QMenu *m_pTabsMenu; 173 QMenu *m_pNavigationMenu; 165 174 QHelpContentWidget *m_pContentWidget; 166 175 QHelpIndexWidget *m_pIndexWidget; … … 171 180 UIHelpBrowserTabManager *m_pTabManager; 172 181 UIBookmarksListContainer *m_pBookmarksWidget; 173 QWidget *m_pSearchContainerWidget; 174 QAction *m_pPrintAction; 175 QAction *m_pQuitAction; 176 QAction *m_pShowHideSideBarAction; 177 QAction *m_pShowHideToolBarAction; 178 QAction *m_pShowHideStatusBarAction; 179 QAction *m_pCopySelectedTextAction; 180 QAction *m_pFindInPageAction; 181 QAction *m_pFindNextInPageAction; 182 QAction *m_pFindPreviousInPageAction; 182 QWidget *m_pSearchContainerWidget; 183 QAction *m_pPrintAction; 184 QAction *m_pQuitAction; 185 QAction *m_pShowHideSideBarAction; 186 QAction *m_pShowHideToolBarAction; 187 QAction *m_pShowHideStatusBarAction; 188 QAction *m_pCopySelectedTextAction; 189 QAction *m_pFindInPageAction; 190 QAction *m_pFindNextInPageAction; 191 QAction *m_pFindPreviousInPageAction; 192 QAction *m_pBackwardAction; 193 QAction *m_pForwardAction; 194 QAction *m_pHomeAction; 195 QAction *m_pReloadPageAction; 196 QAction *m_pAddBookmarkAction; 197 183 198 UIZoomMenuAction *m_pZoomMenuAction; 184 199 -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.cpp
r89390 r89409 70 70 void sigGoForward(); 71 71 void sigGoHome(); 72 void sigReloadPage(); 72 73 void sigAddBookmark(); 73 74 … … 84 85 QIToolButton *m_pForwardButton; 85 86 QIToolButton *m_pHomeButton; 87 QIToolButton *m_pReloadPageButton; 86 88 QIToolButton *m_pAddBookmarkButton; 87 89 }; … … 135 137 , m_pForwardButton(0) 136 138 , m_pHomeButton(0) 139 , m_pReloadPageButton(0) 137 140 , m_pAddBookmarkButton(0) 138 141 { … … 162 165 m_pForwardButton = new QIToolButton; 163 166 m_pHomeButton = new QIToolButton; 167 m_pReloadPageButton = new QIToolButton; 164 168 m_pAddBookmarkButton = new QIToolButton; 165 169 166 170 AssertReturnVoid(m_pBackwardButton && 167 171 m_pForwardButton && 168 m_pHomeButton); 172 m_pHomeButton && 173 m_pReloadPageButton); 174 169 175 m_pForwardButton->setEnabled(false); 170 176 m_pBackwardButton->setEnabled(false); 171 177 m_pHomeButton->setIcon(UIIconPool::iconSet(":/help_browser_home_32px.png")); 178 m_pReloadPageButton->setIcon(UIIconPool::iconSet(":/help_browser_reload_32px.png")); 172 179 m_pForwardButton->setIcon(UIIconPool::iconSet(":/help_browser_forward_32px.png", ":/help_browser_forward_disabled_32px.png")); 173 180 m_pBackwardButton->setIcon(UIIconPool::iconSet(":/help_browser_backward_32px.png", ":/help_browser_backward_disabled_32px.png")); … … 177 184 pMainLayout->addWidget(m_pForwardButton); 178 185 pMainLayout->addWidget(m_pHomeButton); 186 pMainLayout->addWidget(m_pReloadPageButton); 179 187 pMainLayout->addWidget(m_pAddBookmarkButton); 180 188 pMainLayout->setContentsMargins(0, 0, 0, 0); … … 186 194 connect(m_pHomeButton, &QIToolButton::pressed, 187 195 this, &UIContextMenuNavigationAction::sigGoHome); 196 connect(m_pReloadPageButton, &QIToolButton::pressed, 197 this, &UIContextMenuNavigationAction::sigReloadPage); 188 198 connect(m_pAddBookmarkButton, &QIToolButton::pressed, 199 this, &UIContextMenuNavigationAction::sigAddBookmark); 200 connect(m_pReloadPageButton, &QIToolButton::pressed, 189 201 this, &UIContextMenuNavigationAction::sigAddBookmark); 190 202 } … … 545 557 connect(pNavigationActions, &UIContextMenuNavigationAction::sigGoHome, 546 558 this, &UIHelpViewer::sigGoHome); 559 connect(pNavigationActions, &UIContextMenuNavigationAction::sigReloadPage, 560 this, &UIHelpViewer::reload); 547 561 connect(pNavigationActions, &UIContextMenuNavigationAction::sigAddBookmark, 548 562 this, &UIHelpViewer::sigAddBookmark); -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpViewer.h
r89390 r89409 76 76 static const QPair<int, int> zoomPercentageMinMax; 77 77 void toggleFindInPageWidget(bool fVisible); 78 void reload();79 78 80 79 public slots: … … 82 81 void sltSelectPreviousMatch(); 83 82 void sltSelectNextMatch(); 83 virtual void reload() /* overload */; 84 84 85 85 protected:
Note:
See TracChangeset
for help on using the changeset viewer.