~ubuntu-branches/debian/jessie/stellarium/jessie

1.2.1 by Ethan Anderson
Import upstream version 0.10.0
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
1.2.7 by Tomasz Buchert
Import upstream version 0.11.2
17
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
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;
1.1.7 by Cédric Delfosse
Import upstream version 0.10.1
28
class StelLocation;
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
29
30
class LocationDialog : public StelDialog
31
{
1.1.7 by Cédric Delfosse
Import upstream version 0.10.1
32
	Q_OBJECT
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
33
public:
1.2.15 by Tomasz Buchert
Import upstream version 0.13.0
34
	LocationDialog(QObject* parent);
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
35
	virtual ~LocationDialog();
36
	//! Notify that the application style changed
37
	void styleChanged();
1.2.6 by Cédric Delfosse
Import upstream version 0.11.0
38
39
public slots:
1.2.7 by Tomasz Buchert
Import upstream version 0.11.2
40
	void retranslate();
1.2.6 by Cédric Delfosse
Import upstream version 0.11.0
41
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
42
protected:
43
	//! Initialize the dialog widgets and connect the signals/slots
44
	virtual void createDialogContent();
45
	Ui_locationDialogForm* ui;
46
	
47
private:
48
	//! Set the values of all the fields from a location info
49
	//! Also move the observer to this position
1.1.7 by Cédric Delfosse
Import upstream version 0.10.1
50
	void setFieldsFromLocation(const StelLocation& loc);
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
51
	
1.1.7 by Cédric Delfosse
Import upstream version 0.10.1
52
	//! Create a StelLocation instance from the fields
53
	StelLocation locationFromFields() const;
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
54
	
55
	//! True if the user is currently editing a new location
56
	bool isEditingNew;
57
	
58
	void disconnectEditSignals();
59
	void connectEditSignals();
60
	
61
	//! Update the map for the given location.
1.1.7 by Cédric Delfosse
Import upstream version 0.10.1
62
	void setMapForLocation(const StelLocation& loc);
1.2.7 by Tomasz Buchert
Import upstream version 0.11.2
63
64
	//! Populates the drop-down list of planets.
65
	//! The displayed names are localized in the current interface language.
66
	//! The original names are kept in the user data field of each QComboBox
67
	//! item.
68
	void populatePlanetList();
69
70
	//! Populates the drop-down list of countries.
71
	//! The displayed names are localized in the current interface language.
72
	//! The original names are kept in the user data field of each QComboBox
73
	//! item.
74
	void populateCountryList();
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
75
	
76
private slots:
1.2.9 by Tomasz Buchert
Import upstream version 0.11.4a
77
	//! To be called when user edits any field
78
	void reportEdit();
79
	
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
80
	//! Update the widget to make sure it is synchrone if the location is changed programmatically
81
	//! This function should be called repeatidly with e.g. a timer
1.2.9 by Tomasz Buchert
Import upstream version 0.11.4a
82
	void updateFromProgram(const StelLocation& location);
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
83
	
1.2.9 by Tomasz Buchert
Import upstream version 0.11.4a
84
	//! Called when the map is clicked.
1.2.16 by Tomasz Buchert
Import upstream version 0.13.1
85
	//! GZ_New: create new list for places nearby and feed into location list box.
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
86
	void setPositionFromMap(double longitude, double latitude);
87
	
1.2.9 by Tomasz Buchert
Import upstream version 0.11.4a
88
	//! Called when the user activates an item from the locations list.
89
	void setPositionFromList(const QModelIndex& index);
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
90
	
1.2.9 by Tomasz Buchert
Import upstream version 0.11.4a
91
	//! Called when the planet is manually changed.
92
	void moveToAnotherPlanet(const QString& text);
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
93
	//! Called when latitude/longitude/altitude is modified
1.2.9 by Tomasz Buchert
Import upstream version 0.11.4a
94
	void setPositionFromCoords(int i=0);
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
95
	
1.2.9 by Tomasz Buchert
Import upstream version 0.11.4a
96
	//! Called when the user clicks on the add to list button
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
97
	void addCurrentLocationToList();
98
	
1.2.9 by Tomasz Buchert
Import upstream version 0.11.4a
99
	//! Called when the user clicks on the delete button
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
100
	void deleteCurrentLocationFromList();
1.2.16 by Tomasz Buchert
Import upstream version 0.13.1
101
102
	//! filter city list to show entries from single country only
103
	void filterSitesByCountry();
104
105
	//! reset city list to complete list (may have been reduced to picked list)
106
	void resetCompleteList();
107
108
	//! called when the user wants get location from network
109
	void ipQueryLocation(bool state);
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
110
	
111
	//! Called when the user wants to use the current location as default
1.2.16 by Tomasz Buchert
Import upstream version 0.13.1
112
	void setDefaultLocation(bool state);
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
113
	
114
private:
1.2.15 by Tomasz Buchert
Import upstream version 0.13.0
115
	QString lastPlanet;
1.2.9 by Tomasz Buchert
Import upstream version 0.11.4a
116
	//! Updates the check state and the enabled/disabled status.
117
	void updateDefaultLocationControls(bool currentIsDefault);
1.2.1 by Ethan Anderson
Import upstream version 0.10.0
118
};
119
120
#endif // _LOCATIONDIALOG_HPP_