mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-24 06:25:37 +08:00
refs #680, call help URL from menu
* added central functionality in CGuiApplication * function in global setup for URL
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user