File indexing completed on 2024-07-21 06:28:38

0001 /*
0002     SPDX-FileCopyrightText: 2011 Jérôme SONRIER <jsid@emor3j.fr.eu.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ui_opssatellites.h"
0010 
0011 #include <kconfigdialog.h>
0012 
0013 #include <QFrame>
0014 #include <QSortFilterProxyModel>
0015 
0016 class QStandardItem;
0017 class QStandardItemModel;
0018 class KStars;
0019 
0020 class SatelliteSortFilterProxyModel : public QSortFilterProxyModel
0021 {
0022   Q_OBJECT
0023 
0024   public:
0025     explicit SatelliteSortFilterProxyModel(QObject *parent);
0026     bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
0027 };
0028 
0029 /**
0030  * @class OpsSatellites
0031  *
0032  * The Satellites Tab of the Options window.  In this Tab the user can configure
0033  * satellites options and select satellites that should be draw
0034  *
0035  * @author Jérôme SONRIER
0036  * @version 1.0
0037  */
0038 class OpsSatellites : public QFrame, public Ui::OpsSatellites
0039 {
0040     Q_OBJECT
0041 
0042   public:
0043     /** Constructor */
0044     OpsSatellites();
0045 
0046     virtual ~OpsSatellites() override = default;
0047 
0048   private:
0049     /** Refresh satellites list */
0050     void updateListView();
0051 
0052     /**
0053      * @brief saveSatellitesList Saves list of checked satellites in the configuration file
0054      */
0055     void saveSatellitesList();
0056 
0057   private slots:
0058     void slotUpdateTLEs();
0059     void slotShowSatellites(bool on);
0060     void slotApply();
0061     void slotCancel();
0062     void slotFilterReg(const QString &);
0063     void slotItemChanged(QStandardItem *);
0064 
0065 private:
0066   KConfigDialog *m_ConfigDialog { nullptr };
0067   QStandardItemModel *m_Model { nullptr };
0068   QSortFilterProxyModel *m_SortModel { nullptr };
0069   bool isDirty { false };
0070 };