69 |
69 |
70 for (int i = 0; i < product->miscs.size(); i++) { |
70 for (int i = 0; i < product->miscs.size(); i++) { |
71 |
71 |
72 ui->miscsTable->setItem(i, 0, new QTableWidgetItem(product->miscs.at(i).name)); |
72 ui->miscsTable->setItem(i, 0, new QTableWidgetItem(product->miscs.at(i).name)); |
73 |
73 |
74 item = new QTableWidgetItem(misc_types[product->miscs.at(i).type]); |
74 item = new QTableWidgetItem(QCoreApplication::translate("MiscType", g_misc_types[product->miscs.at(i).type])); |
75 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
75 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
76 ui->miscsTable->setItem(i, 1, item); |
76 ui->miscsTable->setItem(i, 1, item); |
77 |
77 |
78 item = new QTableWidgetItem(misc_uses[product->miscs.at(i).use_use]); |
78 item = new QTableWidgetItem(QCoreApplication::translate("MiscUse", g_misc_uses[product->miscs.at(i).use_use])); |
79 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
79 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
80 ui->miscsTable->setItem(i, 2, item); |
80 ui->miscsTable->setItem(i, 2, item); |
81 |
81 |
82 if (product->miscs.at(i).use_use == MISC_USES_BOIL) { |
82 if (product->miscs.at(i).use_use == MISC_USES_BOIL) { |
83 item = new QTableWidgetItem(QString("%1 min.").arg(product->miscs.at(i).time, 1, 'f', 0, '0')); |
83 item = new QTableWidgetItem(QString("%1 min.").arg(product->miscs.at(i).time, 1, 'f', 0, '0')); |
421 * Update the visible fields |
421 * Update the visible fields |
422 */ |
422 */ |
423 mnameEdit->setText(product->miscs.at(product->miscs_row).name); |
423 mnameEdit->setText(product->miscs.at(product->miscs_row).name); |
424 ui->miscsTable->setItem(product->miscs_row, 0, new QTableWidgetItem(product->miscs.at(product->miscs_row).name)); |
424 ui->miscsTable->setItem(product->miscs_row, 0, new QTableWidgetItem(product->miscs.at(product->miscs_row).name)); |
425 |
425 |
426 item = new QTableWidgetItem(misc_types[product->miscs.at(product->miscs_row).type]); |
426 item = new QTableWidgetItem(QCoreApplication::translate("MiscType", g_misc_types[product->miscs.at(product->miscs_row).type])); |
427 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
427 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
428 ui->miscsTable->setItem(product->miscs_row, 1, item); |
428 ui->miscsTable->setItem(product->miscs_row, 1, item); |
429 |
429 |
430 item = new QTableWidgetItem(misc_uses[product->miscs.at(product->miscs_row).use_use]); |
430 item = new QTableWidgetItem(QCoreApplication::translate("MiscUse", g_misc_uses[product->miscs.at(product->miscs_row).use_use])); |
431 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
431 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
432 ui->miscsTable->setItem(product->miscs_row, 2, item); |
432 ui->miscsTable->setItem(product->miscs_row, 2, item); |
433 useatEdit->setCurrentIndex(product->miscs.at(product->miscs_row).use_use); |
433 useatEdit->setCurrentIndex(product->miscs.at(product->miscs_row).use_use); |
434 |
434 |
435 if (product->miscs.at(product->miscs_row).use_use == 3 || product->miscs.at(product->miscs_row).use_use == 4) { // Fermentation stages |
435 if (product->miscs.at(product->miscs_row).use_use == 3 || product->miscs.at(product->miscs_row).use_use == 4) { // Fermentation stages |
502 query.prepare(sql); |
502 query.prepare(sql); |
503 query.exec(); |
503 query.exec(); |
504 query.first(); |
504 query.first(); |
505 this->mselectEdit->addItem(""); // Start with empty value |
505 this->mselectEdit->addItem(""); // Start with empty value |
506 for (int i = 0; i < query.size(); i++) { |
506 for (int i = 0; i < query.size(); i++) { |
507 this->mselectEdit->addItem(query.value(0).toString()+ " (" + misc_types[query.value(1).toInt()] + ") " + |
507 this->mselectEdit->addItem(query.value(0).toString()+ " (" + QCoreApplication::translate("MiscType", g_misc_types[query.value(1).toInt()]) + ") " + |
508 QString("%1 %2").arg(query.value(3).toDouble() * 1000.0, 3, 'f', 2, '0').arg(query.value(2).toInt()?"gr":"ml")); |
508 QString("%1 %2").arg(query.value(3).toDouble() * 1000.0, 3, 'f', 2, '0').arg(query.value(2).toInt()?"gr":"ml")); |
509 query.next(); |
509 query.next(); |
510 } |
510 } |
511 } |
511 } |
512 |
512 |
515 { |
515 { |
516 QTableWidgetItem *item; |
516 QTableWidgetItem *item; |
517 |
517 |
518 qDebug() << "misc_useat_changed" << val; |
518 qDebug() << "misc_useat_changed" << val; |
519 product->miscs[product->miscs_row].use_use = val; |
519 product->miscs[product->miscs_row].use_use = val; |
520 item = new QTableWidgetItem(misc_uses[val]); |
520 item = new QTableWidgetItem(QCoreApplication::translate("MiscUse", g_misc_uses[val])); |
521 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
521 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter); |
522 ui->miscsTable->setItem(product->miscs_row, 2, item); |
522 ui->miscsTable->setItem(product->miscs_row, 2, item); |
523 |
523 |
524 if (val == MISC_USES_PRIMARY || val == MISC_USES_SECONDARY) { |
524 if (val == MISC_USES_PRIMARY || val == MISC_USES_SECONDARY) { |
525 product->miscs[product->miscs_row].time = mtimeEdit->value() * 1440; |
525 product->miscs[product->miscs_row].time = mtimeEdit->value() * 1440; |