refs #680, call help URL from menu

* added central functionality in CGuiApplication
* function in global setup for URL
This commit is contained in:
Klaus Basan
2016-06-21 02:29:28 +02:00
parent 22162970fd
commit 83d0234d3c
6 changed files with 30 additions and 0 deletions

View File

@@ -44,6 +44,8 @@
using namespace BlackConfig;
using namespace BlackMisc;
using namespace BlackMisc::Network;
using namespace BlackCore::Data;
BlackGui::CGuiApplication *sGui = nullptr; // set by constructor
@@ -454,6 +456,21 @@ namespace BlackGui
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
}
void CGuiApplication::addMenuHelp(QMenu &menu)
{
QWidget *w = mainApplicationWindow();
if (!w) { return; }
const CGlobalSetup gs = this->getGlobalSetup();
const CUrl helpPage = gs.getHelpPageUrl();
QAction *a = menu.addAction(w->style()->standardIcon(QStyle::SP_TitleBarContextHelpButton), "Online help");
bool c = connect(a, &QAction::triggered, this, [helpPage]()
{
QDesktopServices::openUrl(helpPage);
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
}
const CStyleSheetUtility &CGuiApplication::getStyleSheetUtility() const
{
return this->m_styleSheetUtility;

View File

@@ -126,6 +126,9 @@ namespace BlackGui
//! Window operations
void addMenuWindow(QMenu &menu);
//! Help operations
void addMenuHelp(QMenu &menu);
//! Style sheet handling
const CStyleSheetUtility &getStyleSheetUtility() const;