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

Stellarium / stellarium / 15291801018

28 May 2025 04:52AM UTC coverage: 11.931% (-0.02%) from 11.951%
15291801018

push

github

alex-w
Added new set of navigational stars (XIX century)

0 of 6 new or added lines in 2 files covered. (0.0%)

14124 existing lines in 74 files now uncovered.

14635 of 122664 relevant lines covered (11.93%)

18291.42 hits per line

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

0.0
/plugins/MosaicCamera/src/gui/MosaicCameraDialog.cpp
1
/*
2
 * Mosaic Camera Plug-in GUI
3
 *
4
 * Copyright (C) 2024 Josh Meyers
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, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
19
*/
20

21
#include "MosaicCamera.hpp"
22
#include "MosaicCameraDialog.hpp"
23
#include "ui_mosaicCameraDialog.h"
24

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

31
MosaicCameraDialog::MosaicCameraDialog()
×
32
        : StelDialog("MosaicCamera")
33
        , mc(nullptr)
×
34
{
35
        ui = new Ui_mosaicCameraDialog;
×
36
}
×
37

38
MosaicCameraDialog::~MosaicCameraDialog()
×
39
{
40
        delete ui;
×
41
}
×
42

43
QString MosaicCameraDialog::getCurrentCameraName() const
×
44
{
45
        return currentCameraName;
×
46
}
47

48
void MosaicCameraDialog::updateRA()
×
49
{
50
        mc->setRA(currentCameraName, ui->RASpinBox->valueDegrees());
×
51
}
×
52

53
void MosaicCameraDialog::updateDec()
×
54
{
55
        mc->setDec(currentCameraName, ui->DecSpinBox->valueDegrees());
×
56
}
×
57

58
void MosaicCameraDialog::updateRotation()
×
59
{
60
        mc->setRotation(currentCameraName, ui->RotationSpinBox->valueDegrees());
×
61
}
×
62

63
void MosaicCameraDialog::updateVisibility(bool visible)
×
64
{
65
        mc->setVisibility(currentCameraName, visible);
×
66
}
×
67

68
void MosaicCameraDialog::updateDialogFields()
×
69
{
70
        // Temporarily disconnect the signals to avoid triggering updates while setting values
71
        ui->RASpinBox->blockSignals(true);
×
72
        ui->DecSpinBox->blockSignals(true);
×
73
        ui->RotationSpinBox->blockSignals(true);
×
74
        ui->visibleCheckBox->blockSignals(true);
×
75
        ui->cameraListWidget->blockSignals(true);
×
76

77
        ui->RASpinBox->setDegrees(mc->getRA(currentCameraName));
×
78
        ui->DecSpinBox->setDegrees(mc->getDec(currentCameraName));
×
79
        ui->RotationSpinBox->setDegrees(mc->getRotation(currentCameraName));
×
80
        ui->visibleCheckBox->setChecked(mc->getVisibility(currentCameraName));
×
81
        QListWidgetItem* item = ui->cameraListWidget->findItems(currentCameraName, Qt::MatchExactly).first();
×
82
        int row = ui->cameraListWidget->row(item);
×
83
        ui->cameraListWidget->setCurrentRow(row);
×
84

85
        // Reconnect the signals
86
        ui->RASpinBox->blockSignals(false);
×
87
        ui->DecSpinBox->blockSignals(false);
×
88
        ui->RotationSpinBox->blockSignals(false);
×
89
        ui->visibleCheckBox->blockSignals(false);
×
90
        ui->cameraListWidget->blockSignals(false);
×
91

92
        // don't display anything if the camera name is empty
93
        if (currentCameraFullName.isEmpty() || currentCameraDescription.isEmpty() || currentCameraURLDetails.isEmpty())
×
94
        {
95
                ui->cameraTextBrowser->setHtml("");
×
96
                return;
×
97
        }
98
        QString html = QString("<p><strong>%1</strong></p>\n<p>%2 %3: <a href='%4'>%4</a>.</p>").arg(q_(currentCameraFullName), q_(currentCameraDescription), q_("See more at"), currentCameraURLDetails);
×
UNCOV
99
        ui->cameraTextBrowser->setHtml(html);
×
100
}
×
101

UNCOV
102
void MosaicCameraDialog::setRA(double ra)
×
103
{
UNCOV
104
        ui->RASpinBox->setDegrees(ra);
×
105
}
×
106

UNCOV
107
void MosaicCameraDialog::setDec(double dec)
×
108
{
UNCOV
109
        ui->DecSpinBox->setDegrees(dec);
×
110
}
×
111

UNCOV
112
void MosaicCameraDialog::setRotation(double rot)
×
113
{
UNCOV
114
        ui->RotationSpinBox->setDegrees(rot);
×
115
}
×
116

117
void MosaicCameraDialog::setVisibility(bool visible)
×
118
{
119
        ui->visibleCheckBox->setChecked(visible);
×
UNCOV
120
}
×
121

UNCOV
122
void MosaicCameraDialog::setCurrentCameraName(const QString& cameraName, const QString& cameraFullName, const QString& cameraDescription, const QString& cameraURLDetails)
×
123
{
124
        currentCameraName = cameraName;
×
UNCOV
125
        currentCameraFullName = cameraFullName;
×
126
        currentCameraDescription = cameraDescription;
×
UNCOV
127
        currentCameraURLDetails = cameraURLDetails;
×
128
        updateDialogFields();
×
UNCOV
129
}
×
130

131
void MosaicCameraDialog::retranslate()
×
132
{
133
        if (dialog)
×
134
        {
UNCOV
135
                ui->retranslateUi(dialog);
×
136
                setAboutHtml();
×
137
        }
138
}
×
139

140
void MosaicCameraDialog::onCameraSelectionChanged(const QString& cameraName)
×
141
{
142
        enableUIElements(true);
×
143
        currentCameraName = cameraName;
×
144
        mc->setCurrentCamera(cameraName);
×
UNCOV
145
        updateDialogFields();
×
146
}
×
147

148
void MosaicCameraDialog::enableUIElements(bool state)
×
149
{
UNCOV
150
        ui->RASpinBox->setEnabled(state);
×
151
        ui->DecSpinBox->setEnabled(state);
×
UNCOV
152
        ui->RotationSpinBox->setEnabled(state);
×
UNCOV
153
        ui->visibleCheckBox->setEnabled(state);
×
UNCOV
154
        ui->setMosaicToObjectButton->setEnabled(state);
×
155
        ui->setMosaicToViewButton->setEnabled(state);
×
156
        ui->setViewToCameraButton->setEnabled(state);
×
157
}
×
158

159
void MosaicCameraDialog::setCameraNames(const QStringList& cameraNames)
×
160
{
UNCOV
161
        ui->cameraListWidget->blockSignals(true);
×
UNCOV
162
        ui->cameraListWidget->clear();
×
163
        ui->cameraListWidget->addItems(cameraNames);
×
164
        if (cameraNames.size() > 0)
×
165
        {
UNCOV
166
                currentCameraName = cameraNames[0];
×
167
                mc->setCurrentCamera(currentCameraName);
×
168
        }
169
        else
170
        {
UNCOV
171
                currentCameraName = "";
×
172
        }
173
        ui->cameraListWidget->blockSignals(false);
×
174
        enableUIElements(false);
×
175
}
×
176

177
// Initialize the dialog widgets and connect the signals/slots
178
void MosaicCameraDialog::createDialogContent()
×
179
{
180
        mc = GETSTELMODULE(MosaicCamera);
×
181
        ui->setupUi(dialog);
×
182
        ui->tabs->setCurrentIndex(1);
×
183

184
        setCameraNames(mc->getCameraNames());
×
185

UNCOV
186
        connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
×
187

188
        // Kinetic scrolling
189
        kineticScrollingList << ui->aboutTextBrowser;
×
190
        StelGui* gui= dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
×
UNCOV
191
        if (gui)
×
192
        {
UNCOV
193
                enableKineticScrolling(gui->getFlagUseKineticScrolling());
×
194
                connect(gui, SIGNAL(flagUseKineticScrollingChanged(bool)), this, SLOT(enableKineticScrolling(bool)));
×
195
        }
196

197
        connect(ui->titleBar, &TitleBar::closeClicked, this, &StelDialog::close);
×
198
        connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
×
199

200
        // About tab
201
        setAboutHtml();
×
202
        if(gui!=nullptr)
×
203
                ui->aboutTextBrowser->document()->setDefaultStyleSheet(QString(gui->getStelStyle().htmlStyleSheet));
×
204

205
        // Cameras tab
206
        ui->RASpinBox->setDisplayFormat(AngleSpinBox::HMSSymbols);
×
207
        ui->RotationSpinBox->setDisplayFormat(AngleSpinBox::DecimalDeg);
×
208
        ui->DecSpinBox->setDisplayFormat(AngleSpinBox::DMSSymbols);
×
209
        ui->DecSpinBox->setPrefixType(AngleSpinBox::NormalPlus);
×
210
        ui->DecSpinBox->setMinimum(-90.0, true);
×
211
        ui->DecSpinBox->setMaximum(90.0, true);
×
212
        connect(ui->cameraListWidget, SIGNAL(currentTextChanged(const QString&)), this, SLOT(onCameraSelectionChanged(const QString&)));
×
UNCOV
213
        connect(ui->RASpinBox, SIGNAL(valueChanged()), this, SLOT(updateRA()));
×
214
        connect(ui->DecSpinBox, SIGNAL(valueChanged()), this, SLOT(updateDec()));
×
215
        connect(ui->RotationSpinBox, SIGNAL(valueChanged()), this, SLOT(updateRotation()));
×
UNCOV
216
        connect(ui->visibleCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateVisibility(bool)));
×
217
        connect(ui->setMosaicToObjectButton, SIGNAL(clicked()), mc, SLOT(setRADecToObject()));
×
218
        connect(ui->setViewToCameraButton, SIGNAL(clicked()), mc, SLOT(setViewToCamera()));
×
219
        connect(ui->setMosaicToViewButton, SIGNAL(clicked()), mc, SLOT(setRADecToView()));
×
220

221
        // General tab
222
        connectBoolProperty(ui->checkBoxShowButton, "MosaicCamera.showButton");
×
UNCOV
223
        connect(ui->pushButtonSaveSettings, SIGNAL(clicked()), mc, SLOT(saveSettings()));
×
UNCOV
224
        connect(ui->pushButtonRestoreDefaults, SIGNAL(clicked()), this, SLOT(restoreDefaults()));
×
UNCOV
225
}
×
226

UNCOV
227
void MosaicCameraDialog::setAboutHtml(void)
×
228
{
UNCOV
229
        QString html = "<html><head></head><body>";
×
UNCOV
230
        html += "<h2>" + q_("Mosaic Camera Plug-in") + "</h2><table class='layout' width=\"90%\">";
×
UNCOV
231
        html += "<tr width=\"30%\"><td><strong>" + q_("Version") + ":</strong></td><td>" + MOSAICCAMERA_PLUGIN_VERSION + "</td></tr>";
×
UNCOV
232
        html += "<tr><td><strong>" + q_("License") + ":</strong></td><td>" + MOSAICCAMERA_PLUGIN_LICENSE + "</td></tr>";
×
UNCOV
233
        html += "<tr><td><strong>" + q_("Author") + ":</strong></td><td>Josh Meyers &lt;jmeyers314@gmail.com&gt;</td></tr></table>";
×
UNCOV
234
        html += "<p>" + q_("The Mosaic Camera plugin overlays camera sensor boundaries on the sky. The position of an overlay is defined by its J2000 RA/Dec coordinates, and a camera rotation angle.") + "</p>";
×
UNCOV
235
        html += "</body></html>";
×
236

UNCOV
237
        StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
×
UNCOV
238
        if(gui!=nullptr)
×
239
        {
UNCOV
240
                QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet);
×
UNCOV
241
                ui->aboutTextBrowser->document()->setDefaultStyleSheet(htmlStyleSheet);
×
UNCOV
242
        }
×
243

UNCOV
244
        ui->aboutTextBrowser->setHtml(html);
×
UNCOV
245
}
×
246

UNCOV
247
void MosaicCameraDialog::restoreDefaults()
×
248
{
UNCOV
249
        if (!askConfirmation()) {
×
UNCOV
250
                qDebug() << "[MosaicCamera] Restore defaults cancelled.";
×
UNCOV
251
                return;
×
252
        }
UNCOV
253
        qDebug() << "[MosaicCamera] Restoring defaults...";
×
UNCOV
254
        mc->restoreDefaults();
×
UNCOV
255
        setCameraNames(mc->getCameraNames());
×
256
}
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