src/Setup.h

Fri, 04 Nov 2022 14:17:56 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 04 Nov 2022 14:17:56 +0100
changeset 430
ef2638cfc1b7
parent 380
8f5c03ed4321
permissions
-rw-r--r--

Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.

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;
430
ef2638cfc1b7 Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
59 QLabel *haleafLabel;
ef2638cfc1b7 Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
60 QLabel *hapelletLabel;
ef2638cfc1b7 Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
61 QLabel *hahopplugLabel;
ef2638cfc1b7 Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
62 QLabel *hawethopLabel;
ef2638cfc1b7 Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
63 QLabel *hacryohopLabel;
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
64 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
65 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
66 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
67 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
68 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
69 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
70 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
71 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
72
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
73 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
74
3a6cba2dd05d Status and Windowtitle messages via signals and slots. Global setup now on the mainwindow.
Michiel Broek <mbroek@mbse.eu>
parents: 41
diff changeset
75 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
76 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
77 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
78 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
79 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
80 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
81 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
82 QDoubleSpinBox *extractEdit;
430
ef2638cfc1b7 Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
83 QDoubleSpinBox *hapelletEdit;
ef2638cfc1b7 Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
84 QDoubleSpinBox *hahopplugEdit;
ef2638cfc1b7 Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
85 QDoubleSpinBox *haleafEdit;
ef2638cfc1b7 Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
86 QDoubleSpinBox *hawethopEdit;
ef2638cfc1b7 Added five hop absorption fields to the profile_setup record to set the hop absorption rates. Added edit fields in the global setup. Load global these new variables during application startup.
Michiel Broek <mbroek@mbse.eu>
parents: 380
diff changeset
87 QDoubleSpinBox *hacryohopEdit;
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
88 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
89 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
90 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
91 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
92 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
93 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
94 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
95 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
96 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
97 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
98
41
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
99 double scaleFactor = 1;
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
100
dc4b659a320b Added logo load and save in profile setup.
Michiel Broek <mbroek@mbse.eu>
parents: 16
diff changeset
101 void setImage(const QImage &newImage);
16
a5d8e783a7b0 Completed the global setup editor.
Michiel Broek <mbroek@mbse.eu>
parents: 15
diff changeset
102 bool fieldIsChanged = false;
15
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 };
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104
c58b82549713 Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 #endif

mercurial