src/EditRecipe.cpp

changeset 126
3c013ef88a00
parent 125
2e79e0975e58
child 127
475c8b8df67f
equal deleted inserted replaced
125:2e79e0975e58 126:3c013ef88a00
645 } 645 }
646 646
647 647
648 bool EditRecipe::hop_sort_test(const Hops &D1, const Hops &D2) 648 bool EditRecipe::hop_sort_test(const Hops &D1, const Hops &D2)
649 { 649 {
650 return (D1.h_useat <= D2.h_useat ) && (D1.h_time >= D2.h_time) && (D1.h_amount >= D2.h_amount); 650 if (D1.h_useat > D2.h_useat)
651 return false;
652 if (D1.h_useat < D2.h_useat)
653 return true;
654 /* Same useat moments, test time. */
655 if (D1.h_time < D2.h_time)
656 return false;
657 if (D1.h_time > D2.h_time)
658 return true;
659 /* Finally consider the amounts */
660 return (D1.h_amount > D2.h_amount);
651 } 661 }
652 662
653 663
654 void EditRecipe::refreshHops() 664 void EditRecipe::refreshHops()
655 { 665 {
657 QWidget* pWidget; 667 QWidget* pWidget;
658 QHBoxLayout* pLayout; 668 QHBoxLayout* pLayout;
659 QTableWidgetItem *item; 669 QTableWidgetItem *item;
660 670
661 qDebug() << "refreshHops" << recipe->hops.size(); 671 qDebug() << "refreshHops" << recipe->hops.size();
662 // std::sort(recipe->hops.begin(), recipe->hops.end(), hop_sort_test); 672 std::sort(recipe->hops.begin(), recipe->hops.end(), hop_sort_test);
663 673
664 /* 674 /*
665 * During filling the table turn off the cellChanged signal because every cell that is filled 675 * During filling the table turn off the cellChanged signal because every cell that is filled
666 * triggers the cellChanged signal. The QTableWidget has no better signal to use. 676 * triggers the cellChanged signal. The QTableWidget has no better signal to use.
667 */ 677 */
1590 recipe->fermentables.append(newf); 1600 recipe->fermentables.append(newf);
1591 emit refreshAll(); 1601 emit refreshAll();
1592 } 1602 }
1593 1603
1594 1604
1605 void EditRecipe::on_addHopRow_clicked()
1606 {
1607 Hops newh;
1608
1609 qDebug() << "Add hop row";
1610
1611 for (int i = 0; i < recipe->hops.size(); i++) {
1612 if (recipe->hops.at(i).h_amount == 0 && recipe->hops.at(i).h_alpha == 0)
1613 return; // Add only one at a time.
1614 }
1615
1616 emit refreshAll();
1617 }
1618
1619
1595 void EditRecipe::on_deleteFermentRow_clicked() 1620 void EditRecipe::on_deleteFermentRow_clicked()
1596 { 1621 {
1597 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); 1622 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
1598 int row = pb->objectName().toInt(); 1623 int row = pb->objectName().toInt();
1599 qDebug() << "Delete fermentable row" << row << recipe->fermentables.size(); 1624 qDebug() << "Delete fermentable row" << row << recipe->fermentables.size();
1620 if (recipe->fermentables.at(i).f_added < 4) 1645 if (recipe->fermentables.at(i).f_added < 4)
1621 recipe->fermentables[i].f_percentage = recipe->fermentables.at(i).f_amount / total * 100; 1646 recipe->fermentables[i].f_percentage = recipe->fermentables.at(i).f_amount / total * 100;
1622 1647
1623 this->ignoreChanges = false; 1648 this->ignoreChanges = false;
1624 emit refreshAll(); 1649 emit refreshAll();
1650 }
1651
1652
1653 void EditRecipe::on_deleteHopRow_clicked()
1654 {
1655 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
1656 int row = pb->objectName().toInt();
1657 qDebug() << "Delete hop row" << row << recipe->hops.size();
1658
1659 if (recipe->hops.size() < 1)
1660 return;
1661
1662 int rc = QMessageBox::warning(this, tr("Delete hop"), tr("Delete %1").arg(recipe->hops.at(row).h_name),
1663 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
1664 if (rc == QMessageBox::No)
1665 return;
1666
1667
1625 } 1668 }
1626 1669
1627 1670
1628 void EditRecipe::ferment_amount_changed(double val) 1671 void EditRecipe::ferment_amount_changed(double val)
1629 { 1672 {
1660 } 1703 }
1661 this->ignoreChanges = false; 1704 this->ignoreChanges = false;
1662 is_changed(); 1705 is_changed();
1663 } 1706 }
1664 1707
1708
1709 void EditRecipe::hop_amount_changed(double val)
1710 {
1711 QTableWidgetItem *item;
1712
1713 qDebug() << "hop_amount_changed()" << recipe->hops_row << val;
1714 this->ignoreChanges = true;
1715
1716 recipe->hops[recipe->hops_row].h_amount = val / 1000.0;
1717 item = new QTableWidgetItem(QString("%1 gr").arg(val, 2, 'f', 1, '0'));
1718 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
1719 ui->hopsTable->setItem(recipe->hops_row, 8, item);
1720
1721 double ibu = Utils::toIBU(recipe->hops.at(recipe->hops_row).h_useat, recipe->hops.at(recipe->hops_row).h_form, recipe->preboil_sg,
1722 recipe->batch_size, recipe->hops.at(recipe->hops_row).h_amount, recipe->hops.at(recipe->hops_row).h_time,
1723 recipe->hops.at(recipe->hops_row).h_alpha, recipe->ibu_method, 0, recipe->hops.at(recipe->hops_row).h_time, 0);
1724
1725 ibuEdit->setValue(ibu);
1726 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0'));
1727 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
1728 ui->hopsTable->setItem(recipe->hops_row, 7, item);
1729
1730 this->ignoreChanges = false;
1731 calcIBUs();
1732 is_changed();
1733 }
1734
1735
1665 void EditRecipe::ferment_pct_changed(double val) 1736 void EditRecipe::ferment_pct_changed(double val)
1666 { 1737 {
1667 QTableWidgetItem *item; 1738 QTableWidgetItem *item;
1668 double total = 0, row100 = -1; 1739 double total = 0, row100 = -1;
1669 1740
1693 recipe->fermentables[row100].f_amount -= diffw; 1764 recipe->fermentables[row100].f_amount -= diffw;
1694 1765
1695 item = new QTableWidgetItem(QString("%1 Kg").arg(recipe->fermentables[recipe->fermentables_row].f_amount, 4, 'f', 3, '0')); 1766 item = new QTableWidgetItem(QString("%1 Kg").arg(recipe->fermentables[recipe->fermentables_row].f_amount, 4, 'f', 3, '0'));
1696 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); 1767 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
1697 ui->fermentablesTable->setItem(recipe->fermentables_row, 7, item); 1768 ui->fermentablesTable->setItem(recipe->fermentables_row, 7, item);
1698 this->amountEdit->setValue(recipe->fermentables[recipe->fermentables_row].f_amount); 1769 this->famountEdit->setValue(recipe->fermentables[recipe->fermentables_row].f_amount);
1699 1770
1700 item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables[recipe->fermentables_row].f_percentage, 2, 'f', 1, '0')); 1771 item = new QTableWidgetItem(QString("%1%").arg(recipe->fermentables[recipe->fermentables_row].f_percentage, 2, 'f', 1, '0'));
1701 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); 1772 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
1702 ui->fermentablesTable->setItem(recipe->fermentables_row, 8, item); 1773 ui->fermentablesTable->setItem(recipe->fermentables_row, 8, item);
1703 1774
1710 ui->fermentablesTable->setItem(row100, 8, item); 1781 ui->fermentablesTable->setItem(row100, 8, item);
1711 1782
1712 this->ignoreChanges = false; 1783 this->ignoreChanges = false;
1713 is_changed(); 1784 is_changed();
1714 } 1785 }
1786
1787
1788 void EditRecipe::hop_time_changed(int val)
1789 {
1790 QTableWidgetItem *item;
1791
1792 qDebug() << "hop_time_changed()" << recipe->hops_row << val;
1793
1794 this->ignoreChanges = true;
1795 recipe->hops[recipe->hops_row].h_time = val;
1796
1797 if (recipe->hops.at(recipe->hops_row).h_useat == 2 || recipe->hops.at(recipe->hops_row).h_useat == 4) { // Boil or whirlpool
1798 item = new QTableWidgetItem(QString("%1 min.").arg(val, 1, 'f', 0, '0'));
1799 } else if (recipe->hops.at(recipe->hops_row).h_useat == 5) { // Dry-hop
1800 item = new QTableWidgetItem(QString("%1 days.").arg(val / 1440, 1, 'f', 0, '0'));
1801 } else {
1802 item = new QTableWidgetItem(QString(""));
1803 }
1804 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
1805 ui->hopsTable->setItem(recipe->hops_row, 6, item);
1806
1807 double ibu = Utils::toIBU(recipe->hops.at(recipe->hops_row).h_useat, recipe->hops.at(recipe->hops_row).h_form, recipe->preboil_sg,
1808 recipe->batch_size, recipe->hops.at(recipe->hops_row).h_amount, recipe->hops.at(recipe->hops_row).h_time,
1809 recipe->hops.at(recipe->hops_row).h_alpha, recipe->ibu_method, 0, recipe->hops.at(recipe->hops_row).h_time, 0);
1810
1811 ibuEdit->setValue(ibu);
1812 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0'));
1813 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
1814 ui->hopsTable->setItem(recipe->hops_row, 7, item);
1815
1816 this->ignoreChanges = false;
1817 calcIBUs();
1818 is_changed();
1819 }
1820
1715 1821
1716 void EditRecipe::ferment_to100_changed(bool val) 1822 void EditRecipe::ferment_to100_changed(bool val)
1717 { 1823 {
1718 qDebug() << "ferment_to100_changed()" << recipe->fermentables_row << val << recipe->fermentables_use100; 1824 qDebug() << "ferment_to100_changed()" << recipe->fermentables_row << val << recipe->fermentables_use100;
1719 1825
1726 if (! recipe->fermentables_use100 && val) { 1832 if (! recipe->fermentables_use100 && val) {
1727 /* Scenario 1. */ 1833 /* Scenario 1. */
1728 recipe->fermentables_use100 = true; 1834 recipe->fermentables_use100 = true;
1729 recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 = true; 1835 recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 = true;
1730 pctEdit->setReadOnly(false); 1836 pctEdit->setReadOnly(false);
1731 amountEdit->setReadOnly(true); 1837 famountEdit->setReadOnly(true);
1732 } else if (recipe->fermentables_use100 && recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 && ! val) { 1838 } else if (recipe->fermentables_use100 && recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 && ! val) {
1733 /* Scenario 2. */ 1839 /* Scenario 2. */
1734 recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 = false; 1840 recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 = false;
1735 recipe->fermentables_use100 = false; 1841 recipe->fermentables_use100 = false;
1736 pctEdit->setReadOnly(true); 1842 pctEdit->setReadOnly(true);
1737 amountEdit->setReadOnly(false); 1843 famountEdit->setReadOnly(false);
1738 } else if (recipe->fermentables_use100 && ! recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 && val) { 1844 } else if (recipe->fermentables_use100 && ! recipe->fermentables[recipe->fermentables_row].f_adjust_to_total_100 && val) {
1739 /* Scenario 3. */ 1845 /* Scenario 3. */
1740 for (int i = 0; i < recipe->fermentables.size(); i++) { 1846 for (int i = 0; i < recipe->fermentables.size(); i++) {
1741 recipe->fermentables[i].f_adjust_to_total_100 = false; 1847 recipe->fermentables[i].f_adjust_to_total_100 = false;
1742 } 1848 }
1755 } 1861 }
1756 1862
1757 void EditRecipe::ferment_select_changed(int val) 1863 void EditRecipe::ferment_select_changed(int val)
1758 { 1864 {
1759 QSqlQuery query; 1865 QSqlQuery query;
1760 bool instock = instockEdit->isChecked(); 1866 bool instock = finstockEdit->isChecked();
1761 QString w; 1867 QString w;
1762 QTableWidgetItem *item; 1868 QTableWidgetItem *item;
1763 1869
1764 if (val < 1) 1870 if (val < 1)
1765 return; 1871 return;
1806 recipe->fermentables[recipe->fermentables_row].f_acid_to_ph_57 = query.value(17).toDouble(); 1912 recipe->fermentables[recipe->fermentables_row].f_acid_to_ph_57 = query.value(17).toDouble();
1807 1913
1808 /* 1914 /*
1809 * Update the visible fields 1915 * Update the visible fields
1810 */ 1916 */
1811 nameEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_name); 1917 fnameEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_name);
1812 supplierEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_supplier); 1918 fsupplierEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_supplier);
1813 maxEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_max_in_batch); 1919 fmaxEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_max_in_batch);
1814 1920
1815 ui->fermentablesTable->setItem(recipe->fermentables_row, 0, new QTableWidgetItem(recipe->fermentables.at(recipe->fermentables_row).f_supplier)); 1921 ui->fermentablesTable->setItem(recipe->fermentables_row, 0, new QTableWidgetItem(recipe->fermentables.at(recipe->fermentables_row).f_supplier));
1816 ui->fermentablesTable->setItem(recipe->fermentables_row, 1, new QTableWidgetItem(recipe->fermentables.at(recipe->fermentables_row).f_name)); 1922 ui->fermentablesTable->setItem(recipe->fermentables_row, 1, new QTableWidgetItem(recipe->fermentables.at(recipe->fermentables_row).f_name));
1817 1923
1818 w = QString("%1").arg(recipe->fermentables.at(recipe->fermentables_row).f_color, 1, 'f', 0, '0'); 1924 w = QString("%1").arg(recipe->fermentables.at(recipe->fermentables_row).f_color, 1, 'f', 0, '0');
1835 this->ignoreChanges = false; 1941 this->ignoreChanges = false;
1836 calcFermentables(); 1942 calcFermentables();
1837 is_changed(); 1943 is_changed();
1838 } 1944 }
1839 1945
1946
1947 void EditRecipe::hop_select_changed(int val)
1948 {
1949 QSqlQuery query;
1950 bool instock = hinstockEdit->isChecked();
1951 QString w;
1952 QTableWidgetItem *item;
1953
1954 if (val < 1)
1955 return;
1956
1957 qDebug() << "hop_select_changed()" << recipe->fermentables_row << val << instock;
1958
1959 /*
1960 * Search the hop pointed by the index and instock flag.
1961 */
1962 QString sql = "SELECT name,origin,alpha,beta,humulene,caryophyllene,cohumulone,myrcene,hsi,total_oil,type,form,cost FROM inventory_hops ";
1963 if (instock)
1964 sql.append("WHERE inventory > 0 ");
1965 sql.append("ORDER BY origin,name");
1966 query.prepare(sql);
1967 query.exec();
1968 query.first();
1969 for (int i = 0; i < (val - 1); i++) {
1970 query.next();
1971 }
1972 qDebug() << "found" << query.value(1).toString() << query.value(0).toString();
1973
1974 /*
1975 * Replace the hop record contents
1976 */
1977 this->ignoreChanges = true;
1978 recipe->hops[recipe->hops_row].h_name = query.value(0).toString();
1979 recipe->hops[recipe->hops_row].h_origin = query.value(1).toString();
1980 recipe->hops[recipe->hops_row].h_alpha = query.value(2).toDouble();
1981 recipe->hops[recipe->hops_row].h_beta = query.value(3).toDouble();
1982 recipe->hops[recipe->hops_row].h_humulene = query.value(4).toDouble();
1983 recipe->hops[recipe->hops_row].h_caryophyllene = query.value(5).toDouble();
1984 recipe->hops[recipe->hops_row].h_cohumulone = query.value(6).toDouble();
1985 recipe->hops[recipe->hops_row].h_myrcene = query.value(7).toDouble();
1986 recipe->hops[recipe->hops_row].h_hsi = query.value(8).toDouble();
1987 recipe->hops[recipe->hops_row].h_total_oil = query.value(9).toDouble();
1988 recipe->hops[recipe->hops_row].h_type = query.value(10).toInt();
1989 recipe->hops[recipe->hops_row].h_form = query.value(11).toInt();
1990 recipe->hops[recipe->hops_row].h_cost = query.value(12).toDouble();
1991
1992 /*
1993 * Update the visible fields
1994 */
1995 hnameEdit->setText(recipe->hops.at(recipe->hops_row).h_name);
1996 horiginEdit->setText(recipe->hops.at(recipe->hops_row).h_origin);
1997
1998 double ibu = Utils::toIBU(recipe->hops.at(recipe->hops_row).h_useat, recipe->hops.at(recipe->hops_row).h_form, recipe->preboil_sg,
1999 recipe->batch_size, recipe->hops.at(recipe->hops_row).h_amount, recipe->hops.at(recipe->hops_row).h_time,
2000 recipe->hops.at(recipe->hops_row).h_alpha, recipe->ibu_method, 0, recipe->hops.at(recipe->hops_row).h_time, 0);
2001 ibuEdit->setValue(ibu);
2002
2003 ui->hopsTable->setItem(recipe->hops_row, 0, new QTableWidgetItem(recipe->hops.at(recipe->hops_row).h_origin));
2004 ui->hopsTable->setItem(recipe->hops_row, 1, new QTableWidgetItem(recipe->hops.at(recipe->hops_row).h_name));
2005
2006 item = new QTableWidgetItem(h_types[recipe->hops.at(recipe->hops_row).h_type]);
2007 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
2008 ui->hopsTable->setItem(recipe->hops_row, 2, item);
2009
2010 item = new QTableWidgetItem(h_forms[recipe->hops.at(recipe->hops_row).h_form]);
2011 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
2012 ui->hopsTable->setItem(recipe->hops_row, 3, item);
2013
2014 item = new QTableWidgetItem(QString("%1%").arg(recipe->hops.at(recipe->hops_row).h_alpha, 2, 'f', 1, '0'));
2015 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
2016 ui->hopsTable->setItem(recipe->hops_row, 4, item);
2017
2018 item = new QTableWidgetItem(QString("%1").arg(ibu, 2, 'f', 1, '0'));
2019 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
2020 ui->hopsTable->setItem(recipe->hops_row, 7, item);
2021
2022 this->ignoreChanges = false;
2023 calcIBUs();
2024 is_changed();
2025 }
2026
2027
1840 void EditRecipe::ferment_instock_changed(bool val) 2028 void EditRecipe::ferment_instock_changed(bool val)
1841 { 2029 {
1842 QSqlQuery query; 2030 QSqlQuery query;
1843 2031
1844 qDebug() << "ferment_instock_changed()" << recipe->fermentables_row << val; 2032 qDebug() << "ferment_instock_changed()" << recipe->fermentables_row << val;
1845 2033
1846 this->selectEdit->setCurrentIndex(-1); 2034 this->fselectEdit->setCurrentIndex(-1);
1847 this->selectEdit->clear(); 2035 this->fselectEdit->clear();
1848 QString sql = "SELECT supplier,name,color,inventory FROM inventory_fermentables "; 2036 QString sql = "SELECT supplier,name,color,inventory FROM inventory_fermentables ";
1849 if (val) 2037 if (val)
1850 sql.append("WHERE inventory > 0 "); 2038 sql.append("WHERE inventory > 0 ");
1851 sql.append("ORDER BY supplier,name"); 2039 sql.append("ORDER BY supplier,name");
1852 query.prepare(sql); 2040 query.prepare(sql);
1853 query.exec(); 2041 query.exec();
1854 query.first(); 2042 query.first();
1855 this->selectEdit->addItem(""); // Start with empty value 2043 this->fselectEdit->addItem(""); // Start with empty value
1856 for (int i = 0; i < query.size(); i++) { 2044 for (int i = 0; i < query.size(); i++) {
1857 this->selectEdit->addItem(query.value(0).toString()+" - "+query.value(1).toString()+" ("+query.value(2).toString()+" EBC) "+ 2045 this->fselectEdit->addItem(query.value(0).toString()+" - "+query.value(1).toString()+" ("+query.value(2).toString()+" EBC) "+
1858 QString("%1 kg").arg(query.value(3).toDouble(), 4, 'f', 3, '0')); 2046 QString("%1 kg").arg(query.value(3).toDouble(), 4, 'f', 3, '0'));
1859 query.next(); 2047 query.next();
1860 } 2048 }
1861 } 2049 }
2050
2051
2052 void EditRecipe::hop_instock_changed(bool val)
2053 {
2054 QSqlQuery query;
2055
2056 qDebug() << "hop_instock_changed()" << recipe->hops_row << val;
2057
2058 this->hselectEdit->setCurrentIndex(-1);
2059 this->hselectEdit->clear();
2060 QString sql = "SELECT origin,name,alpha,inventory FROM inventory_hops ";
2061 if (val)
2062 sql.append("WHERE inventory > 0 ");
2063 sql.append("ORDER BY origin,name");
2064 query.prepare(sql);
2065 query.exec();
2066 query.first();
2067 this->hselectEdit->addItem(""); // Start with empty value
2068 for (int i = 0; i < query.size(); i++) {
2069 this->hselectEdit->addItem(query.value(0).toString()+" - "+query.value(1).toString()+" ("+query.value(2).toString()+"%) "+
2070 QString("%1 gr").arg(query.value(3).toDouble() * 1000.0, 2, 'f', 1, '0'));
2071 query.next();
2072 }
2073 }
2074
1862 2075
1863 void EditRecipe::ferment_added_changed(int val) 2076 void EditRecipe::ferment_added_changed(int val)
1864 { 2077 {
1865 qDebug() << "ferment_added_changed()" << recipe->fermentables_row << val; 2078 qDebug() << "ferment_added_changed()" << recipe->fermentables_row << val;
1866 2079
1875 if (recipe->fermentables.at(i).f_added < 4) // Only before bottle/kegging 2088 if (recipe->fermentables.at(i).f_added < 4) // Only before bottle/kegging
1876 total += recipe->fermentables.at(i).f_amount; 2089 total += recipe->fermentables.at(i).f_amount;
1877 for (int i = 0; i < recipe->fermentables.size(); i++) 2090 for (int i = 0; i < recipe->fermentables.size(); i++)
1878 if (recipe->fermentables.at(i).f_added < 4) 2091 if (recipe->fermentables.at(i).f_added < 4)
1879 recipe->fermentables[i].f_percentage = recipe->fermentables.at(i).f_amount / total * 100; 2092 recipe->fermentables[i].f_percentage = recipe->fermentables.at(i).f_amount / total * 100;
2093
2094 this->ignoreChanges = false;
2095 is_changed();
2096 emit refreshAll();
2097 }
2098
2099
2100 void EditRecipe::hop_useat_changed(int val)
2101 {
2102 qDebug() << "hop_useat_changed()" << recipe->hops_row << val;
2103
2104 this->ignoreChanges = true;
2105 recipe->hops[recipe->hops_row].h_useat = val;
2106 QTableWidgetItem *item = new QTableWidgetItem(h_useat[val]);
2107 item->setTextAlignment(Qt::AlignCenter|Qt::AlignVCenter);
2108 ui->hopsTable->setItem(recipe->hops_row, 5, item);
2109
2110 if (val == 2 || val == 4) { // Boil or whirlpool
2111 htimeLabel->setText(tr("Time in minutes:"));
2112 htimeEdit->setValue(recipe->hops.at(recipe->hops_row).h_time);
2113 htimeEdit->setReadOnly(false);
2114 } else if (val == 5) { // Dry-hop
2115 htimeLabel->setText(tr("Time in days:"));
2116 htimeEdit->setValue(recipe->hops.at(recipe->hops_row).h_time / 1440);
2117 htimeEdit->setReadOnly(false);
2118 } else {
2119 htimeLabel->setText("");
2120 htimeEdit->setValue(0);
2121 htimeEdit->setReadOnly(true);
2122 }
1880 2123
1881 this->ignoreChanges = false; 2124 this->ignoreChanges = false;
1882 is_changed(); 2125 is_changed();
1883 emit refreshAll(); 2126 emit refreshAll();
1884 } 2127 }
1946 maxLabel->setObjectName(QString::fromUtf8("maxLabel")); 2189 maxLabel->setObjectName(QString::fromUtf8("maxLabel"));
1947 maxLabel->setText(tr("Max in batch:")); 2190 maxLabel->setText(tr("Max in batch:"));
1948 maxLabel->setGeometry(QRect(420, 130, 121, 20)); 2191 maxLabel->setGeometry(QRect(420, 130, 121, 20));
1949 maxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 2192 maxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
1950 2193
1951 selectEdit = new QComboBox(dialog); 2194 fselectEdit = new QComboBox(dialog);
1952 selectEdit->setObjectName(QString::fromUtf8("selectEdit")); 2195 fselectEdit->setObjectName(QString::fromUtf8("fselectEdit"));
1953 selectEdit->setGeometry(QRect(160, 70, 371, 23)); 2196 fselectEdit->setGeometry(QRect(160, 70, 371, 23));
1954 2197
1955 nameEdit = new QLineEdit(dialog); 2198 fnameEdit = new QLineEdit(dialog);
1956 nameEdit->setObjectName(QString::fromUtf8("nameEdit")); 2199 fnameEdit->setObjectName(QString::fromUtf8("fnameEdit"));
1957 nameEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_name); 2200 fnameEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_name);
1958 nameEdit->setGeometry(QRect(160, 10, 511, 23)); 2201 fnameEdit->setGeometry(QRect(160, 10, 511, 23));
1959 nameEdit->setReadOnly(true); 2202 fnameEdit->setReadOnly(true);
1960 supplierEdit = new QLineEdit(dialog); 2203 fsupplierEdit = new QLineEdit(dialog);
1961 supplierEdit->setObjectName(QString::fromUtf8("supplierEdit")); 2204 fsupplierEdit->setObjectName(QString::fromUtf8("fsupplierEdit"));
1962 supplierEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_supplier); 2205 fsupplierEdit->setText(recipe->fermentables.at(recipe->fermentables_row).f_supplier);
1963 supplierEdit->setGeometry(QRect(160, 40, 511, 23)); 2206 fsupplierEdit->setGeometry(QRect(160, 40, 511, 23));
1964 supplierEdit->setReadOnly(true); 2207 fsupplierEdit->setReadOnly(true);
1965 amountEdit = new QDoubleSpinBox(dialog); 2208 famountEdit = new QDoubleSpinBox(dialog);
1966 amountEdit->setObjectName(QString::fromUtf8("amountEdit")); 2209 famountEdit->setObjectName(QString::fromUtf8("famountEdit"));
1967 amountEdit->setGeometry(QRect(160, 100, 121, 24)); 2210 famountEdit->setGeometry(QRect(160, 100, 121, 24));
1968 amountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 2211 famountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
1969 amountEdit->setAccelerated(true); 2212 famountEdit->setAccelerated(true);
1970 amountEdit->setDecimals(3); 2213 famountEdit->setDecimals(3);
1971 amountEdit->setReadOnly(recipe->fermentables_use100); 2214 famountEdit->setReadOnly(recipe->fermentables_use100);
1972 amountEdit->setMaximum(100000.0); 2215 famountEdit->setMaximum(100000.0);
1973 amountEdit->setSingleStep(0.0010); 2216 famountEdit->setSingleStep(0.0010);
1974 amountEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_amount); 2217 famountEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_amount);
1975 2218
1976 pctEdit = new QDoubleSpinBox(dialog); 2219 pctEdit = new QDoubleSpinBox(dialog);
1977 pctEdit->setObjectName(QString::fromUtf8("pctEdit")); 2220 pctEdit->setObjectName(QString::fromUtf8("pctEdit"));
1978 pctEdit->setGeometry(QRect(160, 130, 121, 24)); 2221 pctEdit->setGeometry(QRect(160, 130, 121, 24));
1979 pctEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 2222 pctEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
1989 } 2232 }
1990 pctEdit->setMaximum(100.0); 2233 pctEdit->setMaximum(100.0);
1991 pctEdit->setSingleStep(0.1); 2234 pctEdit->setSingleStep(0.1);
1992 pctEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_percentage); 2235 pctEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_percentage);
1993 2236
1994 addedEdit = new QComboBox(dialog); 2237 faddedEdit = new QComboBox(dialog);
1995 addedEdit->setObjectName(QString::fromUtf8("addedEdit")); 2238 faddedEdit->setObjectName(QString::fromUtf8("faddedEdit"));
1996 addedEdit->setGeometry(QRect(160, 190, 161, 23)); 2239 faddedEdit->setGeometry(QRect(160, 190, 161, 23));
1997 addedEdit->addItem(tr("Mash")); 2240 faddedEdit->addItem(tr("Mash"));
1998 addedEdit->addItem(tr("Boil")); 2241 faddedEdit->addItem(tr("Boil"));
1999 addedEdit->addItem(tr("Fermentation")); 2242 faddedEdit->addItem(tr("Fermentation"));
2000 addedEdit->addItem(tr("Lagering")); 2243 faddedEdit->addItem(tr("Lagering"));
2001 addedEdit->addItem(tr("Bottle")); 2244 faddedEdit->addItem(tr("Bottle"));
2002 addedEdit->addItem(tr("Kegs")); 2245 faddedEdit->addItem(tr("Kegs"));
2003 addedEdit->setCurrentIndex(recipe->fermentables.at(recipe->fermentables_row).f_added); 2246 faddedEdit->setCurrentIndex(recipe->fermentables.at(recipe->fermentables_row).f_added);
2004 2247
2005 to100Edit = new QCheckBox(dialog); 2248 to100Edit = new QCheckBox(dialog);
2006 to100Edit->setObjectName(QString::fromUtf8("to100Edit")); 2249 to100Edit->setObjectName(QString::fromUtf8("to100Edit"));
2007 to100Edit->setGeometry(QRect(160, 160, 85, 21)); 2250 to100Edit->setGeometry(QRect(160, 160, 85, 21));
2008 to100Edit->setChecked(recipe->fermentables.at(recipe->fermentables_row).f_adjust_to_total_100); 2251 to100Edit->setChecked(recipe->fermentables.at(recipe->fermentables_row).f_adjust_to_total_100);
2009 2252
2010 instockEdit = new QCheckBox(dialog); 2253 finstockEdit = new QCheckBox(dialog);
2011 instockEdit->setObjectName(QString::fromUtf8("instockEdit")); 2254 finstockEdit->setObjectName(QString::fromUtf8("instockEdit"));
2012 instockEdit->setGeometry(QRect(655, 70, 85, 21)); 2255 finstockEdit->setGeometry(QRect(655, 70, 85, 21));
2013 instockEdit->setChecked(true); 2256 finstockEdit->setChecked(true);
2014 2257
2015 maxEdit = new QDoubleSpinBox(dialog); 2258 fmaxEdit = new QDoubleSpinBox(dialog);
2016 maxEdit->setObjectName(QString::fromUtf8("maxEdit")); 2259 fmaxEdit->setObjectName(QString::fromUtf8("fmaxEdit"));
2017 maxEdit->setGeometry(QRect(550, 130, 121, 24)); 2260 fmaxEdit->setGeometry(QRect(550, 130, 121, 24));
2018 maxEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 2261 fmaxEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2019 maxEdit->setReadOnly(true); 2262 fmaxEdit->setReadOnly(true);
2020 maxEdit->setButtonSymbols(QAbstractSpinBox::NoButtons); 2263 fmaxEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
2021 maxEdit->setDecimals(1); 2264 fmaxEdit->setDecimals(1);
2022 maxEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_max_in_batch); 2265 fmaxEdit->setValue(recipe->fermentables.at(recipe->fermentables_row).f_max_in_batch);
2023 2266
2024 ferment_instock_changed(true); 2267 ferment_instock_changed(true);
2025 2268
2026 connect(selectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::ferment_select_changed); 2269 connect(fselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::ferment_select_changed);
2027 connect(amountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::ferment_amount_changed); 2270 connect(famountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::ferment_amount_changed);
2028 connect(pctEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::ferment_pct_changed); 2271 connect(pctEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::ferment_pct_changed);
2029 connect(addedEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::ferment_added_changed); 2272 connect(faddedEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::ferment_added_changed);
2030 connect(to100Edit, &QCheckBox::stateChanged, this, &EditRecipe::ferment_to100_changed); 2273 connect(to100Edit, &QCheckBox::stateChanged, this, &EditRecipe::ferment_to100_changed);
2031 connect(instockEdit, &QCheckBox::stateChanged, this, &EditRecipe::ferment_instock_changed); 2274 connect(finstockEdit, &QCheckBox::stateChanged, this, &EditRecipe::ferment_instock_changed);
2032 connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); 2275 connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
2033 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); 2276 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
2034 2277
2035 dialog->setModal(true); 2278 dialog->setModal(true);
2036 dialog->exec(); 2279 dialog->exec();
2052 recipe->fermentables[i].f_percentage = recipe->fermentables.at(i).f_amount / total * 100; 2295 recipe->fermentables[i].f_percentage = recipe->fermentables.at(i).f_amount / total * 100;
2053 } 2296 }
2054 } 2297 }
2055 } 2298 }
2056 2299
2057 disconnect(selectEdit, nullptr, nullptr, nullptr); 2300 disconnect(fselectEdit, nullptr, nullptr, nullptr);
2058 disconnect(amountEdit, nullptr, nullptr, nullptr); 2301 disconnect(famountEdit, nullptr, nullptr, nullptr);
2059 disconnect(pctEdit, nullptr, nullptr, nullptr); 2302 disconnect(pctEdit, nullptr, nullptr, nullptr);
2060 disconnect(addedEdit, nullptr, nullptr, nullptr); 2303 disconnect(faddedEdit, nullptr, nullptr, nullptr);
2061 disconnect(to100Edit, nullptr, nullptr, nullptr); 2304 disconnect(to100Edit, nullptr, nullptr, nullptr);
2062 disconnect(instockEdit, nullptr, nullptr, nullptr); 2305 disconnect(finstockEdit, nullptr, nullptr, nullptr);
2306 disconnect(buttonBox, nullptr, nullptr, nullptr);
2307
2308 emit refreshAll();
2309 }
2310
2311
2312 void EditRecipe::on_editHopRow_clicked()
2313 {
2314 QSqlQuery query;
2315
2316 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
2317 recipe->hops_row = pb->objectName().toInt();
2318 qDebug() << "Edit hop row" << recipe->hops_row;
2319 Hops backup = recipe->hops.at(recipe->hops_row);
2320
2321 QDialog* dialog = new QDialog(this);
2322 dialog->resize(738, 260);
2323 QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
2324 buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
2325 buttonBox->setGeometry(QRect(30, 210, 671, 32));
2326 buttonBox->setLayoutDirection(Qt::LeftToRight);
2327 buttonBox->setOrientation(Qt::Horizontal);
2328 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
2329 buttonBox->setCenterButtons(true);
2330 QLabel *nameLabel = new QLabel(dialog);
2331 nameLabel->setObjectName(QString::fromUtf8("nameLabel"));
2332 nameLabel->setText(tr("Current hop:"));
2333 nameLabel->setGeometry(QRect(10, 10, 141, 20));
2334 nameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2335 QLabel *originLabel = new QLabel(dialog);
2336 originLabel->setObjectName(QString::fromUtf8("originLabel"));
2337 originLabel->setText(tr("Origin:"));
2338 originLabel->setGeometry(QRect(10, 40, 141, 20));
2339 originLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2340 QLabel *amountLabel = new QLabel(dialog);
2341 amountLabel->setObjectName(QString::fromUtf8("amountLabel"));
2342 amountLabel->setText(tr("Amount in gr:"));
2343 amountLabel->setGeometry(QRect(10, 100, 141, 20));
2344 amountLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2345 htimeLabel = new QLabel(dialog);
2346 htimeLabel->setObjectName(QString::fromUtf8("htimeLabel"));
2347 if (recipe->hops.at(recipe->hops_row).h_useat == 5) // Dry-hop
2348 htimeLabel->setText(tr("Time in days:"));
2349 else if (recipe->hops.at(recipe->hops_row).h_useat == 2 || recipe->hops.at(recipe->hops_row).h_useat == 4) // Boil or whirlpool
2350 htimeLabel->setText(tr("Time in minutes:"));
2351 else
2352 htimeLabel->setText("");
2353
2354 htimeLabel->setGeometry(QRect(10, 130, 141, 20));
2355 htimeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2356 QLabel *useatLabel = new QLabel(dialog);
2357 useatLabel->setObjectName(QString::fromUtf8("useatLabel"));
2358 useatLabel->setText(tr("Use at:"));
2359 useatLabel->setGeometry(QRect(10, 160, 141, 20));
2360 useatLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2361 QLabel *selectLabel = new QLabel(dialog);
2362 selectLabel->setObjectName(QString::fromUtf8("selectLabel"));
2363 selectLabel->setText(tr("Select hop:"));
2364 selectLabel->setGeometry(QRect(10, 70, 141, 20));
2365 selectLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2366 QLabel *instockLabel = new QLabel(dialog);
2367 instockLabel->setObjectName(QString::fromUtf8("instockLabel"));
2368 instockLabel->setText(tr("In stock:"));
2369 instockLabel->setGeometry(QRect(525, 70, 121, 20));
2370 instockLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2371 QLabel *ibuLabel = new QLabel(dialog);
2372 ibuLabel->setObjectName(QString::fromUtf8("maxLabel"));
2373 ibuLabel->setText(tr("Bitterness IBU:"));
2374 ibuLabel->setGeometry(QRect(420, 130, 121, 20));
2375 ibuLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2376
2377 hselectEdit = new QComboBox(dialog);
2378 hselectEdit->setObjectName(QString::fromUtf8("selectEdit"));
2379 hselectEdit->setGeometry(QRect(160, 70, 371, 23));
2380
2381 hnameEdit = new QLineEdit(dialog);
2382 hnameEdit->setObjectName(QString::fromUtf8("hnameEdit"));
2383 hnameEdit->setText(recipe->hops.at(recipe->hops_row).h_name);
2384 hnameEdit->setGeometry(QRect(160, 10, 511, 23));
2385 hnameEdit->setReadOnly(true);
2386 horiginEdit = new QLineEdit(dialog);
2387 horiginEdit->setObjectName(QString::fromUtf8("horiginEdit"));
2388 horiginEdit->setText(recipe->hops.at(recipe->hops_row).h_origin);
2389 horiginEdit->setGeometry(QRect(160, 40, 511, 23));
2390 horiginEdit->setReadOnly(true);
2391 hamountEdit = new QDoubleSpinBox(dialog);
2392 hamountEdit->setObjectName(QString::fromUtf8("hamountEdit"));
2393 hamountEdit->setGeometry(QRect(160, 100, 121, 24));
2394 hamountEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2395 hamountEdit->setAccelerated(true);
2396 hamountEdit->setDecimals(1);
2397 hamountEdit->setMaximum(1000000.0);
2398 hamountEdit->setSingleStep(0.5);
2399 hamountEdit->setValue(recipe->hops.at(recipe->hops_row).h_amount * 1000.0);
2400 htimeEdit = new QSpinBox(dialog);
2401 htimeEdit->setObjectName(QString::fromUtf8("htimeEdit"));
2402 htimeEdit->setGeometry(QRect(160, 130, 121, 24));
2403 htimeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2404 htimeEdit->setAccelerated(true);
2405 htimeEdit->setMaximum(10000.0);
2406 if (recipe->hops.at(recipe->hops_row).h_useat == 2 || recipe->hops.at(recipe->hops_row).h_useat == 4) { // Boil or whirlpool
2407 htimeEdit->setValue(recipe->hops.at(recipe->hops_row).h_time);
2408 htimeEdit->setReadOnly(false);
2409 } else if (recipe->hops.at(recipe->hops_row).h_useat == 5){ // Dry-hop
2410 htimeEdit->setValue(recipe->hops.at(recipe->hops_row).h_time / 1440);
2411 htimeEdit->setReadOnly(false);
2412 } else {
2413 htimeEdit->setReadOnly(true);
2414 }
2415 useatEdit = new QComboBox(dialog);
2416 useatEdit->setObjectName(QString::fromUtf8("useatEdit"));
2417 useatEdit->setGeometry(QRect(160, 160, 161, 23));
2418 useatEdit->addItem(tr("Mash"));
2419 useatEdit->addItem(tr("First wort"));
2420 useatEdit->addItem(tr("Boil"));
2421 useatEdit->addItem(tr("Aroma"));
2422 useatEdit->addItem(tr("Whirlpool"));
2423 useatEdit->addItem(tr("Dry hop"));
2424 useatEdit->setCurrentIndex(recipe->hops.at(recipe->hops_row).h_useat);
2425
2426 hinstockEdit = new QCheckBox(dialog);
2427 hinstockEdit->setObjectName(QString::fromUtf8("hinstockEdit"));
2428 hinstockEdit->setGeometry(QRect(655, 70, 85, 21));
2429 hinstockEdit->setChecked(true);
2430
2431 ibuEdit = new QDoubleSpinBox(dialog);
2432 ibuEdit->setObjectName(QString::fromUtf8("ibuEdit"));
2433 ibuEdit->setGeometry(QRect(550, 130, 121, 24));
2434 ibuEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
2435 ibuEdit->setReadOnly(true);
2436 ibuEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
2437 ibuEdit->setDecimals(1);
2438 double ibu = Utils::toIBU(recipe->hops.at(recipe->hops_row).h_useat, recipe->hops.at(recipe->hops_row).h_form, recipe->preboil_sg,
2439 recipe->batch_size, recipe->hops.at(recipe->hops_row).h_amount, recipe->hops.at(recipe->hops_row).h_time,
2440 recipe->hops.at(recipe->hops_row).h_alpha, recipe->ibu_method, 0, recipe->hops.at(recipe->hops_row).h_time, 0);
2441 ibuEdit->setValue(ibu);
2442
2443 hop_instock_changed(true);
2444
2445 connect(hselectEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::hop_select_changed);
2446 connect(hamountEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &EditRecipe::hop_amount_changed);
2447 connect(htimeEdit, QOverload<int>::of(&QSpinBox::valueChanged), this, &EditRecipe::hop_time_changed);
2448 connect(useatEdit, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &EditRecipe::hop_useat_changed);
2449 connect(hinstockEdit, &QCheckBox::stateChanged, this, &EditRecipe::hop_instock_changed);
2450 connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));
2451 connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
2452
2453 dialog->setModal(true);
2454 dialog->exec();
2455 if (dialog->result() == QDialog::Rejected) {
2456 qDebug() << "reject and rollback";
2457 recipe->hops[recipe->hops_row] = backup;
2458 } else {
2459 /* Clear time if hop is not used for boil, whirlpool or dry-hop. */
2460 if (! (recipe->hops.at(recipe->hops_row).h_useat == 2 ||
2461 recipe->hops.at(recipe->hops_row).h_useat == 4 ||
2462 recipe->hops.at(recipe->hops_row).h_useat == 5)) {
2463 if (recipe->hops.at(recipe->hops_row).h_time) {
2464 recipe->hops[recipe->hops_row].h_time = 0;
2465 is_changed();
2466 }
2467 }
2468 }
2469
2470 disconnect(hselectEdit, nullptr, nullptr, nullptr);
2471 disconnect(hamountEdit, nullptr, nullptr, nullptr);
2472 disconnect(htimeEdit, nullptr, nullptr, nullptr);
2473 disconnect(useatEdit, nullptr, nullptr, nullptr);
2474 disconnect(hinstockEdit, nullptr, nullptr, nullptr);
2063 disconnect(buttonBox, nullptr, nullptr, nullptr); 2475 disconnect(buttonBox, nullptr, nullptr, nullptr);
2064 2476
2065 emit refreshAll(); 2477 emit refreshAll();
2066 } 2478 }
2067 2479

mercurial