Kstars

horizonmanager.h
1 /*
2  SPDX-FileCopyrightText: 2015 Jasem Mutlaq <[email protected]>
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 
15 class QStandardItem;
16 class QStandardItemModel;
17 
18 class ArtificialHorizonComponent;
19 class ArtificialHorizonEntity;
20 class LineList;
21 class SkyPoint;
22 
23 class HorizonManagerUI : public QFrame, public Ui::HorizonManager
24 {
25  Q_OBJECT
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  */
40 class HorizonManager : public QDialog
41 {
42  Q_OBJECT
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 setSelectPoints(bool);
77  void slotCurrentPointChanged(const QModelIndex &current, const QModelIndex &previous);
78 
79  private slots:
80  void verifyItemValue(QStandardItem *item);
81  void slotSaveChanges();
82  void slotSetShownRegion(QModelIndex idx);
83 
84  private:
85  void addPoint(SkyPoint *skyPoint);
86  void terminateLivePreview();
87  void setPointSelection(bool enable);
88  void removeEmptyRows(int regionID);
89  void setupLivePreview(QStandardItem *item);
90  void setupValidation(int regionID);
91 
92  HorizonManagerUI *ui { nullptr };
93 
94  QStandardItemModel *m_RegionsModel { nullptr };
95  ArtificialHorizonComponent *horizonComponent { nullptr };
96 
97  std::shared_ptr<LineList> livePreview;
98  bool selectPoints { false };
99 
100  friend class TestArtificialHorizon;
101 };
Q_OBJECTQ_OBJECT
virtual ~HorizonManager() override=default
Destructor.
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
virtual bool event(QEvent *event) override
Manages adding/removing and editing regions and points associated with user-customized artificial hor...
void slotAddRegion()
Add region.
void slotRemoveRegion()
Delete region.
HorizonManager(QWidget *ks)
Constructor.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:54 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.