2
* This program is distributed in the hope that it will be useful,
3
* but WITHOUT ANY WARRANTY; without even the implied warranty of
4
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5
* GNU General Public License for more details.
6
* You should have received a copy of the GNU General Public License
7
* along with this program; if not, write to the Free Software
8
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
11
#include "CustomDeltaTEquationDialog.hpp"
12
#include "ui_CustomDeltaTEquationDialog.h"
15
#include "StelApp.hpp"
16
#include "StelTranslator.hpp"
17
#include "StelObjectMgr.hpp"
21
CustomDeltaTEquationDialog::CustomDeltaTEquationDialog()
23
ui = new Ui_CustomDeltaTEquationDialogForm;
24
conf = StelApp::getInstance().getSettings();
25
core = StelApp::getInstance().getCore();
27
ndot = core->getCustomNDot();
28
year = core->getCustomYear();
29
coeff = core->getCustomEquationCoefficients();
32
CustomDeltaTEquationDialog::~CustomDeltaTEquationDialog()
38
void CustomDeltaTEquationDialog::retranslate()
42
ui->retranslateUi(dialog);
48
void CustomDeltaTEquationDialog::createDialogContent()
53
ui->labelNDot->setText(QString("%1:").arg(QChar(0x1E45)));
55
ui->lineEditCoefficientA->setText(QString("%1").arg(coeff[0]));
56
ui->lineEditCoefficientB->setText(QString("%1").arg(coeff[1]));
57
ui->lineEditCoefficientC->setText(QString("%1").arg(coeff[2]));
58
ui->lineEditYear->setText(QString("%1").arg(year));
59
ui->lineEditNDot->setText(QString("%1").arg(ndot));
62
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
63
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
65
connect(ui->lineEditNDot, SIGNAL(textEdited(const QString&)), this, SLOT(setNDot(const QString&)));
66
connect(ui->lineEditYear, SIGNAL(textEdited(const QString&)), this, SLOT(setYear(const QString&)));
67
connect(ui->lineEditCoefficientA, SIGNAL(textEdited(const QString&)), this, SLOT(setCoeffA(const QString&)));
68
connect(ui->lineEditCoefficientB, SIGNAL(textEdited(const QString&)), this, SLOT(setCoeffB(const QString&)));
69
connect(ui->lineEditCoefficientC, SIGNAL(textEdited(const QString&)), this, SLOT(setCoeffC(const QString&)));
73
void CustomDeltaTEquationDialog::setVisible(bool v)
75
StelDialog::setVisible(v);
78
void CustomDeltaTEquationDialog::saveSettings(void) const
80
conf->beginGroup("custom_time_correction");
82
conf->setValue("year", year);
83
conf->setValue("ndot", ndot);
84
conf->setValue("coefficients", QString("%1,%2,%3").arg(coeff[0]).arg(coeff[1]).arg(coeff[2]));
89
void CustomDeltaTEquationDialog::setNDot(const QString& v)
92
core->setCustomNDot(ndot);
96
void CustomDeltaTEquationDialog::setYear(const QString& v)
99
core->setCustomYear(year);
103
void CustomDeltaTEquationDialog::setCoeffA(const QString& v)
105
coeff[0] = v.toFloat();
106
core->setCustomEquationCoefficients(coeff);
110
void CustomDeltaTEquationDialog::setCoeffB(const QString& v)
112
coeff[1] = v.toFloat();
113
core->setCustomEquationCoefficients(coeff);
117
void CustomDeltaTEquationDialog::setCoeffC(const QString& v)
119
coeff[2] = v.toFloat();
120
core->setCustomEquationCoefficients(coeff);
124
void CustomDeltaTEquationDialog::setDescription() const
126
ui->stelWindowTitle->setText(q_("Custom equation for %1T").arg(QChar(0x0394)));
127
ui->labelDescription->setText(q_("A typical equation for calculation of %1T looks like:").arg(QChar(0x0394)));
128
ui->labelEquation->setText(QString("<strong>%1T = a + b%2u + c%3u%4,</strong>").arg(QChar(0x0394)).arg(QChar(0x00B7)).arg(QChar(0x00B7)).arg(QChar(0x00B2)));
129
ui->labelSubEquation->setText(QString("%1 <em>u = (%2 - y)/100</em>").arg(q_("where")).arg(q_("year")));