src/Setup.cpp

changeset 337
8133cdb19aa1
parent 336
e97f9e87d94b
child 344
9ffac162000c
--- a/src/Setup.cpp	Tue Jul 05 14:31:39 2022 +0200
+++ b/src/Setup.cpp	Thu Jul 07 08:51:57 2022 +0200
@@ -158,6 +158,12 @@
     brixLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
     brixLabel->setText(tr("Brix Correction factor:"));
 
+    heightLabel = new QLabel(topWidget);
+    heightLabel->setObjectName(QString::fromUtf8("heightLabel"));
+    heightLabel->setGeometry(QRect(400, 180, 161, 20));
+    heightLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+    heightLabel->setText(tr("Brewery height meters:"));
+
     titleLabel = new QLabel(topWidget);
     titleLabel->setObjectName(QString::fromUtf8("titleLabel"));
     titleLabel->setGeometry(QRect(5, 80, 1251, 20));
@@ -219,6 +225,17 @@
     brixEdit->setValue(1.000000000000000);
     brixEdit->setToolTip(tr("Plato to Brix conversion factor."));
 
+    heightEdit = new QSpinBox(topWidget);
+    heightEdit->setObjectName(QString::fromUtf8("heightEdit"));
+    heightEdit->setGeometry(QRect(580, 180, 101, 24));
+    heightEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
+    heightEdit->setAccelerated(true);
+    heightEdit->setMinimum(-430);
+    heightEdit->setMaximum(8849);
+    heightEdit->setStepType(QAbstractSpinBox::DefaultStepType);
+    heightEdit->setValue(0);
+    heightEdit->setToolTip(tr("Height in meters above/below sealevel to calculate the exact boiling point and hop isomerizon."));
+
     colorEdit = new QComboBox(topWidget);
     colorEdit->setObjectName(QString::fromUtf8("colorEdit"));
     colorEdit->setGeometry(QRect(940, 120, 161, 23));
@@ -314,8 +331,10 @@
 
     grainEdit->setValue(query.value("grain_absorbtion").toDouble());
     brixEdit->setValue(query.value("brix_correction").toDouble());
+    heightEdit->setValue(query.value("brewery_height").toInt());
     connect(grainEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed);
     connect(brixEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed);
+    connect(heightEdit, &QSpinBox::textChanged, this, &Setup::is_changed);
 
     colorEdit->addItem("Morey");
     colorEdit->addItem("Mosher");
@@ -453,7 +472,8 @@
      */
     query.prepare("UPDATE profile_setup SET brewery_name=:brewery, brewery_logo=:logo, factor_mashhop=:mashhop, factor_fwh=:fwh, "
 		  "factor_pellet=:pellet, factor_plug=:plug, factor_wethop=:wet, factor_cryohop=:cryo, color_method=:color, ibu_method=:ibu, "
-		  "brix_correction=:brix, grain_absorbtion=:grain, default_water=:water, my_yeastlab=:yeast WHERE record='1'");
+		  "brix_correction=:brix, grain_absorbtion=:grain, default_water=:water, my_yeastlab=:yeast, "
+		  "brewery_height=:height  WHERE record='1'");
     query.bindValue(":brewery", this->breweryEdit->text());
     query.bindValue(":logo", logoByteArray);
     query.bindValue(":mashhop", this->mashhopEdit->value());
@@ -468,6 +488,7 @@
     query.bindValue(":grain", this->grainEdit->value());
     query.bindValue(":water", record);
     query.bindValue(":yeast", this->yeastEdit->currentText());
+    query.bindValue(":height", this->heightEdit->value());
     query.exec();
     if (query.lastError().isValid()) {
 	qDebug() << "Setup Save error:" << query.lastError();

mercurial