Kstars

ledstatuswidget.cpp
1/* Progress and status of device or process preparation and execution
2 SPDX-FileCopyrightText: Wolfgang Reissenberger <sterne-jaeger@openfuture.de>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "ledstatuswidget.h"
8
9namespace Ekos
10{
11LedStatusWidget::LedStatusWidget(QWidget * parent) : QWidget(parent)
12{
13 setupUi(this);
14
15 statusLed = new KLed(Qt::gray, KLed::On, KLed::Flat, KLed::Circular, this);
16 statusLed->setObjectName("statusLed");
17 statusLayout->insertWidget(-1, statusLed, 0, Qt::AlignVCenter);
18
19 statusText->setText(i18n("Idle"));
20}
21
22void LedStatusWidget::setCaptureState(CaptureState status)
23{
24 switch (status)
25 {
26 case CAPTURE_IDLE:
27 setStatus(i18n("Idle"), Qt::gray);
28 break;
29 case CAPTURE_PAUSED:
30 setStatus(i18n("Paused"), Qt::gray);
31 break;
33 setStatus(i18n("Suspended"), Qt::gray);
34 break;
36 setStatus(i18n("Completed"), Qt::gray);
37 break;
38
40 setStatus(i18n("Preparing..."), Qt::yellow);
41 break;
42 case CAPTURE_WAITING:
43 setStatus(i18n("Waiting..."), Qt::yellow);
44 break;
46 setStatus(i18n("Dithering..."), Qt::yellow);
47 break;
49 setStatus(i18n("Focusing..."), Qt::yellow);
50 break;
52 setStatus(i18n("Filter change..."), Qt::yellow);
53 break;
55 setStatus(i18n("Filter change..."), Qt::yellow);
56 break;
58 setStatus(i18n("Aligning..."), Qt::yellow);
59 break;
61 setStatus(i18n("Calibrating..."), Qt::yellow);
62 break;
64 setStatus(i18n("Meridian flip..."), Qt::yellow);
65 break;
66
68 setStatus(i18n("Capturing"), Qt::darkGreen);
69 break;
71 setStatus(i18n("Image received."), Qt::darkGreen);
72 break;
74 setStatus(i18n("Pause planned..."), Qt::darkGreen);
75 break;
76
77 case CAPTURE_ABORTED:
78 setStatus(i18n("Aborted"), Qt::darkRed);
79 break;
80
84 // do nothing here, set from {@see Capture::updatePrepareState()}
85 break;
86 }
87}
88
89void LedStatusWidget::setMountState(QString text, ISD::Mount::Status status)
90{
91 switch (status)
92 {
93 case ISD::Mount::MOUNT_IDLE:
94 case ISD::Mount::MOUNT_PARKED:
95 setStatus(text, Qt::gray);
96 break;
97 case ISD::Mount::MOUNT_MOVING:
98 case ISD::Mount::MOUNT_SLEWING:
99 case ISD::Mount::MOUNT_PARKING:
100 setStatus(text, Qt::yellow);
101 break;
102 case ISD::Mount::MOUNT_TRACKING:
103 setStatus(text, Qt::darkGreen);
104 break;
105 case ISD::Mount::MOUNT_ERROR:
106 setStatus(text, Qt::red);
107 break;
108 }
109}
110
111void LedStatusWidget::setFocusState(FocusState status)
112{
113 switch (status)
114 {
115 case FOCUS_IDLE:
116 setStatus(Ekos::getFocusStatusString(status), Qt::gray);
117 break;
118 case FOCUS_COMPLETE:
119 setStatus(Ekos::getFocusStatusString(status), Qt::darkGreen);
120 break;
121 case FOCUS_WAITING:
122 case FOCUS_PROGRESS:
123 case FOCUS_FRAMING:
124 case FOCUS_CHANGING_FILTER:
125 setStatus(Ekos::getFocusStatusString(status), Qt::yellow);
126 break;
127 case FOCUS_FAILED:
128 case FOCUS_ABORTED:
129 setStatus(Ekos::getFocusStatusString(status), Qt::red);
130 break;
131 }
132}
133
134void LedStatusWidget::setFilterState(FilterState status)
135{
136 switch (status)
137 {
138 case FILTER_CHANGE:
139 case FILTER_OFFSET:
140 case FILTER_AUTOFOCUS:
141 setStatus(Ekos::getFilterStatusString(status), Qt::yellow);
142 break;
143 case FILTER_IDLE:
144 if (lastFilterState == FILTER_CHANGE)
145 setStatus(i18n("Filter selected."), Qt::darkGreen);
146 break;
147 default:
148 // do nothing
149 break;
150 }
151 // remember the current status
152 lastFilterState = status;
153}
154
155void LedStatusWidget::setStatus(QString text, Qt::GlobalColor color)
156{
157 statusText->setText(text);
158 statusLed->setColor(color);
159}
160
161}
QString i18n(const char *text, const TYPE &arg...)
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:79
@ CAPTURE_GUIDER_DRIFT
Definition ekos.h:106
@ CAPTURE_DITHERING
Definition ekos.h:102
@ CAPTURE_SETTING_ROTATOR
Definition ekos.h:108
@ CAPTURE_FILTER_FOCUS
Definition ekos.h:104
@ CAPTURE_WAITING
Definition ekos.h:100
@ CAPTURE_PROGRESS
Definition ekos.h:94
@ CAPTURE_PAUSE_PLANNED
Definition ekos.h:96
@ CAPTURE_PAUSED
Definition ekos.h:97
@ CAPTURE_FOCUSING
Definition ekos.h:103
@ CAPTURE_IMAGE_RECEIVED
Definition ekos.h:101
@ CAPTURE_SUSPENDED
Definition ekos.h:98
@ CAPTURE_ABORTED
Definition ekos.h:99
@ CAPTURE_COMPLETE
Definition ekos.h:112
@ CAPTURE_MERIDIAN_FLIP
Definition ekos.h:111
@ CAPTURE_CAPTURING
Definition ekos.h:95
@ CAPTURE_CALIBRATING
Definition ekos.h:110
@ CAPTURE_ALIGNING
Definition ekos.h:109
@ CAPTURE_CHANGING_FILTER
Definition ekos.h:105
@ CAPTURE_IDLE
Definition ekos.h:93
@ CAPTURE_SETTING_TEMPERATURE
Definition ekos.h:107
NETWORKMANAGERQT_EXPORT NetworkManager::Status status()
AlignVCenter
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.