src/EditRecipe.cpp

changeset 98
1425bf3e18ed
parent 97
8283bbf95806
child 99
053c0578cf58
equal deleted inserted replaced
97:8283bbf95806 98:1425bf3e18ed
31 WindowTitle(); 31 WindowTitle();
32 32
33 ui->typeEdit->addItem(tr("Extract")); 33 ui->typeEdit->addItem(tr("Extract"));
34 ui->typeEdit->addItem(tr("Partial Mash")); 34 ui->typeEdit->addItem(tr("Partial Mash"));
35 ui->typeEdit->addItem(tr("All Grain")); 35 ui->typeEdit->addItem(tr("All Grain"));
36
37 ui->color_methodEdit->addItem("Morey");
38 ui->color_methodEdit->addItem("Mosher");
39 ui->color_methodEdit->addItem("Daniels");
40 ui->color_methodEdit->addItem("Halberstadt");
41 ui->color_methodEdit->addItem("Naudts");
36 42
37 if (id >= 0) { 43 if (id >= 0) {
38 query.prepare("SELECT * FROM recipes WHERE record = :recno"); 44 query.prepare("SELECT * FROM recipes WHERE record = :recno");
39 query.bindValue(":recno", id); 45 query.bindValue(":recno", id);
40 query.exec(); 46 query.exec();
85 ui->est_abvShow->setMarkerTextIsValue(true); 91 ui->est_abvShow->setMarkerTextIsValue(true);
86 ui->est_abvShow->setValue(query.value(30).toDouble()); 92 ui->est_abvShow->setValue(query.value(30).toDouble());
87 93
88 ui->est_colorEdit->setValue(query.value(31).toDouble()); 94 ui->est_colorEdit->setValue(query.value(31).toDouble());
89 QColor color = Utils::ebc_to_color(query.value(31).toInt()); 95 QColor color = Utils::ebc_to_color(query.value(31).toInt());
96 ui->est_colorEdit->setStyleSheet(Utils::ebc_to_style(query.value(31).toInt()));
90 ui->est_colorGlass->setColor(color); 97 ui->est_colorGlass->setColor(color);
91 ui->est_colorShow->setPrecision(0); 98 ui->est_colorShow->setPrecision(0);
92 ui->est_colorShow->setMarkerTextIsValue(true); 99 ui->est_colorShow->setMarkerTextIsValue(false);
93 ui->est_colorShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); 100 ui->est_colorShow->setRange(query.value(15).toDouble(), query.value(16).toDouble());
94 ui->est_colorShow->setValue(query.value(31).toDouble()); 101 ui->est_colorShow->setValue(query.value(31).toDouble());
95 102
96 ui->color_methodEdit->addItem("Morey");
97 ui->color_methodEdit->addItem("Mosher");
98 ui->color_methodEdit->addItem("Daniels");
99 ui->color_methodEdit->addItem("Halberstadt");
100 ui->color_methodEdit->addItem("Naudts");
101 ui->color_methodEdit->setCurrentIndex(query.value(32).toInt()); 103 ui->color_methodEdit->setCurrentIndex(query.value(32).toInt());
102 104
103 // 33 est_ibu 105 // 33 est_ibu
104 // 34 ibu_method 106 // 34 ibu_method
105 // 35 est_carb 107 // 35 est_carb
289 291
290 292
291 void EditRecipe::on_quitButton_clicked() 293 void EditRecipe::on_quitButton_clicked()
292 { 294 {
293 if (this->textIsChanged) { 295 if (this->textIsChanged) {
294 int rc = QMessageBox::warning(this, tr("Recipe changed"), tr("The ingredient has been modified. Save changes?"), 296 int rc = QMessageBox::warning(this, tr("Recipe changed"), tr("The recipe has been modified. Save changes?"),
295 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save); 297 QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save);
296 switch (rc) { 298 switch (rc) {
297 case QMessageBox::Save: 299 case QMessageBox::Save:
298 on_saveButton_clicked(); 300 on_saveButton_clicked();
299 break; /* Saved and then Quit */ 301 break; /* Saved and then Quit */

mercurial