Kstars

focusprogresswidget.cpp
1/*
2 SPDX-FileCopyrightText: 2012 Jasem Mutlaq <mutlaqja@ikartech.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 "focusprogresswidget.h"
9#include "kstarsdata.h"
10#include "Options.h"
11
12namespace Ekos
13{
14FocusProgressWidget::FocusProgressWidget(QWidget * parent) : QWidget(parent)
15{
16 setupUi(this);
17}
18
19void FocusProgressWidget::updateCurrentHFR(double newHFR)
20{
21 currentHFR->setText(QString("%1").arg(newHFR, 0, 'f', 2) + " px");
22 profilePlot->drawProfilePlot(newHFR);
23}
24
25void FocusProgressWidget::updateFocusDetailView()
26{
27 const int pos = focusDetailView->currentIndex();
28 if (pos == 1 && focusStarPixmap.get() != nullptr)
29 {
30 focusStarView->setPixmap(focusStarPixmap.get()->scaled(focusDetailView->width(), focusDetailView->height(),
32 }
33}
34
35void FocusProgressWidget::updateFocusStarPixmap(QPixmap &starPixmap)
36{
37 if (starPixmap.isNull())
38 return;
39
40 focusStarPixmap.reset(new QPixmap(starPixmap));
41 updateFocusDetailView();
42}
43
44void FocusProgressWidget::updateFocusStatus(Ekos::FocusState status)
45{
46 focusStatus->setFocusState(status);
47}
48
49void FocusProgressWidget::init()
50{
51
52 // focus details buttons
53 connect(focusDetailNextButton, &QPushButton::clicked, [this]()
54 {
55 const int pos = focusDetailView->currentIndex();
56 if (pos == 0 || (pos == 1 && focusStarPixmap.get() != nullptr))
57 focusDetailView->setCurrentIndex(pos + 1);
58 else if (pos > 0)
59 focusDetailView->setCurrentIndex(0);
60 updateFocusDetailView();
61 });
62 connect(focusDetailPrevButton, &QPushButton::clicked, [this]()
63 {
64 const int pos = focusDetailView->currentIndex();
65 if (pos == 0 && focusStarPixmap.get() != nullptr)
66 focusDetailView->setCurrentIndex(pos + 2);
67 else if (pos == 0)
68 focusDetailView->setCurrentIndex(pos + 1);
69 else if (pos > 0)
70 focusDetailView->setCurrentIndex(pos - 1);
71 updateFocusDetailView();
72 });
73}
74
75void FocusProgressWidget::reset()
76{
77 focusStatus->setFocusState(FOCUS_IDLE);
78}
79
80} // namespace Ekos
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
void clicked(bool checked)
bool isNull() const const
KeepAspectRatio
SmoothTransformation
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.