From 3f52e5f086c43d14ec107ba0bb533e210cf8ba6a Mon Sep 17 00:00:00 2001
From: Edward Brown <edward.brown@stfc.ac.uk>
Date: Fri, 26 Jan 2018 16:11:06 +0000
Subject: [PATCH] Re #21167 Add link to help page.

---
 .../ISISReflectometry/CMakeLists.txt          |  1 +
 .../IReflMainWindowPresenter.h                |  2 +-
 .../QtReflMainWindowView.cpp                  |  6 ++
 .../ISISReflectometry/QtReflMainWindowView.h  |  4 ++
 .../ReflMainWindowPresenter.cpp               |  9 +++
 .../ReflMainWindowPresenter.h                 |  1 +
 .../ISISReflectometry/ReflMainWindowWidget.ui | 57 +++++++++++--------
 7 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/qt/scientific_interfaces/ISISReflectometry/CMakeLists.txt b/qt/scientific_interfaces/ISISReflectometry/CMakeLists.txt
index 7f418e9aa0c..fae84b62681 100644
--- a/qt/scientific_interfaces/ISISReflectometry/CMakeLists.txt
+++ b/qt/scientific_interfaces/ISISReflectometry/CMakeLists.txt
@@ -82,6 +82,7 @@ set ( MOC_FILES
     QtReflSaveTabView.h
     QtReflSettingsTabView.h
     QtReflSettingsView.h
+    QtReflMainWindowView.h
 )
 
 set ( UI_FILES
diff --git a/qt/scientific_interfaces/ISISReflectometry/IReflMainWindowPresenter.h b/qt/scientific_interfaces/ISISReflectometry/IReflMainWindowPresenter.h
index 2ced88b289a..717bbdae174 100644
--- a/qt/scientific_interfaces/ISISReflectometry/IReflMainWindowPresenter.h
+++ b/qt/scientific_interfaces/ISISReflectometry/IReflMainWindowPresenter.h
@@ -40,7 +40,7 @@ public:
   /// Destructor
   virtual ~IReflMainWindowPresenter(){};
 
-  enum class Flag { ConfirmReductionPausedFlag, ConfirmReductionResumedFlag };
+  enum class Flag { ConfirmReductionPausedFlag, ConfirmReductionResumedFlag, HelpPressed };
   virtual void notify(Flag flag) = 0;
 
   /// Pre-processing
diff --git a/qt/scientific_interfaces/ISISReflectometry/QtReflMainWindowView.cpp b/qt/scientific_interfaces/ISISReflectometry/QtReflMainWindowView.cpp
index 5261dde7123..ee29e44a1c1 100644
--- a/qt/scientific_interfaces/ISISReflectometry/QtReflMainWindowView.cpp
+++ b/qt/scientific_interfaces/ISISReflectometry/QtReflMainWindowView.cpp
@@ -35,11 +35,17 @@ void QtReflMainWindowView::initLayout() {
   auto settingsPresenter = createSettingsTab();
   auto savePresenter = createSaveTab();
 
+  connect(m_ui.helpButton, SIGNAL(clicked()), this, SLOT(helpPressed()));
+
   // Create the presenter
   m_presenter.reset(new ReflMainWindowPresenter(
       this, runsPresenter, eventPresenter, settingsPresenter, savePresenter));
 }
 
+void QtReflMainWindowView::helpPressed() {
+  m_presenter->notify(IReflMainWindowPresenter::Flag::HelpPressed);
+}
+
 /** Creates the 'Runs' tab and returns a pointer to its presenter
 * @return :: A pointer to the presenter managing the 'Runs' tab
 */
diff --git a/qt/scientific_interfaces/ISISReflectometry/QtReflMainWindowView.h b/qt/scientific_interfaces/ISISReflectometry/QtReflMainWindowView.h
index 7916589ac74..6cb5f70be8f 100644
--- a/qt/scientific_interfaces/ISISReflectometry/QtReflMainWindowView.h
+++ b/qt/scientific_interfaces/ISISReflectometry/QtReflMainWindowView.h
@@ -44,6 +44,7 @@ Code Documentation is available at: <http://doxygen.mantidproject.org>
 */
 class QtReflMainWindowView : public MantidQt::API::UserSubWindow,
                              public IReflMainWindowView {
+  Q_OBJECT
 public:
   /// Constructor
   explicit QtReflMainWindowView(QWidget *parent = nullptr);
@@ -66,6 +67,9 @@ public:
   /// Close window handler
   void closeEvent(QCloseEvent *event) override;
 
+public slots:
+  void helpPressed();
+
 private:
   /// Initializes the interface
   void initLayout() override;
diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp
index 95742d9cc15..9eddec5f939 100644
--- a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp
+++ b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp
@@ -4,6 +4,7 @@
 #include "IReflEventTabPresenter.h"
 #include "IReflSettingsTabPresenter.h"
 #include "IReflSaveTabPresenter.h"
+#include "MantidQtWidgets/Common/HelpWindow.h"
 #include <iostream>
 
 using namespace MantidQt::MantidWidgets::DataProcessor;
@@ -53,11 +54,19 @@ void ReflMainWindowPresenter::notify(IReflMainWindowPresenter::Flag flag) {
   case Flag::ConfirmReductionResumedFlag:
     m_isProcessing = true;
     break;
+  case Flag::HelpPressed:
+    showHelp();
+    break;
   }
   // Not having a 'default' case is deliberate. gcc issues a warning if there's
   // a flag we aren't handling.
 }
 
+void ReflMainWindowPresenter::showHelp() {
+  MantidQt::API::HelpWindow::showCustomInterface(
+      nullptr, QString("ISIS Reflectometry"));
+}
+
 void ReflMainWindowPresenter::settingsChanged(int group) {
   m_runsPresenter->settingsChanged(group);
 }
diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h
index b6c75d20c6c..fd7a8346577 100644
--- a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h
+++ b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h
@@ -94,6 +94,7 @@ private:
   void pauseReduction() const;
   /// Resumes reduction in the Runs Tab
   void resumeReduction() const;
+  void showHelp();
   /// The view we are handling
   IReflMainWindowView *m_view;
   /// The presenter of tab 'Runs'
diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowWidget.ui b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowWidget.ui
index ea85fadb3f1..27ccd181ebd 100644
--- a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowWidget.ui
+++ b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowWidget.ui
@@ -4,39 +4,48 @@
  <widget class="QMainWindow" name="RelMainWindowWidget">
   <property name="geometry">
    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>959</width>
-     <height>346</height>
+    <x>0</x>
+    <y>0</y>
+    <width>975</width>
+    <height>515</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>ISIS Reflectometry</string>
   </property>
   <widget class="QWidget" name="centralwidget">
-   <layout class="QGridLayout" name="gridLayout">
-    <property name="leftMargin">
-     <number>3</number>
-    </property>
-    <property name="topMargin">
-     <number>3</number>
-    </property>
-    <property name="rightMargin">
-     <number>3</number>
-    </property>
-    <property name="bottomMargin">
-     <number>1</number>
-    </property>
-    <property name="spacing">
-     <number>1</number>
-    </property>
-    <item row="0" column="0">
-      <widget class="QTabWidget" name="mainTab">
-      </widget>/>
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QTabWidget" name="mainTab"/>
+    </item>
+    <item>
+     <widget class="QPushButton" name="helpButton">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>30</width>
+        <height>30</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>30</width>
+        <height>30</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>?</string>
+      </property>
+     </widget>
     </item>
    </layout>
   </widget>
  </widget>
  <resources/>
  <connections/>
-</ui>
\ No newline at end of file
+</ui>
-- 
GitLab