# HG changeset patch # User Michiel Broek # Date 1645305429 -3600 # Node ID fcbbddcc22c1054f1fdf787c85a948ecafa16a3c # Parent c94edc758a5b169b5995160e65181a4747bea7ca Completed the Fermentables editor. diff -r c94edc758a5b -r fcbbddcc22c1 CMakeLists.txt --- a/CMakeLists.txt Fri Feb 18 15:53:02 2022 +0100 +++ b/CMakeLists.txt Sat Feb 19 22:17:09 2022 +0100 @@ -101,9 +101,12 @@ ${SRCDIR}/InventorySuppliers.cpp ${SRCDIR}/EditSupplier.cpp ${SRCDIR}/InventoryFermentables.cpp + ${SRCDIR}/EditFermentable.cpp ${SRCDIR}/Setup.cpp + ${SRCDIR}/Utils.cpp ${SRCDIR}/MainWindow.cpp ${SRCDIR}/database/database.cpp + ${SRCDIR}/nulldateedit.cpp ) set( HDRS @@ -112,9 +115,12 @@ ${SRCDIR}/InventorySuppliers.h ${SRCDIR}/EditSupplier.h ${SRCDIR}/InventoryFermentables.h + ${SRCDIR}/EditFermentable.h ${SRCDIR}/Setup.h + ${SRCDIR}/Utils.h ${SRCDIR}/MainWindow.h ${SRCDIR}/database/database.h + ${SRCDIR}/nulldateedit.h ) set( UIS @@ -122,6 +128,7 @@ ${UIDIR}/InventorySuppliers.ui ${UIDIR}/EditSupplier.ui ${UIDIR}/InventoryFermentables.ui + ${UIDIR}/EditFermentable.ui ${UIDIR}/Setup.ui ${UIDIR}/MainWindow.ui ) diff -r c94edc758a5b -r fcbbddcc22c1 src/EditFermentable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/EditFermentable.cpp Sat Feb 19 22:17:09 2022 +0100 @@ -0,0 +1,296 @@ +/** + * EditFermentable.cpp is part of bmsapp. + * + * bmsapp is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * bmsapp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "EditFermentable.h" +#include "../ui/ui_EditFermentable.h" +#include "bmsapp.h" + + +EditFermentable::EditFermentable(int id, QWidget *parent) : QDialog(parent), ui(new Ui::EditFermentable) +{ + QSqlQuery query; + + qDebug() << "EditFermentable record:" << id; + ui->setupUi(this); + this->recno = id; + + WindowTitle(); + + ui->typeEdit->addItem(tr("Grain")); + ui->typeEdit->addItem(tr("Sugar")); + ui->typeEdit->addItem(tr("Extract")); + ui->typeEdit->addItem(tr("Dry extract")); + ui->typeEdit->addItem(tr("Adjunct")); + + ui->graintypeEdit->addItem(tr("Base")); + ui->graintypeEdit->addItem(tr("Roast")); + ui->graintypeEdit->addItem(tr("Crystal")); + ui->graintypeEdit->addItem(tr("Kilned")); + ui->graintypeEdit->addItem(tr("Sour Malt")); + ui->graintypeEdit->addItem(tr("Special")); + ui->graintypeEdit->addItem(tr("No malt")); + + ui->addedEdit->addItem(tr("Mash")); + ui->addedEdit->addItem(tr("Boil")); + ui->addedEdit->addItem(tr("Fermentation")); + ui->addedEdit->addItem(tr("Lagering")); + ui->addedEdit->addItem(tr("Bottle")); + ui->addedEdit->addItem(tr("Kegs")); + + if (id >= 0) { + query.prepare("SELECT * FROM inventory_fermentables WHERE record = :recno"); + query.bindValue(":recno", id); + query.exec(); + query.next(); + + ui->nameEdit->setText(query.value(1).toString()); + ui->notesEdit->setPlainText(query.value(8).toString()); + ui->originEdit->setText(query.value(6).toString()); + ui->supplierEdit->setText(query.value(7).toString()); + ui->typeEdit->setCurrentIndex(query.value(2).toInt()); + ui->graintypeEdit->setCurrentIndex(query.value(20).toInt()); + ui->maxinbatchEdit->setValue(query.value(14).toDouble()); + ui->mashEdit->setChecked(query.value(16).toInt() ? true:false); + ui->addafterEdit->setChecked(query.value(5).toInt() ? true:false); + ui->addedEdit->setCurrentIndex(query.value(17).toInt()); + ui->alwaysEdit->setChecked(query.value(5).toInt() ? true:false); + ui->inventoryEdit->setValue(query.value(21).toDouble()); + ui->costEdit->setValue(query.value(22).toDouble()); + ui->valueEdit->setValue(query.value(21).toDouble() * query.value(22).toDouble()); + ui->yieldEdit->setValue(query.value(3).toDouble()); + ui->colorEdit->setValue(query.value(4).toDouble()); + ui->moistureEdit->setValue(query.value(10).toDouble()); + ui->coarseEdit->setValue(query.value(9).toDouble()); + ui->proteinEdit->setValue(query.value(12).toDouble()); + ui->dissolvedEdit->setValue(query.value(13).toDouble()); + ui->diastaticEdit->setValue(Utils::lintner_to_kolbach(query.value(11).toDouble())); + ui->diphEdit->setValue(query.value(18).toDouble()); + ui->acidphEdit->setValue(query.value(19).toDouble()); + if (query.value(23).toString().length() == 10) { + ui->prodEdit->setDate(query.value(23).toDate()); + } else { + ui->prodEdit->clear(); + } + if (query.value(24).toString().length() == 10) { + ui->thtEdit->setDate(query.value(24).toDate()); + } else { + ui->thtEdit->clear(); + } + } else { + /* Set some defaults */ + ui->typeEdit->setCurrentIndex(0); + ui->graintypeEdit->setCurrentIndex(0); + ui->maxinbatchEdit->setValue(100); + ui->mashEdit->setChecked(true); + ui->addedEdit->setCurrentIndex(0); + ui->yieldEdit->setValue(80); + ui->colorEdit->setValue(3); + ui->coarseEdit->setValue(3); + ui->moistureEdit->setValue(4); + } + connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditFermentable::is_changed); + connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed())); + connect(ui->originEdit, &QLineEdit::textChanged, this, &EditFermentable::is_changed); + connect(ui->supplierEdit, &QLineEdit::textChanged, this, &EditFermentable::is_changed); + connect(ui->typeEdit, &QComboBox::currentTextChanged, this, &EditFermentable::is_changed); + connect(ui->graintypeEdit, &QComboBox::currentTextChanged, this, &EditFermentable::is_changed); + connect(ui->maxinbatchEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->mashEdit, &QCheckBox::stateChanged, this, &EditFermentable::is_changed); + connect(ui->addafterEdit, &QCheckBox::stateChanged, this, &EditFermentable::is_changed); + connect(ui->addedEdit, &QComboBox::currentTextChanged, this, &EditFermentable::is_changed); + connect(ui->alwaysEdit, &QCheckBox::stateChanged, this, &EditFermentable::is_changed); + connect(ui->inventoryEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->costEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->yieldEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->colorEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->moistureEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->coarseEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->proteinEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->dissolvedEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->diastaticEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->diphEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->acidphEdit, &QDoubleSpinBox::textChanged, this, &EditFermentable::is_changed); + connect(ui->prodEdit, &QDateEdit::dateChanged, this, &EditFermentable::is_changed); + connect(ui->thtEdit, &QDateEdit::dateChanged, this, &EditFermentable::is_changed); + + ui->saveButton->setEnabled(false); + ui->deleteButton->setEnabled((ui->inventoryEdit->value() == 0 && id >= 0) ? true:false); +} + + +EditFermentable::~EditFermentable() +{ + qDebug() << "EditFermentable done"; + delete ui; + emit entry_changed(); +} + + +/* + * Window header, mark any change with '**' + */ +void EditFermentable::WindowTitle() +{ + QString txt; + + if (this->recno < 0) { + txt = QString(tr("BMSapp - Add new fermentable")); + } else { + txt = QString(tr("BMSapp - Edit fermentable %1").arg(this->recno)); + } + + if (this->textIsChanged) { + txt.append((QString(" **"))); + } + setWindowTitle(txt); +} + + +void EditFermentable::on_saveButton_clicked() +{ + QSqlQuery query; + + /* If there are errors in the form, show a message and do "return;" */ + if (ui->nameEdit->text().length() < 2) { + QMessageBox::warning(this, tr("Edit Fermentable"), tr("Name empty or too short.")); + return; + } + if (ui->originEdit->text().length() < 2) { + QMessageBox::warning(this, tr("Edit Fermentable"), tr("Origin empty or too short.")); + return; + } + if (ui->supplierEdit->text().length() < 2) { + QMessageBox::warning(this, tr("Edit Fermentable"), tr("Supplier empty or too short.")); + return; + } + + if (this->textIsChanged) { + if (this->recno == -1) { + query.prepare("INSERT INTO inventory_fermentables SET name=:name, type=:type, yield=:yield, color=:color, " + "add_after_boil=:addafter, origin=:origin, supplier=:supplier, notes=:notes, coarse_fine_diff=:coarse, " + "moisture=:moisture, diastatic_power=:diastatic, protein=:protein, dissolved_protein=:dissolved, " + "max_in_batch=:maxinbatch, recommend_mash=:mash, added=:added, always_on_stock=:always, di_ph=:diph, " + "acid_to_ph_57=:acidph, graintype=:graintype, inventory=:inventory, cost=:cost, production_date=:prod, " + "tht_date=:tht, uuid = :uuid"); + } else { + query.prepare("UPDATE inventory_fermentables SET name=:name, type=:type, yield=:yield, color=:color, " + "add_after_boil=:addafter, origin=:origin, supplier=:supplier, notes=:notes, coarse_fine_diff=:coarse, " + "moisture=:moisture, diastatic_power=:diastatic, protein=:protein, dissolved_protein=:dissolved, " + "max_in_batch=:maxinbatch, recommend_mash=:mash, added=:added, always_on_stock=:always, di_ph=:diph, " + "acid_to_ph_57=:acidph, graintype=:graintype, inventory=:inventory, cost=:cost, production_date=:prod, " + "tht_date=:tht WHERE record = :recno"); + } + query.bindValue(":name", ui->nameEdit->text()); + query.bindValue(":type", ui->typeEdit->currentIndex()); + query.bindValue(":yield", QString("%1").arg(ui->yieldEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":color", QString("%1").arg(ui->colorEdit->value(), 1, 'f', 0, '0')); + query.bindValue(":addafter", ui->addafterEdit->isChecked() ? 1:0); + query.bindValue(":origin", ui->originEdit->text()); + query.bindValue(":supplier", ui->supplierEdit->text()); + query.bindValue(":notes", ui->notesEdit->toPlainText()); + query.bindValue(":coarse", QString("%1").arg(ui->coarseEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":moisture", QString("%1").arg(ui->moistureEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":diastatic", Utils::kolbach_to_lintner(ui->diastaticEdit->value())); + query.bindValue(":protein", QString("%1").arg(ui->proteinEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":dissolved", QString("%1").arg(ui->dissolvedEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":maxinbatch", QString("%1").arg(ui->maxinbatchEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":mash", ui->mashEdit->isChecked() ? 1:0); + query.bindValue(":added", ui->addedEdit->currentIndex()); + query.bindValue(":always", ui->alwaysEdit->isChecked() ? 1:0); + query.bindValue(":diph", QString("%1").arg(ui->diphEdit->value(), 3, 'f', 2, '0')); + query.bindValue(":acidph", QString("%1").arg(ui->acidphEdit->value(), 6, 'f', 5, '0')); + query.bindValue(":graintype", ui->graintypeEdit->currentIndex()); + query.bindValue(":inventory", QString("%1").arg(ui->inventoryEdit->value(), 4, 'f', 3, '0')); + query.bindValue(":cost", QString("%1").arg(ui->costEdit->value(), 3, 'f', 2, '0')); + /* Uses https://www.qtcentre.org/threads/17295-How-to-put-empty-value-in-QDateEdit */ + query.bindValue(":prod", ui->prodEdit->nullDate()); + query.bindValue(":tht", ui->thtEdit->nullDate()); + if (this->recno == -1) { + query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36)); + } else { + query.bindValue(":recno", this->recno); + } + query.exec(); + if (query.lastError().isValid()) { + qDebug() << "EditFermentable" << query.lastError(); + QMessageBox::warning(this, tr("Database error"), + tr("MySQL error: %1\n%2\n%3") + .arg(query.lastError().nativeErrorCode()) + .arg(query.lastError().driverText()) + .arg(query.lastError().databaseText())); + } else { + qDebug() << "EditFermentable Saved"; + } + } + + ui->saveButton->setEnabled(false); + this->textIsChanged = false; + WindowTitle(); +} + + +void EditFermentable::on_deleteButton_clicked() +{ + QSqlQuery query; + + query.prepare("DELETE FROM inventory_fermentables WHERE record = :recno"); + query.bindValue(":recno", this->recno); + query.exec(); + if (query.lastError().isValid()) { + qDebug() << "EditFermentable" << query.lastError(); + QMessageBox::warning(this, tr("Database error"), + tr("MySQL error: %1\n%2\n%3") + .arg(query.lastError().nativeErrorCode()) + .arg(query.lastError().driverText()) + .arg(query.lastError().databaseText())); + } else { + qDebug() << "EditFermentable Deleted" << this->recno; + } + + this->close(); + this->setResult(1); +} + + +void EditFermentable::is_changed() +{ + ui->valueEdit->setValue(ui->inventoryEdit->value() * ui->costEdit->value()); + ui->saveButton->setEnabled(true); + ui->deleteButton->setEnabled((ui->inventoryEdit->value() == 0 && this->recno >= 0) ? true:false); + this->textIsChanged = true; + WindowTitle(); +} + + +void EditFermentable::on_quitButton_clicked() +{ + if (this->textIsChanged) { + int rc = QMessageBox::warning(this, tr("Fermentable changed"), tr("The fermentable has been modified\n Save changes?"), + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save); + switch (rc) { + case QMessageBox::Save: + on_saveButton_clicked(); + break; /* Saved and then Quit */ + case QMessageBox::Discard: + break; /* Quit without Save */ + case QMessageBox::Cancel: + return; /* Return to the editor page */ + } + } + + this->close(); + this->setResult(1); +} diff -r c94edc758a5b -r fcbbddcc22c1 src/EditFermentable.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/EditFermentable.h Sat Feb 19 22:17:09 2022 +0100 @@ -0,0 +1,36 @@ +#ifndef _EDITFERMENTABLE_H +#define _EDITFERMENTABLE_H + +#include + + +namespace Ui { +class EditFermentable; +} + +class EditFermentable : public QDialog +{ + Q_OBJECT + +signals: + void entry_changed(); + +public: + explicit EditFermentable(int id, QWidget *parent = 0); + ~EditFermentable(); + +private slots: + void on_saveButton_clicked(); + void on_quitButton_clicked(); + void on_deleteButton_clicked(); + void is_changed(); + +private: + Ui::EditFermentable *ui; + int recno; + bool textIsChanged = false; + + void WindowTitle(); +}; + +#endif diff -r c94edc758a5b -r fcbbddcc22c1 src/InventoryFermentables.cpp --- a/src/InventoryFermentables.cpp Fri Feb 18 15:53:02 2022 +0100 +++ b/src/InventoryFermentables.cpp Sat Feb 19 22:17:09 2022 +0100 @@ -15,7 +15,7 @@ * along with this program. If not, see . */ #include "InventoryFermentables.h" -//#include "EditSupplier.h" +#include "EditFermentable.h" #include "../ui/ui_InventoryFermentables.h" #include "config.h" #include "bmsapp.h" @@ -36,7 +36,7 @@ { QString w; - qDebug() << "slot" << Q_FUNC_INFO; + qDebug() << "InventoryFermentables reload"; QSqlQuery query("SELECT * FROM inventory_fermentables ORDER BY supplier,name"); const QStringList labels({tr("Origin"), tr("Supplier"), tr("Name"), tr("Type"), tr("Grain"), tr("Color"), tr("Yield"), tr("Stock"), tr("Edit")}); @@ -62,7 +62,6 @@ QTableWidgetItem *rightitem = new QTableWidgetItem(); rightitem->setTextAlignment(Qt::AlignRight); - qDebug() << query.record().count() << query.size(); query.first(); for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { ui->tableFermentables->setItem(ridx, 0, new QTableWidgetItem(query.value(6).toString())); @@ -119,11 +118,11 @@ { qDebug() << "InventoryFermentables edit:" << recno; -// EditSupplier dialog(recno, this); + EditFermentable dialog(recno, this); /* Signal from editor if a refresh is needed */ -// connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); -// dialog.setModal(true); -// dialog.exec(); + connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); + dialog.setModal(true); + dialog.exec(); } diff -r c94edc758a5b -r fcbbddcc22c1 src/Utils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Utils.cpp Sat Feb 19 22:17:09 2022 +0100 @@ -0,0 +1,43 @@ +/** + * Utils.cpp is part of bmsapp. + * + * bmsapp is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * bmsapp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "Utils.h" + +#include + +double Utils::Round(double n, int d) +{ + int m; + + for (int i = 0, m = 1; i < d; i++, m *= 10); + return round(n * m) / m; +} + + +double Utils::lintner_to_kolbach(double lintner) +{ + double wk = (3.5 * lintner) - 16; + if (wk < 0) + return 0.0; + return wk; +} + + +double Utils::kolbach_to_lintner(double kolbach) +{ + return Round((kolbach + 16) / 3.5, 3); +} + diff -r c94edc758a5b -r fcbbddcc22c1 src/Utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Utils.h Sat Feb 19 22:17:09 2022 +0100 @@ -0,0 +1,19 @@ +#ifndef _UTILS_H +#define _UTILS_H + + +/** + * @namespace Utils + * + * @brief Global math functions. + */ +namespace Utils { + + double Round(double n, int d); + + double lintner_to_kolbach(double lintner); + + double kolbach_to_lintner(double kolbach); +} + +#endif diff -r c94edc758a5b -r fcbbddcc22c1 src/bmsapp.h --- a/src/bmsapp.h Fri Feb 18 15:53:02 2022 +0100 +++ b/src/bmsapp.h Sat Feb 19 22:17:09 2022 +0100 @@ -21,7 +21,7 @@ #include #include - +#include "Utils.h" #include "database/database.h" diff -r c94edc758a5b -r fcbbddcc22c1 src/nulldateedit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/nulldateedit.cpp Sat Feb 19 22:17:09 2022 +0100 @@ -0,0 +1,55 @@ +/** + * Utils.cpp is part of bmsapp. + * + * See https://www.qtcentre.org/threads/17295-How-to-put-empty-value-in-QDateEdit + * + * bmsapp is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * bmsapp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "nulldateedit.h" + + +NullDateEdit::NullDateEdit(const QDate& date, QWidget* parent) + : QDateEdit(date, parent) +{ + this->setSpecialValueText("Null"); +} + +NullDateEdit::NullDateEdit(QWidget* parent) + : QDateEdit(parent) +{ + this->setSpecialValueText("Null"); +} + +NullDateEdit::~NullDateEdit() +{ +} + +void NullDateEdit::clear() +{ + this->setDate(this->minimumDate()); +} + +QDate NullDateEdit::nullDate() const +{ + if (date() == this->minimumDate()) + return QDate(); + return date(); +} + +void NullDateEdit::setDate(const QDate & date) +{ + if (date.isNull()) + QDateEdit::setDate(this->minimumDate()); + QDateEdit::setDate(date); +} diff -r c94edc758a5b -r fcbbddcc22c1 src/nulldateedit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/nulldateedit.h Sat Feb 19 22:17:09 2022 +0100 @@ -0,0 +1,16 @@ +#include +class NullDateEdit : public QDateEdit +{ + Q_OBJECT + Q_PROPERTY(QDate nullDate READ nullDate WRITE setDate USER true) +public: + NullDateEdit(const QDate& date, QWidget* parent); + NullDateEdit(QWidget* parent); + ~NullDateEdit(); + + QDate nullDate() const; + +public slots: + void clear(); + void setDate(const QDate& date); +}; diff -r c94edc758a5b -r fcbbddcc22c1 ui/EditFermentable.ui --- a/ui/EditFermentable.ui Fri Feb 18 15:53:02 2022 +0100 +++ b/ui/EditFermentable.ui Sat Feb 19 22:17:09 2022 +0100 @@ -1,38 +1,838 @@ - editFermentable - + EditFermentable + 0 0 - 1280 - 640 + 1024 + 560 Dialog - - - - - 0 - 24 - - - - - 16777215 - 24 - - + + + + + + 30 + 10 + 91 + 20 + + + + Name: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 30 + 40 + 91 + 20 + + + + Notes: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 130 + 121 + 20 + + + + Type: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 160 + 121 + 20 + + + + Grain type: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 190 + 121 + 20 + + + + Origin: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 220 + 121 + 20 + + + + Supplier: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 250 + 121 + 20 + + + + Max in batch: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 280 + 121 + 20 + + + + Recommend mash: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 310 + 121 + 20 + + + + Add after boil: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 340 + 121 + 20 + + + + Add moment: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 370 + 121 + 20 + + + + Always on stock: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 410 + 121 + 20 + + + + Inventory: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 440 + 121 + 20 + + + + Cost per Kg: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 470 + 121 + 20 + + + + Total value: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 130 + 141 + 20 + + + + Yield: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 160 + 141 + 20 + + + + Color EBC: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 190 + 141 + 20 + + + + Moisture: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 220 + 141 + 20 + + + + Coarse fine diff: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 250 + 141 + 20 + + + + Protein: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 310 + 141 + 20 + + + + Diastatic power: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 280 + 141 + 20 + + + + Dissolved protein: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 340 + 141 + 20 + + + + Dissolved pH: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 370 + 141 + 20 + + + + Acid to pH 5.7: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 410 + 141 + 20 + + + + Production date: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 440 + 141 + 20 + + + + Best before date: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 140 + 10 + 791 + 23 + + + + 128 + + + Name of the fermentable + + + + + + 140 + 40 + 791 + 81 + + + + Notes and usage tips. + + + + + + 140 + 130 + 151 + 23 + + + + + + + 140 + 160 + 151 + 23 + + + + + + + 140 + 190 + 451 + 23 + + + + 128 + + + Country of origin + + + + + + 140 + 220 + 451 + 23 + + + + 128 + + + Producer or supplier + + + + + + 140 + 250 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + % + + + 1 + + + 0.500000000000000 + + + + + + 140 + 410 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + false + + + QAbstractSpinBox::UpDownArrows + + + true + + + 3 + + + 100000.000000000000000 + + + 0.001000000000000 + + + QAbstractSpinBox::DefaultStepType + + + + + + 140 + 440 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + 1000.000000000000000 + + + 0.010000000000000 + + + QAbstractSpinBox::DefaultStepType + + + + + + 810 + 130 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 160 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 190 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 220 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 250 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 280 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 310 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + 0 + + + 1000.000000000000000 + + + + + + 810 + 340 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 810 + 370 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + 4 + + + -1000.000000000000000 + + + 1000.000000000000000 + + + + + + 140 + 280 + 85 + 21 + + + + Yes + + + + + + 140 + 310 + 85 + 21 + + + + Yes + + + + + + 140 + 370 + 85 + 21 + + + + Yes + + + + + + 140 + 340 + 151 + 23 + + + + + + + 810 + 410 + 121 + 24 + + + + + 0 + 0 + 0 + 2000 + 1 + 1 + + + + yyyy-MM-dd + + + true + + + + + + 810 + 440 + 121 + 24 + + + + yyyy-MM-dd + + + true + + - 10 - 0 + 90 + 510 80 23 @@ -52,10 +852,13 @@ + + false + - 1170 - 0 + 850 + 510 80 23 @@ -68,13 +871,86 @@ :/icons/silk/icons/silk/disk.png:/icons/silk/icons/silk/disk.png + + + false + + + + 463 + 510 + 80 + 23 + + + + Delete + + + + :/icons/silk/icons/silk/delete.png:/icons/silk/icons/silk/delete.png + + + + + + 140 + 470 + 107 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + QAbstractSpinBox::NoButtons + + - - - + + + NullDateEdit + QWidget +
nulldateedit.h
+
+
+ + nameEdit + notesEdit + typeEdit + graintypeEdit + originEdit + supplierEdit + maxinbatchEdit + mashEdit + addafterEdit + addedEdit + alwaysEdit + inventoryEdit + costEdit + yieldEdit + colorEdit + moistureEdit + coarseEdit + proteinEdit + dissolvedEdit + diastaticEdit + diphEdit + acidphEdit + prodEdit + thtEdit + quitButton + deleteButton + saveButton + valueEdit + diff -r c94edc758a5b -r fcbbddcc22c1 ui/InventoryFermentables.ui --- a/ui/InventoryFermentables.ui Fri Feb 18 15:53:02 2022 +0100 +++ b/ui/InventoryFermentables.ui Sat Feb 19 22:17:09 2022 +0100 @@ -68,8 +68,52 @@
- + + + + + 0 + 0 + + + + + 80 + 24 + + + + Export + + + + + + + + 0 + 0 + + + + + 80 + 24 + + + + Import + + + + + + + 0 + 0 + + 80