Fri, 10 Feb 2023 10:09:37 +0100
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
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 | * ChartFermenter.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 "ChartFermenter.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:
333
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" |
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
|
20 | |
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 | ChartFermenter::ChartFermenter(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
|
23 | { |
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 | QSqlQuery query; |
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 | double timestamp; |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
26 | bool use_air = false, use_beer=false, use_chiller = false, use_room = false; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
27 | bool use_sp_low = false, use_sp_high = false, use_heater = false, use_cooler = false; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
28 | QAreaSeries *pwr_cool, *pwr_heat; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
29 | QLineSeries *pv_air, *pv_beer, *pv_chiller; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
30 | QLineSeries *pwr_cool1, *pwr_cool0, *pwr_heat1, *pwr_heat0; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
31 | int min = 100, max = 0; |
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
|
32 | |
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 | qDebug() << "ChartFermenter:" << 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
|
34 | |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
35 | /* |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
36 | * First see which values are really used in the logfile. |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
37 | */ |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
38 | query.prepare("SELECT * FROM log_fermenter WHERE code=:code ORDER BY datetime"); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
39 | query.bindValue(":code", code); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
40 | query.exec(); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
41 | while (query.next()) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
42 | if (query.value("temp_air").toDouble() > 0) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
43 | use_air = true; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
44 | if (query.value("temp_beer").toDouble() > 0) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
45 | use_beer = true; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
46 | if (query.value("temp_chiller").toDouble() > 0) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
47 | use_chiller = true; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
48 | if (query.value("temp_room").toDouble() > 0) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
49 | use_room = true; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
50 | if (query.value("sp_low").toDouble() > 0) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
51 | use_sp_low = true; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
52 | if (query.value("sp_high").toDouble() > 0) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
53 | use_sp_high = true; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
54 | if (query.value("heater_power").toDouble() > 0) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
55 | use_heater = true; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
56 | if (query.value("cooler_power").toDouble() > 0) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
57 | use_cooler = true; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
58 | if (use_air && use_beer && use_chiller && use_room && use_sp_low && use_sp_high && use_heater && use_cooler) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
59 | break; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
60 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
61 | // qDebug() << "use" << use_air << use_beer << use_chiller << use_room << use_sp_low << use_sp_high << use_heater << use_cooler; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
62 | |
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
|
63 | QDialog* dialog = new 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
|
64 | dialog->setWindowTitle(tr("BMSapp - Fermenter log ") + "\"" + 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
|
65 | dialog->setObjectName(QString::fromUtf8("ChartFermenter")); |
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
|
66 | 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
|
67 | 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
|
68 | |
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:
333
diff
changeset
|
69 | 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:
333
diff
changeset
|
70 | 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:
333
diff
changeset
|
71 | 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:
333
diff
changeset
|
72 | 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:
333
diff
changeset
|
73 | 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:
333
diff
changeset
|
74 | |
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
|
75 | 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
|
76 | 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:
333
diff
changeset
|
77 | 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
|
78 | 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:
333
diff
changeset
|
79 | 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
|
80 | |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
81 | if (use_air) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
82 | pv_air = new QLineSeries(); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
83 | if (use_beer) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
84 | pv_beer = new QLineSeries(); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
85 | if (use_chiller) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
86 | pv_chiller = new QLineSeries(); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
87 | if (use_cooler) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
88 | pwr_cool1 = new QLineSeries(); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
89 | pwr_cool0 = new QLineSeries(); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
90 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
91 | if (use_heater) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
92 | pwr_heat1 = new QLineSeries(); // Top side of area |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
93 | pwr_heat0 = new QLineSeries(); // Bottom side of area |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
94 | } |
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
|
95 | |
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
|
96 | query.prepare("SELECT * FROM log_fermenter 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
|
97 | 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
|
98 | 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
|
99 | 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
|
100 | timestamp = query.value("datetime").toDateTime().toSecsSinceEpoch() * 1000; |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
101 | if (use_air) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
102 | pv_air->append(timestamp, query.value("temp_air").toDouble()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
103 | if (ceil(query.value("temp_air").toDouble()) > max) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
104 | max = ceil(query.value("temp_air").toDouble()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
105 | if (floor(query.value("temp_air").toDouble()) < min) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
106 | min = floor(query.value("temp_air").toDouble()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
107 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
108 | if (use_beer) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
109 | pv_beer->append(timestamp, query.value("temp_beer").toDouble()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
110 | if (ceil(query.value("temp_beer").toDouble()) > max) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
111 | max = ceil(query.value("temp_beer").toDouble()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
112 | if (floor(query.value("temp_beer").toDouble()) < min) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
113 | min = floor(query.value("temp_beer").toDouble()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
114 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
115 | if (use_chiller && query.value("temp_chiller").toDouble() > 0) { |
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
|
116 | pv_chiller->append(timestamp, query.value("temp_chiller").toDouble()); |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
117 | // if (ceil(query.value("temp_chiller").toDouble()) > max) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
118 | // max = ceil(query.value("temp_chiller").toDouble()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
119 | // if (floor(query.value("temp_chiller").toDouble()) < min) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
120 | // min = floor(query.value("temp_chiller").toDouble()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
121 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
122 | if (use_cooler) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
123 | pwr_cool0->append(timestamp, 0); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
124 | pwr_cool1->append(timestamp, query.value("cooler_power").toInt()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
125 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
126 | if (use_heater) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
127 | pwr_heat0->append(timestamp, 0); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
128 | pwr_heat1->append(timestamp, query.value("heater_power").toInt()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
129 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
130 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
131 | // qDebug() << "min" << min << "max" << max << "ticks" << max-min+1; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
132 | |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
133 | /* |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
134 | * If the range is small, increase it. |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
135 | */ |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
136 | if ((max - min) < 5) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
137 | min = max - 5; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
138 | } else if ((max - min) < 10) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
139 | min = max - 10; |
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
|
140 | } |
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 | |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
142 | if (use_air) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
143 | pv_air->setName(tr("Air")); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
144 | if (use_beer) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
145 | pv_air->setColor(QColorConstants::Svg::lightgreen); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
146 | } else { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
147 | /* |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
148 | * If there is no beer line, then make this one fat. |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
149 | */ |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
150 | QPen pen(QColorConstants::Svg::lightgreen); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
151 | pen.setWidth(2); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
152 | pv_air->setPen(pen); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
153 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
154 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
155 | if (use_beer) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
156 | pv_beer->setName(tr("Beer")); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
157 | QPen pen(QColorConstants::Svg::navy); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
158 | pen.setWidth(2); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
159 | pv_beer->setPen(pen); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
160 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
161 | if (use_chiller) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
162 | pv_chiller->setName(tr("Chiller")); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
163 | pv_chiller->setColor(QColorConstants::Svg::lightsalmon); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
164 | pv_chiller->setOpacity(0.75); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
165 | } |
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
|
166 | |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
167 | if (use_cooler) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
168 | pwr_cool = new QAreaSeries(pwr_cool0, pwr_cool1); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
169 | pwr_cool->setName("Cool %"); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
170 | pwr_cool->setOpacity(0.50); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
171 | pwr_cool->setColor(QColorConstants::Blue); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
172 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
173 | if (use_heater) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
174 | pwr_heat = new QAreaSeries(pwr_heat0, pwr_heat1); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
175 | pwr_heat->setName("Heat %"); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
176 | pwr_heat->setOpacity(0.50); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
177 | pwr_heat->setColor(QColorConstants::Red); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
178 | } |
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 | |
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:
333
diff
changeset
|
180 | 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
|
181 | chart->setTitle(QString("%1 \"%2\"").arg(code).arg(name)); |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
182 | if (use_cooler) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
183 | chart->addSeries(pwr_cool); // Order is important, first drawn is lowest layer. |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
184 | if (use_heater) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
185 | chart->addSeries(pwr_heat); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
186 | if (use_chiller) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
187 | chart->addSeries(pv_chiller); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
188 | if (use_air) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
189 | chart->addSeries(pv_air); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
190 | if (use_beer) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
191 | chart->addSeries(pv_beer); // Top layer |
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
|
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 | 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
|
194 | 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
|
195 | 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
|
196 | 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
|
197 | 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
|
198 | chart->addAxis(axisX, Qt::AlignBottom); |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
199 | if (use_air) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
200 | pv_air->attachAxis(axisX); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
201 | if (use_beer) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
202 | pv_beer->attachAxis(axisX); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
203 | if (use_chiller) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
204 | pv_chiller->attachAxis(axisX); |
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
|
205 | |
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
|
206 | QValueAxis *axisY = new QValueAxis; |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
207 | axisY->setRange(min, max); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
208 | axisY->setTickCount(max-min+1); |
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
|
209 | axisY->setMinorTickCount(1); |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
210 | axisY->setLabelFormat("%.1f"); |
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
|
211 | axisY->setTitleText(tr("Temp °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
|
212 | axisY->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
|
213 | chart->addAxis(axisY, Qt::AlignLeft); |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
214 | if (use_air) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
215 | pv_air->attachAxis(axisY); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
216 | if (use_beer) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
217 | pv_beer->attachAxis(axisY); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
218 | if (use_chiller) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
219 | pv_chiller->attachAxis(axisY); |
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
|
220 | |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
221 | if (use_heater || use_cooler) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
222 | QValueAxis *axisYR = new QValueAxis; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
223 | axisYR->setRange(0, 100); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
224 | axisYR->setTickCount(11); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
225 | axisYR->setLabelFormat("%i"); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
226 | axisYR->setTitleText(tr("Power %")); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
227 | axisYR->setLabelsFont(QFont("Helvetica", 8, QFont::Normal)); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
228 | chart->addAxis(axisYR, Qt::AlignRight); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
229 | if (use_cooler) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
230 | pwr_cool->attachAxis(axisYR); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
231 | if (use_heater) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
232 | pwr_heat->attachAxis(axisYR); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
233 | } |
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
|
234 | |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
235 | if (use_air) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
236 | connect(pv_air, &QLineSeries::hovered, this, &ChartFermenter::tooltip); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
237 | if (use_beer) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
238 | connect(pv_beer, &QLineSeries::hovered, this, &ChartFermenter::tooltip); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
239 | if (use_chiller) |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
240 | connect(pv_chiller, &QLineSeries::hovered, this, &ChartFermenter::tooltip); |
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
|
241 | |
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:
333
diff
changeset
|
242 | 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
|
243 | 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:
333
diff
changeset
|
244 | 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
|
245 | 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
|
246 | 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
|
247 | |
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
|
248 | 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
|
249 | 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:
333
diff
changeset
|
250 | 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
|
251 | |
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
|
252 | 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
|
253 | 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
|
254 | } |
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
|
255 | |
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
|
256 | |
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
|
257 | ChartFermenter::~ChartFermenter() {} |
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
|
258 | |
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:
333
diff
changeset
|
259 | |
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:
333
diff
changeset
|
260 | void ChartFermenter::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:
333
diff
changeset
|
261 | { |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
262 | QSettings settings(QSettings::IniFormat, QSettings::UserScope, "mbse", "bmsapp"); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
263 | QString dirName; |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
264 | |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
265 | /* |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
266 | * First check if the directory stored in the settings file exists. |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
267 | * It might be on a removable media that was last used ... |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
268 | * If so, fallback to the user's home directory. |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
269 | */ |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
270 | dirName = settings.value("paths/download").toString(); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
271 | if (! QDir(dirName).exists()) { |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
272 | dirName = QDir::homePath(); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
273 | } |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
274 | |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
275 | QString path = QFileDialog::getSaveFileName(this, tr("Save Image"), dirName + "/fermenter.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:
333
diff
changeset
|
276 | 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:
333
diff
changeset
|
277 | 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:
333
diff
changeset
|
278 | 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:
333
diff
changeset
|
279 | } |
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:
333
diff
changeset
|
280 | |
490
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
281 | /* |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
282 | * Update to current selected path |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
283 | */ |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
284 | settings.setValue("paths/download", QFileInfo(path).absolutePath()); |
b67fb2e5bb41
Fermenter charts, only draw lines that are really used. Better auto scaling, not using the internal version. If only a air line is to be shown, make it fat. Save the path to download the image in the settings file.
Michiel Broek <mbroek@mbse.eu>
parents:
434
diff
changeset
|
285 | |
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:
333
diff
changeset
|
286 | 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:
333
diff
changeset
|
287 | 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:
333
diff
changeset
|
288 | 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:
333
diff
changeset
|
289 | 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:
333
diff
changeset
|
290 | 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:
333
diff
changeset
|
291 | 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:
333
diff
changeset
|
292 | 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:
333
diff
changeset
|
293 | } |
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:
333
diff
changeset
|
294 | |
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:
333
diff
changeset
|
295 | |
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:
333
diff
changeset
|
296 | void ChartFermenter::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:
333
diff
changeset
|
297 | { |
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:
333
diff
changeset
|
298 | 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:
333
diff
changeset
|
299 | |
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:
333
diff
changeset
|
300 | 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:
333
diff
changeset
|
301 | 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:
333
diff
changeset
|
302 | |
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:
333
diff
changeset
|
303 | 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:
333
diff
changeset
|
304 | 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:
333
diff
changeset
|
305 | //qDebug() << "tooltip" << QString("%1 %2°C").arg( timeis.toString("dd-MM-yyyy hh:mm") ).arg(point.y(), 2, 'f', 1); |
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:
333
diff
changeset
|
306 | |
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:
333
diff
changeset
|
307 | 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:
333
diff
changeset
|
308 | t_tooltip->setText(QString("%1\n%2 %3°C").arg(timeis.toString("dd-MM-yyyy hh:mm")).arg(series->name()).arg(point.y(), 2, 'f', 1)); |
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:
333
diff
changeset
|
309 | 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:
333
diff
changeset
|
310 | 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:
333
diff
changeset
|
311 | 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:
333
diff
changeset
|
312 | 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:
333
diff
changeset
|
313 | } 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:
333
diff
changeset
|
314 | 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:
333
diff
changeset
|
315 | } |
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:
333
diff
changeset
|
316 | } |
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:
333
diff
changeset
|
317 |