move from tabs to spaces
This commit is contained in:
parent
a6aad07f05
commit
fa45072998
86 changed files with 2611 additions and 2486 deletions
|
|
@ -2,73 +2,73 @@
|
|||
#include "ui_alarmwidget.h"
|
||||
|
||||
AlarmWidget::AlarmWidget(std::shared_ptr<AlarmTime> alarm, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
alarm_(alarm),
|
||||
ui(new Ui::AlarmWidget)
|
||||
QWidget(parent),
|
||||
alarm_(alarm),
|
||||
ui(new Ui::AlarmWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->checkBox, &QCheckBox::stateChanged, this, &AlarmWidget::toggleRepeating);
|
||||
connect(ui->radioButton, &QRadioButton::clicked, this, &AlarmWidget::setRepeatingType);
|
||||
connect(ui->radioButton_2, &QRadioButton::clicked, this, &AlarmWidget::setRepeatingType);
|
||||
connect(ui->radioButton_3, &QRadioButton::clicked, this, &AlarmWidget::setRepeatingType);
|
||||
connect(ui->radioButton_4, &QRadioButton::clicked, this, &AlarmWidget::setRepeatingType);
|
||||
ui->setupUi(this);
|
||||
connect(ui->checkBox, &QCheckBox::stateChanged, this, &AlarmWidget::toggleRepeating);
|
||||
connect(ui->radioButton, &QRadioButton::clicked, this, &AlarmWidget::setRepeatingType);
|
||||
connect(ui->radioButton_2, &QRadioButton::clicked, this, &AlarmWidget::setRepeatingType);
|
||||
connect(ui->radioButton_3, &QRadioButton::clicked, this, &AlarmWidget::setRepeatingType);
|
||||
connect(ui->radioButton_4, &QRadioButton::clicked, this, &AlarmWidget::setRepeatingType);
|
||||
|
||||
ui->dateTimeEdit->setDateTime(alarm->getDateTime());
|
||||
ui->dateTimeEdit->setDateTime(alarm->getDateTime());
|
||||
|
||||
if(alarm_->getRepeat() == AlarmTime::REPEAT_NEVER)
|
||||
{
|
||||
ui->radioButton->setEnabled(false);
|
||||
ui->radioButton_2->setEnabled(false);
|
||||
ui->radioButton_3->setEnabled(false);
|
||||
ui->radioButton_4->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->checkBox->setChecked(true);
|
||||
ui->radioButton->setEnabled(true);
|
||||
ui->radioButton_2->setEnabled(true);
|
||||
ui->radioButton_3->setEnabled(true);
|
||||
ui->radioButton_4->setEnabled(true);
|
||||
}
|
||||
if(alarm_->getRepeat() == AlarmTime::REPEAT_NEVER)
|
||||
{
|
||||
ui->radioButton->setEnabled(false);
|
||||
ui->radioButton_2->setEnabled(false);
|
||||
ui->radioButton_3->setEnabled(false);
|
||||
ui->radioButton_4->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->checkBox->setChecked(true);
|
||||
ui->radioButton->setEnabled(true);
|
||||
ui->radioButton_2->setEnabled(true);
|
||||
ui->radioButton_3->setEnabled(true);
|
||||
ui->radioButton_4->setEnabled(true);
|
||||
}
|
||||
|
||||
if(alarm_->getRepeat() == AlarmTime::REPEAT_DAILY) ui->radioButton->setChecked(true);
|
||||
else if(alarm_->getRepeat() == AlarmTime::REPEAT_WEEKLY) ui->radioButton_2->setChecked(true);
|
||||
else if(alarm_->getRepeat() == AlarmTime::REPEAT_MONTHLY)ui->radioButton_3->setChecked(true);
|
||||
else if(alarm_->getRepeat() == AlarmTime::REPEAT_YEARLY) ui->radioButton_4->setChecked(true);
|
||||
if(alarm_->getRepeat() == AlarmTime::REPEAT_DAILY) ui->radioButton->setChecked(true);
|
||||
else if(alarm_->getRepeat() == AlarmTime::REPEAT_WEEKLY) ui->radioButton_2->setChecked(true);
|
||||
else if(alarm_->getRepeat() == AlarmTime::REPEAT_MONTHLY)ui->radioButton_3->setChecked(true);
|
||||
else if(alarm_->getRepeat() == AlarmTime::REPEAT_YEARLY) ui->radioButton_4->setChecked(true);
|
||||
|
||||
connect(ui->dateTimeEdit, &QDateTimeEdit::dateTimeChanged, alarm.get(), &AlarmTime::changeTime);
|
||||
connect(ui->dateTimeEdit, &QDateTimeEdit::dateTimeChanged, alarm.get(), &AlarmTime::changeTime);
|
||||
}
|
||||
|
||||
AlarmWidget::~AlarmWidget()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AlarmWidget::setRepeatingType()
|
||||
{
|
||||
if(ui->radioButton->isChecked())alarm_->setRepeat(AlarmTime::REPEAT_DAILY);
|
||||
if(ui->radioButton_2->isChecked())alarm_->setRepeat(AlarmTime::REPEAT_WEEKLY);
|
||||
if(ui->radioButton_3->isChecked())alarm_->setRepeat(AlarmTime::REPEAT_MONTHLY);
|
||||
if(ui->radioButton_4->isChecked())alarm_->setRepeat(AlarmTime::REPEAT_YEARLY);
|
||||
if(ui->radioButton->isChecked())alarm_->setRepeat(AlarmTime::REPEAT_DAILY);
|
||||
if(ui->radioButton_2->isChecked())alarm_->setRepeat(AlarmTime::REPEAT_WEEKLY);
|
||||
if(ui->radioButton_3->isChecked())alarm_->setRepeat(AlarmTime::REPEAT_MONTHLY);
|
||||
if(ui->radioButton_4->isChecked())alarm_->setRepeat(AlarmTime::REPEAT_YEARLY);
|
||||
}
|
||||
|
||||
void AlarmWidget::toggleRepeating(int state)
|
||||
{
|
||||
if(state)
|
||||
{
|
||||
ui->radioButton->setEnabled(true);
|
||||
ui->radioButton_2->setEnabled(true);
|
||||
ui->radioButton_3->setEnabled(true);
|
||||
ui->radioButton_4->setEnabled(true);
|
||||
setRepeatingType();
|
||||
}
|
||||
else
|
||||
{
|
||||
alarm_->setRepeat(AlarmTime::REPEAT_NEVER);
|
||||
ui->radioButton->setEnabled(false);
|
||||
ui->radioButton_2->setEnabled(false);
|
||||
ui->radioButton_3->setEnabled(false);
|
||||
ui->radioButton_4->setEnabled(false);
|
||||
}
|
||||
if(state)
|
||||
{
|
||||
ui->radioButton->setEnabled(true);
|
||||
ui->radioButton_2->setEnabled(true);
|
||||
ui->radioButton_3->setEnabled(true);
|
||||
ui->radioButton_4->setEnabled(true);
|
||||
setRepeatingType();
|
||||
}
|
||||
else
|
||||
{
|
||||
alarm_->setRepeat(AlarmTime::REPEAT_NEVER);
|
||||
ui->radioButton->setEnabled(false);
|
||||
ui->radioButton_2->setEnabled(false);
|
||||
ui->radioButton_3->setEnabled(false);
|
||||
ui->radioButton_4->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,26 +5,27 @@
|
|||
#include <memory>
|
||||
#include "../../actors/alarmtime.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class AlarmWidget;
|
||||
}
|
||||
|
||||
class AlarmWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
std::shared_ptr<AlarmTime> alarm_;
|
||||
std::shared_ptr<AlarmTime> alarm_;
|
||||
|
||||
public:
|
||||
explicit AlarmWidget(std::shared_ptr<AlarmTime> alarm, QWidget *parent = nullptr);
|
||||
~AlarmWidget();
|
||||
explicit AlarmWidget(std::shared_ptr<AlarmTime> alarm, QWidget *parent = nullptr);
|
||||
~AlarmWidget();
|
||||
|
||||
private slots:
|
||||
void toggleRepeating(int state);
|
||||
void setRepeatingType();
|
||||
void toggleRepeating(int state);
|
||||
void setRepeatingType();
|
||||
|
||||
private:
|
||||
Ui::AlarmWidget *ui;
|
||||
Ui::AlarmWidget *ui;
|
||||
};
|
||||
|
||||
#endif // ALARMWIDGET_H
|
||||
|
|
|
|||
|
|
@ -3,82 +3,82 @@
|
|||
#include "../actorsettingsdialog.h"
|
||||
|
||||
FactorActorWidget::FactorActorWidget(std::shared_ptr<MultiFactorActor> actor, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::FactorActorWidget)
|
||||
QWidget(parent),
|
||||
actor_(actor),
|
||||
ui(new Ui::FactorActorWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->comboBox->setCurrentText(actor_->getFactorDirection() ? "True" : "False");
|
||||
ui->spinBox->setValue(actor_->getPreCancleTime());
|
||||
if(actor_->getFactorActor()) ui->label_FactorActor->setText(actor_->getFactorActor()->getName());
|
||||
connect(ui->pushButton, &QPushButton::clicked, this, &FactorActorWidget::createFactorActor);
|
||||
connect(ui->comboBox_Direcion, &QComboBox::currentTextChanged, this, &FactorActorWidget::setDirection);
|
||||
connect(ui->spinBox, qOverload<int>(&QSpinBox::valueChanged), this, &FactorActorWidget::setPreCancleTime);
|
||||
ui->setupUi(this);
|
||||
ui->comboBox->setCurrentText(actor_->getFactorDirection() ? "True" : "False");
|
||||
ui->spinBox->setValue(actor_->getPreCancleTime());
|
||||
if(actor_->getFactorActor()) ui->label_FactorActor->setText(actor_->getFactorActor()->getName());
|
||||
connect(ui->pushButton, &QPushButton::clicked, this, &FactorActorWidget::createFactorActor);
|
||||
connect(ui->comboBox_Direcion, &QComboBox::currentTextChanged, this, &FactorActorWidget::setDirection);
|
||||
connect(ui->spinBox, qOverload<int>(&QSpinBox::valueChanged), this, &FactorActorWidget::setPreCancleTime);
|
||||
}
|
||||
|
||||
FactorActorWidget::~FactorActorWidget()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FactorActorWidget::createFactorActor()
|
||||
{
|
||||
ActorSettingsDialog* dialog = nullptr;
|
||||
std::shared_ptr<Actor> actor = nullptr;
|
||||
ActorSettingsDialog* dialog = nullptr;
|
||||
std::shared_ptr<Actor> actor = nullptr;
|
||||
|
||||
if(ui->comboBox->currentText() == "Alarm")
|
||||
{
|
||||
std::shared_ptr<AlarmTime> alarm = std::shared_ptr<AlarmTime>(new AlarmTime);
|
||||
actor = alarm;
|
||||
dialog = new ActorSettingsDialog(alarm, this);
|
||||
}
|
||||
else if(ui->comboBox->currentText() == "Sensor")
|
||||
{
|
||||
std::shared_ptr<SensorActor> sensorActor = std::shared_ptr<SensorActor>(new SensorActor());
|
||||
actor = sensorActor;
|
||||
dialog = new ActorSettingsDialog(sensorActor, this);
|
||||
}
|
||||
else if(ui->comboBox->currentText() == "Timer" )
|
||||
{
|
||||
std::shared_ptr<TimerActor> timerActor = std::shared_ptr<TimerActor>(new TimerActor());
|
||||
actor = timerActor;
|
||||
dialog = new ActorSettingsDialog(timerActor, this);
|
||||
}
|
||||
else if(ui->comboBox->currentText() == "Regulator")
|
||||
{
|
||||
std::shared_ptr<Regulator> regulator = std::shared_ptr<Regulator>(new Regulator());
|
||||
actor = regulator;
|
||||
dialog = new ActorSettingsDialog(regulator, this);
|
||||
}
|
||||
if(ui->comboBox->currentText() == "Alarm")
|
||||
{
|
||||
std::shared_ptr<AlarmTime> alarm = std::shared_ptr<AlarmTime>(new AlarmTime);
|
||||
actor = alarm;
|
||||
dialog = new ActorSettingsDialog(alarm, this);
|
||||
}
|
||||
else if(ui->comboBox->currentText() == "Sensor")
|
||||
{
|
||||
std::shared_ptr<SensorActor> sensorActor = std::shared_ptr<SensorActor>(new SensorActor());
|
||||
actor = sensorActor;
|
||||
dialog = new ActorSettingsDialog(sensorActor, this);
|
||||
}
|
||||
else if(ui->comboBox->currentText() == "Timer" )
|
||||
{
|
||||
std::shared_ptr<TimerActor> timerActor = std::shared_ptr<TimerActor>(new TimerActor());
|
||||
actor = timerActor;
|
||||
dialog = new ActorSettingsDialog(timerActor, this);
|
||||
}
|
||||
else if(ui->comboBox->currentText() == "Regulator")
|
||||
{
|
||||
std::shared_ptr<Regulator> regulator = std::shared_ptr<Regulator>(new Regulator());
|
||||
actor = regulator;
|
||||
dialog = new ActorSettingsDialog(regulator, this);
|
||||
}
|
||||
|
||||
else if(ui->comboBox->currentText() == "Polynomal")
|
||||
{
|
||||
std::shared_ptr<PolynomalActor> polynomalActor = std::shared_ptr<PolynomalActor>(new PolynomalActor());
|
||||
actor = polynomalActor;
|
||||
dialog = new ActorSettingsDialog(polynomalActor, this);
|
||||
}
|
||||
else if(ui->comboBox->currentText() == "Polynomal")
|
||||
{
|
||||
std::shared_ptr<PolynomalActor> polynomalActor = std::shared_ptr<PolynomalActor>(new PolynomalActor());
|
||||
actor = polynomalActor;
|
||||
dialog = new ActorSettingsDialog(polynomalActor, this);
|
||||
}
|
||||
|
||||
|
||||
if(dialog != nullptr)
|
||||
{
|
||||
dialog->setParent(this);
|
||||
dialog->show();
|
||||
if(dialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
actor_->setFactorActor(actor);
|
||||
ui->label_FactorActor->setText(actor->getName());
|
||||
}
|
||||
delete dialog;
|
||||
}
|
||||
if(dialog != nullptr)
|
||||
{
|
||||
dialog->setParent(this);
|
||||
dialog->show();
|
||||
if(dialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
actor_->setFactorActor(actor);
|
||||
ui->label_FactorActor->setText(actor->getName());
|
||||
}
|
||||
delete dialog;
|
||||
}
|
||||
}
|
||||
|
||||
void FactorActorWidget::setDirection(const QString& type)
|
||||
{
|
||||
if(type == "True") actor_->setFactorDirection(true);
|
||||
else actor_->setFactorDirection(false);
|
||||
if(type == "True") actor_->setFactorDirection(true);
|
||||
else actor_->setFactorDirection(false);
|
||||
}
|
||||
|
||||
void FactorActorWidget::setPreCancleTime(int time)
|
||||
{
|
||||
actor_->setPreCancleTime(time);
|
||||
actor_->setPreCancleTime(time);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,27 +4,28 @@
|
|||
#include <QWidget>
|
||||
#include "../../actors/factoractor.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class FactorActorWidget;
|
||||
}
|
||||
|
||||
class FactorActorWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
std::shared_ptr<MultiFactorActor> actor_;
|
||||
std::shared_ptr<MultiFactorActor> actor_;
|
||||
|
||||
public:
|
||||
explicit FactorActorWidget(std::shared_ptr<MultiFactorActor> actor, QWidget *parent = nullptr);
|
||||
~FactorActorWidget();
|
||||
explicit FactorActorWidget(std::shared_ptr<MultiFactorActor> actor, QWidget *parent = nullptr);
|
||||
~FactorActorWidget();
|
||||
|
||||
private slots:
|
||||
void createFactorActor();
|
||||
void setDirection(const QString& direction);
|
||||
void setPreCancleTime(int time);
|
||||
void createFactorActor();
|
||||
void setDirection(const QString& direction);
|
||||
void setPreCancleTime(int time);
|
||||
|
||||
private:
|
||||
Ui::FactorActorWidget *ui;
|
||||
Ui::FactorActorWidget *ui;
|
||||
};
|
||||
|
||||
#endif // FACTORACTORWIDGET_H
|
||||
|
|
|
|||
|
|
@ -1,48 +1,50 @@
|
|||
#include "polynomalactorwidget.h"
|
||||
#include "ui_polynomalactorwidget.h"
|
||||
|
||||
PolynomalActorWidget::PolynomalActorWidget(std::shared_ptr<PolynomalActor> actor, SensorStore* sensors, QWidget *parent):
|
||||
QWidget(parent),
|
||||
sensors_(sensors),
|
||||
actor_(actor),
|
||||
ui(new Ui::PolynomalActorWidget)
|
||||
PolynomalActorWidget::PolynomalActorWidget(std::shared_ptr<PolynomalActor> actor, SensorStore* sensors,
|
||||
QWidget *parent):
|
||||
QWidget(parent),
|
||||
sensors_(sensors),
|
||||
actor_(actor),
|
||||
ui(new Ui::PolynomalActorWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
if(sensors)ui->listView->sensorsChanged(*(sensors->getSensors()));
|
||||
else
|
||||
{
|
||||
ui->listView->hide();
|
||||
ui->label->hide();
|
||||
}
|
||||
ui->setupUi(this);
|
||||
if(sensors)ui->listView->sensorsChanged(*(sensors->getSensors()));
|
||||
else
|
||||
{
|
||||
ui->listView->hide();
|
||||
ui->label->hide();
|
||||
}
|
||||
|
||||
double pow3, pow2, pow1, pow0;
|
||||
double pow3, pow2, pow1, pow0;
|
||||
|
||||
actor_->getCoeffiancts(pow3, pow2, pow1, pow0);
|
||||
actor_->getCoeffiancts(pow3, pow2, pow1, pow0);
|
||||
|
||||
ui->doubleSpinBox_pow0->setValue(pow0);
|
||||
ui->doubleSpinBox_pow1->setValue(pow1);
|
||||
ui->doubleSpinBox_pow2->setValue(pow2);
|
||||
ui->doubleSpinBox_pow3->setValue(pow3);
|
||||
ui->doubleSpinBox_pow0->setValue(pow0);
|
||||
ui->doubleSpinBox_pow1->setValue(pow1);
|
||||
ui->doubleSpinBox_pow2->setValue(pow2);
|
||||
ui->doubleSpinBox_pow3->setValue(pow3);
|
||||
|
||||
connect(ui->doubleSpinBox_pow3, &QDoubleSpinBox::editingFinished, this, &PolynomalActorWidget::setPow);
|
||||
connect(ui->doubleSpinBox_pow2, &QDoubleSpinBox::editingFinished, this, &PolynomalActorWidget::setPow);
|
||||
connect(ui->doubleSpinBox_pow1, &QDoubleSpinBox::editingFinished, this, &PolynomalActorWidget::setPow);
|
||||
connect(ui->doubleSpinBox_pow0, &QDoubleSpinBox::editingFinished, this, &PolynomalActorWidget::setPow);
|
||||
connect(ui->listView, &SensorListWidget::clicked, this, &PolynomalActorWidget::setSensor);
|
||||
connect(ui->doubleSpinBox_pow3, &QDoubleSpinBox::editingFinished, this, &PolynomalActorWidget::setPow);
|
||||
connect(ui->doubleSpinBox_pow2, &QDoubleSpinBox::editingFinished, this, &PolynomalActorWidget::setPow);
|
||||
connect(ui->doubleSpinBox_pow1, &QDoubleSpinBox::editingFinished, this, &PolynomalActorWidget::setPow);
|
||||
connect(ui->doubleSpinBox_pow0, &QDoubleSpinBox::editingFinished, this, &PolynomalActorWidget::setPow);
|
||||
connect(ui->listView, &SensorListWidget::clicked, this, &PolynomalActorWidget::setSensor);
|
||||
|
||||
}
|
||||
|
||||
PolynomalActorWidget::~PolynomalActorWidget()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PolynomalActorWidget::setPow()
|
||||
{
|
||||
actor_->setCoeffiancts(ui->doubleSpinBox_pow3->value(), ui->doubleSpinBox_pow2->value(), ui->doubleSpinBox_pow1->value(), ui->doubleSpinBox_pow0->value());
|
||||
actor_->setCoeffiancts(ui->doubleSpinBox_pow3->value(), ui->doubleSpinBox_pow2->value(),
|
||||
ui->doubleSpinBox_pow1->value(), ui->doubleSpinBox_pow0->value());
|
||||
}
|
||||
|
||||
void PolynomalActorWidget::setSensor(const QModelIndex &index)
|
||||
{
|
||||
actor_->setSensor(sensors_->getSensors()->at(index.row()));
|
||||
actor_->setSensor(sensors_->getSensors()->at(index.row()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,27 +4,29 @@
|
|||
#include <QWidget>
|
||||
#include "../../actors/polynomalactor.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class PolynomalActorWidget;
|
||||
}
|
||||
|
||||
class PolynomalActorWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
SensorStore* sensors_;
|
||||
std::shared_ptr<PolynomalActor> actor_;
|
||||
Q_OBJECT
|
||||
SensorStore* sensors_;
|
||||
std::shared_ptr<PolynomalActor> actor_;
|
||||
|
||||
public:
|
||||
explicit PolynomalActorWidget(std::shared_ptr<PolynomalActor> regulator, SensorStore* sensors = nullptr, QWidget *parent = nullptr);
|
||||
~PolynomalActorWidget();
|
||||
explicit PolynomalActorWidget(std::shared_ptr<PolynomalActor> regulator, SensorStore* sensors = nullptr,
|
||||
QWidget *parent = nullptr);
|
||||
~PolynomalActorWidget();
|
||||
|
||||
private slots:
|
||||
|
||||
void setPow();
|
||||
void setSensor(const QModelIndex &index);
|
||||
void setPow();
|
||||
void setSensor(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
Ui::PolynomalActorWidget *ui;
|
||||
Ui::PolynomalActorWidget *ui;
|
||||
};
|
||||
|
||||
#endif // POLYNOMALACTORWIDGET_H
|
||||
|
|
|
|||
|
|
@ -4,45 +4,45 @@
|
|||
|
||||
RegulatorWdiget::~RegulatorWdiget()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
|
||||
RegulatorWdiget::RegulatorWdiget(std::shared_ptr<Regulator> regulator, SensorStore* sensors, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
regulator_(regulator),
|
||||
sensors_(sensors),
|
||||
ui(new Ui::RegulatorWdiget)
|
||||
QWidget(parent),
|
||||
regulator_(regulator),
|
||||
sensors_(sensors),
|
||||
ui(new Ui::RegulatorWdiget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
if(sensors)ui->listView->sensorsChanged(*(sensors->getSensors()));
|
||||
else
|
||||
{
|
||||
ui->listView->hide();
|
||||
ui->label->hide();
|
||||
}
|
||||
ui->doubleSpinBox_setPoint->setValue(regulator->getSetPoint());
|
||||
ui->doubleSpinBox_band->setValue(regulator->getBand());
|
||||
ui->setupUi(this);
|
||||
if(sensors)ui->listView->sensorsChanged(*(sensors->getSensors()));
|
||||
else
|
||||
{
|
||||
ui->listView->hide();
|
||||
ui->label->hide();
|
||||
}
|
||||
ui->doubleSpinBox_setPoint->setValue(regulator->getSetPoint());
|
||||
ui->doubleSpinBox_band->setValue(regulator->getBand());
|
||||
|
||||
connect(ui->listView, &SensorListWidget::clicked, this, &RegulatorWdiget::setSensor);
|
||||
connect(ui->doubleSpinBox_setPoint, SIGNAL(valueChanged(double)), this, SLOT(setPoint(double)));
|
||||
connect(ui->doubleSpinBox_band, SIGNAL(valueChanged(double)), this, SLOT(setBand(double)));
|
||||
connect(ui->listView, &SensorListWidget::clicked, this, &RegulatorWdiget::setSensor);
|
||||
connect(ui->doubleSpinBox_setPoint, SIGNAL(valueChanged(double)), this, SLOT(setPoint(double)));
|
||||
connect(ui->doubleSpinBox_band, SIGNAL(valueChanged(double)), this, SLOT(setBand(double)));
|
||||
}
|
||||
|
||||
void RegulatorWdiget::setPoint(double in)
|
||||
{
|
||||
regulator_->setPoint(in);
|
||||
regulator_->setPoint(in);
|
||||
}
|
||||
|
||||
void RegulatorWdiget::setBand(double band)
|
||||
{
|
||||
regulator_->setBand(band);
|
||||
regulator_->setBand(band);
|
||||
}
|
||||
|
||||
void RegulatorWdiget::setSensor(const QModelIndex &index)
|
||||
{
|
||||
regulator_->setSensor(sensors_->getSensors()->at(index.row()));
|
||||
setPoint(sensors_->getSensors()->at(index.row()).field);
|
||||
ui->doubleSpinBox_setPoint->setValue(sensors_->getSensors()->at(index.row()).field);
|
||||
regulator_->setSensor(sensors_->getSensors()->at(index.row()));
|
||||
setPoint(sensors_->getSensors()->at(index.row()).field);
|
||||
ui->doubleSpinBox_setPoint->setValue(sensors_->getSensors()->at(index.row()).field);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,29 +4,31 @@
|
|||
#include <QWidget>
|
||||
#include "../../actors/regulator.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class RegulatorWdiget;
|
||||
}
|
||||
|
||||
class RegulatorWdiget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
std::shared_ptr<Regulator> regulator_;
|
||||
SensorStore* sensors_;
|
||||
std::shared_ptr<Regulator> regulator_;
|
||||
SensorStore* sensors_;
|
||||
|
||||
public:
|
||||
explicit RegulatorWdiget(std::shared_ptr<Regulator> regulator, SensorStore* sensors = nullptr, QWidget *parent = nullptr);
|
||||
~RegulatorWdiget();
|
||||
explicit RegulatorWdiget(std::shared_ptr<Regulator> regulator, SensorStore* sensors = nullptr,
|
||||
QWidget *parent = nullptr);
|
||||
~RegulatorWdiget();
|
||||
|
||||
private slots:
|
||||
|
||||
void setPoint(double in);
|
||||
void setBand(double band);
|
||||
void setSensor(const QModelIndex &index);
|
||||
void setPoint(double in);
|
||||
void setBand(double band);
|
||||
void setSensor(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
Ui::RegulatorWdiget *ui;
|
||||
Ui::RegulatorWdiget *ui;
|
||||
};
|
||||
|
||||
#endif // REGULATORWDIGET_H
|
||||
|
|
|
|||
|
|
@ -4,49 +4,49 @@
|
|||
#include <QDebug>
|
||||
|
||||
SensorActorWidget::SensorActorWidget(std::shared_ptr<SensorActor> sensorActor, SensorStore* sensors, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
sensorActor_(sensorActor),
|
||||
sensors_(sensors),
|
||||
ui(new Ui::SensorActorWidget)
|
||||
QWidget(parent),
|
||||
sensorActor_(sensorActor),
|
||||
sensors_(sensors),
|
||||
ui(new Ui::SensorActorWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
if(sensors)ui->listView->sensorsChanged(*(sensors->getSensors()));
|
||||
else
|
||||
{
|
||||
ui->listView->hide();
|
||||
ui->label->hide();
|
||||
}
|
||||
ui->setupUi(this);
|
||||
if(sensors)ui->listView->sensorsChanged(*(sensors->getSensors()));
|
||||
else
|
||||
{
|
||||
ui->listView->hide();
|
||||
ui->label->hide();
|
||||
}
|
||||
|
||||
if(sensorActor_->getSloap() == SensorActor::SLOPE_UP) ui->comboBox_slope->setCurrentIndex(0);
|
||||
else if(sensorActor_->getSloap() == SensorActor::SLOPE_DOWN) ui->comboBox_slope->setCurrentIndex(1);
|
||||
else if(sensorActor_->getSloap() == SensorActor::SLOPE_BOTH) ui->comboBox_slope->setCurrentIndex(2);
|
||||
if(sensorActor_->getSloap() == SensorActor::SLOPE_UP) ui->comboBox_slope->setCurrentIndex(0);
|
||||
else if(sensorActor_->getSloap() == SensorActor::SLOPE_DOWN) ui->comboBox_slope->setCurrentIndex(1);
|
||||
else if(sensorActor_->getSloap() == SensorActor::SLOPE_BOTH) ui->comboBox_slope->setCurrentIndex(2);
|
||||
|
||||
ui->doubleSpinBox_threshold->setValue(sensorActor_->getThreshold());
|
||||
ui->doubleSpinBox_threshold->setValue(sensorActor_->getThreshold());
|
||||
|
||||
connect(ui->listView, &SensorListWidget::clicked, this, &SensorActorWidget::setSensor);
|
||||
connect(ui->doubleSpinBox_threshold, SIGNAL(valueChanged(double)), this, SLOT(setThreshold(double)));
|
||||
connect(ui->comboBox_slope, SIGNAL(currentIndexChanged(int)), this, SLOT(setSlope(int)));
|
||||
connect(ui->listView, &SensorListWidget::clicked, this, &SensorActorWidget::setSensor);
|
||||
connect(ui->doubleSpinBox_threshold, SIGNAL(valueChanged(double)), this, SLOT(setThreshold(double)));
|
||||
connect(ui->comboBox_slope, SIGNAL(currentIndexChanged(int)), this, SLOT(setSlope(int)));
|
||||
}
|
||||
|
||||
SensorActorWidget::~SensorActorWidget()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SensorActorWidget::setThreshold(double in)
|
||||
{
|
||||
sensorActor_->setThreshold(in);
|
||||
sensorActor_->setThreshold(in);
|
||||
}
|
||||
|
||||
void SensorActorWidget::setSlope(int index)
|
||||
{
|
||||
if(index == 0) sensorActor_->setSloap(SensorActor::SLOPE_UP);
|
||||
else if(index == 1) sensorActor_->setSloap(SensorActor::SLOPE_DOWN);
|
||||
else if(index == 2) sensorActor_->setSloap(SensorActor::SLOPE_BOTH);
|
||||
if(index == 0) sensorActor_->setSloap(SensorActor::SLOPE_UP);
|
||||
else if(index == 1) sensorActor_->setSloap(SensorActor::SLOPE_DOWN);
|
||||
else if(index == 2) sensorActor_->setSloap(SensorActor::SLOPE_BOTH);
|
||||
}
|
||||
|
||||
void SensorActorWidget::setSensor(const QModelIndex &index)
|
||||
{
|
||||
sensorActor_->setSensor(sensors_->getSensors()->at(index.row()));
|
||||
qDebug()<<"Selected "<<sensors_->getSensors()->at(index.row()).name;
|
||||
sensorActor_->setSensor(sensors_->getSensors()->at(index.row()));
|
||||
qDebug()<<"Selected "<<sensors_->getSensors()->at(index.row()).name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,29 +5,31 @@
|
|||
#include <QItemSelection>
|
||||
#include "../../actors/sensoractor.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class SensorActorWidget;
|
||||
}
|
||||
|
||||
class SensorActorWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
std::shared_ptr<SensorActor> sensorActor_;
|
||||
SensorStore* sensors_;
|
||||
std::shared_ptr<SensorActor> sensorActor_;
|
||||
SensorStore* sensors_;
|
||||
|
||||
public:
|
||||
explicit SensorActorWidget(std::shared_ptr<SensorActor> sensorActor, SensorStore* sensors = nullptr, QWidget *parent = nullptr);
|
||||
~SensorActorWidget();
|
||||
explicit SensorActorWidget(std::shared_ptr<SensorActor> sensorActor, SensorStore* sensors = nullptr,
|
||||
QWidget *parent = nullptr);
|
||||
~SensorActorWidget();
|
||||
|
||||
private slots:
|
||||
|
||||
void setThreshold(double in);
|
||||
void setSlope(int index);
|
||||
void setSensor(const QModelIndex &index);
|
||||
void setThreshold(double in);
|
||||
void setSlope(int index);
|
||||
void setSensor(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
Ui::SensorActorWidget *ui;
|
||||
Ui::SensorActorWidget *ui;
|
||||
};
|
||||
|
||||
#endif // SENSORACTORWIDGET_H
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@
|
|||
#include <QSpinBox>
|
||||
|
||||
TimerActorWidget::TimerActorWidget(std::shared_ptr<TimerActor> actor, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::TimerActorWidget)
|
||||
QWidget(parent),
|
||||
ui(new Ui::TimerActorWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->spinBox->setValue(actor->getTimeout());
|
||||
ui->spinBox->setValue(actor->getTimeout());
|
||||
|
||||
connect(ui->spinBox, SIGNAL(valueChanged(int)), actor.get(), SLOT(setTimeout(int)));
|
||||
connect(ui->spinBox, SIGNAL(valueChanged(int)), actor.get(), SLOT(setTimeout(int)));
|
||||
}
|
||||
|
||||
TimerActorWidget::~TimerActorWidget()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,20 +4,21 @@
|
|||
#include <QWidget>
|
||||
#include "../../actors/timeractor.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class TimerActorWidget;
|
||||
}
|
||||
|
||||
class TimerActorWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TimerActorWidget(std::shared_ptr<TimerActor> actor, QWidget *parent = nullptr);
|
||||
~TimerActorWidget();
|
||||
explicit TimerActorWidget(std::shared_ptr<TimerActor> actor, QWidget *parent = nullptr);
|
||||
~TimerActorWidget();
|
||||
|
||||
private:
|
||||
Ui::TimerActorWidget *ui;
|
||||
Ui::TimerActorWidget *ui;
|
||||
};
|
||||
|
||||
#endif // TIMERACTORWIDGET_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue