File indexing completed on 2024-04-21 03:41:38

0001 /*
0002     SPDX-FileCopyrightText: 2010 Luca Tringali <TRINGALINVENT@libero.it>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef TITRATIONCALCULATOR_H
0008 #define TITRATIONCALCULATOR_H
0009 
0010 #include "kalzium_debug.h"
0011 #include <QString>
0012 #include <QStringList>
0013 
0014 #include <KPlotObject>
0015 #include <KPlotPoint>
0016 #include <KPlotWidget>
0017 
0018 #include <element.h>
0019 #include <isotope.h>
0020 #include <prefs.h>
0021 
0022 #include "ui_titrationCalculator.h"
0023 
0024 /*
0025  * This class implements the titration calculator: it can solve a system of chemical equilibria equations
0026  * and find out the equivalence point of an experimental titration.
0027  *
0028  * @author Luca Tringali
0029  */
0030 class titrationCalculator : public QWidget
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     explicit titrationCalculator(QWidget *parent = nullptr);
0036     ~titrationCalculator() override;
0037 
0038 public Q_SLOTS:
0039     void on_pushButton_clicked();
0040     void on_xmin_valueChanged(double val);
0041     void on_xmax_valueChanged(double val);
0042     void on_ymin_valueChanged(double val);
0043     void on_ymax_valueChanged(double val);
0044 
0045     void on_actionSave_image_triggered();
0046     void on_actionOpen_triggered();
0047     void on_actionSave_triggered();
0048     void on_actionNew_triggered();
0049     void on_actionRapid_Help_triggered();
0050 
0051 private:
0052     void resize();
0053     double xmin;
0054     double xmax;
0055     double ymin;
0056     double ymax;
0057     int width;
0058     int end;
0059     int lettere;
0060     int temponu;
0061     double a;
0062     void plot();
0063     QString solve(char *yvalue);
0064     QString solvex(char *yvalue, const QString &dnum);
0065     QImage tempi;
0066     double setttanh(double x);
0067     QString redplot;
0068     QString greenplot;
0069     QString blueplot;
0070 
0071     Ui::titrationCalculator uid; // The user interface
0072 };
0073 
0074 #endif // TITRATIONCALCULATOR_H