Commit 963cc9c6 authored by Aaron Bray's avatar Aaron Bray

Major Environment Tab Update

parent 1c920845
......@@ -18,7 +18,7 @@ public:
QChronicAnemiaWidget::QChronicAnemiaWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent, flags)
{
m_Controls = new Controls();
m_Controls->ReductionFactor = new QScalarWidget("Reduction Factor", 0, 1, 0.1, false, this);
m_Controls->ReductionFactor = new QScalarWidget("Reduction Factor", 0, 1, 0.1, ScalarOptionWidget::None, this);
layout()->addWidget(m_Controls->ReductionFactor);
reset();
}
......
......@@ -19,8 +19,8 @@ public:
QChronicObstructivePulmonaryDiseaseWidget::QChronicObstructivePulmonaryDiseaseWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent,flags)
{
m_Controls = new Controls();
m_Controls->BronchitisSeverity = new QScalarWidget("Bronchitis Severity", 0, 1, 0.1, false, this);
m_Controls->EmphysemaSeverity = new QScalarWidget("Emphysema Severity", 0, 1, 0.1, false, this);
m_Controls->BronchitisSeverity = new QScalarWidget("Bronchitis Severity", 0, 1, 0.1, ScalarOptionWidget::None, this);
m_Controls->EmphysemaSeverity = new QScalarWidget("Emphysema Severity", 0, 1, 0.1, ScalarOptionWidget::None, this);
layout()->addWidget(m_Controls->BronchitisSeverity);
layout()->addWidget(m_Controls->EmphysemaSeverity);
reset();
......
......@@ -22,7 +22,7 @@ public:
QChronicPericardialEffusionWidget::QChronicPericardialEffusionWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent,flags)
{
m_Controls = new Controls();
m_Controls->AccumulatedVolume = new QScalarQuantityWidget<VolumeUnit>("Accumulated Volume", 0, 1000, 1, VolumeUnit::mL, false, this);
m_Controls->AccumulatedVolume = new QScalarQuantityWidget<VolumeUnit>("Accumulated Volume", 0, 1000, 1, VolumeUnit::mL, ScalarOptionWidget::None, this);
m_Controls->AccumulatedVolume->addUnit(VolumeUnit::L);
layout()->addWidget(m_Controls->AccumulatedVolume);
reset();
......
......@@ -19,8 +19,8 @@ public:
QChronicRenalStenosisWidget::QChronicRenalStenosisWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent,flags)
{
m_Controls = new Controls();
m_Controls->LeftKidneySeverity = new QScalarWidget("Left Kidney Severity", 0, 1, 0.1, false, this);
m_Controls->RightKidneySeverity = new QScalarWidget("Right Kidney Severity", 0, 1, 0.1, false, this);
m_Controls->LeftKidneySeverity = new QScalarWidget("Left Kidney Severity", 0, 1, 0.1, ScalarOptionWidget::None, this);
m_Controls->RightKidneySeverity = new QScalarWidget("Right Kidney Severity", 0, 1, 0.1, ScalarOptionWidget::None, this);
layout()->addWidget(m_Controls->LeftKidneySeverity);
layout()->addWidget(m_Controls->RightKidneySeverity);
reset();
......
......@@ -21,9 +21,9 @@ public:
QImpairedAlveolarExchangeWidget::QImpairedAlveolarExchangeWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent,flags)
{
m_Controls = new Controls();
m_Controls->ImpairedFraction = new QScalarWidget("Impaired Fraction", 0, 1, 0.1, false, this);
m_Controls->ImpairedFraction = new QScalarWidget("Impaired Fraction", 0, 1, 0.1, ScalarOptionWidget::None, this);
layout()->addWidget(m_Controls->ImpairedFraction);
m_Controls->ImpairedSurfaceArea = new QScalarQuantityWidget<AreaUnit>("Impaired Surface Area", 0, 100, 1, AreaUnit::m2, false, this);
m_Controls->ImpairedSurfaceArea = new QScalarQuantityWidget<AreaUnit>("Impaired Surface Area", 0, 100, 1, AreaUnit::m2, ScalarOptionWidget::None, this);
m_Controls->ImpairedSurfaceArea->addUnit(AreaUnit::cm2);
layout()->addWidget(m_Controls->ImpairedSurfaceArea);
reset();
......
......@@ -20,9 +20,9 @@ public:
QLobarPneumoniaWidget::QLobarPneumoniaWidget(QWidget *parent, Qt::WindowFlags flags) : QConditionWidget(parent,flags)
{
m_Controls = new Controls();
m_Controls->Severity = new QScalarWidget("Severity", 0, 1, 0.1, false, this);
m_Controls->LeftLungAffected = new QScalarWidget("Left Lung Affected", 0, 1, 0.1, false, this);
m_Controls->RightLungAffected = new QScalarWidget("Right Lung Affected", 0, 1, 0.1, false, this);
m_Controls->Severity = new QScalarWidget("Severity", 0, 1, 0.1, ScalarOptionWidget::None, this);
m_Controls->LeftLungAffected = new QScalarWidget("Left Lung Affected", 0, 1, 0.1, ScalarOptionWidget::None, this);
m_Controls->RightLungAffected = new QScalarWidget("Right Lung Affected", 0, 1, 0.1, ScalarOptionWidget::None, this);
layout()->addWidget(m_Controls->Severity);
layout()->addWidget(m_Controls->LeftLungAffected);
layout()->addWidget(m_Controls->RightLungAffected);
......
This diff is collapsed.
......@@ -6,6 +6,8 @@ See accompanying NOTICE file for details.*/
#include <QDockWidget>
#include "QPulse.h"
class SEEnvironmentalConditions;
namespace Ui {
class EnviornmentWidget;
}
......@@ -14,19 +16,11 @@ class QEnviornmentWidget : public QDockWidget, public PulseListener
{
Q_OBJECT
public:
QEnviornmentWidget(QTextEdit& log, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
QEnviornmentWidget(QPulse& qp, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
virtual ~QEnviornmentWidget();
void Reset();
void DeleteAerosol();
void DeleteGases();
void pushall();
void UpdateValues(PhysiologyEngine & pulse);
//SECondition& GetInitialEnvironmentConditions();
void AtSteadyState(PhysiologyEngine& pulse);
void AtSteadyStateUpdateUI();// Main Window will call this to update UI Components
......@@ -35,8 +29,21 @@ public:
//signals:
protected slots:
void AddGases();
void AddAerosol();
void EnableCooling();
void EnableCoolingSurfaceArea();
void EnableCoolingSurfaceAreaFraction();
void EnableHeating();
void EnableHeatingSurfaceArea();
void EnableHeatingSurfaceAreaFraction();
void EnableAppliedTemp();
void EnableAppliedTempSurfaceArea();
void EnableAppliedSurfaceAreaFraction();
void SelectEnvironmentFile();
void ControlsToEnvironment();
void EnvironmentToControls();
void LoadEnvironmentFile(const std::string& fileName);
private:
class Controls;
......
......@@ -148,7 +148,7 @@ MainExplorerWindow::MainExplorerWindow()
m_Controls->DataRequestsWidget = new QDataRequestsWidget(*m_Controls->LogBox, this);
m_Controls->DataRequestsWidget->setTitleBarWidget(new QWidget());
m_Controls->TabWidget->widget(tabIdx++)->layout()->addWidget(m_Controls->DataRequestsWidget);
m_Controls->EnviornmentWidget = new QEnviornmentWidget(*m_Controls->LogBox, this);
m_Controls->EnviornmentWidget = new QEnviornmentWidget(*m_Controls->Pulse, this);
m_Controls->EnviornmentWidget->setTitleBarWidget(new QWidget());
m_Controls->TabWidget->widget(tabIdx++)->layout()->addWidget(m_Controls->EnviornmentWidget);
......
This diff is collapsed.
......@@ -9,6 +9,7 @@ See accompanying NOTICE file for details.*/
#include <QDoubleSpinBox>
#include <QSpacerItem>
#include <QComboBox>
#include <QRadioButton.h>
#include "controls/ScalarWidget.h"
......@@ -18,17 +19,22 @@ See accompanying NOTICE file for details.*/
template <typename Unit>
class QScalarQuantityWidget : public QScalarConvertWidget
{
public:
explicit QScalarQuantityWidget(const QString& name, double min, double max, double step, const Unit& unit, bool check = true, QWidget *parent = nullptr, bool type = false);
explicit QScalarQuantityWidget(const QString& name, double min, double max, double step, const Unit& unit, ScalarOptionWidget optWidget=ScalarOptionWidget::Check, QWidget *parent = nullptr, bool seperate_label = false);
void reset();
bool isChecked();
void setDecimals(int prec);
void addUnit(const Unit& unit);
void setValue(const SEScalarQuantity<Unit>& s);
void getValue(SEScalarQuantity<Unit>& s);
void enableInput(bool b);
void enableConverter(bool b);
void fullDisable();
const QRadioButton* getRadioButton() { return m_Radio; }
protected slots:
void checkProperty(bool b);
......@@ -39,6 +45,7 @@ protected slots:
QHBoxLayout* m_Layout;
QCheckBox* m_Check;
QRadioButton* m_Radio;
QLabel* m_Label;
QDoubleSpinBox* m_Value;
QSpacerItem* m_Spacer;
......
......@@ -3,7 +3,7 @@ See accompanying NOTICE file for details.*/
#include "ScalarQuantityWidget.h"
template<typename Unit>
QScalarQuantityWidget<Unit>::QScalarQuantityWidget(const QString& name, double min, double max, double step, const Unit& unit, bool check, QWidget *parent, bool type) : QScalarConvertWidget(parent), m_DefaultUnit(unit)
QScalarQuantityWidget<Unit>::QScalarQuantityWidget(const QString& name, double min, double max, double step, const Unit& unit, ScalarOptionWidget optWidget, QWidget *parent, bool seperate_label) : QScalarConvertWidget(parent), m_DefaultUnit(unit)
{
setAutoFillBackground(true);
m_Layout = new QHBoxLayout(this);
......@@ -13,35 +13,58 @@ QScalarQuantityWidget<Unit>::QScalarQuantityWidget(const QString& name, double m
QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
if (check)
m_Check = nullptr;
m_Radio = nullptr;
switch (optWidget)
{
m_Check = new QCheckBox(name, this);
sizePolicy.setHeightForWidth(m_Check->sizePolicy().hasHeightForWidth());
m_Check->setSizePolicy(sizePolicy);
m_Label = nullptr;
m_Layout->addWidget(m_Check);
connect(m_Check, SIGNAL(toggled(bool)), this, SLOT(checkProperty(bool)));
if (type) {
m_Label = new QLabel(name, this);
m_Label->setSizePolicy(sizePolicy);
m_Layout->addWidget(m_Label);
}
}
else
{
m_Check = nullptr;
m_Label = new QLabel(name, this);
sizePolicy.setHeightForWidth(m_Label->sizePolicy().hasHeightForWidth());
m_Label->setSizePolicy(sizePolicy);
m_Layout->addWidget(m_Label);
case ScalarOptionWidget::Check:
{
m_Check = new QCheckBox(name, this);
sizePolicy.setHeightForWidth(m_Check->sizePolicy().hasHeightForWidth());
m_Check->setSizePolicy(sizePolicy);
m_Label = nullptr;
m_Layout->addWidget(m_Check);
connect(m_Check, SIGNAL(toggled(bool)), this, SLOT(checkProperty(bool)));
if (seperate_label)
{
m_Label = new QLabel(name, this);
m_Label->setSizePolicy(sizePolicy);
m_Layout->addWidget(m_Label);
}
break;
}
case ScalarOptionWidget::Radio:
{
m_Radio = new QRadioButton(name, this);
sizePolicy.setHeightForWidth(m_Radio->sizePolicy().hasHeightForWidth());
m_Radio->setSizePolicy(sizePolicy);
m_Label = nullptr;
m_Layout->addWidget(m_Radio);
//connect(m_Radio, SIGNAL(toggled(bool)), this, SLOT(checkProperty(bool)));
if (seperate_label)
{
m_Label = new QLabel(name, this);
m_Label->setSizePolicy(sizePolicy);
m_Layout->addWidget(m_Label);
}
break;
}
case ScalarOptionWidget::None:
{
m_Label = new QLabel(name, this);
sizePolicy.setHeightForWidth(m_Label->sizePolicy().hasHeightForWidth());
m_Label->setSizePolicy(sizePolicy);
m_Layout->addWidget(m_Label);
break;
}
}
m_Spacer = new QSpacerItem(40, 30, QSizePolicy::Expanding, QSizePolicy::Minimum);
m_Layout->addItem(m_Spacer);
m_Value = new QDoubleSpinBox(this);
m_Value->setSingleStep(step);
if (check)
if (optWidget == ScalarOptionWidget::Check)
m_Value->setSpecialValueText("nan");
m_Value->setMinimum(check ? min - step : min);
m_Value->setMinimum(optWidget == ScalarOptionWidget::Check ? min - step : min);
m_Value->setMaximum(max);
m_Value->setMinimumSize(QSize(70, 22));
m_Value->setMaximumSize(QSize(70, 22));
......@@ -66,9 +89,13 @@ QScalarQuantityWidget<Unit>::QScalarQuantityWidget(const QString& name, double m
m_Max = max;
m_Step = step;
reset();
if (type) {
m_Check->setChecked(type);
m_Check->hide();
if (seperate_label)
{
if (m_Check != nullptr)
{
m_Check->setChecked(true);
m_Check->hide();
}
}
}
......@@ -78,6 +105,8 @@ void QScalarQuantityWidget<Unit>::reset()
m_Convert = false;
if (m_Check != nullptr)
m_Check->setChecked(false);
if (m_Radio != nullptr)
m_Radio->setChecked(false);
enableInput(true, false);
m_LastUnitIndex = 0;
m_LastValue = m_Value->minimum();
......@@ -90,9 +119,17 @@ bool QScalarQuantityWidget<Unit>::isChecked()
{
if (m_Check != nullptr)
return m_Check->isChecked();
if (m_Radio != nullptr)
return m_Radio->isChecked();
return true;
}
template<typename Unit>
void QScalarQuantityWidget<Unit>::setDecimals(int prec)
{
m_Value->setDecimals(prec);
}
template<typename Unit>
void QScalarQuantityWidget<Unit>::addUnit(const Unit& unit)
{
......@@ -123,6 +160,7 @@ void QScalarQuantityWidget<Unit>::setValue(const SEScalarQuantity<Unit>& s)
m_Value->setValue(m_Value->minimum());
if (m_Check != nullptr)
m_Check->setChecked(false);
m_Value->setEnabled(false);
}
}
......@@ -146,10 +184,22 @@ template<typename Unit>
void QScalarQuantityWidget<Unit>::enableInput(bool check, bool value)
{
if (m_Check != nullptr)
m_Check->setEnabled(check);
m_Check->setChecked(check);
if (m_Radio != nullptr)
m_Radio->setChecked(check);
m_Value->setEnabled(value);
}
template<typename Unit>
void QScalarQuantityWidget<Unit>::fullDisable()
{
enableInput(false);
if (m_Check != nullptr)
m_Check->setDisabled(true);
if (m_Radio != nullptr)
m_Radio->setDisabled(true);
}
template<typename Unit>
void QScalarQuantityWidget<Unit>::checkProperty(bool b)
{
......
......@@ -5,7 +5,7 @@ See accompanying NOTICE file for details.*/
#include "cdm/CommonDataModel.h"
#include "cdm/properties/SEScalar.h"
QScalarWidget::QScalarWidget(const QString& name, double min, double max, double step, bool check, QWidget *parent,bool type) : QWidget(parent)
QScalarWidget::QScalarWidget(const QString& name, double min, double max, double step, ScalarOptionWidget optWidget, QWidget *parent, bool seperate_label) : QWidget(parent)
{
setAutoFillBackground(true);
m_Layout = new QHBoxLayout(this);
......@@ -15,35 +15,58 @@ QScalarWidget::QScalarWidget(const QString& name, double min, double max, double
QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
if (check)
m_Check = nullptr;
m_Radio = nullptr;
switch (optWidget)
{
m_Check = new QCheckBox(name,this);
sizePolicy.setHeightForWidth(m_Check->sizePolicy().hasHeightForWidth());
m_Check->setSizePolicy(sizePolicy);
m_Label = nullptr;
m_Layout->addWidget(m_Check);
connect(m_Check, SIGNAL(toggled(bool)), this, SLOT(checkProperty(bool)));
if (type) {
m_Label = new QLabel(name, this);
m_Label->setSizePolicy(sizePolicy);
m_Layout->addWidget(m_Label);
}
case ScalarOptionWidget::Check:
{
m_Check = new QCheckBox(name, this);
sizePolicy.setHeightForWidth(m_Check->sizePolicy().hasHeightForWidth());
m_Check->setSizePolicy(sizePolicy);
m_Label = nullptr;
m_Layout->addWidget(m_Check);
connect(m_Check, SIGNAL(toggled(bool)), this, SLOT(checkProperty(bool)));
if (seperate_label)
{
m_Label = new QLabel(name, this);
m_Label->setSizePolicy(sizePolicy);
m_Layout->addWidget(m_Label);
}
break;
}
case ScalarOptionWidget::Radio:
{
m_Radio = new QRadioButton(name, this);
sizePolicy.setHeightForWidth(m_Radio->sizePolicy().hasHeightForWidth());
m_Radio->setSizePolicy(sizePolicy);
m_Label = nullptr;
m_Layout->addWidget(m_Radio);
//connect(m_Radio, SIGNAL(toggled(bool)), this, SLOT(checkProperty(bool)));
if (seperate_label)
{
m_Label = new QLabel(name, this);
m_Label->setSizePolicy(sizePolicy);
m_Layout->addWidget(m_Label);
}
break;
}
case ScalarOptionWidget::None:
{
m_Label = new QLabel(name, this);
sizePolicy.setHeightForWidth(m_Label->sizePolicy().hasHeightForWidth());
m_Label->setSizePolicy(sizePolicy);
m_Layout->addWidget(m_Label);
break;
}
}
else
{
m_Check = nullptr;
m_Label = new QLabel(name,this);
sizePolicy.setHeightForWidth(m_Label->sizePolicy().hasHeightForWidth());
m_Label->setSizePolicy(sizePolicy);
m_Layout->addWidget(m_Label);
}
m_Spacer1 = new QSpacerItem(40,30, QSizePolicy::Expanding, QSizePolicy::Maximum);
m_Spacer1 = new QSpacerItem(40, 30, QSizePolicy::Expanding, QSizePolicy::Maximum);
m_Layout->addItem(m_Spacer1);
m_Value = new QDoubleSpinBox(this);
m_Value = new QDoubleSpinBox(this);
m_Value->setSingleStep(step);
if(check)
if (optWidget==ScalarOptionWidget::Check)
m_Value->setSpecialValueText("nan");
m_Value->setMinimum(check ? min-step : min);
m_Value->setMinimum(optWidget==ScalarOptionWidget::Check ? min - step : min);
m_Value->setMaximum(max);
m_Value->setMinimumSize(QSize(70, 22));
m_Value->setMaximumSize(QSize(70, 22));
......@@ -53,9 +76,13 @@ QScalarWidget::QScalarWidget(const QString& name, double min, double max, double
m_Layout->addItem(m_Spacer2);
setLayout(m_Layout);
reset();
if (type) {
m_Check->setChecked(type);
m_Check->hide();
if (seperate_label)
{
if (m_Check != nullptr)
{
m_Check->setChecked(true);
m_Check->hide();
}
}
}
void QScalarWidget::reset()
......@@ -74,6 +101,11 @@ bool QScalarWidget::isChecked()
return true;
}
void QScalarWidget::setDecimals(int prec)
{
m_Value->setDecimals(prec);
}
void QScalarWidget::setValue(const SEScalar& s)
{
if (s.IsValid())
......@@ -90,6 +122,7 @@ void QScalarWidget::setValue(const SEScalar& s)
if (m_Check != nullptr)
m_Check->setChecked(false);
m_LastValue = m_Value->minimum();
m_Value->setEnabled(false);
}
}
......@@ -110,10 +143,21 @@ void QScalarWidget::enableInput(bool b)
void QScalarWidget::enableInput(bool check, bool value)
{
if (m_Check != nullptr)
m_Check->setEnabled(check);
m_Check->setChecked(check);
if (m_Radio != nullptr)
m_Radio->setChecked(check);
m_Value->setEnabled(value);
}
void QScalarWidget::fullDisable()
{
enableInput(false);
if (m_Check != nullptr)
m_Check->setDisabled(true);
if (m_Radio != nullptr)
m_Radio->setDisabled(true);
}
void QScalarWidget::checkProperty(bool b)
{
m_Value->setEnabled(b);
......
......@@ -9,22 +9,30 @@ See accompanying NOTICE file for details.*/
#include <QDoubleSpinBox>
#include <QSpacerItem>
#include <QComboBox>
#include <QRadioButton.h>
#include "cdm/CommonDataModel.h"
#include "cdm/properties/SEScalar.h"
enum class ScalarOptionWidget { None, Check, Radio };
class QScalarWidget : public QWidget
{
Q_OBJECT
public:
explicit QScalarWidget(const QString& name, double min, double max, double step, bool check=true, QWidget *parent = nullptr,bool type = false);
explicit QScalarWidget(const QString& name, double min, double max, double step, ScalarOptionWidget optWidget=ScalarOptionWidget::Check, QWidget *parent = nullptr, bool seperate_label = false);
void reset();
bool isChecked();
void setDecimals(int prec);
void setValue(const SEScalar& s);
void getValue(SEScalar& s);
void enableInput(bool b);
void fullDisable();
const QRadioButton* getRadioButton() { return m_Radio; }
public slots:
void checkProperty(bool b);
......@@ -34,6 +42,7 @@ protected:
QHBoxLayout* m_Layout;
QCheckBox* m_Check;
QRadioButton* m_Radio;
QLabel* m_Label;
QDoubleSpinBox* m_Value;
QSpacerItem* m_Spacer1;
......
This diff is collapsed.
......@@ -196,7 +196,13 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="Enviornment">
<widget class="QWidget" name="EnviornmentTab">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">QWidget#EnvironmentTab { background: lightgrey }</string>
</property>
<attribute name="title">
<string>Enviornment</string>
</attribute>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment