src/Setup.cpp

changeset 337
8133cdb19aa1
parent 336
e97f9e87d94b
child 344
9ffac162000c
equal deleted inserted replaced
336:e97f9e87d94b 337:8133cdb19aa1
156 brixLabel->setObjectName(QString::fromUtf8("brixLabel")); 156 brixLabel->setObjectName(QString::fromUtf8("brixLabel"));
157 brixLabel->setGeometry(QRect(400, 150, 161, 20)); 157 brixLabel->setGeometry(QRect(400, 150, 161, 20));
158 brixLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 158 brixLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
159 brixLabel->setText(tr("Brix Correction factor:")); 159 brixLabel->setText(tr("Brix Correction factor:"));
160 160
161 heightLabel = new QLabel(topWidget);
162 heightLabel->setObjectName(QString::fromUtf8("heightLabel"));
163 heightLabel->setGeometry(QRect(400, 180, 161, 20));
164 heightLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
165 heightLabel->setText(tr("Brewery height meters:"));
166
161 titleLabel = new QLabel(topWidget); 167 titleLabel = new QLabel(topWidget);
162 titleLabel->setObjectName(QString::fromUtf8("titleLabel")); 168 titleLabel->setObjectName(QString::fromUtf8("titleLabel"));
163 titleLabel->setGeometry(QRect(5, 80, 1251, 20)); 169 titleLabel->setGeometry(QRect(5, 80, 1251, 20));
164 QFont font; 170 QFont font;
165 font.setFamily(QString::fromUtf8("DejaVu Sans")); 171 font.setFamily(QString::fromUtf8("DejaVu Sans"));
217 brixEdit->setSingleStep(0.010000000000000); 223 brixEdit->setSingleStep(0.010000000000000);
218 brixEdit->setStepType(QAbstractSpinBox::DefaultStepType); 224 brixEdit->setStepType(QAbstractSpinBox::DefaultStepType);
219 brixEdit->setValue(1.000000000000000); 225 brixEdit->setValue(1.000000000000000);
220 brixEdit->setToolTip(tr("Plato to Brix conversion factor.")); 226 brixEdit->setToolTip(tr("Plato to Brix conversion factor."));
221 227
228 heightEdit = new QSpinBox(topWidget);
229 heightEdit->setObjectName(QString::fromUtf8("heightEdit"));
230 heightEdit->setGeometry(QRect(580, 180, 101, 24));
231 heightEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
232 heightEdit->setAccelerated(true);
233 heightEdit->setMinimum(-430);
234 heightEdit->setMaximum(8849);
235 heightEdit->setStepType(QAbstractSpinBox::DefaultStepType);
236 heightEdit->setValue(0);
237 heightEdit->setToolTip(tr("Height in meters above/below sealevel to calculate the exact boiling point and hop isomerizon."));
238
222 colorEdit = new QComboBox(topWidget); 239 colorEdit = new QComboBox(topWidget);
223 colorEdit->setObjectName(QString::fromUtf8("colorEdit")); 240 colorEdit->setObjectName(QString::fromUtf8("colorEdit"));
224 colorEdit->setGeometry(QRect(940, 120, 161, 23)); 241 colorEdit->setGeometry(QRect(940, 120, 161, 23));
225 colorEdit->setMinimumContentsLength(4); 242 colorEdit->setMinimumContentsLength(4);
226 colorEdit->setIconSize(QSize(0, 0)); 243 colorEdit->setIconSize(QSize(0, 0));
312 connect(wethopEdit, &QSpinBox::textChanged, this, &Setup::is_changed); 329 connect(wethopEdit, &QSpinBox::textChanged, this, &Setup::is_changed);
313 connect(cryohopEdit, &QSpinBox::textChanged, this, &Setup::is_changed); 330 connect(cryohopEdit, &QSpinBox::textChanged, this, &Setup::is_changed);
314 331
315 grainEdit->setValue(query.value("grain_absorbtion").toDouble()); 332 grainEdit->setValue(query.value("grain_absorbtion").toDouble());
316 brixEdit->setValue(query.value("brix_correction").toDouble()); 333 brixEdit->setValue(query.value("brix_correction").toDouble());
334 heightEdit->setValue(query.value("brewery_height").toInt());
317 connect(grainEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed); 335 connect(grainEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed);
318 connect(brixEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed); 336 connect(brixEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed);
337 connect(heightEdit, &QSpinBox::textChanged, this, &Setup::is_changed);
319 338
320 colorEdit->addItem("Morey"); 339 colorEdit->addItem("Morey");
321 colorEdit->addItem("Mosher"); 340 colorEdit->addItem("Mosher");
322 colorEdit->addItem("Daniels"); 341 colorEdit->addItem("Daniels");
323 colorEdit->addItem("Halberstadt"); 342 colorEdit->addItem("Halberstadt");
451 /* 470 /*
452 * Update all other data 471 * Update all other data
453 */ 472 */
454 query.prepare("UPDATE profile_setup SET brewery_name=:brewery, brewery_logo=:logo, factor_mashhop=:mashhop, factor_fwh=:fwh, " 473 query.prepare("UPDATE profile_setup SET brewery_name=:brewery, brewery_logo=:logo, factor_mashhop=:mashhop, factor_fwh=:fwh, "
455 "factor_pellet=:pellet, factor_plug=:plug, factor_wethop=:wet, factor_cryohop=:cryo, color_method=:color, ibu_method=:ibu, " 474 "factor_pellet=:pellet, factor_plug=:plug, factor_wethop=:wet, factor_cryohop=:cryo, color_method=:color, ibu_method=:ibu, "
456 "brix_correction=:brix, grain_absorbtion=:grain, default_water=:water, my_yeastlab=:yeast WHERE record='1'"); 475 "brix_correction=:brix, grain_absorbtion=:grain, default_water=:water, my_yeastlab=:yeast, "
476 "brewery_height=:height WHERE record='1'");
457 query.bindValue(":brewery", this->breweryEdit->text()); 477 query.bindValue(":brewery", this->breweryEdit->text());
458 query.bindValue(":logo", logoByteArray); 478 query.bindValue(":logo", logoByteArray);
459 query.bindValue(":mashhop", this->mashhopEdit->value()); 479 query.bindValue(":mashhop", this->mashhopEdit->value());
460 query.bindValue(":fwh", this->fwhEdit->value()); 480 query.bindValue(":fwh", this->fwhEdit->value());
461 query.bindValue(":pellet", this->pelletEdit->value()); 481 query.bindValue(":pellet", this->pelletEdit->value());
466 query.bindValue(":ibu", this->ibuEdit->currentIndex()); 486 query.bindValue(":ibu", this->ibuEdit->currentIndex());
467 query.bindValue(":brix", this->brixEdit->value()); 487 query.bindValue(":brix", this->brixEdit->value());
468 query.bindValue(":grain", this->grainEdit->value()); 488 query.bindValue(":grain", this->grainEdit->value());
469 query.bindValue(":water", record); 489 query.bindValue(":water", record);
470 query.bindValue(":yeast", this->yeastEdit->currentText()); 490 query.bindValue(":yeast", this->yeastEdit->currentText());
491 query.bindValue(":height", this->heightEdit->value());
471 query.exec(); 492 query.exec();
472 if (query.lastError().isValid()) { 493 if (query.lastError().isValid()) {
473 qDebug() << "Setup Save error:" << query.lastError(); 494 qDebug() << "Setup Save error:" << query.lastError();
474 QMessageBox::warning(this, tr("Database error"), 495 QMessageBox::warning(this, tr("Database error"),
475 tr("MySQL error: %1\n%2\n%3") 496 tr("MySQL error: %1\n%2\n%3")

mercurial