• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Stellarium / stellarium / 6685397774

29 Oct 2023 07:37PM UTC coverage: 11.735% (-0.002%) from 11.737%
6685397774

push

github

10110111
Deduplicate title bar implementation

131 of 131 new or added lines in 56 files covered. (100.0%)

14842 of 126472 relevant lines covered (11.74%)

21617.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/gui/CustomDeltaTEquationDialog.cpp
1
/*
2
 * Stellarium
3
 * Copyright (C) 2013 Alexander Wolf
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
17
*/
18

19
#include "CustomDeltaTEquationDialog.hpp"
20
#include "ui_customDeltaTEquationDialog.h"
21

22
#include "Dialog.hpp"
23
#include "StelApp.hpp"
24
#include "StelTranslator.hpp"
25
#include "StelObjectMgr.hpp"
26

27
CustomDeltaTEquationDialog::CustomDeltaTEquationDialog() : StelDialog("CustomDeltaTEquation")
×
28
{
29
        ui = new Ui_customDeltaTEquationDialogForm;
×
30
        conf = StelApp::getInstance().getSettings();
×
31
        core = StelApp::getInstance().getCore();
×
32

33
        ndot = core->getDeltaTCustomNDot();
×
34
        year = core->getDeltaTCustomYear();
×
35
        coeff = core->getDeltaTCustomEquationCoefficients();
×
36
}
×
37

38
CustomDeltaTEquationDialog::~CustomDeltaTEquationDialog()
×
39
{
40
        delete ui;
×
41
        ui=Q_NULLPTR;
×
42
}
×
43

44
void CustomDeltaTEquationDialog::retranslate()
×
45
{
46
        if (dialog)
×
47
        {
48
                ui->retranslateUi(dialog);
×
49
                setDescription();
×
50
        }
51
}
×
52

53
void CustomDeltaTEquationDialog::createDialogContent()
×
54
{
55
        ui->setupUi(dialog);
×
56
        setDescription();
×
57

58
        ui->labelNDot->setText(QString("n%1:").arg(QChar(0x2032)));
×
59

60
        ui->lineEditCoefficientA->setText(QString("%1").arg(coeff[0]));
×
61
        ui->lineEditCoefficientB->setText(QString("%1").arg(coeff[1]));
×
62
        ui->lineEditCoefficientC->setText(QString("%1").arg(coeff[2]));
×
63
        ui->lineEditYear->setText(QString("%1").arg(year));
×
64
        ui->lineEditNDot->setText(QString("%1").arg(ndot));
×
65

66
        //Signals and slots
67
        connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
×
68
        connect(ui->titleBar, &TitleBar::closeClicked, this, &StelDialog::close);
×
69
        connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
×
70

71
        connect(ui->lineEditNDot, SIGNAL(textEdited(const QString&)), this, SLOT(setNDot(const QString&)));
×
72
        connect(ui->lineEditYear, SIGNAL(textEdited(const QString&)), this, SLOT(setYear(const QString&)));
×
73
        connect(ui->lineEditCoefficientA, SIGNAL(textEdited(const QString&)), this, SLOT(setCoeffA(const QString&)));
×
74
        connect(ui->lineEditCoefficientB, SIGNAL(textEdited(const QString&)), this, SLOT(setCoeffB(const QString&)));
×
75
        connect(ui->lineEditCoefficientC, SIGNAL(textEdited(const QString&)), this, SLOT(setCoeffC(const QString&)));
×
76
}
×
77

78
void CustomDeltaTEquationDialog::saveSettings(void) const
×
79
{
80
        conf->beginGroup("custom_time_correction");
×
81

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]));
×
85

86
        conf->endGroup();
×
87
}
×
88

89
void CustomDeltaTEquationDialog::setNDot(const QString& v)
×
90
{
91
        ndot = v.toDouble();
×
92
        core->setDeltaTCustomNDot(ndot);
×
93
        saveSettings();
×
94
}
×
95

96
void CustomDeltaTEquationDialog::setYear(const QString& v)
×
97
{
98
        year = v.toDouble();
×
99
        core->setDeltaTCustomYear(year);
×
100
        saveSettings();
×
101
}
×
102

103
void CustomDeltaTEquationDialog::setCoeffA(const QString& v)
×
104
{
105
        coeff[0] = v.toDouble();
×
106
        core->setDeltaTCustomEquationCoefficients(coeff);
×
107
        saveSettings();
×
108
}
×
109

110
void CustomDeltaTEquationDialog::setCoeffB(const QString& v)
×
111
{
112
        coeff[1] = v.toDouble();
×
113
        core->setDeltaTCustomEquationCoefficients(coeff);
×
114
        saveSettings();
×
115
}
×
116

117
void CustomDeltaTEquationDialog::setCoeffC(const QString& v)
×
118
{
119
        coeff[2] = v.toDouble();
×
120
        core->setDeltaTCustomEquationCoefficients(coeff);
×
121
        saveSettings();
×
122
}
×
123

124
void CustomDeltaTEquationDialog::setDescription() const
×
125
{
126
        ui->titleBar->setTitle(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>&Delta;T = a + b&middot;u + c&middot;u<sup>2</sup>,</strong>"));
×
129
        ui->labelSubEquation->setText(QString("%1 <em>u = (%2 - y)/100</em>").arg(q_("where"), q_("year")));
×
130
        QString tooltip = q_("Secular acceleration of the Moon");
×
131
        ui->labelNDot->setToolTip(tooltip);
×
132
        ui->lineEditNDot->setToolTip(tooltip);
×
133
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc