Sensors now work over broadcast pipe
Added Polynomal actor Added Item adding dialog Added Factor Actor
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
#include "../actors/sensoractor.h"
|
||||
#include "../actors/timeractor.h"
|
||||
#include "../actors/regulator.h"
|
||||
#include "../actors/factoractor.h"
|
||||
|
||||
#include<memory>
|
||||
|
||||
@ -31,21 +32,17 @@ ItemSettingsDialog::ItemSettingsDialog(Item* item, QWidget *parent) :
|
||||
ui->label_address_lable->hide();
|
||||
ui->label_id_lable->hide();
|
||||
}
|
||||
ui->checkBox_auto->setChecked(item_->actorsActive());
|
||||
|
||||
connect(ui->checkBox_auto, &QCheckBox::toggled, item_, &Relay::setActorsActive);
|
||||
connect(ui->pushButton_add, &QPushButton::clicked, this, &ItemSettingsDialog::addActor);
|
||||
connect(ui->pushButton_remove, &QPushButton::clicked, this, &ItemSettingsDialog::removeActor);
|
||||
connect(ui->pushButton_edit, &QPushButton::clicked, this, &ItemSettingsDialog::editActor);
|
||||
|
||||
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Actor"));
|
||||
ui->tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("Action"));
|
||||
ui->tableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem("Acts on"));
|
||||
ui->tableWidget->setHorizontalHeaderItem(3, new QTableWidgetItem("Enabled"));
|
||||
ui->tableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem("Enabled"));
|
||||
ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
ui->tableWidget->horizontalHeader()->resizeSection(1, 60);
|
||||
ui->tableWidget->horizontalHeader()->resizeSection(2, 60);
|
||||
ui->tableWidget->horizontalHeader()->resizeSection(3, 75);
|
||||
ui->tableWidget->horizontalHeader()->resizeSection(2, 75);
|
||||
loadActorList();
|
||||
}
|
||||
|
||||
@ -63,8 +60,7 @@ void ItemSettingsDialog::loadActorList()
|
||||
{
|
||||
ui->tableWidget->setItem(i, 0, new QTableWidgetItem(item_->getActors()[i]->getName()));
|
||||
ui->tableWidget->setItem(i, 1, new QTableWidgetItem(item_->getActors()[i]->actionName()));
|
||||
ui->tableWidget->setItem(i, 2, new QTableWidgetItem("Item"));
|
||||
ui->tableWidget->setItem(i, 3, new QTableWidgetItem(item_->getActors()[i]->isActive() ? "Y" : "N"));
|
||||
ui->tableWidget->setItem(i, 2, new QTableWidgetItem(item_->getActors()[i]->isActive() ? "Y" : "N"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,11 +75,11 @@ void ItemSettingsDialog::addActor()
|
||||
actor = alarm;
|
||||
dialog = new ActorSettingsDialog(alarm, this);
|
||||
}
|
||||
else if(ui->comboBox->currentText() == "Sensor" && item_->getSensorStore() != nullptr)
|
||||
else if(ui->comboBox->currentText() == "Sensor")
|
||||
{
|
||||
SensorActor* sensorActor = new SensorActor();
|
||||
actor = sensorActor;
|
||||
dialog = new ActorSettingsDialog(sensorActor, item_->getSensorStore(), this);
|
||||
dialog = new ActorSettingsDialog(sensorActor, this);
|
||||
}
|
||||
else if(ui->comboBox->currentText() == "Timer" )
|
||||
{
|
||||
@ -91,11 +87,25 @@ void ItemSettingsDialog::addActor()
|
||||
actor = timerActor;
|
||||
dialog = new ActorSettingsDialog(timerActor, this);
|
||||
}
|
||||
else if(ui->comboBox->currentText() == "Regulator" && item_->getSensorStore() != nullptr)
|
||||
else if(ui->comboBox->currentText() == "Regulator")
|
||||
{
|
||||
Regulator* regulator = new Regulator();
|
||||
actor = regulator;
|
||||
dialog = new ActorSettingsDialog(regulator, item_->getSensorStore(), this);
|
||||
dialog = new ActorSettingsDialog(regulator, this);
|
||||
}
|
||||
|
||||
else if(ui->comboBox->currentText() == "Polynomal")
|
||||
{
|
||||
PolynomalActor* polynomalActor = new PolynomalActor();
|
||||
actor = polynomalActor;
|
||||
dialog = new ActorSettingsDialog(polynomalActor, this);
|
||||
}
|
||||
|
||||
else if(ui->comboBox->currentText() == "Multi Factor")
|
||||
{
|
||||
MultiFactorActor* polynomalActor = new MultiFactorActor();
|
||||
actor = polynomalActor;
|
||||
dialog = new ActorSettingsDialog(polynomalActor, this);
|
||||
}
|
||||
|
||||
|
||||
@ -133,13 +143,17 @@ void ItemSettingsDialog::editActor()
|
||||
Regulator* regulator = dynamic_cast<Regulator*>(actor);
|
||||
SensorActor* sensorActor = dynamic_cast<SensorActor*>(actor);
|
||||
TimerActor* timerActor = dynamic_cast<TimerActor*>(actor);
|
||||
PolynomalActor* polynomalActor = dynamic_cast<PolynomalActor*>(actor);
|
||||
MultiFactorActor* factorActor = dynamic_cast<MultiFactorActor*>(actor);
|
||||
|
||||
ActorSettingsDialog* dialog;
|
||||
|
||||
if(alarmTime) dialog = new ActorSettingsDialog(alarmTime, this);
|
||||
else if(regulator) dialog = new ActorSettingsDialog(regulator, nullptr, this);
|
||||
else if(sensorActor) dialog = new ActorSettingsDialog(sensorActor, nullptr, this);
|
||||
else if(regulator) dialog = new ActorSettingsDialog(regulator, this);
|
||||
else if(sensorActor) dialog = new ActorSettingsDialog(sensorActor, this);
|
||||
else if(timerActor) dialog = new ActorSettingsDialog(timerActor, this);
|
||||
else if(polynomalActor) dialog = new ActorSettingsDialog(polynomalActor, this);
|
||||
else if(factorActor) dialog = new ActorSettingsDialog(factorActor, this);
|
||||
else dialog = new ActorSettingsDialog(actor, this);
|
||||
dialog->setParent(this);
|
||||
dialog->show();
|
||||
@ -149,7 +163,7 @@ void ItemSettingsDialog::editActor()
|
||||
{
|
||||
ui->tableWidget->item(i, 0)->setText(item_->getActors()[i]->getName());
|
||||
ui->tableWidget->item(i, 1)->setText(item_->getActors()[i]->actionName());
|
||||
ui->tableWidget->item(i, 3)->setText(item_->getActors()[i]->isActive() ? "Y" : "N");
|
||||
ui->tableWidget->item(i, 2)->setText(item_->getActors()[i]->isActive() ? "Y" : "N");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user