src/EditEquipment.cpp

changeset 419
d49f38cc76a0
parent 385
09af9f46518f
child 423
8cb46020796a
--- a/src/EditEquipment.cpp	Fri Oct 21 17:01:20 2022 +0200
+++ b/src/EditEquipment.cpp	Mon Oct 24 15:25:50 2022 +0200
@@ -14,9 +14,10 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+#include "MainWindow.h"
 #include "EditEquipment.h"
 #include "../ui/ui_EditEquipment.h"
-#include "MainWindow.h"
+#include "global.h"
 
 
 EditEquipment::EditEquipment(int id, QWidget *parent) : QDialog(parent), ui(new Ui::EditEquipment)
@@ -28,11 +29,12 @@
     this->recno = id;
 
     WindowTitle();
-    
-    ui->tun_materialEdit->addItem(tr("Stainless Steel"));
-    ui->tun_materialEdit->addItem(tr("Aluminium"));
-    ui->tun_materialEdit->addItem(tr("Plastics"));
-    ui->tun_materialEdit->addItem(tr("Copper"));
+
+    for (int i = 0; i < 4; i++)
+	ui->tun_materialEdit->addItem(QCoreApplication::translate("TunMaterial", g_tun_materials[i]));
+
+    for (int i = 0; i < 5; i++)
+        ui->chiller_typeEdit->addItem(QCoreApplication::translate("ChillerType", g_chiller_types[i]));
 
     if (id >= 0) {
 	query.prepare("SELECT * FROM inventory_equipments WHERE record = :recno");
@@ -40,36 +42,38 @@
 	query.exec();
 	query.next();
 
-	ui->nameEdit->setText(query.value(1).toString());
-	ui->boil_sizeEdit->setValue(query.value(2).toDouble());
-	ui->batch_sizeEdit->setValue(query.value(3).toDouble());
-	ui->tun_volumeEdit->setValue(query.value(4).toDouble());
-	ui->tun_weightEdit->setValue(query.value(5).toDouble());
-	ui->tun_specific_heatEdit->setValue(query.value(6).toDouble());
-	ui->tun_materialEdit->setCurrentIndex(query.value(7).toInt());
-	ui->tun_heightEdit->setValue(query.value(8).toDouble() * 100.0);
-	ui->top_up_waterEdit->setValue(query.value(9).toDouble());
-	ui->chiller_lossEdit->setValue(query.value(10).toDouble());
-	ui->evap_rateEdit->setValue(query.value(11).toDouble());
-	ui->boil_timeEdit->setValue(query.value(12).toDouble());
-	ui->calcboilEdit->setChecked(query.value(13).toInt() ? true:false);
-	ui->top_up_kettleEdit->setValue(query.value(14).toDouble());
-	ui->hopfactorEdit->setValue(query.value(15).toDouble());
-	ui->notesEdit->setPlainText(query.value(16).toString());
-	ui->lauter_volumeEdit->setValue(query.value(17).toDouble());
-	ui->lauter_heightEdit->setValue(query.value(18).toDouble() * 100.0);
-	ui->lauter_deadspaceEdit->setValue(query.value(19).toDouble());
-	ui->kettle_volumeEdit->setValue(query.value(20).toDouble());
-	ui->kettle_heightEdit->setValue(query.value(21).toDouble() * 100.0);
-	ui->mash_volumeEdit->setValue(query.value(22).toDouble());
-	ui->mash_maxEdit->setValue(query.value(23).toDouble());
-	ui->efficiencyEdit->setValue(query.value(24).toDouble());
+	ui->nameEdit->setText(query.value("name").toString());
+	ui->boil_sizeEdit->setValue(query.value("boil_size").toDouble());
+	ui->batch_sizeEdit->setValue(query.value("batch_size").toDouble());
+	ui->tun_volumeEdit->setValue(query.value("tun_volume").toDouble());
+	ui->tun_weightEdit->setValue(query.value("tun_weight").toDouble());
+	ui->tun_specific_heatEdit->setValue(query.value("tun_specific_heat").toDouble());
+	ui->tun_materialEdit->setCurrentIndex(query.value("tun_material").toInt());
+	ui->tun_heightEdit->setValue(query.value("tun_height").toDouble() * 100.0);
+	ui->top_up_waterEdit->setValue(query.value("top_up_water").toDouble());
+	ui->trub_lossEdit->setValue(query.value("trub_chiller_loss").toDouble());
+	ui->evap_rateEdit->setValue(query.value("evap_rate").toDouble());
+	ui->boil_timeEdit->setValue(query.value("boil_time").toDouble());
+	ui->calcboilEdit->setChecked(query.value("calc_boil_volume").toInt() ? true:false);
+	ui->top_up_kettleEdit->setValue(query.value("top_up_kettle").toDouble());
+	ui->notesEdit->setPlainText(query.value("notes").toString());
+	ui->lauter_deadspaceEdit->setValue(query.value("lauter_deadspace").toDouble());
+	ui->kettle_volumeEdit->setValue(query.value("kettle_volume").toDouble());
+	ui->kettle_heightEdit->setValue(query.value("kettle_height").toDouble() * 100.0);
+	ui->mash_volumeEdit->setValue(query.value("mash_volume").toDouble());
+	ui->mash_maxEdit->setValue(query.value("mash_max").toDouble());
+	ui->efficiencyEdit->setValue(query.value("efficiency").toDouble());
+	ui->chiller_typeEdit->setCurrentIndex(query.value("chiller_type").toInt());
+	ui->chiller_to79Edit->setValue(query.value("chiller_to79").toDouble());
+	ui->chiller_lossEdit->setValue(query.value("chiller_loss").toDouble());
+        ui->chiller_volumeEdit->setValue(query.value("chiller_volume").toDouble());
+	ui->chiller_lpmEdit->setValue(query.value("chiller_lpm").toDouble());
 	/*
 	 * Now we have loaded this record, check if this equipment is
 	 * being used by a product. If so, make the name field read-only.
 	 */
 	query2.prepare("SELECT eq_name FROM products WHERE eq_name=:name");
-	query2.bindValue(":name", query.value(1).toString());
+	query2.bindValue(":name", query.value("name").toString());
 	query2.exec();
 	inuse = query2.size();
 	ui->nameEdit->setReadOnly(inuse > 0);
@@ -83,22 +87,28 @@
 	ui->tun_materialEdit->setCurrentIndex(0);
 	ui->tun_heightEdit->setValue(20);
 	ui->top_up_waterEdit->setValue(0);
-	ui->chiller_lossEdit->setValue(0.5);
+	ui->trub_lossEdit->setValue(0.5);
 	ui->evap_rateEdit->setValue(1.8);
 	ui->boil_timeEdit->setValue(90);
 	ui->calcboilEdit->setChecked(true);
 	ui->top_up_kettleEdit->setValue(0);
-	ui->hopfactorEdit->setValue(100);
-	ui->lauter_volumeEdit->setValue(20);
-	ui->lauter_heightEdit->setValue(20);
 	ui->lauter_deadspaceEdit->setValue(0.5);
 	ui->kettle_volumeEdit->setValue(20);
 	ui->kettle_heightEdit->setValue(20);
 	ui->mash_volumeEdit->setValue(18);
 	ui->mash_maxEdit->setValue(6);
 	ui->efficiencyEdit->setValue(75);
+	ui->chiller_typeEdit->setCurrentIndex(1);
+	ui->chiller_to79Edit->setValue(10);
+	ui->chiller_lossEdit->setValue(0);
+	ui->chiller_volumeEdit->setValue(0.5);
+	ui->chiller_lpmEdit->setValue(0);
 	inuse = 0;
     }
+    /* Block select no chiller used */
+    qobject_cast<QStandardItemModel*>(ui->chiller_typeEdit->model())->item(CHILLER_TYPE_NONE)->setEnabled(false);
+    chiller_setup(ui->chiller_typeEdit->currentIndex());
+
     connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditEquipment::is_changed);
     connect(ui->boil_sizeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->batch_sizeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
@@ -107,21 +117,23 @@
     connect(ui->tun_materialEdit, &QComboBox::currentTextChanged, this, &EditEquipment::material_changed);   
     connect(ui->tun_heightEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->top_up_waterEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
-    connect(ui->chiller_lossEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
+    connect(ui->trub_lossEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->evap_rateEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->boil_timeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->calcboilEdit, &QCheckBox::stateChanged, this, &EditEquipment::is_changed);
     connect(ui->top_up_kettleEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
-    connect(ui->hopfactorEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed()));
-    connect(ui->lauter_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
-    connect(ui->lauter_heightEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->lauter_deadspaceEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->kettle_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->kettle_heightEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->mash_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->mash_maxEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
     connect(ui->efficiencyEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
+    connect(ui->chiller_typeEdit, &QComboBox::currentTextChanged, this, &EditEquipment::chiller_changed);
+    connect(ui->chiller_to79Edit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
+    connect(ui->chiller_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
+    connect(ui->chiller_lpmEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
+    connect(ui->chiller_lossEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
 
     calcBatchVolume();
     ui->saveButton->setEnabled(false);
@@ -159,6 +171,7 @@
 void EditEquipment::on_saveButton_clicked()
 {
     QSqlQuery query;
+    QString sql = "";
 
     /* If there are errors in the form, show a message and do "return;" */
     if (ui->nameEdit->text().length() < 2) {
@@ -167,27 +180,26 @@
     }
 
     if (this->textIsChanged) {
-    	if (this->recno == -1) {
-    	    query.prepare("INSERT INTO inventory_equipments SET name=:name, boil_size=:boil_size, "
+	if (this->recno == -1) {
+	    sql = "INSERT INTO";
+	} else {
+	    sql = "UPDATE";
+	}
+	sql.append(" inventory_equipments SET name=:name, boil_size=:boil_size, "
 		"batch_size=:batch_size, tun_volume=:tun_volume, tun_weight=:tun_weight, "
 		"tun_specific_heat=:tun_specific_heat, tun_material=:tun_material, tun_height=:tun_height, "
-		"top_up_water=:top_up_water, trub_chiller_loss=:chiller_loss, evap_rate=:evap_rate, "
+		"top_up_water=:top_up_water, trub_chiller_loss=:trub_loss, evap_rate=:evap_rate, "
 		"boil_time=:boil_time, calc_boil_volume=:calcboil, top_up_kettle=:top_up_kettle, "
-		"hop_utilization=:hopfactor, notes=:notes, lauter_volume=:lauter_volume, "
-		"lauter_height=:lauter_height, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, "
+		"notes=:notes, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, "
 		"kettle_height=:kettle_height, mash_volume=:mash_volume, mash_max=:mash_max, "
-		"efficiency=:efficiency, uuid=:uuid");
-    	} else {
-	    query.prepare("UPDATE inventory_equipments SET name=:name, boil_size=:boil_size, "
-		"batch_size=:batch_size, tun_volume=:tun_volume, tun_weight=:tun_weight, "
-                "tun_specific_heat=:tun_specific_heat, tun_material=:tun_material, tun_height=:tun_height, "
-                "top_up_water=:top_up_water, trub_chiller_loss=:chiller_loss, evap_rate=:evap_rate, "
-                "boil_time=:boil_time, calc_boil_volume=:calcboil, top_up_kettle=:top_up_kettle, "
-                "hop_utilization=:hopfactor, notes=:notes, lauter_volume=:lauter_volume, "
-                "lauter_height=:lauter_height, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, "
-		"kettle_height=:kettle_height, mash_volume=:mash_volume, mash_max=:mash_max, "
-                "efficiency=:efficiency WHERE record=:recno");
-    	}
+		"efficiency=:efficiency, chiller_type=:chiller_type, chiller_to79=:chiller_to79, "
+		"chiller_volume=:chiller_volume, chiller_lpm=:chiller_lpm, chiller_loss=:chiller_loss");
+	if (this->recno == -1) {
+	    sql.append(", uuid=:uuid");
+	} else {
+	    sql.append(" WHERE record = :recno");
+	}
+	query.prepare(sql);
 	query.bindValue(":name", ui->nameEdit->text());
 	query.bindValue(":boil_size", QString("%1").arg(ui->boil_sizeEdit->value(), 2, 'f', 1, '0'));
 	query.bindValue(":batch_size", QString("%1").arg(ui->batch_sizeEdit->value(), 3, 'f', 2, '0'));
@@ -197,21 +209,24 @@
 	query.bindValue(":tun_material", ui->tun_materialEdit->currentIndex());
 	query.bindValue(":tun_height", QString("%1").arg(ui->tun_heightEdit->value() / 100, 4, 'f', 3, '0'));
 	query.bindValue(":top_up_water", QString("%1").arg(ui->top_up_waterEdit->value(), 2, 'f', 1, '0'));
-	query.bindValue(":chiller_loss", QString("%1").arg(ui->chiller_lossEdit->value(), 2, 'f', 1, '0'));
+	query.bindValue(":trub_loss", QString("%1").arg(ui->trub_lossEdit->value(), 2, 'f', 1, '0'));
 	query.bindValue(":evap_rate", QString("%1").arg(ui->evap_rateEdit->value(), 3, 'f', 2, '0'));
 	query.bindValue(":boil_time", QString("%1").arg(ui->boil_timeEdit->value(), 1, 'f', 0, '0'));
 	query.bindValue(":calcboil", ui->calcboilEdit->isChecked() ? 1:0);
 	query.bindValue(":top_up_kettle", QString("%1").arg(ui->top_up_kettleEdit->value(), 2, 'f', 1, '0'));
-	query.bindValue(":hopfactor", QString("%1").arg(ui->hopfactorEdit->value(), 1, 'f', 0, '0'));
 	query.bindValue(":notes", ui->notesEdit->toPlainText());
-	query.bindValue(":lauter_volume", QString("%1").arg(ui->lauter_volumeEdit->value(), 2, 'f', 1, '0'));
-	query.bindValue(":lauter_height", QString("%1").arg(ui->lauter_heightEdit->value() / 100, 4, 'f', 3, '0'));
 	query.bindValue(":lauter_deadspace", QString("%1").arg(ui->lauter_deadspaceEdit->value(), 2, 'f', 1, '0'));
 	query.bindValue(":kettle_volume", QString("%1").arg(ui->kettle_volumeEdit->value(), 2, 'f', 1, '0'));
 	query.bindValue(":kettle_height", QString("%1").arg(ui->kettle_heightEdit->value() / 100, 4, 'f', 3, '0'));
 	query.bindValue(":mash_volume", QString("%1").arg(ui->mash_volumeEdit->value(), 2, 'f', 1, '0'));
 	query.bindValue(":mash_max", QString("%1").arg(ui->mash_maxEdit->value(), 2, 'f', 1, '0'));
 	query.bindValue(":efficiency", QString("%1").arg(ui->efficiencyEdit->value(), 2, 'f', 1, '0'));
+	query.bindValue(":chiller_type", ui->chiller_typeEdit->currentIndex());
+	query.bindValue(":chiller_to79", QString("%1").arg(ui->chiller_to79Edit->value(), 1, 'f', 0, '0'));
+	query.bindValue(":chiller_volume", QString("%1").arg(ui->chiller_volumeEdit->value(), 3, 'f', 2, '0'));
+	query.bindValue(":chiller_lpm", QString("%1").arg(ui->chiller_lpmEdit->value(), 3, 'f', 2, '0'));
+	query.bindValue(":chiller_loss", QString("%1").arg(ui->chiller_lossEdit->value(), 3, 'f', 2, '0'));
+
 	if (this->recno == -1) {
             query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36));
         } else {
@@ -243,12 +258,12 @@
     query.prepare("INSERT INTO inventory_equipments SET name=:name, boil_size=:boil_size, "
                 "batch_size=:batch_size, tun_volume=:tun_volume, tun_weight=:tun_weight, "
                 "tun_specific_heat=:tun_specific_heat, tun_material=:tun_material, tun_height=:tun_height, "
-                "top_up_water=:top_up_water, trub_chiller_loss=:chiller_loss, evap_rate=:evap_rate, "
+                "top_up_water=:top_up_water, trub_chiller_loss=:trub_loss, evap_rate=:evap_rate, "
                 "boil_time=:boil_time, calc_boil_volume=:calcboil, top_up_kettle=:top_up_kettle, "
-                "hop_utilization=:hopfactor, notes=:notes, lauter_volume=:lauter_volume, "
-                "lauter_height=:lauter_height, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, "
+                "notes=:notes, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, "
                 "kettle_height=:kettle_height, mash_volume=:mash_volume, mash_max=:mash_max, "
-                "efficiency=:efficiency, uuid=:uuid");
+                "efficiency=:efficiency, chiller_type=:chiller_type, chiller_to79=:chiller_to79, "
+                "chiller_volume=:chiller_volume, chiller_lpm=:chiller_lpm, chiller_loss=:chiller_loss, uuid=:uuid");
 
     query.bindValue(":name", ui->nameEdit->text() + " [copy]");
     query.bindValue(":boil_size", QString("%1").arg(ui->boil_sizeEdit->value(), 2, 'f', 1, '0'));
@@ -259,15 +274,12 @@
     query.bindValue(":tun_material", ui->tun_materialEdit->currentIndex());
     query.bindValue(":tun_height", QString("%1").arg(ui->tun_heightEdit->value() / 100, 4, 'f', 3, '0'));
     query.bindValue(":top_up_water", QString("%1").arg(ui->top_up_waterEdit->value(), 2, 'f', 1, '0'));
-    query.bindValue(":chiller_loss", QString("%1").arg(ui->chiller_lossEdit->value(), 2, 'f', 1, '0'));
+    query.bindValue(":trub_loss", QString("%1").arg(ui->trub_lossEdit->value(), 2, 'f', 1, '0'));
     query.bindValue(":evap_rate", QString("%1").arg(ui->evap_rateEdit->value(), 3, 'f', 2, '0'));
     query.bindValue(":boil_time", QString("%1").arg(ui->boil_timeEdit->value(), 1, 'f', 0, '0'));
     query.bindValue(":calcboil", ui->calcboilEdit->isChecked() ? 1:0);
     query.bindValue(":top_up_kettle", QString("%1").arg(ui->top_up_kettleEdit->value(), 2, 'f', 1, '0'));
-    query.bindValue(":hopfactor", QString("%1").arg(ui->hopfactorEdit->value(), 1, 'f', 0, '0'));
     query.bindValue(":notes", ui->notesEdit->toPlainText());
-    query.bindValue(":lauter_volume", QString("%1").arg(ui->lauter_volumeEdit->value(), 2, 'f', 1, '0'));
-    query.bindValue(":lauter_height", QString("%1").arg(ui->lauter_heightEdit->value() / 100, 4, 'f', 3, '0'));
     query.bindValue(":lauter_deadspace", QString("%1").arg(ui->lauter_deadspaceEdit->value(), 2, 'f', 1, '0'));
     query.bindValue(":kettle_volume", QString("%1").arg(ui->kettle_volumeEdit->value(), 2, 'f', 1, '0'));
     query.bindValue(":kettle_height", QString("%1").arg(ui->kettle_heightEdit->value() / 100, 4, 'f', 3, '0'));
@@ -275,6 +287,11 @@
     query.bindValue(":mash_max", QString("%1").arg(ui->mash_maxEdit->value(), 2, 'f', 1, '0'));
     query.bindValue(":efficiency", QString("%1").arg(ui->efficiencyEdit->value(), 2, 'f', 1, '0'));
     query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36));
+    query.bindValue(":chiller_type", ui->chiller_typeEdit->currentIndex());
+    query.bindValue(":chiller_to79", QString("%1").arg(ui->chiller_to79Edit->value(), 1, 'f', 0, '0'));
+    query.bindValue(":chiller_volume", QString("%1").arg(ui->chiller_volumeEdit->value(), 3, 'f', 2, '0'));
+    query.bindValue(":chiller_lpm", QString("%1").arg(ui->chiller_lpmEdit->value(), 3, 'f', 2, '0'));
+    query.bindValue(":chiller_loss", QString("%1").arg(ui->chiller_lossEdit->value(), 3, 'f', 2, '0'));
     query.exec();
     if (query.lastError().isValid()) {
 	qWarning() << "EditEquipment" << query.lastError();
@@ -320,8 +337,10 @@
 void EditEquipment::calcBatchVolume()
 {
     double batch = ui->boil_sizeEdit->value() - (ui->evap_rateEdit->value() * ui->boil_timeEdit->value() / 60) + ui->top_up_kettleEdit->value();
-    double fermenter = round(((batch / 1.04) + ui->top_up_waterEdit->value() - ui->chiller_lossEdit->value()) * 100) / 100.0;
+    double fermenter = round(((batch / 1.04) + ui->top_up_waterEdit->value() - ui->trub_lossEdit->value() - ui->chiller_lossEdit->value()) * 100) / 100.0;
     batch = round(batch * 100) / 100.0;
+    if (ui->batch_sizeEdit->value() != batch)
+    	qDebug() << "Batch volue updated to" << batch;
     ui->batch_sizeEdit->setValue(batch);
     ui->vol_fermenterEdit->setValue(fermenter);
 }
@@ -349,6 +368,76 @@
 }
 
 
+void EditEquipment::chiller_setup(int val)
+{
+    if (val == CHILLER_TYPE_IMMERSION) {
+	ui->chiller_volumeEdit->setReadOnly(false);
+	ui->chiller_volumeEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
+	ui->chiller_volumeEdit->setFixedSize(101, 24);
+	if (ui->chiller_volumeEdit->value() == 0)
+	    ui->chiller_volumeEdit->setValue(0.5);
+    } else {
+	ui->chiller_volumeEdit->setReadOnly(true);
+	ui->chiller_volumeEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
+	ui->chiller_volumeEdit->setFixedSize(86, 24);
+	ui->chiller_volumeEdit->setValue(0);
+    }
+
+    if (val == CHILLER_TYPE_COUNTERFLOW) {
+	ui->chiller_to79Edit->setReadOnly(true);
+	ui->chiller_to79Edit->setButtonSymbols(QAbstractSpinBox::NoButtons);
+        ui->chiller_to79Edit->setFixedSize(86, 24);
+	ui->chiller_to79Edit->setValue(0);
+
+	ui->chiller_lpmEdit->setReadOnly(false);
+        ui->chiller_lpmEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
+        ui->chiller_lpmEdit->setFixedSize(101, 24);
+        if (ui->chiller_lpmEdit->value() == 0)
+             ui->chiller_lpmEdit->setValue(2.5);
+
+        ui->chiller_lossEdit->setReadOnly(false);
+        ui->chiller_lossEdit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
+        ui->chiller_lossEdit->setFixedSize(101, 24);
+        if (ui->chiller_lossEdit->value() == 0)
+             ui->chiller_lossEdit->setValue(3);
+
+    } else {
+	ui->chiller_to79Edit->setReadOnly(false);
+	ui->chiller_to79Edit->setButtonSymbols(QAbstractSpinBox::UpDownArrows);
+        ui->chiller_to79Edit->setFixedSize(101, 24);
+	int time = 5;
+	if (val == CHILLER_TYPE_AUBAINMARIE)
+	    time = 20;
+	if (val == CHILLER_TYPE_NOCHILL)
+	    time = 240;
+	if (ui->chiller_to79Edit->value() == 0)
+	    ui->chiller_to79Edit->setValue(time);
+
+	ui->chiller_lpmEdit->setReadOnly(true);
+        ui->chiller_lpmEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
+        ui->chiller_lpmEdit->setFixedSize(86, 24);
+        ui->chiller_lpmEdit->setValue(0);
+
+        ui->chiller_lossEdit->setReadOnly(true);
+        ui->chiller_lossEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
+        ui->chiller_lossEdit->setFixedSize(86, 24);
+        ui->chiller_lossEdit->setValue(0);
+    }
+}
+
+
+void EditEquipment::chiller_changed()
+{
+    const QSignalBlocker blocker1(ui->chiller_to79Edit);
+    const QSignalBlocker blocker2(ui->chiller_volumeEdit);
+    const QSignalBlocker blocker3(ui->chiller_lpmEdit);
+    const QSignalBlocker blocker4(ui->chiller_lossEdit);
+
+    chiller_setup(ui->chiller_typeEdit->currentIndex());
+    is_changed();
+}
+
+
 void EditEquipment::on_quitButton_clicked()
 {
     if (this->textIsChanged) {

mercurial