Mantid
Loading...
Searching...
No Matches
AlgorithmHistoryWindow.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
14#include "MantidAPI/Workspace.h"
18
19#include <QAbstractListModel>
20#include <QCheckBox>
21#include <QComboBox>
22#include <QDialog>
23#include <QGroupBox>
24#include <QPushButton>
25#include <QStandardItemModel>
26#include <QTreeView>
27#include <QTreeWidget>
28#include <utility>
29
30#include <utility>
31
32//------------------------------------------------------------------------------
33// Forward declarations
34//------------------------------------------------------------------------------
35class QMouseEvent;
36class QLineEdit;
37class QLabel;
38class QFileDialog;
39
40//------------------------------------------------------------------------------
41// Mantid Forward declarations
42//------------------------------------------------------------------------------
43
44namespace Mantid {
45namespace API {
46class Workspace;
47}
48} // namespace Mantid
49
50class AlgHistoryItem : public QTreeWidgetItem, public Mantid::API::HistoryItem {
51public:
52 AlgHistoryItem(const QStringList &names, Mantid::API::AlgorithmHistory_const_sptr algHistory,
53 AlgHistoryItem *parent = nullptr)
54 : QTreeWidgetItem(parent, names, UserType), Mantid::API::HistoryItem(std::move(std::move(algHistory))) {}
55};
56
57class AlgHistoryTreeWidget : public QTreeWidget {
58 Q_OBJECT
59
60signals:
62 void unrollAlgorithmHistory(const std::vector<int> &indicies);
64
65public:
67 explicit AlgHistoryTreeWidget(QWidget *w) : QTreeWidget(w), m_algName(""), m_nVersion(0) {
68 connect(this, SIGNAL(itemChanged(QTreeWidgetItem *, int)), SLOT(onItemChanged(QTreeWidgetItem *, int)));
69 }
71
72protected:
73 void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
74
75private slots:
76 void onItemChanged(QTreeWidgetItem *item, int index);
77
78private:
80 void getItemIndex(QTreeWidgetItem *item, int &index);
81 void itemChecked(QTreeWidgetItem *item, int index);
82 void itemUnchecked(QTreeWidgetItem *item, int index);
84 void uncheckAllChildren(QTreeWidgetItem *item, int index);
85 QString concatVersionwithName(const std::string &name, const int version);
86
87 const static int UNROLL_COLUMN_INDEX = 1;
88 QString m_algName;
90};
91
92class AlgExecSummaryGrpBox : public QGroupBox {
93 Q_OBJECT
94public:
95 explicit AlgExecSummaryGrpBox(QWidget *w);
96 AlgExecSummaryGrpBox(const QString & /*title*/, QWidget *w);
97 ~AlgExecSummaryGrpBox() override;
98 void setData(const double execDuration, const Mantid::Types::Core::DateAndTime execDate);
99
100private:
101 QLineEdit *getAlgExecDurationCtrl() const { return m_execDurationEdit; }
102 QLineEdit *getAlgExecDateCtrl() const { return m_execDateTimeEdit; }
103
104private:
107 QLabel *m_Datelabel;
110};
111
112class AlgEnvHistoryGrpBox : public QGroupBox {
113 Q_OBJECT
114public:
115 explicit AlgEnvHistoryGrpBox(QWidget *w);
116 AlgEnvHistoryGrpBox(const QString & /*title*/, QWidget *w);
117 ~AlgEnvHistoryGrpBox() override;
118
119 QLineEdit *getosNameEdit() const { return m_osNameEdit; }
120 QLineEdit *getosVersionEdit() const { return m_osVersionEdit; }
121 QLineEdit *getfrmworkVersionEdit() const { return m_frmwkVersnEdit; }
123
124private:
126 QLineEdit *m_osNameEdit;
128 QLineEdit *m_osVersionEdit;
131};
132
135 Q_OBJECT
136signals:
137 void updateAlgorithmHistoryWindow(QString algName);
138
139public:
140 AlgorithmHistoryWindow(QWidget *parent, const std::shared_ptr<const Mantid::API::Workspace> & /*wsptr*/);
141 AlgorithmHistoryWindow(QWidget *parent, const QString &workspaceName);
142 ~AlgorithmHistoryWindow() override;
143
144 void closeEvent(QCloseEvent *ce) override;
145
146public slots:
147 void updateAll(const Mantid::API::AlgorithmHistory_const_sptr &algHistmakeory);
148 void doUnroll(const std::vector<int> &unrollIndicies);
149 void doRoll(int index);
150
151 void copytoClipboard();
152 void writeToScriptFile();
153 void unrollAll(int state);
154
155private:
156 AlgExecSummaryGrpBox *createExecSummaryGrpBox();
157 AlgEnvHistoryGrpBox *createEnvHistGrpBox(const Mantid::Kernel::EnvironmentHistory &envHistory);
158 AlgHistoryProperties *createAlgHistoryPropWindow();
159
160 QFileDialog *createScriptDialog(const QString &algName);
161 void updateExecSummaryGrpBox(const Mantid::API::AlgorithmHistory_const_sptr &algHistory);
162 void updateAlgHistoryProperties(const Mantid::API::AlgorithmHistory_const_sptr &algHistory);
163
164 std::string getScriptVersionMode();
165
166private:
171 QPushButton *m_scriptButtonFile;
177 QString m_wsName;
178 std::shared_ptr<Mantid::API::HistoryView> m_view;
179};
180
181class AlgHistoryProperties : public QObject {
182 Q_OBJECT
183
184public:
185 AlgHistoryProperties(QWidget *w, std::vector<Mantid::Kernel::PropertyHistory_sptr> propHist);
186
188 void clearData();
189
190 void setAlgProperties(const std::vector<Mantid::Kernel::PropertyHistory_sptr> &histProp);
192
193public slots:
194 void popupMenu(const QPoint &pos);
196
197public:
198 QTreeWidget *m_histpropTree;
199
200private:
201 QAction *m_copyAction;
204
205 std::vector<Mantid::Kernel::PropertyHistory_sptr> m_Histprop;
206};
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
std::vector< history_type > history
history information
QLineEdit * getosNameEdit() const
QLineEdit * getosVersionEdit() const
void fillEnvHistoryGroupBox(const Mantid::Kernel::EnvironmentHistory &envHist)
QLineEdit * getfrmworkVersionEdit() const
QLineEdit * getAlgExecDateCtrl() const
void setData(const double execDuration, const Mantid::Types::Core::DateAndTime execDate)
QLineEdit * getAlgExecDurationCtrl() const
AlgHistoryItem(const QStringList &names, Mantid::API::AlgorithmHistory_const_sptr algHistory, AlgHistoryItem *parent=nullptr)
void popupMenu(const QPoint &pos)
void setAlgProperties(const std::vector< Mantid::Kernel::PropertyHistory_sptr > &histProp)
const Mantid::Kernel::PropertyHistories & getAlgProperties()
void displayAlgHistoryProperties()
Populates the Algorithm History display with property names, values, directions and whether their val...
std::vector< Mantid::Kernel::PropertyHistory_sptr > m_Histprop
void itemChecked(QTreeWidgetItem *item, int index)
QString concatVersionwithName(const std::string &name, const int version)
void uncheckAllChildren(QTreeWidgetItem *item, int index)
static const int UNROLL_COLUMN_INDEX
void updateAlgorithmHistoryWindow(Mantid::API::AlgorithmHistory_const_sptr algHistory)
void populateNestedHistory(AlgHistoryItem *parentWidget, const Mantid::API::AlgorithmHistory_sptr &history)
void itemUnchecked(QTreeWidgetItem *item, int index)
void rollAlgorithmHistory(int index)
void onItemChanged(QTreeWidgetItem *item, int index)
void populateAlgHistoryTreeWidget(const Mantid::API::WorkspaceHistory &wsHist)
void unrollAlgorithmHistory(const std::vector< int > &indicies)
AlgHistoryTreeWidget(QWidget *w)
Constructor.
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override
void getItemIndex(QTreeWidgetItem *item, int &index)
AlgEnvHistoryGrpBox * m_envHistGrpBox
AlgExecSummaryGrpBox * m_execSumGrpBox
const Mantid::API::WorkspaceHistory & m_algHist
std::shared_ptr< Mantid::API::HistoryView > m_view
void updateAlgorithmHistoryWindow(QString algName)
AlgHistoryProperties * m_histPropWindow
AlgHistoryTreeWidget * m_Historytree
QFileDialog * createScriptDialog(const QString &algName)
HistoryItem(AlgorithmHistory_const_sptr algHist)
Definition: HistoryItem.cpp:16
This class stores information about the Workspace History used by algorithms on a workspace and the e...
This class stores information about the Environment of the computer used by the framework.
std::shared_ptr< const AlgorithmHistory > AlgorithmHistory_const_sptr
std::shared_ptr< AlgorithmHistory > AlgorithmHistory_sptr
std::vector< PropertyHistory_sptr > PropertyHistories
Helper class which provides the Collimation Length for SANS instruments.
STL namespace.