src/Setup.h

Thu, 18 Aug 2022 20:34:15 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 18 Aug 2022 20:34:15 +0200
changeset 401
583148eb6e01
parent 380
8f5c03ed4321
child 430
ef2638cfc1b7
permissions
-rw-r--r--

Init est_carb field for new products.

15
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 #ifndef _SETUP_H
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 #define _SETUP_H
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 #include <QDialog>
41
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
5 #include <QFileDialog>
78
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
6 #include <QtGui/QIcon>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
7 #include <QtWidgets/QApplication>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
8 #include <QtWidgets/QComboBox>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
9 #include <QtWidgets/QDialog>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
10 #include <QtWidgets/QDoubleSpinBox>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
11 #include <QtWidgets/QFrame>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
12 #include <QtWidgets/QGridLayout>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
13 #include <QtWidgets/QLabel>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
14 #include <QtWidgets/QLineEdit>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
15 #include <QtWidgets/QPushButton>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
16 #include <QtWidgets/QSpinBox>
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
17 #include <QtWidgets/QWidget>
41
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
18
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
19 QT_BEGIN_NAMESPACE
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
20 class QLabel;
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
21 QT_END_NAMESPACE
15
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 namespace Ui {
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 class Setup;
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 }
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 class Setup : public QDialog
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 {
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 Q_OBJECT
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 public:
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 explicit Setup(QWidget *parent = nullptr);
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 ~Setup();
41
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
34 bool loadFile(const QString &);
15
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 signals:
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 void firstWindow();
78
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
38 void setTitle(QString);
15
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 private slots:
41
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
41 void on_openButton_clicked();
15
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 void on_quitButton_clicked();
16
a5d8e783a7b0 Completed the global setup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 15
diff changeset
43 void on_saveButton_clicked();
a5d8e783a7b0 Completed the global setup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 15
diff changeset
44 void is_changed();
15
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 private:
41
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
47 QByteArray logoByteArray;
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
48 QImage image;
78
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
49 QLabel *logoLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
50 QLabel *breweryLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
51 QLabel *fwhLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
52 QLabel *mashhopLabel;
380
8f5c03ed4321 Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
53 QLabel *leafLabel;
78
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
54 QLabel *pelletLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
55 QLabel *hopplugLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
56 QLabel *wethopLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
57 QLabel *cryohopLabel;
380
8f5c03ed4321 Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
58 QLabel *extractLabel;
78
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
59 QLabel *grainLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
60 QLabel *brixLabel;
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
61 QLabel *heightLabel;
78
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
62 QLabel *titleLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
63 QLabel *colorLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
64 QLabel *ibuLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
65 QLabel *waterLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
66 QLabel *yeastLabel;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
67
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
68 QLineEdit *breweryEdit;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
69
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
70 QSpinBox *fwhEdit;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
71 QSpinBox *mashhopEdit;
380
8f5c03ed4321 Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
72 QDoubleSpinBox *pelletEdit;
8f5c03ed4321 Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
73 QDoubleSpinBox *hopplugEdit;
8f5c03ed4321 Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
74 QDoubleSpinBox *leafEdit;
8f5c03ed4321 Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
75 QDoubleSpinBox *wethopEdit;
8f5c03ed4321 Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
76 QDoubleSpinBox *cryohopEdit;
8f5c03ed4321 Global setup added hop utilisation defaults, these are used by the hops editor. In the hops editor, changing the hop form sets the new default utilisation. Hide and show the time edit entry instead of setting it read-only. The new defaults are loaded at program startup. Changed the global setup for the new utilisation fields and dropped the obsolete factor fields. The toIBU formula doesn't use my_factor_* variables anymore, hop differences now come from the utilisation field per hop. The global database is updated to the new defaults.
Michiel Broek <mbroek@mbse.eu>
parents: 337
diff changeset
77 QDoubleSpinBox *extractEdit;
78
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
78 QComboBox *waterEdit;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
79 QDoubleSpinBox *grainEdit;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
80 QDoubleSpinBox *brixEdit;
337
8133cdb19aa1 Added my_height global variable and edit in profile setup. This sets the height of the brewery above or below sealevel. Added calculations for the air pressure, boilpoint and IBU_reduction that all depend on the height. Currently not yet in use. Split out the real IBU calculation from the generic toIBU function. This has no effect on the results.
Michiel Broek <mbroek@mbse.eu>
parents: 78
diff changeset
81 QSpinBox *heightEdit;
78
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
82 QComboBox *colorEdit;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
83 QComboBox *ibuEdit;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
84 QComboBox *yeastEdit;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
85 QPushButton *quitButton;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
86 QPushButton *saveButton;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
87 QPushButton *openButton;
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
88
41
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
89 double scaleFactor = 1;
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
90
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
91 void setImage(const QImage &newImage);
16
a5d8e783a7b0 Completed the global setup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 15
diff changeset
92 bool fieldIsChanged = false;
15
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 };
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 #endif

mercurial