Stellarium  0.16.1
LocationDialog.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2008 Guillaume Chereau
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18 */
19 
20 #ifndef _LOCATIONDIALOG_HPP_
21 #define _LOCATIONDIALOG_HPP_
22 
23 #include <QObject>
24 #include "StelDialog.hpp"
25 
26 class Ui_locationDialogForm;
27 class QModelIndex;
28 class QSortFilterProxyModel;
29 class QStringListModel;
30 class StelLocation;
31 
32 class LocationDialog : public StelDialog
33 {
34  Q_OBJECT
35 public:
36  LocationDialog(QObject* parent);
37  virtual ~LocationDialog();
39  void styleChanged();
40 
41 public slots:
42  void retranslate();
44  virtual void handleDialogSizeChanged(QSizeF size);
45 protected:
47  virtual void createDialogContent();
48  Ui_locationDialogForm* ui;
49 
50 private:
53  void setFieldsFromLocation(const StelLocation& loc);
54 
56  StelLocation locationFromFields() const;
57 
59  bool isEditingNew;
60 
61  void disconnectEditSignals();
62  void connectEditSignals();
63 
65  void setMapForLocation(const StelLocation& loc);
66 
71  void populatePlanetList();
72 
77  void populateCountryList();
78 
83  void populateTimeZonesList();
84 
85 private slots:
87  void reloadLocations();
88 
90  void reportEdit();
91 
92  void saveTimeZone();
93 
96  void updateFromProgram(const StelLocation& location);
97 
100  void setPositionFromMap(double longitude, double latitude);
101 
103  void setPositionFromList(const QModelIndex& index);
104 
106  void moveToAnotherPlanet(const QString& text);
107 
110  void setPositionFromCoords(int i=0);
111 
113  void addCurrentLocationToList();
114 
116  void deleteCurrentLocationFromList();
117 
119  void filterSitesByCountry();
120 
122  void resetCompleteList();
123 
129  void ipQueryLocation(bool state);
130 
131 #ifdef ENABLE_GPS
132  void gpsQueryLocation();
138  void gpsReturn(bool success);
140  void resetGPSbuttonLabel();
141 #endif
142 
144  void setDefaultLocation(bool state);
145 
147  void updateTimeZoneControls(bool useCustomTimeZone);
148 
149 private:
150  QString lastPlanet;
151  QString customTimeZone;
152  QStringListModel* allModel;
153  QStringListModel* pickedModel;
154  QSortFilterProxyModel *proxyModel;
155 
157  void updateDefaultLocationControls(bool currentIsDefault);
158 
159 };
160 
161 #endif // _LOCATIONDIALOG_HPP_
Store the informations for a location on a planet.
void styleChanged()
Notify that the application style changed.
Base class for all the GUI windows in Stellarium.
Definition: StelDialog.hpp:72
virtual void createDialogContent()
Initialize the dialog widgets and connect the signals/slots.
virtual void handleDialogSizeChanged(QSizeF size)
In addition to StelDialog&#39;s inherited solution, puts the arrow on the right spot in the map...