Stellarium 0.15.2
SatellitesDialog.hpp
1 /*
2  * Stellarium Satellites Plug-in GUI
3  *
4  * Copyright (C) 2010 Matthew Gates
5  * Copyright (C) 2015 Nick Fedoseev (Iridium flares)
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
20 */
21 
22 #ifndef _SATELLITESDIALOG_HPP_
23 #define _SATELLITESDIALOG_HPP_
24 
25 #include <QObject>
26 #include <QModelIndex>
27 #include <QTreeWidget>
28 #include <QTreeWidgetItem>
29 #include "StelDialog.hpp"
30 #include "Satellites.hpp"
31 
32 class Ui_satellitesDialog;
33 class QCheckBox;
34 class QListWidgetItem;
35 class QSortFilterProxyModel;
36 class QStandardItemModel;
37 class QTimer;
38 
41 
46 {
47  Q_OBJECT
48 
49 public:
53  IridiumFlaresDate,
59  };
60 
63 
64 protected:
66  void createDialogContent();
67 
68 public slots:
69  void retranslate();
70 
71 private slots:
72  void jumpToSourcesTab();
74  void updateCountdown();
77  void filterListByGroup(int index);
83  void updateSatelliteData();
84  void saveSatellites(void);
85  void showUpdateState(Satellites::UpdateState state);
86  void showUpdateCompleted(int updated, int total, int added, int missing);
87 
89 
90  void saveEditedSource();
91  void saveSourceList(void);
92  void deleteSourceRow(void);
93  void addSourceRow(void);
96  void toggleCheckableSources();
98 
99  void restoreDefaults(void);
100  void saveSettings(void);
101  void addSatellites(const TleDataList& newSatellites);
102  void removeSatellites();
104  void setFlags();
106  void handleGroupChanges(QListWidgetItem* item);
108  void trackSatellite(const QModelIndex & index);
109  void setOrbitParams(void);
110  void updateTLEs(void);
111 
112  void predictIridiumFlares();
113  void selectCurrentIridiumFlare(const QModelIndex &modelIndex);
114 
115 private:
117  void enableSatelliteDataForm(bool enabled);
118  void populateAboutPage();
121  void updateSettingsPage();
124  void populateFilterMenu();
126  void populateSourcesList();
132  void addSpecialGroupItem();
134  void setGroups();
135 
137  void setIridiumFlaresHeaderNames();
138 
140  void initListIridiumFlares();
141 
142  Ui_satellitesDialog* ui;
143  bool satelliteModified;
144 
145  QTimer* updateTimer;
146 
147  SatellitesImportDialog* importWindow;
148 
149  SatellitesListFilterModel* filterModel;
150 
152  Qt::ItemDataRole checkStateRole;
153 };
154 
155 // Reimplements the QTreeWidgetItem class to fix the sorting bug
156 class SatPIFTreeWidgetItem : public QTreeWidgetItem
157 {
158 public:
159  SatPIFTreeWidgetItem(QTreeWidget* parent)
160  : QTreeWidgetItem(parent)
161  {
162  }
163 
164 private:
165  bool operator < (const QTreeWidgetItem &other) const
166  {
167  int column = treeWidget()->sortColumn();
168 
170  {
171  return text(column).toFloat() < other.text(column).toFloat();
172  }
173  else
174  {
175  return text(column).toLower() < other.text(column).toLower();
176  }
177  }
178 };
179 
180 #endif // _SATELLITESDIALOG_HPP_
Main configuration window of the Satellites plugin.
void createDialogContent()
Initialize the dialog widgets and connect the signals/slots.
Base class for all the GUI windows in Stellarium.
Definition: StelDialog.hpp:72
UpdateState
Used for keeping track of the download/update status.
Definition: Satellites.hpp:170
Custom proxy model allowing filtering by satellite group and flag.
date and time of Iridium flare
IridiumFlaresColumns
Defines the number and the order of the columns in the Iridium Flares table.