Newer
Older
#include "QtReflEventTabView.h"
#include "ReflEventTabPresenter.h"
namespace MantidQt {
namespace CustomInterfaces {
/** Constructor
* @param group :: [input] The group on the parent tab this belongs to
* @param parent :: [input] The parent of this widget
*/
QtReflEventTabView::QtReflEventTabView(QWidget *parent) {
UNUSED_ARG(parent);
initLayout();
registerEventWidgets();
void QtReflEventTabView::subscribe(EventTabViewSubscriber *notifyee) {
void QtReflEventTabView::initLayout() {
m_ui.setupUi(this);
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
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
initUniformSliceTypeLayout();
initUniformEvenSliceTypeLayout();
initLogValueSliceTypeLayout();
initCustomSliceTypeLayout();
m_sliceTypeRadioButtons =
makeQWidgetGroup(m_ui.uniformEvenButton, m_ui.uniformButton,
m_ui.logValueButton, m_ui.customButton);
}
void QtReflEventTabView::initUniformSliceTypeLayout() {
m_uniformGroup = makeQWidgetGroup(m_ui.uniformEdit, m_ui.uniformLabel);
connect(m_ui.uniformButton, SIGNAL(toggled(bool)), this,
SLOT(toggleUniform(bool)));
connect(m_ui.);
}
void QtReflEventTabView::initUniformEvenSliceTypeLayout() {
m_uniformEvenGroup =
makeQWidgetGroup(m_ui.uniformEvenEdit, m_ui.uniformEvenLabel);
connect(m_ui.uniformEvenButton, SIGNAL(toggled(bool)), this,
SLOT(toggleUniformEven(bool)));
}
void QtReflEventTabView::initCustomSliceTypeLayout() {
m_customGroup = makeQWidgetGroup(m_ui.customEdit, m_ui.customLabel);
connect(m_ui.customButton, SIGNAL(toggled(bool)), this,
SLOT(toggleCustom(bool)));
}
void QtReflEventTabView::initLogValueSliceTypeLayout() {
m_logValueGroup =
makeQWidgetGroup(m_ui.logValueTypeEdit, m_ui.logValueTypeLabel,
m_ui.logValueEdit, m_ui.logValueLabel);
connect(m_ui.logValueButton, SIGNAL(toggled(bool)), this,
SLOT(toggleLogValue(bool)));
}
void QtReflEventTabView::enableSliceType(SliceType sliceType) {
switch (sliceType) {
case SliceType::Uniform:
m_uniformGroup.enable();
break;
case SliceType::UniformEven:
m_uniformEvenGroup.enable();
break;
case SliceType::Custom:
m_customGroup.enable();
break;
case SliceType::LogValue:
m_logValueGroup.enable();
break;
}
}
void QtReflEventTabView::disableSliceType(SliceType sliceType) {
switch (sliceType) {
case SliceType::Uniform:
m_uniformGroup.disable();
break;
case SliceType::UniformEven:
m_uniformEvenGroup.disable();
break;
case SliceType::Custom:
m_customGroup.disable();
break;
case SliceType::LogValue:
m_logValueGroup.disable();
break;
}
}
std::string QtReflEventTabView::getLogValueTimeSlicingType() const {
return textFrom(m_ui.logValueTypeEdit);
}
std::string QtReflEventTabView::getLogValueTimeSlicingValues() const {
return textFrom(m_ui.logValueEdit);
}
std::string QtReflEventTabView::getCustomTimeSlicingValues() const {
return textFrom(m_ui.customEdit);
}
std::string QtReflEventTabView::getUniformTimeSlicingValues() const {
return textFrom(m_ui.uniformEdit);
}
std::string QtReflEventTabView::getUniformEvenTimeSlicingValues() const {
return textFrom(m_ui.uniformEvenEdit);
}
std::string QtReflEventTabView::textFrom(QLineEdit const *const widget) const {
return widget->text().toStdString();
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
void QtReflEventTabView::disableSliceTypeSelection() {
m_sliceTypeRadioButtons.disable();
}
void QtReflEventTabView::enableSliceTypeSelection() {
m_sliceTypeRadioButtons.enable();
}
void QtReflEventTabView::toggleUniform(bool isChecked) {
if (isChecked)
m_notifyee->notifySliceTypeChanged(SliceType::Uniform);
}
void QtReflEventTabView::toggleUniformEven(bool isChecked) {
if (isChecked)
m_notifyee->notifySliceTypeChanged(SliceType::UniformEven);
}
void QtReflEventTabView::toggleCustom(bool isChecked) {
if (isChecked)
m_notifyee->notifySliceTypeChanged(SliceType::Custom);
}
void QtReflEventTabView::toggleLogValue(bool isChecked) {
if (isChecked)
m_notifyee->notifySliceTypeChanged(SliceType::LogValue);
}
void QtReflEventTabView::notifySettingsChanged() {
m_notifyee->notifySettingsChanged();
}
void QtReflEventTabView::connectSettingsChange(QLineEdit &edit) {
connect(&edit, SIGNAL(textChanged(QString const &)), this,
SLOT(notifySettingsChanged()));
}
void QtReflEventTabView::connectSettingsChange(QGroupBox &edit) {
connect(&edit, SIGNAL(toggled(bool)), this, SLOT(notifySettingsChanged()));
}
void QtReflEventTabView::registerEventWidgets() {
connectSettingsChange(*m_ui.uniformGroup);
connectSettingsChange(*m_ui.uniformEvenEdit);
connectSettingsChange(*m_ui.uniformEdit);
connectSettingsChange(*m_ui.customGroup);
connectSettingsChange(*m_ui.customEdit);
connectSettingsChange(*m_ui.logValueGroup);
connectSettingsChange(*m_ui.logValueEdit);
connectSettingsChange(*m_ui.logValueTypeEdit);
}
} // namespace Mantid