Changeset 86913 in vbox
- Timestamp:
- Nov 19, 2020 10:32:18 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 141395
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r86906 r86913 615 615 } 616 616 617 void UIMessageCenter::cannotFindHelpFile(const QString &strFileLocation, QWidget *pParent /* = 0 */) const 618 { 619 /* Show the error: */ 620 error(pParent, MessageType_Error, 621 tr("Failed to find help file."), 622 QString("%1:<!--EOM-->%2").arg(tr("The following file could not found")).arg(strFileLocation)); 617 void UIMessageCenter::cannotFindHelpFile(const QString &strFileLocation) const 618 { 619 alert(0, MessageType_Error, QString("<p>%1:</p>%2").arg(tr("Failed to find the following help file")).arg(strFileLocation)); 620 } 621 622 void UIMessageCenter::cannotFindHelpTag() const 623 { 624 alert(0, MessageType_Error, QString("<p>%1</p>").arg(tr("There is no help page for this dialog."))); 623 625 } 624 626 … … 3438 3440 if (!QFileInfo(strHelpFilePath).exists()) 3439 3441 { 3440 cannotFindHelpFile(strHelpFilePath , pParent);3442 cannotFindHelpFile(strHelpFilePath); 3441 3443 return; 3442 3444 } 3443 3445 if (!m_pHelpBrowserDialog) 3444 3446 { 3445 UIHelpBrowserDialogFactory dialogFactory(strHelpFilePath , strKeyword);3447 UIHelpBrowserDialogFactory dialogFactory(strHelpFilePath); 3446 3448 dialogFactory.prepare(m_pHelpBrowserDialog); 3447 3449 AssertReturnVoid(m_pHelpBrowserDialog); … … 3449 3451 this, &UIMessageCenter::sltCloseHelpBrowser); 3450 3452 } 3453 if (!strKeyword.isEmpty()) 3454 { 3455 UIHelpBrowserDialog *pWidget = qobject_cast<UIHelpBrowserDialog*>(m_pHelpBrowserDialog); 3456 if (pWidget) 3457 pWidget->showHelpForKeyword(strKeyword); 3458 } 3459 3451 3460 m_pHelpBrowserDialog->show(); 3452 3461 m_pHelpBrowserDialog->setWindowState(m_pHelpBrowserDialog->windowState() & ~Qt::WindowMinimized); … … 3474 3483 QVariant keyWordProp = pSender->property("helptag"); 3475 3484 if (!keyWordProp.isValid() || !keyWordProp.canConvert(QMetaType::QString)) 3485 { 3486 cannotFindHelpTag(); 3476 3487 return; 3488 } 3477 3489 QString strKeyword = keyWordProp.toString(); 3490 if (strKeyword.isEmpty()) 3491 { 3492 cannotFindHelpTag(); 3493 return; 3494 } 3495 3478 3496 showHelpBrowser(uiCommon().helpFile(), strKeyword); 3479 3497 # endif /* #if defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))&& (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r86906 r86913 266 266 void cannotAcquireVirtualBoxParameter(const CVirtualBox &comVBox, QWidget *pParent = 0) const; 267 267 void cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent = 0) const; 268 void cannotFindHelpFile(const QString &strFileLocation, QWidget *pParent = 0) const; 268 void cannotFindHelpFile(const QString &strFileLocation) const; 269 void cannotFindHelpTag() const; 269 270 270 271 /* API: Selector warnings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserDialog.cpp
r86906 r86913 44 44 *********************************************************************************************************************************/ 45 45 46 UIHelpBrowserDialogFactory::UIHelpBrowserDialogFactory(const QString &strHelpFilePath, 47 const QString &strKeyword /* = QString() */) 46 UIHelpBrowserDialogFactory::UIHelpBrowserDialogFactory(const QString &strHelpFilePath) 48 47 : m_strHelpFilePath(strHelpFilePath) 49 , m_strKeyword(strKeyword)50 48 { 51 49 } … … 53 51 UIHelpBrowserDialogFactory::UIHelpBrowserDialogFactory() 54 52 : m_strHelpFilePath(QString()) 55 , m_strKeyword(QString())56 53 { 57 54 } … … 59 56 void UIHelpBrowserDialogFactory::create(QIManagerDialog *&pDialog, QWidget *pCenterWidget) 60 57 { 61 pDialog = new UIHelpBrowserDialog(pCenterWidget, m_strHelpFilePath , m_strKeyword);58 pDialog = new UIHelpBrowserDialog(pCenterWidget, m_strHelpFilePath); 62 59 } 63 60 … … 67 64 *********************************************************************************************************************************/ 68 65 69 UIHelpBrowserDialog::UIHelpBrowserDialog(QWidget *pCenterWidget, const QString &strHelpFilePath, 70 const QString &strKeyword /* = QString() */) 66 UIHelpBrowserDialog::UIHelpBrowserDialog(QWidget *pCenterWidget, const QString &strHelpFilePath) 71 67 : QIWithRetranslateUI<QIManagerDialog>(pCenterWidget) 72 68 , m_strHelpFilePath(strHelpFilePath) 73 , m_ strKeyword(strKeyword)69 , m_pWidget(0) 74 70 { 71 } 72 73 void UIHelpBrowserDialog::showHelpForKeyword(const QString &strKeyword) 74 { 75 if (m_pWidget) 76 m_pWidget->showHelpForKeyword(strKeyword); 75 77 } 76 78 … … 92 94 { 93 95 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_DOCS_QHELP) && (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) 94 UIHelpBrowserWidget *pWidget = new UIHelpBrowserWidget(EmbedTo_Dialog, m_strHelpFilePath, m_strKeyword);95 if ( pWidget)96 m_pWidget = new UIHelpBrowserWidget(EmbedTo_Dialog, m_strHelpFilePath); 97 if (m_pWidget) 96 98 { 97 99 /* Configure widget: */ 98 setWidget( pWidget);99 setWidgetMenus( pWidget->menus());100 setWidget(m_pWidget); 101 setWidgetMenus(m_pWidget->menus()); 100 102 #ifdef VBOX_WS_MAC 101 setWidgetToolbar( pWidget->toolbar());103 setWidgetToolbar(m_pWidget->toolbar()); 102 104 #endif 103 connect( pWidget, &UIHelpBrowserWidget::sigSetCloseButtonShortCut,105 connect(m_pWidget, &UIHelpBrowserWidget::sigSetCloseButtonShortCut, 104 106 this, &UIHelpBrowserDialog::sltSetCloseButtonShortCut); 105 107 106 108 /* Add into layout: */ 107 centralWidget()->layout()->addWidget( pWidget);109 centralWidget()->layout()->addWidget(m_pWidget); 108 110 } 109 111 #endif -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserDialog.h
r86906 r86913 38 38 class QVBoxLayout; 39 39 class UIHelpBrowserDialog; 40 40 class UIHelpBrowserWidget; 41 41 42 42 /** QIManagerDialogFactory extension used as a factory for Log Viewer dialog. */ … … 46 46 public: 47 47 48 /** @param strHelpFilePath: the full path of the qHelp archive file. 49 * @param strKeyword: optional keyword string. Used in context sensitive help. */ 50 UIHelpBrowserDialogFactory(const QString &strHelpFilePath, const QString &strKeyword = QString()); 48 /** @param strHelpFilePath: the full path of the qHelp archive file. */ 49 UIHelpBrowserDialogFactory(const QString &strHelpFilePath); 51 50 UIHelpBrowserDialogFactory(); 52 51 … … 60 59 61 60 QString m_strHelpFilePath; 62 QString m_strKeyword;63 61 }; 64 62 … … 69 67 public: 70 68 71 UIHelpBrowserDialog(QWidget *pCenterWidget, const QString &strHelpFilePath, 72 const QString &strKeyword = QString()); 69 UIHelpBrowserDialog(QWidget *pCenterWidget, const QString &strHelpFilePath); 70 /** A passthru function for QHelpIndexWidget::showHelpForKeyword. */ 71 void showHelpForKeyword(const QString &strKeyword); 73 72 74 73 protected: … … 109 108 110 109 QString m_strHelpFilePath; 111 QString m_strKeyword;110 UIHelpBrowserWidget *m_pWidget; 112 111 }; 113 112 -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.cpp
r86906 r86913 405 405 /** Either start with a single tab showin the home url or saved tab(s). Depending on the params. passed to ctor. */ 406 406 void initializeTabs(); 407 /** Initialize with a single url. Effectively disables multitab. Possibly used in context sensitive help mode. */408 void initializeSingleTab(const QUrl &url);409 407 /* Url of the current tab. */ 410 408 QUrl currentSource() const; … … 418 416 int fontPointSize() const; 419 417 void setFontScaleWidgetVisible(bool fToggled); 420 void setMultiTabEnabled(bool fFlag);421 418 422 419 protected: … … 443 440 /** Immediately switch the newly created tab. Otherwise open the tab in background. */ 444 441 bool m_fSwitchToNewTab; 445 bool m_fMultiTabEnabled;446 442 bool m_fToolBarVisible; 447 443 }; … … 1418 1414 , m_savedUrlList(urlList) 1419 1415 , m_fSwitchToNewTab(true) 1420 , m_fMultiTabEnabled(true)1421 1416 , m_fToolBarVisible(true) 1422 1417 { … … 1426 1421 void UIHelpBrowserTabManager::addNewTab(const QUrl &initialUrl) 1427 1422 { 1428 if (!m_fMultiTabEnabled && count() >= 1)1429 return;1430 1423 UIHelpBrowserTab *pTabWidget = new UIHelpBrowserTab(m_pHelpEngine, m_homeUrl, initialUrl); 1431 1424 AssertReturnVoid(pTabWidget); … … 1466 1459 } 1467 1460 1468 void UIHelpBrowserTabManager::initializeSingleTab(const QUrl &url)1469 {1470 m_fMultiTabEnabled = false;1471 clearAndDeleteTabs();1472 addNewTab(url);1473 }1474 1475 1461 QUrl UIHelpBrowserTabManager::currentSource() const 1476 1462 { … … 1640 1626 *********************************************************************************************************************************/ 1641 1627 1642 UIHelpBrowserWidget::UIHelpBrowserWidget(EmbedTo enmEmbedding, const QString &strHelpFilePath, 1643 const QString &strKeyword /* = QString() */, QWidget *pParent /* = 0 */) 1628 UIHelpBrowserWidget::UIHelpBrowserWidget(EmbedTo enmEmbedding, const QString &strHelpFilePath, QWidget *pParent /* = 0 */) 1644 1629 : QIWithRetranslateUI<QWidget>(pParent) 1645 1630 , m_enmEmbedding(enmEmbedding) … … 1650 1635 , m_pToolBar(0) 1651 1636 , m_strHelpFilePath(strHelpFilePath) 1652 , m_strKeyword(strKeyword)1653 , m_fContextSensitiveMode(strKeyword.isEmpty() ? false : true)1654 1637 , m_pHelpEngine(0) 1655 1638 , m_pSplitter(0) … … 1673 1656 , m_pFontSizeResetAction(0) 1674 1657 , m_fModelContentCreated(false) 1658 , m_fIndexingFinished(false) 1675 1659 { 1676 1660 qRegisterMetaType<HelpBrowserTabs>("HelpBrowserTabs"); … … 1691 1675 << m_pViewMenu; 1692 1676 return menuList; 1677 } 1678 1679 void UIHelpBrowserWidget::showHelpForKeyword(const QString &strKeyword) 1680 { 1681 if (m_fIndexingFinished) 1682 findAndShowUrlForKeyword(strKeyword); 1683 else 1684 m_keywordList.append(strKeyword); 1693 1685 } 1694 1686 … … 1911 1903 void UIHelpBrowserWidget::saveOptions() 1912 1904 { 1913 /* dont save the url list if context sensitive mode; */ 1914 if (m_pTabManager && !m_fContextSensitiveMode) 1905 if (m_pTabManager) 1915 1906 gEDataManager->setHelpBrowserLastUrlList(m_pTabManager->tabUrlList()); 1916 1907 } … … 2016 2007 } 2017 2008 2009 void UIHelpBrowserWidget::findAndShowUrlForKeyword(const QString &strKeyword) 2010 { 2011 QMap<QString, QUrl> map = m_pHelpEngine->linksForIdentifier(strKeyword); 2012 if (!map.isEmpty()) 2013 { 2014 /* We have to a have a single url per keyword in this case: */ 2015 QUrl keywordUrl = map.first(); 2016 m_pTabManager->setSource(keywordUrl, true /* new tab */); 2017 } 2018 } 2019 2018 2020 void UIHelpBrowserWidget::sltHandleWidgetVisibilityToggle(bool fToggled) 2019 2021 { … … 2047 2049 void UIHelpBrowserWidget::sltHandleHelpEngineSetupFinished() 2048 2050 { 2051 AssertReturnVoid(m_pTabManager); 2052 m_fIndexingFinished = true; 2053 m_pTabManager->initializeTabs(); 2049 2054 } 2050 2055 … … 2098 2103 2099 2104 m_pSearchContainerWidget->setEnabled(true); 2100 if (!m_fContextSensitiveMode) 2101 m_pTabManager->initializeTabs(); 2102 else 2103 { 2104 QMap<QString, QUrl> map = m_pHelpEngine->linksForIdentifier(m_strKeyword); 2105 if (!map.isEmpty()) 2106 { 2107 /* We have to a have a single url per keyword in this case: */ 2108 QUrl keywordUrl = map.first(); 2109 m_pTabManager->initializeSingleTab(keywordUrl); 2110 } 2111 } 2105 m_fIndexingFinished = true; 2106 /* Process the keyword queue. */ 2107 foreach (const QString strKeyword, m_keywordList) 2108 findAndShowUrlForKeyword(strKeyword); 2109 m_keywordList.clear(); 2110 2112 2111 } 2113 2112 -
trunk/src/VBox/Frontends/VirtualBox/src/helpbrowser/UIHelpBrowserWidget.h
r86906 r86913 67 67 public: 68 68 69 UIHelpBrowserWidget(EmbedTo enmEmbedding, const QString &strHelpFilePath, 70 const QString &strKeyword = QString(), QWidget *pParent = 0); 69 UIHelpBrowserWidget(EmbedTo enmEmbedding, const QString &strHelpFilePath, QWidget *pParent = 0); 71 70 ~UIHelpBrowserWidget(); 72 73 71 QList<QMenu*> menus() const; 74 72 void showHelpForKeyword(const QString &strKeyword); 75 73 #ifdef VBOX_WS_MAC 76 74 QIToolBar *toolbar() const { return m_pToolBar; } … … 130 128 virtual void keyPressEvent(QKeyEvent *pEvent) /* override */; 131 129 /** @} */ 130 /* Looks for Url for the keyword using QHelpEngine API and shows it in a new tab whne successful. */ 131 void findAndShowUrlForKeyword(const QString &strKeyword); 132 132 133 133 /** Holds the widget's embedding type. */ 134 134 const EmbedTo m_enmEmbedding; 135 /** Hold sthe action-pool reference. */136 135 UIActionPool *m_pActionPool; 137 138 /** Holds whether the dialog is polished. */139 136 bool m_fIsPolished; 140 137 141 /** Holds container for log-pages. */142 138 QVBoxLayout *m_pMainLayout; 143 139 QHBoxLayout *m_pTopLayout; 140 /** Container tab widget for content, index, bookmark widgets. Sits on a side bar. */ 141 QITabWidget *m_pTabWidget; 144 142 145 QITabWidget *m_pTabWidget;146 143 /** @name Toolbar and menu variables. 147 144 * @{ */ 148 QIToolBar *m_pToolBar;145 QIToolBar *m_pToolBar; 149 146 /** @} */ 150 147 151 148 QString m_strHelpFilePath; 152 149 /** Start the browser with this keyword. When not empty widget is shown `only` with html viewer and single tab.*/ 153 QString m_strKeyword;154 bool m_fContextSensitiveMode;155 150 QHelpEngine *m_pHelpEngine; 156 151 QSplitter *m_pSplitter; … … 175 170 /* This is set t true when handling QHelpContentModel::contentsCreated signal. */ 176 171 bool m_fModelContentCreated; 172 bool m_fIndexingFinished; 173 /** This queue is used in unlikely case where possibly several keywords are requested to be shown 174 * but indexing is not yet finished. In that case we queue the keywords and process them after 175 * after indexing is finished. */ 176 QStringList m_keywordList; 177 177 }; 178 178 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r86907 r86913 118 118 { 119 119 const int iIndex = m_pages.value(cId); 120 setHelpButtonHelpTag( iIndex);120 setHelpButtonHelpTag(cId); 121 121 #ifdef VBOX_WS_MAC 122 122 /* If index is within the stored size list bounds: */ … … 423 423 pSettingsPage->setId(cId); 424 424 assignValidator(pSettingsPage); 425 }426 }427 428 void UISettingsDialog::enableHelpButton()429 {430 if (m_pButtonBox)431 {432 QPushButton *pHelpButton = m_pButtonBox->addButton(QDialogButtonBox::Help);433 if (pHelpButton)434 connect(pHelpButton, &QAbstractButton::pressed,435 &(msgCenter()), &UIMessageCenter::sltHandleDialogHelpButtonPress);436 425 } 437 426 } … … 784 773 m_pButtonBox = new QIDialogButtonBox(pCentralWidget); 785 774 m_pButtonBox->setObjectName(QStringLiteral("m_pButtonBox")); 786 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok); 775 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::NoButton| 776 QDialogButtonBox::Ok| QDialogButtonBox::Help); 787 777 pMainLayout->addWidget(m_pButtonBox, 2, 0, 1, 2); 788 778 … … 791 781 QObject::connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UISettingsDialog::reject); 792 782 QObject::connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UISettingsDialog::accept); 783 connect(m_pButtonBox->button(QDialogButtonBox::Help), &QAbstractButton::pressed, 784 &(msgCenter()), &UIMessageCenter::sltHandleDialogHelpButtonPress); 793 785 } 794 786 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
r86907 r86913 136 136 virtual void recorrelate(UISettingsPage *pSettingsPage) { Q_UNUSED(pSettingsPage); } 137 137 138 /** Inserts the standard help button to the button box of the dialog and make a connection to the appropirate slot. */139 void enableHelpButton();140 138 /** Set/change/reset the help tag of the help buttons help tag. Possibly used as tabs are changed. Searches the map 141 139 * m_pageHelpTags for the help tag for the page with @iPageType (GlobalSettingsPageType or MachineSettingsPageType) */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r86907 r86913 197 197 addItem(":/machine_32px.png", ":/machine_24px.png", ":/machine_16px.png", 198 198 iPageIndex, "#general", pSettingsPage); 199 addPageHelpTag(iPageIndex, "globalsettings"); 199 200 break; 200 201 } … … 205 206 addItem(":/keyboard_32px.png", ":/keyboard_24px.png", ":/keyboard_16px.png", 206 207 iPageIndex, "#input", pSettingsPage); 208 addPageHelpTag(iPageIndex, "globalsettings"); 207 209 break; 208 210 } … … 214 216 addItem(":/refresh_32px.png", ":/refresh_24px.png", ":/refresh_16px.png", 215 217 iPageIndex, "#update", pSettingsPage); 218 addPageHelpTag(iPageIndex, "globalsettings"); 216 219 break; 217 220 } … … 223 226 addItem(":/site_32px.png", ":/site_24px.png", ":/site_16px.png", 224 227 iPageIndex, "#language", pSettingsPage); 228 addPageHelpTag(iPageIndex, "globalsettings"); 225 229 break; 226 230 } … … 231 235 addItem(":/vrdp_32px.png", ":/vrdp_24px.png", ":/vrdp_16px.png", 232 236 iPageIndex, "#display", pSettingsPage); 237 addPageHelpTag(iPageIndex, "globalsettings"); 233 238 break; 234 239 } … … 239 244 addItem(":/nw_32px.png", ":/nw_24px.png", ":/nw_16px.png", 240 245 iPageIndex, "#network", pSettingsPage); 246 addPageHelpTag(iPageIndex, "globalsettings"); 241 247 break; 242 248 } … … 247 253 addItem(":/extension_pack_32px.png", ":/extension_pack_24px.png", ":/extension_pack_16px.png", 248 254 iPageIndex, "#extensions", pSettingsPage); 255 addPageHelpTag(iPageIndex, "globalsettings"); 249 256 break; 250 257 } … … 256 263 addItem(":/proxy_32px.png", ":/proxy_24px.png", ":/proxy_16px.png", 257 264 iPageIndex, "#proxy", pSettingsPage); 265 addPageHelpTag(iPageIndex, "globalsettings"); 258 266 break; 259 267 } … … 721 729 addItem(":/vrdp_32px.png", ":/vrdp_24px.png", ":/vrdp_16px.png", 722 730 iPageIndex, "#display", pSettingsPage); 731 addPageHelpTag(iPageIndex, "settings-display"); 723 732 break; 724 733 } … … 731 740 addItem(":/hd_32px.png", ":/hd_24px.png", ":/hd_16px.png", 732 741 iPageIndex, "#storage", pSettingsPage); 742 addPageHelpTag(iPageIndex, "settings-storage"); 733 743 break; 734 744 } … … 739 749 addItem(":/sound_32px.png", ":/sound_24px.png", ":/sound_16px.png", 740 750 iPageIndex, "#audio", pSettingsPage); 751 addPageHelpTag(iPageIndex, "settings-audio"); 741 752 break; 742 753 } … … 747 758 addItem(":/nw_32px.png", ":/nw_24px.png", ":/nw_16px.png", 748 759 iPageIndex, "#network", pSettingsPage); 760 addPageHelpTag(iPageIndex, "settings-network"); 749 761 break; 750 762 } … … 762 774 addItem(":/serial_port_32px.png", ":/serial_port_24px.png", ":/serial_port_16px.png", 763 775 iPageIndex, "#serialPorts", pSettingsPage, MachineSettingsPageType_Ports); 776 addPageHelpTag(iPageIndex, "serialports"); 764 777 break; 765 778 } … … 770 783 addItem(":/usb_32px.png", ":/usb_24px.png", ":/usb_16px.png", 771 784 iPageIndex, "#usb", pSettingsPage, MachineSettingsPageType_Ports); 785 addPageHelpTag(iPageIndex, "usb-support"); 772 786 break; 773 787 } … … 778 792 addItem(":/sf_32px.png", ":/sf_24px.png", ":/sf_16px.png", 779 793 iPageIndex, "#sharedFolders", pSettingsPage); 794 addPageHelpTag(iPageIndex, "shared-folders"); 780 795 break; 781 796 } … … 786 801 addItem(":/interface_32px.png", ":/interface_24px.png", ":/interface_16px.png", 787 802 iPageIndex, "#userInterface", pSettingsPage); 803 addPageHelpTag(iPageIndex, "user-interface"); 788 804 break; 789 805 } … … 833 849 else 834 850 m_pSelector->selectById(MachineSettingsPageType_General); 835 836 /* Enabled the 'Help' button of the button box for the context senstive help: */837 enableHelpButton();838 851 } 839 852
Note:
See TracChangeset
for help on using the changeset viewer.