Sun, 20 Mar 2022 14:08:05 +0100
Removed sizegrip from the statusbar
25
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * InventoryYeasts.cpp is part of bmsapp. |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * bmsapp is free software: you can redistribute it and/or modify |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * it under the terms of the GNU General Public License as published by |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * the Free Software Foundation, either version 3 of the License, or |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * (at your option) any later version. |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * bmsapp is distributed in the hope that it will be useful, |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * GNU General Public License for more details. |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * You should have received a copy of the GNU General Public License |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | #include "InventoryYeasts.h" |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | #include "EditYeast.h" |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | #include "../ui/ui_InventoryYeasts.h" |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | #include "config.h" |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | #include "bmsapp.h" |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | InventoryYeasts::InventoryYeasts(QWidget *parent) : QDialog(parent), ui(new Ui::InventoryYeasts) |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | qDebug() << "InventoryYeasts start"; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | ui->setupUi(this); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | emit refreshTable(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | setWindowTitle( QString("BMSapp - %1 - Inventory Yeasts").arg(VERSIONSTRING) ); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | void InventoryYeasts::refreshTable() |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | QString w; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | QWidget* pWidget; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | QLabel *label; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | QHBoxLayout* pLayout; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | qDebug() << "InventoryYeasts reload"; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | QSqlQuery query("SELECT * FROM inventory_yeasts ORDER BY laboratory,product_id,name"); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | const QStringList labels({tr("Laboratory"), tr("Product id"), tr("Name"), tr("Type"), tr("Form"), tr("SVG %"), tr("Tol %"), tr("POF+"), tr("STA1"), tr("Stock"), tr("Edit")}); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | const QStringList types({tr("Lager"), tr("Ale"), tr("Wheat"), tr("Wine"), tr("Champagne"), tr("Brett"), tr("Kveik"), tr("Hybrid")}); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | const QStringList form({tr("Liquid"), tr("Dry"), tr("Slant"), tr("Culture"), tr("Frozen"), tr("Bottle"), tr("Dried")}); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | /* origin supplier name type graintype color yield inventory Edit */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | ui->tableYeasts->setColumnCount(11); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | ui->tableYeasts->setColumnWidth(0, 120); /* Laboratory */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | ui->tableYeasts->setColumnWidth(1, 120); /* Product ID */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | ui->tableYeasts->setColumnWidth(2, 250); /* Name */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | ui->tableYeasts->setColumnWidth(3, 70); /* Type */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | ui->tableYeasts->setColumnWidth(4, 70); /* Form */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | ui->tableYeasts->setColumnWidth(5, 80); /* SVG */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | ui->tableYeasts->setColumnWidth(6, 80); /* Tolerance */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | ui->tableYeasts->setColumnWidth(7, 60); /* POF+ */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | ui->tableYeasts->setColumnWidth(8, 60); /* STA1 */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | ui->tableYeasts->setColumnWidth(9, 80); /* Stock */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | ui->tableYeasts->setColumnWidth(10, 80); /* Edit button */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | ui->tableYeasts->setRowCount(query.size()); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | ui->tableYeasts->setHorizontalHeaderLabels(labels); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | ui->tableYeasts->verticalHeader()->hide(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | ui->tableYeasts->setFixedSize(1070 + 24, 640); /* Even if this is too large, it works */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | QTableWidgetItem *rightitem = new QTableWidgetItem(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | rightitem->setTextAlignment(Qt::AlignRight); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | query.first(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | ui->tableYeasts->setItem(ridx, 0, new QTableWidgetItem(query.value(4).toString())); /* Laboratory */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | ui->tableYeasts->setItem(ridx, 1, new QTableWidgetItem(query.value(5).toString())); /* Product id */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | ui->tableYeasts->setItem(ridx, 2, new QTableWidgetItem(query.value(1).toString())); /* Name */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | ui->tableYeasts->setItem(ridx, 3, new QTableWidgetItem(types[query.value(2).toInt()])); /* Type */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | ui->tableYeasts->setItem(ridx, 4, new QTableWidgetItem(form[query.value(3).toInt()])); /* Form */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | w = QString("%1 %").arg(query.value(9).toDouble(), 2, 'f', 1, '0' ); /* Attenuation% */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | QTableWidgetItem *item = new QTableWidgetItem(w); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | ui->tableYeasts->setItem(ridx, 5, item); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | w = QString(""); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | if (query.value(10).toDouble() > 0) |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | w = QString("%1 %").arg(query.value(10).toDouble(), 2, 'f', 1, '0' ); /* Alcohol% */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | item = new QTableWidgetItem(w); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | ui->tableYeasts->setItem(ridx, 6, item); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
88 | if (query.value(24).toInt()) { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | pWidget = new QWidget(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | label = new QLabel; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | label->setPixmap(QPixmap(":icons/silk/tick.png")); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | pLayout = new QHBoxLayout(pWidget); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | pLayout->addWidget(label); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | pLayout->setAlignment(Qt::AlignCenter); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | pLayout->setContentsMargins(0, 0, 0, 0); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | pWidget->setLayout(pLayout); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | ui->tableYeasts->setCellWidget(ridx, 7, 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:
25
diff
changeset
|
98 | } else { |
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:
25
diff
changeset
|
99 | ui->tableYeasts->removeCellWidget(ridx, 7); |
25
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | if (query.value(19).toInt()) { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | pWidget = new QWidget(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | label = new QLabel; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | label->setPixmap(QPixmap(":icons/silk/tick.png")); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | pLayout = new QHBoxLayout(pWidget); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | pLayout->addWidget(label); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | pLayout->setAlignment(Qt::AlignCenter); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | pLayout->setContentsMargins(0, 0, 0, 0); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | pWidget->setLayout(pLayout); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | ui->tableYeasts->setCellWidget(ridx, 8, 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:
25
diff
changeset
|
111 | } else { |
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:
25
diff
changeset
|
112 | ui->tableYeasts->removeCellWidget(ridx, 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:
25
diff
changeset
|
113 | } |
25
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | w = QString(""); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | if (query.value(14).toDouble() > 0) { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | if (query.value(3).toInt() == 0 && query.value(14).toDouble() > 1) { /* Liquid yeast, multiple packs */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | w = QString("%1 packs").arg(query.value(14).toDouble(), 1, 'f', 0, '0'); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | } else if (query.value(3).toInt() == 0) { /* Liquid yeast */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | w = QString("%1 pack").arg(query.value(14).toDouble(), 1, 'f', 0, '0'); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
121 | } else if (query.value(3).toInt() == 1 || query.value(3).toInt() == 6) { /* Dry or dried */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | w = QString("%1 gram").arg(query.value(14).toDouble() * 1000, 2, 'f', 1, '0'); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | } else { /* Any other form */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | w = QString("%1 ml").arg(query.value(14).toDouble() * 1000, 2, 'f', 1, '0'); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
126 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
127 | item = new QTableWidgetItem(w); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
128 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
129 | ui->tableYeasts->setItem(ridx, 9, item); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
131 | /* Add the Edit button */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
132 | pWidget = new QWidget(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | QPushButton* btn_edit = new QPushButton(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | btn_edit->setObjectName(QString("%1").arg(query.value(0).toString())); /* Send record with the button */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | btn_edit->setText(tr("Edit")); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_editButton_clicked())); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | pLayout = new QHBoxLayout(pWidget); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | pLayout->addWidget(btn_edit); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | pLayout->setContentsMargins(5, 0, 5, 0); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | pWidget->setLayout(pLayout); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | ui->tableYeasts->setCellWidget(ridx, 10, pWidget); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | query.next(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | setWindowTitle( QString("BMSapp - %1 - Inventory Yeasts").arg(VERSIONSTRING) ); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | InventoryYeasts::~InventoryYeasts() |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
150 | { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | qDebug() << "InventoryYeasts done"; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | delete ui; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
153 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | void InventoryYeasts::edit(int recno) |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
157 | { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | qDebug() << "InventoryYeasts edit:" << recno; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | EditYeast dialog(recno, this); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
161 | /* Signal from editor if a refresh is needed */ |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
162 | connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
163 | dialog.setModal(true); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
164 | dialog.exec(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
165 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
166 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
167 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
168 | void InventoryYeasts::on_editButton_clicked() |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
169 | { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
170 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
171 | int recno = pb->objectName().toInt(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
172 | qDebug() << Q_FUNC_INFO << recno; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
173 | edit(recno); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
174 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
175 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
176 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
177 | void InventoryYeasts::on_insertButton_clicked() |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
178 | { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
179 | qDebug() << Q_FUNC_INFO; |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
180 | edit(-1); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
181 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
182 | |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
183 | |
44
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
184 | void InventoryYeasts::on_exportButton_clicked() |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
185 | { |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
186 | qDebug() << Q_FUNC_INFO; |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
187 | |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
188 | QSqlQuery query("SELECT * FROM inventory_yeasts ORDER BY laboratory,product_id,name"); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
189 | const QStringList types({ "Lager", "Ale", "Wheat", "Wine", "Champagne", "Other", "Other", "Other" }); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
190 | /* "Lager", "Ale", "Wheat", "Wine", "Champagne", "Brett", "Kveik", "Hybrid" */ |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
191 | /* We use more yeat forms then beerxml knows about, so we send known names */ |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
192 | /* instead of what we internally use. */ |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
193 | const QStringList forms({ "Liquid", "Dry", "Slant", "Culture", "Culture", "Culture", "Dry" }); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
194 | /* "Liquid", "Dry", "Slant", "Culture", "Frozen", "Bottle", "Dried" */ |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
195 | const QStringList flocs({ "Low", "Medium", "High", "Very high" }); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
196 | |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
197 | QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), QDir::homePath() + "/yeasts.xml", tr("Files (*.xml)")); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
198 | if (fileName == 0) { |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
199 | QMessageBox::warning(this, tr("Save File"), tr("No XML file selected.")); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
200 | return; |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
201 | } |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
202 | |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
203 | QFile file(fileName); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
204 | file.open(QIODevice::WriteOnly); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
205 | |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
206 | QXmlStreamWriter *xmlWriter = new QXmlStreamWriter(&file); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
207 | xmlWriter->writeStartDocument(); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
208 | xmlWriter->setAutoFormatting(true); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
209 | xmlWriter->setAutoFormattingIndent(1); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
210 | xmlWriter->writeStartElement("YEASTS"); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
211 | |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
212 | query.first(); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
213 | for (int i = 0 ; i < query.size() ; i++ ) { |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
214 | xmlWriter->writeStartElement("YEAST"); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
215 | xmlWriter->writeTextElement("VERSION", "1"); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
216 | xmlWriter->writeTextElement("NAME", query.value(1).toString()); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
217 | xmlWriter->writeTextElement("TYPE", types[query.value(2).toInt()]); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
218 | xmlWriter->writeTextElement("FORM", forms[query.value(3).toInt()]); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
219 | xmlWriter->writeTextElement("AMOUNT_IS_WEIGHT", (query.value(3).toInt() == 1 || query.value(3).toInt() == 6) ? "TRUE":"FALSE"); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
220 | xmlWriter->writeTextElement("LABORATORY", query.value(4).toString()); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
221 | if (query.value(5).toString().length()) |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
222 | xmlWriter->writeTextElement("PRODUCT_ID", query.value(5).toString()); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
223 | xmlWriter->writeTextElement("MIN_TEMPERATURE", QString::number(query.value(6).toDouble(), 'f', 4)); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
224 | xmlWriter->writeTextElement("MAX_TEMPERATURE", QString::number(query.value(7).toDouble(), 'f', 4)); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
225 | xmlWriter->writeTextElement("ATTENUATION", QString::number(query.value(9).toDouble(), 'f', 4)); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
226 | xmlWriter->writeTextElement("ADD_TO_SECONDARY", "FALSE"); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
227 | xmlWriter->writeTextElement("FLOCCULATION", flocs[query.value(8).toInt()]); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
228 | xmlWriter->writeTextElement("MAX_REUSE", QString::number(query.value(13).toInt())); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
229 | if (query.value(15).toDouble() > 0) |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
230 | xmlWriter->writeTextElement("COST", QString::number(query.value(15).toDouble(), 'f', 5)); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
231 | if (query.value(11).toString().length()) |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
232 | xmlWriter->writeTextElement("NOTES", query.value(11).toString()); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
233 | xmlWriter->writeEndElement(); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
234 | query.next(); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
235 | } |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
236 | |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
237 | xmlWriter->writeEndElement(); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
238 | xmlWriter->writeEndDocument(); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
239 | QMessageBox::information(this, tr("Save File"), tr("XML export ready")); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
240 | |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
241 | file.close(); |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
242 | } |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
243 | |
5a9a159c2d34
Added yeasts and hops XML exports.
Michiel Broek <mbroek@mbse.eu>
parents:
29
diff
changeset
|
244 | |
25
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
245 | void InventoryYeasts::on_quitButton_clicked() |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
246 | { |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
247 | emit firstWindow(); |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
248 | } |
a9da2744609e
Added inventory yeasts editor. Fixed resource icons location.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
249 |