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

@@ -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().

View File

@@ -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;

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;

View File

@@ -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()

View File

@@ -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));
}