Kstars

horizonmanager.h
1/*
2 SPDX-FileCopyrightText: 2015 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "ui_horizonmanager.h"
10
11#include <QDialog>
12
13#include <memory>
14
15class QStandardItem;
17
18class ArtificialHorizonComponent;
19class ArtificialHorizonEntity;
20class LineList;
21class SkyPoint;
22
23class HorizonManagerUI : public QFrame, public Ui::HorizonManager
24{
26
27 public:
28 /** @short Constructor */
29 explicit HorizonManagerUI(QWidget *parent);
30};
31
32/**
33 * @class HorizonManager
34 * @short Manages adding/removing and editing regions and points associated with
35 * user-customized artificial horizons.
36 *
37 * @version 1.0
38 * @author Jasem Mutlaq
39 */
40class HorizonManager : public QDialog
41{
43 public:
44 /** @short Constructor */
45 explicit HorizonManager(QWidget *ks);
46
47 /** @short Destructor */
48 virtual ~HorizonManager() override = default;
49
50 void showRegion(const int regionID);
51
52 bool validate(int regionID);
53
54 void deleteRegion(int regionID);
55
56 protected:
57 void closeEvent(QCloseEvent *event) override;
58 void showEvent(QShowEvent *event) override;
59
60 public slots:
61 /** @short Add region */
62 void slotAddRegion();
63
64 /** @short Delete region */
65 void slotRemoveRegion();
66
67 void slotToggleCeiling();
68
69 void addSkyPoint(SkyPoint *skypoint);
70 void slotAddPoint();
71 void slotRemovePoint();
72 void slotClosed();
73
74 void clearPoints();
75
76 void importHorizon();
77 void exportHorizon();
78
79 void setSelectPoints(bool);
80 void slotCurrentPointChanged(const QModelIndex &current, const QModelIndex &previous);
81
82 private slots:
83 void verifyItemValue(QStandardItem *item);
84 void slotSaveChanges();
85 void slotSetShownRegion(QModelIndex idx);
86
87 private:
88 void addPoint(const SkyPoint *skyPoint);
89 void terminateLivePreview();
90 void setPointSelection(bool enable);
91 void removeEmptyRows(int regionID);
92 void setupLivePreview(QStandardItem *item);
93 void setupValidation(int regionID);
94 void addRegion(const QString &name);
95
96 HorizonManagerUI *ui { nullptr };
97
98 QStandardItemModel *m_RegionsModel { nullptr };
99 ArtificialHorizonComponent *horizonComponent { nullptr };
100
101 std::shared_ptr<LineList> livePreview;
102 bool selectPoints { false };
103 bool m_ForceUpdates = true;
104
105 friend class TestArtificialHorizon;
106};
Manages adding/removing and editing regions and points associated with user-customized artificial hor...
void slotRemoveRegion()
Delete region.
HorizonManager(QWidget *ks)
Constructor.
void slotAddRegion()
Add region.
virtual ~HorizonManager() override=default
Destructor.
A simple data container used by LineListIndex.
Definition linelist.h:25
The sky coordinates of a point in the sky.
Definition skypoint.h:45
Q_OBJECTQ_OBJECT
QObject * parent() const const
virtual bool event(QEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:53:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.