Stellarium 0.15.2
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();
43 
44 protected:
46  virtual void createDialogContent();
47  Ui_locationDialogForm* ui;
48 
49 private:
52  void setFieldsFromLocation(const StelLocation& loc);
53 
55  StelLocation locationFromFields() const;
56 
58  bool isEditingNew;
59 
60  void disconnectEditSignals();
61  void connectEditSignals();
62 
64  void setMapForLocation(const StelLocation& loc);
65 
70  void populatePlanetList();
71 
76  void populateCountryList();
77 
82  void populateTimeZonesList();
83 
84 private slots:
86  void reloadLocations();
87 
89  void reportEdit();
90 
91  void saveTimeZone();
92 
95  void updateFromProgram(const StelLocation& location);
96 
99  void setPositionFromMap(double longitude, double latitude);
100 
102  void setPositionFromList(const QModelIndex& index);
103 
105  void moveToAnotherPlanet(const QString& text);
107  void setPositionFromCoords(int i=0);
108 
110  void addCurrentLocationToList();
111 
113  void deleteCurrentLocationFromList();
114 
116  void filterSitesByCountry();
117 
119  void resetCompleteList();
120 
122  void ipQueryLocation(bool state);
123 
125  void setDefaultLocation(bool state);
126 
128  void updateTimeZoneControls(bool useCustomTimeZone);
129 
130 private:
131  QString lastPlanet;
132  QString customTimeZone;
133  QStringListModel* allModel;
134  QStringListModel* pickedModel;
135  QSortFilterProxyModel *proxyModel;
136 
138  void updateDefaultLocationControls(bool currentIsDefault);
139 
140 };
141 
142 #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.