• 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/TelescopeControl/src/gui/TelescopeConfigurationDialog.cpp
1
/*
2
 * Stellarium TelescopeControl Plug-in
3
 *
4
 * Copyright (C) 2009-2011 Bogdan Marinov (this file)
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 "TelescopeConfigurationDialog.hpp"
22
#include "Dialog.hpp"
23
#include "StelApp.hpp"
24
#include "StelModuleMgr.hpp"
25
#include "StelTranslator.hpp"
26
#include "TelescopeControl.hpp"
27
#include "ui_telescopeConfigurationDialog.h"
28

29
#ifdef Q_OS_WIN
30
        #include "../common/ASCOMSupport.hpp"
31
#endif
32

33
#include <QCompleter>
34
#include <QDebug>
35
#include <QDir>
36
#include <QFile>
37
#include <QFrame>
38
#include <QTimer>
39
#include <QRegularExpression>
40
#include <QtSerialPort/QSerialPortInfo>
41

42
TelescopeConfigurationDialog::TelescopeConfigurationDialog()
×
43
        : StelDialog("TelescopeControlConfiguration"), configuredSlot(0)
×
44
{
45
        ui = new Ui_telescopeConfigurationDialog();
×
46

47
        telescopeManager = GETSTELMODULE(TelescopeControl);
×
48

49
        telescopeNameValidator = new QRegularExpressionValidator(QRegularExpression("[^:\"]+"), this); // Test the update for JSON
×
50
        hostNameValidator =
×
51
          new QRegularExpressionValidator(QRegularExpression("[a-zA-Z0-9\\-\\.]+"), this); // TODO: Write a proper host/IP regexp?
×
52
        circleListValidator = new QRegularExpressionValidator(QRegularExpression("[0-9,\\.\\s]+"), this);
×
53
#ifdef Q_OS_WIN
54
        serialPortValidator = new QRegularExpressionValidator(QRegularExpression("COM[0-9]+"), this);
55
#else
56
        serialPortValidator = new QRegularExpressionValidator(QRegularExpression("/.*"), this);
×
57
#endif
58
}
×
59

60
TelescopeConfigurationDialog::~TelescopeConfigurationDialog()
×
61
{
62
        delete ui;
×
63
        delete telescopeNameValidator;
×
64
        delete hostNameValidator;
×
65
        delete circleListValidator;
×
66
        delete serialPortValidator;
×
67
}
×
68

69
QStringList* TelescopeConfigurationDialog::listSerialPorts()
×
70
{
71
        // list real serial ports
72
        QStringList* plist = new QStringList();
×
73
        for (const auto& serialPortInfo : QSerialPortInfo::availablePorts())
×
74
        {
75
#ifdef Q_OS_WIN
76
                plist->append(serialPortInfo.portName()); // Use COM1 in the GUI instead \\.\COM1 naming
77
#else
78
                plist->append(serialPortInfo.systemLocation());
×
79
#endif
80
                qDebug() << "[TelescopeControl] port name:" << serialPortInfo.portName()
×
81
                                 << "; vendor identifier:" << serialPortInfo.vendorIdentifier()
×
82
                                 << "; product identifier:" << serialPortInfo.productIdentifier();
×
83
        }
×
84

85
// on linux find some virtual ports
86
#ifdef Q_OS_LINUX
87
        QStringList filters;
×
88
        filters << "ttyNET*"
×
89
                        << "ttynet*"
×
90
                        << "Telescope*";
×
91
        // look in /dev/*
92
        QDir dev("/dev");
×
93
        dev.setFilter(QDir::System);
×
94
        dev.setSorting(QDir::Reversed);
×
95
        dev.setNameFilters(filters);
×
96
        QFileInfoList list = dev.entryInfoList();
×
97
        for (int i = 0; i < list.size(); i++)
×
98
        {
99
                QFileInfo fileInfo = list.at(i);
×
100
                plist->append(fileInfo.absoluteFilePath());
×
101
        }
×
102
        // look in /tmp/* for non-root virtual ports (append ttyS8 and ttyUSB*)
103
        filters << "ttyS*"
×
104
                        << "ttyUSB*";
×
105
        QDir tmp("/tmp");
×
106
        tmp.setFilter(QDir::System);
×
107
        tmp.setSorting(QDir::Reversed);
×
108
        tmp.setNameFilters(filters);
×
109
        list = tmp.entryInfoList();
×
110
        for (int i = 0; i < list.size(); i++)
×
111
        {
112
                QFileInfo fileInfo = list.at(i);
×
113
                plist->append(fileInfo.absoluteFilePath());
×
114
        }
×
115
#endif
116

117
        return plist;
×
118
}
×
119

120
void TelescopeConfigurationDialog::retranslate()
×
121
{
122
        if (dialog)
×
123
        {
124
                ui->retranslateUi(dialog);
×
125
                populateToolTips();
×
126
        }
127
}
×
128

129
// Initialize the dialog widgets and connect the signals/slots
130
void TelescopeConfigurationDialog::createDialogContent()
×
131
{
132
        ui->setupUi(dialog);
×
133

134
        // ASCOM Telescope client widget needs to be dynamically added in order to make use of preprocessors to exclude for non-windows
135
        #ifdef Q_OS_WIN
136
        ascomWidget = new TelescopeClientASCOMWidget(ui->scrollAreaWidgetContents);
137
        ui->ASCOMLayout->addWidget(ascomWidget);
138

139
        if (!ASCOMSupport::isASCOMSupported())
140
        {
141
                ui->radioButtonTelescopeASCOM->hide();
142
        }
143
        #endif
144

145
        // Inherited connect
146
        connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
×
147
        connect(ui->titleBar, &TitleBar::closeClicked, this, &TelescopeConfigurationDialog::buttonDiscardPressed);
×
148
        connect(ui->titleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
×
149
        connect(dialog, SIGNAL(rejected()), this, SLOT(buttonDiscardPressed()));
×
150

151
        // Connect: sender, signal, receiver, member
152
        connect(ui->radioButtonTelescopeLocal, SIGNAL(toggled(bool)), this, SLOT(toggleTypeLocal(bool)));
×
153
        connect(ui->radioButtonTelescopeConnection, SIGNAL(toggled(bool)), this, SLOT(toggleTypeConnection(bool)));
×
154
        connect(ui->radioButtonTelescopeVirtual, SIGNAL(toggled(bool)), this, SLOT(toggleTypeVirtual(bool)));
×
155
        connect(ui->radioButtonTelescopeRTS2, SIGNAL(toggled(bool)), this, SLOT(toggleTypeRTS2(bool)));
×
156
        connect(ui->radioButtonTelescopeINDI, SIGNAL(toggled(bool)), this, SLOT(toggleTypeINDI(bool)));
×
157
        #ifdef Q_OS_WIN
158
        connect(ui->radioButtonTelescopeASCOM, SIGNAL(toggled(bool)), this, SLOT(toggleTypeASCOM(bool)));
159
        #else
160
        ui->radioButtonTelescopeASCOM->hide();
×
161
        #endif
162

163
        connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(buttonSavePressed()));
×
164
        connect(ui->pushButtonDiscard, SIGNAL(clicked()), this, SLOT(buttonDiscardPressed()));
×
165

166
        connect(ui->comboBoxDeviceModel, SIGNAL(currentIndexChanged(int)), this, SLOT(deviceModelSelected(int)));
×
167

168
        // Setting validators
169
        ui->lineEditTelescopeName->setValidator(telescopeNameValidator);
×
170
        ui->lineEditHostName->setValidator(hostNameValidator);
×
171
        ui->lineEditCircleList->setValidator(circleListValidator);
×
172
        ui->comboSerialPort->setValidator(serialPortValidator);
×
173

174
        populateToolTips();
×
175
}
×
176

177
void TelescopeConfigurationDialog::populateToolTips()
×
178
{
179
        ui->doubleSpinBoxTelescopeDelay->setToolTip(
×
180
          QString("<p>%1</p>")
×
181
                .arg(q_("The approximate time it takes for the signals from the telescope to reach Stellarium. "
×
182
                                "Increase this value if the reticle is skipping.")));
183
        ui->doubleSpinBoxRTS2Refresh->setToolTip(
×
184
          QString("<p>%1</p>")
×
185
                .arg(q_("Refresh rate of the RTS2 telescope. Delay before sending next telescope status request. The "
×
186
                                "default value of 0.5 second works fine with most setups.")));
187
}
×
188

189
// Set the configuration panel in a predictable state
190
void TelescopeConfigurationDialog::initConfigurationDialog()
×
191
{
192
        ui->groupBoxConnectionSettings->hide();
×
193
        ui->groupBoxDeviceSettings->hide();
×
194
        ui->groupBoxRTS2Settings->hide();
×
195
        ui->INDIProperties->hide();
×
196
        #ifdef Q_OS_WIN
197
        ascomWidget->hide();
198
        #endif
199

200
        // Reusing code used in both methods that call this one
201
        deviceModelNames = telescopeManager->getDeviceModels().keys();
×
202

203
        // Name
204
        ui->lineEditTelescopeName->clear();
×
205

206
        // Equinox
207
        ui->radioButtonJ2000->setChecked(true);
×
208

209
        // Connect at startup
210
        ui->checkBoxConnectAtStartup->setChecked(false);
×
211

212
        // Serial port
213
        QStringList* plist = listSerialPorts();
×
214
        ui->comboSerialPort->clear();
×
215
        ui->comboSerialPort->addItems(*plist);
×
216
#if (QT_VERSION>=QT_VERSION_CHECK(5,14,0))
217
        emit ui->comboSerialPort->textActivated(plist->value(0));
×
218
#else
219
        ui->comboSerialPort->activated(plist->value(0));
220
#endif
221
        ui->comboSerialPort->setEditText(plist->value(0));
×
222
        delete (plist);
×
223

224
        // Populating the list of available devices
225
        ui->comboBoxDeviceModel->clear();
×
226
        if (!deviceModelNames.isEmpty())
×
227
        {
228
                deviceModelNames.sort();
×
229
                ui->comboBoxDeviceModel->addItems(deviceModelNames);
×
230
        }
231
        ui->comboBoxDeviceModel->setCurrentIndex(0);
×
232

233
        // FOV circles
234
        ui->checkBoxCircles->setChecked(false);
×
235
        ui->lineEditCircleList->clear();
×
236

237
        // It is very unlikely that this situation will happen any more due to the
238
        // embedded telescope servers.
239
        if (deviceModelNames.isEmpty())
×
240
        {
241
                ui->radioButtonTelescopeLocal->setEnabled(false);
×
242
                ui->radioButtonTelescopeConnection->setChecked(true);
×
243
                toggleTypeConnection(true); // Not called if the button is already checked
×
244
        }
245
        else
246
        {
247
                ui->radioButtonTelescopeLocal->setEnabled(true);
×
248
                ui->radioButtonTelescopeLocal->setChecked(true);
×
249
                toggleTypeLocal(true); // Not called if the button is already checked
×
250
        }
251
}
×
252

253
void TelescopeConfigurationDialog::initNewTelescopeConfiguration(int slot)
×
254
{
255
        configuredSlot = slot;
×
256
        initConfigurationDialog();
×
257
        ui->titleBar->setTitle(q_("Add New Telescope"));
×
258
        ui->lineEditTelescopeName->setText(QString("New Telescope %1").arg(QString::number(configuredSlot)));
×
259

260
        ui->doubleSpinBoxTelescopeDelay->setValue(SECONDS_FROM_MICROSECONDS(TelescopeControl::DEFAULT_DELAY));
×
261
}
×
262

263
void TelescopeConfigurationDialog::initExistingTelescopeConfiguration(int slot)
×
264
{
265
        configuredSlot = slot;
×
266
        initConfigurationDialog();
×
267
        ui->titleBar->setTitle(q_("Configure Telescope"));
×
268

269
        // Read the telescope properties
270
        QString name;
×
271
        TelescopeControl::ConnectionType connectionType;
272
        QString equinox;
×
273
        QString host;
×
274
        int portTCP;
275
        int delay;
276
        bool connectAtStartup;
277
        QList<double> circles;
×
278
        QString deviceModelName;
×
279
        QString serialPortName;
×
280
        QString rts2Url;
×
281
        QString rts2Username;
×
282
        QString rts2Password;
×
283
        int rts2Refresh;
284
        QString ascomDeviceId;
×
285
        bool ascomUseDeviceEqCoordType;
286

287
        if (!telescopeManager->getTelescopeAtSlot(slot, connectionType, name, equinox, host, portTCP, delay,
×
288
                  connectAtStartup, circles, deviceModelName, serialPortName, rts2Url, rts2Username, rts2Password,
289
                  rts2Refresh, ascomDeviceId, ascomUseDeviceEqCoordType))
290
        {
291
                // TODO: Add better debug
292
                qDebug() << "Cannot get telescope for slot" << slot;
×
293
                return;
×
294
        }
295
        ui->lineEditTelescopeName->setText(name);
×
296

297
        if (connectionType == TelescopeControl::ConnectionInternal && !deviceModelName.isEmpty())
×
298
        {
299
                ui->radioButtonTelescopeLocal->setChecked(true);
×
300
                ui->lineEditHostName->setText("localhost"); // TODO: Remove magic word!
×
301

302
                // Make the current device model selected in the list
303
                int index = ui->comboBoxDeviceModel->findText(deviceModelName);
×
304
                if (index < 0)
×
305
                {
306
                        qDebug() << "TelescopeConfigurationDialog: Current device model is not in the list?";
×
307
                        emit changesDiscarded();
×
308
                        return;
×
309
                }
310
                else
311
                        ui->comboBoxDeviceModel->setCurrentIndex(index);
×
312

313
                // Initialize the serial port value
314
#if (QT_VERSION>=QT_VERSION_CHECK(5,14,0))
315
                emit ui->comboSerialPort->textActivated(serialPortName);
×
316
#else
317
                ui->comboSerialPort->activated(serialPortName);
318
#endif
319
                ui->comboSerialPort->setEditText(serialPortName);
×
320
        }
321
        else if (connectionType == TelescopeControl::ConnectionRemote)
×
322
        {
323
                ui->radioButtonTelescopeConnection->setChecked(true); // Calls toggleTypeConnection(true)
×
324
                ui->lineEditHostName->setText(host);
×
325
        }
326
        else if (connectionType == TelescopeControl::ConnectionLocal)
×
327
        {
328
                ui->radioButtonTelescopeConnection->setChecked(true);
×
329
                ui->lineEditHostName->setText("localhost");
×
330
        }
331
        else if (connectionType == TelescopeControl::ConnectionVirtual)
×
332
        {
333
                ui->radioButtonTelescopeVirtual->setChecked(true);
×
334
        }
335
        else if (connectionType == TelescopeControl::ConnectionRTS2)
×
336
        {
337
                ui->radioButtonTelescopeRTS2->setChecked(true);
×
338
                ui->lineEditRTS2Url->setText(rts2Url);
×
339
                ui->lineEditRTS2Username->setText(rts2Username);
×
340
                ui->lineEditRTS2Password->setText(rts2Password);
×
341
                ui->doubleSpinBoxRTS2Refresh->setValue(SECONDS_FROM_MICROSECONDS(rts2Refresh));
×
342
        }
343
        else if (connectionType == TelescopeControl::ConnectionINDI)
×
344
        {
345
                ui->radioButtonTelescopeINDI->setChecked(true);
×
346
                ui->INDIProperties->setHost(host);
×
347
                ui->INDIProperties->setPort(portTCP);
×
348
                ui->INDIProperties->setSelectedDevice(deviceModelName);
×
349
        }
350
        #ifdef Q_OS_WIN
351
        else if (connectionType == TelescopeControl::ConnectionASCOM)
352
        {
353
                ui->radioButtonTelescopeASCOM->setChecked(true);
354
                ascomWidget->setSelectedDevice(ascomDeviceId);
355
                ascomWidget->setUseDeviceEqCoordType(ascomUseDeviceEqCoordType);
356
        }
357
        #endif
358

359
        // Equinox
360
        if (equinox == "JNow")
×
361
                ui->radioButtonJNow->setChecked(true);
×
362
        else
363
                ui->radioButtonJ2000->setChecked(true);
×
364

365
        // Circles
366
        if (!circles.isEmpty())
×
367
        {
368
                ui->checkBoxCircles->setChecked(true);
×
369

370
                QStringList circleList;
×
371
                for (int i = 0; i < circles.size(); i++)
×
372
                        circleList.append(QString::number(circles[i]));
×
373
                ui->lineEditCircleList->setText(circleList.join(", "));
×
374
        }
×
375

376
        // TCP port
377
        ui->spinBoxTCPPort->setValue(portTCP);
×
378

379
        // Delay
380
        ui->doubleSpinBoxTelescopeDelay->setValue(SECONDS_FROM_MICROSECONDS(delay)); // Microseconds to seconds
×
381

382
        // Connect at startup
383
        ui->checkBoxConnectAtStartup->setChecked(connectAtStartup);
×
384
}
×
385

386
void TelescopeConfigurationDialog::toggleTypeLocal(bool isChecked)
×
387
{
388
        if (isChecked)
×
389
        {
390
                // Re-initialize values that may have been changed
391
                ui->comboBoxDeviceModel->setCurrentIndex(0);
×
392
                QStringList* plist = listSerialPorts();
×
393
#if (QT_VERSION>=QT_VERSION_CHECK(5,14,0))
394
                emit ui->comboSerialPort->textActivated(plist->value(0));
×
395
#else
396
                ui->comboSerialPort->activated(plist->value(0));
397
#endif
398
                ui->comboSerialPort->setEditText(plist->value(0));
×
399
                delete (plist);
×
400
                ui->lineEditHostName->setText("localhost");
×
401
                ui->spinBoxTCPPort->setValue(DEFAULT_TCP_PORT_FOR_SLOT(configuredSlot));
×
402

403
                ui->groupBoxDeviceSettings->show();
×
404

405
                ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopeProperties);
×
406
        }
407
        else
408
        {
409
                ui->groupBoxDeviceSettings->hide();
×
410
        }
411
}
×
412

413
void TelescopeConfigurationDialog::toggleTypeConnection(bool isChecked)
×
414
{
415
        if (isChecked)
×
416
        {
417
                // Re-initialize values that may have been changed
418
                ui->lineEditHostName->setText("localhost");
×
419
                ui->spinBoxTCPPort->setValue(DEFAULT_TCP_PORT_FOR_SLOT(configuredSlot));
×
420

421
                ui->groupBoxConnectionSettings->show();
×
422

423
                ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopeProperties);
×
424
        }
425
        else
426
        {
427
                ui->groupBoxConnectionSettings->hide();
×
428
        }
429
}
×
430

431
void TelescopeConfigurationDialog::toggleTypeVirtual(bool isChecked)
×
432
{
433
        Q_UNUSED(isChecked)
434
        ui->scrollArea->ensureWidgetVisible(ui->groupBoxTelescopeProperties);
×
435
}
×
436

437
void TelescopeConfigurationDialog::toggleTypeRTS2(bool isChecked)
×
438
{
439
        if (isChecked)
×
440
        {
441
                // Re-initialize values that may have been changed
442
                ui->lineEditRTS2Url->setText("localhost:8889");
×
443

444
                ui->groupBoxRTS2Settings->show();
×
445

446
                ui->scrollArea->ensureWidgetVisible(ui->groupBoxRTS2Settings);
×
447
        }
448
        else
449
        {
450
                ui->groupBoxRTS2Settings->hide();
×
451
        }
452
}
×
453

454
void TelescopeConfigurationDialog::toggleTypeINDI(bool enabled)
×
455
{
456
        ui->INDIProperties->setVisible(enabled);
×
457
}
×
458

459
#ifdef Q_OS_WIN
460
void TelescopeConfigurationDialog::toggleTypeASCOM(bool enabled)
461
{
462
        ascomWidget->setVisible(enabled);        
463
}
464
#endif
465

466
void TelescopeConfigurationDialog::buttonSavePressed()
×
467
{
468
        // Main telescope properties
469
        QString name = ui->lineEditTelescopeName->text().trimmed();
×
470

471
        if (name.isEmpty()) return;
×
472

473
        QString host = ui->lineEditHostName->text();
×
474

475
        if (host.isEmpty()) // Remove validation of hostname
×
476
                return;
×
477

478
        int delay = qRound(MICROSECONDS_FROM_SECONDS(ui->doubleSpinBoxTelescopeDelay->value()));
×
479
        int portTCP = ui->spinBoxTCPPort->value();
×
480
        bool connectAtStartup = ui->checkBoxConnectAtStartup->isChecked();
×
481

482
        // Circles
483
        // TODO: This will change if there is a validator for that field
484
        QList<double> circles;
×
485
        QString rawCircles = ui->lineEditCircleList->text().trimmed();
×
486
        QStringList circleStrings;
×
487
        if (ui->checkBoxCircles->isChecked() && !(rawCircles.isEmpty()))
×
488
        {
489
                #if (QT_VERSION>=QT_VERSION_CHECK(5, 14, 0))
490
                circleStrings = rawCircles.simplified().remove(' ').split(',', Qt::SkipEmptyParts);
×
491
                #else
492
                circleStrings = rawCircles.simplified().remove(' ').split(',', QString::SkipEmptyParts);
493
                #endif
494
                circleStrings.removeDuplicates();
×
495
                circleStrings.sort();
×
496

497
                for (int i = 0; i < circleStrings.size(); i++)
×
498
                {
499
                        if (i >= TelescopeControl::MAX_CIRCLE_COUNT) break;
×
500
                        double circle = circleStrings.at(i).toDouble();
×
501
                        if (circle > 0.0) circles.append(circle);
×
502
                }
503
        }
504

505
        QString equinox("J2000");
×
506
        if (ui->radioButtonJNow->isChecked()) equinox = "JNow";
×
507

508
        // Type and server properties
509
        // TODO: When adding, check for success!
510
        TelescopeControl::ConnectionType type = TelescopeControl::ConnectionNA;
×
511
        if (ui->radioButtonTelescopeLocal->isChecked())
×
512
        {
513
                // Read the serial port
514
                QString serialPortName = ui->comboSerialPort->currentText();
×
515
                type = TelescopeControl::ConnectionInternal;
×
516
                telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, host, portTCP, delay,
×
517
                  connectAtStartup, circles, ui->comboBoxDeviceModel->currentText(), serialPortName);
×
518
        }
×
519
        else if (ui->radioButtonTelescopeConnection->isChecked())
×
520
        {
521
                if (host == "localhost")
×
522
                        type = TelescopeControl::ConnectionLocal;
×
523
                else
524
                        type = TelescopeControl::ConnectionRemote;
×
525
                telescopeManager->addTelescopeAtSlot(
×
526
                  configuredSlot, type, name, equinox, host, portTCP, delay, connectAtStartup, circles);
527
        }
528
        else if (ui->radioButtonTelescopeVirtual->isChecked())
×
529
        {
530
                type = TelescopeControl::ConnectionVirtual;
×
531
                telescopeManager->addTelescopeAtSlot(
×
532
                  configuredSlot, type, name, equinox, QString(), portTCP, delay, connectAtStartup, circles);
×
533
        }
534
        else if (ui->radioButtonTelescopeRTS2->isChecked())
×
535
        {
536
                type = TelescopeControl::ConnectionRTS2;
×
537
                telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, host, portTCP, delay,
×
538
                  connectAtStartup, circles, QString(), QString(), ui->lineEditRTS2Url->text(),
×
539
                  ui->lineEditRTS2Username->text(), ui->lineEditRTS2Password->text(),
×
540
                  qRound(MICROSECONDS_FROM_SECONDS(ui->doubleSpinBoxRTS2Refresh->value())));
×
541
        }
542
        else if (ui->radioButtonTelescopeINDI->isChecked())
×
543
        {
544
                type = TelescopeControl::ConnectionINDI;
×
545
                telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, ui->INDIProperties->host(),
×
546
                  ui->INDIProperties->port(), delay, connectAtStartup, circles, ui->INDIProperties->selectedDevice());
×
547
        }
548
        #ifdef Q_OS_WIN
549
        else if (ui->radioButtonTelescopeASCOM->isChecked())
550
        {
551
                type = TelescopeControl::ConnectionASCOM;
552
                telescopeManager->addTelescopeAtSlot(configuredSlot, type, name, equinox, host, portTCP, delay,
553
                  connectAtStartup, circles, QString(), QString(), QString(), QString(), QString(), -1,
554
                  ascomWidget->selectedDevice(), ascomWidget->useDeviceEqCoordType());
555
        }
556
        #endif
557

558
        emit changesSaved(name, type);
×
559
}
×
560

561
void TelescopeConfigurationDialog::buttonDiscardPressed()
×
562
{
563
        emit changesDiscarded();
×
564
}
×
565

566
void TelescopeConfigurationDialog::deviceModelSelected(int modelIndex)
×
567
{
568
        const QString& deviceModelName=ui->comboBoxDeviceModel->itemText(modelIndex);
×
569
        ui->labelDeviceModelDescription->setText(
×
570
          q_(telescopeManager->getDeviceModels().value(deviceModelName).description));
×
571
        ui->doubleSpinBoxTelescopeDelay->setValue(
×
572
          SECONDS_FROM_MICROSECONDS(telescopeManager->getDeviceModels().value(deviceModelName).defaultDelay));
×
573
}
×
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