Mon, 18 Apr 2022 20:00:49 +0200
Added calcYeast(). Added show svg from calcFermentables() on the yeast tab. Fixed wrong data displayed in the yeast table. Show estimated needed dry yeast or starters.
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * ProfileWaters.cpp is part of bmsapp. |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * bmsapp is free software: you can redistribute it and/or modify |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * it under the terms of the GNU General Public License as published by |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * the Free Software Foundation, either version 3 of the License, or |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * (at your option) any later version. |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * bmsapp is distributed in the hope that it will be useful, |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * GNU General Public License for more details. |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * You should have received a copy of the GNU General Public License |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | #include "ProfileWaters.h" |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | #include "EditProfileWater.h" |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
19 | #include "MainWindow.h" |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | #include "config.h" |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
23 | ProfileWaters::ProfileWaters(QWidget *parent) : QDialog(parent) |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | qDebug() << "ProfileWaters start"; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
27 | gridLayout = new QGridLayout(this); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
28 | gridLayout->setObjectName(QString::fromUtf8("gridLayout")); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
29 | tableWaters = new QTableWidget(this); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
30 | tableWaters->setObjectName(QString::fromUtf8("tableWaters")); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
31 | tableWaters->setEnabled(true); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
32 | QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
33 | sizePolicy.setHorizontalStretch(0); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
34 | sizePolicy.setVerticalStretch(0); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
35 | tableWaters->setSizePolicy(sizePolicy); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
36 | tableWaters->setMinimumSize(QSize(1154, 0)); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
37 | gridLayout->addWidget(tableWaters, 0, 0, 1, 1); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
38 | |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
39 | groupBox = new QGroupBox(this); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
40 | groupBox->setObjectName(QString::fromUtf8("groupBox")); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
41 | groupBox->setEnabled(true); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
42 | groupBox->setFlat(false); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
43 | horizontalLayout = new QHBoxLayout(groupBox); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
44 | horizontalLayout->setSpacing(6); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
45 | horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
46 | horizontalLayout->setContentsMargins(0, 0, 0, 0); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
47 | |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
48 | quitButton = new QPushButton(groupBox); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
49 | quitButton->setObjectName(QString::fromUtf8("quitButton")); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
50 | quitButton->setMinimumSize(QSize(80, 24)); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
51 | quitButton->setText(tr("Quit")); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
52 | QIcon icon; |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
53 | icon.addFile(QString::fromUtf8(":icons/silk/door_out.png"), QSize(), QIcon::Normal, QIcon::Off); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
54 | quitButton->setIcon(icon); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
55 | horizontalLayout->addWidget(quitButton, 0, Qt::AlignLeft); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
56 | |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
57 | insertButton = new QPushButton(groupBox); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
58 | insertButton->setObjectName(QString::fromUtf8("insertButton")); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
59 | insertButton->setMinimumSize(QSize(80, 24)); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
60 | insertButton->setText(tr("New")); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
61 | QIcon icon3; |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
62 | icon3.addFile(QString::fromUtf8(":icons/silk/table_row_insert.png"), QSize(), QIcon::Normal, QIcon::Off); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
63 | insertButton->setIcon(icon3); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
64 | horizontalLayout->addWidget(insertButton, 0, Qt::AlignRight); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
65 | gridLayout->addWidget(groupBox, 1, 0, 1, 1); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
66 | |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
67 | connect(quitButton, SIGNAL(clicked()), parent, SLOT(fromProfileWaters())); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
68 | connect(insertButton, SIGNAL(clicked()), this, SLOT(on_insertButton_clicked())); |
79
e726db72da3c
All inventory and profiles now show the items sizes in the statusbar.
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
69 | connect(this, SIGNAL(setStatus(QString)), parent, SLOT(statusMsg(QString))); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | emit refreshTable(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | void ProfileWaters::refreshTable() |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | QString w; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | QWidget* pWidget; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | QHBoxLayout* pLayout; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | qDebug() << "ProfileWaters reload"; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | QSqlQuery query("SELECT * FROM profile_water ORDER BY name"); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | const QStringList labels({tr("Name"), tr("Notes"), tr("Ca"), tr("Mg"), tr("Na"), tr("CaCO3"), tr("Cl"), tr("SO4"), tr("pH"), tr("Edit")}); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
85 | this->tableWaters->setColumnCount(10); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
86 | this->tableWaters->setColumnWidth(0, 150); /* Name */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
87 | this->tableWaters->setColumnWidth(1, 375); /* Notes */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
88 | this->tableWaters->setColumnWidth(2, 75); /* Ca */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
89 | this->tableWaters->setColumnWidth(3, 75); /* Mg */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
90 | this->tableWaters->setColumnWidth(4, 75); /* Na */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
91 | this->tableWaters->setColumnWidth(5, 75); /* CaCO3 */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
92 | this->tableWaters->setColumnWidth(6, 75); /* Cl */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
93 | this->tableWaters->setColumnWidth(7, 75); /* SO4 */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
94 | this->tableWaters->setColumnWidth(8, 75); /* pH */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
95 | this->tableWaters->setColumnWidth(9, 80); /* Edit button */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
96 | this->tableWaters->setRowCount(query.size()); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
97 | this->tableWaters->setHorizontalHeaderLabels(labels); |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
98 | this->tableWaters->verticalHeader()->hide(); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | QTableWidgetItem *rightitem = new QTableWidgetItem(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | rightitem->setTextAlignment(Qt::AlignRight); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | query.first(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
105 | this->tableWaters->setItem(ridx, 0, new QTableWidgetItem(query.value(1).toString())); /* Name */ |
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
106 | this->tableWaters->setItem(ridx, 1, new QTableWidgetItem(query.value(9).toString())); /* Notes */ |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | w = QString("%1").arg(query.value(2).toDouble(), 2, 'f', 1, '0' ); /* Ca */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | QTableWidgetItem *item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
111 | this->tableWaters->setItem(ridx, 2, item); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | w = QString("%1").arg(query.value(7).toDouble(), 2, 'f', 1, '0' ); /* Mg */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
116 | this->tableWaters->setItem(ridx, 3, item); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | w = QString("%1").arg(query.value(6).toDouble(), 2, 'f', 1, '0' ); /* Na */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
121 | this->tableWaters->setItem(ridx, 4, item); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | w = QString("%1").arg(query.value(10).toDouble(), 2, 'f', 1, '0' ); /* CaCO3 */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
126 | this->tableWaters->setItem(ridx, 5, item); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
127 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
128 | w = QString("%1").arg(query.value(5).toDouble(), 2, 'f', 1, '0' ); /* Cl */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
129 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
131 | this->tableWaters->setItem(ridx, 6, item); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
132 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | w = QString("%1").arg(query.value(4).toDouble(), 2, 'f', 1, '0' ); /* SO4 */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
136 | this->tableWaters->setItem(ridx, 7, item); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | w = QString("%1").arg(query.value(8).toDouble(), 2, 'f', 1, '0' ); /* pH */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
141 | this->tableWaters->setItem(ridx, 8, item); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | /* Add the Edit button */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | pWidget = new QWidget(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | QPushButton* btn_edit = new QPushButton(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | btn_edit->setObjectName(QString("%1").arg(query.value(0).toString())); /* Send record with the button */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | btn_edit->setText(tr("Edit")); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_editButton_clicked())); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | pLayout = new QHBoxLayout(pWidget); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
150 | pLayout->addWidget(btn_edit); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | pLayout->setContentsMargins(5, 0, 5, 0); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | pWidget->setLayout(pLayout); |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
153 | this->tableWaters->setCellWidget(ridx, 9, pWidget); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | query.next(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | } |
79
e726db72da3c
All inventory and profiles now show the items sizes in the statusbar.
Michiel Broek <mbroek@mbse.eu>
parents:
74
diff
changeset
|
156 | emit setStatus(QString(tr("Total items: %1")).arg(query.size())); |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
157 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | |
74
4ac38457a709
Profile Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents:
48
diff
changeset
|
160 | ProfileWaters::~ProfileWaters() {} |
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
161 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
162 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
163 | void ProfileWaters::edit(int recno) |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
164 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
165 | EditProfileWater dialog(recno, this); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
166 | /* Signal from editor if a refresh is needed */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
167 | connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
168 | dialog.setModal(true); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
169 | dialog.exec(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
170 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
171 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
172 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
173 | void ProfileWaters::on_editButton_clicked() |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
174 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
175 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
176 | int recno = pb->objectName().toInt(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
177 | edit(recno); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
178 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
179 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
180 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
181 | void ProfileWaters::on_insertButton_clicked() |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
182 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
183 | edit(-1); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
184 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
185 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
186 |