14 * GNU General Public License for more details. |
14 * GNU General Public License for more details. |
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 |
|
20 |
|
21 void EditProduct::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 = product->st_ibu_min / ((product->st_og_min - 1) * 1000); |
|
30 double bugu_max = product->st_ibu_max / ((product->st_og_max - 1) * 1000); |
|
31 ui->est_buguShow->setRange(bugu_min, bugu_max); |
|
32 |
|
33 double fg_min = product->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(product->st_og_min) + Utils::sg_to_plato(product->st_og_max)) / 2)) + |
|
41 (0.8192 * ((Utils::sg_to_plato(fg_min) + Utils::sg_to_plato(product->st_fg_max)) / 2))); |
|
42 |
|
43 /* BU:RE */ |
|
44 double bure_min = product->st_ibu_min / re; |
|
45 double bure_max = product->st_ibu_max / re; |
|
46 ui->est_bufguShow->setRange(bure_min, bure_max); |
|
47 |
|
48 qDebug() << "BU:RE" << bure_min << bure_max; |
|
49 } |
19 |
50 |
20 |
51 |
21 void EditProduct::code_changed(QString code) |
52 void EditProduct::code_changed(QString code) |
22 { |
53 { |
23 product->code = code; |
54 product->code = code; |
86 ui->est_ibuShow->setRange(query.value(11).toDouble(), query.value(12).toDouble()); |
117 ui->est_ibuShow->setRange(query.value(11).toDouble(), query.value(12).toDouble()); |
87 ui->est_colorShow->setRange(query.value(13).toDouble(), query.value(14).toDouble()); |
118 ui->est_colorShow->setRange(query.value(13).toDouble(), query.value(14).toDouble()); |
88 ui->est_carbShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); |
119 ui->est_carbShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); |
89 ui->est_abvShow->setRange(query.value(17).toDouble(), query.value(18).toDouble()); |
120 ui->est_abvShow->setRange(query.value(17).toDouble(), query.value(18).toDouble()); |
90 |
121 |
|
122 calcStyle(); |
91 is_changed(); |
123 is_changed(); |
92 } |
124 } |
93 |
125 |
94 |
126 |
95 void EditProduct::colormethod_changed(int val) |
127 void EditProduct::colormethod_changed(int val) |