src/EditEquipment.cpp

changeset 462
1654ff5446c7
parent 458
ac216a75ca9b
child 527
84091b9cb800
equal deleted inserted replaced
461:add4dbef0c81 462:1654ff5446c7
52 ui->tun_heightEdit->setValue(query.value("tun_height").toDouble() * 100.0); 52 ui->tun_heightEdit->setValue(query.value("tun_height").toDouble() * 100.0);
53 ui->top_up_waterEdit->setValue(query.value("top_up_water").toDouble()); 53 ui->top_up_waterEdit->setValue(query.value("top_up_water").toDouble());
54 ui->trub_lossEdit->setValue(query.value("trub_loss").toDouble()); 54 ui->trub_lossEdit->setValue(query.value("trub_loss").toDouble());
55 ui->evap_rateEdit->setValue(query.value("evap_rate").toDouble()); 55 ui->evap_rateEdit->setValue(query.value("evap_rate").toDouble());
56 ui->boil_timeEdit->setValue(query.value("boil_time").toDouble()); 56 ui->boil_timeEdit->setValue(query.value("boil_time").toDouble());
57 ui->calcboilEdit->setChecked(query.value("calc_boil_volume").toInt() ? true:false);
58 ui->top_up_kettleEdit->setValue(query.value("top_up_kettle").toDouble()); 57 ui->top_up_kettleEdit->setValue(query.value("top_up_kettle").toDouble());
59 ui->notesEdit->setPlainText(query.value("notes").toString()); 58 ui->notesEdit->setPlainText(query.value("notes").toString());
60 ui->lauter_deadspaceEdit->setValue(query.value("lauter_deadspace").toDouble()); 59 ui->lauter_deadspaceEdit->setValue(query.value("lauter_deadspace").toDouble());
61 ui->kettle_volumeEdit->setValue(query.value("kettle_volume").toDouble()); 60 ui->kettle_volumeEdit->setValue(query.value("kettle_volume").toDouble());
62 ui->kettle_heightEdit->setValue(query.value("kettle_height").toDouble() * 100.0); 61 ui->kettle_heightEdit->setValue(query.value("kettle_height").toDouble() * 100.0);
88 ui->tun_heightEdit->setValue(20); 87 ui->tun_heightEdit->setValue(20);
89 ui->top_up_waterEdit->setValue(0); 88 ui->top_up_waterEdit->setValue(0);
90 ui->trub_lossEdit->setValue(0.5); 89 ui->trub_lossEdit->setValue(0.5);
91 ui->evap_rateEdit->setValue(1.8); 90 ui->evap_rateEdit->setValue(1.8);
92 ui->boil_timeEdit->setValue(90); 91 ui->boil_timeEdit->setValue(90);
93 ui->calcboilEdit->setChecked(true);
94 ui->top_up_kettleEdit->setValue(0); 92 ui->top_up_kettleEdit->setValue(0);
95 ui->lauter_deadspaceEdit->setValue(0.5); 93 ui->lauter_deadspaceEdit->setValue(0.5);
96 ui->kettle_volumeEdit->setValue(20); 94 ui->kettle_volumeEdit->setValue(20);
97 ui->kettle_heightEdit->setValue(20); 95 ui->kettle_heightEdit->setValue(20);
98 ui->mash_volumeEdit->setValue(18); 96 ui->mash_volumeEdit->setValue(18);
118 connect(ui->tun_heightEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed); 116 connect(ui->tun_heightEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
119 connect(ui->top_up_waterEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed); 117 connect(ui->top_up_waterEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
120 connect(ui->trub_lossEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed); 118 connect(ui->trub_lossEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
121 connect(ui->evap_rateEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed); 119 connect(ui->evap_rateEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
122 connect(ui->boil_timeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed); 120 connect(ui->boil_timeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
123 connect(ui->calcboilEdit, &QCheckBox::stateChanged, this, &EditEquipment::is_changed);
124 connect(ui->top_up_kettleEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed); 121 connect(ui->top_up_kettleEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
125 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed())); 122 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed()));
126 connect(ui->lauter_deadspaceEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed); 123 connect(ui->lauter_deadspaceEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
127 connect(ui->kettle_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed); 124 connect(ui->kettle_volumeEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
128 connect(ui->kettle_heightEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed); 125 connect(ui->kettle_heightEdit, &QDoubleSpinBox::textChanged, this, &EditEquipment::is_changed);
187 } 184 }
188 sql.append(" inventory_equipments SET name=:name, boil_size=:boil_size, " 185 sql.append(" inventory_equipments SET name=:name, boil_size=:boil_size, "
189 "batch_size=:batch_size, tun_volume=:tun_volume, tun_weight=:tun_weight, " 186 "batch_size=:batch_size, tun_volume=:tun_volume, tun_weight=:tun_weight, "
190 "tun_specific_heat=:tun_specific_heat, tun_material=:tun_material, tun_height=:tun_height, " 187 "tun_specific_heat=:tun_specific_heat, tun_material=:tun_material, tun_height=:tun_height, "
191 "top_up_water=:top_up_water, trub_loss=:trub_loss, evap_rate=:evap_rate, " 188 "top_up_water=:top_up_water, trub_loss=:trub_loss, evap_rate=:evap_rate, "
192 "boil_time=:boil_time, calc_boil_volume=:calcboil, top_up_kettle=:top_up_kettle, " 189 "boil_time=:boil_time, top_up_kettle=:top_up_kettle, "
193 "notes=:notes, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, " 190 "notes=:notes, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, "
194 "kettle_height=:kettle_height, mash_volume=:mash_volume, mash_max=:mash_max, " 191 "kettle_height=:kettle_height, mash_volume=:mash_volume, mash_max=:mash_max, "
195 "efficiency=:efficiency, chiller_type=:chiller_type, chiller_to79=:chiller_to79, " 192 "efficiency=:efficiency, chiller_type=:chiller_type, chiller_to79=:chiller_to79, "
196 "chiller_volume=:chiller_volume, chiller_lpm=:chiller_lpm, chiller_loss=:chiller_loss"); 193 "chiller_volume=:chiller_volume, chiller_lpm=:chiller_lpm, chiller_loss=:chiller_loss");
197 if (this->recno == -1) { 194 if (this->recno == -1) {
210 query.bindValue(":tun_height", QString("%1").arg(ui->tun_heightEdit->value() / 100, 4, 'f', 3, '0')); 207 query.bindValue(":tun_height", QString("%1").arg(ui->tun_heightEdit->value() / 100, 4, 'f', 3, '0'));
211 query.bindValue(":top_up_water", QString("%1").arg(ui->top_up_waterEdit->value(), 2, 'f', 1, '0')); 208 query.bindValue(":top_up_water", QString("%1").arg(ui->top_up_waterEdit->value(), 2, 'f', 1, '0'));
212 query.bindValue(":trub_loss", QString("%1").arg(ui->trub_lossEdit->value(), 2, 'f', 1, '0')); 209 query.bindValue(":trub_loss", QString("%1").arg(ui->trub_lossEdit->value(), 2, 'f', 1, '0'));
213 query.bindValue(":evap_rate", QString("%1").arg(ui->evap_rateEdit->value(), 3, 'f', 2, '0')); 210 query.bindValue(":evap_rate", QString("%1").arg(ui->evap_rateEdit->value(), 3, 'f', 2, '0'));
214 query.bindValue(":boil_time", QString("%1").arg(ui->boil_timeEdit->value(), 1, 'f', 0, '0')); 211 query.bindValue(":boil_time", QString("%1").arg(ui->boil_timeEdit->value(), 1, 'f', 0, '0'));
215 query.bindValue(":calcboil", ui->calcboilEdit->isChecked() ? 1:0);
216 query.bindValue(":top_up_kettle", QString("%1").arg(ui->top_up_kettleEdit->value(), 2, 'f', 1, '0')); 212 query.bindValue(":top_up_kettle", QString("%1").arg(ui->top_up_kettleEdit->value(), 2, 'f', 1, '0'));
217 query.bindValue(":notes", ui->notesEdit->toPlainText()); 213 query.bindValue(":notes", ui->notesEdit->toPlainText());
218 query.bindValue(":lauter_deadspace", QString("%1").arg(ui->lauter_deadspaceEdit->value(), 2, 'f', 1, '0')); 214 query.bindValue(":lauter_deadspace", QString("%1").arg(ui->lauter_deadspaceEdit->value(), 2, 'f', 1, '0'));
219 query.bindValue(":kettle_volume", QString("%1").arg(ui->kettle_volumeEdit->value(), 2, 'f', 1, '0')); 215 query.bindValue(":kettle_volume", QString("%1").arg(ui->kettle_volumeEdit->value(), 2, 'f', 1, '0'));
220 query.bindValue(":kettle_height", QString("%1").arg(ui->kettle_heightEdit->value() / 100, 4, 'f', 3, '0')); 216 query.bindValue(":kettle_height", QString("%1").arg(ui->kettle_heightEdit->value() / 100, 4, 'f', 3, '0'));
257 253
258 query.prepare("INSERT INTO inventory_equipments SET name=:name, boil_size=:boil_size, " 254 query.prepare("INSERT INTO inventory_equipments SET name=:name, boil_size=:boil_size, "
259 "batch_size=:batch_size, tun_volume=:tun_volume, tun_weight=:tun_weight, " 255 "batch_size=:batch_size, tun_volume=:tun_volume, tun_weight=:tun_weight, "
260 "tun_specific_heat=:tun_specific_heat, tun_material=:tun_material, tun_height=:tun_height, " 256 "tun_specific_heat=:tun_specific_heat, tun_material=:tun_material, tun_height=:tun_height, "
261 "top_up_water=:top_up_water, trub_loss=:trub_loss, evap_rate=:evap_rate, " 257 "top_up_water=:top_up_water, trub_loss=:trub_loss, evap_rate=:evap_rate, "
262 "boil_time=:boil_time, calc_boil_volume=:calcboil, top_up_kettle=:top_up_kettle, " 258 "boil_time=:boil_time, top_up_kettle=:top_up_kettle, "
263 "notes=:notes, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, " 259 "notes=:notes, lauter_deadspace=:lauter_deadspace, kettle_volume=:kettle_volume, "
264 "kettle_height=:kettle_height, mash_volume=:mash_volume, mash_max=:mash_max, " 260 "kettle_height=:kettle_height, mash_volume=:mash_volume, mash_max=:mash_max, "
265 "efficiency=:efficiency, chiller_type=:chiller_type, chiller_to79=:chiller_to79, " 261 "efficiency=:efficiency, chiller_type=:chiller_type, chiller_to79=:chiller_to79, "
266 "chiller_volume=:chiller_volume, chiller_lpm=:chiller_lpm, chiller_loss=:chiller_loss, uuid=:uuid"); 262 "chiller_volume=:chiller_volume, chiller_lpm=:chiller_lpm, chiller_loss=:chiller_loss, uuid=:uuid");
267 263
275 query.bindValue(":tun_height", QString("%1").arg(ui->tun_heightEdit->value() / 100, 4, 'f', 3, '0')); 271 query.bindValue(":tun_height", QString("%1").arg(ui->tun_heightEdit->value() / 100, 4, 'f', 3, '0'));
276 query.bindValue(":top_up_water", QString("%1").arg(ui->top_up_waterEdit->value(), 2, 'f', 1, '0')); 272 query.bindValue(":top_up_water", QString("%1").arg(ui->top_up_waterEdit->value(), 2, 'f', 1, '0'));
277 query.bindValue(":trub_loss", QString("%1").arg(ui->trub_lossEdit->value(), 2, 'f', 1, '0')); 273 query.bindValue(":trub_loss", QString("%1").arg(ui->trub_lossEdit->value(), 2, 'f', 1, '0'));
278 query.bindValue(":evap_rate", QString("%1").arg(ui->evap_rateEdit->value(), 3, 'f', 2, '0')); 274 query.bindValue(":evap_rate", QString("%1").arg(ui->evap_rateEdit->value(), 3, 'f', 2, '0'));
279 query.bindValue(":boil_time", QString("%1").arg(ui->boil_timeEdit->value(), 1, 'f', 0, '0')); 275 query.bindValue(":boil_time", QString("%1").arg(ui->boil_timeEdit->value(), 1, 'f', 0, '0'));
280 query.bindValue(":calcboil", ui->calcboilEdit->isChecked() ? 1:0);
281 query.bindValue(":top_up_kettle", QString("%1").arg(ui->top_up_kettleEdit->value(), 2, 'f', 1, '0')); 276 query.bindValue(":top_up_kettle", QString("%1").arg(ui->top_up_kettleEdit->value(), 2, 'f', 1, '0'));
282 query.bindValue(":notes", ui->notesEdit->toPlainText()); 277 query.bindValue(":notes", ui->notesEdit->toPlainText());
283 query.bindValue(":lauter_deadspace", QString("%1").arg(ui->lauter_deadspaceEdit->value(), 2, 'f', 1, '0')); 278 query.bindValue(":lauter_deadspace", QString("%1").arg(ui->lauter_deadspaceEdit->value(), 2, 'f', 1, '0'));
284 query.bindValue(":kettle_volume", QString("%1").arg(ui->kettle_volumeEdit->value(), 2, 'f', 1, '0')); 279 query.bindValue(":kettle_volume", QString("%1").arg(ui->kettle_volumeEdit->value(), 2, 'f', 1, '0'));
285 query.bindValue(":kettle_height", QString("%1").arg(ui->kettle_heightEdit->value() / 100, 4, 'f', 3, '0')); 280 query.bindValue(":kettle_height", QString("%1").arg(ui->kettle_heightEdit->value() / 100, 4, 'f', 3, '0'));

mercurial