98 |
99 |
99 qDebug() << "InventoryHops reload"; |
100 qDebug() << "InventoryHops reload"; |
100 |
101 |
101 QSqlQuery query("SELECT * FROM inventory_hops ORDER BY origin,name"); |
102 QSqlQuery query("SELECT * FROM inventory_hops ORDER BY origin,name"); |
102 const QStringList labels({tr("Origin"), tr("Name"), tr("Type"), tr("Form"), tr("Alpha"), tr("Beta"), tr("Cohumulone"), tr("HSI"), tr("Harvest"), tr("Stock"), tr("Edit")}); |
103 const QStringList labels({tr("Origin"), tr("Name"), tr("Type"), tr("Form"), tr("Alpha"), tr("Beta"), tr("Cohumulone"), tr("HSI"), tr("Harvest"), tr("Stock"), tr("Edit")}); |
103 const QStringList types({tr("Bittering"), tr("Aroma"), tr("Both")}); |
|
104 const QStringList form({tr("Pellet"), tr("Plug"), tr("Leaf"), tr("Leaf Wet"), tr("Cryo")}); |
|
105 |
104 |
106 /* origin supplier name type graintype color yield inventory Edit */ |
105 /* origin supplier name type graintype color yield inventory Edit */ |
107 this->tableHops->setColumnCount(11); |
106 this->tableHops->setColumnCount(11); |
108 this->tableHops->setColumnWidth(0, 130); /* Origin */ |
107 this->tableHops->setColumnWidth(0, 130); /* Origin */ |
109 this->tableHops->setColumnWidth(1, 250); /* Name */ |
108 this->tableHops->setColumnWidth(1, 250); /* Name */ |
125 |
124 |
126 query.first(); |
125 query.first(); |
127 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { |
126 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { |
128 this->tableHops->setItem(ridx, 0, new QTableWidgetItem(query.value(12).toString())); /* Origin */ |
127 this->tableHops->setItem(ridx, 0, new QTableWidgetItem(query.value(12).toString())); /* Origin */ |
129 this->tableHops->setItem(ridx, 1, new QTableWidgetItem(query.value(1).toString())); /* Name */ |
128 this->tableHops->setItem(ridx, 1, new QTableWidgetItem(query.value(1).toString())); /* Name */ |
130 this->tableHops->setItem(ridx, 2, new QTableWidgetItem(types[query.value(9).toInt()])); /* Type */ |
129 this->tableHops->setItem(ridx, 2, new QTableWidgetItem(hop_types[query.value(9).toInt()])); /* Type */ |
131 this->tableHops->setItem(ridx, 3, new QTableWidgetItem(form[query.value(10).toInt()])); /* Form */ |
130 this->tableHops->setItem(ridx, 3, new QTableWidgetItem(hop_forms[query.value(10).toInt()])); /* Form */ |
132 w = QString("%1 %").arg(query.value(2).toDouble(), 2, 'f', 1, '0' ); /* Alpha% */ |
131 w = QString("%1 %").arg(query.value(2).toDouble(), 2, 'f', 1, '0' ); /* Alpha% */ |
133 QTableWidgetItem *item = new QTableWidgetItem(w); |
132 QTableWidgetItem *item = new QTableWidgetItem(w); |
134 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
133 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
135 this->tableHops->setItem(ridx, 4, item); |
134 this->tableHops->setItem(ridx, 4, item); |
136 w = QString("%1 %").arg(query.value(3).toDouble(), 2, 'f', 1, '0' ); /* Beta% */ |
135 w = QString("%1 %").arg(query.value(3).toDouble(), 2, 'f', 1, '0' ); /* Beta% */ |