src/ChartiSpindel.cpp

Sun, 23 Jun 2024 11:51:22 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 23 Jun 2024 11:51:22 +0200
changeset 539
e5972bf6e50c
parent 537
48de0f61e5ea
permissions
-rw-r--r--

Archive products on code and on date all use the packaging date.

333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * ChartiSpindel.cpp is part of bmsapp.
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include "ChartiSpindel.h"
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
18 #include "callout.h"
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 #include "MainWindow.h"
498
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
20 #include "Utils.h"
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 ChartiSpindel::ChartiSpindel(QString code, QString name, QWidget *parent) : QDialog(parent)
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 {
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 QSqlQuery query;
537
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
26 double timestamp, poly[4], plato, angle;
498
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
27 double sg_min = 1.2, sg_max = 0.8, mg, sg;
494
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
28 double temp_min = 100, temp_max = 0, temp;
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
29 double batt_min = 4.5, batt_max = 3.0, batt;
537
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
30 bool polyvalid = false;
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 qDebug() << "ChartiSpindel:" << code << name;
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 QDialog* dialog = new QDialog(parent);
334
9203fa01ddbf Version 0.2.15 with updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 333
diff changeset
35 dialog->setWindowTitle(tr("BMSapp - iSpindel ") + "\"" + name + "\"");
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 dialog->setObjectName(QString::fromUtf8("ChartiSpindel"));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 dialog->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 dialog->resize(1024, 600);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
40 QPushButton *saveButton = new QPushButton(tr("Save"));
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
41 saveButton->setAutoDefault(false);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
42 QIcon icon1;
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
43 icon1.addFile(QString::fromUtf8(":icons/silk/disk.png"), QSize(), QIcon::Normal, QIcon::Off);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
44 saveButton->setIcon(icon1);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
45
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
48 buttonBox->setOrientation(Qt::Vertical);
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 buttonBox->setStandardButtons(QDialogButtonBox::Ok);
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
50 buttonBox->addButton(saveButton,QDialogButtonBox::ActionRole);
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51
537
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
52 /*
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
53 * Try to load the polynomial calibration data.
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
54 * This only succeeds for the current brew.
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
55 * For historical brews we need another way to load the correct record.
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
56 */
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
57 query.prepare("SELECT calibrate FROM mon_ispindels WHERE beercode=:beercode AND beername=:beername");
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
58 query.bindValue(":beercode", code);
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
59 query.bindValue(":beername", name);
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
60 query.exec();
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
61 if (query.next()) {
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
62 QJsonParseError parseError;
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
63 const auto& json = query.value("calibrate").toString();
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
64 if (!json.trimmed().isEmpty()) {
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
65 const auto& formattedJson = QString("%1").arg(json);
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
66 QJsonDocument jsonResponse = QJsonDocument::fromJson(formattedJson.toUtf8(), &parseError);
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
67 QJsonObject jsonObj = jsonResponse.object();
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
68 QJsonArray polyData = jsonObj.value("polyData").toArray();
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
69 if (polyData.size() == 4) {
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
70 for (int i = 0; i < polyData.size(); i++) {
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
71 poly[i] = polyData.at(i).toDouble();
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
72 }
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
73 polyvalid = true;
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
74 }
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
75 }
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
76 }
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
77 // qDebug() << "polyvalid" << polyvalid;
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
78
438
e06b04ef1579 Small changes to the iSpindel graph. Translated the dutch product edit window title.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
79 temperature = new QLineSeries();
e06b04ef1579 Small changes to the iSpindel graph. Translated the dutch product edit window title.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
80 density = new QLineSeries();
e06b04ef1579 Small changes to the iSpindel graph. Translated the dutch product edit window title.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
81 battery = new QLineSeries();
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 query.prepare("SELECT * FROM log_ispindel WHERE code=:code ORDER BY datetime");
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 query.bindValue(":code", code);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 query.exec();
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 while (query.next()) {
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 timestamp = query.value("datetime").toDateTime().toSecsSinceEpoch() * 1000;
537
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
88 if (polyvalid) {
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
89 angle = query.value("angle").toDouble();
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
90 plato = (poly[0] * pow(angle, 3)) + (poly[1] * pow(angle, 2)) + (poly[2] * angle) + poly[3];
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
91 mg = Utils::plato_to_sg(plato);
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
92 // qDebug() << "sg" << query.value("sg").toDouble() << "mg" << mg;
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
93 } else {
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
94 mg = query.value("sg").toDouble();
48de0f61e5ea The iSpindel monitor, detail and chart screens try to use the polynomial calibration data to show the SG. Fallback to already logged data if this fails.
Michiel Broek <mbroek@mbse.eu>
parents: 501
diff changeset
95 }
494
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
96 temp = query.value("temperature").toDouble();
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
97 if (ceil(temp) > temp_max)
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
98 temp_max = ceil(temp);
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
99 if (floor(temp) < temp_min)
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
100 temp_min = floor(temp);
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
101
498
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
102 /*
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
103 * Correct the SG plotline for temperature.
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
104 */
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
105 sg = Utils::HydroCorrection(mg, temp, 20.0);
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
106 if ((ceil(sg * 100) / 100) > sg_max)
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
107 sg_max = ceil(sg * 100) / 100;
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
108 if ((floor(sg * 100) / 100) < sg_min)
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
109 sg_min = floor(sg * 100) / 100;
c6f957fa7442 In fermentation plot draw the SG line with temperature compensation.
Michiel Broek <mbroek@mbse.eu>
parents: 494
diff changeset
110
494
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
111 batt = round(query.value("battery").toDouble() * 500) / 500;
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
112 if ((ceil(batt * 10) / 10) > batt_max)
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
113 batt_max = ceil(batt * 10) / 10;
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
114 if ((floor(batt * 10) / 10) < batt_min)
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
115 batt_min = floor(batt * 10) / 10;
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
116
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
117 temperature->append(timestamp, temp);
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
118 density->append(timestamp, sg);
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
119 battery ->append(timestamp, batt);
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 }
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
122 temperature->setName(tr("Temperature"));
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 temperature->setColor(QColorConstants::Svg::red);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 density->setName(tr("SG"));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 QPen pen(QColorConstants::Svg::navy);
434
ebf4996ab396 Charts downsize the pen from 3 to 2. Some nicer looking graphs.
Michiel Broek <mbroek@mbse.eu>
parents: 372
diff changeset
126 pen.setWidth(2);
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 density->setPen(pen);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 battery->setName(tr("Battery"));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 battery->setColor(QColorConstants::Svg::limegreen);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
131 chart = new QChart();
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 chart->setTitle(QString("%1 \"%2\"").arg(code).arg(name));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 chart->addSeries(battery);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 chart->addSeries(temperature);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 chart->addSeries(density);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 QDateTimeAxis *axisX = new QDateTimeAxis;
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 axisX->setTickCount(10);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 axisX->setFormat("dd MMM");
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 axisX->setTitleText(tr("Date"));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 axisX->setLabelsFont(QFont("Helvetica", 8, QFont::Normal));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 chart->addAxis(axisX, Qt::AlignBottom);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 battery->attachAxis(axisX);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 temperature->attachAxis(axisX);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 density->attachAxis(axisX);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 QValueAxis *axisYT = new QValueAxis;
494
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
148 axisYT->setRange(temp_min, temp_max);
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 axisYT->setTickCount(10);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 axisYT->setLabelFormat("%.1f");
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 axisYT->setTitleText(tr("Temperature °C"));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 axisYT->setLabelsFont(QFont("Helvetica", 8, QFont::Normal));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 chart->addAxis(axisYT, Qt::AlignRight);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 temperature->attachAxis(axisYT);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 QValueAxis *axisYD = new QValueAxis;
494
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
157 axisYD->setRange(sg_min, sg_max);
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 axisYD->setTickCount(10);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 axisYD->setLabelFormat("%.3f");
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 axisYD->setTitleText("SG");
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 axisYD->setLabelsFont(QFont("Helvetica", 8, QFont::Normal));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 chart->addAxis(axisYD, Qt::AlignLeft);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 density->attachAxis(axisYD);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 QValueAxis *axisYB = new QValueAxis;
494
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
166 axisYB->setRange(batt_min, batt_max);
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 axisYB->setTickCount(10);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 axisYB->setLabelFormat("%.2f");
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 axisYB->setTitleText(tr("Battery volt"));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 axisYB->setLabelsFont(QFont("Helvetica", 8, QFont::Normal));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 chart->addAxis(axisYB, Qt::AlignRight);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 battery->attachAxis(axisYB);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173
438
e06b04ef1579 Small changes to the iSpindel graph. Translated the dutch product edit window title.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
174 connect(temperature, &QLineSeries::hovered, this, &ChartiSpindel::tooltip);
e06b04ef1579 Small changes to the iSpindel graph. Translated the dutch product edit window title.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
175 connect(density, &QLineSeries::hovered, this, &ChartiSpindel::tooltip);
e06b04ef1579 Small changes to the iSpindel graph. Translated the dutch product edit window title.
Michiel Broek <mbroek@mbse.eu>
parents: 434
diff changeset
176 connect(battery, &QLineSeries::hovered, this, &ChartiSpindel::tooltip);
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
177
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
178 chartView = new QChartView(chart);
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 chartView->setRenderHint(QPainter::Antialiasing);
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
180 dialog->setLayout(new QHBoxLayout);
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 dialog->layout()->addWidget(chartView);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 dialog->layout()->addWidget(buttonBox);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 QObject::connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
186 QObject::connect(saveButton, SIGNAL(clicked()), this, SLOT(savePNG()));
333
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 dialog->setModal(true);
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189 dialog->exec();
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 }
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 ChartiSpindel::~ChartiSpindel() {}
499c95108bbd Moved Fermenter and iSpindel charts to their own functions. Added these to DetailFermenter and DetailiSpindel too.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
195
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
196 void ChartiSpindel::savePNG()
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
197 {
494
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
198 QSettings settings(QSettings::IniFormat, QSettings::UserScope, "mbse", "bmsapp");
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
199 QString dirName;
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
200
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
201 /*
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
202 * First check if the directory stored in the settings file exists.
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
203 * It might be on a removable media that was last used ...
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
204 * If so, fallback to the user's home directory.
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
205 */
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
206 dirName = settings.value("paths/download").toString();
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
207 if (! QDir(dirName).exists()) {
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
208 dirName = QDir::homePath();
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
209 }
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
210
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
211 QString path = QFileDialog::getSaveFileName(this, tr("Save Image"), dirName + "/ispindel.png", tr("Image (*.png)"));
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
212 if (path.isEmpty()) {
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
213 QMessageBox::warning(this, tr("Save File"), tr("No image file selected."));
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
214 return;
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
215 }
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
216
494
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
217 /*
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
218 * Update to current selected path
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
219 */
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
220 settings.setValue("paths/download", QFileInfo(path).absolutePath());
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
221
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
222 QImage img((chartView->size()), QImage::Format_ARGB32);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
223 QPainter painter;
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
224 painter.begin(&img);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
225 chartView->render(&painter);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
226 painter.setRenderHint(QPainter::Antialiasing);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
227 painter.end();
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
228 img.save(path);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
229 }
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
230
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
231
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
232 void ChartiSpindel::tooltip(QPointF point, bool state)
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
233 {
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
234 QAbstractSeries *series = qobject_cast<QAbstractSeries *>(sender());
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
235
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
236 if (t_tooltip == 0)
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
237 t_tooltip = new Callout(chart, series);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
238
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
239 if (state) {
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
240 QDateTime timeis = QDateTime::fromMSecsSinceEpoch(point.x());
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
241 t_tooltip->setSeries(series);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
242 if (series == temperature)
372
d9c78eb19728 Version 0.2.21. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 371
diff changeset
243 t_tooltip->setText(QString(tr("%1\nTemperature %2°C")).arg(timeis.toString("dd-MM-yyyy hh:mm")).arg(point.y(), 2, 'f', 1));
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
244 else if (series == density)
372
d9c78eb19728 Version 0.2.21. Updated translations.
Michiel Broek <mbroek@mbse.eu>
parents: 371
diff changeset
245 t_tooltip->setText(QString(tr("%1\nDensity %2 SG")).arg(timeis.toString("dd-MM-yyyy hh:mm")).arg(point.y(), 5, 'f', 4));
494
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
246 else if (series == battery) {
501
a01ae5ff0e96 New battery percentage formula for iSpindel in chart.
Michiel Broek <mbroek@mbse.eu>
parents: 498
diff changeset
247 const float battery_max = 4.13;
a01ae5ff0e96 New battery percentage formula for iSpindel in chart.
Michiel Broek <mbroek@mbse.eu>
parents: 498
diff changeset
248 const float battery_min = 3.43;
a01ae5ff0e96 New battery percentage formula for iSpindel in chart.
Michiel Broek <mbroek@mbse.eu>
parents: 498
diff changeset
249 double batt = ((point.y() - battery_min) / (battery_max - battery_min)) * 100;
494
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
250 if (batt < 0)
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
251 batt = 0;
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
252 if (batt > 100)
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
253 batt = 100;
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
254 t_tooltip->setText(QString(tr("%1\nBattery %2 volt\nCapacity %3%")).arg(timeis.toString("dd-MM-yyyy hh:mm"))
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
255 .arg(point.y(), 3, 'f', 2).arg(batt, 2, 'f', 1, '0'));
49ac23d25f61 In monitor iSpindel: in the chart calculate the ranges, do't let the toolkit do that. Save the path for chart image download in the user settings. In the tooltip for the battery voltage line, also show the remaining battery capacity. In the monitor window show the battery capacity digit instead of allways 0. Updated the translations.
Michiel Broek <mbroek@mbse.eu>
parents: 438
diff changeset
256 }
371
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
257 t_tooltip->setAnchor(point);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
258 t_tooltip->setZValue(11);
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
259 t_tooltip->updateGeometry();
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
260 t_tooltip->show();
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
261 } else {
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
262 t_tooltip->hide();
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
263 }
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
264 }
d03a426e0b6b On the fermenter, iSpindel, carbonation and brewday chart a tooltip with values is shown wheren hovering over the most important data lines. Changed the vertical to horzontal screen layout and added a save button to save the graph as .png image.
Michiel Broek <mbroek@mbse.eu>
parents: 334
diff changeset
265

mercurial