src/EditRecipe.cpp

changeset 100
d11a3e713e3b
parent 99
053c0578cf58
child 101
1d14d3bf2465
equal deleted inserted replaced
99:053c0578cf58 100:d11a3e713e3b
38 ui->color_methodEdit->addItem("Mosher"); 38 ui->color_methodEdit->addItem("Mosher");
39 ui->color_methodEdit->addItem("Daniels"); 39 ui->color_methodEdit->addItem("Daniels");
40 ui->color_methodEdit->addItem("Halberstadt"); 40 ui->color_methodEdit->addItem("Halberstadt");
41 ui->color_methodEdit->addItem("Naudts"); 41 ui->color_methodEdit->addItem("Naudts");
42 42
43 ui->ibu_methodEdit->addItem("Tinseth");
44 ui->ibu_methodEdit->addItem("Rager");
45 ui->ibu_methodEdit->addItem("Daniels");
46
43 if (id >= 0) { 47 if (id >= 0) {
44 query.prepare("SELECT * FROM recipes WHERE record = :recno"); 48 query.prepare("SELECT * FROM recipes WHERE record = :recno");
45 query.bindValue(":recno", id); 49 query.bindValue(":recno", id);
46 query.exec(); 50 query.exec();
47 query.next(); 51 query.next();
48 52
49 ui->lockedEdit->setChecked(query.value(2).toInt() ? true:false); 53 ui->lockedEdit->setChecked(query.value(2).toInt() ? true:false);
50 // 3 st_name 54 ui->st_nameEdit->setText(query.value(3).toString());
51 // 4 st_letter 55 ui->st_groupEdit->setText(query.value(4).toString());
52 // 5 st_guide 56 ui->st_guideEdit->setText(query.value(5).toString());
53 // 6 st_category 57 ui->st_catEdit->setText(query.value(6).toString());
54 // 7 st_category_number 58 ui->st_catnrEdit->setText(query.value(7).toString());
55 // 8 st_type 59 ui->st_typeEdit->setText(query.value(8).toString());
56 // 9 st_og_min 60
57 // 10 st_og_max
58 // 11 st_fg_min
59 // 12 st_fg_max
60 // 13 st_ibu_min
61 // 14 st_ibu_max
62 // 15 st_color_min
63 // 16 st_color_max
64 // 17 st_carb_min
65 // 18 st_carb_max
66 // 19 st_abv_min
67 // 20 st_abv_max
68 ui->nameEdit->setText(query.value(21).toString()); 61 ui->nameEdit->setText(query.value(21).toString());
69 ui->notesEdit->setPlainText(query.value(22).toString()); 62 ui->notesEdit->setPlainText(query.value(22).toString());
70 ui->typeEdit->setCurrentIndex(query.value(23).toInt()); 63 ui->typeEdit->setCurrentIndex(query.value(23).toInt());
71 ui->batch_sizeEdit->setValue(query.value(24).toDouble()); 64 ui->batch_sizeEdit->setValue(query.value(24).toDouble());
72 ui->boil_sizeEdit->setValue(query.value(25).toDouble()); 65 ui->boil_sizeEdit->setValue(query.value(25).toDouble());
99 ui->est_colorShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); 92 ui->est_colorShow->setRange(query.value(15).toDouble(), query.value(16).toDouble());
100 ui->est_colorShow->setValue(query.value(31).toDouble()); 93 ui->est_colorShow->setValue(query.value(31).toDouble());
101 94
102 ui->color_methodEdit->setCurrentIndex(query.value(32).toInt()); 95 ui->color_methodEdit->setCurrentIndex(query.value(32).toInt());
103 96
104 // 33 est_ibu 97 ui->est_ibuEdit->setValue(query.value(33).toDouble());
105 // 34 ibu_method 98 ui->est_ibuShow->setPrecision(0);
106 // 35 est_carb 99 ui->est_ibuShow->setMarkerTextIsValue(true);
100 ui->est_ibuShow->setRange(query.value(13).toDouble(), query.value(14).toDouble());
101 ui->est_ibuShow->setValue(query.value(33).toDouble());
102
103 ui->ibu_methodEdit->setCurrentIndex(query.value(34).toInt());
104
105 ui->est_carbEdit->setValue(query.value(35).toDouble());
106 ui->est_carbShow->setPrecision(1);
107 ui->est_carbShow->setMarkerTextIsValue(true);
108 ui->est_carbShow->setRange(query.value(17).toDouble(), query.value(18).toDouble());
109 ui->est_carbShow->setValue(query.value(35).toDouble());
110
107 // 36 sparge_temp 111 // 36 sparge_temp
108 // 37 sparge_ph 112 // 37 sparge_ph
109 // 38 sparge_volume 113 // 38 sparge_volume
110 // 39 sparge_source 114 // 39 sparge_source
111 // 40 sparge_acid_type 115 // 40 sparge_acid_type
165 169
166 connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditRecipe::is_changed); 170 connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditRecipe::is_changed);
167 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed())); 171 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed()));
168 connect(ui->typeEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed); 172 connect(ui->typeEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed);
169 connect(ui->batch_sizeEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); 173 connect(ui->batch_sizeEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed);
170 connect(ui->boil_sizeEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed);
171 connect(ui->boil_timeEdit, &QSpinBox::textChanged, this, &EditRecipe::is_changed); 174 connect(ui->boil_timeEdit, &QSpinBox::textChanged, this, &EditRecipe::is_changed);
172 connect(ui->efficiencyEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed); 175 connect(ui->efficiencyEdit, &QDoubleSpinBox::textChanged, this, &EditRecipe::is_changed);
173 176
174 connect(ui->color_methodEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed); 177 connect(ui->color_methodEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed);
178
179 connect(ui->ibu_methodEdit, &QComboBox::currentTextChanged, this, &EditRecipe::is_changed);
175 180
176 ui->saveButton->setEnabled(false); 181 ui->saveButton->setEnabled(false);
177 ui->deleteButton->setEnabled((id >= 0) ? true:false); 182 ui->deleteButton->setEnabled((id >= 0) ? true:false);
178 } 183 }
179 184

mercurial