Fri, 18 Feb 2022 15:53:02 +0100
Added Inventory Fermentables table.
4 | 1 | /** |
2 | * MainWindow.cpp is part of bmsapp. | |
3 | * | |
4 | * bmsapp is free software: you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation, either version 3 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * bmsapp is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | */ | |
3 | 17 | #include "MainWindow.h" |
4 | 18 | #include "AboutDialog.h" |
6
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
19 | #include "InventorySuppliers.h" |
19
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
20 | #include "InventoryFermentables.h" |
15
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
21 | #include "Setup.h" |
3 | 22 | #include "../ui/ui_MainWindow.h" |
6
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
23 | #include "config.h" |
3 | 24 | |
25 | #include <QApplication> | |
26 | #include <QCloseEvent> | |
27 | #include <QDebug> | |
28 | #include <QStandardItem> | |
29 | #include <QWidget> | |
30 | ||
31 | ||
32 | MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) | |
33 | { | |
6
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
34 | qDebug() << Q_FUNC_INFO; |
4 | 35 | ui->setupUi(this); |
6
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
36 | |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
37 | setWindowTitle( QString("BMSapp - %1").arg(VERSIONSTRING) ); |
3 | 38 | } |
39 | ||
40 | ||
41 | MainWindow::~MainWindow() | |
42 | { | |
6
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
43 | qDebug() << Q_FUNC_INFO; |
4 | 44 | delete ui; |
3 | 45 | } |
46 | ||
47 | ||
4 | 48 | void MainWindow::on_actionExit_triggered() |
49 | { | |
6
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
50 | qDebug() << Q_FUNC_INFO; |
4 | 51 | this->close(); |
52 | } | |
3 | 53 | |
4 | 54 | |
6
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
55 | void MainWindow::fromInventorySuppliers() |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
56 | { |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
57 | qDebug() << Q_FUNC_INFO; |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
58 | delete InventorySuppliersWindow; |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
59 | this->show(); |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
60 | } |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
61 | |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
62 | |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
63 | void MainWindow::on_actionSuppliers_triggered() |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
64 | { |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
65 | qDebug() << Q_FUNC_INFO; |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
66 | InventorySuppliersWindow = new InventorySuppliers(this); |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
67 | QObject::connect(InventorySuppliersWindow, SIGNAL(firstWindow()), this, SLOT(fromInventorySuppliers())); |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
68 | this->hide(); // Close the main window |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
69 | InventorySuppliersWindow->show(); // Show a second window |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
70 | } |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
71 | |
f8474f2c5db9
We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
4
diff
changeset
|
72 | |
19
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
73 | void MainWindow::fromInventoryFermentables() |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
74 | { |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
75 | qDebug() << Q_FUNC_INFO; |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
76 | delete InventoryFermentablesWindow; |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
77 | this->show(); |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
78 | } |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
79 | |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
80 | |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
81 | void MainWindow::on_actionFermentables_triggered() |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
82 | { |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
83 | qDebug() << Q_FUNC_INFO; |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
84 | InventoryFermentablesWindow = new InventoryFermentables(this); |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
85 | QObject::connect(InventoryFermentablesWindow, SIGNAL(firstWindow()), this, SLOT(fromInventoryFermentables())); |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
86 | this->hide(); // Close the main window |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
87 | InventoryFermentablesWindow->show(); // Show a second window |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
88 | } |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
89 | |
c94edc758a5b
Added Inventory Fermentables table.
Michiel Broek <mbroek@mbse.eu>
parents:
16
diff
changeset
|
90 | |
15
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
91 | void MainWindow::fromSetup() |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
92 | { |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
93 | qDebug() << Q_FUNC_INFO; |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
94 | delete SetupWindow; |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
95 | this->show(); |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
96 | } |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
97 | |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
98 | |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
99 | void MainWindow::on_actionSetup_triggered() |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
100 | { |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
101 | qDebug() << Q_FUNC_INFO; |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
102 | SetupWindow = new Setup(this); |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
103 | QObject::connect(SetupWindow, SIGNAL(firstWindow()), this, SLOT(fromSetup())); |
16
a5d8e783a7b0
Completed the global setup editor.
Michiel Broek <mbroek@mbse.eu>
parents:
15
diff
changeset
|
104 | this->hide(); // Close the main window |
a5d8e783a7b0
Completed the global setup editor.
Michiel Broek <mbroek@mbse.eu>
parents:
15
diff
changeset
|
105 | SetupWindow->show(); // Show a setup window |
15
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
106 | } |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
107 | |
c58b82549713
Started adding the global setup screen.
Michiel Broek <mbroek@mbse.eu>
parents:
6
diff
changeset
|
108 | |
4 | 109 | void MainWindow::on_actionAbout_triggered() |
110 | { | |
111 | AboutDialog dialog(this); | |
112 | dialog.setModal(true); | |
113 | dialog.exec(); | |
114 | } | |
115 | ||
116 |