src/InventoryWaters.cpp

Fri, 20 May 2022 14:48:03 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 20 May 2022 14:48:03 +0200
changeset 224
d369948a3eb5
parent 90
2396457a8167
child 290
93820a8ffbff
permissions
-rw-r--r--

Added stage changing from tertiary fermentation upto carbonation. Show, hide, readonly etc for the package tab. Make sure current sugar amounts are displayed. Added package date and buttons.

29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * InventoryWaters.cpp is part of bmsapp.
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include "InventoryWaters.h"
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 #include "EditWater.h"
73
ebd2fc719b1a Inventory Equipments now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 72
diff changeset
19 #include "MainWindow.h"
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 #include "config.h"
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
23 InventoryWaters::InventoryWaters(QWidget *parent) : QDialog(parent)
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 qDebug() << "InventoryWaters start";
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
27 gridLayout = new QGridLayout(this);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
28 gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
29 tableWaters = new QTableWidget(this);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
30 tableWaters->setObjectName(QString::fromUtf8("tableWaters"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
31 tableWaters->setEnabled(true);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
32 QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
33 sizePolicy.setHorizontalStretch(0);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
34 sizePolicy.setVerticalStretch(0);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
35 tableWaters->setSizePolicy(sizePolicy);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
36 tableWaters->setMinimumSize(QSize(954, 0));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
37 gridLayout->addWidget(tableWaters, 0, 0, 1, 1);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
38
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
39 groupBox = new QGroupBox(this);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
40 groupBox->setObjectName(QString::fromUtf8("groupBox"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
41 groupBox->setEnabled(true);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
42 groupBox->setFlat(false);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
43 horizontalLayout = new QHBoxLayout(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
44 horizontalLayout->setSpacing(6);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
45 horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
46 horizontalLayout->setContentsMargins(0, 0, 0, 0);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
47
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
48 quitButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
49 quitButton->setObjectName(QString::fromUtf8("quitButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
50 quitButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
51 quitButton->setText(tr("Quit"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
52 QIcon icon;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
53 icon.addFile(QString::fromUtf8(":icons/silk/door_out.png"), QSize(), QIcon::Normal, QIcon::Off);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
54 quitButton->setIcon(icon);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
55 horizontalLayout->addWidget(quitButton, 0, Qt::AlignLeft);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
56
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
57 exportButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
58 exportButton->setObjectName(QString::fromUtf8("exportButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
59 exportButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
60 exportButton->setText(tr("Export"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
61 QIcon icon1;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
62 icon1.addFile(QString::fromUtf8(":/icons/silk/database_save.png"), QSize(), QIcon::Normal, QIcon::Off);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
63 exportButton->setIcon(icon1);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
64 horizontalLayout->addWidget(exportButton, 0, Qt::AlignRight);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
65
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
66 importButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
67 importButton->setObjectName(QString::fromUtf8("importButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
68 importButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
69 importButton->setText(tr("Import"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
70 QIcon icon2;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
71 icon2.addFile(QString::fromUtf8(":/icons/silk/database_add.png"), QSize(), QIcon::Normal, QIcon::Off);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
72 importButton->setIcon(icon2);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
73 horizontalLayout->addWidget(importButton, 0, Qt::AlignRight);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
74
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
75 insertButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
76 insertButton->setObjectName(QString::fromUtf8("insertButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
77 insertButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
78 insertButton->setText(tr("New"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
79 QIcon icon3;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
80 icon3.addFile(QString::fromUtf8(":icons/silk/table_row_insert.png"), QSize(), QIcon::Normal, QIcon::Off);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
81 insertButton->setIcon(icon3);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
82 horizontalLayout->addWidget(insertButton, 0, Qt::AlignRight);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
83 gridLayout->addWidget(groupBox, 1, 0, 1, 1);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
84
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
85 connect(quitButton, SIGNAL(clicked()), parent, SLOT(fromInventoryWaters()));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
86 connect(insertButton, SIGNAL(clicked()), this, SLOT(on_insertButton_clicked()));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
87 connect(exportButton, SIGNAL(clicked()), this, SLOT(on_exportButton_clicked()));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
88 // connect(importButton, SIGNAL(clicked()), this, SLOT(on_importButton_clicked()));
79
e726db72da3c All inventory and profiles now show the items sizes in the statusbar.
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
89 connect(this, SIGNAL(setStatus(QString)), parent, SLOT(statusMsg(QString)));
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 emit refreshTable();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 void InventoryWaters::refreshTable()
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 QString w;
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 QWidget* pWidget;
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 QLabel *label;
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 QHBoxLayout* pLayout;
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 qDebug() << "InventoryWaters reload";
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 QSqlQuery query("SELECT * FROM inventory_waters ORDER BY name");
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 const QStringList labels({tr("Name"), tr("Notes"), tr("Unlimited"), tr("Stock"), tr("Edit")});
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
106 this->tableWaters->setColumnCount(5);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
107 this->tableWaters->setColumnWidth(0, 200); /* Name */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
108 this->tableWaters->setColumnWidth(1, 500); /* Notes */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
109 this->tableWaters->setColumnWidth(2, 75); /* Unlimited */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
110 this->tableWaters->setColumnWidth(3, 75); /* Stock */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
111 this->tableWaters->setColumnWidth(4, 80); /* Edit button */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
112 this->tableWaters->setRowCount(query.size());
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
113 this->tableWaters->setHorizontalHeaderLabels(labels);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
114 this->tableWaters->verticalHeader()->hide();
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 QTableWidgetItem *rightitem = new QTableWidgetItem();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 rightitem->setTextAlignment(Qt::AlignRight);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 query.first();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) {
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
121 this->tableWaters->setItem(ridx, 0, new QTableWidgetItem(query.value(1).toString())); /* Name */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
122 this->tableWaters->setItem(ridx, 1, new QTableWidgetItem(query.value(10).toString())); /* Notes */
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 if (query.value(2).toInt()) {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 pWidget = new QWidget();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 label = new QLabel;
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 label->setPixmap(QPixmap(":icons/silk/tick.png"));
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 pLayout = new QHBoxLayout(pWidget);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 pLayout->addWidget(label);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 pLayout->setAlignment(Qt::AlignCenter);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 pLayout->setContentsMargins(0, 0, 0, 0);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 pWidget->setLayout(pLayout);
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
132 this->tableWaters->setCellWidget(ridx, 2, pWidget);
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 } else {
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
134 this->tableWaters->removeCellWidget(ridx, 2);
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 w = QString("");
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 if (query.value(12).toDouble() > 0) {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 w = QString("%1 L").arg(query.value(12).toDouble(), 2, 'f', 1, '0' );
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 QTableWidgetItem *item = new QTableWidgetItem(w);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
143 this->tableWaters->setItem(ridx, 3, item);
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 /* Add the Edit button */
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 pWidget = new QWidget();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 QPushButton* btn_edit = new QPushButton();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 btn_edit->setObjectName(QString("%1").arg(query.value(0).toString())); /* Send record with the button */
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 btn_edit->setText(tr("Edit"));
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_editButton_clicked()));
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 pLayout = new QHBoxLayout(pWidget);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 pLayout->addWidget(btn_edit);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 pLayout->setContentsMargins(5, 0, 5, 0);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 pWidget->setLayout(pLayout);
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
155 this->tableWaters->setCellWidget(ridx, 4, pWidget);
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 query.next();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 }
79
e726db72da3c All inventory and profiles now show the items sizes in the statusbar.
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
158 emit setStatus(QString(tr("Total items: %1")).arg(query.size()));
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
162 InventoryWaters::~InventoryWaters() {}
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 void InventoryWaters::edit(int recno)
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 EditWater dialog(recno, this);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 /* Signal from editor if a refresh is needed */
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable()));
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 dialog.setModal(true);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 dialog.exec();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 void InventoryWaters::on_editButton_clicked()
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 int recno = pb->objectName().toInt();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 edit(recno);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 void InventoryWaters::on_insertButton_clicked()
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 edit(-1);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188
46
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
189 void InventoryWaters::on_exportButton_clicked()
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
190 {
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
191 qDebug() << Q_FUNC_INFO;
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
192
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
193 QSqlQuery query("SELECT * FROM inventory_waters ORDER BY name");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
194
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
195 QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), QDir::homePath() + "/waters.xml", tr("Files (*.xml)"));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
196 if (fileName == 0) {
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
197 QMessageBox::warning(this, tr("Save File"), tr("No XML file selected."));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
198 return;
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
199 }
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
200
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
201 QFile file(fileName);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
202 file.open(QIODevice::WriteOnly);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
203
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
204 QXmlStreamWriter *xmlWriter = new QXmlStreamWriter(&file);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
205 xmlWriter->writeStartDocument();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
206 xmlWriter->setAutoFormatting(true);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
207 xmlWriter->setAutoFormattingIndent(1);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
208 xmlWriter->writeStartElement("WATERS");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
209
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
210 query.first();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
211 for (int i = 0 ; i < query.size() ; i++ ) {
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
212 xmlWriter->writeStartElement("WATER");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
213 xmlWriter->writeTextElement("VERSION", "1");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
214 xmlWriter->writeTextElement("NAME", query.value(1).toString());
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
215 if (query.value(13).toDouble() > 0)
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
216 xmlWriter->writeTextElement("COST", QString::number(query.value(13).toDouble(), 'f', 5));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
217 if (query.value(10).toString().length())
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
218 xmlWriter->writeTextElement("NOTES", query.value(10).toString());
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
219 xmlWriter->writeTextElement("CALCIUM", QString::number(query.value(3).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
220 xmlWriter->writeTextElement("BICARBONATE", QString::number(query.value(4).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
221 xmlWriter->writeTextElement("SULFATE", QString::number(query.value(5).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
222 xmlWriter->writeTextElement("CHLORIDE", QString::number(query.value(6).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
223 xmlWriter->writeTextElement("SODIUM", QString::number(query.value(7).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
224 xmlWriter->writeTextElement("MAGNESIUM", QString::number(query.value(8).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
225 xmlWriter->writeTextElement("TOTAL_ALKALINITY", QString::number(query.value(11).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
226 xmlWriter->writeTextElement("PH", QString::number(query.value(9).toDouble(), 'f', 5));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
227 xmlWriter->writeEndElement();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
228 query.next();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
229 }
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
230
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
231 xmlWriter->writeEndElement();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
232 xmlWriter->writeEndDocument();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
233 QMessageBox::information(this, tr("Save File"), tr("XML export ready"));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
234
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
235 file.close();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
236 }
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
237
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
238

mercurial