mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +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:
@@ -57,6 +57,11 @@ namespace BlackCore
|
||||
return getDbRootDirectoryUrl().withAppendedPath("/page/index.php");
|
||||
}
|
||||
|
||||
CUrl CGlobalSetup::getHelpPageUrl() const
|
||||
{
|
||||
return getDbRootDirectoryUrl().withAppendedPath("/page/index.php");
|
||||
}
|
||||
|
||||
CUrl CGlobalSetup::getDbLoginServiceUrl() const
|
||||
{
|
||||
return getDbRootDirectoryUrl().
|
||||
|
||||
@@ -84,6 +84,9 @@ namespace BlackCore
|
||||
//! Home page url
|
||||
BlackMisc::Network::CUrl getDbHomePageUrl() const;
|
||||
|
||||
//! Help page URL
|
||||
BlackMisc::Network::CUrl getHelpPageUrl() const;
|
||||
|
||||
//! Login service
|
||||
BlackMisc::Network::CUrl getDbLoginServiceUrl() const;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -123,6 +123,7 @@ void CSwiftData::initMenu()
|
||||
sGui->addMenuFile(*this->ui->menu_File);
|
||||
sGui->addMenuInternals(*this->ui->menu_Internals);
|
||||
sGui->addMenuWindow(*this->ui->menu_Window);
|
||||
sGui->addMenuHelp(*this->ui->menu_Help);
|
||||
}
|
||||
|
||||
void CSwiftData::performGracefulShutdown()
|
||||
|
||||
@@ -72,5 +72,6 @@ void SwiftGuiStd::initMenus()
|
||||
sGui->addMenuFile(*this->ui->menu_File);
|
||||
sGui->addMenuInternals(*this->ui->menu_Internals);
|
||||
sGui->addMenuWindow(*this->ui->menu_Window);
|
||||
sGui->addMenuHelp(*this->ui->menu_Help);
|
||||
this->ui->menu_InfoAreas->addActions(this->ui->comp_MainInfoArea->getInfoAreaSelectActions(this->ui->menu_InfoAreas));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user