diff --git a/GUI/View/Job/JobPropertiesWidget.cpp b/GUI/View/Job/JobPropertiesWidget.cpp index a3a70f45af388fe99450f418a4c4087415b04886..8b56e6dec939369ec5af0270ff82a9d0a48a3a3f 100644 --- a/GUI/View/Job/JobPropertiesWidget.cpp +++ b/GUI/View/Job/JobPropertiesWidget.cpp @@ -39,6 +39,7 @@ enum ETabId { JOB_PROPERTIES, JOB_MESSAGES }; JobPropertiesWidget::JobPropertiesWidget(QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f) , m_jobItem(nullptr) + , m_panelSize(10,10) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding); setWindowTitle(GUI::Constants::JobPropertiesWidgetName); @@ -64,12 +65,23 @@ JobPropertiesWidget::JobPropertiesWidget(QWidget* parent, Qt::WindowFlags f) connect(m_commentsEditor, &QTextEdit::textChanged, this, &JobPropertiesWidget::onCommentsEdited); + + readSettings(); + adjustSize(); + setFixedSize(m_panelSize); } JobPropertiesWidget::~JobPropertiesWidget() { if (m_jobItem) disconnect(m_jobItem, nullptr, this, nullptr); + writeSettings(); +} + +void JobPropertiesWidget::resizeEvent(QResizeEvent*) +{ + setMinimumSize(0,0); + setMaximumSize(QWIDGETSIZE_MAX,QWIDGETSIZE_MAX); } QSize JobPropertiesWidget::sizeHint() const @@ -127,3 +139,22 @@ void JobPropertiesWidget::onCommentsEdited() m_jobItem->blockSignals(false); } } + +void JobPropertiesWidget::readSettings() +{ + QSettings settings; + if (settings.childGroups().contains(GUI::Constants::S_JOB_PROPERTIES_PANEL)) { + settings.beginGroup(GUI::Constants::S_JOB_PROPERTIES_PANEL); + m_panelSize = settings.value(GUI::Constants::S_JOB_PROPERTIES_PANEL_SIZE).toSize(); + settings.endGroup(); + } +} + +void JobPropertiesWidget::writeSettings() +{ + QSettings settings; + settings.beginGroup(GUI::Constants::S_JOB_PROPERTIES_PANEL); + settings.setValue(GUI::Constants::S_JOB_PROPERTIES_PANEL_SIZE, size()); + settings.endGroup(); + settings.sync(); +} diff --git a/GUI/View/Job/JobPropertiesWidget.h b/GUI/View/Job/JobPropertiesWidget.h index 56645dfac5176e0310ca418434872571712703b2..fa9d021db133d05c4beea6ef0fa5dde368854cf1 100644 --- a/GUI/View/Job/JobPropertiesWidget.h +++ b/GUI/View/Job/JobPropertiesWidget.h @@ -33,6 +33,7 @@ public: ~JobPropertiesWidget() override; void setJobItem(JobItem* jobItem); + void resizeEvent(QResizeEvent*) override; QSize sizeHint() const override; QSize minimumSizeHint() const override; @@ -41,6 +42,8 @@ private: private slots: void onCommentsEdited(); + void readSettings(); + void writeSettings(); private: QTabWidget* m_tabWidget; @@ -48,6 +51,7 @@ private: JobPropertiesTableModel* m_propertiesModel; QTextEdit* m_commentsEditor; JobItem* m_jobItem; + QSize m_panelSize; }; #endif // BORNAGAIN_GUI_VIEW_JOB_JOBPROPERTIESWIDGET_H diff --git a/GUI/View/Job/JobSelectorWidget.cpp b/GUI/View/Job/JobSelectorWidget.cpp index c44c7bf21eef6cb8c7fe25dbaf2026608cfa23ce..79aa359e696a3e2eb813b485d927ed1487d80ebf 100644 --- a/GUI/View/Job/JobSelectorWidget.cpp +++ b/GUI/View/Job/JobSelectorWidget.cpp @@ -29,8 +29,6 @@ JobSelectorWidget::JobSelectorWidget(JobModel* jobModel, QWidget* parent) setWindowTitle(GUI::Constants::JobSelectorWidgetName); setObjectName("JobSelectorWidget"); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - auto* layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -39,12 +37,15 @@ JobSelectorWidget::JobSelectorWidget(JobModel* jobModel, QWidget* parent) auto* splitter = new QSplitter(Qt::Vertical, this); splitter->setChildrenCollapsible(true); layout->addWidget(splitter); +// splitter->hide(); m_jobListView = new JobListView(m_jobModel, splitter); splitter->addWidget(m_jobListView); +// m_jobListView->hide(); m_jobProperties = new JobPropertiesWidget(this); splitter->addWidget(m_jobProperties); +// m_jobProperties->hide(); connect(m_jobListView, &JobListView::selectedJobsChanged, this, &JobSelectorWidget::onSelectedJobsChanged); diff --git a/GUI/View/Job/JobView.cpp b/GUI/View/Job/JobView.cpp index c300c66144a4876e444c53dad1d481d45f241c9c..4099e1baedccfd568a596e07fb67ebd3b4fd0b09 100644 --- a/GUI/View/Job/JobView.cpp +++ b/GUI/View/Job/JobView.cpp @@ -118,7 +118,7 @@ void JobView::createSubWindows() m_jobMessagePanel = new JobMessagePanel(this); m_docks->addWidget(JobViewFlags::JOB_LIST_DOCK, m_jobSelector, Qt::LeftDockWidgetArea); - m_docks->addWidget(JobViewFlags::REAL_TIME_DOCK, m_jobRealTimeWidget, Qt::RightDockWidgetArea); +// m_docks->addWidget(JobViewFlags::REAL_TIME_DOCK, m_jobRealTimeWidget, Qt::RightDockWidgetArea); m_docks->addWidget(JobViewFlags::FIT_PANEL_DOCK, m_fitActivityPanel, Qt::RightDockWidgetArea); m_docks->addWidget(JobViewFlags::JOB_MESSAGE_DOCK, m_jobMessagePanel, Qt::BottomDockWidgetArea); diff --git a/GUI/View/Tool/mainwindow_constants.h b/GUI/View/Tool/mainwindow_constants.h index 87a3d4acf8f01fe6b67e5b54eae84e9c957afd1d..17a5b32ce6e4c81f9b754101490ea739fcbe9b49 100644 --- a/GUI/View/Tool/mainwindow_constants.h +++ b/GUI/View/Tool/mainwindow_constants.h @@ -24,6 +24,7 @@ const char S_MAIN_WINDOW[] = "MainWindow"; const char S_JOB_MESSAGE_PANEL[] = "JobMessagePanel"; const char S_JOB_SELECTOR_PANEL[] = "JobSelectorPanel"; const char S_FIT_ACTIVITY_PANEL[] = "FitActivityPanel"; +const char S_JOB_PROPERTIES_PANEL[] = "JobPropertiesPanel"; const char S_SESSION_MODEL_VIEW[] = "SessionModelView"; // Settings keys @@ -34,6 +35,7 @@ const char S_VIEW_IS_ACTIVE[] = "ViewIsActive"; const char S_JOB_MESSAGE_PANEL_SIZE[] = "size"; const char S_JOB_SELECTOR_PANEL_SIZE[] = "size"; const char S_FIT_ACTIVITY_PANEL_SIZE[] = "size"; +const char S_JOB_PROPERTIES_PANEL_SIZE[] = "size"; const int MAX_RECENT_PROJECTS = 10;