Newer
Older
#include "MantidQtCustomInterfaces/Reflectometry/ReflMainWindowPresenter.h"
#include "MantidQtCustomInterfaces/Reflectometry/IReflMainWindowView.h"
#include "MantidQtCustomInterfaces/Reflectometry/IReflRunsTabPresenter.h"
#include "MantidQtCustomInterfaces/Reflectometry/IReflSettingsTabPresenter.h"
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
namespace MantidQt {
namespace CustomInterfaces {
/** Constructor
* @param view :: [input] The view we are managing
* @param runsPresenter :: [input] A pointer to the 'Runs' tab presenter
* @param settingsPresenter :: [input] A pointer to the 'Settings' tab presenter
*/
ReflMainWindowPresenter::ReflMainWindowPresenter(
IReflMainWindowView *view, IReflRunsTabPresenter *runsPresenter,
IReflSettingsTabPresenter *settingsPresenter)
: m_view(view), m_runsPresenter(runsPresenter),
m_settingsPresenter(settingsPresenter) {
// Tell the tab presenters that this is going to be the main presenter
m_runsPresenter->acceptMainPresenter(this);
m_settingsPresenter->acceptMainPresenter(this);
}
/** Destructor
*/
ReflMainWindowPresenter::~ReflMainWindowPresenter() {}
/** Returns global pre-processing options
* @return :: Global pre-processing options
*/
std::map<std::string, std::string>
ReflMainWindowPresenter::getPreprocessingOptions() {
// Empty map at present
// Options to 'CreateTransmissionWorkspaceAuto' are likely to be added
// in the future
return std::map<std::string, std::string>();
}
/** Returns global processing options
* @return :: Global processing options
*/
std::string ReflMainWindowPresenter::getProcessingOptions() {
// Request global processing options to 'Settings' presenter
return m_settingsPresenter->getProcessingOptions();
}
/** Returns global post-processing options
* @return :: Global post-processing options
*/
std::string ReflMainWindowPresenter::getPostprocessingOptions() {
// Request global post-processing options to 'Settings' presenter
return m_settingsPresenter->getPostprocessingOptions();
}
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/**
Tells the view to show an critical error dialog
@param prompt : The prompt to appear on the dialog
@param title : The text for the title bar of the dialog
*/
void ReflMainWindowPresenter::giveUserCritical(std::string prompt,
std::string title) {
m_view->giveUserCritical(prompt, title);
}
/**
Tells the view to show a warning dialog
@param prompt : The prompt to appear on the dialog
@param title : The text for the title bar of the dialog
*/
void ReflMainWindowPresenter::giveUserWarning(std::string prompt,
std::string title) {
m_view->giveUserWarning(prompt, title);
}
/**
Tells the view to show an information dialog
@param prompt : The prompt to appear on the dialog
@param title : The text for the title bar of the dialog
*/
void ReflMainWindowPresenter::giveUserInfo(std::string prompt,
std::string title) {
m_view->giveUserInfo(prompt, title);
}
/**
Tells the view to ask the user a Yes/No question
@param prompt : The prompt to appear on the dialog
@param title : The text for the title bar of the dialog
@returns a boolean true if Yes, false if No
*/
bool ReflMainWindowPresenter::askUserYesNo(std::string prompt,
std::string title) {
return m_view->askUserYesNo(prompt, title);
}
/**
Tells the view to ask the user to enter a string.
@param prompt : The prompt to appear on the dialog
@param title : The text for the title bar of the dialog
@param defaultValue : The default value entered.
@returns The user's string if submitted, or an empty string
*/
std::string
ReflMainWindowPresenter::askUserString(const std::string &prompt,
const std::string &title,
const std::string &defaultValue) {
return m_view->askUserString(prompt, title, defaultValue);
}
/**
Tells the view to show the user the dialog for an algorithm
* @param pythonCode : [input] The algorithm as python code
* @return : Result of the execution
*/
std::string
ReflMainWindowPresenter::runPythonAlgorithm(const std::string &pythonCode) {
return m_view->runPythonAlgorithm(pythonCode);
}