# HG changeset patch # User Michiel Broek # Date 1697296732 -7200 # Node ID fa07b6c6238a47f0eba877a525544eb99fb9134d # Parent ea07f6c97a69d75af047f31046ba94ab72e59951 Added the cell edit function. diff -r ea07f6c97a69 -r fa07b6c6238a src/CalibrateiSpindel.cpp --- a/src/CalibrateiSpindel.cpp Sat Oct 14 16:10:14 2023 +0200 +++ b/src/CalibrateiSpindel.cpp Sat Oct 14 17:18:52 2023 +0200 @@ -268,6 +268,34 @@ qDebug() << "Cell at row " + QString::number(nRow) + " column " + QString::number(nCol) + " was changed."; + if (nCol == 0) { // SG changed + double d = ui->dataTable->item(nRow, 0)->text().toDouble(); + if (d < 1.000 || d > 1.100) { + QMessageBox::warning(this, tr("iSpindel calibrate"), tr("The SG must be between 1.000 and 1.100.")); + return; + } + nCal[nRow].sg = d; + nCal[nRow].plato = Utils::sg_to_plato(d); + qDebug() << "sg" << nCal[nRow].sg << "plato" << nCal[nRow].plato; + } else if (nCol == 1) { + double d = ui->dataTable->item(nRow, 1)->text().toDouble(); + if (d < 0 || d > 25) { + QMessageBox::warning(this, tr("iSpindel calibrate"), tr("Plato must be between 0 and 25.")); + return; + } + nCal[nRow].plato = d; + nCal[nRow].sg = Utils::plato_to_sg(d); + qDebug() << "sg" << nCal[nRow].sg << "plato" << nCal[nRow].plato; + } else if (nCol == 2) { + double d = ui->dataTable->item(nRow, 2)->text().toDouble(); + if (d < 10 || d > 80) { + QMessageBox::warning(this, tr("iSpindel calibrate"), tr("The tilt angles must be between 10 and 80.")); + return; + } + nCal[nRow].angle = d; + } + + emit refreshTable(); } diff -r ea07f6c97a69 -r fa07b6c6238a translations/bmsapp_en.ts --- a/translations/bmsapp_en.ts Sat Oct 14 16:10:14 2023 +0200 +++ b/translations/bmsapp_en.ts Sat Oct 14 17:18:52 2023 +0200 @@ -101,7 +101,7 @@ - + Angle @@ -112,32 +112,50 @@ - + Old - + New - + Calibration plot - + + + + iSpindel calibrate - + You cannot delete too many rows. - + + The SG must be between 1.000 and 1.100. + + + + + Plato must be between 0 and 25. + + + + + The tilt angles must be between 10 and 80. + + + + BMSapp - Calibrate iSpindel %1 diff -r ea07f6c97a69 -r fa07b6c6238a translations/bmsapp_nl.ts --- a/translations/bmsapp_nl.ts Sat Oct 14 16:10:14 2023 +0200 +++ b/translations/bmsapp_nl.ts Sat Oct 14 17:18:52 2023 +0200 @@ -155,7 +155,7 @@ - + Angle @@ -166,32 +166,50 @@ - + Old - + New Nieuw - + Calibration plot - + + + + iSpindel calibrate - + You cannot delete too many rows. - + + The SG must be between 1.000 and 1.100. + + + + + Plato must be between 0 and 25. + + + + + The tilt angles must be between 10 and 80. + + + + BMSapp - Calibrate iSpindel %1