From a74be7479202dcd10dfbca559ccc19f7e4fa5b81 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 24 Oct 2013 10:46:57 +0200 Subject: [PATCH] Open Users Guide url from Help menu --- ApplicationCode/UserInterface/RiuMainWindow.cpp | 17 +++++++++++++++++ ApplicationCode/UserInterface/RiuMainWindow.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index 0f74ba9e92..8f0fa94197 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -281,6 +281,8 @@ void RiuMainWindow::createActions() connect(m_aboutAction, SIGNAL(triggered()), SLOT(slotAbout())); m_commandLineHelpAction = new QAction("&Command Line Help", this); connect(m_commandLineHelpAction, SIGNAL(triggered()), SLOT(slotShowCommandLineHelp())); + m_openUsersGuideInBrowserAction = new QAction("&Users Guide", this); + connect(m_openUsersGuideInBrowserAction, SIGNAL(triggered()), SLOT(slotOpenUsersGuideInBrowserAction())); // Draw style actions m_dsActionGroup = new QActionGroup(this); @@ -390,6 +392,7 @@ void RiuMainWindow::createMenus() // Help menu QMenu* helpMenu = menuBar()->addMenu("&Help"); + helpMenu->addAction(m_openUsersGuideInBrowserAction); helpMenu->addAction(m_aboutAction); helpMenu->addAction(m_commandLineHelpAction); } @@ -1798,3 +1801,17 @@ void RiuMainWindow::slotAddWellCellsToRangeFilterAction(bool doAdd) riv->wellCollection()->wellCellsToRangeFilterMode.setValueFromUi(static_cast(rangeAddType.index())); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindow::slotOpenUsersGuideInBrowserAction() +{ + QString usersGuideUrl = "https://github.com/OPM/ResInsight/blob/internal/Documentation/UsersGuide/UsersGuide.md"; + + if (!QDesktopServices::openUrl(usersGuideUrl)) + { + QErrorMessage* errorHandler = QErrorMessage::qtHandler(); + errorHandler->showMessage("Failed open browser with the following url\n\n" + usersGuideUrl); + } +} diff --git a/ApplicationCode/UserInterface/RiuMainWindow.h b/ApplicationCode/UserInterface/RiuMainWindow.h index 03fcaca2b8..eea849c1a8 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.h +++ b/ApplicationCode/UserInterface/RiuMainWindow.h @@ -163,6 +163,7 @@ private: // Help actions QAction* m_aboutAction; QAction* m_commandLineHelpAction; + QAction* m_openUsersGuideInBrowserAction; // Animation caf::AnimationToolBar* m_animationToolBar; @@ -245,6 +246,7 @@ private slots: // Help slots void slotAbout(); void slotShowCommandLineHelp(); + void slotOpenUsersGuideInBrowserAction(); void slotSubWindowActivated(QMdiSubWindow* subWindow); void slotCurrentChanged(const QModelIndex & current, const QModelIndex & previous);