BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FitLog.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Views/FitWidgets/FitLog.cpp
6 //! @brief Implements class FitLog
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 
17 
18 FitLog::FitLog() : m_messagePanel(nullptr) {}
19 
21 {
22  m_messagePanel = messagePanel;
23  if (!m_messagePanel)
24  return;
25 
27 
28  for (auto& record : m_records) {
29  m_messagePanel->onMessage(QString::fromStdString(record.m_text),
30  QColor(FitLogFlags::color(record.m_type)));
31  }
32 }
33 
34 void FitLog::append(const std::string& text, FitLogFlags::MessageType type)
35 {
36  m_records.push_back({text, type});
37 
38  if (m_messagePanel)
39  m_messagePanel->onMessage(QString::fromStdString(text), QColor(FitLogFlags::color(type)));
40 }
41 
43 {
44  m_records.clear();
45  if (m_messagePanel)
47 }
Defines class FitLog.
Defines class JobMessagePanel.
static Qt::GlobalColor color(MessageType messageType)
Definition: FitLogFlags.cpp:33
void clearLog()
Definition: FitLog.cpp:42
FitLog()
Definition: FitLog.cpp:18
std::vector< Record > m_records
Definition: FitLog.h:38
void append(const std::string &text, FitLogFlags::MessageType type)
Definition: FitLog.cpp:34
JobMessagePanel * m_messagePanel
Definition: FitLog.h:39
void setMessagePanel(JobMessagePanel *messagePanel)
Definition: FitLog.cpp:20
The JobMessagePanel class shows log messages from FitActivityPanel at the bottom part of JobView.
void onMessage(const QString &message, const QColor &color=QColor(Qt::black))