Commit d13457cc authored by Anthony Lim's avatar Anthony Lim
Browse files

refs #26904 rename BaseInstrument* for custom instrument views

parent a5759a43
......@@ -7,7 +7,7 @@
#ifndef MANTIDQT_CUSTOMINTERFACES_ALFVIEWMODEL_H_
#define MANTIDQT_CUSTOMINTERFACES_ALFVIEWMODEL_H_
#include "MantidQtWidgets/InstrumentView/BaseInstrumentModel.h"
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentModel.h"
#include "MantidAPI/CompositeFunction.h"
#include "MantidAPI/FunctionFactory.h"
......@@ -17,7 +17,7 @@
namespace MantidQt {
namespace CustomInterfaces {
class ALFView_model : public MantidWidgets::BaseInstrumentModel {
class ALFView_model : public MantidWidgets::BaseCustomInstrumentModel {
public:
ALFView_model();
......
......@@ -18,7 +18,7 @@ namespace CustomInterfaces {
ALFView_presenter::ALFView_presenter(ALFView_view *view, ALFView_model *model,
MantidWidgets::PlotFitAnalysisPanePresenter *analysisPane)
: BaseInstrumentPresenter(view, model, analysisPane->getView()),
: BaseCustomInstrumentPresenter(view, model, analysisPane->getView()),
m_view(view), m_model(model), m_analysisPane(analysisPane),
m_extractSingleTubeObserver(nullptr), m_averageTubeObserver(nullptr) {
addInstrument();
......
......@@ -7,7 +7,7 @@
#ifndef MANTIDQT_CUSTOMINTERFACES_ALFVIEWPRESENTER_H_
#define MANTIDQT_CUSTOMINTERFACES_ALFVIEWPRESENTER_H_
#include "MantidQtWidgets/InstrumentView/BaseInstrumentPresenter.h"
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentPresenter.h"
#include "MantidQtWidgets/InstrumentView/PlotFitAnalysisPanePresenter.h"
#include "ALFView_model.h"
......@@ -20,7 +20,8 @@
namespace MantidQt {
namespace CustomInterfaces {
class MANTIDQT_DIRECT_DLL ALFView_presenter : public MantidWidgets::BaseInstrumentPresenter {
class MANTIDQT_DIRECT_DLL ALFView_presenter
: public MantidWidgets::BaseCustomInstrumentPresenter {
Q_OBJECT
public:
......
......@@ -16,7 +16,7 @@ namespace MantidQt {
namespace CustomInterfaces {
ALFView_view::ALFView_view(const std::string &instrument, QWidget *parent)
: BaseInstrumentView(instrument, parent),
: MantidWidgets::BaseCustomInstrumentView(instrument, parent),
m_extractSingleTubeObservable(nullptr), m_averageTubeObservable(nullptr),
m_extractAction(nullptr), m_averageAction(nullptr),
m_analysisPane(nullptr) {
......@@ -84,7 +84,7 @@ void ALFView_view::setupAnalysisPane(MantidWidgets::PlotFitAnalysisPaneView *ana
// keep a copy here so we can use a custom class
m_analysisPane = analysis;
// just adds it to the view
BaseInstrumentView::setupInstrumentAnalysisSplitters(analysis);
BaseCustomInstrumentView::setupInstrumentAnalysisSplitters(analysis);
}
void ALFView_view::addSpectrum(std::string wsName) {
......
......@@ -7,7 +7,7 @@
#ifndef MANTIDQT_CUSTOMINTERFACES_ALFVIEW_VIEW_H_
#define MANTIDQT_CUSTOMINTERFACES_ALFVIEW_VIEW_H_
#include "MantidQtWidgets/InstrumentView/BaseInstrumentView.h"
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentView.h"
#include "DllConfig.h"
#include "MantidQtWidgets/Common/MWRunFiles.h"
#include "MantidQtWidgets/Common/ObserverPattern.h"
......@@ -21,7 +21,7 @@
namespace MantidQt {
namespace CustomInterfaces {
class ALFView_view : public MantidWidgets::BaseInstrumentView {
class ALFView_view : public MantidWidgets::BaseCustomInstrumentView {
Q_OBJECT
public:
......
......@@ -6,9 +6,9 @@ set(
SRC_FILES
src/BankRenderingHelpers.cpp
src/BankTextureBuilder.cpp
src/BaseInstrumentModel.cpp
src/BaseInstrumentView.cpp
src/BaseInstrumentPresenter.cpp
src/BaseCustomInstrumentModel.cpp
src/BaseCustomInstrumentView.cpp
src/BaseCustomInstrumentPresenter.cpp
src/BinDialog.cpp
src/CollapsiblePanel.cpp
src/DetXMLFile.cpp
......@@ -58,8 +58,8 @@ set(QT5_SRC_FILES src/MiniPlotMpl.cpp)
set(
MOC_FILES
inc/MantidQtWidgets/InstrumentView/BinDialog.h
inc/MantidQtWidgets/InstrumentView/BaseInstrumentPresenter.h
inc/MantidQtWidgets/InstrumentView/BaseInstrumentView.h
inc/MantidQtWidgets/InstrumentView/BaseCustomInstrumentPresenter.h
inc/MantidQtWidgets/InstrumentView/BaseCustomInstrumentView.h
inc/MantidQtWidgets/InstrumentView/CollapsiblePanel.h
inc/MantidQtWidgets/InstrumentView/InstrumentActor.h
inc/MantidQtWidgets/InstrumentView/InstrumentTreeModel.h
......@@ -91,9 +91,9 @@ set(
INC_FILES
inc/MantidQtWidgets/InstrumentView/BankRenderingHelpers.h
inc/MantidQtWidgets/InstrumentView/BankTextureBuilder.h
inc/MantidQtWidgets/InstrumentView/BaseInstrumentModel.h
inc/MantidQtWidgets/InstrumentView/BaseInstrumentPresenter.h
inc/MantidQtWidgets/InstrumentView/BaseInstrumentView.h
inc/MantidQtWidgets/InstrumentView/BaseCustomInstrumentModel.h
inc/MantidQtWidgets/InstrumentView/BaseCustomInstrumentPresenter.h
inc/MantidQtWidgets/InstrumentView/BaseCustomInstrumentView.h
inc/MantidQtWidgets/InstrumentView/BinDialog.h
inc/MantidQtWidgets/InstrumentView/CollapsiblePanel.h
inc/MantidQtWidgets/InstrumentView/ColorMap.h
......
......@@ -4,8 +4,8 @@
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTIDQT_INSTRUMENTVIEW_BASEINSTRUMENTMODEL_H_
#define MANTIDQT_INSTRUMENTVIEW_BASEINSTRUMENTMODEL_H_
#ifndef MANTIDQT_INSTRUMENTVIEW_BASECUSTOMINSTRUMENTMODEL_H_
#define MANTIDQT_INSTRUMENTVIEW_BASECUSTOMINSTRUMENTMODEL_H_
#include "DllOption.h"
......@@ -15,11 +15,11 @@
namespace MantidQt {
namespace MantidWidgets {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW BaseInstrumentModel {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW BaseCustomInstrumentModel {
public:
BaseInstrumentModel();
~BaseInstrumentModel(){};
BaseCustomInstrumentModel();
~BaseCustomInstrumentModel(){};
virtual void loadEmptyInstrument();
virtual std::pair<int, std::string> loadData(const std::string &name);
void setCurrentRun(int &run) { m_currentRun = run; };
......
......@@ -4,11 +4,11 @@
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTIDQT_INSTRUMENTVIEW_BASEINSTRUMENTPRESENTER_H_
#define MANTIDQT_INSTRUMENTVIEW_BASEINSTRUMENTPRESENTER_H_
#ifndef MANTIDQT_INSTRUMENTVIEW_BASECUSTOMINSTRUMENTPRESENTER_H_
#define MANTIDQT_INSTRUMENTVIEW_BASECUSTOMINSTRUMENTPRESENTER_H_
#include "DllOption.h"
#include "MantidQtWidgets/InstrumentView/BaseInstrumentModel.h"
#include "MantidQtWidgets/InstrumentView/BaseInstrumentView.h"
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentModel.h"
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentView.h"
#include "MantidQtWidgets/Common/ObserverPattern.h"
#include <string>
......@@ -16,14 +16,15 @@
namespace MantidQt {
namespace MantidWidgets {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW BaseInstrumentPresenter
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW BaseCustomInstrumentPresenter
: public QObject {
Q_OBJECT
public:
BaseInstrumentPresenter(BaseInstrumentView *view, BaseInstrumentModel *model,
BaseCustomInstrumentPresenter(BaseCustomInstrumentView *view,
BaseCustomInstrumentModel *model,
QWidget *analysisView);
~BaseInstrumentPresenter() { delete m_loadRunObserver; };
~BaseCustomInstrumentPresenter() { delete m_loadRunObserver; };
typedef std::pair<
std::string,
......@@ -49,8 +50,8 @@ private:
virtual void setUpInstrumentAnalysisSplitter();
std::pair<instrumentSetUp, instrumentObserverOptions> setupInstrument();
BaseInstrumentView *m_view;
BaseInstrumentModel *m_model;
BaseCustomInstrumentView *m_view;
BaseCustomInstrumentModel *m_model;
int m_currentRun;
std::string m_currentFile;
VoidObserver *m_loadRunObserver;
......@@ -59,4 +60,4 @@ private:
} // namespace MantidWidgets
} // namespace MantidQt
#endif /* MANTIDQT_INSTRUMENTVIEW_BASEINSTRUMENTPRESENTER_H_ */
#endif /* MANTIDQT_INSTRUMENTVIEW_BaseCustomInstrumentPresenter_H_ */
......@@ -4,8 +4,8 @@
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTIDQT_INSTRUMENTVIEW_BASEINSTRUMENTVIEW_H_
#define MANTIDQT_INSTRUMENTVIEW_BASEINSTRUMENTVIEW_H_
#ifndef MANTIDQT_INSTRUMENTVIEW_BASECUSTOMINSTRUMENTVIEW_H_
#define MANTIDQT_INSTRUMENTVIEW_BASECUSTOMINSTRUMENTVIEW_H_
#include "DllOption.h"
#include "MantidQtWidgets/Common/MWRunFiles.h"
......@@ -21,11 +21,11 @@
namespace MantidQt {
namespace MantidWidgets {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW BaseInstrumentView : public QSplitter {
class EXPORT_OPT_MANTIDQT_INSTRUMENTVIEW BaseCustomInstrumentView : public QSplitter {
Q_OBJECT
public:
explicit BaseInstrumentView(const std::string &instrument,
explicit BaseCustomInstrumentView(const std::string &instrument,
QWidget *parent = nullptr);
std::string getFile();
void setRunQuietly(const std::string &runNumber);
......@@ -67,4 +67,4 @@ private:
} // namespace MantidWidgets
} // namespace MantidQt
#endif /* MANTIDQT_INSTRUMENTVIEW_BASEINSTRUMENTVIEW_H_ */
#endif /* MANTIDQT_INSTRUMENTVIEW_BASECUSTOMINSTRUMENTVIEW_H_ */
......@@ -5,7 +5,7 @@
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidQtWidgets/InstrumentView/BaseInstrumentModel.h"
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentModel.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/AnalysisDataService.h"
......@@ -24,11 +24,11 @@ using namespace Mantid::API;
namespace MantidQt {
namespace MantidWidgets {
BaseInstrumentModel::BaseInstrumentModel()
BaseCustomInstrumentModel::BaseCustomInstrumentModel()
: m_currentRun(0), m_tmpName("tmp"), m_instrumentName("MUSR"),
m_wsName("testData") {}
void BaseInstrumentModel::loadEmptyInstrument() {
void BaseCustomInstrumentModel::loadEmptyInstrument() {
auto alg =
Mantid::API::AlgorithmManager::Instance().create("LoadEmptyInstrument");
alg->initialize();
......@@ -43,7 +43,7 @@ void BaseInstrumentModel::loadEmptyInstrument() {
* @return std::pair<int,std::string>:: the run number and status
*/
std::pair<int, std::string>
BaseInstrumentModel::loadData(const std::string &name) {
BaseCustomInstrumentModel::loadData(const std::string &name) {
auto alg = AlgorithmManager::Instance().create("Load");
alg->initialize();
alg->setProperty("Filename", name);
......@@ -58,16 +58,16 @@ BaseInstrumentModel::loadData(const std::string &name) {
return std::make_pair(runNumber, message);
}
void BaseInstrumentModel::rename() {
void BaseCustomInstrumentModel::rename() {
AnalysisDataService::Instance().rename(m_tmpName, m_wsName);
}
void BaseInstrumentModel::remove() {
void BaseCustomInstrumentModel::remove() {
AnalysisDataService::Instance().remove(m_tmpName);
}
std::string BaseInstrumentModel::dataFileName() { return m_wsName; }
std::string BaseCustomInstrumentModel::dataFileName() { return m_wsName; }
int BaseInstrumentModel::currentRun() {
int BaseCustomInstrumentModel::currentRun() {
try {
auto ws =
......@@ -78,7 +78,7 @@ int BaseInstrumentModel::currentRun() {
}
}
bool BaseInstrumentModel::isErrorCode(const int run) {
bool BaseCustomInstrumentModel::isErrorCode(const int run) {
return (run == ERRORCODE);
}
......
......@@ -4,9 +4,9 @@
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidQtWidgets/InstrumentView/BaseInstrumentPresenter.h"
#include "MantidQtWidgets/InstrumentView/BaseInstrumentView.h"
#include "MantidQtWidgets/InstrumentView/BaseInstrumentModel.h"
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentPresenter.h"
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentView.h"
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentModel.h"
#include "MantidAPI/FileFinder.h"
#include <functional>
......@@ -15,8 +15,8 @@
namespace MantidQt {
namespace MantidWidgets {
BaseInstrumentPresenter::BaseInstrumentPresenter(BaseInstrumentView *view,
MantidWidgets::BaseInstrumentModel *model,
BaseCustomInstrumentPresenter::BaseCustomInstrumentPresenter(
BaseCustomInstrumentView *view, BaseCustomInstrumentModel *model,
QWidget *analysisPaneView)
: m_view(view), m_model(model), m_currentRun(0), m_currentFile(""),
m_loadRunObserver(nullptr), m_analysisPaneView(analysisPaneView) {
......@@ -24,28 +24,29 @@ BaseInstrumentPresenter::BaseInstrumentPresenter(BaseInstrumentView *view,
m_model->loadEmptyInstrument();
}
void BaseInstrumentPresenter::addInstrument() {
void BaseCustomInstrumentPresenter::addInstrument() {
auto setUp = setupInstrument();
initLayout(&setUp);
}
void BaseInstrumentPresenter::initLayout(
void BaseCustomInstrumentPresenter::initLayout(
std::pair<instrumentSetUp, instrumentObserverOptions> *setUp) {
// connect to new run
m_view->observeLoadRun(m_loadRunObserver);
std::function<void()> loadBinder =
std::bind(&BaseInstrumentPresenter::loadRunNumber, this);
std::bind(&BaseCustomInstrumentPresenter::loadRunNumber, this);
m_loadRunObserver->setSlot(loadBinder);
initInstrument(setUp);
setUpInstrumentAnalysisSplitter();
m_view->setupHelp();
}
void BaseInstrumentPresenter::setUpInstrumentAnalysisSplitter() {
void BaseCustomInstrumentPresenter::setUpInstrumentAnalysisSplitter() {
m_view->setupInstrumentAnalysisSplitters(m_analysisPaneView);
}
void BaseInstrumentPresenter::loadAndAnalysis(const std::string &pathToRun) {
void BaseCustomInstrumentPresenter::loadAndAnalysis(
const std::string &pathToRun) {
try {
auto loadedResult = m_model->loadData(pathToRun);
......@@ -66,7 +67,7 @@ void BaseInstrumentPresenter::loadAndAnalysis(const std::string &pathToRun) {
}
}
void BaseInstrumentPresenter::loadRunNumber() {
void BaseCustomInstrumentPresenter::loadRunNumber() {
auto pathToRun = m_view->getFile();
if (pathToRun == "" || m_currentFile == pathToRun) {
return;
......@@ -74,7 +75,7 @@ void BaseInstrumentPresenter::loadRunNumber() {
loadAndAnalysis(pathToRun);
}
void BaseInstrumentPresenter::initInstrument(
void BaseCustomInstrumentPresenter::initInstrument(
std::pair<instrumentSetUp, instrumentObserverOptions> *setUp) {
if (!setUp) {
return;
......@@ -97,7 +98,7 @@ typedef std::vector<std::tuple<std::string, Observer *>>
instrumentObserverOptions;
std::pair<instrumentSetUp, instrumentObserverOptions>
BaseInstrumentPresenter::setupInstrument() {
BaseCustomInstrumentPresenter::setupInstrument() {
instrumentSetUp setUpContextConditions;
// set up the slots for the custom context menu
......
......@@ -4,10 +4,10 @@
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidQtWidgets/InstrumentView/BaseInstrumentView.h"
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentView.h"
#include "MantidQtWidgets/Common/HelpWindow.h"
#include "MantidQtWidgets/InstrumentView/InstrumentWidgetPickTab.h"
// change to BaseCustomInstrumentView etc.
#include <QMessageBox>
#include <QSizePolicy>
#include <QSpacerItem>
......@@ -17,7 +17,7 @@
namespace MantidQt {
namespace MantidWidgets {
BaseInstrumentView::BaseInstrumentView(const std::string &instrument,
BaseCustomInstrumentView::BaseCustomInstrumentView(const std::string &instrument,
QWidget *parent)
: QSplitter(Qt::Vertical, parent), m_helpPage(""),
m_loadRunObservable(nullptr), m_files(nullptr),
......@@ -27,7 +27,7 @@ BaseInstrumentView::BaseInstrumentView(const std::string &instrument,
this->addWidget(loadWidget);
}
void BaseInstrumentView::setUpInstrument(
void BaseCustomInstrumentView::setUpInstrument(
const std::string &fileName,
std::vector<std::function<bool(std::map<std::string, bool>)>> &instrument) {
......@@ -38,7 +38,7 @@ void BaseInstrumentView::setUpInstrument(
setInstrumentWidget(instrumentWidget);
}
QWidget *BaseInstrumentView::generateLoadWidget() {
QWidget *BaseCustomInstrumentView::generateLoadWidget() {
m_loadRunObservable = new Observable();
m_files = new API::MWRunFiles(this);
......@@ -60,7 +60,7 @@ QWidget *BaseInstrumentView::generateLoadWidget() {
return loadWidget;
}
void BaseInstrumentView::setupInstrumentAnalysisSplitters(
void BaseCustomInstrumentView::setupInstrumentAnalysisSplitters(
QWidget *analysisPane) {
QSplitter *split = new QSplitter(Qt::Horizontal);
split->addWidget(m_instrumentWidget);
......@@ -68,7 +68,7 @@ void BaseInstrumentView::setupInstrumentAnalysisSplitters(
this->addWidget(split);
}
void BaseInstrumentView::setupHelp() {
void BaseCustomInstrumentView::setupHelp() {
QWidget *helpWidget = new QWidget();
m_help = new QPushButton("?");
m_help->setMaximumWidth(25);
......@@ -81,7 +81,7 @@ void BaseInstrumentView::setupHelp() {
connect(m_help, SIGNAL(clicked()), this, SLOT(openHelp()));
}
void BaseInstrumentView::openHelp() {
void BaseCustomInstrumentView::openHelp() {
if (m_helpPage == "") {
return;
}
......@@ -89,18 +89,18 @@ void BaseInstrumentView::openHelp() {
nullptr, QString::fromStdString(m_helpPage));
}
std::string BaseInstrumentView::getFile() {
std::string BaseCustomInstrumentView::getFile() {
auto name = m_files->getFilenames();
if (name.size() > 0)
return name[0].toStdString();
return "";
}
void BaseInstrumentView::setRunQuietly(const std::string &runNumber) {
void BaseCustomInstrumentView::setRunQuietly(const std::string &runNumber) {
m_files->setText(QString::fromStdString(runNumber));
}
void BaseInstrumentView::fileLoaded() {
void BaseCustomInstrumentView::fileLoaded() {
if (m_files->getText().isEmpty())
return;
......@@ -111,11 +111,11 @@ void BaseInstrumentView::fileLoaded() {
m_loadRunObservable->notify();
}
void BaseInstrumentView::warningBox(const std::string &message) {
void BaseCustomInstrumentView::warningBox(const std::string &message) {
warningBox(QString::fromStdString(message));
}
void BaseInstrumentView::warningBox(const QString &message) {
void BaseCustomInstrumentView::warningBox(const QString &message) {
QMessageBox::warning(this, m_instrument + " view", message);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment