Mon, 04 Apr 2022 16:21:38 +0200
Hide not visible fermentables data inside the fermentablesTable so that all data stays together. Format the fermentables json data again after changes. Add confirmation message to delete a fermentable row. Added buttons for a fermentables row editor.
#ifndef _EDITRECIPE_H #define _EDITRECIPE_H #include <QDialog> #include <QStringList> #include <QJsonDocument> typedef struct f_edit { int f_row; ///< Row to edit, -1 for insert. QString f_name; ///< Fermentable name QString f_supplier; ///< Fermentable supplier double f_max_in_batch; ///< Max percentage in batch double f_percentage; ///< Current percentage in batch double f_amount; ///< Amount in kg bool f_adjust_to_total_100; ///< Adjust amount/percentage to 100% int f_added; ///< When to add fermentable } fedit; namespace Ui { class EditRecipe; } class EditRecipe : public QDialog { Q_OBJECT signals: void entry_changed(); public: explicit EditRecipe(int id, QWidget *parent = 0); ~EditRecipe(); private slots: void on_saveButton_clicked(); void on_quitButton_clicked(); void on_deleteButton_clicked(); void is_changed(); void style_changed(); void colormethod_changed(); void time_changed(); void refreshFermentables(); void refreshHops(); void refreshMiscs(); void refreshYeasts(); void refreshMashs(); void refreshAll(); void cell_Fermentable_changed(int nRow, int nCol); void on_deleteFermentRow_clicked(); void on_editFermentRow_clicked(); void on_perc_mash_valueChanged(int value); void on_perc_sugars_valueChanged(int value); void on_perc_cara_valueChanged(int value); void on_lintner_valueChanged(int value); private: Ui::EditRecipe *ui; QStringList s_types = { tr("Lager"), tr("Ale"), tr("Mead"), tr("Wheat"), tr("Mixed"), tr("Cider") }; QStringList f_types = { tr("Grain"), tr("Sugar"), tr("Extract"), tr("Dry extract"), tr("Adjunct") }; QStringList f_graintypes = { tr("Base"), tr("Roast"), tr("Crystal"), tr("Kilned"), tr("Sour Malt"), tr("Special"), tr("No malt")}; QStringList f_added = { tr("Mash"), tr("Boil"), tr("Fermentation"), tr("Lagering"), tr("Bottle"), tr("Kegs") }; QString bar_red = "QProgressBar::chunk {background: #FF0000;}"; QString bar_orange = "QProgressBar::chunk {background: #EB7331;}"; QString bar_green = "QProgressBar::chunk {background: #008C00;}"; int recno, lasttime = 0; bool textIsChanged = false; bool ignoreChanges = false; QJsonDocument fermentables, hops, miscs, yeasts, mashs; fedit fermentrow, fermentbackup; void WindowTitle(); void fermentable_Json(); void calcFermentables(); }; #endif