diff --git a/GUI/View/Fit/JobMessagePanel.cpp b/GUI/View/Fit/JobMessagePanel.cpp index 97b2887b0f0afc32014cceb7c1cfdd3ce49af08e..f7af65c2f04cb7d72c38cdcf3165ff01d3bc71ac 100644 --- a/GUI/View/Fit/JobMessagePanel.cpp +++ b/GUI/View/Fit/JobMessagePanel.cpp @@ -13,11 +13,8 @@ // ************************************************************************************************ #include "GUI/View/Fit/JobMessagePanel.h" -#include "GUI/View/Tool/mainwindow_constants.h" #include <QScrollBar> -#include <QStackedWidget> #include <QTextEdit> -#include <QVBoxLayout> namespace { @@ -43,37 +40,23 @@ QColor color(FitLogLevel level) } // namespace -JobMessagePanel::JobMessagePanel(QWidget* parent) - : InfoPanel(parent), m_log(nullptr), m_plainLog(new QTextEdit) +JobMessagePanel::JobMessagePanel(QWidget* parent) : QTextEdit(parent), m_log(nullptr) { - setWindowTitle(GUI::Constants::JobMessagePanelName); - setObjectName("JobMessagePanel"); - - m_plainLog->setReadOnly(true); - // m_plainLog->setMaximumBlockCount(100000); - m_plainLog->setFont(QFont("Courier")); - - m_stackedWidget->addWidget(m_plainLog); - - setContentVisible(false); -} - -void JobMessagePanel::onClearLog() -{ - m_plainLog->clear(); + setWindowTitle("Message Panel"); + setReadOnly(true); + setFont(QFont("Courier")); } void JobMessagePanel::appendMessage(const FitLog::Message& message) { - QScrollBar* scrollbar = m_plainLog->verticalScrollBar(); + QScrollBar* scrollbar = verticalScrollBar(); bool autoscroll = scrollbar->value() == scrollbar->maximum(); - // m_plainLog->appendPlainText(message); - m_plainLog->setTextColor(color(message.level)); - m_plainLog->append(QString::fromStdString(message.text)); + setTextColor(color(message.level)); + append(QString::fromStdString(message.text)); if (autoscroll) { - QTextCursor c = m_plainLog->textCursor(); + QTextCursor c = textCursor(); c.movePosition(QTextCursor::End); - m_plainLog->setTextCursor(c); + setTextCursor(c); } } @@ -82,11 +65,11 @@ void JobMessagePanel::setLog(FitLog* log) if (m_log) m_log->disconnect(this); m_log = log; - m_plainLog->clear(); + clear(); if (m_log) { for (const auto& record : m_log->messages()) appendMessage(record); - connect(m_log, &FitLog::cleared, this, &JobMessagePanel::onClearLog); + connect(m_log, &FitLog::cleared, this, &JobMessagePanel::clear); connect(m_log, &FitLog::messageAppended, this, &JobMessagePanel::appendMessage); } } diff --git a/GUI/View/Fit/JobMessagePanel.h b/GUI/View/Fit/JobMessagePanel.h index 28f1c8b47d640a013503cad4d74596cd018bad41..c14a65ea7bbbc9d362c7f3b2fd4bc772b7d4843d 100644 --- a/GUI/View/Fit/JobMessagePanel.h +++ b/GUI/View/Fit/JobMessagePanel.h @@ -15,28 +15,23 @@ #ifndef BORNAGAIN_GUI_VIEW_FIT_JOBMESSAGEPANEL_H #define BORNAGAIN_GUI_VIEW_FIT_JOBMESSAGEPANEL_H -#include "GUI/View/Common/InfoPanel.h" #include "GUI/View/Fit/FitLog.h" #include <QColor> - -class QTextEdit; +#include <QTextEdit> //! The JobMessagePanel class shows log messages from FitActivityPanel at the //! bottom part of JobView. -class JobMessagePanel : public InfoPanel { +class JobMessagePanel : public QTextEdit { Q_OBJECT public: JobMessagePanel(QWidget* parent = nullptr); -public slots: - void onClearLog(); void appendMessage(const FitLog::Message& message); void setLog(FitLog* log); private: FitLog* m_log; - QTextEdit* m_plainLog; }; #endif // BORNAGAIN_GUI_VIEW_FIT_JOBMESSAGEPANEL_H diff --git a/GUI/View/Job/JobView.cpp b/GUI/View/Job/JobView.cpp index 8f5a2e7250947e6217de421196bf39e7b55567a2..3e5a9bf476f550470883b07bd7dea5ef439057b4 100644 --- a/GUI/View/Job/JobView.cpp +++ b/GUI/View/Job/JobView.cpp @@ -109,9 +109,6 @@ void JobView::createSubWindows() m_docks->addWidget(JobViewFlags::FIT_PANEL_DOCK, m_fitActivityPanel, Qt::RightDockWidgetArea); m_docks->addWidget(JobViewFlags::JOB_MESSAGE_DOCK, m_jobMessagePanel, Qt::BottomDockWidgetArea); - connect(m_jobMessagePanel, &JobMessagePanel::widgetHeightRequest, m_docks, - &DocksController::setDockHeightForWidget); - m_fitActivityPanel->setRealTimeWidget(m_jobRealTimeWidget); setCentralWidget(m_jobResultsPresenter); diff --git a/GUI/View/Tool/mainwindow_constants.h b/GUI/View/Tool/mainwindow_constants.h index b278003ba7eecce19d5dfe2e525430eda3f5fbc0..1dbac7aaa9adf93273afd1248cf1f6c3d797c1bb 100644 --- a/GUI/View/Tool/mainwindow_constants.h +++ b/GUI/View/Tool/mainwindow_constants.h @@ -53,7 +53,6 @@ const QString JobRealTimeWidgetName = "Job Real Time"; const QString JobPropertiesWidgetName = "Job Properties"; const QString JobFitPanelName = "Fit Panel"; const QString JobSelectorWidgetName = "Job Selector"; -const QString JobMessagePanelName = "Message Panel"; const QString JobViewActivityName = "Job View Activity"; const QString JobRealTimeActivityName = "Real Time Activity";