diff --git a/GUI/View/Fit/JobMessagePanel.cpp b/GUI/View/Fit/JobMessagePanel.cpp index a0bdac5dd2df7fd58e5e7a82dd70b9b2ba506d3a..e03ba91538fef6ee1650d644d2f557a4b367635b 100644 --- a/GUI/View/Fit/JobMessagePanel.cpp +++ b/GUI/View/Fit/JobMessagePanel.cpp @@ -13,8 +13,10 @@ // ************************************************************************************************ #include "GUI/View/Fit/JobMessagePanel.h" +#include "GUI/View/Tool/mainwindow_constants.h" #include <QScrollBar> #include <QTextEdit> +#include <QSettings> namespace { @@ -43,15 +45,48 @@ QColor color(FitLogLevel level) JobMessagePanel::JobMessagePanel(QWidget* parent) : QTextEdit(parent) , m_log(nullptr) + , m_panelSize(80, 400) { setWindowTitle("Message Panel"); setReadOnly(true); setFont(QFont("Courier")); + + readSettings(); + setMinimumSize(10,10); +} + +JobMessagePanel::~JobMessagePanel() +{ + writeSettings(); +} + +void JobMessagePanel::readSettings() +{ + QSettings settings; + if (settings.childGroups().contains(GUI::Constants::S_JOBMESSAGEPANEL)) { + settings.beginGroup(GUI::Constants::S_JOBMESSAGEPANEL); + m_panelSize = settings.value(GUI::Constants::S_JOBMESSAGEPANEL_SIZE).toSize(); + settings.endGroup(); + } +} + +void JobMessagePanel::writeSettings() +{ + QSettings settings; + settings.beginGroup(GUI::Constants::S_JOBMESSAGEPANEL); + settings.setValue(GUI::Constants::S_JOBMESSAGEPANEL_SIZE, size()); + settings.endGroup(); + settings.sync(); +} + +QSize JobMessagePanel::sizeHint() const +{ + return QSize(m_panelSize); } QSize JobMessagePanel::minimumSizeHint() const { - return QSize(80, 300); + return sizeHint(); } void JobMessagePanel::appendMessage(const FitLog::Message& message) diff --git a/GUI/View/Fit/JobMessagePanel.h b/GUI/View/Fit/JobMessagePanel.h index 484035dd3f2deeb45b81f0961aedb92ea0276168..52b6e4a3e553639691d63e092e0fedc89d55588a 100644 --- a/GUI/View/Fit/JobMessagePanel.h +++ b/GUI/View/Fit/JobMessagePanel.h @@ -26,14 +26,20 @@ class JobMessagePanel : public QTextEdit { Q_OBJECT public: JobMessagePanel(QWidget* parent = nullptr); + ~JobMessagePanel(); void appendMessage(const FitLog::Message& message); void setLog(FitLog* log); + QSize sizeHint() const override; QSize minimumSizeHint() const override; private: - FitLog* m_log; + void readSettings(); + void writeSettings(); + + FitLog* m_log; + QSize m_panelSize; }; #endif // BORNAGAIN_GUI_VIEW_FIT_JOBMESSAGEPANEL_H diff --git a/GUI/View/Job/JobResultsPresenter.cpp b/GUI/View/Job/JobResultsPresenter.cpp index 9c75fa7d26f85f7567048512ebe86a6204b4b543..2a8e97db135f3a9a7c015975d1314bf44f16f5ec 100644 --- a/GUI/View/Job/JobResultsPresenter.cpp +++ b/GUI/View/Job/JobResultsPresenter.cpp @@ -33,7 +33,7 @@ JobResultsPresenter::JobResultsPresenter(QWidget* parent) registerWidget("Reflectometry", create_new<SpecularDataWidget>); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - setMinimumSize(600, 600); + setMinimumSize(220, 200); } QString JobResultsPresenter::itemPresentation() const diff --git a/GUI/View/Tool/mainwindow_constants.h b/GUI/View/Tool/mainwindow_constants.h index a96300340c70ca818ae8348a26b2928d07935f7a..0564c6477ab45bfafcc15c403c8656b30d57bbc1 100644 --- a/GUI/View/Tool/mainwindow_constants.h +++ b/GUI/View/Tool/mainwindow_constants.h @@ -21,6 +21,7 @@ namespace GUI::Constants { // Settings groups const char S_MAINWINDOW[] = "MainWindow"; +const char S_JOBMESSAGEPANEL[] = "JobMessagePanel"; const char S_MASKEDITOR[] = "MaskEditor"; const char S_MATERIALEDITOR[] = "MaterialEditor"; const char S_SESSIONMODELVIEW[] = "SessionModelView"; @@ -31,6 +32,8 @@ const char S_WINDOWPOSITION[] = "pos"; const char S_SPLITTERSIZE[] = "SplitterSize"; const char S_VIEWISACTIVE[] = "ViewIsActive"; +const char S_JOBMESSAGEPANEL_SIZE[] = "size"; + const int MAX_RECENT_PROJECTS = 10; const char MIME_JOBQUEUE[] = "application/org.bornagainproject.jobqueue";