• 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
/plugins/EquationOfTime/src/gui/EquationOfTimeWindow.cpp
1
/*
2
 * Equation of Time plug-in for Stellarium
3
 *
4
 * Copyright (C) 2014 Alexander Wolf
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
 */
19

20
#include "EquationOfTime.hpp"
21
#include "EquationOfTimeWindow.hpp"
22
#include "ui_equationOfTimeWindow.h"
23

24
#include "StelApp.hpp"
25
#include "StelModule.hpp"
26
#include "StelModuleMgr.hpp"
27
#include "StelTranslator.hpp"
28

29
EquationOfTimeWindow::EquationOfTimeWindow()
×
30
        : StelDialog("EquationOfTime")
31
        , eq(Q_NULLPTR)
×
32
{
33
        ui = new Ui_equationOfTimeWindowForm();
×
34
}
×
35

36
EquationOfTimeWindow::~EquationOfTimeWindow()
×
37
{
38
        delete ui;
×
39
}
×
40

41
void EquationOfTimeWindow::retranslate()
×
42
{
43
        if (dialog)
×
44
        {
45
                ui->retranslateUi(dialog);
×
46
                setAboutHtml();
×
47
        }
48
}
×
49

50
void EquationOfTimeWindow::createDialogContent()
×
51
{
52
        eq = GETSTELMODULE(EquationOfTime);
×
53
        ui->setupUi(dialog);
×
54

55
        connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
×
56
        connect(ui->titleBar, &TitleBar::closeClicked, this, &StelDialog::close);
×
57
        connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
×
58

59
        ui->checkBoxEnableAtStartup->setChecked(eq->getFlagEnableAtStartup());
×
60
        connect(ui->checkBoxEnableAtStartup, SIGNAL(clicked(bool)), eq, SLOT(setFlagEnableAtStartup(bool)));
×
61

62
        ui->checkBoxInvertedValue->setChecked(eq->getFlagInvertedValue());
×
63
        connect(ui->checkBoxInvertedValue, SIGNAL(clicked(bool)), eq, SLOT(setFlagInvertedValue(bool)));
×
64

65
        ui->checkBoxMsFormat->setChecked(eq->getFlagMsFormat());
×
66
        connect(ui->checkBoxMsFormat, SIGNAL(clicked(bool)), eq, SLOT(setFlagMsFormat(bool)));
×
67

68
        ui->spinBoxFontSize->setValue(eq->getFontSize());
×
69
        connect(ui->spinBoxFontSize, SIGNAL(valueChanged(int)), eq, SLOT(setFontSize(int)));
×
70

71
        ui->checkBoxShowButton->setChecked(eq->getFlagShowEOTButton());
×
72
        connect(ui->checkBoxShowButton, SIGNAL(clicked(bool)), eq, SLOT(setFlagShowEOTButton(bool)));
×
73

74
        connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(saveEquationOfTimeSettings()));        
×
75
        connect(ui->pushButtonReset, SIGNAL(clicked()), this, SLOT(resetEquationOfTimeSettings()));
×
76

77
        connectColorButton(ui->textColorButton, "EquationOfTime.textColor", "EquationOfTime/text_color");
×
78

79
        setAboutHtml();
×
80
}
×
81

82
void EquationOfTimeWindow::setAboutHtml()
×
83
{
84
        QString html = "<html><head></head><body>";
×
85
        html += "<h2>" + q_("Equation of Time plug-in") + "</h2><table width=\"90%\">";
×
86
        html += "<tr width=\"30%\"><td><strong>" + q_("Version") + ":</strong></td><td>" + EQUATIONOFTIME_PLUGIN_VERSION + "</td></tr>";
×
87
        html += "<tr><td><strong>" + q_("License") + ":</strong></td><td>" + EQUATIONOFTIME_PLUGIN_LICENSE + "</td></tr>";
×
88
        html += "<tr><td><strong>" + q_("Author") + ":</strong></td><td>Alexander Wolf</td></tr>";
×
89
        html += "</table>";
×
90

91
        html += "<p>" + q_("This plugin shows the value of the equation of time.") + "</p>";
×
92
        html += StelApp::getInstance().getModuleMgr().getStandardSupportLinksInfo("Equation of Time plugin");
×
93
        html += "</body></html>";
×
94

95
        StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
×
96
        if(gui!=Q_NULLPTR)
×
97
        {
98
                QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet);
×
99
                ui->aboutTextBrowser->document()->setDefaultStyleSheet(htmlStyleSheet);
×
100
        }
×
101

102
        ui->aboutTextBrowser->setHtml(html);
×
103
}
×
104

105
void EquationOfTimeWindow::saveEquationOfTimeSettings()
×
106
{
107
        eq->saveSettingsToConfig();
×
108
}
×
109

110
void EquationOfTimeWindow::resetEquationOfTimeSettings()
×
111
{
112
        if (askConfirmation())
×
113
        {
114
                qDebug() << "[EquationOfTime] restore defaults...";
×
115
                eq->restoreDefaults();
×
116
        }
117
        else
118
                qDebug() << "[EquationOfTime] restore defaults is canceled...";
×
119
}
×
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