diff -r 86a3277a7317 -r 3a6cba2dd05d src/Setup.cpp --- a/src/Setup.cpp Sun Mar 20 21:39:06 2022 +0100 +++ b/src/Setup.cpp Mon Mar 21 11:44:51 2022 +0100 @@ -15,106 +15,364 @@ * along with this program. If not, see . */ #include "Setup.h" -#include "../ui/ui_Setup.h" #include "config.h" #include "bmsapp.h" -Setup::Setup(QWidget *parent) : QDialog(parent), ui(new Ui::Setup) +Setup::Setup(QWidget *parent) : QDialog(parent) { QSqlQuery query; + QGridLayout *gridLayout; + QWidget *topWidget; + QFrame *line; qDebug() << "Setup start"; - ui->setupUi(this); - setWindowTitle( QString("BMSapp - %1 - Setup").arg(VERSIONSTRING) ); + + gridLayout = new QGridLayout(this); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + topWidget = new QWidget(this); + topWidget->setObjectName(QString::fromUtf8("topWidget")); + + breweryLabel = new QLabel(topWidget); + breweryLabel->setObjectName(QString::fromUtf8("breweryLabel")); + breweryLabel->setGeometry(QRect(60, 20, 131, 20)); + breweryLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + breweryLabel->setText(tr("Brewery name:")); + breweryEdit = new QLineEdit(topWidget); + breweryEdit->setObjectName(QString::fromUtf8("breweryEdit")); + breweryEdit->setGeometry(QRect(212, 20, 941, 23)); + breweryEdit->setToolTip(tr("The name for this brewery.")); + + line = new QFrame(topWidget); + line->setObjectName(QString::fromUtf8("line")); + line->setGeometry(QRect(0, 60, 1251, 20)); + line->setFrameShape(QFrame::HLine); + line->setFrameShadow(QFrame::Sunken); + + fwhLabel = new QLabel(topWidget); + fwhLabel->setObjectName(QString::fromUtf8("fwhLabel")); + fwhLabel->setGeometry(QRect(60, 120, 131, 20)); + fwhLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + fwhLabel->setText(tr("First Wort Hop factor:")); + + mashhopLabel = new QLabel(topWidget); + mashhopLabel->setObjectName(QString::fromUtf8("mashhopLabel")); + mashhopLabel->setGeometry(QRect(60, 150, 131, 20)); + mashhopLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + mashhopLabel->setText(tr("Mash Hop factor:")); + + pelletLabel = new QLabel(topWidget); + pelletLabel->setObjectName(QString::fromUtf8("pelletLabel")); + pelletLabel->setGeometry(QRect(60, 180, 131, 20)); + pelletLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + pelletLabel->setText(tr("Pellet Hop factor:")); + + hopplugLabel = new QLabel(topWidget); + hopplugLabel->setObjectName(QString::fromUtf8("hopplugLabel")); + hopplugLabel->setGeometry(QRect(60, 210, 131, 20)); + hopplugLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + hopplugLabel->setText(tr("Hop Plugs factor:")); + + wethopLabel = new QLabel(topWidget); + wethopLabel->setObjectName(QString::fromUtf8("wethopLabel")); + wethopLabel->setGeometry(QRect(60, 240, 131, 20)); + wethopLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + wethopLabel->setText(tr("Wet Hop factor:")); + + cryohopLabel = new QLabel(topWidget); + cryohopLabel->setObjectName(QString::fromUtf8("cryohopLabel")); + cryohopLabel->setGeometry(QRect(60, 270, 131, 20)); + cryohopLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + cryohopLabel->setText(tr("Cryo Hop\302\256 factor:")); + + fwhEdit = new QSpinBox(topWidget); + fwhEdit->setObjectName(QString::fromUtf8("fwhEdit")); + fwhEdit->setGeometry(QRect(210, 120, 81, 24)); + fwhEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + fwhEdit->setAccelerated(true); + fwhEdit->setMinimum(-50); + fwhEdit->setMaximum(50); + fwhEdit->setToolTip(tr("The efficiency for First Wort Hopping.")); + fwhEdit->setSuffix(tr("%")); + + mashhopEdit = new QSpinBox(topWidget); + mashhopEdit->setObjectName(QString::fromUtf8("mashhopEdit")); + mashhopEdit->setGeometry(QRect(210, 150, 81, 24)); + mashhopEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + mashhopEdit->setAccelerated(true); + mashhopEdit->setMinimum(-50); + mashhopEdit->setMaximum(50); + mashhopEdit->setToolTip(tr("The efficiency for Mash hopping.")); + mashhopEdit->setSuffix(tr("%")); + + pelletEdit = new QSpinBox(topWidget); + pelletEdit->setObjectName(QString::fromUtf8("pelletEdit")); + pelletEdit->setGeometry(QRect(210, 180, 81, 24)); + pelletEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + pelletEdit->setAccelerated(true); + pelletEdit->setMinimum(0); + pelletEdit->setMaximum(20); + pelletEdit->setToolTip(tr("The efficiency for hop pellets.")); + pelletEdit->setSuffix(tr("%")); + + hopplugEdit = new QSpinBox(topWidget); + hopplugEdit->setObjectName(QString::fromUtf8("hopplugEdit")); + hopplugEdit->setGeometry(QRect(210, 210, 81, 24)); + hopplugEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + hopplugEdit->setAccelerated(true); + hopplugEdit->setMaximum(20); + hopplugEdit->setToolTip(tr("The efficiency for hop plugs.")); + hopplugEdit->setSuffix(tr("%")); + + wethopEdit = new QSpinBox(topWidget); + wethopEdit->setObjectName(QString::fromUtf8("wethopEdit")); + wethopEdit->setGeometry(QRect(210, 240, 81, 24)); + wethopEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + wethopEdit->setAccelerated(true); + wethopEdit->setMinimum(-98); + wethopEdit->setMaximum(-20); + wethopEdit->setToolTip(tr("The efficiency for fresh hops.")); + wethopEdit->setSuffix(tr("%")); + + cryohopEdit = new QSpinBox(topWidget); + cryohopEdit->setObjectName(QString::fromUtf8("cryohopEdit")); + cryohopEdit->setGeometry(QRect(210, 270, 81, 24)); + cryohopEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + cryohopEdit->setAccelerated(true); + cryohopEdit->setMinimum(-20); + cryohopEdit->setMaximum(150); + cryohopEdit->setToolTip(tr("The efficiency for using Cryo Hop\302\256.")); + cryohopEdit->setSuffix(tr("%")); + + grainLabel = new QLabel(topWidget); + grainLabel->setObjectName(QString::fromUtf8("grainLabel")); + grainLabel->setGeometry(QRect(400, 120, 161, 20)); + grainLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + grainLabel->setText(tr("Grain Absorbtion:")); + + brixLabel = new QLabel(topWidget); + brixLabel->setObjectName(QString::fromUtf8("brixLabel")); + brixLabel->setGeometry(QRect(400, 150, 161, 20)); + brixLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + brixLabel->setText(tr("Brix Correction factor:")); + + titleLabel = new QLabel(topWidget); + titleLabel->setObjectName(QString::fromUtf8("titleLabel")); + titleLabel->setGeometry(QRect(5, 80, 1251, 20)); + QFont font; + font.setFamily(QString::fromUtf8("DejaVu Sans")); + font.setPointSize(12); + font.setBold(true); + font.setWeight(75); + titleLabel->setFont(font); + titleLabel->setAlignment(Qt::AlignCenter); + titleLabel->setText(tr("Brew settings.")); + + colorLabel = new QLabel(topWidget); + colorLabel->setObjectName(QString::fromUtf8("colorLabel")); + colorLabel->setGeometry(QRect(800, 120, 121, 16)); + colorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + colorLabel->setText(tr("Color Calculation:")); + + ibuLabel = new QLabel(topWidget); + ibuLabel->setObjectName(QString::fromUtf8("ibuLabel")); + ibuLabel->setGeometry(QRect(800, 150, 121, 16)); + ibuLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + ibuLabel->setText(tr("IBU Calculation:")); + + waterLabel = new QLabel(topWidget); + waterLabel->setObjectName(QString::fromUtf8("waterLabel")); + waterLabel->setGeometry(QRect(800, 180, 121, 16)); + waterLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + waterLabel->setText(tr("Default Water:")); + + yeastLabel = new QLabel(topWidget); + yeastLabel->setObjectName(QString::fromUtf8("yeastLabel")); + yeastLabel->setGeometry(QRect(800, 210, 121, 16)); + yeastLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + yeastLabel->setText(tr("Private Yeast bank:")); + + grainEdit = new QDoubleSpinBox(topWidget); + grainEdit->setObjectName(QString::fromUtf8("grainEdit")); + grainEdit->setGeometry(QRect(580, 120, 101, 24)); + grainEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + grainEdit->setAccelerated(true); + grainEdit->setMinimum(0.500000000000000); + grainEdit->setMaximum(1.100000000000000); + grainEdit->setSingleStep(0.010000000000000); + grainEdit->setStepType(QAbstractSpinBox::DefaultStepType); + grainEdit->setValue(1.000000000000000); + grainEdit->setToolTip(tr("Absorbtion with water by the grain (L/Kg)")); + grainEdit->setSuffix(tr(" L/Kg")); + + brixEdit = new QDoubleSpinBox(topWidget); + brixEdit->setObjectName(QString::fromUtf8("brixEdit")); + brixEdit->setGeometry(QRect(580, 150, 101, 24)); + brixEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + brixEdit->setAccelerated(true); + brixEdit->setMinimum(1.000000000000000); + brixEdit->setMaximum(1.090000000000000); + brixEdit->setSingleStep(0.010000000000000); + brixEdit->setStepType(QAbstractSpinBox::DefaultStepType); + brixEdit->setValue(1.000000000000000); + brixEdit->setToolTip(tr("Plato to Brix conversion factor.")); + + colorEdit = new QComboBox(topWidget); + colorEdit->setObjectName(QString::fromUtf8("colorEdit")); + colorEdit->setGeometry(QRect(940, 120, 161, 23)); + colorEdit->setMinimumContentsLength(4); + colorEdit->setIconSize(QSize(0, 0)); + colorEdit->setCurrentText(QString()); + colorEdit->setPlaceholderText(tr("Choose color")); + + ibuEdit = new QComboBox(topWidget); + ibuEdit->setObjectName(QString::fromUtf8("ibuEdit")); + ibuEdit->setGeometry(QRect(940, 150, 161, 23)); + ibuEdit->setMinimumContentsLength(4); + ibuEdit->setIconSize(QSize(0, 0)); + ibuEdit->setCurrentText(QString()); + ibuEdit->setPlaceholderText(tr("Choose color")); + + waterEdit = new QComboBox(topWidget); + waterEdit->setObjectName(QString::fromUtf8("waterEdit")); + waterEdit->setGeometry(QRect(940, 180, 211, 23)); + waterEdit->setMinimumContentsLength(4); + waterEdit->setIconSize(QSize(0, 0)); + waterEdit->setCurrentText(QString()); + waterEdit->setPlaceholderText(tr("Choose color")); + + yeastEdit = new QComboBox(topWidget); + yeastEdit->setObjectName(QString::fromUtf8("yeastEdit")); + yeastEdit->setGeometry(QRect(940, 210, 211, 23)); + yeastEdit->setMinimumContentsLength(4); + yeastEdit->setIconSize(QSize(0, 0)); + yeastEdit->setCurrentText(QString()); + yeastEdit->setPlaceholderText(tr("Choose color")); + + logoLabel = new QLabel(topWidget); + logoLabel->setObjectName(QString::fromUtf8("logoLabel")); + logoLabel->setGeometry(QRect(940, 260, 211, 211)); + logoLabel->setAlignment(Qt::AlignCenter); + logoLabel->setText(tr("Logo here")); + + quitButton = new QPushButton(topWidget); + quitButton->setObjectName(QString::fromUtf8("quitButton")); + quitButton->setGeometry(QRect(50, 520, 80, 23)); + QIcon icon; + icon.addFile(QString::fromUtf8(":icons/silk/door_out.png"), QSize(), QIcon::Normal, QIcon::Off); + quitButton->setIcon(icon); + quitButton->setText(tr("Quit")); + + saveButton = new QPushButton(topWidget); + saveButton->setObjectName(QString::fromUtf8("saveButton")); + saveButton->setGeometry(QRect(200, 520, 80, 23)); + QIcon icon1; + icon1.addFile(QString::fromUtf8(":icons/silk/disk.png"), QSize(), QIcon::Normal, QIcon::Off); + saveButton->setIcon(icon1); + saveButton->setText(tr("Save")); + saveButton->setEnabled(false); + + openButton = new QPushButton(topWidget); + openButton->setObjectName(QString::fromUtf8("openButton")); + openButton->setGeometry(QRect(810, 260, 111, 23)); + QIcon icon2; + icon2.addFile(QString::fromUtf8(":/icons/silk/folder_picture.png"), QSize(), QIcon::Normal, QIcon::Off); + openButton->setIcon(icon2); + openButton->setText(tr("Load logo")); + + gridLayout->addWidget(topWidget, 0, 0, 1, 1); + + connect(quitButton, SIGNAL(clicked()), this, SLOT(on_quitButton_clicked())); + connect(saveButton, SIGNAL(clicked()), this, SLOT(on_saveButton_clicked())); + connect(openButton, SIGNAL(clicked()), this, SLOT(on_openButton_clicked())); + connect(this, SIGNAL(firstWindow()), parent, SLOT(fromSetup())); + connect(this, SIGNAL(setTitle(QString)), parent, SLOT(windowTitle(QString))); + + emit setTitle(QString(tr("Setup"))); query.prepare("SELECT * FROM profile_setup WHERE record='1'"); query.exec(); query.next(); - ui->breweryEdit->setText(query.value(1).toString()); // max 128 - connect(ui->breweryEdit, &QLineEdit::textChanged, this, &Setup::is_changed); + breweryEdit->setText(query.value(1).toString()); // max 128 + connect(breweryEdit, &QLineEdit::textChanged, this, &Setup::is_changed); - ui->fwhEdit->setValue(query.value(4).toInt()); - ui->mashhopEdit->setValue(query.value(3).toInt()); - ui->pelletEdit->setValue(query.value(5).toInt()); - ui->hopplugEdit->setValue(query.value(6).toInt()); - ui->wethopEdit->setValue(query.value(7).toInt()); - ui->cryohopEdit->setValue(query.value(8).toInt()); - connect(ui->fwhEdit, &QSpinBox::textChanged, this, &Setup::is_changed); - connect(ui->mashhopEdit, &QSpinBox::textChanged, this, &Setup::is_changed); - connect(ui->pelletEdit, &QSpinBox::textChanged, this, &Setup::is_changed); - connect(ui->hopplugEdit, &QSpinBox::textChanged, this, &Setup::is_changed); - connect(ui->wethopEdit, &QSpinBox::textChanged, this, &Setup::is_changed); - connect(ui->cryohopEdit, &QSpinBox::textChanged, this, &Setup::is_changed); + fwhEdit->setValue(query.value(4).toInt()); + mashhopEdit->setValue(query.value(3).toInt()); + pelletEdit->setValue(query.value(5).toInt()); + hopplugEdit->setValue(query.value(6).toInt()); + wethopEdit->setValue(query.value(7).toInt()); + cryohopEdit->setValue(query.value(8).toInt()); + connect(fwhEdit, &QSpinBox::textChanged, this, &Setup::is_changed); + connect(mashhopEdit, &QSpinBox::textChanged, this, &Setup::is_changed); + connect(pelletEdit, &QSpinBox::textChanged, this, &Setup::is_changed); + connect(hopplugEdit, &QSpinBox::textChanged, this, &Setup::is_changed); + connect(wethopEdit, &QSpinBox::textChanged, this, &Setup::is_changed); + connect(cryohopEdit, &QSpinBox::textChanged, this, &Setup::is_changed); - ui->grainEdit->setValue(query.value(12).toDouble()); - ui->brixEdit->setValue(query.value(11).toDouble()); - connect(ui->grainEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed); - connect(ui->brixEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed); + grainEdit->setValue(query.value(12).toDouble()); + brixEdit->setValue(query.value(11).toDouble()); + connect(grainEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed); + connect(brixEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed); - ui->colorEdit->addItem("Morey"); - ui->colorEdit->addItem("Mosher"); - ui->colorEdit->addItem("Daniels"); - ui->colorEdit->addItem("Halberstadt"); - ui->colorEdit->addItem("Naudts"); - ui->colorEdit->setEditable(true); - ui->colorEdit->setCurrentIndex(query.value(10).toInt()); - connect(ui->colorEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); + colorEdit->addItem("Morey"); + colorEdit->addItem("Mosher"); + colorEdit->addItem("Daniels"); + colorEdit->addItem("Halberstadt"); + colorEdit->addItem("Naudts"); + colorEdit->setEditable(true); + colorEdit->setCurrentIndex(query.value(10).toInt()); + connect(colorEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); - ui->ibuEdit->addItem("Tinseth"); - ui->ibuEdit->addItem("Rager"); - ui->ibuEdit->addItem("Daniels"); - ui->ibuEdit->setEditable(true); - ui->ibuEdit->setCurrentIndex(query.value(9).toInt()); - connect(ui->ibuEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); + ibuEdit->addItem("Tinseth"); + ibuEdit->addItem("Rager"); + ibuEdit->addItem("Daniels"); + ibuEdit->setEditable(true); + ibuEdit->setCurrentIndex(query.value(9).toInt()); + connect(ibuEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); QSqlQuery query2("SELECT record,name FROM inventory_waters"); query2.first(); int pos = -1; - ui->waterEdit->setEditable(true); - ui->waterEdit->setPlaceholderText(tr("Choose default water")); + waterEdit->setEditable(true); + waterEdit->setPlaceholderText(tr("Choose default water")); for (int i = 0 ; i < query2.size() ; i++ ) { - ui->waterEdit->addItem(query2.value(1).toString()); + waterEdit->addItem(query2.value(1).toString()); if (query2.value(0).toInt() == query.value(13).toInt()) { pos = i; } query2.next(); } if (pos >= 0) - ui->waterEdit->setCurrentIndex(pos); - connect(ui->waterEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); + waterEdit->setCurrentIndex(pos); + connect(waterEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); QSqlQuery query3("SELECT DISTINCT laboratory FROM inventory_yeasts ORDER BY laboratory"); query3.first(); pos = -1; - ui->yeastEdit->setEditable(true); - ui->yeastEdit->setPlaceholderText(tr("Choose laboratory")); + yeastEdit->setEditable(true); + yeastEdit->setPlaceholderText(tr("Choose laboratory")); for (int i = 0 ; i < query3.size() ; i++ ) { - ui->yeastEdit->addItem(query3.value(0).toString()); + yeastEdit->addItem(query3.value(0).toString()); if (QString::compare(query.value(14).toString(), query3.value(0).toString(), Qt::CaseSensitive) == 0) pos = i; query3.next(); } if (pos >= 0) - ui->yeastEdit->setCurrentIndex(pos); - connect(ui->yeastEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); + yeastEdit->setCurrentIndex(pos); + connect(yeastEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); /* logo */ logoByteArray = query.value(2).toByteArray(); QPixmap outPixmap = QPixmap(); outPixmap.loadFromData(logoByteArray); - ui->logoLabel->setPixmap(outPixmap); - ui->logoLabel->adjustSize(); + logoLabel->setPixmap(outPixmap); + logoLabel->adjustSize(); } -Setup::~Setup() -{ - qDebug() << "Setup done"; - delete ui; -} +Setup::~Setup() {} bool Setup::loadFile(const QString &fileName) @@ -144,11 +402,11 @@ buffer.open(QIODevice::WriteOnly); image.save(&buffer, "PNG"); // writes image into logoByteArray in PNG format - ui->logoLabel->setPixmap(QPixmap::fromImage(image)); + this->logoLabel->setPixmap(QPixmap::fromImage(image)); scaleFactor = 1.0; -// ui->logoLabel->resize(scaleFactor * ui->logoLabel->pixmap(Qt::ReturnByValue).size()); - ui->logoLabel->adjustSize(); +// this->logoLabel->resize(scaleFactor * ui->logoLabel->pixmap(Qt::ReturnByValue).size()); + this->logoLabel->adjustSize(); } @@ -187,7 +445,7 @@ * Search record number of the current water. */ query.prepare("SELECT record FROM inventory_waters WHERE name=:name"); - query.bindValue(":name", ui->waterEdit->currentText()); + query.bindValue(":name", this->waterEdit->currentText()); query.exec(); query.first(); int record = query.value(0).toInt(); @@ -198,20 +456,20 @@ query.prepare("UPDATE profile_setup SET brewery_name=:brewery, brewery_logo=:logo, factor_mashhop=:mashhop, factor_fwh=:fwh, " "factor_pellet=:pellet, factor_plug=:plug, factor_wethop=:wet, factor_cryohop=:cryo, color_method=:color, ibu_method=:ibu, " "brix_correction=:brix, grain_absorbtion=:grain, default_water=:water, my_yeastlab=:yeast WHERE record='1'"); - query.bindValue(":brewery", ui->breweryEdit->text()); + query.bindValue(":brewery", this->breweryEdit->text()); query.bindValue(":logo", logoByteArray); - query.bindValue(":mashhop", ui->mashhopEdit->value()); - query.bindValue(":fwh", ui->fwhEdit->value()); - query.bindValue(":pellet", ui->pelletEdit->value()); - query.bindValue(":plug", ui->hopplugEdit->value()); - query.bindValue(":wet", ui->wethopEdit->value()); - query.bindValue(":cryo", ui->cryohopEdit->value()); - query.bindValue(":color", ui->colorEdit->currentIndex()); - query.bindValue(":ibu", ui->ibuEdit->currentIndex()); - query.bindValue(":brix", ui->brixEdit->value()); - query.bindValue(":grain", ui->grainEdit->value()); + query.bindValue(":mashhop", this->mashhopEdit->value()); + query.bindValue(":fwh", this->fwhEdit->value()); + query.bindValue(":pellet", this->pelletEdit->value()); + query.bindValue(":plug", this->hopplugEdit->value()); + query.bindValue(":wet", this->wethopEdit->value()); + query.bindValue(":cryo", this->cryohopEdit->value()); + query.bindValue(":color", this->colorEdit->currentIndex()); + query.bindValue(":ibu", this->ibuEdit->currentIndex()); + query.bindValue(":brix", this->brixEdit->value()); + query.bindValue(":grain", this->grainEdit->value()); query.bindValue(":water", record); - query.bindValue(":yeast", ui->yeastEdit->currentText()); + query.bindValue(":yeast", this->yeastEdit->currentText()); query.exec(); if (query.lastError().isValid()) { qDebug() << "Setup Save error:" << query.lastError(); @@ -225,7 +483,8 @@ } this->fieldIsChanged = false; - setWindowTitle( QString("BMSapp - %1 - Setup").arg(VERSIONSTRING) ); + saveButton->setEnabled(false); + emit setTitle(QString(tr("Setup"))); } @@ -250,6 +509,7 @@ void Setup::is_changed() { + saveButton->setEnabled(true); this->fieldIsChanged = true; - setWindowTitle( QString("BMSapp - %1 - Setup **").arg(VERSIONSTRING) ); + emit setTitle(QString(tr("Setup") + " **")); }