Mantid
Loading...
Searching...
No Matches
AlgorithmInputHistory.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2009 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//----------------------------------
10// Includes
11//----------------------------------
12#include "DllOption.h"
15#include <QHash>
16#include <QString>
17
18namespace MantidQt {
19namespace API {
20
22public:
24
25 AlgorithmInputHistorySettings(InputHistory lastInput = {}, QString previousDirectory = {});
26
27 [[nodiscard]] InputHistory const &lastInput() const;
28 [[nodiscard]] QString const &previousDirectory() const;
29
30private:
33};
34
39 : public MantidWidgets::Configurable<AlgorithmInputHistorySettings> {
40public:
44 virtual ~AbstractAlgorithmInputHistory() override = 0;
45
48 void storeNewValue(const QString &algName, const std::pair<QString, QString> &property);
49
51 void clearAlgorithmInput(const QString &algName);
52
54 QString previousInput(const QString &algName, const QString &propName) const;
55
58 void setPreviousDirectory(const QString &lastdir);
59
62 const QString &getPreviousDirectory() const;
63
65 void save() const;
66
68 [[nodiscard]] AlgorithmInputHistorySettings readSettings(const QSettings &storage) const;
70 void restoreSettings(const AlgorithmInputHistorySettings &settings) override;
72 [[nodiscard]] AlgorithmInputHistorySettings captureSettings() const override;
74 void saveSettings(QSettings &storage, const AlgorithmInputHistorySettings &settings) const;
75
76protected:
78 AbstractAlgorithmInputHistory(const QString &settingsGroup);
79
80private:
82 void initializeSettings();
83
86
89
93
95 QString m_dirKey;
96};
97
106
108} // namespace API
109} // namespace MantidQt
110
111namespace Mantid {
112namespace Kernel {
115}
116} // namespace Mantid
#define EXPORT_OPT_MANTIDQT_COMMON
Definition DllOption.h:15
#define EXTERN_MANTIDQT_COMMON
Definition DllOption.h:16
This abstract class deals with the loading and saving of previous algorithm property values to/from M...
AbstractAlgorithmInputHistory & operator=(const AbstractAlgorithmInputHistory &)=delete
QHash< QString, QHash< QString, QString > > m_lastInput
A map indexing the algorithm name and a list of property name:value pairs.
QString m_previousDirectory
The directory that last used by an open file dialog.
QString m_algorithmsGroup
The string denoting the group (in the QSettings) where the algorithm properties are stored.
QString m_dirKey
The string denoting the key for the previous dir storage.
AbstractAlgorithmInputHistory(const AbstractAlgorithmInputHistory &)=delete
Defines the in-memory half of the persistent settings lifecycle.
Manage the lifetime of a class intended to be a singleton.
Mantid::Kernel::SingletonHolder< AlgorithmInputHistoryImpl > AlgorithmInputHistory
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
Helper class which provides the Collimation Length for SANS instruments.
Policy class controlling creation of the singleton Implementation classes should mark their default c...