diff --git a/GUI/coregui/Models/ApplicationModels.cpp b/GUI/coregui/Models/ApplicationModels.cpp index 9c23b277b8ec39e35adc42bffff2fdc885cf1551..e682b37c8e1be5e617284ecd838c7a43b54c3c78 100644 --- a/GUI/coregui/Models/ApplicationModels.cpp +++ b/GUI/coregui/Models/ApplicationModels.cpp @@ -205,7 +205,7 @@ void ApplicationModels::createTestSample() void ApplicationModels::createTestJob() { SimulationOptionsItem *optionsItem = m_documentModel->getSimulationOptionsItem(); - optionsItem->setRunPolicy(Constants::JOB_RUN_IN_BACKGROUND); +// optionsItem->setRunPolicy(Constants::JOB_RUN_IN_BACKGROUND); JobItem *jobItem = m_jobModel->addJob( m_sampleModel->multiLayerItem(), diff --git a/GUI/coregui/Views/CommonWidgets/StatusLabel.cpp b/GUI/coregui/Views/CommonWidgets/StatusLabel.cpp index c27be1f8a21b19691887b3fdd1ffef22a556831f..4ad848b2d007037346eb39eb3e0ba7b746c770f9 100644 --- a/GUI/coregui/Views/CommonWidgets/StatusLabel.cpp +++ b/GUI/coregui/Views/CommonWidgets/StatusLabel.cpp @@ -22,7 +22,7 @@ namespace { const int default_label_height = 20; -const int default_text_size = 12; +const int default_text_size = 11; } StatusLabel::StatusLabel(QWidget *parent) diff --git a/GUI/coregui/Views/FitWidgets/FitComparisonWidget.cpp b/GUI/coregui/Views/FitWidgets/FitComparisonWidget.cpp index 0711e096ff20e7af090ac20343bb79a91f64bd3d..1610bbb569ea923e7fa309af5600be5cec699386 100644 --- a/GUI/coregui/Views/FitWidgets/FitComparisonWidget.cpp +++ b/GUI/coregui/Views/FitWidgets/FitComparisonWidget.cpp @@ -15,35 +15,51 @@ // ************************************************************************** // #include "FitComparisonWidget.h" -#include "ColorMapPlot.h" +#include "ColorMap.h" #include "JobItem.h" #include "RealDataItem.h" #include "SessionModel.h" #include "IntensityDataItem.h" #include "IntensityDataFunctions.h" +#include "FitFlowWidget.h" +#include "ColorMapLabel.h" #include <QGridLayout> #include <QVBoxLayout> +#include <QVBoxLayout> #include <QLabel> #include <QDebug> FitComparisonWidget::FitComparisonWidget(QWidget *parent) : SessionItemWidget(parent) - , m_realDataPlot(new ColorMapPlot) - , m_simulatedDataPlot(new ColorMapPlot) - , m_relativeDiffPlot(new ColorMapPlot) + , m_realDataPlot(new ColorMap) + , m_simulatedDataPlot(new ColorMap) + , m_relativeDiffPlot(new ColorMap) + , m_fitFlowWidget(new FitFlowWidget) + , m_statusLabel(new ColorMapLabel(0, this)) , m_realDataItem(0) , m_simulatedDataItem(0) , m_relativeDiffItem(0) , m_tempIntensityDataModel(new SessionModel("TempIntensityDataModel", this)) { + QVBoxLayout *vlayout = new QVBoxLayout; + vlayout->setMargin(0); + vlayout->setSpacing(0); QGridLayout *gridLayout = new QGridLayout; + gridLayout->setMargin(0); + gridLayout->setSpacing(0); + + setStyleSheet("background-color:white;"); gridLayout->addWidget(m_realDataPlot, 0, 0); gridLayout->addWidget(m_simulatedDataPlot, 0, 1); gridLayout->addWidget(m_relativeDiffPlot, 1, 0); + gridLayout->addWidget(m_fitFlowWidget, 1, 1); + + vlayout->addLayout(gridLayout); + vlayout->addWidget(m_statusLabel); + setLayout(vlayout); - setLayout(gridLayout); } FitComparisonWidget::~FitComparisonWidget() @@ -72,6 +88,11 @@ void FitComparisonWidget::setJobItem(JobItem *jobItem) m_realDataPlot->setItem(m_realDataItem); m_simulatedDataPlot->setItem(m_simulatedDataItem); m_relativeDiffPlot->setItem(m_relativeDiffItem); + + m_statusLabel->reset(); + m_statusLabel->addColorMap(m_realDataPlot); + m_statusLabel->addColorMap(m_simulatedDataPlot); + m_statusLabel->addColorMap(m_relativeDiffPlot); } //! Sets tracking of simulated data item. diff --git a/GUI/coregui/Views/FitWidgets/FitComparisonWidget.h b/GUI/coregui/Views/FitWidgets/FitComparisonWidget.h index 603413c304aa45a2a2daf26dc62b8a32849e0808..6a4767d8df27da0da7894e035c64384fd0dfd537 100644 --- a/GUI/coregui/Views/FitWidgets/FitComparisonWidget.h +++ b/GUI/coregui/Views/FitWidgets/FitComparisonWidget.h @@ -20,7 +20,10 @@ #include "SessionItemWidget.h" class IntensityDataItem; -class ColorMapPlot; +class ColorMap; +class SessionModel; +class FitFlowWidget; +class ColorMapLabel; //! The FitComparisonWidget class plots realdata, simulated data and relative difference map //! during the course of the fit. @@ -41,18 +44,20 @@ protected: private: void setSimulatedDataItem(IntensityDataItem *simulatedDataItem); - class IntensityDataItem *createRelativeDifferenceItem(); + IntensityDataItem *createRelativeDifferenceItem(); void calculateRelativeDifference(); - ColorMapPlot *m_realDataPlot; - ColorMapPlot *m_simulatedDataPlot; - ColorMapPlot *m_relativeDiffPlot; + ColorMap *m_realDataPlot; + ColorMap *m_simulatedDataPlot; + ColorMap *m_relativeDiffPlot; + FitFlowWidget *m_fitFlowWidget; + ColorMapLabel *m_statusLabel; IntensityDataItem *m_realDataItem; IntensityDataItem *m_simulatedDataItem; IntensityDataItem *m_relativeDiffItem; - class SessionModel *m_tempIntensityDataModel; + SessionModel *m_tempIntensityDataModel; }; #endif diff --git a/GUI/coregui/Views/FitWidgets/FitFlowWidget.cpp b/GUI/coregui/Views/FitWidgets/FitFlowWidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..088cbab2fcb5d6feb58a99991ee38eb9fc22e3bf --- /dev/null +++ b/GUI/coregui/Views/FitWidgets/FitFlowWidget.cpp @@ -0,0 +1,32 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/FitWidgets/FitFlowWidget.cpp +//! @brief Implement class FitFlowWidget +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#include "FitFlowWidget.h" +#include <QVBoxLayout> + +FitFlowWidget::FitFlowWidget(QWidget *parent) + : QFrame(parent) +{ + setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + + QVBoxLayout *layout = new QVBoxLayout; + layout->setSpacing(0); + layout->setMargin(0); + + setStyleSheet("background-color:white;"); + + setLayout(layout); +} diff --git a/GUI/coregui/Views/FitWidgets/FitFlowWidget.h b/GUI/coregui/Views/FitWidgets/FitFlowWidget.h new file mode 100644 index 0000000000000000000000000000000000000000..964bebcb30d51af827785a36fae3941fa2b89b7c --- /dev/null +++ b/GUI/coregui/Views/FitWidgets/FitFlowWidget.h @@ -0,0 +1,37 @@ +// ************************************************************************** // +// +// BornAgain: simulate and fit scattering at grazing incidence +// +//! @file GUI/coregui/Views/FitWidgets/FitFlowWidget.h +//! @brief Declares class FitFlowWidget +//! +//! @homepage http://www.bornagainproject.org +//! @license GNU General Public License v3 or higher (see COPYING) +//! @copyright Forschungszentrum Jülich GmbH 2016 +//! @authors Scientific Computing Group at MLZ Garching +//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov +//! @authors Walter Van Herck, Joachim Wuttke +// +// ************************************************************************** // + +#ifndef FITFLOWWIDGET_H +#define FITFLOWWIDGET_H + +#include "WinDllMacros.h" +#include <QFrame> + +//! The FitFlowWidget class is intended for showing chi2 .vs interation count dependency. +//! The main goal is to fill vacant place in FitComparisonWidget. + +class BA_CORE_API_ FitFlowWidget : public QFrame +{ + Q_OBJECT +public: + explicit FitFlowWidget(QWidget *parent = 0); + +}; + + + +#endif + diff --git a/GUI/coregui/Views/IntensityDataWidgets/ColorMapCanvas.cpp b/GUI/coregui/Views/IntensityDataWidgets/ColorMapCanvas.cpp index 50245a22740ca3bff5c3f485add0feaed980b455..84f0d9eb309812a2f693b97f7eb1ea52cfeb8b7c 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/ColorMapCanvas.cpp +++ b/GUI/coregui/Views/IntensityDataWidgets/ColorMapCanvas.cpp @@ -39,7 +39,7 @@ ColorMapCanvas::ColorMapCanvas(QWidget *parent) setLayout(layout); - m_statusLabel->setLabelEnabled(true); + m_statusLabel->setLabelEnabled(false); } diff --git a/GUI/coregui/Views/IntensityDataWidgets/ColorMapLabel.cpp b/GUI/coregui/Views/IntensityDataWidgets/ColorMapLabel.cpp index 2894065532054013a671bc1a47a4119fbb42f7af..0ab4f8a6a92f81435592cc227389bb8fc966eaa1 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/ColorMapLabel.cpp +++ b/GUI/coregui/Views/IntensityDataWidgets/ColorMapLabel.cpp @@ -17,10 +17,15 @@ #include "ColorMapLabel.h" #include "ColorMap.h" +//namespace { +//const int min_size = 0; +//} + ColorMapLabel::ColorMapLabel(ColorMap *colorMap, QWidget *parent) : StatusLabel(parent) { - addColorMap(colorMap); + if(colorMap) + addColorMap(colorMap); } void ColorMapLabel::addColorMap(ColorMap *colorMap) @@ -43,11 +48,27 @@ void ColorMapLabel::setLabelEnabled(bool flag) setEnabled(flag); } +//! Disconnects all color maps from the label. + +void ColorMapLabel::reset() +{ + foreach(ColorMap *colorMap, m_colorMaps) + setColorMapLabelEnabled(colorMap, false); + + m_colorMaps.clear(); +} + void ColorMapLabel::onColorMapStatusString(const QString &text) { setText(text); } +//void ColorMapLabel::resizeEvent(QResizeEvent *event) +//{ +// qDebug() << "ColorMapLabel::resizeEvent(QResizeEvent *event)" << event->size(); + +//} + //! Enables/disables showing of label for given color map. void ColorMapLabel::setColorMapLabelEnabled(ColorMap *colorMap, bool flag) diff --git a/GUI/coregui/Views/IntensityDataWidgets/ColorMapLabel.h b/GUI/coregui/Views/IntensityDataWidgets/ColorMapLabel.h index bb064a4ea4310dc2e96a8cdd69e0b275453a88e6..352a38c3178af95034aeccc081efe6d60b7afbe7 100644 --- a/GUI/coregui/Views/IntensityDataWidgets/ColorMapLabel.h +++ b/GUI/coregui/Views/IntensityDataWidgets/ColorMapLabel.h @@ -21,6 +21,7 @@ #include <QList> class ColorMap; +class QResizeEvent; //! The ColorMapLabel class shows status string as reported by ColorMap in a frame. //! Can work with more than one ColorMap. Provides automatic adjustment of font size, @@ -37,10 +38,14 @@ public: void setLabelEnabled(bool flag); + void reset(); public slots: void onColorMapStatusString(const QString &text); +//protected: +// void resizeEvent(QResizeEvent *event); + private: void setColorMapLabelEnabled(ColorMap *colorMap, bool flag); void setConnected(ColorMap *colorMap, bool flag);