Kstars

guidestatewidget.cpp
1/*
2 SPDX-FileCopyrightText: 2012 Jasem Mutlaq <mutlaqja@ikarustech.com>
3 SPDX-FileCopyrightText: 2021 Wolfgang Reissenberger <sterne-jaeger@openfuture.de>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6*/
7
8#include "guidestatewidget.h"
9
10namespace Ekos
11{
12GuideStateWidget::GuideStateWidget(QWidget * parent) : QWidget(parent)
13{
14 setupUi(this);
15 init();
16}
17
18void GuideStateWidget::init()
19{
20 // Guiding state
21 if (idlingStateLed == nullptr)
22 {
23 idlingStateLed = new KLed(Qt::gray, KLed::Off, KLed::Flat, KLed::Circular, this);
24 idlingStateLed->setObjectName("idlingStateLed");
25 guideStateLayout->insertWidget(0, idlingStateLed);
26 }
27 if (preparingStateLed == nullptr)
28 {
29 preparingStateLed = new KLed(Qt::gray, KLed::Off, KLed::Flat, KLed::Circular, this);
30 preparingStateLed->setObjectName("preparingStateLed");
31 guideStateLayout->insertWidget(2, preparingStateLed);
32 }
33 if (runningStateLed == nullptr)
34 {
35 runningStateLed = new KLed(Qt::gray, KLed::Off, KLed::Flat, KLed::Circular, this);
36 runningStateLed->setObjectName("runningStateLed");
37 guideStateLayout->insertWidget(4, runningStateLed);
38 }
39}
40
41void GuideStateWidget::updateGuideStatus(GuideState state)
42{
43 idlingStateLed->off();
44 preparingStateLed->off();
45 runningStateLed->off();
46 switch (state)
47 {
48 case GUIDE_DISCONNECTED:
49 idlingStateLed->setColor(Qt::red);
50 idlingStateLed->on();
51 break;
52 case GUIDE_CONNECTED:
53 idlingStateLed->setColor(Qt::green);
54 preparingStateLed->setColor(Qt::gray);
55 runningStateLed->setColor(Qt::gray);
56 idlingStateLed->on();
57 break;
58 case GUIDE_CAPTURE:
59 case GUIDE_LOOPING:
60 case GUIDE_DARK:
61 case GUIDE_SUBFRAME:
62 preparingStateLed->setColor(Qt::green);
63 runningStateLed->setColor(Qt::gray);
64 preparingStateLed->on();
65 break;
66 case GUIDE_STAR_SELECT:
67 case GUIDE_CALIBRATING:
68 preparingStateLed->setColor(Qt::yellow);
69 runningStateLed->setColor(Qt::gray);
70 preparingStateLed->on();
71 break;
72 case GUIDE_CALIBRATION_ERROR:
73 preparingStateLed->setColor(Qt::red);
74 runningStateLed->setColor(Qt::red);
75 preparingStateLed->on();
76 break;
77 case GUIDE_CALIBRATION_SUCCESS:
78 preparingStateLed->setColor(Qt::green);
79 runningStateLed->setColor(Qt::yellow);
80 preparingStateLed->on();
81 break;
82 case GUIDE_GUIDING:
83 preparingStateLed->setColor(Qt::green);
84 runningStateLed->setColor(Qt::green);
85 runningStateLed->setState(KLed::On);
86 break;
87 case GUIDE_MANUAL_DITHERING:
88 case GUIDE_DITHERING:
89 case GUIDE_DITHERING_SETTLE:
90 case GUIDE_REACQUIRE:
91 case GUIDE_SUSPENDED:
92 runningStateLed->setColor(Qt::yellow);
93 runningStateLed->setState(KLed::On);
94 break;
95 case GUIDE_DITHERING_ERROR:
96 case GUIDE_ABORTED:
97 idlingStateLed->setColor(Qt::green);
98 preparingStateLed->setColor(Qt::red);
99 runningStateLed->setColor(Qt::red);
100 idlingStateLed->on();
101 break;
102 case GUIDE_IDLE:
103 default:
104 idlingStateLed->setColor(Qt::green);
105 idlingStateLed->on();
106 break;
107 }
108
109}
110}
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:79
QCA_EXPORT void init()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:49:21 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.