1 /*
2     SPDX-FileCopyrightText: 2011 Jérôme SONRIER <jsid@emor3j.fr.eu.org>
3 
4     SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "ui_opssatellites.h"
10 
11 #include <kconfigdialog.h>
12 
13 #include <QFrame>
14 #include <QSortFilterProxyModel>
15 
16 class QStandardItem;
17 class QStandardItemModel;
18 class KStars;
19 
20 class SatelliteSortFilterProxyModel : public QSortFilterProxyModel
21 {
22   Q_OBJECT
23 
24   public:
25     explicit SatelliteSortFilterProxyModel(QObject *parent);
26     bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
27 };
28 
29 /**
30  * @class OpsSatellites
31  *
32  * The Satellites Tab of the Options window.  In this Tab the user can configure
33  * satellites options and select satellites that should be draw
34  *
35  * @author Jérôme SONRIER
36  * @version 1.0
37  */
38 class OpsSatellites : public QFrame, public Ui::OpsSatellites
39 {
40     Q_OBJECT
41 
42   public:
43     /** Constructor */
44     OpsSatellites();
45 
46     virtual ~OpsSatellites() override = default;
47 
48   private:
49     /** Refresh satellites list */
50     void updateListView();
51 
52     /**
53      * @brief saveSatellitesList Saves list of checked satellites in the configuration file
54      */
55     void saveSatellitesList();
56 
57   private slots:
58     void slotUpdateTLEs();
59     void slotShowSatellites(bool on);
60     void slotApply();
61     void slotCancel();
62     void slotFilterReg(const QString &);
63     void slotItemChanged(QStandardItem *);
64 
65 private:
66   KConfigDialog *m_ConfigDialog { nullptr };
67   QStandardItemModel *m_Model { nullptr };
68   QSortFilterProxyModel *m_SortModel { nullptr };
69   bool isDirty { false };
70 };
71