# HG changeset patch # User Michiel Broek # Date 1717269054 -7200 # Node ID 3b9abdae181e98d603d88186e0fa1d405e1479e9 # Parent e6a4a3a2958425a215979c24e37903f4de771666 Added fields for target_water and auto upgrade the products table diff -r e6a4a3a29584 -r 3b9abdae181e src/database/db_product.cpp --- a/src/database/db_product.cpp Sat Jun 01 15:19:08 2024 +0200 +++ b/src/database/db_product.cpp Sat Jun 01 21:10:54 2024 +0200 @@ -23,6 +23,31 @@ { QSqlQuery query, yquery; + /* + * Upgrade database extra columns for target water. + */ + query.exec("SHOW COLUMNS FROM `products` LIKE 'tw_name'"); + if (! query.first()) { + qWarning() << "loadProduct upgrade for target water"; + QString sql = "ALTER TABLE `products` ADD `tw_name` VARCHAR(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL AFTER `calc_acid`, "; + sql.append("ADD `tw_calcium` FLOAT NOT NULL DEFAULT '0' AFTER `tw_name`, "); + sql.append("ADD `tw_sulfate` FLOAT NOT NULL DEFAULT '0' AFTER `tw_calcium`, "); + sql.append("ADD `tw_chloride` FLOAT NOT NULL DEFAULT '0' AFTER `tw_sulfate`, "); + sql.append("ADD `tw_sodium` FLOAT NOT NULL DEFAULT '0' AFTER `tw_chloride`, "); + sql.append("ADD `tw_magnesium` FLOAT NOT NULL DEFAULT '0' AFTER `tw_sodium`, "); + sql.append("ADD `tw_total_alkalinity` FLOAT NOT NULL DEFAULT '0' AFTER `tw_magnesium`;"); +// qDebug() << sql; + query.exec(sql); + if (query.lastError().isValid()) { + qWarning() << "loadProduct upgrade" << query.lastError(); + QMessageBox::warning(dialog, QObject::tr("Database error"), + QObject::tr("MySQL error: %1\n%2\n%3") + .arg(query.lastError().nativeErrorCode()) + .arg(query.lastError().driverText()) + .arg(query.lastError().databaseText())); + } + } + query.prepare("SELECT * FROM products WHERE record = :recno"); query.bindValue(":recno", recno); query.exec(); diff -r e6a4a3a29584 -r 3b9abdae181e src/global.h --- a/src/global.h Sat Jun 01 15:19:08 2024 +0200 +++ b/src/global.h Sat Jun 01 21:10:54 2024 +0200 @@ -610,6 +610,14 @@ QString mash_name; bool calc_acid; + QString tw_name; ///< Target water (since 0.4.6) + double tw_calcium; + double tw_sulfate; + double tw_chloride; + double tw_sodium; + double tw_magnesium; + double tw_total_alkalinity; + QString w1_name; ///< Water source 1 double w1_amount; double w1_calcium; @@ -638,6 +646,7 @@ double wg_magnesium; double wg_total_alkalinity; double wg_ph; + double wb_calcium; ///< Treated water double wb_sulfate; double wb_chloride; diff -r e6a4a3a29584 -r 3b9abdae181e translations/bmsapp_en.ts --- a/translations/bmsapp_en.ts Sat Jun 01 15:19:08 2024 +0200 +++ b/translations/bmsapp_en.ts Sat Jun 01 21:10:54 2024 +0200 @@ -2483,14 +2483,14 @@ - + Save - + @@ -2535,8 +2535,8 @@ - - + + Efficiency: @@ -2567,22 +2567,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + % @@ -2590,12 +2590,12 @@ - - - - - - + + + + + + min @@ -2620,24 +2620,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + L @@ -2879,7 +2879,18 @@ - + + + Total brew and sparge water supply + + + + + Total needed mixed water + + + + Top up water: @@ -2947,7 +2958,7 @@ - + Kettle trub loss: @@ -3006,7 +3017,7 @@ - + Add @@ -3089,10 +3100,10 @@ - - - - + + + + Set or clear date @@ -3101,29 +3112,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + ... @@ -3180,7 +3191,7 @@ - + Set the date to today. @@ -3191,12 +3202,12 @@ - - - - - - + + + + + + dd-MM-yyyy @@ -3336,8 +3347,8 @@ - - + + gr @@ -3494,791 +3505,791 @@ - - Mixed water - - - - + The division between the main and dilution water. The total volume does not change. - + Optional dilution water - + Choose dilution - + Hardness - + Mg - + pH - + RA - + + Total brew and sparge water supply without optional dilution water + + + + CaCO3 - + The main brewing water - + Choose water - + Cl - + Na - + Ca - + SO4 - + Volume - + HCO3 - + Water profile - + Sparge water source 1 - + Sparge water source 2 - + Sparge water mixed - + Sparge - + Treated sparge water - + Brewday - + Brewday plan: - + Brewday end: - + Mashing and Sparge - + Mash pH: - + Mash SG: - + Mash efficiency: - + Sparge water pH: - + Sparge supply: - + Sparge estimate: - + Sparge temp: - - - - - - - - - + + + + + + + + + °C - + Pre boil - - + + Measured pH: - - + + Measured SG: - - + + Volume @100°C: - + Mash, sparge and lauter efficiency. - - - - + + + + Edit volume - + Whirlpools - + Whirlpool 72..79°C: - + Whirlpool 60..66°C: - + Whirlpool cold: - + Whirlpool 85..100°C: - + Transfer to fermenter - + Volume to fermenter: - + SG in fermenter: - + EBC color in fermenter: - + IBU in fermenter: - + Aeration time & speed: - + L/m - + Aeration with: - - - - + + + + Brew log chart - + Cooling - + Cooling method: - + Cooling to: - + Cooling time: - + After boil - + The overall efficiency. - + Edit the brewdate plan or start. - + Clear planned brewdate - + Edit the brewdate start time. - - + + hh:mm - + Edit the brewdate end. - + Edit the brewdate end time. - + Set the brewdate end date. - + End time: - + Start time: - + Show brewlog: - + Confirm brew done: - - - + + + Confirm the brew dates and times. - + Fermenting - + Primary fermentation - + Start density: - + Start temperature: - + Peak temperature: - - + + End temperature: - - + + End density: - - + + End date: - - - + + + Apparent attenuation: - - - + + + Edit SG in Plato, Brix or SG - - + + Set the date to today - + Edit the date the primary fermentation was done. - + Secondary fermentation - + Edit the date the secondary fermentation was done. - + Tertiary fermentation - + Average temperature: - + Final density: - + Expected end density: - + Alcohol volume: - + Show fermenter unit log: - + Show fermentation log: - + Package - + Package date: - + Carbonation range: - + Infusion or Dilution - + Package volume: - + Extra added volume: - + Extra remarks: - + Estimated final ABV %: - + Estimated final IBU: - + Estimated final EBC: - + Extra added ABV %: - + pH from fermenter: - + Extra dilution or infusion added to this batch. - - + + The ABV including the infusion. - + If there is alcohol in the infusion, give the percentage. - + Could be the description of the infusion. - + Estimated package ABV %: - + Bottles - - + + Volume: - - + + Desired volume CO2: - - + + Priming sugar: - - + + Sugar amount: - - + + Priming: - - + + Water amount: - + Bottle fermentation: - - + + gr/L - + Expected pressure in bar: - + Bottles ABV %: - + Kegs - + Kegs ABV %: - + Kegs pressure in bar: - + Kegs temperature: - + Forced carbonation: - + Edit the package date. - + Show carbonation log: - + Tasting - + Taste date: - + Taste rate: - + Color: - + Transparency: - + Head: - + Aroma: - + Taste: - + Aftertaste: - + Mouthfeel: - + Notes: - + Edit the tasting date. - + Images - + Previous - + Next - + Filename: - + Comment: - + Type: - + Export - - + + Print @@ -5419,7 +5430,7 @@ - + Image here @@ -12483,23 +12494,25 @@ - - - + + + + Database error - + MySQL error: record %1 not found - - + + + MySQL error: %1 %2 %3 diff -r e6a4a3a29584 -r 3b9abdae181e translations/bmsapp_nl.ts --- a/translations/bmsapp_nl.ts Sat Jun 01 15:19:08 2024 +0200 +++ b/translations/bmsapp_nl.ts Sat Jun 01 21:10:54 2024 +0200 @@ -2820,14 +2820,14 @@ - + Save Bewaar - + @@ -2872,8 +2872,8 @@ - - + + Efficiency: Rendement: @@ -2904,22 +2904,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + % % @@ -2927,12 +2927,12 @@ - - - - - - + + + + + + min min @@ -2957,24 +2957,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + L @@ -3169,7 +3169,7 @@ Trub koeler verlies: - + Top up water: Extra water in gistvat: @@ -3242,7 +3242,7 @@ - + Add Nieuw @@ -3304,10 +3304,10 @@ - - - - + + + + Set or clear date Zet of wis datum @@ -3316,29 +3316,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + ... ... @@ -3394,7 +3394,7 @@ - + Set the date to today. Zet de datum op vandaag. @@ -3405,12 +3405,12 @@ - - - - - - + + + + + + dd-MM-yyyy dd-MM-yyyy @@ -3456,55 +3456,55 @@ Water overzicht - + Ca Ca - + Mg Mg - + HCO3 HCO3 - + CaCO3 CaCO3 - + Na Na - + Cl Cl - + SO4 SO4 - + pH pH - + Volume Volume - + The division between the main and dilution water. The total volume does not change. De verdeling tussen het hoofd en verdunnings water. Het totale volume blijft gelijk. @@ -3549,27 +3549,27 @@ De ideale hoeveelheid Zout moet minder dan 150 zijn. - + Water profile Water profiel - + The main brewing water Het hoofd brouwwater - + Choose water Kies water - + Optional dilution water Optioneel meng water - + Choose dilution Kies mengwater @@ -3579,21 +3579,20 @@ Indien nodig, kies een doel water profiel. - Mixed water - Gemengd water + Gemengd water Treated water Behandeld water - + RA - + Hardness Hardheid @@ -3722,8 +3721,8 @@ - - + + gr gr @@ -3835,92 +3834,92 @@ Geschat voor kook pH: - + Brewday Brouwdag - + Sparge supply: Spoelwater voorraad: - + Sparge estimate: Spoelwater geschat: - + Sparge temp: Spoelwater temp: - + Start density: Begin densiteit: - + Start temperature: Start temperatuur: - + Peak temperature: Piek temperatuur: - - + + End temperature: Eind temperatuur: - - + + End density: Eind densiteit: - - + + End date: Eind datum: - - - + + + Apparent attenuation: Schijnbare vergisting: - + Edit the date the secondary fermentation was done. Wijzig de datum dat de nagisting gereed was. - + Average temperature: Gemiddelde temperatuur: - + Final density: Finale densiteit: - + Expected end density: Verwachte eind densiteit: - + Extra added volume: Toevoeging volume: - + Extra remarks: Toevoeging opmerking: @@ -3930,45 +3929,45 @@ Finale ABV %: - + Extra added ABV %: Toevoeging extra ABV %: - + Estimated final IBU: Verwacht finale IBU: - + Estimated final EBC: Verwacht finale EBC: - - + + Volume: Volume: - - + + Priming: Carbonatie: - + Bottle fermentation: Flessen hergisting: - - + + gr/L gr/L - + Kegs temperature: Fusten temperatuur: @@ -3977,32 +3976,32 @@ Brouwdag start: - + Brewday end: Brouwdag eind: - + Mashing and Sparge Maischen en Spoelen - + Mash pH: Maisch pH: - + Mash SG: Maisch SG: - + Mash efficiency: Maisch rendement: - + Sparge water pH: Spoelwater pH: @@ -4035,94 +4034,94 @@ Voor koken rendement: - - - - + + + + Edit volume Wijzig volume - + Whirlpool cold: Whirlpool koud: - + Aeration time & speed: Beluchten tijd snelheid: - + Cooling method: Koelen methode: - + Cooling time: Koelen tijd: - + Transfer to fermenter Naar gistvat - + Brewday plan: Brouwdag plan: - - - - - - - - - + + + + + + + + + °C °C - + Pre boil Begin koken - - + + Volume @100°C: Volume @100°C: - + Mash, sparge and lauter efficiency. Maischen, spoelen en filteren rendement. - + Whirlpools Whirlpoolen - + Whirlpool 72..79°C: Whirlpool 72..79°C: - + Whirlpool 60..66°C: Whirlpool 60..66°C: - + Whirlpool 85..100°C: Whirlpool 85..100°C: - + Volume to fermenter: Volume naar gistvat: @@ -4131,17 +4130,17 @@ Trub en koeler verlies: - + SG in fermenter: SG in gistvat: - + EBC color in fermenter: EBC kleur in gistvat: - + IBU in fermenter: IBU in het gistvat: @@ -4150,7 +4149,7 @@ Beluchten - + Aeration with: Beluchten met: @@ -4163,177 +4162,177 @@ Beluchten snelheid: - + L/m L/m - - - - + + + + Brew log chart Brouw log grafiek - + Cooling Koelen - + Cooling to: Koelen tot: - + After boil Einde koken - + The overall efficiency. Het totale brouwzaal rendement. - + Edit the brewdate plan or start. Wijzig de brouwdag plan of start datum. - + Clear planned brewdate Wis geplande brouwdag - + Edit the brewdate start time. Wijzig de brouwdag start tijd. - - + + hh:mm hh:mm - + Edit the brewdate end. Wijzig de brouwdag eind datum. - + Edit the brewdate end time. Wijzig de brouwdag eind tijd. - + Set the brewdate end date. Zet de brouwdag eind datum. - + End time: Eind tijd: - + Start time: Start tijd: - + Show brewlog: Toon brouwlog: - + Confirm brew done: Bevestig brouwdag: - - - + + + Confirm the brew dates and times. Bevestig de brouw datums en tijden. - + Fermenting Vergisten - + Primary fermentation Hoofdvergisting - - - + + + Edit SG in Plato, Brix or SG Wijzig SG in Plato, Brix of SG - - + + Set the date to today Zet de datum op vandaag - + Edit the date the primary fermentation was done. Wijzig de datum dat de hoofdgisting gereed was. - + Secondary fermentation Nagisting - + Tertiary fermentation Lageren - + Alcohol volume: Alcohol vol%: - + Show fermenter unit log: Toon gistkast log: - + Show fermentation log: Toon vergisting log: - + Package Verpakken - + Package date: Verpakken datum: - + Carbonation range: Koolzuur volumes: - + Infusion or Dilution Infusie of verdunnen - + Package volume: Verpakken volume: @@ -4343,7 +4342,7 @@ Verpakken ABV %: - + pH from fermenter: pH vanuit gistvat: @@ -4448,7 +4447,7 @@ - + Kettle trub loss: Kookketel trub verlies: @@ -4533,229 +4532,245 @@ Behandeld maisch water - + + + Total brew and sparge water supply + + + + + Total needed mixed water + + + + + Total brew and sparge water supply without optional dilution water + + + + Sparge water source 1 Spoelwater bron 1 - + Sparge water source 2 Spoelwater bron 2 - + Sparge water mixed Gemengd spoelwater - + Sparge Spoel - + Treated sparge water Behandeld spoelwater - + Estimated final ABV %: Verwacht finale ABV %: - + Extra dilution or infusion added to this batch. Toegevoegde verdunning of infusie aan deze batch. - - + + The ABV including the infusion. Het ABV inclusief infusie. - + If there is alcohol in the infusion, give the percentage. Als er alcohol in de infusie zit, geef hier het percentage. - + Could be the description of the infusion. Hier kun je de toevoeging beschrijven. - + Estimated package ABV %: Verwacht verpakken ABV %: - + Bottles Flessen - - + + Desired volume CO2: Gewenst volume CO2: - - + + Priming sugar: Carbonatie suiker: - - + + Sugar amount: Suiker gewicht: - - + + Water amount: Water volume: - + Expected pressure in bar: Verwachte druk in bar: - + Bottles ABV %: Flessen ABV %: - + Kegs Fusten - + Kegs ABV %: Fusten ABV %: - + Kegs pressure in bar: Fusten druk in bar: - + Forced carbonation: Geforceerde carbonatie: - + Edit the package date. Wijzig de verpakkings datum. - + Show carbonation log: Toon carbonatie log: - + Tasting Proeven - + Taste date: Proeven datum: - + Taste rate: Beoordeling cijfer: - + Color: Kleur: - + Transparency: Helderheid: - + Head: Schuim: - + Aroma: Geur: - + Taste: Smaak: - + Aftertaste: Nasmaak: - + Mouthfeel: Mondgevoel: - + Notes: Opmerkingen: - + Edit the tasting date. Wijzig de datum van proeven. - + Images Plaatjes - + Previous Vorige - + Next Volgende - + Filename: Bestand: - + Comment: Bijschrift: - + Type: Soort: - + Export Exporteer - - + + Print Print @@ -5587,8 +5602,8 @@ Verwarm tijd: - - + + Measured pH: Gemeten pH: @@ -5599,8 +5614,8 @@ Gemeten Brix: - - + + Measured SG: Gemeten SG: @@ -6068,7 +6083,7 @@ Kan niet laden %1: %2 - + Image here Plaatje hier @@ -14175,23 +14190,25 @@ - - - + + + + Database error Database fout - + MySQL error: record %1 not found MySQL fout: record %1 niet gevonden - - + + + MySQL error: %1 %2 %3 diff -r e6a4a3a29584 -r 3b9abdae181e ui/EditProduct.ui --- a/ui/EditProduct.ui Sat Jun 01 15:19:08 2024 +0200 +++ b/ui/EditProduct.ui Sat Jun 01 21:10:54 2024 +0200 @@ -95,7 +95,7 @@ QTabWidget::Rounded - 10 + 7 Qt::ElideNone @@ -5471,7 +5471,7 @@ 750 - 160 + 220 71 24 @@ -5496,7 +5496,7 @@ 670 - 160 + 220 71 24 @@ -5521,7 +5521,7 @@ 590 - 160 + 220 71 24 @@ -5546,7 +5546,7 @@ 1070 - 160 + 220 71 24 @@ -5574,7 +5574,7 @@ 910 - 160 + 220 71 24 @@ -5599,7 +5599,7 @@ 830 - 160 + 220 71 24 @@ -5624,7 +5624,7 @@ 430 - 160 + 220 71 24 @@ -5649,7 +5649,7 @@ 510 - 160 + 220 71 24 @@ -5674,7 +5674,7 @@ 250 - 160 + 220 81 24 @@ -5705,7 +5705,7 @@ 990 - 160 + 220 71 24 @@ -5730,7 +5730,7 @@ 350 - 160 + 220 71 24 @@ -5755,7 +5755,7 @@ 10 - 210 + 40 181 23 @@ -5771,7 +5771,7 @@ 990 - 210 + 40 71 24 @@ -5796,7 +5796,7 @@ 830 - 210 + 40 71 24 @@ -5821,7 +5821,7 @@ 670 - 210 + 40 71 24 @@ -5846,7 +5846,7 @@ 1070 - 210 + 40 71 24 @@ -5874,7 +5874,7 @@ 590 - 210 + 40 71 24 @@ -5899,7 +5899,7 @@ 350 - 210 + 40 71 24 @@ -5924,7 +5924,7 @@ 750 - 210 + 40 71 24 @@ -5949,7 +5949,7 @@ 430 - 210 + 40 71 24 @@ -5974,7 +5974,7 @@ 510 - 210 + 40 71 24 @@ -5999,7 +5999,7 @@ 510 - 130 + 190 71 24 @@ -6027,7 +6027,7 @@ 990 - 130 + 190 71 24 @@ -6052,7 +6052,7 @@ 10 - 130 + 190 171 21 @@ -6068,7 +6068,7 @@ 910 - 130 + 190 71 24 @@ -6096,7 +6096,7 @@ 670 - 130 + 190 71 24 @@ -6124,7 +6124,7 @@ 590 - 130 + 190 71 24 @@ -6149,7 +6149,7 @@ 750 - 130 + 190 71 24 @@ -6178,7 +6178,7 @@ 350 - 130 + 190 71 24 @@ -6206,7 +6206,7 @@ 1070 - 130 + 190 71 24 @@ -6234,7 +6234,7 @@ 430 - 130 + 190 71 24 @@ -6262,7 +6262,7 @@ 830 - 130 + 190 71 24 @@ -6291,7 +6291,7 @@ 510 - 100 + 130 71 24 @@ -6316,7 +6316,7 @@ 1070 - 100 + 130 71 24 @@ -6344,13 +6344,16 @@ 10 - 100 + 130 171 21 - - Mixed water + + Total brew and sparge water supply + + + Total needed mixed water Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -6360,7 +6363,7 @@ 350 - 100 + 130 71 24 @@ -6385,7 +6388,7 @@ 990 - 100 + 130 71 24 @@ -6410,10 +6413,13 @@ 250 - 100 - 71 - 24 - + 130 + 71 + 24 + + + + Total brew and sparge water supply Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -6438,7 +6444,7 @@ 670 - 100 + 130 71 24 @@ -6463,7 +6469,7 @@ 750 - 100 + 130 71 24 @@ -6488,7 +6494,7 @@ 430 - 100 + 130 71 24 @@ -6513,7 +6519,7 @@ 830 - 100 + 130 71 24 @@ -6538,7 +6544,7 @@ 590 - 100 + 130 71 24 @@ -6563,7 +6569,7 @@ 910 - 100 + 130 71 24 @@ -6588,7 +6594,7 @@ 1070 - 70 + 100 71 24 @@ -6616,7 +6622,7 @@ 350 - 70 + 100 71 24 @@ -6641,7 +6647,7 @@ 830 - 70 + 100 71 24 @@ -6666,7 +6672,7 @@ 430 - 70 + 100 71 24 @@ -6691,7 +6697,7 @@ 910 - 70 + 100 71 24 @@ -6716,7 +6722,7 @@ 990 - 70 + 100 71 24 @@ -6741,7 +6747,7 @@ 250 - 70 + 100 85 24 @@ -6778,7 +6784,7 @@ 670 - 70 + 100 71 24 @@ -6803,7 +6809,7 @@ 750 - 70 + 100 71 24 @@ -6828,7 +6834,7 @@ 10 - 70 + 100 181 23 @@ -6844,7 +6850,7 @@ 590 - 70 + 100 71 24 @@ -6869,7 +6875,7 @@ 510 - 70 + 100 71 24 @@ -6894,7 +6900,7 @@ 430 - 40 + 70 71 24 @@ -6919,7 +6925,7 @@ 510 - 40 + 70 71 24 @@ -6960,7 +6966,7 @@ 910 - 40 + 70 71 24 @@ -7045,7 +7051,7 @@ 990 - 40 + 70 71 24 @@ -7070,10 +7076,13 @@ 250 - 40 - 71 - 24 - + 70 + 71 + 24 + + + + Total brew and sparge water supply without optional dilution water Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -7101,7 +7110,7 @@ 830 - 40 + 70 71 24 @@ -7142,7 +7151,7 @@ 590 - 40 + 70 71 24 @@ -7167,7 +7176,7 @@ 1070 - 40 + 70 71 24 @@ -7195,7 +7204,7 @@ 10 - 40 + 70 181 23 @@ -7326,7 +7335,7 @@ 750 - 40 + 70 71 24 @@ -7351,7 +7360,7 @@ 350 - 40 + 70 71 24 @@ -7376,7 +7385,7 @@ 670 - 40 + 70 71 24 @@ -7401,7 +7410,7 @@ 210 - 40 + 70 21 21 @@ -7423,7 +7432,7 @@ 210 - 70 + 100 21 21 @@ -7442,7 +7451,7 @@ 210 - 100 + 130 21 21 @@ -7474,7 +7483,7 @@ 10 - 160 + 220 171 21 @@ -10703,7 +10712,7 @@ 14.000000000000000 - 0.010000000000000 + 0.100000000000000