src/EditProductTab4.cpp

changeset 301
fe6346211b5b
parent 300
2a97905cb637
child 305
35ce719998e1
equal deleted inserted replaced
300:2a97905cb637 301:fe6346211b5b
68 for (int i = 0; i < product->hops.size(); i++) { 68 for (int i = 0; i < product->hops.size(); i++) {
69 69
70 ui->hopsTable->setItem(i, 0, new QTableWidgetItem(product->hops.at(i).origin)); 70 ui->hopsTable->setItem(i, 0, new QTableWidgetItem(product->hops.at(i).origin));
71 ui->hopsTable->setItem(i, 1, new QTableWidgetItem(product->hops.at(i).name)); 71 ui->hopsTable->setItem(i, 1, new QTableWidgetItem(product->hops.at(i).name));
72 72
73 item = new QTableWidgetItem(hop_types[product->hops.at(i).type]); 73 item = new QTableWidgetItem(QCoreApplication::translate("HopTypes", g_hop_types[product->hops.at(i).type]));
74 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); 74 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
75 ui->hopsTable->setItem(i, 2, item); 75 ui->hopsTable->setItem(i, 2, item);
76 76
77 item = new QTableWidgetItem(hop_forms[product->hops.at(i).form]); 77 item = new QTableWidgetItem(QCoreApplication::translate("HopForm", g_hop_forms[product->hops.at(i).form]));
78 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); 78 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
79 ui->hopsTable->setItem(i, 3, item); 79 ui->hopsTable->setItem(i, 3, item);
80 80
81 item = new QTableWidgetItem(QString("%1%").arg(product->hops.at(i).alpha, 2, 'f', 1, '0')); 81 item = new QTableWidgetItem(QString("%1%").arg(product->hops.at(i).alpha, 2, 'f', 1, '0'));
82 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); 82 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
83 ui->hopsTable->setItem(i, 4, item); 83 ui->hopsTable->setItem(i, 4, item);
84 84
85 item = new QTableWidgetItem(hop_useat[product->hops.at(i).useat]); 85 item = new QTableWidgetItem(QCoreApplication::translate("HopUse", g_hop_useat[product->hops.at(i).useat]));
86 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); 86 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
87 ui->hopsTable->setItem(i, 5, item); 87 ui->hopsTable->setItem(i, 5, item);
88 88
89 if (product->hops.at(i).useat == 2 || product->hops.at(i).useat == 4) { // Boil or whirlpool 89 if (product->hops.at(i).useat == 2 || product->hops.at(i).useat == 4) { // Boil or whirlpool
90 item = new QTableWidgetItem(QString("%1 min.").arg(product->hops.at(i).time, 1, 'f', 0, '0')); 90 item = new QTableWidgetItem(QString("%1 min.").arg(product->hops.at(i).time, 1, 'f', 0, '0'));
442 ibuEdit->setValue(ibu); 442 ibuEdit->setValue(ibu);
443 443
444 ui->hopsTable->setItem(product->hops_row, 0, new QTableWidgetItem(product->hops.at(product->hops_row).origin)); 444 ui->hopsTable->setItem(product->hops_row, 0, new QTableWidgetItem(product->hops.at(product->hops_row).origin));
445 ui->hopsTable->setItem(product->hops_row, 1, new QTableWidgetItem(product->hops.at(product->hops_row).name)); 445 ui->hopsTable->setItem(product->hops_row, 1, new QTableWidgetItem(product->hops.at(product->hops_row).name));
446 446
447 item = new QTableWidgetItem(hop_types[product->hops.at(product->hops_row).type]); 447 QString hoptype = QCoreApplication::translate("HopTypes", g_hop_types[product->hops.at(product->hops_row).type]);
448 item = new QTableWidgetItem(hoptype);
448 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); 449 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
449 ui->hopsTable->setItem(product->hops_row, 2, item); 450 ui->hopsTable->setItem(product->hops_row, 2, item);
450 451
451 item = new QTableWidgetItem(hop_forms[product->hops.at(product->hops_row).form]); 452
453 item = new QTableWidgetItem(QCoreApplication::translate("HopForm", g_hop_forms[product->hops.at(product->hops_row).form]));
452 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); 454 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
453 ui->hopsTable->setItem(product->hops_row, 3, item); 455 ui->hopsTable->setItem(product->hops_row, 3, item);
454 456
455 item = new QTableWidgetItem(QString("%1%").arg(product->hops.at(product->hops_row).alpha, 2, 'f', 1, '0')); 457 item = new QTableWidgetItem(QString("%1%").arg(product->hops.at(product->hops_row).alpha, 2, 'f', 1, '0'));
456 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); 458 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
502 void EditProduct::hop_useat_changed(int val) 504 void EditProduct::hop_useat_changed(int val)
503 { 505 {
504 qDebug() << "hop_useat_changed()" << product->hops_row << val; 506 qDebug() << "hop_useat_changed()" << product->hops_row << val;
505 507
506 product->hops[product->hops_row].useat = val; 508 product->hops[product->hops_row].useat = val;
507 QTableWidgetItem *item = new QTableWidgetItem(hop_useat[val]); 509 QTableWidgetItem *item = new QTableWidgetItem(QCoreApplication::translate("HopUse", g_hop_useat[val]));
508 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); 510 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
509 ui->hopsTable->setItem(product->hops_row, 5, item); 511 ui->hopsTable->setItem(product->hops_row, 5, item);
510 512
511 if (val == HOP_USEAT_BOIL || val == HOP_USEAT_WHIRLPOOL) { 513 if (val == HOP_USEAT_BOIL || val == HOP_USEAT_WHIRLPOOL) {
512 htimeLabel->setText(tr("Time in minutes:")); 514 htimeLabel->setText(tr("Time in minutes:"));

mercurial