• 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/Calendars/src/gui/CalendarsDialog.cpp
1
/*
2
 * Calendars plug-in for Stellarium
3
 *
4
 * Copyright (C) 2020 Georg Zotti
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 <QRegularExpression>
21

22
#include "Calendars.hpp"
23
#include "CalendarsDialog.hpp"
24
#include "ui_calendarsDialog.h"
25

26
#include "StelApp.hpp"
27
#include "StelGui.hpp"
28
#include "StelModule.hpp"
29
#include "StelModuleMgr.hpp"
30
#include "StelTranslator.hpp"
31

32
// We only need to include calendars when we have to call special functions.
33
#include "JulianCalendar.hpp"
34
#include "RevisedJulianCalendar.hpp"
35
#include "GregorianCalendar.hpp"
36
//#include "MayaHaabCalendar.hpp"
37
//#include "MayaTzolkinCalendar.hpp"
38
//#include "AztecXihuitlCalendar.hpp"
39
//#include "AztecTonalpohualliCalendar.hpp"
40

41

42
CalendarsDialog::CalendarsDialog()
×
43
        : StelDialog("Calendars")
44
        , cal(nullptr)
×
45
{
46
        ui = new Ui_calendarsDialog();
×
47
}
×
48

49
CalendarsDialog::~CalendarsDialog()
×
50
{
51
        delete ui; ui=nullptr;
×
52
}
×
53

54
void CalendarsDialog::retranslate()
×
55
{
56
        if (dialog)
×
57
        {
58
                ui->retranslateUi(dialog);
×
59
                setAboutHtml();
×
60
        }
61
}
×
62

63
void CalendarsDialog::createDialogContent()
×
64
{
65
        cal = GETSTELMODULE(Calendars);
×
66
        ui->setupUi(dialog);
×
67

68
        // Kinetic scrolling
69
        kineticScrollingList << ui->aboutTextBrowser;
×
70
        StelGui* gui= static_cast<StelGui*>(StelApp::getInstance().getGui());
×
71
        enableKineticScrolling(gui->getFlagUseKineticScrolling());
×
72
        connect(gui, SIGNAL(flagUseKineticScrollingChanged(bool)), this, SLOT(enableKineticScrolling(bool)));
×
73

74
        connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
×
75
        connect(ui->titleBar, &TitleBar::closeClicked, this, &StelDialog::close);
×
76
        connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
×
77

78
        connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(resetCalendarsSettings()));
×
79
        setAboutHtml();
×
80

81
#ifdef STELLARIUM_RELEASE_BUILD
82
        ui->labelRDvalue->hide();
83
        ui->labelRD->hide();
84
        // DISABLE handling Chinese etc for now, TBD!
85
        ui->tabs->removeTab(2);
86
#else
87
        connect(cal->getCal("Julian"), &JulianCalendar::jdChanged, this, [=](double jd){ui->labelRDvalue->setText(QString::number(Calendar::fixedFromJD(jd, true)));});
×
88
#endif
89

90
        // MAKE SURE to connect each calendar's partsChanged to a respective populate... method here.
91
        connect(cal->getCal("Julian"),             SIGNAL(partsChanged(QVector<int>)), this, SLOT(populateJulianParts(QVector<int>)));
×
92
        connect(cal->getCal("RevisedJulian"),      SIGNAL(partsChanged(QVector<int>)), this, SLOT(populateRevisedJulianParts(QVector<int>)));
×
93
        connect(cal->getCal("Gregorian"),          SIGNAL(partsChanged(QVector<int>)), this, SLOT(populateGregorianParts(QVector<int>)));
×
94
        connect(cal->getCal("ISO"),                SIGNAL(partsChanged(QVector<int>)), this, SLOT(populateISOParts(QVector<int>)));
×
95
        connect(cal->getCal("MayaLongCount"),      SIGNAL(partsChanged(QVector<int>)), this, SLOT(populateMayaLongCountParts(QVector<int>)));
×
96
        connect(cal->getCal("MayaHaab"),           SIGNAL(partsChanged(QVector<int>)), this, SLOT(populateMayaHaabParts(QVector<int>)));
×
97
        connect(cal->getCal("MayaTzolkin"),        SIGNAL(partsChanged(QVector<int>)), this, SLOT(populateMayaTzolkinParts(QVector<int>)));
×
98
        connect(cal->getCal("AztecXihuitl"),       SIGNAL(partsChanged(QVector<int>)), this, SLOT(populateAztecXihuitlParts(QVector<int>)));
×
99
        connect(cal->getCal("AztecTonalpohualli"), SIGNAL(partsChanged(QVector<int>)), this, SLOT(populateAztecTonalpohualliParts(QVector<int>)));
×
100
        //connect(cal->getCal("Chinese"), SIGNAL(partsChanged(QVector<int>)), this, SLOT(populateChineseParts(QVector<int>)));
101

102
        connectBoolProperty(ui->julianCheckBox,             "Calendars.flagShowJulian");
×
103
        connectBoolProperty(ui->revisedJulianCheckBox,      "Calendars.flagShowRevisedJulian");
×
104
        connectBoolProperty(ui->gregorianCheckBox,          "Calendars.flagShowGregorian");
×
105
        connectBoolProperty(ui->isoCheckBox,                "Calendars.flagShowISO");
×
106
        connectBoolProperty(ui->romanCheckBox,              "Calendars.flagShowRoman");
×
107
        connectBoolProperty(ui->olympicCheckBox,            "Calendars.flagShowOlympic");
×
108
        connectBoolProperty(ui->egyptianCheckBox,           "Calendars.flagShowEgyptian");
×
109
        connectBoolProperty(ui->armenianCheckBox,           "Calendars.flagShowArmenian");
×
110
        connectBoolProperty(ui->zoroastrianCheckBox,        "Calendars.flagShowZoroastrian");
×
111
        connectBoolProperty(ui->copticCheckBox,             "Calendars.flagShowCoptic");
×
112
        connectBoolProperty(ui->ethiopicCheckBox,           "Calendars.flagShowEthiopic");
×
113
        connectBoolProperty(ui->icelandicCheckBox,          "Calendars.flagShowIcelandic");
×
114
        connectBoolProperty(ui->chineseCheckBox,            "Calendars.flagShowChinese");
×
115
        connectBoolProperty(ui->japaneseCheckBox,           "Calendars.flagShowJapanese");
×
116
        connectBoolProperty(ui->koreanCheckBox,             "Calendars.flagShowKorean");
×
117
        connectBoolProperty(ui->vietnameseCheckBox,         "Calendars.flagShowVietnamese");
×
118
        connectBoolProperty(ui->islamicCheckBox,            "Calendars.flagShowIslamic");
×
119
        connectBoolProperty(ui->hebrewCheckBox,             "Calendars.flagShowHebrew");
×
120
        connectBoolProperty(ui->oldHinduSolarCheckBox,      "Calendars.flagShowOldHinduSolar");
×
121
        connectBoolProperty(ui->oldHinduLunarCheckBox,      "Calendars.flagShowOldHinduLunar");
×
122
        connectBoolProperty(ui->newHinduSolarCheckBox,      "Calendars.flagShowNewHinduSolar");
×
123
        connectBoolProperty(ui->newHinduLunarCheckBox,      "Calendars.flagShowNewHinduLunar");
×
124
        connectBoolProperty(ui->astroHinduSolarCheckBox,    "Calendars.flagShowAstroHinduSolar");
×
125
        connectBoolProperty(ui->astroHinduLunarCheckBox,    "Calendars.flagShowAstroHinduLunar");
×
126
        connectBoolProperty(ui->tibetanCheckBox,            "Calendars.flagShowTibetan");
×
127
        connectBoolProperty(ui->mayaLCCheckBox,             "Calendars.flagShowMayaLongCount");
×
128
        connectBoolProperty(ui->mayaHaabCheckBox,           "Calendars.flagShowMayaHaab");
×
129
        connectBoolProperty(ui->mayaTzolkinCheckBox,        "Calendars.flagShowMayaTzolkin");
×
130
        connectBoolProperty(ui->aztecXihuitlCheckBox,       "Calendars.flagShowAztecXihuitl");
×
131
        connectBoolProperty(ui->aztecTonalpohualliCheckBox, "Calendars.flagShowAztecTonalpohualli");
×
132
        connectBoolProperty(ui->balineseCheckBox,           "Calendars.flagShowBalinese");
×
133
        connectBoolProperty(ui->frenchAstronomicalCheckBox, "Calendars.flagShowFrenchAstronomical");
×
134
        connectBoolProperty(ui->frenchArithmeticCheckBox,   "Calendars.flagShowFrenchArithmetic");
×
135
        connectBoolProperty(ui->persianArithmeticCheckBox,  "Calendars.flagShowPersianArithmetic");
×
136
        connectBoolProperty(ui->persianAstronomicalCheckBox,"Calendars.flagShowPersianAstronomical");
×
137
        connectBoolProperty(ui->bahaiArithmeticCheckBox,    "Calendars.flagShowBahaiArithmetic");
×
138
        connectBoolProperty(ui->bahaiAstronomicalCheckBox,  "Calendars.flagShowBahaiAstronomical");
×
139

140
        connectBoolProperty(ui->overrideTextColorCheckBox,  "Calendars.flagTextColorOverride");
×
141
        connectColorButton(ui->textcolorToolButton,         "Calendars.textColor", "Calendars/text_color");
×
142

143
        // MAKE SURE to connect all part edit elements respective ...Changed() method here.
144
        connect(ui->julianYearSpinBox,                SIGNAL(valueChanged(int)), this, SLOT(julianChanged()));
×
145
        connect(ui->julianMonthSpinBox,                SIGNAL(valueChanged(int)), this, SLOT(julianChanged()));
×
146
        connect(ui->julianDaySpinBox,                SIGNAL(valueChanged(int)), this, SLOT(julianChanged()));
×
147
        connect(ui->revisedJulianYearSpinBox,        SIGNAL(valueChanged(int)), this, SLOT(revisedJulianChanged()));
×
148
        connect(ui->revisedJulianMonthSpinBox,        SIGNAL(valueChanged(int)), this, SLOT(revisedJulianChanged()));
×
149
        connect(ui->revisedJulianDaySpinBox,        SIGNAL(valueChanged(int)), this, SLOT(revisedJulianChanged()));
×
150
        connect(ui->gregorianYearSpinBox,        SIGNAL(valueChanged(int)), this, SLOT(gregorianChanged()));
×
151
        connect(ui->gregorianMonthSpinBox,        SIGNAL(valueChanged(int)), this, SLOT(gregorianChanged()));
×
152
        connect(ui->gregorianDaySpinBox,        SIGNAL(valueChanged(int)), this, SLOT(gregorianChanged()));
×
153
        connect(ui->isoYearSpinBox,                SIGNAL(valueChanged(int)), this, SLOT(isoChanged()));
×
154
        connect(ui->isoWeekSpinBox,                SIGNAL(valueChanged(int)), this, SLOT(isoChanged()));
×
155
        connect(ui->isoDaySpinBox,                SIGNAL(valueChanged(int)), this, SLOT(isoChanged()));
×
156
        connect(ui->baktunSpinBox,                SIGNAL(valueChanged(int)), this, SLOT(mayaLongCountChanged()));
×
157
        connect(ui->katunSpinBox,                SIGNAL(valueChanged(int)), this, SLOT(mayaLongCountChanged()));
×
158
        connect(ui->tunSpinBox,                        SIGNAL(valueChanged(int)), this, SLOT(mayaLongCountChanged()));
×
159
        connect(ui->uinalSpinBox,                SIGNAL(valueChanged(int)), this, SLOT(mayaLongCountChanged()));
×
160
        connect(ui->kinSpinBox,                        SIGNAL(valueChanged(int)), this, SLOT(mayaLongCountChanged()));
×
161
        // TODO: Indirect handling of Haab/Tzolkin and Xihuitl/Tonalpohualli, with going back and forth to dates set in the GUI elements.
162
        //connect(ui->haabMonthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(mayaHaabChanged()));
163
        //connect(ui->haabDaySpinBox,   SIGNAL(valueChanged(int)), this, SLOT(mayaHaabChanged()));
164
        //connect(ui->tzolkinNumberSpinBox, SIGNAL(valueChanged(int)), this, SLOT(mayaTzolkinChanged()));
165
        //connect(ui->tzolkinNameSpinBox,   SIGNAL(valueChanged(int)), this, SLOT(mayaTzolkinChanged()));
166
        // In the first version, only switch full Tzolkin/Haab/Xihuitl/Tonalpohualli cycles. Later versions should allow configuring a date combination and trigger previous/next.
167
        StelCore *core=StelApp::getInstance().getCore();
×
168
        connect(ui->previousHaabButton,          &QPushButton::clicked, this, [=](){ core->addSolarDays(-365.);});
×
169
        connect(ui->nextHaabButton,              &QPushButton::clicked, this, [=](){ core->addSolarDays(365.);});
×
170
        connect(ui->previousTzolkinButton,       &QPushButton::clicked, this, [=](){ core->addSolarDays(-260.);});
×
171
        connect(ui->nextTzolkinButton,           &QPushButton::clicked, this, [=](){ core->addSolarDays(260.);});
×
172
        connect(ui->previousXihuitlButton,       &QPushButton::clicked, this, [=](){ core->addSolarDays(-365.);});
×
173
        connect(ui->nextXihuitlButton,           &QPushButton::clicked, this, [=](){ core->addSolarDays(365.);});
×
174
        connect(ui->previousTonalpohualliButton, &QPushButton::clicked, this, [=](){ core->addSolarDays(-260.);});
×
175
        connect(ui->nextTonalpohualliButton,     &QPushButton::clicked, this, [=](){ core->addSolarDays(260.);});
×
176
}
×
177

178
void CalendarsDialog::setAboutHtml(void)
×
179
{
180
        // Regexp to replace {text} with an HTML link.
181
        static const QRegularExpression a_rx("[{]([^{]*)[}]");
×
182

183
        QString html = "<html><head></head><body>";
×
184
        html += "<h2>" + q_("Calendars Plug-in") + "</h2><table width=\"90%\">";
×
185
        html += "<tr width=\"30%\"><td><strong>" + q_("Version") + ":</strong></td><td>" + CALENDARS_PLUGIN_VERSION + "</td></tr>";
×
186
        html += "<tr><td><strong>" + q_("License") + ":</strong></td><td>" + CALENDARS_PLUGIN_LICENSE + "</td></tr>";
×
187
        html += "<tr><td><strong>" + q_("Author") + ":</strong></td><td>Georg Zotti</td></tr>";
×
188
        //html += "<tr><td><strong>" + q_("Contributors") + ":</strong></td><td> List with br separators </td></tr>";
189
        html += "</table>";
×
190

191
        html += "<p>" + q_("The Calendars plugin provides an interface to various calendars used around the world.") + "</p>";
×
192
        html += "<ul><li>" + q_("Julian Calendar") + "</li>";
×
193
        html += "<li>" + q_("Gregorian Calendar") + "</li>";
×
194
        html += "<li>" + q_("Revised Julian Calendar (Milankovi&#x107;)") + "</li>";
×
195
        html += "<li>" + q_("ISO Weeks") + "</li>";
×
196
        html += "<li>" + q_("Icelandic calendar") + "</li>";
×
197
        html += "<li>" + q_("Roman (Julian) calendar") + "</li>";
×
198
        html += "<li>" + q_("Olympiad calendar") + "</li>";
×
199
        html += "<li>" + q_("Egyptian calendar") + "</li>";
×
200
        html += "<li>" + q_("Armenian calendar") + "</li>";
×
201
        html += "<li>" + q_("Zoroastrian calendar") + "</li>";
×
202
        html += "<li>" + q_("Coptic calendar") + "</li>";
×
203
        html += "<li>" + q_("Ethiopic calendar") + "</li>";
×
204

205
        html += "<li>" + q_("Islamic Calendar (algorithmic)") + "</li>";
×
206
        html += "<li>" + q_("Hebrew Calendar") + "</li>";
×
207
        html += "<li>" + q_("French Revolution calendar (astronomical version of 1793)") + "</li>";
×
208
        html += "<li>" + q_("French Revolution calendar (arithmetic version of 1795)") + "</li>";
×
209
        html += "<li>" + q_("Persian calendar (arithmetic version)") + "</li>";
×
210
        html += "<li>" + q_("Persian calendar (astronomical version)") + "</li>";
×
211
        html += "<li>" + q_("Bahá’í calendar (arithmetic version)") + "</li>";
×
212
        html += "<li>" + q_("Bahá’í calendar (astronomical version)") + "</li>";
×
213

214
        html += "<li>" + q_("Old Hindu Solar and Lunar calendars") + "</li>";
×
215
        html += "<li>" + q_("New Hindu Solar and Lunar calendars") + "</li>";
×
216
        html += "<li>" + q_("Astronomically 'accurate' Hindu Solar and Lunar calendars") + "</li>";
×
217
        html += "<li>" + q_("Tibetan (Phuglugs, Phug-pa, K&#x101;lacakra) calendar") + "</li>";
×
218
        html += "<li>" + q_("Chinese calendar") + "</li>";
×
219
        html += "<li>" + q_("Japanese calendar") + "</li>";
×
220
        html += "<li>" + q_("Korean calendar") + "</li>";
×
221
        html += "<li>" + q_("Vietnamese calendar") + "</li>";
×
222
        html += "<li>" + q_("Balinese Pawukon calendar") + "</li>";
×
223
        html += "<li>" + q_("Maya calendars") + "</li>";
×
224
        html += "<li>" + q_("Aztec calendars") + "</li>";
×
225
        html += "</ul>";
×
226
        html += "<p>" + q_("The plugin is still under development. Please cross-check results and report errors.") + "</p>";
×
227
        html += "<p>" + q_("For some calendars, we welcome proper formatting suggestions by actual users.") + "</p>";
×
228

229
        html += "<h3>" + q_("Publications") + "</h3>";
×
230
        html += "<p>"  + q_("If you use this plugin in your publications, please cite:") + "</p>";
×
231
        html += "<p><ul>";
×
232
        html += "<li>" + QString("{Georg Zotti, Susanne M. Hoffmann, Alexander Wolf, Fabien Chéreau, Guillaume Chéreau: The simulated sky: Stellarium for cultural astronomy research.} Journal for Skyscape Archaeology, 6.2, 2021, pp. 221-258.")
×
233
                        .toHtmlEscaped().replace(a_rx, "<a href=\"https://doi.org/10.1558/jsa.17822\">\\1</a>") + "</li>";
×
234
        html += "</ul></p>";
×
235

236
        html += "<h3>" + q_("References") + "</h3>";
×
237
        html += "<p>"  + q_("This plugin is based on:");
×
238
        html += "<ul>";
×
239
        html += "<li>" + QString("{Edward M. Reingold, Nachum Dershowitz: Calendrical Calculations.} The Ultimate Edition. Cambridge University Press 2018.")
×
240
                        .toHtmlEscaped().replace(a_rx, "<a href=\"https://doi.org/10.1017/9781107415058\">\\1</a>") + "</li>";
×
241
        html += "</ul></p>";
×
242

243
        html += StelApp::getInstance().getModuleMgr().getStandardSupportLinksInfo("Calendars plugin");
×
244
        html += "</body></html>";
×
245

246
        StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
×
247
        if(gui)
×
248
        {
249
                QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet);
×
250
                ui->aboutTextBrowser->document()->setDefaultStyleSheet(htmlStyleSheet);
×
251
        }
×
252
        ui->aboutTextBrowser->setHtml(html);
×
253
}
×
254

255
void CalendarsDialog::resetCalendarsSettings()
×
256
{
257
        if (askConfirmation())
×
258
        {
259
                qDebug() << "[Calendars] restore defaults...";
×
260
                cal->restoreDefaultSettings();
×
261
        }
262
        else
263
                qDebug() << "[Calendars] restore defaults cancelled.";
×
264
}
×
265

266
void CalendarsDialog::populateJulianParts(QVector<int> parts)
×
267
{
268
        ui->julianYearSpinBox->setValue(parts.at(0));
×
269
        ui->julianMonthSpinBox->setValue(parts.at(1));
×
270
        ui->julianDaySpinBox->setValue(parts.at(2));
×
271

272
        // If the GUI wants to show other related data, we can find the sender. (nullptr when this slot is called directly!)
273
        JulianCalendar *jul=dynamic_cast<JulianCalendar*>(sender());
×
274
        if (jul)
×
275
                ui->julianWeekdayLineEdit->setText(jul->weekday(jul->getJD()));
×
276
}
×
277

278
void CalendarsDialog::populateRevisedJulianParts(QVector<int> parts)
×
279
{
280
        ui->revisedJulianYearSpinBox->setValue(parts.at(0));
×
281
        ui->revisedJulianMonthSpinBox->setValue(parts.at(1));
×
282
        ui->revisedJulianDaySpinBox->setValue(parts.at(2));
×
283

284
        // If the GUI wants to show other related data, we can find the sender. (nullptr when this slot is called directly!)
285
        RevisedJulianCalendar *rjul=dynamic_cast<RevisedJulianCalendar*>(sender());
×
286
        if (rjul)
×
287
                ui->revisedJulianWeekdayLineEdit->setText(rjul->weekday(rjul->getJD()));
×
288
}
×
289

290
void CalendarsDialog::populateGregorianParts(QVector<int> parts)
×
291
{
292
        ui->gregorianYearSpinBox->setValue(parts.at(0));
×
293
        ui->gregorianMonthSpinBox->setValue(parts.at(1));
×
294
        ui->gregorianDaySpinBox->setValue(parts.at(2));
×
295

296
        GregorianCalendar *greg=dynamic_cast<GregorianCalendar*>(sender());
×
297
        if (greg)
×
298
                ui->gregorianWeekdayLineEdit->setText(greg->weekday(greg->getJD()));
×
299
}
×
300

301
void CalendarsDialog::populateISOParts(QVector<int> parts)
×
302
{
303
        ui->isoYearSpinBox->setValue(parts.at(0));
×
304
        ui->isoWeekSpinBox->setValue(parts.at(1));
×
305
        ui->isoDaySpinBox->setValue(parts.at(2));
×
306
}
×
307

308
void CalendarsDialog::populateMayaLongCountParts(QVector<int> parts)
×
309
{
310
        ui->baktunSpinBox->setValue(parts.at(0));
×
311
        ui->katunSpinBox->setValue(parts.at(1));
×
312
        ui->tunSpinBox->setValue(parts.at(2));
×
313
        ui->uinalSpinBox->setValue(parts.at(3));
×
314
        ui->kinSpinBox->setValue(parts.at(4));
×
315
}
×
316

317
void CalendarsDialog::populateMayaHaabParts(QVector<int> parts)
×
318
{
319
        ui->haabMonthSpinBox->setValue(parts.at(0));
×
320
        ui->haabDaySpinBox->setValue(parts.at(1));
×
321
        Calendar *haab=dynamic_cast<Calendar*>(sender());
×
322
        if (haab)
×
323
                ui->haabLineEdit->setText(haab->getFormattedDateString());
×
324
}
×
325

326
void CalendarsDialog::populateMayaTzolkinParts(QVector<int> parts)
×
327
{
328
        ui->tzolkinNumberSpinBox->setValue(parts.at(0));
×
329
        ui->tzolkinNameSpinBox->setValue(parts.at(1));
×
330
        Calendar *tzolkin=dynamic_cast<Calendar*>(sender());
×
331
        if (tzolkin)
×
332
                ui->tzolkinLineEdit->setText(tzolkin->getFormattedDateString());
×
333
}
×
334

335
void CalendarsDialog::populateAztecXihuitlParts(QVector<int> parts)
×
336
{
337
        ui->xihuitlMonthSpinBox->setValue(parts.at(0));
×
338
        ui->xihuitlDaySpinBox->setValue(parts.at(1));
×
339
        Calendar *xihuitl=dynamic_cast<Calendar*>(sender());
×
340
        if (xihuitl)
×
341
                ui->xihuitlLineEdit->setText(xihuitl->getFormattedDateString());
×
342
}
×
343

344
void CalendarsDialog::populateAztecTonalpohualliParts(QVector<int> parts)
×
345
{
346
        ui->tonalpohualliNumberSpinBox->setValue(parts.at(0));
×
347
        ui->tonalpohualliNameSpinBox->setValue(parts.at(1));
×
348
        Calendar *tonalpohualli=dynamic_cast<Calendar*>(sender());
×
349
        if (tonalpohualli)
×
350
                ui->tonalpohualliLineEdit->setText(tonalpohualli->getFormattedDateString());
×
351
}
×
352

353
/*
354
 * These slots set the calendar from the associated GUI elements
355
 */
356

357
void CalendarsDialog::julianChanged()
×
358
{
359
        cal->getCal("Julian")->setDate({ui->julianYearSpinBox->value(),
×
360
                                        ui->julianMonthSpinBox->value(),
×
361
                                        ui->julianDaySpinBox->value()});
×
362
}
×
363

364
void CalendarsDialog::revisedJulianChanged()
×
365
{
366
        cal->getCal("RevisedJulian")->setDate({ui->revisedJulianYearSpinBox->value(),
×
367
                                               ui->revisedJulianMonthSpinBox->value(),
×
368
                                               ui->revisedJulianDaySpinBox->value()});
×
369
}
×
370

371
void CalendarsDialog::gregorianChanged()
×
372
{
373
        cal->getCal("Gregorian")->setDate({ui->gregorianYearSpinBox->value(),
×
374
                                           ui->gregorianMonthSpinBox->value(),
×
375
                                           ui->gregorianDaySpinBox->value()});
×
376
}
×
377

378
void CalendarsDialog::isoChanged()
×
379
{
380
        // TODO proper handling of ISO weekday combo box.
381
        cal->getCal("ISO")->setDate({ui->isoYearSpinBox->value(),
×
382
                                     ui->isoWeekSpinBox->value(),
×
383
                                     ui->isoDaySpinBox->value()});
×
384
}
×
385

386
void CalendarsDialog::mayaLongCountChanged()
×
387
{
388
        cal->getCal("MayaLongCount")->setDate({ui->baktunSpinBox->value(),
×
389
                                               ui->katunSpinBox->value(),
×
390
                                               ui->tunSpinBox->value(),
×
391
                                               ui->uinalSpinBox->value(),
×
392
                                               ui->kinSpinBox->value()});
×
393
}
×
394

395
void CalendarsDialog::mayaHaabChanged()
×
396
{
397
        cal->getCal("MayaHaab")->setDate({ui->haabMonthSpinBox->value(),
×
398
                                          ui->haabDaySpinBox->value()});
×
399
}
×
400

401
void CalendarsDialog::mayaTzolkinChanged()
×
402
{
403
        cal->getCal("MayaTzolkin")->setDate({ui->tzolkinNumberSpinBox->value(),
×
404
                                             ui->tzolkinNameSpinBox->value()});
×
405
}
×
406

407
void CalendarsDialog::aztecXihuitlChanged()
×
408
{
409
        cal->getCal("AztecXihuitl")->setDate({ui->xihuitlMonthSpinBox->value(),
×
410
                                              ui->xihuitlDaySpinBox->value()});
×
411
}
×
412

413
void CalendarsDialog::aztecTonalpohualliChanged()
×
414
{
415
        cal->getCal("AztecTonalpohualli")->setDate({ui->tonalpohualliNumberSpinBox->value(),
×
416
                                                    ui->tonalpohualliNameSpinBox->value()});
×
417
}
×
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