src/InventoryWaters.cpp

Mon, 21 Mar 2022 12:08:41 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 21 Mar 2022 12:08:41 +0100
changeset 79
e726db72da3c
parent 73
ebd2fc719b1a
child 90
2396457a8167
permissions
-rw-r--r--

All inventory and profiles now show the items sizes in the statusbar.

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 #include "bmsapp.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
22
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
23
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
24 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
25 {
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 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
27
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
28 gridLayout = new QGridLayout(this);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
29 gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
30 tableWaters = new QTableWidget(this);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
31 tableWaters->setObjectName(QString::fromUtf8("tableWaters"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
32 tableWaters->setEnabled(true);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
33 QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
34 sizePolicy.setHorizontalStretch(0);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
35 sizePolicy.setVerticalStretch(0);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
36 tableWaters->setSizePolicy(sizePolicy);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
37 tableWaters->setMinimumSize(QSize(954, 0));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
38 gridLayout->addWidget(tableWaters, 0, 0, 1, 1);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
39
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
40 groupBox = new QGroupBox(this);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
41 groupBox->setObjectName(QString::fromUtf8("groupBox"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
42 groupBox->setEnabled(true);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
43 groupBox->setFlat(false);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
44 horizontalLayout = new QHBoxLayout(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
45 horizontalLayout->setSpacing(6);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
46 horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
47 horizontalLayout->setContentsMargins(0, 0, 0, 0);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
48
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
49 quitButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
50 quitButton->setObjectName(QString::fromUtf8("quitButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
51 quitButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
52 quitButton->setText(tr("Quit"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
53 QIcon icon;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
54 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
55 quitButton->setIcon(icon);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
56 horizontalLayout->addWidget(quitButton, 0, Qt::AlignLeft);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
57
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
58 exportButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
59 exportButton->setObjectName(QString::fromUtf8("exportButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
60 exportButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
61 exportButton->setText(tr("Export"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
62 QIcon icon1;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
63 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
64 exportButton->setIcon(icon1);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
65 horizontalLayout->addWidget(exportButton, 0, Qt::AlignRight);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
66
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
67 importButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
68 importButton->setObjectName(QString::fromUtf8("importButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
69 importButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
70 importButton->setText(tr("Import"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
71 QIcon icon2;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
72 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
73 importButton->setIcon(icon2);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
74 horizontalLayout->addWidget(importButton, 0, Qt::AlignRight);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
75
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
76 insertButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
77 insertButton->setObjectName(QString::fromUtf8("insertButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
78 insertButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
79 insertButton->setText(tr("New"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
80 QIcon icon3;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
81 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
82 insertButton->setIcon(icon3);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
83 horizontalLayout->addWidget(insertButton, 0, Qt::AlignRight);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
84 gridLayout->addWidget(groupBox, 1, 0, 1, 1);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
85
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
86 connect(quitButton, SIGNAL(clicked()), parent, SLOT(fromInventoryWaters()));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
87 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
88 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
89 // 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
90 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
91 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
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
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 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
96 {
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 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
98 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
99 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
100 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
101
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 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
103
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 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
105 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
106
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
107 this->tableWaters->setColumnCount(5);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
108 this->tableWaters->setColumnWidth(0, 200); /* Name */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
109 this->tableWaters->setColumnWidth(1, 500); /* Notes */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
110 this->tableWaters->setColumnWidth(2, 75); /* Unlimited */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
111 this->tableWaters->setColumnWidth(3, 75); /* Stock */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
112 this->tableWaters->setColumnWidth(4, 80); /* Edit button */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
113 this->tableWaters->setRowCount(query.size());
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
114 this->tableWaters->setHorizontalHeaderLabels(labels);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
115 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
116
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 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
118 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
119
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 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
121 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
122 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
123 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
124 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
125 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
126 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
127 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
128 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
129 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
130 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
131 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
132 pWidget->setLayout(pLayout);
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
133 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
134 } else {
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
135 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
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
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 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
139 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
140 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
141 }
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 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
143 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
144 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
145
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 /* 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
147 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
148 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
149 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
150 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
151 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
152 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
153 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
154 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
155 pWidget->setLayout(pLayout);
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
156 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
157 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
158 }
79
e726db72da3c All inventory and profiles now show the items sizes in the statusbar.
Michiel Broek <mbroek@mbse.eu>
parents: 73
diff changeset
159 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
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
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
162
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
163 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
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
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 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
167 {
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 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
169 /* 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
170 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
171 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
172 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
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
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 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
177 {
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 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
179 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
180 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
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
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 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
185 {
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 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
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
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
189
46
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
190 void InventoryWaters::on_exportButton_clicked()
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
191 {
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
192 qDebug() << Q_FUNC_INFO;
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
193
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
194 QSqlQuery query("SELECT * FROM inventory_waters ORDER BY name");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
195
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
196 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
197 if (fileName == 0) {
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
198 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
199 return;
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
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
202 QFile file(fileName);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
203 file.open(QIODevice::WriteOnly);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
204
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
205 QXmlStreamWriter *xmlWriter = new QXmlStreamWriter(&file);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
206 xmlWriter->writeStartDocument();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
207 xmlWriter->setAutoFormatting(true);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
208 xmlWriter->setAutoFormattingIndent(1);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
209 xmlWriter->writeStartElement("WATERS");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
210
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
211 query.first();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
212 for (int i = 0 ; i < query.size() ; i++ ) {
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
213 xmlWriter->writeStartElement("WATER");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
214 xmlWriter->writeTextElement("VERSION", "1");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
215 xmlWriter->writeTextElement("NAME", query.value(1).toString());
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
216 if (query.value(13).toDouble() > 0)
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
217 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
218 if (query.value(10).toString().length())
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
219 xmlWriter->writeTextElement("NOTES", query.value(10).toString());
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
220 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
221 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
222 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
223 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
224 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
225 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
226 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
227 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
228 xmlWriter->writeEndElement();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
229 query.next();
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
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
232 xmlWriter->writeEndElement();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
233 xmlWriter->writeEndDocument();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
234 QMessageBox::information(this, tr("Save File"), tr("XML export ready"));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
235
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
236 file.close();
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
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
239

mercurial