Wed, 16 Feb 2022 22:11:29 +0100
Started adding the global setup screen.
CMakeLists.txt | file | annotate | diff | comparison | revisions | |
src/MainWindow.cpp | file | annotate | diff | comparison | revisions | |
src/MainWindow.h | file | annotate | diff | comparison | revisions | |
src/Setup.cpp | file | annotate | diff | comparison | revisions | |
src/Setup.h | file | annotate | diff | comparison | revisions | |
src/main.cpp | file | annotate | diff | comparison | revisions | |
ui/MainWindow.ui | file | annotate | diff | comparison | revisions | |
ui/Setup.ui | file | annotate | diff | comparison | revisions |
--- a/CMakeLists.txt Wed Feb 16 16:29:42 2022 +0100 +++ b/CMakeLists.txt Wed Feb 16 22:11:29 2022 +0100 @@ -100,6 +100,7 @@ ${SRCDIR}/AboutDialog.cpp ${SRCDIR}/InventorySuppliers.cpp ${SRCDIR}/EditSupplier.cpp + ${SRCDIR}/Setup.cpp ${SRCDIR}/MainWindow.cpp ${SRCDIR}/database/database.cpp ) @@ -109,6 +110,7 @@ ${SRCDIR}/AboutDialog.h ${SRCDIR}/InventorySuppliers.h ${SRCDIR}/EditSupplier.h + ${SRCDIR}/Setup.h ${SRCDIR}/MainWindow.h ${SRCDIR}/database/database.h ) @@ -117,6 +119,7 @@ ${UIDIR}/AboutDialog.ui ${UIDIR}/InventorySuppliers.ui ${UIDIR}/EditSupplier.ui + ${UIDIR}/Setup.ui ${UIDIR}/MainWindow.ui )
--- a/src/MainWindow.cpp Wed Feb 16 16:29:42 2022 +0100 +++ b/src/MainWindow.cpp Wed Feb 16 22:11:29 2022 +0100 @@ -17,6 +17,7 @@ #include "MainWindow.h" #include "AboutDialog.h" #include "InventorySuppliers.h" +#include "Setup.h" #include "../ui/ui_MainWindow.h" #include "config.h" @@ -68,6 +69,24 @@ } +void MainWindow::fromSetup() +{ + qDebug() << Q_FUNC_INFO; + delete SetupWindow; + this->show(); +} + + +void MainWindow::on_actionSetup_triggered() +{ + qDebug() << Q_FUNC_INFO; + SetupWindow = new Setup(this); + QObject::connect(SetupWindow, SIGNAL(firstWindow()), this, SLOT(fromSetup())); + this->hide(); // Close the main window + SetupWindow->show(); // Show a second window +} + + void MainWindow::on_actionAbout_triggered() { qDebug() << Q_FUNC_INFO;
--- a/src/MainWindow.h Wed Feb 16 16:29:42 2022 +0100 +++ b/src/MainWindow.h Wed Feb 16 22:11:29 2022 +0100 @@ -2,6 +2,7 @@ #define _MAINWINDOW_H #include "InventorySuppliers.h" +#include "Setup.h" #include <QMainWindow> #include <QStandardItemModel> @@ -23,16 +24,19 @@ private slots: void on_actionExit_triggered(); void on_actionSuppliers_triggered(); + void on_actionSetup_triggered(); void on_actionAbout_triggered(); public slots: void fromInventorySuppliers(); + void fromSetup(); private: Ui::MainWindow *ui; // Keep pointers to new windows. InventorySuppliers *InventorySuppliersWindow; + Setup *SetupWindow; }; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Setup.cpp Wed Feb 16 22:11:29 2022 +0100 @@ -0,0 +1,45 @@ +/** + * Setup.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 <http://www.gnu.org/licenses/>. + */ +#include "Setup.h" +#include "../ui/ui_Setup.h" +#include "config.h" +#include "bmsapp.h" + + + +Setup::Setup(QWidget *parent) : QDialog(parent), ui(new Ui::Setup) +{ + qDebug() << "Setup start"; + + ui->setupUi(this); + + setWindowTitle( QString("BMSapp - %1 - Setup").arg(VERSIONSTRING) ); +} + + +Setup::~Setup() +{ + qDebug() << "Setup done"; + delete ui; +} + + +void Setup::on_quitButton_clicked() +{ + emit firstWindow(); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Setup.h Wed Feb 16 22:11:29 2022 +0100 @@ -0,0 +1,31 @@ +#ifndef _SETUP_H +#define _SETUP_H + +#include <QDialog> + +namespace Ui { +class Setup; +} + +class Setup : public QDialog +{ + Q_OBJECT + +public: + explicit Setup(QWidget *parent = nullptr); + ~Setup(); + +signals: + void firstWindow(); + +private slots: + void on_quitButton_clicked(); +// void on_insertButton_clicked(); +// void on_editButton_clicked(); +// void refreshTable(void); + +private: + Ui::Setup *ui; +}; + +#endif
--- a/src/main.cpp Wed Feb 16 16:29:42 2022 +0100 +++ b/src/main.cpp Wed Feb 16 22:11:29 2022 +0100 @@ -35,11 +35,10 @@ #endif ); app.setApplicationVersion(VERSIONSTRING); -// app.setStyle("oxygen"); app.setOrganizationName("mbse"); + /* Stylesheet setup */ QFile f(":/qdarkstyle/theme/style.qss"); - if (!f.exists()) { printf("Unable to set stylesheet, file not found\n"); } else {
--- a/ui/MainWindow.ui Wed Feb 16 16:29:42 2022 +0100 +++ b/ui/MainWindow.ui Wed Feb 16 22:11:29 2022 +0100 @@ -85,7 +85,7 @@ <addaction name="actionBeer_styles"/> <addaction name="actionFermentation_schedules"/> <addaction name="separator"/> - <addaction name="actionGlobal_settings"/> + <addaction name="actionSetup"/> </widget> <widget class="QMenu" name="menuInventory"> <property name="title"> @@ -339,7 +339,7 @@ <string>Fermentation schedules</string> </property> </action> - <action name="actionGlobal_settings"> + <action name="actionSetup"> <property name="icon"> <iconset resource="../resources/icons.qrc"> <normaloff>:/icons/silk/icons/silk/wrench.png</normaloff>:/icons/silk/icons/silk/wrench.png</iconset>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/Setup.ui Wed Feb 16 22:11:29 2022 +0100 @@ -0,0 +1,647 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Setup</class> + <widget class="QDialog" name="Setup"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>1280</width> + <height>640</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QWidget" name="widget" native="true"> + <widget class="QLabel" name="breweryLabel"> + <property name="geometry"> + <rect> + <x>60</x> + <y>20</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Brewery name:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLineEdit" name="breweryEdit"> + <property name="geometry"> + <rect> + <x>212</x> + <y>20</y> + <width>941</width> + <height>23</height> + </rect> + </property> + <property name="toolTip"> + <string>De naam voor deze brouwerij.</string> + </property> + </widget> + <widget class="Line" name="line"> + <property name="geometry"> + <rect> + <x>0</x> + <y>60</y> + <width>1251</width> + <height>20</height> + </rect> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + <widget class="QLabel" name="fwhLabel"> + <property name="geometry"> + <rect> + <x>60</x> + <y>120</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>First Wort Hop factor:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="mashhopLabel"> + <property name="geometry"> + <rect> + <x>60</x> + <y>150</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Mash Hop factor:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="pelletLabel"> + <property name="geometry"> + <rect> + <x>60</x> + <y>180</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Pellet Hop factor:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="hopplugLabel"> + <property name="geometry"> + <rect> + <x>60</x> + <y>210</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Hop Plugs factor:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="wethopLabel"> + <property name="geometry"> + <rect> + <x>60</x> + <y>240</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Wet Hop factor:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="cryohopLabel"> + <property name="geometry"> + <rect> + <x>60</x> + <y>270</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Cryo HopĀ® factor:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QSpinBox" name="fwhEdit"> + <property name="geometry"> + <rect> + <x>210</x> + <y>120</y> + <width>81</width> + <height>24</height> + </rect> + </property> + <property name="toolTip"> + <string>Het efficientie percentage voor First Wort Hop.</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string>%</string> + </property> + <property name="minimum"> + <number>-50</number> + </property> + <property name="maximum"> + <number>50</number> + </property> + </widget> + <widget class="QSpinBox" name="mashhopEdit"> + <property name="geometry"> + <rect> + <x>210</x> + <y>150</y> + <width>81</width> + <height>24</height> + </rect> + </property> + <property name="toolTip"> + <string>Het efficientie percentage voor hop tijdens de maisch.</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string>%</string> + </property> + <property name="minimum"> + <number>-50</number> + </property> + <property name="maximum"> + <number>50</number> + </property> + </widget> + <widget class="QSpinBox" name="pelletEdit"> + <property name="geometry"> + <rect> + <x>210</x> + <y>180</y> + <width>81</width> + <height>24</height> + </rect> + </property> + <property name="toolTip"> + <string>Het efficientie percentage bij gebruik van hop pellets.</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string>%</string> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>20</number> + </property> + </widget> + <widget class="QSpinBox" name="hopplugEdit"> + <property name="geometry"> + <rect> + <x>210</x> + <y>210</y> + <width>81</width> + <height>24</height> + </rect> + </property> + <property name="toolTip"> + <string>Het efficientie percentage bij gebruik van hop plugs.</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string>%</string> + </property> + <property name="maximum"> + <number>20</number> + </property> + </widget> + <widget class="QSpinBox" name="wethopEdit"> + <property name="geometry"> + <rect> + <x>210</x> + <y>240</y> + <width>81</width> + <height>24</height> + </rect> + </property> + <property name="toolTip"> + <string>Het efficientie percentage bij gebruik van nat geplukte hop.</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string>%</string> + </property> + <property name="minimum"> + <number>-98</number> + </property> + <property name="maximum"> + <number>-20</number> + </property> + </widget> + <widget class="QSpinBox" name="cryohopEdit"> + <property name="geometry"> + <rect> + <x>210</x> + <y>270</y> + <width>81</width> + <height>24</height> + </rect> + </property> + <property name="toolTip"> + <string>Het efficientie percentage bij gebruik van Cryo HopĀ®.</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string>%</string> + </property> + <property name="minimum"> + <number>-20</number> + </property> + <property name="maximum"> + <number>150</number> + </property> + </widget> + <widget class="QLabel" name="grainLabel"> + <property name="geometry"> + <rect> + <x>440</x> + <y>120</y> + <width>161</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Grain Absorbtion:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="brixLabel"> + <property name="geometry"> + <rect> + <x>440</x> + <y>150</y> + <width>161</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Brix Correction factor:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="titleLabel"> + <property name="geometry"> + <rect> + <x>5</x> + <y>80</y> + <width>1251</width> + <height>20</height> + </rect> + </property> + <property name="font"> + <font> + <family>DejaVu Sans</family> + <pointsize>12</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Brew settings.</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QLabel" name="colorLabel"> + <property name="geometry"> + <rect> + <x>850</x> + <y>120</y> + <width>121</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Color Method:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="ibuLabel"> + <property name="geometry"> + <rect> + <x>850</x> + <y>150</y> + <width>121</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>IBU Calculation:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="waterLabel"> + <property name="geometry"> + <rect> + <x>850</x> + <y>180</y> + <width>121</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Default Water:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="yeastLabel"> + <property name="geometry"> + <rect> + <x>850</x> + <y>210</y> + <width>121</width> + <height>16</height> + </rect> + </property> + <property name="text"> + <string>Private Yeast bank:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QDoubleSpinBox" name="grainEdit"> + <property name="geometry"> + <rect> + <x>620</x> + <y>120</y> + <width>101</width> + <height>24</height> + </rect> + </property> + <property name="toolTip"> + <string>Absorbtion with water by the grain (L/Kg)</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string> L/Kg</string> + </property> + <property name="minimum"> + <double>0.500000000000000</double> + </property> + <property name="maximum"> + <double>1.100000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + <property name="stepType"> + <enum>QAbstractSpinBox::DefaultStepType</enum> + </property> + <property name="value"> + <double>1.010000000000000</double> + </property> + </widget> + <widget class="QDoubleSpinBox" name="brixEdit"> + <property name="geometry"> + <rect> + <x>620</x> + <y>150</y> + <width>101</width> + <height>24</height> + </rect> + </property> + <property name="toolTip"> + <string>Plato to Brix conversion factor.</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="minimum"> + <double>1.000000000000000</double> + </property> + <property name="maximum"> + <double>1.090000000000000</double> + </property> + <property name="singleStep"> + <double>0.010000000000000</double> + </property> + <property name="stepType"> + <enum>QAbstractSpinBox::DefaultStepType</enum> + </property> + <property name="value"> + <double>1.040000000000000</double> + </property> + </widget> + <widget class="QComboBox" name="colorEdit"> + <property name="geometry"> + <rect> + <x>990</x> + <y>120</y> + <width>161</width> + <height>23</height> + </rect> + </property> + <property name="currentText"> + <string/> + </property> + <property name="minimumContentsLength"> + <number>4</number> + </property> + <property name="placeholderText"> + <string>Choose color</string> + </property> + </widget> + <widget class="QComboBox" name="ibuEdit"> + <property name="geometry"> + <rect> + <x>990</x> + <y>150</y> + <width>161</width> + <height>23</height> + </rect> + </property> + <property name="currentText"> + <string/> + </property> + <property name="minimumContentsLength"> + <number>4</number> + </property> + <property name="placeholderText"> + <string>Choose color</string> + </property> + </widget> + <widget class="QComboBox" name="waterEdit"> + <property name="geometry"> + <rect> + <x>990</x> + <y>180</y> + <width>161</width> + <height>23</height> + </rect> + </property> + <property name="currentText"> + <string/> + </property> + <property name="minimumContentsLength"> + <number>4</number> + </property> + <property name="placeholderText"> + <string>Choose color</string> + </property> + </widget> + <widget class="QComboBox" name="yeastEdit"> + <property name="geometry"> + <rect> + <x>990</x> + <y>210</y> + <width>161</width> + <height>23</height> + </rect> + </property> + <property name="currentText"> + <string/> + </property> + <property name="minimumContentsLength"> + <number>4</number> + </property> + <property name="placeholderText"> + <string>Choose color</string> + </property> + </widget> + </widget> + </item> + <item row="1" column="0"> + <widget class="QWidget" name="widget" native="true"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>24</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>24</height> + </size> + </property> + <widget class="QPushButton" name="quitButton"> + <property name="geometry"> + <rect> + <x>10</x> + <y>0</y> + <width>80</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>Quit</string> + </property> + <property name="icon"> + <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc"> + <normaloff>:/icons/silk/icons/silk/door_out.png</normaloff>:/icons/silk/icons/silk/door_out.png</iconset> + </property> + </widget> + <widget class="QPushButton" name="saveButton"> + <property name="geometry"> + <rect> + <x>1170</x> + <y>0</y> + <width>80</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>Save</string> + </property> + <property name="icon"> + <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc"> + <normaloff>:/icons/silk/icons/silk/disk.png</normaloff>:/icons/silk/icons/silk/disk.png</iconset> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + <resources> + <include location="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc"/> + </resources> + <connections/> +</ui>