Add the ability to enable and disable actors from the ui
add safe and timeout to the regulator actor
This commit is contained in:
parent
d8471789b7
commit
271330d5fd
7 changed files with 176 additions and 20 deletions
|
|
@ -83,14 +83,20 @@ void ActorSettingsDialog::init()
|
|||
connect(ui->comboBox_action, SIGNAL(currentIndexChanged(int)), this, SLOT(changeAction(int)));
|
||||
connect(ui->spinBox, SIGNAL(valueChanged(int)), this, SLOT(valueChanged(int)));
|
||||
connect(ui->pushButton_editItem, &QPushButton::clicked, this, &ActorSettingsDialog::editAsItem);
|
||||
connect(ui->pushButton_enable, &QPushButton::clicked, this, &ActorSettingsDialog::setEnabled);
|
||||
ui->spinBox->hide();
|
||||
|
||||
ui->spinBox->setValue(actor_->getTriggerValue());
|
||||
if(actor_->getTriggerValue() == 0) ui->comboBox_action->setCurrentIndex(0);
|
||||
else if(actor_->getTriggerValue() == 1) ui->comboBox_action->setCurrentIndex(1);
|
||||
else ui->comboBox_action->setCurrentIndex(2);
|
||||
if(actor_->getTriggerValue() == 0)
|
||||
ui->comboBox_action->setCurrentIndex(0);
|
||||
else if(actor_->getTriggerValue() == 1)
|
||||
ui->comboBox_action->setCurrentIndex(1);
|
||||
else
|
||||
ui->comboBox_action->setCurrentIndex(2);
|
||||
|
||||
ui->label_Exausted->setText(actor_->isExausted() ? "True" : "False");
|
||||
ui->label_Enabled->setText(actor_->isActive() ? "True" : "False");
|
||||
ui->pushButton_enable->setText(actor_->isActive() ? "Disable" : "Enable");
|
||||
}
|
||||
|
||||
ActorSettingsDialog::~ActorSettingsDialog()
|
||||
|
|
@ -104,6 +110,13 @@ void ActorSettingsDialog::editAsItem()
|
|||
itemSettingsDiag.exec();
|
||||
}
|
||||
|
||||
void ActorSettingsDialog::setEnabled()
|
||||
{
|
||||
actor_->setActive(!actor_->isActive());
|
||||
ui->label_Enabled->setText(actor_->isActive() ? "True" : "False");
|
||||
ui->pushButton_enable->setText(actor_->isActive() ? "Disable" : "Enable");
|
||||
}
|
||||
|
||||
void ActorSettingsDialog::valueChanged(int value)
|
||||
{
|
||||
actor_->setTriggerValue(value);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ private slots:
|
|||
void changeAction(int index);
|
||||
void valueChanged(int value);
|
||||
void editAsItem();
|
||||
void setEnabled();
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -85,6 +85,63 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Enabled:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Enabled">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>True</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_enable">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
|||
|
|
@ -24,12 +24,17 @@ RegulatorWdiget::RegulatorWdiget(std::shared_ptr<Regulator> regulator, SensorSto
|
|||
}
|
||||
ui->doubleSpinBox_setPoint->setValue(regulator->getSetPoint());
|
||||
ui->doubleSpinBox_band->setValue(regulator->getBand());
|
||||
ui->spinBox_safe->setValue(regulator_->getSafeValue());
|
||||
ui->spinBox_timeout->setValue(regulator_->getTimeout());
|
||||
|
||||
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->spinBox_safe, SIGNAL(valueChanged(int)), regulator_.get(), SLOT(setSafeValue(int)));
|
||||
connect(ui->spinBox_timeout, SIGNAL(valueChanged(int)), regulator_.get(), SLOT(setTimeout(int)));
|
||||
}
|
||||
|
||||
|
||||
void RegulatorWdiget::setPoint(double in)
|
||||
{
|
||||
regulator_->setPoint(in);
|
||||
|
|
|
|||
|
|
@ -38,15 +38,8 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Set Point</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_setPoint">
|
||||
<property name="minimum">
|
||||
<double>-9999.989999999999782</double>
|
||||
|
|
@ -56,7 +49,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
|
|
@ -69,9 +62,46 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Timeout</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Set Point</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_band"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Safety Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_safe"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QSpinBox" name="spinBox_timeout">
|
||||
<property name="suffix">
|
||||
<string> s</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1800</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue