src/InventoryMiscs.cpp

changeset 155
f671c599f65b
parent 90
2396457a8167
child 290
93820a8ffbff
equal deleted inserted replaced
154:1af9f7b7f317 155:f671c599f65b
16 */ 16 */
17 #include "InventoryMiscs.h" 17 #include "InventoryMiscs.h"
18 #include "EditMisc.h" 18 #include "EditMisc.h"
19 #include "MainWindow.h" 19 #include "MainWindow.h"
20 #include "config.h" 20 #include "config.h"
21 #include "global.h"
21 22
22 23
23 InventoryMiscs::InventoryMiscs(QWidget *parent) : QDialog(parent) 24 InventoryMiscs::InventoryMiscs(QWidget *parent) : QDialog(parent)
24 { 25 {
25 qDebug() << "InventoryMiscs start"; 26 qDebug() << "InventoryMiscs start";
97 98
98 qDebug() << "InventoryMiscs reload"; 99 qDebug() << "InventoryMiscs reload";
99 100
100 QSqlQuery query("SELECT * FROM inventory_miscs ORDER BY name"); 101 QSqlQuery query("SELECT * FROM inventory_miscs ORDER BY name");
101 const QStringList labels({tr("Name"), tr("Type"), tr("Use"), tr("Time"), tr("Stock"), tr("Edit")}); 102 const QStringList labels({tr("Name"), tr("Type"), tr("Use"), tr("Time"), tr("Stock"), tr("Edit")});
102 const QStringList types({tr("Spice"), tr("Herb"), tr("Flavor"), tr("Fining"), tr("Water agent"), tr("Yeast nutrient"), tr("Other")});
103 const QStringList use({tr("Starter"), tr("Mash"), tr("Boil"), tr("Primary"), tr("Secondary"), tr("Bottling")});
104 103
105 /* origin supplier name type graintype color yield inventory Edit */ 104 /* origin supplier name type graintype color yield inventory Edit */
106 this->tableMiscs->setColumnCount(6); 105 this->tableMiscs->setColumnCount(6);
107 this->tableMiscs->setColumnWidth(0, 275); /* Name */ 106 this->tableMiscs->setColumnWidth(0, 275); /* Name */
108 this->tableMiscs->setColumnWidth(1, 120); /* Type */ 107 this->tableMiscs->setColumnWidth(1, 120); /* Type */
118 rightitem->setTextAlignment(Qt::AlignRight); 117 rightitem->setTextAlignment(Qt::AlignRight);
119 118
120 query.first(); 119 query.first();
121 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { 120 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) {
122 this->tableMiscs->setItem(ridx, 0, new QTableWidgetItem(query.value(1).toString())); /* Name */ 121 this->tableMiscs->setItem(ridx, 0, new QTableWidgetItem(query.value(1).toString())); /* Name */
123 this->tableMiscs->setItem(ridx, 1, new QTableWidgetItem(types[query.value(2).toInt()])); /* Type */ 122 this->tableMiscs->setItem(ridx, 1, new QTableWidgetItem(misc_types[query.value(2).toInt()])); /* Type */
124 this->tableMiscs->setItem(ridx, 2, new QTableWidgetItem(use[query.value(3).toInt()])); /* Use */ 123 this->tableMiscs->setItem(ridx, 2, new QTableWidgetItem(misc_uses[query.value(3).toInt()])); /* Use */
125 124
126 w = QString(""); /* Use time */ 125 w = QString(""); /* Use time */
127 if (query.value(4).toInt() > 0) { 126 if (query.value(4).toInt() > 0) {
128 if (query.value(4).toInt() == 1) 127 if (query.value(4).toInt() == 1)
129 w = QString("1 minute"); 128 w = QString("1 minute");

mercurial