--- a/src/Setup.cpp Fri Jun 24 16:50:22 2022 +0200 +++ b/src/Setup.cpp Mon Jun 27 11:50:18 2022 +0200 @@ -295,15 +295,15 @@ query.exec(); query.next(); - breweryEdit->setText(query.value(1).toString()); // max 128 + breweryEdit->setText(query.value("brewery_name").toString()); // max 128 connect(breweryEdit, &QLineEdit::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()); + fwhEdit->setValue(query.value("factor_fwh").toInt()); + mashhopEdit->setValue(query.value("factor_mashhop").toInt()); + pelletEdit->setValue(query.value("factor_pellet").toInt()); + hopplugEdit->setValue(query.value("factor_plug").toInt()); + wethopEdit->setValue(query.value("factor_wethop").toInt()); + cryohopEdit->setValue(query.value("factor_cryohop").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); @@ -311,8 +311,8 @@ connect(wethopEdit, &QSpinBox::textChanged, this, &Setup::is_changed); connect(cryohopEdit, &QSpinBox::textChanged, this, &Setup::is_changed); - grainEdit->setValue(query.value(12).toDouble()); - brixEdit->setValue(query.value(11).toDouble()); + grainEdit->setValue(query.value("grain_absorbtion").toDouble()); + brixEdit->setValue(query.value("brix_correction").toDouble()); connect(grainEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed); connect(brixEdit, &QDoubleSpinBox::textChanged, this, &Setup::is_changed); @@ -322,14 +322,14 @@ colorEdit->addItem("Halberstadt"); colorEdit->addItem("Naudts"); colorEdit->setEditable(true); - colorEdit->setCurrentIndex(query.value(10).toInt()); + colorEdit->setCurrentIndex(query.value("color_method").toInt()); connect(colorEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); ibuEdit->addItem("Tinseth"); ibuEdit->addItem("Rager"); ibuEdit->addItem("Daniels"); ibuEdit->setEditable(true); - ibuEdit->setCurrentIndex(query.value(9).toInt()); + ibuEdit->setCurrentIndex(query.value("ibu_method").toInt()); connect(ibuEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); QSqlQuery query2("SELECT record,name FROM inventory_waters"); @@ -339,7 +339,7 @@ waterEdit->setPlaceholderText(tr("Choose default water")); for (int i = 0 ; i < query2.size() ; i++ ) { waterEdit->addItem(query2.value(1).toString()); - if (query2.value(0).toInt() == query.value(13).toInt()) { + if (query2.value(0).toInt() == query.value("default_water").toInt()) { pos = i; } query2.next(); @@ -355,7 +355,7 @@ yeastEdit->setPlaceholderText(tr("Choose laboratory")); for (int i = 0 ; i < query3.size() ; i++ ) { yeastEdit->addItem(query3.value(0).toString()); - if (QString::compare(query.value(14).toString(), query3.value(0).toString(), Qt::CaseSensitive) == 0) + if (QString::compare(query.value("my_yeastlab").toString(), query3.value(0).toString(), Qt::CaseSensitive) == 0) pos = i; query3.next(); } @@ -364,7 +364,7 @@ connect(yeastEdit, &QComboBox::currentTextChanged, this, &Setup::is_changed); /* logo */ - logoByteArray = query.value(2).toByteArray(); + logoByteArray = query.value("brewery_logo").toByteArray(); QPixmap outPixmap = QPixmap(); outPixmap.loadFromData(logoByteArray); logoLabel->setPixmap(outPixmap);