BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
JobMessagePanel Class Reference

The JobMessagePanel class shows log messages from FitActivityPanel at the bottom part of JobView. More...

Inheritance diagram for JobMessagePanel:
[legend]
Collaboration diagram for JobMessagePanel:
[legend]

Public Slots

void onClearLog ()
 
void onMessage (const QString &message, const QColor &color=QColor(Qt::black))
 

Signals

void widgetHeightRequest (int)
 

Public Member Functions

 JobMessagePanel (QWidget *parent=0)
 
QSize minimumSizeHint () const
 
QSize sizeHint () const
 

Protected Slots

void onExpandButtonClicked ()
 
void setContentVisible (bool editor_status, bool dock_notify=false)
 

Protected Member Functions

bool isContentVisible ()
 
void resizeEvent (QResizeEvent *event)
 

Protected Attributes

int m_cached_height
 
QStackedWidget * m_stackedWidget
 
InfoPanelToolBarm_toolBar
 

Private Attributes

QTextEdit * m_plainLog
 

Detailed Description

The JobMessagePanel class shows log messages from FitActivityPanel at the bottom part of JobView.

Definition at line 26 of file JobMessagePanel.h.

Constructor & Destructor Documentation

◆ JobMessagePanel()

JobMessagePanel::JobMessagePanel ( QWidget *  parent = 0)

Definition at line 22 of file JobMessagePanel.cpp.

22  : InfoPanel(parent), m_plainLog(new QTextEdit)
23 {
24  setWindowTitle(Constants::JobMessagePanelName);
25  setObjectName("JobMessagePanel");
26 
27  m_plainLog->setReadOnly(true);
28  // m_plainLog->setMaximumBlockCount(100000);
29  QFont f("unexistent");
30  f.setStyleHint(QFont::Monospace);
31  m_plainLog->setFont(f);
32 
33  m_stackedWidget->addWidget(m_plainLog);
34 
35  setContentVisible(false);
36 }
QStackedWidget * m_stackedWidget
Definition: InfoPanel.h:49
void setContentVisible(bool editor_status, bool dock_notify=false)
Definition: InfoPanel.cpp:71
InfoPanel(QWidget *parent)
Definition: InfoPanel.cpp:27
QTextEdit * m_plainLog
const QString JobMessagePanelName

References Constants::JobMessagePanelName, m_plainLog, InfoPanel::m_stackedWidget, and InfoPanel::setContentVisible().

Here is the call graph for this function:

Member Function Documentation

◆ isContentVisible()

bool InfoPanel::isContentVisible ( )
protectedinherited

Definition at line 92 of file InfoPanel.cpp.

93 {
94  if (m_stackedWidget->currentWidget())
95  return m_stackedWidget->currentWidget()->isVisible();
96 
97  return false;
98 }

References InfoPanel::m_stackedWidget.

Referenced by InfoPanel::onExpandButtonClicked(), and InfoPanel::resizeEvent().

◆ minimumSizeHint()

QSize InfoPanel::minimumSizeHint ( ) const
inherited

Definition at line 61 of file InfoPanel.cpp.

62 {
63  return QSize(minimum_widget_height, minimum_widget_height);
64 }

◆ onClearLog

void JobMessagePanel::onClearLog ( )
slot

Definition at line 38 of file JobMessagePanel.cpp.

39 {
40  m_plainLog->clear();
41 }

References m_plainLog.

Referenced by FitLog::clearLog(), FitSessionManager::disableLogging(), FitActivityPanel::setItem(), and FitLog::setMessagePanel().

◆ onExpandButtonClicked

void InfoPanel::onExpandButtonClicked ( )
protectedslotinherited

Definition at line 66 of file InfoPanel.cpp.

67 {
69 }
bool isContentVisible()
Definition: InfoPanel.cpp:92

References InfoPanel::isContentVisible(), and InfoPanel::setContentVisible().

Referenced by InfoPanel::InfoPanel().

Here is the call graph for this function:

◆ onMessage

void JobMessagePanel::onMessage ( const QString &  message,
const QColor &  color = QColor(Qt::black) 
)
slot

Definition at line 43 of file JobMessagePanel.cpp.

44 {
45  QScrollBar* scrollbar = m_plainLog->verticalScrollBar();
46  bool autoscroll = scrollbar->value() == scrollbar->maximum();
47  // m_plainLog->appendPlainText(message);
48  m_plainLog->setTextColor(color);
49  m_plainLog->append(message);
50  if (autoscroll) {
51  QTextCursor c = m_plainLog->textCursor();
52  c.movePosition(QTextCursor::End);
53  m_plainLog->setTextCursor(c);
54  }
55 }

References m_plainLog.

Referenced by FitLog::append(), and FitLog::setMessagePanel().

◆ resizeEvent()

void InfoPanel::resizeEvent ( QResizeEvent *  event)
protectedinherited

Definition at line 100 of file InfoPanel.cpp.

101 {
102  // widget is schrinking in height
103  if (event->oldSize().height() > event->size().height()) {
104  if (event->size().height() <= minimum_height_before_collapse && isContentVisible())
105  setContentVisible(false);
106  }
107 
108  // widget is growing in height
109  if (event->oldSize().height() < event->size().height()) {
110  if (event->size().height() > minimum_height_before_collapse && !isContentVisible())
111  setContentVisible(true);
112  }
113 
114  QWidget::resizeEvent(event);
115 }

References InfoPanel::isContentVisible(), and InfoPanel::setContentVisible().

Here is the call graph for this function:

◆ setContentVisible

void InfoPanel::setContentVisible ( bool  editor_status,
bool  dock_notify = false 
)
protectedslotinherited

Definition at line 71 of file InfoPanel.cpp.

72 {
73  m_toolBar->setExpandStatus(editor_status);
74  if (editor_status) {
75  if (m_cached_height)
76  if (dock_notify)
78 
79  if (m_stackedWidget->currentWidget())
80  m_stackedWidget->currentWidget()->show();
81 
82  } else {
83  m_cached_height = (height() < minimum_height_before_collapse ? default_height : height());
84  if (m_stackedWidget->currentWidget())
85  m_stackedWidget->currentWidget()->hide();
86 
87  if (dock_notify)
88  emit widgetHeightRequest(minimum_widget_height);
89  }
90 }
void setExpandStatus(bool status)
void widgetHeightRequest(int)
InfoPanelToolBar * m_toolBar
Definition: InfoPanel.h:48
int m_cached_height
Definition: InfoPanel.h:50

References InfoPanel::m_cached_height, InfoPanel::m_stackedWidget, InfoPanel::m_toolBar, InfoPanelToolBar::setExpandStatus(), and InfoPanel::widgetHeightRequest().

Referenced by JobMessagePanel(), ScriptPanel::ScriptPanel(), InfoPanel::onExpandButtonClicked(), and InfoPanel::resizeEvent().

Here is the call graph for this function:

◆ sizeHint()

QSize InfoPanel::sizeHint ( ) const
inherited

Definition at line 47 of file InfoPanel.cpp.

48 {
49  QSize result = m_toolBar->sizeHint();
50 
51  if (QWidget* widget = m_stackedWidget->currentWidget()) {
52  if (widget->isVisible())
53  result.setHeight(widget->height() + m_toolBar->height());
54  } else {
55  result.setHeight(m_toolBar->height());
56  }
57 
58  return result;
59 }

References InfoPanel::m_stackedWidget, and InfoPanel::m_toolBar.

◆ widgetHeightRequest

void InfoPanel::widgetHeightRequest ( int  )
signalinherited

Member Data Documentation

◆ m_cached_height

int InfoPanel::m_cached_height
protectedinherited

Definition at line 50 of file InfoPanel.h.

Referenced by InfoPanel::setContentVisible().

◆ m_plainLog

QTextEdit* JobMessagePanel::m_plainLog
private

Definition at line 36 of file JobMessagePanel.h.

Referenced by JobMessagePanel(), onClearLog(), and onMessage().

◆ m_stackedWidget

QStackedWidget* InfoPanel::m_stackedWidget
protectedinherited

◆ m_toolBar

InfoPanelToolBar* InfoPanel::m_toolBar
protectedinherited

The documentation for this class was generated from the following files: