15 * |
15 * |
16 * You should have received a copy of the GNU General Public License |
16 * You should have received a copy of the GNU General Public License |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 */ |
18 */ |
19 |
19 |
|
20 |
|
21 void EditRecipe::calcStyle() |
|
22 { |
|
23 /* |
|
24 * https://www.homebrewersassociation.org/forum/index.php?topic=10548.0 |
|
25 * |
|
26 * Calculate the ideal BU:GU and BU:RE ranges. These values |
|
27 * will be used in the RangedSliders. |
|
28 */ |
|
29 double bugu_min = recipe->st_ibu_min / ((recipe->st_og_min - 1) * 1000); |
|
30 double bugu_max = recipe->st_ibu_max / ((recipe->st_og_max - 1) * 1000); |
|
31 ui->est_buguShow->setRange(bugu_min, bugu_max); |
|
32 |
|
33 double fg_min = recipe->st_fg_min; |
|
34 if (fg_min < 1.002) /* Use 1.002 fg as lowest minimal value */ |
|
35 fg_min = 1.002; |
|
36 |
|
37 /* |
|
38 * Real Extract (RE) |
|
39 */ |
|
40 double re = ((0.1808 * ((Utils::sg_to_plato(recipe->st_og_min) + Utils::sg_to_plato(recipe->st_og_max)) / 2)) + |
|
41 (0.8192 * ((Utils::sg_to_plato(fg_min) + Utils::sg_to_plato(recipe->st_fg_max)) / 2))); |
|
42 |
|
43 /* BU:RE */ |
|
44 double bure_min = recipe->st_ibu_min / re; |
|
45 double bure_max = recipe->st_ibu_max / re; |
|
46 ui->est_bufguShow->setRange(bure_min, bure_max); |
|
47 |
|
48 qDebug() << "BU:RE" << bure_min << bure_max; |
|
49 } |
20 |
50 |
21 |
51 |
22 void EditRecipe::name_changed(QString name) |
52 void EditRecipe::name_changed(QString name) |
23 { |
53 { |
24 recipe->name = name; |
54 recipe->name = name; |
80 ui->est_ibuShow->setRange(query.value(11).toDouble(), query.value(12).toDouble()); |
110 ui->est_ibuShow->setRange(query.value(11).toDouble(), query.value(12).toDouble()); |
81 ui->est_colorShow->setRange(query.value(13).toDouble(), query.value(14).toDouble()); |
111 ui->est_colorShow->setRange(query.value(13).toDouble(), query.value(14).toDouble()); |
82 ui->est_carbShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); |
112 ui->est_carbShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); |
83 ui->est_abvShow->setRange(query.value(17).toDouble(), query.value(18).toDouble()); |
113 ui->est_abvShow->setRange(query.value(17).toDouble(), query.value(18).toDouble()); |
84 |
114 |
|
115 calcStyle(); |
85 is_changed(); |
116 is_changed(); |
86 } |
117 } |
87 |
118 |
88 |
119 |
89 void EditRecipe::colormethod_changed(int val) |
120 void EditRecipe::colormethod_changed(int val) |