1661 checkLine(&painter, &y, QString("%1 kg `%2` (%3)").arg(product->fermentables.at(i).amount * factor, 1, 'f', 3). |
1661 checkLine(&painter, &y, QString("%1 kg `%2` (%3)").arg(product->fermentables.at(i).amount * factor, 1, 'f', 3). |
1662 arg(product->fermentables.at(i).name).arg(product->fermentables.at(i).supplier)); |
1662 arg(product->fermentables.at(i).name).arg(product->fermentables.at(i).supplier)); |
1663 } |
1663 } |
1664 } |
1664 } |
1665 checkLine(&painter, &y, QString(tr("Mill the malts"))); |
1665 checkLine(&painter, &y, QString(tr("Mill the malts"))); |
1666 y += 20; |
1666 |
|
1667 int lines = 0; |
|
1668 int loop = 0; |
|
1669 for (int i = 0; i < product->mashs.size(); i++) { |
|
1670 if (loop == 0) { |
|
1671 lines += 3; |
|
1672 if (numsalts > 0) |
|
1673 lines++; |
|
1674 for (int j = 0; j < product->hops.size(); j++) { |
|
1675 if (product->hops.at(j).useat == HOP_USEAT_MASH) { |
|
1676 lines++; |
|
1677 } |
|
1678 } |
|
1679 for (int j = 0; j < product->miscs.size(); j++) { |
|
1680 if ((product->miscs.at(j).use_use == MISC_USES_MASH) && (product->miscs.at(j).type != MISC_TYPES_WATER_AGENT)) { |
|
1681 lines++; |
|
1682 } |
|
1683 } |
|
1684 } else { |
|
1685 lines++; |
|
1686 } |
|
1687 lines++; |
|
1688 loop++; |
|
1689 } |
|
1690 lines++; |
|
1691 qDebug() << "check" << lines << y + (lines * 20) << painter.device()->height(); |
|
1692 if ((y + (lines * 20)) > painter.device()->height()) { |
|
1693 printer->newPage(); |
|
1694 printHeader(&painter); |
|
1695 y = 120; |
|
1696 } else { |
|
1697 y += 20; |
|
1698 } |
1667 |
1699 |
1668 checkHeader(&painter, &y, tr("Mash")); |
1700 checkHeader(&painter, &y, tr("Mash")); |
1669 int loop = 0; |
1701 loop = 0; |
1670 double l, mvol = 0, msugars = 0; |
1702 double l, mvol = 0, msugars = 0; |
1671 for (int i = 0; i < product->mashs.size(); i++) { |
1703 for (int i = 0; i < product->mashs.size(); i++) { |
1672 if (product->mashs.at(i).step_type == 0) |
1704 if (product->mashs.at(i).step_type == 0) |
1673 mvol += product->mashs.at(i).step_infuse_amount * factor; // We need this later |
1705 mvol += product->mashs.at(i).step_infuse_amount * factor; // We need this later |
1674 if (loop == 0) { |
1706 if (loop == 0) { |
1759 } |
1791 } |
1760 |
1792 |
1761 if (checkSplit(&painter, &y, 1)) |
1793 if (checkSplit(&painter, &y, 1)) |
1762 factor = 1; |
1794 factor = 1; |
1763 /* Boil, how much space do we need */ |
1795 /* Boil, how much space do we need */ |
1764 int lines = 0; |
1796 lines = 0; |
1765 if (product->boil_time == 0) { |
1797 if (product->boil_time == 0) { |
1766 lines = 3; |
1798 lines = 3; |
1767 } else { |
1799 } else { |
1768 lines = 5; |
1800 lines = 5; |
1769 if (product->brew_cooling_method == CHILLER_TYPE_EMERSION) |
1801 if (product->brew_cooling_method == CHILLER_TYPE_EMERSION) |