src/InventoryFermentables.cpp

changeset 20
fcbbddcc22c1
parent 19
c94edc758a5b
child 34
5510352432f5
equal deleted inserted replaced
19:c94edc758a5b 20:fcbbddcc22c1
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 #include "InventoryFermentables.h" 17 #include "InventoryFermentables.h"
18 //#include "EditSupplier.h" 18 #include "EditFermentable.h"
19 #include "../ui/ui_InventoryFermentables.h" 19 #include "../ui/ui_InventoryFermentables.h"
20 #include "config.h" 20 #include "config.h"
21 #include "bmsapp.h" 21 #include "bmsapp.h"
22 22
23 23
34 34
35 void InventoryFermentables::refreshTable() 35 void InventoryFermentables::refreshTable()
36 { 36 {
37 QString w; 37 QString w;
38 38
39 qDebug() << "slot" << Q_FUNC_INFO; 39 qDebug() << "InventoryFermentables reload";
40 40
41 QSqlQuery query("SELECT * FROM inventory_fermentables ORDER BY supplier,name"); 41 QSqlQuery query("SELECT * FROM inventory_fermentables ORDER BY supplier,name");
42 const QStringList labels({tr("Origin"), tr("Supplier"), tr("Name"), tr("Type"), tr("Grain"), tr("Color"), tr("Yield"), tr("Stock"), tr("Edit")}); 42 const QStringList labels({tr("Origin"), tr("Supplier"), tr("Name"), tr("Type"), tr("Grain"), tr("Color"), tr("Yield"), tr("Stock"), tr("Edit")});
43 const QStringList types({tr("Grain"), tr("Sugar"), tr("Extract"), tr("Dry extract"), tr("Adjunct")}); 43 const QStringList types({tr("Grain"), tr("Sugar"), tr("Extract"), tr("Dry extract"), tr("Adjunct")});
44 const QStringList graintypes({tr("Base"), tr("Roast"), tr("Crystal"), tr("Kilned"), tr("Sour Malt"), tr("Special"), tr("No malt")}); 44 const QStringList graintypes({tr("Base"), tr("Roast"), tr("Crystal"), tr("Kilned"), tr("Sour Malt"), tr("Special"), tr("No malt")});
60 ui->tableFermentables->setFixedSize(/*1280*/ 1030 + 24, 640); /* Even if this is too large, it works */ 60 ui->tableFermentables->setFixedSize(/*1280*/ 1030 + 24, 640); /* Even if this is too large, it works */
61 61
62 QTableWidgetItem *rightitem = new QTableWidgetItem(); 62 QTableWidgetItem *rightitem = new QTableWidgetItem();
63 rightitem->setTextAlignment(Qt::AlignRight); 63 rightitem->setTextAlignment(Qt::AlignRight);
64 64
65 qDebug() << query.record().count() << query.size();
66 query.first(); 65 query.first();
67 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { 66 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) {
68 ui->tableFermentables->setItem(ridx, 0, new QTableWidgetItem(query.value(6).toString())); 67 ui->tableFermentables->setItem(ridx, 0, new QTableWidgetItem(query.value(6).toString()));
69 ui->tableFermentables->setItem(ridx, 1, new QTableWidgetItem(query.value(7).toString())); 68 ui->tableFermentables->setItem(ridx, 1, new QTableWidgetItem(query.value(7).toString()));
70 ui->tableFermentables->setItem(ridx, 2, new QTableWidgetItem(query.value(1).toString())); 69 ui->tableFermentables->setItem(ridx, 2, new QTableWidgetItem(query.value(1).toString()));
117 116
118 void InventoryFermentables::edit(int recno) 117 void InventoryFermentables::edit(int recno)
119 { 118 {
120 qDebug() << "InventoryFermentables edit:" << recno; 119 qDebug() << "InventoryFermentables edit:" << recno;
121 120
122 // EditSupplier dialog(recno, this); 121 EditFermentable dialog(recno, this);
123 /* Signal from editor if a refresh is needed */ 122 /* Signal from editor if a refresh is needed */
124 // connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); 123 connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable()));
125 // dialog.setModal(true); 124 dialog.setModal(true);
126 // dialog.exec(); 125 dialog.exec();
127 } 126 }
128 127
129 128
130 void InventoryFermentables::on_editButton_clicked() 129 void InventoryFermentables::on_editButton_clicked()
131 { 130 {

mercurial