Mon, 06 Jun 2022 17:15:27 +0200
Fix default divide_size field in products. Update miscs table column 6 and 7 tooltips and display of the buttons after sort. After a new misc product is selected, update the current row index because the row may be moved. Fix some display misc values in the checklist, they were not multiplied by 1000. Fix display of some bars if the value was 24.
--- a/src/EditProduct.cpp Mon Jun 06 14:22:18 2022 +0200 +++ b/src/EditProduct.cpp Mon Jun 06 17:15:27 2022 +0200 @@ -235,7 +235,8 @@ product->yeast_prod_date = QDate(); product->yeast_pitchrate = product->prop_volume[0] = product->prop_volume[1] = product->prop_volume[2] = product->prop_volume[3] = 0; product->divide_type = product->divide_parts = product->divide_part = 0; - product->divide_size = product->divide_factor = 0; + product->divide_size = 0; + product->divide_factor = 1; } // Tab generic.
--- a/src/EditProductTab5.cpp Mon Jun 06 14:22:18 2022 +0200 +++ b/src/EditProductTab5.cpp Mon Jun 06 17:15:27 2022 +0200 @@ -110,13 +110,21 @@ * Not for water agents, these are set on the water tab. */ if (product->miscs.at(i).m_type == MISC_TYPES_WATER_AGENT) { + ui->miscsTable->removeCellWidget(i, 6); /* to remove the unneeded button */ item = new QTableWidgetItem(""); item->setToolTip(tr("Edit this from the water tab")); ui->miscsTable->setItem(i, 6, item); + ui->miscsTable->removeCellWidget(i, 7); item = new QTableWidgetItem(""); item->setToolTip(tr("Edit this from the water tab")); ui->miscsTable->setItem(i, 7, item); } else { + if (ui->miscsTable->item(i, 6)) { + ui->miscsTable->takeItem(i, 6); /* to remove the old tooltip */ + } + if (ui->miscsTable->item(i, 7)) { + ui->miscsTable->takeItem(i, 7); + } pWidget = new QWidget(); QPushButton* btn_dele = new QPushButton(); btn_dele->setObjectName(QString("%1").arg(i)); /* Send row with the button */ @@ -304,7 +312,7 @@ newm.m_cost = 0; product->miscs.append(newm); is_changed(); - emit refreshAll(); + refreshMiscs(); } @@ -462,7 +470,20 @@ ui->miscsTable->setItem(product->miscs_row, 5, item); is_changed(); - emit refreshAll(); + qDebug() << "before" << product->miscs_row; + refreshMiscs(); + /* + * The order of the list is changed, lookup the item we just added. + */ + for (int i = 0; i < product->miscs.size(); i++) { + if ((product->miscs.at(i).m_name == query.value(0).toString()) && + (product->miscs.at(i).m_type == query.value(1).toInt()) && + (product->miscs.at(i).m_use_use == query.value(2).toInt())) { + product->miscs_row = i; + break; + } + } + qDebug() << "after" << product->miscs_row; }
--- a/src/EditRecipeExport.cpp Mon Jun 06 14:22:18 2022 +0200 +++ b/src/EditRecipeExport.cpp Mon Jun 06 17:15:27 2022 +0200 @@ -422,7 +422,8 @@ p->yeast_prod_date = QDate(); p->yeast_pitchrate = p->prop_volume[0] = p->prop_volume[1] = p->prop_volume[2] = p->prop_volume[3] = 0; p->divide_type = p->divide_parts = p->divide_part = 0; - p->divide_size = p->divide_factor = 0; + p->divide_size = 0; + p->divide_factor = 1; p->fermentables = recipe->fermentables; p->hops = recipe->hops;
--- a/src/PrinterDialog.cpp Mon Jun 06 14:22:18 2022 +0200 +++ b/src/PrinterDialog.cpp Mon Jun 06 17:15:27 2022 +0200 @@ -1535,7 +1535,7 @@ double mashwater = 0; int numsalts = 0; - qInfo() << "Print checklist" << product->record; + qInfo() << "Print checklist" << product->record << "factor" << factor << product->divide_factor; printHeader(&painter); y = 120; @@ -1911,7 +1911,7 @@ for (int i = 0; i < product->miscs.size(); i++) { if (product->miscs.at(i).m_use_use == MISC_USES_PRIMARY) { QString unit = (product->miscs.at(i).m_amount_is_weight) ? "gr":"ml"; - checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` on day 3 or 4")).arg(product->miscs.at(i).m_amount * factor, 1, 'f', 3) + checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` on day 3 or 4")).arg(product->miscs.at(i).m_amount * 1000 * factor, 1, 'f', 3) .arg(unit).arg(product->miscs.at(i).m_name)); } } @@ -2012,7 +2012,7 @@ for (int i = 0; i < product->miscs.size(); i++) { if (product->miscs.at(i).m_use_use == MISC_USES_SECONDARY) { QString unit = (product->miscs.at(i).m_amount_is_weight) ? "gr":"ml"; - checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` for %4 days")).arg(product->miscs.at(i).m_amount * factor, 1, 'f', 3) + checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` for %4 days")).arg(product->miscs.at(i).m_amount * 1000.0 * factor, 1, 'f', 2) .arg(unit).arg(product->miscs.at(i).m_name).arg(product->miscs.at(i).m_time / 1440)); } } @@ -2069,7 +2069,7 @@ for (int i = 0; i < product->miscs.size(); i++) { if (product->miscs.at(i).m_use_use == MISC_USES_BOTTLING) { QString unit = (product->miscs.at(i).m_amount_is_weight) ? "gr":"ml"; - checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` during bottling")).arg(product->miscs.at(i).m_amount * factor, 1, 'f', 3) + checkLine(&painter, &y, QString(tr("Add %1 %2 `%3` during bottling")).arg(product->miscs.at(i).m_amount * 1000 * factor, 1, 'f', 2) .arg(unit).arg(product->miscs.at(i).m_name)); } }
--- a/ui/EditProduct.ui Mon Jun 06 14:22:18 2022 +0200 +++ b/ui/EditProduct.ui Mon Jun 06 17:15:27 2022 +0200 @@ -374,7 +374,7 @@ <rect> <x>880</x> <y>150</y> - <width>87</width> + <width>101</width> <height>24</height> </rect> </property> @@ -382,10 +382,10 @@ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> <property name="readOnly"> - <bool>true</bool> + <bool>false</bool> </property> <property name="buttonSymbols"> - <enum>QAbstractSpinBox::NoButtons</enum> + <enum>QAbstractSpinBox::UpDownArrows</enum> </property> <property name="accelerated"> <bool>false</bool> @@ -2374,7 +2374,7 @@ <number>200</number> </property> <property name="value"> - <number>24</number> + <number>0</number> </property> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -2396,7 +2396,7 @@ <number>120</number> </property> <property name="value"> - <number>24</number> + <number>0</number> </property> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -2418,7 +2418,7 @@ <number>50</number> </property> <property name="value"> - <number>24</number> + <number>0</number> </property> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -2440,7 +2440,7 @@ <number>50</number> </property> <property name="value"> - <number>24</number> + <number>0</number> </property> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -2623,7 +2623,7 @@ <number>100</number> </property> <property name="value"> - <number>24</number> + <number>0</number> </property> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -2645,7 +2645,7 @@ <number>100</number> </property> <property name="value"> - <number>24</number> + <number>0</number> </property> <property name="orientation"> <enum>Qt::Horizontal</enum>