# HG changeset patch # User Michiel Broek # Date 1645384969 -3600 # Node ID 684c6e74cc1b48a9c5d1f401c8df37405265399d # Parent 1ac3fb2569c1b5c4ba08827ea74a52d838574123 Added hops editor. diff -r 1ac3fb2569c1 -r 684c6e74cc1b CMakeLists.txt --- a/CMakeLists.txt Sun Feb 20 12:13:22 2022 +0100 +++ b/CMakeLists.txt Sun Feb 20 20:22:49 2022 +0100 @@ -102,6 +102,8 @@ ${SRCDIR}/EditSupplier.cpp ${SRCDIR}/InventoryFermentables.cpp ${SRCDIR}/EditFermentable.cpp + ${SRCDIR}/InventoryHops.cpp + ${SRCDIR}/EditHop.cpp ${SRCDIR}/Setup.cpp ${SRCDIR}/Utils.cpp ${SRCDIR}/MainWindow.cpp @@ -116,6 +118,8 @@ ${SRCDIR}/EditSupplier.h ${SRCDIR}/InventoryFermentables.h ${SRCDIR}/EditFermentable.h + ${SRCDIR}/InventoryHops.h + ${SRCDIR}/EditHop.h ${SRCDIR}/Setup.h ${SRCDIR}/Utils.h ${SRCDIR}/MainWindow.h diff -r 1ac3fb2569c1 -r 684c6e74cc1b src/EditFermentable.cpp --- a/src/EditFermentable.cpp Sun Feb 20 12:13:22 2022 +0100 +++ b/src/EditFermentable.cpp Sun Feb 20 20:22:49 2022 +0100 @@ -100,6 +100,8 @@ ui->colorEdit->setValue(3); ui->coarseEdit->setValue(3); ui->moistureEdit->setValue(4); + ui->prodEdit->clear(); + ui->thtEdit->clear(); } connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditFermentable::is_changed); connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed())); diff -r 1ac3fb2569c1 -r 684c6e74cc1b src/EditHop.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/EditHop.cpp Sun Feb 20 20:22:49 2022 +0100 @@ -0,0 +1,259 @@ +/** + * EditHop.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 "EditHop.h" +#include "../ui/ui_EditHop.h" +#include "bmsapp.h" + + +EditHop::EditHop(int id, QWidget *parent) : QDialog(parent), ui(new Ui::EditHop) +{ + QSqlQuery query; + + qDebug() << "EditHop record:" << id; + ui->setupUi(this); + this->recno = id; + + WindowTitle(); + + ui->typeEdit->addItem(tr("Bittering")); + ui->typeEdit->addItem(tr("Aroma")); + ui->typeEdit->addItem(tr("Both")); + + ui->formEdit->addItem(tr("Pellet")); + ui->formEdit->addItem(tr("Plug")); + ui->formEdit->addItem(tr("Leaf")); + ui->formEdit->addItem(tr("Leaf Wet")); /* Not in beerxml */ + ui->formEdit->addItem(tr("Cryo")); /* Not in beerxml */ + + if (id >= 0) { + query.prepare("SELECT * FROM inventory_hops WHERE record = :recno"); + query.bindValue(":recno", id); + query.exec(); + query.next(); + + ui->nameEdit->setText(query.value(1).toString()); + ui->alphaEdit->setValue(query.value(2).toDouble()); + ui->betaEdit->setValue(query.value(3).toDouble()); + ui->humuleneEdit->setValue(query.value(4).toDouble()); + ui->caryEdit->setValue(query.value(5).toDouble()); + ui->cohumuloneEdit->setValue(query.value(6).toDouble()); + ui->myrceneEdit->setValue(query.value(7).toDouble()); + ui->hsiEdit->setValue(query.value(8).toDouble()); + ui->typeEdit->setCurrentIndex(query.value(9).toInt()); + ui->formEdit->setCurrentIndex(query.value(10).toInt()); + ui->notesEdit->setPlainText(query.value(11).toString()); + ui->originEdit->setText(query.value(12).toString()); + ui->substitutesEdit->setText(query.value(13).toString()); + ui->alwaysEdit->setChecked(query.value(14).toInt() ? true:false); + ui->inventoryEdit->setValue(query.value(15).toDouble()); + ui->costEdit->setValue(query.value(16).toDouble()); + ui->valueEdit->setValue(query.value(15).toDouble() * query.value(16).toDouble()); + if (query.value(17).toString().length() == 10) { + ui->prodEdit->setDate(query.value(17).toDate()); + } else { + ui->prodEdit->clear(); + } + if (query.value(18).toString().length() == 10) { + ui->thtEdit->setDate(query.value(18).toDate()); + } else { + ui->thtEdit->clear(); + } + ui->oilEdit->setValue(query.value(19).toDouble()); + } else { + /* Set some defaults */ + ui->typeEdit->setCurrentIndex(0); + ui->formEdit->setCurrentIndex(0); + ui->prodEdit->clear(); + ui->thtEdit->clear(); + } + connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditHop::is_changed); + connect(ui->alphaEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed); + connect(ui->betaEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed); + connect(ui->humuleneEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed); + connect(ui->caryEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed); + connect(ui->cohumuloneEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed); + connect(ui->myrceneEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed); + connect(ui->hsiEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed); + connect(ui->typeEdit, &QComboBox::currentTextChanged, this, &EditHop::is_changed); + connect(ui->formEdit, &QComboBox::currentTextChanged, this, &EditHop::is_changed); + connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed())); + connect(ui->originEdit, &QLineEdit::textChanged, this, &EditHop::is_changed); + connect(ui->substitutesEdit, &QLineEdit::textChanged, this, &EditHop::is_changed); + connect(ui->alwaysEdit, &QCheckBox::stateChanged, this, &EditHop::is_changed); + connect(ui->inventoryEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed); + connect(ui->costEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed); + connect(ui->prodEdit, &QDateEdit::dateChanged, this, &EditHop::is_changed); + connect(ui->thtEdit, &QDateEdit::dateChanged, this, &EditHop::is_changed); + connect(ui->oilEdit, &QDoubleSpinBox::textChanged, this, &EditHop::is_changed); + + ui->saveButton->setEnabled(false); + ui->deleteButton->setEnabled((ui->inventoryEdit->value() == 0 && id >= 0) ? true:false); +} + + +EditHop::~EditHop() +{ + qDebug() << "EditHop done"; + delete ui; + emit entry_changed(); +} + + +/* + * Window header, mark any change with '**' + */ +void EditHop::WindowTitle() +{ + QString txt; + + if (this->recno < 0) { + txt = QString(tr("BMSapp - Add new hop")); + } else { + txt = QString(tr("BMSapp - Edit hop %1").arg(this->recno)); + } + + if (this->textIsChanged) { + txt.append((QString(" **"))); + } + setWindowTitle(txt); +} + + +void EditHop::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 Hop"), tr("Name empty or too short.")); + return; + } + if (ui->originEdit->text().length() < 2) { + QMessageBox::warning(this, tr("Edit Hop"), tr("Origin empty or too short.")); + return; + } + + if (this->textIsChanged) { + if (this->recno == -1) { + query.prepare("INSERT INTO inventory_hops SET name=:name, alpha=:alpha, beta=:beta, " + "humulene=:humulene, caryophyllene=:cary, cohumulone=:cohumulone, myrcene=:myrcene, " + "hsi=:hsi, type=:type, form=:form, notes=:notes, origin=:origin, substitutes=:substitutes, " + "always_on_stock=:always, inventory=:inventory, cost=:cost, production_date=:prod, " + "tht_date=:tht, total_oil=:oil, uuid = :uuid"); + } else { + query.prepare("UPDATE inventory_hops SET name=:name, alpha=:alpha, beta=:beta, " + "humulene=:humulene, caryophyllene=:cary, cohumulone=:cohumulone, myrcene=:myrcene, " + "hsi=:hsi, type=:type, form=:form, notes=:notes, origin=:origin, substitutes=:substitutes, " + "always_on_stock=:always, inventory=:inventory, cost=:cost, production_date=:prod, " + "tht_date=:tht, total_oil=:oil WHERE record = :recno"); + } + query.bindValue(":name", ui->nameEdit->text()); + query.bindValue(":alpha", QString("%1").arg(ui->alphaEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":beta", QString("%1").arg(ui->betaEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":humulene", QString("%1").arg(ui->humuleneEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":cary", QString("%1").arg(ui->caryEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":cohumulone", QString("%1").arg(ui->cohumuloneEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":myrcene", QString("%1").arg(ui->myrceneEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":hsi", QString("%1").arg(ui->hsiEdit->value(), 2, 'f', 1, '0')); + query.bindValue(":type", ui->typeEdit->currentIndex()); + query.bindValue(":form", ui->formEdit->currentIndex()); + query.bindValue(":notes", ui->notesEdit->toPlainText()); + query.bindValue(":origin", ui->originEdit->text()); + query.bindValue(":substitutes", ui->substitutesEdit->text()); + query.bindValue(":always", ui->alwaysEdit->isChecked() ? 1:0); + query.bindValue(":inventory", QString("%1").arg(ui->inventoryEdit->value(), 5, 'f', 4, '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()); + query.bindValue(":oil", QString("%1").arg(ui->oilEdit->value(), 2, 'f', 1, '0')); + 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() << "EditHop" << 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() << "EditHop Saved"; + } + } + + ui->saveButton->setEnabled(false); + this->textIsChanged = false; + WindowTitle(); +} + + +void EditHop::on_deleteButton_clicked() +{ + QSqlQuery query; + + query.prepare("DELETE FROM inventory_hops WHERE record = :recno"); + query.bindValue(":recno", this->recno); + query.exec(); + if (query.lastError().isValid()) { + qDebug() << "EditHop" << 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() << "EditHop Deleted" << this->recno; + } + + this->close(); + this->setResult(1); +} + + +void EditHop::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 EditHop::on_quitButton_clicked() +{ + if (this->textIsChanged) { + int rc = QMessageBox::warning(this, tr("Hop 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 1ac3fb2569c1 -r 684c6e74cc1b src/EditHop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/EditHop.h Sun Feb 20 20:22:49 2022 +0100 @@ -0,0 +1,36 @@ +#ifndef _EDITHOP_H +#define _EDITHOP_H + +#include + + +namespace Ui { +class EditHop; +} + +class EditHop : public QDialog +{ + Q_OBJECT + +signals: + void entry_changed(); + +public: + explicit EditHop(int id, QWidget *parent = 0); + ~EditHop(); + +private slots: + void on_saveButton_clicked(); + void on_quitButton_clicked(); + void on_deleteButton_clicked(); + void is_changed(); + +private: + Ui::EditHop *ui; + int recno; + bool textIsChanged = false; + + void WindowTitle(); +}; + +#endif diff -r 1ac3fb2569c1 -r 684c6e74cc1b src/InventoryHops.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/InventoryHops.cpp Sun Feb 20 20:22:49 2022 +0100 @@ -0,0 +1,166 @@ +/** + * InventoryHops.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 "InventoryHops.h" +#include "EditHop.h" +#include "../ui/ui_InventoryHops.h" +#include "config.h" +#include "bmsapp.h" + + +InventoryHops::InventoryHops(QWidget *parent) : QDialog(parent), ui(new Ui::InventoryHops) +{ + qDebug() << "InventoryHops start"; + + ui->setupUi(this); + emit refreshTable(); + + setWindowTitle( QString("BMSapp - %1 - Inventory Hops").arg(VERSIONSTRING) ); +} + + +void InventoryHops::refreshTable() +{ + QString w; + + qDebug() << "InventoryHops reload"; + + QSqlQuery query("SELECT * FROM inventory_hops ORDER BY origin,name"); + const QStringList labels({tr("Origin"), tr("Name"), tr("Type"), tr("Form"), tr("Alpha"), tr("Beta"), tr("Cohumulone"), tr("HSI"), tr("Harvest"), tr("Stock"), tr("Edit")}); + const QStringList types({tr("Bittering"), tr("Aroma"), tr("Both")}); + const QStringList form({tr("Pellet"), tr("Plug"), tr("Leaf"), tr("Leaf Wet"), tr("Cryo")}); + + /* origin supplier name type graintype color yield inventory Edit */ + ui->tableHops->setColumnCount(11); + ui->tableHops->setColumnWidth(0, 130); /* Origin */ + ui->tableHops->setColumnWidth(1, 250); /* Name */ + ui->tableHops->setColumnWidth(2, 80); /* Type */ + ui->tableHops->setColumnWidth(3, 80); /* Form */ + ui->tableHops->setColumnWidth(4, 80); /* Alpha */ + ui->tableHops->setColumnWidth(5, 80); /* Beta */ + ui->tableHops->setColumnWidth(6, 80); /* cohumulone */ + ui->tableHops->setColumnWidth(7, 80); /* HSI */ + ui->tableHops->setColumnWidth(8, 80); /* Harvest date */ + ui->tableHops->setColumnWidth(9, 80); /* Stock */ + ui->tableHops->setColumnWidth(10, 80); /* Edit button */ + ui->tableHops->setRowCount(query.size()); + ui->tableHops->setHorizontalHeaderLabels(labels); + ui->tableHops->verticalHeader()->hide(); + ui->tableHops->setFixedSize(1100 + 24, 640); /* Even if this is too large, it works */ + + QTableWidgetItem *rightitem = new QTableWidgetItem(); + rightitem->setTextAlignment(Qt::AlignRight); + + query.first(); + for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { + ui->tableHops->setItem(ridx, 0, new QTableWidgetItem(query.value(12).toString())); /* Origin */ + ui->tableHops->setItem(ridx, 1, new QTableWidgetItem(query.value(1).toString())); /* Name */ + ui->tableHops->setItem(ridx, 2, new QTableWidgetItem(types[query.value(9).toInt()])); /* Type */ + ui->tableHops->setItem(ridx, 3, new QTableWidgetItem(form[query.value(10).toInt()])); /* Form */ + w = QString("%1 %").arg(query.value(2).toDouble(), 2, 'f', 1, '0' ); /* Alpha% */ + QTableWidgetItem *item = new QTableWidgetItem(w); + item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); + ui->tableHops->setItem(ridx, 4, item); + w = QString("%1 %").arg(query.value(3).toDouble(), 2, 'f', 1, '0' ); /* Beta% */ + item = new QTableWidgetItem(w); + item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); + ui->tableHops->setItem(ridx, 5, item); + + w = QString("%1 %").arg(query.value(6).toDouble(), 2, 'f', 1, '0' ); /* Cohumulone */ + item = new QTableWidgetItem(w); + item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); + ui->tableHops->setItem(ridx, 6, item); + + w = QString("%1").arg(query.value(8).toDouble(), 2, 'f', 1, '0' ); /* HSI */ + item = new QTableWidgetItem(w); + item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); + ui->tableHops->setItem(ridx, 7, item); + + if (query.value(15).toDouble() > 0) + ui->tableHops->setItem(ridx, 8, new QTableWidgetItem(query.value(17).toString())); /* Harvest */ + else + ui->tableHops->setItem(ridx, 8, new QTableWidgetItem(QString(""))); + + w = QString(""); + if (query.value(15).toDouble() > 0) { + if (query.value(15).toDouble() < 1.000) { + w = QString("%1 gr").arg(query.value(15).toDouble() * 1000.0, 2, 'f', 1, '0' ); + } else { + w = QString("%1 kg").arg(query.value(15).toDouble(), 4, 'f', 3, '0' ); + } + } + item = new QTableWidgetItem(w); + item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); + ui->tableHops->setItem(ridx, 9, item); + + /* Add the Edit button */ + QWidget* pWidget = new QWidget(); + QPushButton* btn_edit = new QPushButton(); + btn_edit->setObjectName(QString("%1").arg(query.value(0).toString())); /* Send record with the button */ + btn_edit->setText(tr("Edit")); + connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_editButton_clicked())); + QHBoxLayout* pLayout = new QHBoxLayout(pWidget); + pLayout->addWidget(btn_edit); + pLayout->setContentsMargins(5, 0, 5, 0); + pWidget->setLayout(pLayout); + ui->tableHops->setCellWidget(ridx, 10, pWidget); + query.next(); + } + + setWindowTitle( QString("BMSapp - %1 - Inventory Hops").arg(VERSIONSTRING) ); +} + + +InventoryHops::~InventoryHops() +{ + qDebug() << "InventoryHops done"; + delete ui; +} + + +void InventoryHops::edit(int recno) +{ + qDebug() << "InventoryHops edit:" << recno; + + EditHop dialog(recno, this); + /* Signal from editor if a refresh is needed */ + connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); + dialog.setModal(true); + dialog.exec(); +} + + +void InventoryHops::on_editButton_clicked() +{ + QPushButton *pb = qobject_cast(QObject::sender()); + int recno = pb->objectName().toInt(); + qDebug() << Q_FUNC_INFO << recno; + edit(recno); +} + + +void InventoryHops::on_insertButton_clicked() +{ + qDebug() << Q_FUNC_INFO; + edit(-1); +} + + +void InventoryHops::on_quitButton_clicked() +{ + emit firstWindow(); +} + diff -r 1ac3fb2569c1 -r 684c6e74cc1b src/InventoryHops.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/InventoryHops.h Sun Feb 20 20:22:49 2022 +0100 @@ -0,0 +1,32 @@ +#ifndef _INVENTORYHOPS_H +#define _INVENTORYHOPS_H + +#include + +namespace Ui { +class InventoryHops; +} + +class InventoryHops : public QDialog +{ + Q_OBJECT + +public: + explicit InventoryHops(QWidget *parent = nullptr); + ~InventoryHops(); + +signals: + void firstWindow(); + +private slots: + void on_quitButton_clicked(); + void on_insertButton_clicked(); + void on_editButton_clicked(); + void refreshTable(void); + +private: + Ui::InventoryHops *ui; + void edit(int recno); +}; + +#endif diff -r 1ac3fb2569c1 -r 684c6e74cc1b src/MainWindow.cpp --- a/src/MainWindow.cpp Sun Feb 20 12:13:22 2022 +0100 +++ b/src/MainWindow.cpp Sun Feb 20 20:22:49 2022 +0100 @@ -18,6 +18,7 @@ #include "AboutDialog.h" #include "InventorySuppliers.h" #include "InventoryFermentables.h" +#include "InventoryHops.h" #include "Setup.h" #include "../ui/ui_MainWindow.h" #include "config.h" @@ -88,6 +89,24 @@ } +void MainWindow::fromInventoryHops() +{ + qDebug() << Q_FUNC_INFO; + delete InventoryHopsWindow; + this->show(); +} + + +void MainWindow::on_actionHops_triggered() +{ + qDebug() << Q_FUNC_INFO; + InventoryHopsWindow = new InventoryHops(this); + QObject::connect(InventoryHopsWindow, SIGNAL(firstWindow()), this, SLOT(fromInventoryHops())); + this->hide(); // Close the main window + InventoryHopsWindow->show(); // Show a second window +} + + void MainWindow::fromSetup() { qDebug() << Q_FUNC_INFO; diff -r 1ac3fb2569c1 -r 684c6e74cc1b src/MainWindow.h --- a/src/MainWindow.h Sun Feb 20 12:13:22 2022 +0100 +++ b/src/MainWindow.h Sun Feb 20 20:22:49 2022 +0100 @@ -3,6 +3,7 @@ #include "InventorySuppliers.h" #include "InventoryFermentables.h" +#include "InventoryHops.h" #include "Setup.h" #include @@ -26,12 +27,14 @@ void on_actionExit_triggered(); void on_actionSuppliers_triggered(); void on_actionFermentables_triggered(); + void on_actionHops_triggered(); void on_actionSetup_triggered(); void on_actionAbout_triggered(); public slots: void fromInventorySuppliers(); void fromInventoryFermentables(); + void fromInventoryHops(); void fromSetup(); private: @@ -40,6 +43,7 @@ // Keep pointers to new windows. InventorySuppliers *InventorySuppliersWindow; InventoryFermentables *InventoryFermentablesWindow; + InventoryHops * InventoryHopsWindow; Setup *SetupWindow; }; diff -r 1ac3fb2569c1 -r 684c6e74cc1b ui/EditHop.ui --- a/ui/EditHop.ui Sun Feb 20 12:13:22 2022 +0100 +++ b/ui/EditHop.ui Sun Feb 20 20:22:49 2022 +0100 @@ -52,7 +52,7 @@ 5 - 410 + 350 121 20 @@ -68,7 +68,7 @@ 5 - 440 + 380 121 20 @@ -84,7 +84,7 @@ 5 - 470 + 410 121 20 @@ -100,13 +100,13 @@ 660 - 410 + 350 141 20 - Production date: + Harvest date: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -116,13 +116,13 @@ 660 - 440 + 380 141 20 - Best before date: + Best BeFore date: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -141,7 +141,7 @@ 128 - Name of the fermentable + Name of the hop @@ -161,7 +161,7 @@ 140 - 410 + 350 121 24 @@ -179,7 +179,7 @@ true - 3 + 4 100000.000000000000000 @@ -195,7 +195,7 @@ 140 - 440 + 380 121 24 @@ -220,7 +220,7 @@ 810 - 410 + 350 121 24 @@ -246,7 +246,7 @@ 810 - 440 + 380 121 24 @@ -325,7 +325,7 @@ 140 - 470 + 410 107 24 @@ -339,6 +339,413 @@ QAbstractSpinBox::NoButtons + + 100000.000000000000000 + + + + + + 140 + 140 + 121 + 23 + + + + + + + 5 + 140 + 121 + 20 + + + + Type hop: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 170 + 121 + 20 + + + + Origin: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 200 + 121 + 20 + + + + Substitudes: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 230 + 121 + 20 + + + + Hop Stability Index + + + HSI: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 140 + 141 + 16 + + + + Total oil: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 170 + 141 + 16 + + + + Humulene: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 200 + 141 + 16 + + + + Caryophyllene: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 230 + 141 + 16 + + + + Myrcene: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 260 + 141 + 16 + + + + Cohumulone: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 260 + 121 + 20 + + + + Form: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 290 + 141 + 20 + + + + Alpha %: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 660 + 320 + 141 + 20 + + + + Beta %: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 5 + 320 + 121 + 20 + + + + Always on stock: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 140 + 170 + 471 + 23 + + + + Country and place of origin + + + + + + 140 + 200 + 471 + 23 + + + + 256 + + + Substitutes that can be used for this hop + + + + + + 140 + 260 + 121 + 23 + + + + + + + 140 + 230 + 121 + 24 + + + + Hop Stability Index + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 140 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 170 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 200 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 230 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 260 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 290 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 810 + 320 + 121 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + + + + 140 + 320 + 85 + 21 + + + + Yes + diff -r 1ac3fb2569c1 -r 684c6e74cc1b ui/MainWindow.ui --- a/ui/MainWindow.ui Sun Feb 20 12:13:22 2022 +0100 +++ b/ui/MainWindow.ui Sun Feb 20 20:22:49 2022 +0100 @@ -206,7 +206,7 @@ - false + true