Mantid
Loading...
Searching...
No Matches
ProcessingAlgoWidget.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "DllOption.h"
10#include "MantidAPI/Algorithm.h"
11#include "ui_ProcessingAlgoWidget.h"
12#include <QString>
13#include <QWidget>
14
15class QSettings;
16
17namespace MantidQt {
18namespace MantidWidgets {
19
21public:
22 explicit ProcessingAlgoWidgetSettings(QString lastFile = {});
23
24 [[nodiscard]] const QString &lastFile() const;
25
27 [[nodiscard]] static ProcessingAlgoWidgetSettings readSettings(const QSettings &settings);
29 static void saveSettings(QSettings &settings, const ProcessingAlgoWidgetSettings &values);
30
31private:
32 QString m_lastFile;
33};
34
43 Q_OBJECT
44 Q_PROPERTY(QString infoString READ infoString WRITE infoString)
45 Q_PROPERTY(bool editorVisible READ editorVisible WRITE editorVisible)
46 Q_PROPERTY(bool algoVisible READ algoVisible WRITE algoVisible)
47
48public:
50 ProcessingAlgoWidget(QWidget *parent = nullptr);
51 ~ProcessingAlgoWidget() override;
52
54 QString infoString() { return ui.lblInfo->text(); }
56 void infoString(const QString &text) { return ui.lblInfo->setText(text); }
57
59 bool editorVisible() { return ui.editorContainer->isVisible(); }
61 void editorVisible(bool vis) { ui.editorContainer->setVisible(vis); }
62
64 bool algoVisible() { return ui.splitter->isVisible(); }
66 void algoVisible(bool vis) { ui.splitter->setVisible(vis); }
67
69 QString getSelectedAlgorithm() { return ui.algoSelector->getSelectedAlgorithm(); };
70 void setSelectedAlgorithm(QString algo);
71
73 QString getScriptText();
75 void setScriptText(const QString &text);
76
77 void saveInput();
80 ui.algoProperties->setInputHistory(inputHistory);
81 }
82
85
87 void restoreSettings(const ProcessingAlgoWidgetSettings &settings);
89 [[nodiscard]] ProcessingAlgoWidgetSettings captureSettings() const;
90
91public slots:
92 void changeAlgorithm();
93 void btnSaveClicked();
94 void btnLoadClicked();
95
96signals:
99
100private:
102 Ui::ProcessingAlgoWidget ui;
103
106
108 QString m_lastFile;
109};
110
111} // namespace MantidWidgets
112} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition DllOption.h:15
Algorithm *const m_alg
This abstract class deals with the loading and saving of previous algorithm property values to/from M...
A widget containing an algorithm selector and algorithm properties list, or a script editor window.
void setInputHistory(MantidQt::API::AbstractAlgorithmInputHistory *inputHistory)
Sets the AlgorithmInputHistory object recording the algorithm properties.
void changedAlgorithm()
Signal emitted when the algorithm changes.
void algoVisible(bool vis)
Sets whether the algorithm stuff is visible.
Mantid::API::Algorithm_sptr m_alg
Current algorithm with properties set.
Ui::ProcessingAlgoWidget ui
The form generated by Qt Designer.
void editorVisible(bool vis)
Sets whether the script editor is visible.
void infoString(const QString &text)
Sets the info string displayed at the top.
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< Algorithm > Algorithm_sptr
Typedef for a shared pointer to an Algorithm.
Definition Algorithm.h:52