BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitSessionController.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/Fit/FitSessionController.h
6 //! @brief Defines class FitSessionController
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_VIEW_FIT_FITSESSIONCONTROLLER_H
16 #define BORNAGAIN_GUI_VIEW_FIT_FITSESSIONCONTROLLER_H
17 
18 #include <QObject>
19 #include <memory>
20 
21 class JobItem;
22 class FitWorkerLauncher;
23 class GUIFitObserver;
24 class FitProgressInfo;
25 class FitLog;
27 
28 //! Controls all activity related to the single fitting task for JobItem.
29 //! Provides interaction between FitSessionWidget and fit observers.
30 
31 class FitSessionController : public QObject {
32  Q_OBJECT
33 public:
34  FitSessionController(QObject* parent = nullptr);
36 
37  void setItem(JobItem* item);
38 
39  FitLog* fitLog();
40 
41 signals:
44  void fittingError(const QString& message);
45 
46 public slots:
47  void onStartFittingRequest();
48  void onStopFittingRequest();
49 
50 private slots:
51  void onObserverUpdate();
52  void onFittingStarted();
53  void onFittingFinished();
54  void onFittingError(const QString& text);
55  void updateIterationCount(const FitProgressInfo& info);
56  void updateFitParameterValues(const FitProgressInfo& info);
57  void updateLog(const FitProgressInfo& info);
58 
59 private:
62  std::shared_ptr<GUIFitObserver> m_observer;
63  std::unique_ptr<FitLog> m_fitlog;
64  std::shared_ptr<FitObjectiveBuilder> m_objectiveBuilder;
66 };
67 
68 #endif // BORNAGAIN_GUI_VIEW_FIT_FITSESSIONCONTROLLER_H
the collected messages of a fitting session
Definition: FitLog.h:27
The FitProgressInfo class contains all essential information about fit progress. It is send from GUIF...
Controls all activity related to the single fitting task for JobItem. Provides interaction between Fi...
void onFittingError(const QString &text)
std::shared_ptr< GUIFitObserver > m_observer
std::unique_ptr< FitLog > m_fitlog
~FitSessionController() override
void fittingError(const QString &message)
void updateIterationCount(const FitProgressInfo &info)
FitWorkerLauncher * m_runFitManager
void updateFitParameterValues(const FitProgressInfo &info)
void updateLog(const FitProgressInfo &info)
FitSessionController(QObject *parent=nullptr)
std::shared_ptr< FitObjectiveBuilder > m_objectiveBuilder
void setItem(JobItem *item)
Serves as observer for FitObjective and saves fit iteration data for later display in GUI widgets.