src/CalibrateiSpindel.cpp

changeset 507
fa07b6c6238a
parent 506
ea07f6c97a69
child 509
af4a8649245e
--- 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();
 }
 
 

mercurial