Stellarium  0.16.1
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  void savePredictedIridiumFlares();
115 
116 private:
118  void enableSatelliteDataForm(bool enabled);
119  void populateAboutPage();
122  void updateSettingsPage();
125  void populateFilterMenu();
127  void populateSourcesList();
133  void addSpecialGroupItem();
135  void setGroups();
136 
138  void setIridiumFlaresHeaderNames();
139 
141  void initListIridiumFlares();
142 
143  Ui_satellitesDialog* ui;
144  bool satelliteModified;
145 
146  QTimer* updateTimer;
147 
148  SatellitesImportDialog* importWindow;
149 
150  SatellitesListFilterModel* filterModel;
151 
153  Qt::ItemDataRole checkStateRole;
154 
155  QString delimiter, acEndl;
156  QStringList iridiumFlaresHeader;
157 };
158 
159 // Reimplements the QTreeWidgetItem class to fix the sorting bug
160 class SatPIFTreeWidgetItem : public QTreeWidgetItem
161 {
162 public:
163  SatPIFTreeWidgetItem(QTreeWidget* parent)
164  : QTreeWidgetItem(parent)
165  {
166  }
167 
168 private:
169  bool operator < (const QTreeWidgetItem &other) const
170  {
171  int column = treeWidget()->sortColumn();
172 
174  {
175  return text(column).toFloat() < other.text(column).toFloat();
176  }
177  else
178  {
179  return text(column).toLower() < other.text(column).toLower();
180  }
181  }
182 };
183 
184 #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.