Merge lp:~stellarium/stellarium/tz into lp:stellarium

Proposed by Alexander Wolf
Status: Merged
Merged at revision: 8767
Proposed branch: lp:~stellarium/stellarium/tz
Merge into: lp:stellarium
Diff against target: 4888 lines (+670/-3318)
38 files modified
CMakeLists.txt (+0/-1)
cmake/default_config.ini.cmake (+0/-1)
data/gui/normalStyle.css (+6/-1)
data/zone.tab (+0/-399)
plugins/EquationOfTime/CMakeLists.txt (+1/-1)
plugins/EquationOfTime/src/EquationOfTime.cpp (+1/-42)
plugins/EquationOfTime/src/EquationOfTime.hpp (+0/-6)
plugins/Observability/src/Observability.cpp (+1/-2)
plugins/RemoteControl/src/MainService.cpp (+1/-1)
plugins/Satellites/src/Satellites.cpp (+1/-1)
plugins/Satellites/src/gui/SatellitesDialog.cpp (+1/-1)
plugins/TimeZoneConfiguration/CMakeLists.txt (+0/-19)
plugins/TimeZoneConfiguration/src/CMakeLists.txt (+0/-35)
plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.cpp (+0/-127)
plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.hpp (+0/-82)
plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.cpp (+0/-541)
plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.hpp (+0/-73)
plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.cpp (+0/-285)
plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.hpp (+0/-82)
plugins/TimeZoneConfiguration/src/gui/defineTimeZone.ui (+0/-621)
plugins/TimeZoneConfiguration/src/gui/timeZoneConfigurationWindow.ui (+0/-585)
po/stellarium/POTFILES.in (+0/-5)
src/core/StelApp.cpp (+0/-4)
src/core/StelCore.cpp (+118/-4)
src/core/StelCore.hpp (+17/-1)
src/core/StelLocaleMgr.cpp (+34/-93)
src/core/StelLocaleMgr.hpp (+4/-39)
src/core/StelLocationMgr.cpp (+2/-0)
src/gui/AstroCalcDialog.cpp (+12/-11)
src/gui/BookmarksDialog.cpp (+2/-2)
src/gui/ConfigurationDialog.cpp (+1/-1)
src/gui/DateTimeDialog.cpp (+5/-4)
src/gui/LocationDialog.cpp (+114/-3)
src/gui/LocationDialog.hpp (+14/-1)
src/gui/StelGuiItems.cpp (+14/-2)
src/gui/configurationDialog.ui (+94/-70)
src/gui/locationDialogGui.ui (+226/-171)
src/scripting/StelMainScriptAPI.cpp (+1/-1)
To merge this branch: bzr merge lp:~stellarium/stellarium/tz
Reviewer Review Type Date Requested Status
gzotti Approve
Alexander Wolf Needs Information
Review via email: mp+309092@code.launchpad.net

Description of the change

Added time zone support

To post a comment you must log in.
Revision history for this message
Alexander Wolf (alexwolf) wrote :

I've removed Time Zone plugin but maybe I should restore him and use him for management really custom rules for time zone and DST?

review: Needs Information
Revision history for this message
gzotti (georg-zotti) wrote :

I very much welcome a thorough re-work on the timezone issues, the many bug and wishlist items speak for themselves.

I had no time for a thorough test so far. Do you want to merge now and run public testing for a few weeks on the new trunk betas (and of course fix a few rounds in trunk), or have some testers on this branch and merge only when all is done? Can you publish betas from this branch?

I think some extra TZ settings options can be built into the main program's location panel. (This can become a bit larger. Also the map is very small on FullHD and higher-resolution screens.) There is no use to have a plugin when you must have it activated anyway for really basic operations. The configuration panel is more easily reached in this way.

Some things that can hopefully solved with IANA's TZ database:
DST rules for "Continent/City" timezones. In various countries, DST was introduced at some point in the 20th century. (e.g. WW1, WW2, energy crisis in the 1970s). It would be great if all times can be produced here.
Timezones were introduced around 1886, but not everywhere. Some standardisations were available previously (e.g. Railway time). The current 1886 limit may need a second thought.

Some useful options:
Have a tick (default=active) "System Defaults". This uses time zone of configured location.
Use system settings, but disable DST.
Set timezone as UT offset (15 minute steps)
Use Local Mean Solar Time. This should be default until 1885 (or we find some other meaningful date?).
Use Local True Solar Time (i.e. also add Equation of Time!) This may be useful for historical research. LTST use should be marked somehow in the bottom bar.

In any case, UT+HH:MM should be visible in the bottom toolbar like it is now. Maybe print TZ name or "LMST" in addition?

lp:~stellarium/stellarium/tz updated
8775. By Alexander Wolf

Updates and improvements

Revision history for this message
Alexander Wolf (alexwolf) wrote :

I prefer merge it in trunk and allow to testing it by wide circle of users.

I've added LTST also and allows to enabling/disabling DST.

Adding of full list of all exists time zones is... difficult, because in this case we should implement own tool to manage all them.

Please check last changes.

lp:~stellarium/stellarium/tz updated
8776. By Alexander Wolf

Cosmetic fixes

8777. By Alexander Wolf

Cosmetic fix

8778. By Alexander Wolf

Another cosmetic fix - let's hide combobox for TZ when we use time zones from locations

Revision history for this message
gzotti (georg-zotti) wrote :

LTST is great! However, it should be marked in the bottom status line, else just UT+HH:MM looks like LMST. ALso, the last change, hiding the combobox, is more confusing than helpful. I suggest the timezone combo should be visible (so that you can see what has been found for the city), but unclickable when time from location is active.

When I switch from LMST back to zone time (or activate default) it seems the LMST longitude offset is not set back, or even all auto-zone lookup fails, it seems to keep LMST offset when I select a city.

Disabling DST seems OK for now.

review: Needs Fixing
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Please use tooltip with info for LMST/LTST and current time zone name. Or you meant that I should remove UTC+XX:XX data and use LMST/LTST instead?

I'll check switching from LMST - it should be work correct.

Revision history for this message
Alexander Wolf (alexwolf) wrote :

I can introduce additional UTC+XX:XX time zones with 15-min. step also - should be the range UTC-12:00 -- UTC+12:00?

Revision history for this message
gzotti (georg-zotti) wrote :

Don't forget that tooltips sometimes don't work. Win7/NVidia OpenGL frequently just has no tooltips. (This was my default until recently!)

Optimal would be to see "UT+HH:MM", "UT+HH:MM (LMST)" or "UT+HH:MM (LTST)"

Revision history for this message
gzotti (georg-zotti) wrote :

> I can introduce additional UTC+XX:XX time zones with 15-min. step also -
> should be the range UTC-12:00 -- UTC+12:00?

According to https://en.wikipedia.org/wiki/Time_zone#Offsets_from_UTC
this should even go up to UT+14:00.
Not sure: Half-hour offsets seem frequent, but there are only very few 15-min offsets (Nepal, Australia). Make all, or only the particular actually existing zones? Can you filter the existing zone offsets from the IANA list?

Revision history for this message
Alexander Wolf (alexwolf) wrote :

OK for the tooltip problem.

For time zones in format UTC+HH:MM - we are have them in this format already. Please see bottom of the list.

Revision history for this message
gzotti (georg-zotti) wrote :

Ah yes. OK, Zone list seems complete.

When I am in "Custom zone" mode and select a zone, then disable custom zone, the combo is hidden and correct zone is used. When I then select a neighbour town, it goes back to some other zone. Not even the previously selected!

Example: I set Vienna, but custom zone America/Indianapolis, deselected custom zone (came back to Europe/Vienna), selected some location in Poland, and we were in zone America/Bogota. I see the zone offset in the status bar and zone name in the tooltip, OK. But custom timezone is disabled, so we should correctly be in Europe/Warsaw! I would prefer to see the combobox, just disabled, for reference, and of course correct zone lookup when custom time zone is disabled.

lp:~stellarium/stellarium/tz updated
8779. By Alexander Wolf

Cosmetic fixes

8780. By Alexander Wolf

Cosmetic fix

Revision history for this message
Alexander Wolf (alexwolf) wrote :

Please check it again.

Revision history for this message
gzotti (georg-zotti) wrote :

New observations: Immediately after start, tooltip timezone string is not set under some circumstances. Yes, when ini:localisation:time_zone is missing because it is set to default.

I call the location panel. custom timezone disabled, DST enabled. Displayed time zone: Local Mean Solar Time. This is wrong. It could be UTC+2:00?
Still my time is correctly displayed as UTC+2:00, not LMST.
When I click on my city in the list, all is OK.
This may have to do with an "unnamed" location (just long/Lat). My startup location is not in the site list. Maybe better always store time_zone?

The "Bogota" problem is however solved. ... No, now sometimes it's the other way! Custom tz disabled, I select a city, and TZ goes to previously selected Europe/Vienna. I have to enable custom zone and disable it again to switch to the correct one. I have not found a pattern yet to trigger this confusing behaviour.

When I click a location on the map, accurate country-based timezone is not found automatically, of course. But you could simply suggest a UT+XX zone from Longitude/15, this should fit a first guess.

I have auto-location from IP query disabled. Does this also deliver a timezone?

Maybe add the longitude time offset (LMST) and equation of time value (LTST) in the tooltip? My preference would be "UT+HH:MM", "UT+HH:MM (LMST)" or "UT+HH:MM (LTST)" in the time string directly (avoid problems with tooltips not working).

review: Needs Fixing
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Sorry, but your location was defined by user and he don't have info about time zone - LMST is good solution for guessing here. It's correct behaviour.

>My startup location is not in the site list. Maybe better always store time_zone?

No, because this will cause the old behaviour but with new mistakes.

> I have auto-location from IP query disabled. Does this also deliver a timezone?

Yes.

> My preference would be "UT+HH:MM", "UT+HH:MM (LMST)" or "UT+HH:MM (LTST)"

Please give use case, when it may be useful.

lp:~stellarium/stellarium/tz updated
8781. By Alexander Wolf

Cosmetic fix

8782. By Alexander Wolf

fixed stupid bug

8783. By Alexander Wolf

added alias 'auto' for LMST

Revision history for this message
Alexander Wolf (alexwolf) wrote :

Please check it again.

Revision history for this message
gzotti (georg-zotti) wrote :

> Sorry, but your location was defined by user and he don't have info about time
> zone - LMST is good solution for guessing here. It's correct behaviour.
>
> >My startup location is not in the site list. Maybe better always store
> time_zone?
>
> No, because this will cause the old behaviour but with new mistakes.

I expect tons of misunderstanding. But this is what user testing is all about, let's see then how useful it feels after a few weeks.

> > My preference would be "UT+HH:MM", "UT+HH:MM (LMST)" or "UT+HH:MM (LTST)"
>
> Please give use case, when it may be useful.

Where is it not useful? This mode is mostly for users with advanced requirements (but not necessarily expert astronomers, but maybe historians of science) who understand the difference but e.g. want to be sure it is computed correctly, they don't make a mistake in their thoughts, or want to explain the difference to others.

Revision history for this message
Alexander Wolf (alexwolf) wrote :

Well, let's try public testing :)

Revision history for this message
gzotti (georg-zotti) wrote :

When I go back to my stored location, "Use custom timezone" is disabled, but the correct TZ shown.
After restarting Stellarium, you are using correct UT+2, but location panel indicates LMST.
This is confusing. I had stored a location with custom TZ Europe/Vienna plus active DST (resulting in UTC+2). However, after reverting to default location the previously stored TZ is not again stored in config.ini, so I assume the UTC+2 comes from system settings. Still, the location panel shows LMST.

Maybe you must remember custom time zone from startup to be able to reset properly to startup location/TZ.

LMST/LTST display is fine now!

OK, I expect some user questions/complaints about some inconsistent behaviour which I described until this is fixed, but else I agree this is (going to be) much better user experience than the previous plugin-based TZ handling which required program restart. So this is the way to proceed, and yes for public testing!

review: Approve
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Please send me your user_locations.txt file for playing.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-10-14 14:15:29 +0000
+++ CMakeLists.txt 2016-10-25 16:10:21 +0000
@@ -254,7 +254,6 @@
254ADD_PLUGIN(Supernovae 1)254ADD_PLUGIN(Supernovae 1)
255ADD_PLUGIN(TextUserInterface 1)255ADD_PLUGIN(TextUserInterface 1)
256ADD_PLUGIN(TelescopeControl 1)256ADD_PLUGIN(TelescopeControl 1)
257ADD_PLUGIN(TimeZoneConfiguration 1)
258257
259########## Static plugins need to define includes and libraries258########## Static plugins need to define includes and libraries
260########## for the compilation of Stellarium itself259########## for the compilation of Stellarium itself
261260
=== modified file 'cmake/default_config.ini.cmake'
--- cmake/default_config.ini.cmake 2016-10-10 13:50:34 +0000
+++ cmake/default_config.ini.cmake 2016-10-25 16:10:21 +0000
@@ -55,7 +55,6 @@
55sky_culture = western55sky_culture = western
56sky_locale = system56sky_locale = system
57app_locale = system57app_locale = system
58time_zone = system_default
59time_display_format = system_default58time_display_format = system_default
60date_display_format = yyyymmdd59date_display_format = yyyymmdd
6160
6261
=== modified file 'data/gui/normalStyle.css'
--- data/gui/normalStyle.css 2015-09-03 21:24:13 +0000
+++ data/gui/normalStyle.css 2016-10-25 16:10:21 +0000
@@ -230,7 +230,7 @@
230 background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(183, 184, 185), stop: 1 rgb(111, 113, 114));230 background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(183, 184, 185), stop: 1 rgb(111, 113, 114));
231}231}
232232
233QPushButton::Disabled {233QPushButton::disabled {
234 color: #f0f0f0;234 color: #f0f0f0;
235}235}
236236
@@ -718,6 +718,11 @@
718 padding-left: 3px;718 padding-left: 3px;
719}719}
720720
721QComboBox:disabled, QSpinBox:disabled {
722 color: #f0f0f0;
723}
724
725
721QProgressBar {726QProgressBar {
722 border: 1px solid rgba(102, 102, 128, 50%);727 border: 1px solid rgba(102, 102, 128, 50%);
723 border-radius: 2px;728 border-radius: 2px;
724729
=== removed file 'data/zone.tab'
--- data/zone.tab 2005-03-11 01:52:16 +0000
+++ data/zone.tab 1970-01-01 00:00:00 +0000
@@ -1,399 +0,0 @@
1# @(#)zone.tab 1.27
2#
3# TZ zone descriptions
4#
5# From Paul Eggert <eggert@twinsun.com> (1996-08-05):
6#
7# This file contains a table with the following columns:
8# 1. ISO 3166 2-character country code. See the file `iso3166.tab'.
9# 2. Latitude and longitude of the zone's principal location
10# in ISO 6709 sign-degrees-minutes-seconds format,
11# either +-DDMM+-DDDMM or +-DDMMSS+-DDDMMSS,
12# first latitude (+ is north), then longitude (+ is east).
13# 3. Zone name used in value of TZ environment variable.
14# 4. Comments; present if and only if the country has multiple rows.
15#
16# Columns are separated by a single tab.
17# The table is sorted first by country, then an order within the country that
18# (1) makes some geographical sense, and
19# (2) puts the most populous zones first, where that does not contradict (1).
20#
21# Lines beginning with `#' are comments.
22#
23#country-
24#code coordinates TZ comments
25AD +4230+00131 Europe/Andorra
26AE +2518+05518 Asia/Dubai
27AF +3431+06912 Asia/Kabul
28AG +1703-06148 America/Antigua
29AI +1812-06304 America/Anguilla
30AL +4120+01950 Europe/Tirane
31AM +4011+04430 Asia/Yerevan
32AN +1211-06900 America/Curacao
33AO -0848+01314 Africa/Luanda
34AQ -7750+16636 Antarctica/McMurdo McMurdo Station, Ross Island
35AQ -9000+00000 Antarctica/South_Pole Amundsen-Scott Station, South Pole
36AQ -6448-06406 Antarctica/Palmer Palmer Station, Anvers Island
37AQ -6736+06253 Antarctica/Mawson Mawson Station, Holme Bay
38AQ -6835+07758 Antarctica/Davis Davis Station, Vestfold Hills
39AQ -6617+11031 Antarctica/Casey Casey Station, Bailey Peninsula
40AQ -7824+10654 Antarctica/Vostok Vostok Station, S Magnetic Pole
41AQ -6640+14001 Antarctica/DumontDUrville Dumont-d'Urville Base, Terre Adelie
42AQ -690022+0393524 Antarctica/Syowa Syowa Station, E Ongul I
43AR -3436-05827 America/Buenos_Aires E Argentina (BA, DF, SC, TF)
44AR -3124-06411 America/Cordoba most locations (CB,CC,CH,CN,ER,FM,LP,LR,MN,NQ,RN,SA,SE,SF,SJ,SL,TM)
45AR -2411-06518 America/Jujuy Jujuy (JY)
46AR -2828-06547 America/Catamarca Catamarca (CT)
47AR -3253-06849 America/Mendoza Mendoza (MZ)
48AS -1416-17042 Pacific/Pago_Pago
49AT +4813+01620 Europe/Vienna
50AU -3133+15905 Australia/Lord_Howe Lord Howe Island
51AU -4253+14719 Australia/Hobart Tasmania
52AU -3749+14458 Australia/Melbourne Victoria
53AU -3352+15113 Australia/Sydney New South Wales - most locations
54AU -3157+14127 Australia/Broken_Hill New South Wales - Yancowinna
55AU -2728+15302 Australia/Brisbane Queensland - most locations
56AU -2016+14900 Australia/Lindeman Queensland - Holiday Islands
57AU -3455+13835 Australia/Adelaide South Australia
58AU -1228+13050 Australia/Darwin Northern Territory
59AU -3157+11551 Australia/Perth Western Australia
60AW +1230-06858 America/Aruba
61AZ +4023+04951 Asia/Baku
62BA +4352+01825 Europe/Sarajevo
63BB +1306-05937 America/Barbados
64BD +2343+09025 Asia/Dhaka
65BE +5050+00420 Europe/Brussels
66BF +1222-00131 Africa/Ouagadougou
67BG +4241+02319 Europe/Sofia
68BH +2623+05035 Asia/Bahrain
69BI -0323+02922 Africa/Bujumbura
70BJ +0629+00237 Africa/Porto-Novo
71BM +3217-06446 Atlantic/Bermuda
72BN +0456+11455 Asia/Brunei
73BO -1630-06809 America/La_Paz
74BR -0351-03225 America/Noronha Atlantic islands
75BR -0127-04829 America/Belem Amapa, E Para
76BR -0343-03830 America/Fortaleza NE Brazil (MA, PI, CE, RN, PR)
77BR -0803-03454 America/Recife Pernambuco
78BR -0712-04812 America/Araguaina Tocantins
79BR -0940-03543 America/Maceio Alagoas, Sergipe
80BR -2332-04637 America/Sao_Paulo S & SE Brazil (BA, GO, DF, MG, ES, RJ, SP, PR, SC, RS)
81BR -1535-05605 America/Cuiaba Mato Grosso, Mato Grosso do Sul
82BR -0846-06354 America/Porto_Velho W Para, Rondonia
83BR +0249-06040 America/Boa_Vista Roraima
84BR -0308-06001 America/Manaus E Amazonas
85BR -0640-06952 America/Eirunepe W Amazonas
86BR -0958-06748 America/Rio_Branco Acre
87BS +2505-07721 America/Nassau
88BT +2728+08939 Asia/Thimphu
89BW -2545+02555 Africa/Gaborone
90BY +5354+02734 Europe/Minsk
91BZ +1730-08812 America/Belize
92CA +4734-05243 America/St_Johns Newfoundland Island
93CA +4439-06336 America/Halifax Atlantic Time - Nova Scotia (most places), NB, W Labrador, E Quebec & PEI
94CA +4612-05957 America/Glace_Bay Atlantic Time - Nova Scotia - places that did not observe DST 1966-1971
95CA +5320-06025 America/Goose_Bay Atlantic Time - E Labrador
96CA +4531-07334 America/Montreal Eastern Time - Ontario & Quebec - most locations
97CA +4901-08816 America/Nipigon Eastern Time - Ontario & Quebec - places that did not observe DST 1967-1973
98CA +4823-08915 America/Thunder_Bay Eastern Time - Thunder Bay, Ontario
99CA +6608-06544 America/Pangnirtung Eastern Standard Time - Pangnirtung, Nunavut
100CA +6344-06828 America/Iqaluit Eastern Standard Time - east Nunavut
101CA +6245-09210 America/Rankin_Inlet Eastern Standard Time - central Nunavut
102CA +4953-09709 America/Winnipeg Central Time - Manitoba & west Ontario
103CA +4843-09429 America/Rainy_River Central Time - Rainy River & Fort Frances, Ontario
104CA +6903-10505 America/Cambridge_Bay Central Time - west Nunavut
105CA +5024-10439 America/Regina Central Standard Time - Saskatchewan - most locations
106CA +5017-10750 America/Swift_Current Central Standard Time - Saskatchewan - midwest
107CA +5333-11328 America/Edmonton Mountain Time - Alberta, east British Columbia & west Saskatchewan
108CA +6227-11421 America/Yellowknife Mountain Time - central Northwest Territories
109CA +6825-11330 America/Inuvik Mountain Time - west Northwest Territories
110CA +5946-12014 America/Dawson_Creek Mountain Standard Time - Dawson Creek & Fort Saint John, British Columbia
111CA +4916-12307 America/Vancouver Pacific Time - west British Columbia
112CA +6043-13503 America/Whitehorse Pacific Time - south Yukon
113CA +6404-13925 America/Dawson Pacific Time - north Yukon
114CC -1210+09655 Indian/Cocos
115CD -0418+01518 Africa/Kinshasa west Dem. Rep. of Congo
116CD -1140+02728 Africa/Lubumbashi east Dem. Rep. of Congo
117CF +0422+01835 Africa/Bangui
118CG -0416+01517 Africa/Brazzaville
119CH +4723+00832 Europe/Zurich
120CI +0519-00402 Africa/Abidjan
121CK -2114-15946 Pacific/Rarotonga
122CL -3327-07040 America/Santiago most locations
123CL -2710-10927 Pacific/Easter Easter Island & Sala y Gomez
124CM +0403+00942 Africa/Douala
125CN +3114+12128 Asia/Shanghai east China - Beijing, Guangdong, Shanghai, etc.
126CN +4545+12641 Asia/Harbin Heilongjiang
127CN +2934+10635 Asia/Chongqing central China - Gansu, Guizhou, Sichuan, Yunnan, etc.
128CN +4348+08735 Asia/Urumqi Tibet & most of Xinjiang Uyghur
129CN +3929+07559 Asia/Kashgar southwest Xinjiang Uyghur
130CO +0436-07405 America/Bogota
131CR +0956-08405 America/Costa_Rica
132CU +2308-08222 America/Havana
133CV +1455-02331 Atlantic/Cape_Verde
134CX -1025+10543 Indian/Christmas
135CY +3510+03322 Asia/Nicosia
136CZ +5005+01426 Europe/Prague
137DE +5230+01322 Europe/Berlin
138DJ +1136+04309 Africa/Djibouti
139DK +5540+01235 Europe/Copenhagen
140DM +1518-06124 America/Dominica
141DO +1828-06954 America/Santo_Domingo
142DZ +3647+00303 Africa/Algiers
143EC -0210-07950 America/Guayaquil mainland
144EC -0054-08936 Pacific/Galapagos Galapagos Islands
145EE +5925+02445 Europe/Tallinn
146EG +3003+03115 Africa/Cairo
147EH +2709-01312 Africa/El_Aaiun
148ER +1520+03853 Africa/Asmera
149ES +4024-00341 Europe/Madrid mainland
150ES +3553-00519 Africa/Ceuta Ceuta & Melilla
151ES +2806-01524 Atlantic/Canary Canary Islands
152ET +0902+03842 Africa/Addis_Ababa
153FI +6010+02458 Europe/Helsinki
154FJ -1808+17825 Pacific/Fiji
155FK -5142-05751 Atlantic/Stanley
156FM +0931+13808 Pacific/Yap Yap
157FM +0725+15147 Pacific/Truk Truk (Chuuk)
158FM +0658+15813 Pacific/Ponape Ponape (Pohnpei)
159FM +0519+16259 Pacific/Kosrae Kosrae
160FO +6201-00646 Atlantic/Faeroe
161FR +4852+00220 Europe/Paris
162GA +0023+00927 Africa/Libreville
163GB +512830-0001845 Europe/London Great Britain
164GB +5435-00555 Europe/Belfast Northern Ireland
165GD +1203-06145 America/Grenada
166GE +4143+04449 Asia/Tbilisi
167GF +0456-05220 America/Cayenne
168GH +0533-00013 Africa/Accra
169GI +3608-00521 Europe/Gibraltar
170GL +6411-05144 America/Godthab most locations
171GL +7646-01840 America/Danmarkshavn east coast, north of Scoresbysund
172GL +7030-02215 America/Scoresbysund Scoresbysund / Ittoqqortoormiit
173GL +7634-06847 America/Thule Thule / Pituffik
174GM +1328-01639 Africa/Banjul
175GN +0931-01343 Africa/Conakry
176GP +1614-06132 America/Guadeloupe
177GQ +0345+00847 Africa/Malabo
178GR +3758+02343 Europe/Athens
179GS -5416-03632 Atlantic/South_Georgia
180GT +1438-09031 America/Guatemala
181GU +1328+14445 Pacific/Guam
182GW +1151-01535 Africa/Bissau
183GY +0648-05810 America/Guyana
184HK +2217+11409 Asia/Hong_Kong
185HN +1406-08713 America/Tegucigalpa
186HR +4548+01558 Europe/Zagreb
187HT +1832-07220 America/Port-au-Prince
188HU +4730+01905 Europe/Budapest
189ID -0610+10648 Asia/Jakarta Java & Sumatra
190ID -0002+10920 Asia/Pontianak west & central Borneo
191ID -0507+11924 Asia/Makassar east & south Borneo, Celebes, Bali, Nusa Tengarra, west Timor
192ID -0232+14042 Asia/Jayapura Irian Jaya & the Moluccas
193IE +5320-00615 Europe/Dublin
194IL +3146+03514 Asia/Jerusalem
195IN +2232+08822 Asia/Calcutta
196IO -0720+07225 Indian/Chagos
197IQ +3321+04425 Asia/Baghdad
198IR +3540+05126 Asia/Tehran
199IS +6409-02151 Atlantic/Reykjavik
200IT +4154+01229 Europe/Rome
201JM +1800-07648 America/Jamaica
202JO +3157+03556 Asia/Amman
203JP +353916+1394441 Asia/Tokyo
204KE -0117+03649 Africa/Nairobi
205KG +4254+07436 Asia/Bishkek
206KH +1133+10455 Asia/Phnom_Penh
207KI +0125+17300 Pacific/Tarawa Gilbert Islands
208KI -0308-17105 Pacific/Enderbury Phoenix Islands
209KI +0152-15720 Pacific/Kiritimati Line Islands
210KM -1141+04316 Indian/Comoro
211KN +1718-06243 America/St_Kitts
212KP +3901+12545 Asia/Pyongyang
213KR +3733+12658 Asia/Seoul
214KW +2920+04759 Asia/Kuwait
215KY +1918-08123 America/Cayman
216KZ +4315+07657 Asia/Almaty most locations
217KZ +4448+06528 Asia/Qyzylorda Qyzylorda (Kyzylorda, Kzyl-Orda)
218KZ +5017+05710 Asia/Aqtobe Aqtobe (Aktobe)
219KZ +4431+05016 Asia/Aqtau Atyrau (Atirau, Gur'yev), Mangghystau (Mankistau)
220KZ +5113+05121 Asia/Oral West Kazakhstan
221LA +1758+10236 Asia/Vientiane
222LB +3353+03530 Asia/Beirut
223LC +1401-06100 America/St_Lucia
224LI +4709+00931 Europe/Vaduz
225LK +0656+07951 Asia/Colombo
226LR +0618-01047 Africa/Monrovia
227LS -2928+02730 Africa/Maseru
228LT +5441+02519 Europe/Vilnius
229LU +4936+00609 Europe/Luxembourg
230LV +5657+02406 Europe/Riga
231LY +3254+01311 Africa/Tripoli
232MA +3339-00735 Africa/Casablanca
233MC +4342+00723 Europe/Monaco
234MD +4700+02850 Europe/Chisinau
235MG -1855+04731 Indian/Antananarivo
236MH +0709+17112 Pacific/Majuro most locations
237MH +0905+16720 Pacific/Kwajalein Kwajalein
238MK +4159+02126 Europe/Skopje
239ML +1239-00800 Africa/Bamako southwest Mali
240ML +1446-00301 Africa/Timbuktu northeast Mali
241MM +1647+09610 Asia/Rangoon
242MN +4755+10653 Asia/Ulaanbaatar most locations
243MN +4801+09139 Asia/Hovd Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan
244MN +4804+11430 Asia/Choibalsan Dornod, Sukhbaatar
245MO +2214+11335 Asia/Macau
246MP +1512+14545 Pacific/Saipan
247MQ +1436-06105 America/Martinique
248MR +1806-01557 Africa/Nouakchott
249MS +1644-06213 America/Montserrat
250MT +3554+01431 Europe/Malta
251MU -2010+05730 Indian/Mauritius
252MV +0410+07330 Indian/Maldives
253MW -1547+03500 Africa/Blantyre
254MX +1924-09909 America/Mexico_City Central Time - most locations
255MX +2105-08646 America/Cancun Central Time - Quintana Roo
256MX +2058-08937 America/Merida Central Time - Campeche, Yucatan
257MX +2540-10019 America/Monterrey Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas
258MX +2313-10625 America/Mazatlan Mountain Time - S Baja, Nayarit, Sinaloa
259MX +2838-10605 America/Chihuahua Mountain Time - Chihuahua
260MX +2904-11058 America/Hermosillo Mountain Standard Time - Sonora
261MX +3232-11701 America/Tijuana Pacific Time
262MY +0310+10142 Asia/Kuala_Lumpur peninsular Malaysia
263MY +0133+11020 Asia/Kuching Sabah & Sarawak
264MZ -2558+03235 Africa/Maputo
265NA -2234+01706 Africa/Windhoek
266NC -2216+16530 Pacific/Noumea
267NE +1331+00207 Africa/Niamey
268NF -2903+16758 Pacific/Norfolk
269NG +0627+00324 Africa/Lagos
270NI +1209-08617 America/Managua
271NL +5222+00454 Europe/Amsterdam
272NO +5955+01045 Europe/Oslo
273NP +2743+08519 Asia/Katmandu
274NR -0031+16655 Pacific/Nauru
275NU -1901+16955 Pacific/Niue
276NZ -3652+17446 Pacific/Auckland most locations
277NZ -4355-17630 Pacific/Chatham Chatham Islands
278OM +2336+05835 Asia/Muscat
279PA +0858-07932 America/Panama
280PE -1203-07703 America/Lima
281PF -1732-14934 Pacific/Tahiti Society Islands
282PF -0900-13930 Pacific/Marquesas Marquesas Islands
283PF -2308-13457 Pacific/Gambier Gambier Islands
284PG -0930+14710 Pacific/Port_Moresby
285PH +1435+12100 Asia/Manila
286PK +2452+06703 Asia/Karachi
287PL +5215+02100 Europe/Warsaw
288PM +4703-05620 America/Miquelon
289PN -2504-13005 Pacific/Pitcairn
290PR +182806-0660622 America/Puerto_Rico
291PS +3130+03428 Asia/Gaza
292PT +3843-00908 Europe/Lisbon mainland
293PT +3238-01654 Atlantic/Madeira Madeira Islands
294PT +3744-02540 Atlantic/Azores Azores
295PW +0720+13429 Pacific/Palau
296PY -2516-05740 America/Asuncion
297QA +2517+05132 Asia/Qatar
298RE -2052+05528 Indian/Reunion
299RO +4426+02606 Europe/Bucharest
300RU +5443+02030 Europe/Kaliningrad Moscow-01 - Kaliningrad
301RU +5545+03735 Europe/Moscow Moscow+00 - west Russia
302RU +5312+05009 Europe/Samara Moscow+01 - Caspian Sea
303RU +5651+06036 Asia/Yekaterinburg Moscow+02 - Urals
304RU +5500+07324 Asia/Omsk Moscow+03 - west Siberia
305RU +5502+08255 Asia/Novosibirsk Moscow+03 - Novosibirsk
306RU +5601+09250 Asia/Krasnoyarsk Moscow+04 - Yenisei River
307RU +5216+10420 Asia/Irkutsk Moscow+05 - Lake Baikal
308RU +6200+12940 Asia/Yakutsk Moscow+06 - Lena River
309RU +4310+13156 Asia/Vladivostok Moscow+07 - Amur River
310RU +4658+14242 Asia/Sakhalin Moscow+07 - Sakhalin Island
311RU +5934+15048 Asia/Magadan Moscow+08 - Magadan
312RU +5301+15839 Asia/Kamchatka Moscow+09 - Kamchatka
313RU +6445+17729 Asia/Anadyr Moscow+10 - Bering Sea
314RW -0157+03004 Africa/Kigali
315SA +2438+04643 Asia/Riyadh
316SB -0932+16012 Pacific/Guadalcanal
317SC -0440+05528 Indian/Mahe
318SD +1536+03232 Africa/Khartoum
319SE +5920+01803 Europe/Stockholm
320SG +0117+10351 Asia/Singapore
321SH -1555-00542 Atlantic/St_Helena
322SI +4603+01431 Europe/Ljubljana
323SJ +7800+01600 Arctic/Longyearbyen Svalbard
324SJ +7059-00805 Atlantic/Jan_Mayen Jan Mayen
325SK +4809+01707 Europe/Bratislava
326SL +0830-01315 Africa/Freetown
327SM +4355+01228 Europe/San_Marino
328SN +1440-01726 Africa/Dakar
329SO +0204+04522 Africa/Mogadishu
330SR +0550-05510 America/Paramaribo
331ST +0020+00644 Africa/Sao_Tome
332SV +1342-08912 America/El_Salvador
333SY +3330+03618 Asia/Damascus
334SZ -2618+03106 Africa/Mbabane
335TC +2128-07108 America/Grand_Turk
336TD +1207+01503 Africa/Ndjamena
337TF -492110+0701303 Indian/Kerguelen
338TG +0608+00113 Africa/Lome
339TH +1345+10031 Asia/Bangkok
340TJ +3835+06848 Asia/Dushanbe
341TK -0922-17114 Pacific/Fakaofo
342TL -0833+12535 Asia/Dili
343TM +3757+05823 Asia/Ashgabat
344TN +3648+01011 Africa/Tunis
345TO -2110+17510 Pacific/Tongatapu
346TR +4101+02858 Europe/Istanbul
347TT +1039-06131 America/Port_of_Spain
348TV -0831+17913 Pacific/Funafuti
349TW +2503+12130 Asia/Taipei
350TZ -0648+03917 Africa/Dar_es_Salaam
351UA +5026+03031 Europe/Kiev most locations
352UA +4837+02218 Europe/Uzhgorod Ruthenia
353UA +4750+03510 Europe/Zaporozhye Zaporozh'ye, E Lugansk
354UA +4457+03406 Europe/Simferopol central Crimea
355UG +0019+03225 Africa/Kampala
356UM +1700-16830 Pacific/Johnston Johnston Atoll
357UM +2813-17722 Pacific/Midway Midway Islands
358UM +1917+16637 Pacific/Wake Wake Island
359US +404251-0740023 America/New_York Eastern Time
360US +421953-0830245 America/Detroit Eastern Time - Michigan - most locations
361US +381515-0854534 America/Louisville Eastern Time - Kentucky - Louisville area
362US +364947-0845057 America/Kentucky/Monticello Eastern Time - Kentucky - Wayne County
363US +394606-0860929 America/Indianapolis Eastern Standard Time - Indiana - most locations
364US +382232-0862041 America/Indiana/Marengo Eastern Standard Time - Indiana - Crawford County
365US +411745-0863730 America/Indiana/Knox Eastern Standard Time - Indiana - Starke County
366US +384452-0850402 America/Indiana/Vevay Eastern Standard Time - Indiana - Switzerland County
367US +415100-0873900 America/Chicago Central Time
368US +450628-0873651 America/Menominee Central Time - Michigan - Wisconsin border
369US +470659-1011757 America/North_Dakota/Center Central Time - North Dakota - Oliver County
370US +394421-1045903 America/Denver Mountain Time
371US +433649-1161209 America/Boise Mountain Time - south Idaho & east Oregon
372US +364708-1084111 America/Shiprock Mountain Time - Navajo
373US +332654-1120424 America/Phoenix Mountain Standard Time - Arizona
374US +340308-1181434 America/Los_Angeles Pacific Time
375US +611305-1495401 America/Anchorage Alaska Time
376US +581807-1342511 America/Juneau Alaska Time - Alaska panhandle
377US +593249-1394338 America/Yakutat Alaska Time - Alaska panhandle neck
378US +643004-1652423 America/Nome Alaska Time - west Alaska
379US +515248-1763929 America/Adak Aleutian Islands
380US +211825-1575130 Pacific/Honolulu Hawaii
381UY -3453-05611 America/Montevideo
382UZ +3940+06648 Asia/Samarkand west Uzbekistan
383UZ +4120+06918 Asia/Tashkent east Uzbekistan
384VA +4154+01227 Europe/Vatican
385VC +1309-06114 America/St_Vincent
386VE +1030-06656 America/Caracas
387VG +1827-06437 America/Tortola
388VI +1821-06456 America/St_Thomas
389VN +1045+10640 Asia/Saigon
390VU -1740+16825 Pacific/Efate
391WF -1318-17610 Pacific/Wallis
392WS -1350-17144 Pacific/Apia
393YE +1245+04512 Asia/Aden
394YT -1247+04514 Indian/Mayotte
395YU +4450+02030 Europe/Belgrade
396ZA -2615+02800 Africa/Johannesburg
397ZM -1525+02817 Africa/Lusaka
398ZW -1750+03103 Africa/Harare
399XX 0+0 Etc/UTC
400\ No newline at end of file0\ No newline at end of file
4011
=== modified file 'plugins/EquationOfTime/CMakeLists.txt'
--- plugins/EquationOfTime/CMakeLists.txt 2015-10-28 14:52:25 +0000
+++ plugins/EquationOfTime/CMakeLists.txt 2016-10-25 16:10:21 +0000
@@ -1,6 +1,6 @@
1SET(EQUATIONOFTIME_MAJOR "0")1SET(EQUATIONOFTIME_MAJOR "0")
2SET(EQUATIONOFTIME_MINOR "1")2SET(EQUATIONOFTIME_MINOR "1")
3SET(EQUATIONOFTIME_PATCH "3")3SET(EQUATIONOFTIME_PATCH "4")
4SET(EQUATIONOFTIME_VERSION "${EQUATIONOFTIME_MAJOR}.${EQUATIONOFTIME_MINOR}.${EQUATIONOFTIME_PATCH}")4SET(EQUATIONOFTIME_VERSION "${EQUATIONOFTIME_MAJOR}.${EQUATIONOFTIME_MINOR}.${EQUATIONOFTIME_PATCH}")
55
6IF(APPLE)6IF(APPLE)
77
=== modified file 'plugins/EquationOfTime/src/EquationOfTime.cpp'
--- plugins/EquationOfTime/src/EquationOfTime.cpp 2015-10-28 14:52:25 +0000
+++ plugins/EquationOfTime/src/EquationOfTime.cpp 2016-10-25 16:10:21 +0000
@@ -33,9 +33,6 @@
33#include "EquationOfTime.hpp"33#include "EquationOfTime.hpp"
34#include "EquationOfTimeWindow.hpp"34#include "EquationOfTimeWindow.hpp"
3535
36//#include "sidereal_time.h"
37#include "precession.h"
38
39#include <QFontMetrics>36#include <QFontMetrics>
40#include <QSettings>37#include <QSettings>
41#include <QPixmap>38#include <QPixmap>
@@ -123,7 +120,7 @@
123 sPainter.setFont(font);120 sPainter.setFont(font);
124121
125 QString timeText;122 QString timeText;
126 double eqTime = getSolutionEquationOfTime(core->getJDE());123 double eqTime = core->getSolutionEquationOfTime(core->getJDE());
127124
128 if (getFlagInvertedValue())125 if (getFlagInvertedValue())
129 eqTime *= -1;126 eqTime *= -1;
@@ -215,44 +212,6 @@
215 conf->endGroup();212 conf->endGroup();
216}213}
217214
218double EquationOfTime::getSolutionEquationOfTime(const double JDE) const
219{
220 StelCore* core = StelApp::getInstance().getCore();
221
222 double tau = (JDE - 2451545.0)/365250.0;
223 double sunMeanLongitude = 280.4664567 + tau*(360007.6892779 + tau*(0.03032028 + tau*(1./49931. - tau*(1./15300. - tau/2000000.))));
224
225 // reduce the angle
226 sunMeanLongitude = std::fmod(sunMeanLongitude, 360.);
227 // force it to be the positive remainder, so that 0 <= angle < 360
228 sunMeanLongitude = std::fmod(sunMeanLongitude + 360., 360.);
229
230 Vec3d pos = GETSTELMODULE(StelObjectMgr)->searchByName("Sun")->getEquinoxEquatorialPos(core);
231 double ra, dec;
232 StelUtils::rectToSphe(&ra, &dec, pos);
233
234 // covert radians to degrees and reduce the angle
235 double alpha = std::fmod(ra*180./M_PI, 360.);
236 // force it to be the positive remainder, so that 0 <= angle < 360
237 alpha = std::fmod(alpha + 360., 360.);
238
239 double deltaPsi, deltaEps;
240 getNutationAngles(JDE, &deltaPsi, &deltaEps); // these are radians!
241 //double equation = 4*(sunMeanLongitude - 0.0057183 - alpha + get_nutation_longitude(JDE)*cos(get_mean_ecliptical_obliquity(JDE)));
242 double equation = 4*(sunMeanLongitude - 0.0057183 - alpha + deltaPsi*180./M_PI*cos(getPrecessionAngleVondrakEpsilon(JDE)));
243 // The equation of time is always smaller 20 minutes in absolute value
244 if (qAbs(equation)>20)
245 {
246 // If absolute value of the equation of time appears to be too large, add 24 hours (1440 minutes) to or subtract it from our result
247 if (equation>0.)
248 equation -= 1440.;
249 else
250 equation += 1440.;
251 }
252
253 return equation;
254}
255
256void EquationOfTime::updateMessageText()215void EquationOfTime::updateMessageText()
257{216{
258 messageEquation = q_("Equation of Time");217 messageEquation = q_("Equation of Time");
259218
=== modified file 'plugins/EquationOfTime/src/EquationOfTime.hpp'
--- plugins/EquationOfTime/src/EquationOfTime.hpp 2015-10-28 14:52:25 +0000
+++ plugins/EquationOfTime/src/EquationOfTime.hpp 2016-10-25 16:10:21 +0000
@@ -86,12 +86,6 @@
86 //! Save the settings to the main configuration file.86 //! Save the settings to the main configuration file.
87 void saveSettingsToConfig(void);87 void saveSettingsToConfig(void);
8888
89 //! Get solution of equation of time
90 //! Source: J. Meeus "Astronomical Algorithms" (2nd ed., with corrections as of August 10, 2009) p.183-187.
91 //! @param JDE JD in Dynamical Time (previously called Ephemeris Time)
92 //! @return time in minutes
93 double getSolutionEquationOfTime(const double JDE) const;
94
95 //! Is plugin enabled?89 //! Is plugin enabled?
96 bool isEnabled() const90 bool isEnabled() const
97 {91 {
9892
=== modified file 'plugins/Observability/src/Observability.cpp'
--- plugins/Observability/src/Observability.cpp 2016-07-21 22:45:43 +0000
+++ plugins/Observability/src/Observability.cpp 2016-10-25 16:10:21 +0000
@@ -287,8 +287,7 @@
287 double currheight = (6371.+(core->getCurrentLocation().altitude)/1000.)/UA;287 double currheight = (6371.+(core->getCurrentLocation().altitude)/1000.)/UA;
288 double currJD = core->getJD();288 double currJD = core->getJD();
289 double currJDint;289 double currJDint;
290// GMTShift = StelUtils::getGMTShiftFromQT(currJD)/24.0;290 GMTShift = core->getUTCOffset(currJD)/24.0;
291 GMTShift = StelApp::getInstance().getLocaleMgr().getGMTShift(currJD)/24.0;
292291
293292
294 double currLocalT = 24.*modf(currJD + GMTShift,&currJDint);293 double currLocalT = 24.*modf(currJD + GMTShift,&currJDint);
295294
=== modified file 'plugins/RemoteControl/src/MainService.cpp'
--- plugins/RemoteControl/src/MainService.cpp 2016-06-03 17:40:43 +0000
+++ plugins/RemoteControl/src/MainService.cpp 2016-10-25 16:10:21 +0000
@@ -163,7 +163,7 @@
163 double jday = core->getJD();163 double jday = core->getJD();
164 double deltaT = core->getDeltaT() * StelCore::JD_SECOND;164 double deltaT = core->getDeltaT() * StelCore::JD_SECOND;
165165
166 double gmtShift = localeMgr->getGMTShift(jday) / 24.0;166 double gmtShift = core->getUTCOffset(jday) / 24.0;
167167
168 QString utcIso = StelUtils::julianDayToISO8601String(jday,true).append('Z');168 QString utcIso = StelUtils::julianDayToISO8601String(jday,true).append('Z');
169 QString localIso = StelUtils::julianDayToISO8601String(jday+gmtShift,true);169 QString localIso = StelUtils::julianDayToISO8601String(jday+gmtShift,true);
170170
=== modified file 'plugins/Satellites/src/Satellites.cpp'
--- plugins/Satellites/src/Satellites.cpp 2016-09-17 09:48:40 +0000
+++ plugins/Satellites/src/Satellites.cpp 2016-10-25 16:10:21 +0000
@@ -1689,7 +1689,7 @@
1689 if (angle>angle0 && (v<1) && lat>5*M_PI/180)1689 if (angle>angle0 && (v<1) && lat>5*M_PI/180)
1690 {1690 {
1691 IridiumFlaresPrediction flare;1691 IridiumFlaresPrediction flare;
1692 flare.datetime = StelUtils::julianDayToISO8601String(currentJD+dt+StelUtils::getGMTShiftFromQT(currentJD+dt)/24.f);1692 flare.datetime = StelUtils::julianDayToISO8601String(currentJD+dt+StelApp::getInstance().getCore()->getUTCOffset(currentJD+dt)/24.f);
1693 flare.satellite = sat.data()->getEnglishName();1693 flare.satellite = sat.data()->getEnglishName();
1694 flare.azimuth = lon;1694 flare.azimuth = lon;
1695 flare.altitude = lat;1695 flare.altitude = lat;
16961696
=== modified file 'plugins/Satellites/src/gui/SatellitesDialog.cpp'
--- plugins/Satellites/src/gui/SatellitesDialog.cpp 2016-05-22 13:40:10 +0000
+++ plugins/Satellites/src/gui/SatellitesDialog.cpp 2016-10-25 16:10:21 +0000
@@ -997,7 +997,7 @@
997 QString date = modelIndex.sibling(modelIndex.row(), IridiumFlaresDate).data().toString();997 QString date = modelIndex.sibling(modelIndex.row(), IridiumFlaresDate).data().toString();
998 bool ok;998 bool ok;
999 double JD = StelUtils::getJulianDayFromISO8601String(date.left(10) + "T" + date.right(8), &ok);999 double JD = StelUtils::getJulianDayFromISO8601String(date.left(10) + "T" + date.right(8), &ok);
1000 JD -= StelUtils::getGMTShiftFromQT(JD)/24.;1000 JD -= StelApp::getInstance().getCore()->getUTCOffset(JD)/24.;
10011001
1002 StelObjectMgr* objectMgr = GETSTELMODULE(StelObjectMgr);1002 StelObjectMgr* objectMgr = GETSTELMODULE(StelObjectMgr);
1003 if (objectMgr->findAndSelectI18n(name) || objectMgr->findAndSelect(name))1003 if (objectMgr->findAndSelectI18n(name) || objectMgr->findAndSelect(name))
10041004
=== removed directory 'plugins/TimeZoneConfiguration'
=== removed file 'plugins/TimeZoneConfiguration/CMakeLists.txt'
--- plugins/TimeZoneConfiguration/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/TimeZoneConfiguration/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
1
2SET(TIME_ZONE_CONFIGURATION_MAJOR "0")
3SET(TIME_ZONE_CONFIGURATION_MINOR "0")
4SET(TIME_ZONE_CONFIGURATION_PATCH "4")
5SET(TIME_ZONE_CONFIGURATION_VERSION "${TIME_ZONE_CONFIGURATION_MAJOR}.${TIME_ZONE_CONFIGURATION_MINOR}.${TIME_ZONE_CONFIGURATION_PATCH}")
6
7IF(APPLE)
8 SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/Library/Application\ Support/Stellarium)
9ElSE(APPLE)
10 SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/.stellarium)
11ENDIF(APPLE)
12
13ADD_DEFINITIONS(-DTIME_ZONE_CONFIGURATION_VERSION="${TIME_ZONE_CONFIGURATION_VERSION}")
14
15ADD_SUBDIRECTORY( src )
16
17INSTALL(FILES DESTINATION "modules/TimeZoneConfiguration")
18
19
200
=== removed directory 'plugins/TimeZoneConfiguration/src'
=== removed file 'plugins/TimeZoneConfiguration/src/CMakeLists.txt'
--- plugins/TimeZoneConfiguration/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/TimeZoneConfiguration/src/CMakeLists.txt 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
1
2INCLUDE_DIRECTORIES(
3 .
4 gui
5 ${CMAKE_BINARY_DIR}
6 ${CMAKE_BINARY_DIR}/plugins/TimeZoneConfiguration/src
7 ${CMAKE_BINARY_DIR}/plugins/TimeZoneConfiguration/src/gui
8)
9
10LINK_DIRECTORIES(/src)
11
12SET(TimeZoneConfiguration_SRCS
13 TimeZoneConfiguration.hpp
14 TimeZoneConfiguration.cpp
15 gui/TimeZoneConfigurationWindow.hpp
16 gui/TimeZoneConfigurationWindow.cpp
17 gui/DefineTimeZoneWindow.hpp
18 gui/DefineTimeZoneWindow.cpp
19)
20
21SET(TimeZoneConfiguration_UIS
22 gui/timeZoneConfigurationWindow.ui
23 gui/defineTimeZone.ui
24)
25
26QT5_WRAP_UI(TimeZoneConfiguration_UIS_H ${TimeZoneConfiguration_UIS})
27
28SET(extLinkerOption ${OPENGL_LIBRARIES})
29
30ADD_LIBRARY(TimeZoneConfiguration-static STATIC ${TimeZoneConfiguration_SRCS} ${TimeZoneConfiguration_RES_CXX} ${TimeZoneConfiguration_UIS_H})
31QT5_USE_MODULES(TimeZoneConfiguration-static Core Network Gui Widgets)
32SET_TARGET_PROPERTIES(TimeZoneConfiguration-static PROPERTIES OUTPUT_NAME "TimeZoneConfiguration")
33TARGET_LINK_LIBRARIES(TimeZoneConfiguration-static ${extLinkerOption})
34SET_TARGET_PROPERTIES(TimeZoneConfiguration-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
35ADD_DEPENDENCIES(AllStaticPlugins TimeZoneConfiguration-static)
360
=== removed file 'plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.cpp'
--- plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.cpp 2014-04-15 19:00:10 +0000
+++ plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.cpp 1970-01-01 00:00:00 +0000
@@ -1,127 +0,0 @@
1/*
2 * Time zone configuration plug-in for Stellarium
3 *
4 * Copyright (C) 2010 Bogdan Marinov
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "TimeZoneConfiguration.hpp"
21#include "TimeZoneConfigurationWindow.hpp"
22
23#include "StelApp.hpp"
24#include "StelLocaleMgr.hpp"
25#include "StelModule.hpp"
26
27#include <QSettings>
28
29StelModule* TimeZoneConfigurationStelPluginInterface::getStelModule() const
30{
31 return new TimeZoneConfiguration();
32}
33
34StelPluginInfo TimeZoneConfigurationStelPluginInterface::getPluginInfo() const
35{
36 // Allow to load the resources when used as a static plugin
37 //Q_INIT_RESOURCE(TimeZoneConfiguration);
38
39 StelPluginInfo info;
40 info.id = "TimeZoneConfiguration";
41 info.displayedName = N_("Time Zone");
42 info.authors = "Bogdan Marinov";
43 info.contact = "http://stellarium.org";
44 info.description = N_("A convenient interface for some of the more obscure options in Stellarium's configuration file. Allows setting the time zone and changing the way the time and the date are displayed in the bottom bar.");
45 info.version = TIME_ZONE_CONFIGURATION_VERSION;
46 return info;
47}
48
49TimeZoneConfiguration::TimeZoneConfiguration()
50{
51 setObjectName("TimeZoneConfiguration");
52 mainWindow = new TimeZoneConfigurationWindow();
53 //
54}
55
56TimeZoneConfiguration::~TimeZoneConfiguration()
57{
58 //
59}
60
61void TimeZoneConfiguration::init()
62{
63 //
64}
65
66void TimeZoneConfiguration::deinit()
67{
68 delete mainWindow;
69}
70
71double TimeZoneConfiguration::getCallOrder(StelModuleActionName) const
72{
73 return 0.;
74}
75
76void TimeZoneConfiguration::update(double)
77{
78 //
79}
80
81bool TimeZoneConfiguration::configureGui(bool show)
82{
83 if (show)
84 mainWindow->setVisible(true);
85
86 return true;
87}
88
89void TimeZoneConfiguration::setTimeZone(QString timeZoneString)
90{
91 if (timeZoneString.isEmpty())
92 {
93 return;
94 }
95 //TODO: Validation?
96 qDebug() << "Setting \"localization/time_zone\" to" << timeZoneString;
97
98 QSettings * settings = StelApp::getInstance().getSettings();
99 Q_ASSERT(settings);
100
101 settings->setValue("localization/time_zone", timeZoneString);
102 settings->sync();
103}
104
105QString TimeZoneConfiguration::readTimeZone()
106{
107 QSettings * settings = StelApp::getInstance().getSettings();
108 Q_ASSERT(settings);
109
110 return settings->value("localization/time_zone").toString();
111}
112
113void TimeZoneConfiguration::saveDisplayFormats()
114{
115 QSettings * settings = StelApp::getInstance().getSettings();
116 Q_ASSERT(settings);
117
118 StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
119
120 QString timeDisplayFormat = localeManager.getTimeFormatStr();
121 settings->setValue("localization/time_display_format", timeDisplayFormat);
122
123 QString dateDisplayFormat = localeManager.getDateFormatStr();
124 settings->setValue("localization/date_display_format", dateDisplayFormat);
125
126 settings->sync();
127}
1280
=== removed file 'plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.hpp'
--- plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.hpp 2015-02-18 22:21:55 +0000
+++ plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.hpp 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
1/*
2 * Time zone configuration plug-in for Stellarium
3 *
4 * Copyright (C) 2010 Bogdan Marinov
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef _TIME_ZONE_CONFIGURATION_HPP_
21 #define _TIME_ZONE_CONFIGURATION_HPP_
22
23#include "StelGui.hpp"
24#include "StelModule.hpp"
25
26#include <QString>
27
28class TimeZoneConfigurationWindow;
29
30class TimeZoneConfiguration : public StelModule
31{
32 Q_OBJECT
33
34public:
35 TimeZoneConfiguration();
36 ~TimeZoneConfiguration();
37
38 virtual void init();
39 virtual void deinit();
40 virtual void update(double deltaTime);
41 //virtual void draw(StelCore *core);
42 virtual double getCallOrder(StelModuleActionName actionName) const;
43 virtual bool configureGui(bool show);
44
45 //! Sets the time zone field in Stellarium's configuration file.
46 //! To work, timeZoneString should be a valid value of the TZ environmental
47 //! variable according to the POSIX format.
48 //! (See http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html)
49 //! Note that Microsoft Windows may use a truncated version of the TZ
50 //! format.
51 //! For now, Stellarium needs to be restarted for the new settings to take
52 //! effect.
53 void setTimeZone(QString timeZoneString);
54
55 //! Reads the time zone field in Stellarium's configuration file.
56 //! \returns the contents of the "localization/time_zone" field in
57 //! Stellarium's configuration file.
58 QString readTimeZone();
59
60 //! Saves the formats used to display date and time in the bottom bar.
61 void saveDisplayFormats();
62
63private:
64 TimeZoneConfigurationWindow * mainWindow;
65};
66
67
68#include <QObject>
69#include "StelPluginInterface.hpp"
70
71//! This class is used by Qt to manage a plug-in interface
72class TimeZoneConfigurationStelPluginInterface : public QObject, public StelPluginInterface
73{
74 Q_OBJECT
75 Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
76 Q_INTERFACES(StelPluginInterface)
77public:
78 virtual StelModule* getStelModule() const;
79 virtual StelPluginInfo getPluginInfo() const;
80};
81
82 #endif //_TIME_ZONE_CONFIGURATION_HPP_
830
=== removed directory 'plugins/TimeZoneConfiguration/src/gui'
=== removed file 'plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.cpp'
--- plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.cpp 2016-01-22 11:05:08 +0000
+++ plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.cpp 1970-01-01 00:00:00 +0000
@@ -1,541 +0,0 @@
1/*
2 * Time zone configuration plug-in for Stellarium
3 *
4 * Copyright (C) 2010 Bogdan Marinov
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "TimeZoneConfigurationWindow.hpp"
21#include "DefineTimeZoneWindow.hpp"
22#include "ui_defineTimeZone.h"
23#include "StelApp.hpp"
24#include "StelTranslator.hpp"
25
26#include <cmath>
27#include <QRegExpValidator>
28
29DefineTimeZoneWindow::DefineTimeZoneWindow()
30{
31 ui = new Ui_defineTimeZoneForm();
32 dialogName = "TimeZoneConfigurationDefineTimeZone";
33 timeZoneNameValidator = new QRegExpValidator(QRegExp("[^:\\d,+-/]{3,}"), this);
34}
35
36DefineTimeZoneWindow::~DefineTimeZoneWindow()
37{
38 delete ui;
39 delete timeZoneNameValidator;
40}
41
42void DefineTimeZoneWindow::retranslate()
43{
44 if (dialog)
45 {
46 ui->retranslateUi(dialog);
47 int startDateMonthIndex = ui->comboBoxDstStartDateMonth->currentIndex();
48 int startDayIndex = ui->comboBoxDstStartDay->currentIndex();
49 int startMonthIndex = ui->comboBoxDstStartMonth->currentIndex();
50 int startWeekIndex = ui->comboBoxDstStartWeek->currentIndex();
51 int endDateMonthIndex = ui->comboBoxDstEndDateMonth->currentIndex();
52 int endDayIndex = ui->comboBoxDstEndDay->currentIndex();
53 int endMonthIndex = ui->comboBoxDstEndMonth->currentIndex();
54 int endWeekIndex = ui->comboBoxDstEndWeek->currentIndex();
55 populateDateLists();
56 ui->comboBoxDstStartDateMonth->setCurrentIndex(startDateMonthIndex);
57 ui->comboBoxDstStartDay->setCurrentIndex(startDayIndex);
58 ui->comboBoxDstStartMonth->setCurrentIndex(startMonthIndex);
59 ui->comboBoxDstStartWeek->setCurrentIndex(startWeekIndex);
60 ui->comboBoxDstEndDateMonth->setCurrentIndex(endDateMonthIndex);
61 ui->comboBoxDstEndDay->setCurrentIndex(endDayIndex);
62 ui->comboBoxDstEndMonth->setCurrentIndex(endMonthIndex);
63 ui->comboBoxDstEndWeek->setCurrentIndex(endWeekIndex);
64 }
65}
66
67void DefineTimeZoneWindow::createDialogContent()
68{
69 ui->setupUi(dialog);
70 connect(&StelApp::getInstance(), SIGNAL(languageChanged()),
71 this, SLOT(retranslate()));
72
73 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
74 connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
75 connect(ui->pushButtonUseDefinition, SIGNAL(clicked()),
76 this, SLOT(useDefinition()));
77
78 connect(ui->doubleSpinBoxOffset, SIGNAL(valueChanged(double)),
79 this, SLOT(updateDstOffset(double)));
80
81 connect(ui->comboBoxDstStartDateMonth, SIGNAL(currentIndexChanged(int)),
82 this, SLOT(updateDayNumberMaximumDstStart(int)));
83 connect(ui->comboBoxDstEndDateMonth, SIGNAL(currentIndexChanged(int)),
84 this, SLOT(updateDayNumberMaximumDstEnd(int)));
85
86 ui->lineEditName->setValidator(timeZoneNameValidator);
87 ui->lineEditNameDst->setValidator(timeZoneNameValidator);
88
89 resetWindowState();
90}
91
92void DefineTimeZoneWindow::useDefinition()
93{
94 QString definition;
95 QString timeZoneName = ui->lineEditName->text();
96 if (timeZoneName.length() < 3)
97 {
98 return;
99 }
100 definition.append(timeZoneName);
101 definition.append(TimeZoneConfigurationWindow::getTzOffsetStringFrom(ui->doubleSpinBoxOffset));
102
103 //Daylight saving time
104 if (ui->checkBoxDst->isChecked())
105 {
106 QString dstTimeZoneName = ui->lineEditNameDst->text();
107 if (dstTimeZoneName.length() < 3 || dstTimeZoneName == timeZoneName)
108 {
109 return;
110 }
111 //The name is the minimum required for DST
112 definition.append(dstTimeZoneName);
113
114 //The offset is not necessary
115 if (ui->checkBoxOffsetDst->isChecked())
116 {
117 definition.append(TimeZoneConfigurationWindow::getTzOffsetStringFrom(ui->doubleSpinBoxOffsetDst));
118 }
119
120 if (ui->groupBoxDstStart->isChecked() && ui->groupBoxDstEnd->isChecked())
121 {
122 if (ui->radioButtonDstStartDate->isChecked())
123 {
124 const int month = ui->comboBoxDstStartDateMonth->currentIndex() + 1;
125 const int day = ui->spinBoxDstStartDateDay->value();
126 QDate startDate;
127 if (month == 2 && day == 29)
128 {
129 //Leap year: day is indexed between 0 and 365
130 startDate.setDate(2000, month, day);
131 definition.append(QString(",%1").arg(startDate.dayOfYear() - 1));
132 }
133 else
134 {
135 startDate.setDate(2010, month, day);
136 definition.append(QString(",J%1").arg(startDate.dayOfYear()));
137 }
138 }
139 else //Day of week
140 {
141 //Day of the week: 0-6, 0 is Sunday
142 int day = ui->comboBoxDstStartDay->currentIndex();
143 //Week ordinal number: 1-5, 5 is "last"
144 int week = ui->comboBoxDstStartWeek->currentIndex() + 1;
145 //Month: 1-12
146 int month = ui->comboBoxDstStartMonth->currentIndex() + 1;
147
148 definition.append(QString(",M%1.%2.%3").arg(month).arg(week).arg(day));
149 }
150
151 if (ui->checkBoxDstStartTime->isChecked())
152 {
153 definition.append(ui->timeEditDstStart->time().toString("'/'hh:mm:ss"));
154 }
155
156 if (ui->radioButtonDstEndDate->isChecked())
157 {
158 const int month = ui->comboBoxDstEndDateMonth->currentIndex() + 1;
159 const int day = ui->spinBoxDstEndDateDay->value();
160 QDate endDate;
161 if (month == 2 && day == 29)
162 {
163 //Leap year: day is indexed between 0 and 365
164 endDate.setDate(2000, month, day);
165 definition.append(QString(",%1").arg(endDate.dayOfYear() - 1));
166 }
167 else
168 {
169 endDate.setDate(2010, month, day);
170 definition.append(QString(",J%1").arg(endDate.dayOfYear()));
171 }
172 }
173 else //Day of week
174 {
175 //Day of the week: 0-6, 0 is Sunday
176 int day = ui->comboBoxDstEndDay->currentIndex();
177 //Week ordinal number: 1-5, 5 is "last"
178 int week = ui->comboBoxDstEndWeek->currentIndex() + 1;
179 //Month: 1-12
180 int month = ui->comboBoxDstEndMonth->currentIndex() + 1;
181
182 definition.append(QString(",M%1.%2.%3").arg(month).arg(week).arg(day));
183 }
184
185 if (ui->checkBoxDstEndTime->isChecked())
186 {
187 definition.append(ui->timeEditDstEnd->time().toString("'/'hh:mm:ss"));
188 }
189 }
190 }
191
192 emit timeZoneDefined(definition);
193 close();
194}
195
196void DefineTimeZoneWindow::updateDstOffset(double normalOffset)
197{
198 if (ui->checkBoxOffsetDst->isChecked())
199 return;
200
201 //By default, the DST offset is +1 hour the normal offset
202 ui->doubleSpinBoxOffsetDst->setValue(normalOffset + 1.0);
203}
204
205void DefineTimeZoneWindow::resetWindowState()
206{
207 populateDateLists();
208
209 //Default section
210 ui->lineEditName->clear();
211 ui->lineEditNameDst->clear();
212
213 ui->doubleSpinBoxOffset->setValue(0.0);
214 //(indirectly sets doubleSpinBoxOffsetDst)
215
216 ui->checkBoxDst->setChecked(false);
217 ui->frameDst->setVisible(false);
218
219 ui->checkBoxOffsetDst->setChecked(false);
220 ui->doubleSpinBoxOffsetDst->setEnabled(false);
221
222 ui->groupBoxDstStart->setChecked(false);
223 //(indirectly sets the other one)
224
225 ui->radioButtonDstStartDay->setChecked(true);
226 ui->radioButtonDstEndDay->setChecked(true);
227
228 ui->spinBoxDstStartDateDay->setValue(1);
229 ui->spinBoxDstEndDateDay->setValue(1);
230 ui->comboBoxDstStartDateMonth->setCurrentIndex(0);
231 ui->comboBoxDstEndDateMonth->setCurrentIndex(0);
232
233 ui->checkBoxDstStartTime->setChecked(false);
234 ui->timeEditDstStart->setEnabled(false);
235 ui->timeEditDstStart->setTime(QTime(2, 0, 0, 0));
236 ui->checkBoxDstEndTime->setChecked(false);
237 ui->timeEditDstEnd->setEnabled(false);
238 ui->timeEditDstEnd->setTime(QTime(2, 0, 0, 0));
239}
240
241void DefineTimeZoneWindow::populateDateLists()
242{
243 QStringList monthList;
244 monthList.append(q_("January"));
245 monthList.append(q_("February"));
246 monthList.append(q_("March"));
247 monthList.append(q_("April"));
248 monthList.append(q_("May"));
249 monthList.append(q_("June"));
250 monthList.append(q_("July"));
251 monthList.append(q_("August"));
252 monthList.append(q_("September"));
253 monthList.append(q_("October"));
254 monthList.append(q_("November"));
255 monthList.append(q_("December"));
256
257 ui->comboBoxDstStartMonth->clear();
258 ui->comboBoxDstStartMonth->addItems(monthList);
259 ui->comboBoxDstEndMonth->clear();
260 ui->comboBoxDstEndMonth->addItems(monthList);
261 ui->comboBoxDstStartDateMonth->clear();
262 ui->comboBoxDstStartDateMonth->addItems(monthList);
263 ui->comboBoxDstEndDateMonth->clear();
264 ui->comboBoxDstEndDateMonth->addItems(monthList);
265
266 QStringList weekList;
267 weekList.append(q_("First week"));
268 weekList.append(q_("Second week"));
269 weekList.append(q_("Third week"));
270 weekList.append(q_("Fourth week"));
271 weekList.append(q_("Last week"));
272
273 ui->comboBoxDstStartWeek->clear();
274 ui->comboBoxDstStartWeek->addItems(weekList);
275 ui->comboBoxDstEndWeek->clear();
276 ui->comboBoxDstEndWeek->addItems(weekList);
277
278 //Starts from Sunday deliberately
279 QStringList dayList;
280 dayList.append(q_("Sunday"));
281 dayList.append(q_("Monday"));
282 dayList.append(q_("Tuesday"));
283 dayList.append(q_("Wednesday"));
284 dayList.append(q_("Thursday"));
285 dayList.append(q_("Friday"));
286 dayList.append(q_("Saturday"));
287
288 ui->comboBoxDstStartDay->clear();
289 ui->comboBoxDstStartDay->addItems(dayList);
290 ui->comboBoxDstEndDay->clear();
291 ui->comboBoxDstEndDay->addItems(dayList);
292}
293void DefineTimeZoneWindow::updateDayNumberMaximum(int monthIndex, QSpinBox *spinBoxDay)
294{
295 int maximum = 31;
296 switch (monthIndex)
297 {
298 case 0: //January
299 case 2: //March
300 case 4: //May
301 case 6: //July
302 case 7: //August
303 case 9: //October
304 case 11: //December
305 maximum = 31;
306 break;
307 case 3: //April
308 case 5: //June
309 case 8: //September
310 case 10: //November
311 maximum = 30;
312 break;
313 case 1: //February
314 maximum = 29;
315 break;
316 default:
317 ;//
318 }
319
320 if (spinBoxDay->value() > maximum)
321 spinBoxDay->setValue(maximum);
322 spinBoxDay->setRange(1, maximum);
323}
324
325void DefineTimeZoneWindow::updateDayNumberMaximumDstStart(int monthIndex)
326{
327 updateDayNumberMaximum(monthIndex, ui->spinBoxDstStartDateDay);
328}
329
330void DefineTimeZoneWindow::updateDayNumberMaximumDstEnd(int monthIndex)
331{
332 updateDayNumberMaximum(monthIndex, ui->spinBoxDstEndDateDay);
333}
334
335bool DefineTimeZoneWindow::readDstEndpoint(const QString& string,
336 DstEndpoint endpoint)
337{
338 QGroupBox* groupBox = 0;
339 QRadioButton* radioButtonDay = 0;
340 QRadioButton* radioButtonDate = 0;
341 QCheckBox* checkBoxTime = 0;
342 QComboBox* comboBoxWeek = 0;
343 QComboBox* comboBoxMonth = 0;
344 QComboBox* comboBoxDay = 0;
345 QTimeEdit* timeEdit = 0;
346
347 if (endpoint == DstStart)
348 {
349 groupBox = ui->groupBoxDstStart;
350 radioButtonDay = ui->radioButtonDstStartDay;
351 radioButtonDate = ui->radioButtonDstStartDate;
352 checkBoxTime = ui->checkBoxDstStartTime;
353 comboBoxWeek = ui->comboBoxDstStartWeek;
354 comboBoxMonth = ui->comboBoxDstStartMonth;
355 comboBoxDay = ui->comboBoxDstStartDay;
356 timeEdit = ui->timeEditDstStart;
357 }
358 else
359 {
360 groupBox = ui->groupBoxDstEnd;
361 radioButtonDay = ui->radioButtonDstEndDay;
362 radioButtonDate = ui->radioButtonDstEndDate;
363 checkBoxTime = ui->checkBoxDstEndTime;
364 comboBoxWeek = ui->comboBoxDstEndWeek;
365 comboBoxMonth = ui->comboBoxDstEndMonth;
366 comboBoxDay = ui->comboBoxDstEndDay;
367 timeEdit = ui->timeEditDstEnd;
368 }
369
370 QRegExp endPointFormat("(J\\d{1,3}|\\d{1,3}|M\\d{1,2}\\.\\d\\.\\d)(?:\\/(\\d{1,2}(?:\\:(?:\\d{1,2})(?:\\:(?:\\d{1,2}))?)?))?");
371 if (!endPointFormat.exactMatch(string))
372 return false;
373
374 if (endPointFormat.captureCount() == 2)
375 {
376 QString timeString = endPointFormat.cap(2).trimmed();
377 if (!timeString.isEmpty())
378 {
379 int hours, minutes, seconds;
380 TimeZoneConfigurationWindow::readTzTimeString(timeString,
381 hours,
382 minutes,
383 seconds);
384 QTime time(hours, minutes, seconds);
385 if (time.isValid())
386 {
387 checkBoxTime->setChecked(true);
388 timeEdit->setTime(time);
389 }
390 else
391 return false;
392 }
393 }
394
395 QString date = endPointFormat.cap(1);
396 if (date.startsWith('J'))
397 {
398 int julianDay = date.mid(1).toInt();
399 if (julianDay < 1 || julianDay > 365)
400 return false;
401
402 radioButtonDate->setChecked(true);
403 setEndPointDate(julianDay, false, endpoint);
404 }
405 else if (date.startsWith('M'))
406 {
407 QStringList list = date.mid(1).split('.');
408 if (list.count() != 3)
409 return false;
410
411 int month = list[0].toInt();
412 if (month < 1 || month > 12)
413 return false;
414 int week = list[1].toInt();
415 if (week < 1 || week > 5)
416 return false;
417 int day = list[2].toInt();
418 if (day < 0 || day > 6)
419 return false;
420
421 radioButtonDay->setChecked(true);
422 comboBoxMonth->setCurrentIndex(month - 1);
423 comboBoxWeek->setCurrentIndex(week - 1);
424 comboBoxDay->setCurrentIndex(day);
425 }
426 else
427 {
428 int julianDay = date.toInt();
429 if (julianDay < 0 || julianDay > 365)
430 return false;
431
432 radioButtonDate->setChecked(true);
433 setEndPointDate(julianDay+1, true, endpoint);
434 }
435
436 groupBox->setChecked(true);
437 return true;
438}
439
440void DefineTimeZoneWindow::setEndPointDate(int ordinalDate,
441 bool leapYear,
442 DstEndpoint endpoint)
443{
444 QSpinBox* spinBoxDateDay = 0;
445 QComboBox* comboBoxDateMonth = 0;
446 if (endpoint == DstStart)
447 {
448 spinBoxDateDay = ui->spinBoxDstStartDateDay;
449 comboBoxDateMonth = ui->comboBoxDstStartDateMonth;
450 }
451 else
452 {
453 spinBoxDateDay = ui->spinBoxDstEndDateDay;
454 comboBoxDateMonth = ui->comboBoxDstEndDateMonth;
455 }
456
457 int monthLength[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
458 if (leapYear)
459 monthLength[1] = 29;
460 for (int i = 0; i < 12; i++)
461 {
462 if (ordinalDate <= monthLength[i])
463 {
464 spinBoxDateDay->setValue(ordinalDate);
465 comboBoxDateMonth->setCurrentIndex(i);
466 break;
467 }
468 else
469 {
470 ordinalDate -= monthLength[i];
471 }
472 }
473}
474
475void DefineTimeZoneWindow::setTimeZone(QString tzString)
476{
477 if (dialog == NULL) //As initialized in StelDialog
478 return;
479
480 if (tzString.isEmpty())
481 return;
482
483 //TZ variable format:
484 // - name
485 // - signed offset
486 // The following is optional:
487 // - DST name
488 // - DST signed offset
489 // - DST beginning
490 // - DST end
491 QRegExp tzFormat("^([^:\\d,+-/]{3,})([+-]?[\\d:]+)(?:([^:\\d,+-/]{3,})((?:[+-]?[\\d:]+)?),([JM\\d\\./:]+),([JM\\d\\./:]+))?$");
492 if (!tzFormat.exactMatch(tzString))
493 return;
494
495 double offset = TimeZoneConfigurationWindow::readTzOffsetString(tzFormat.cap(2));
496 if (fabs(offset) >= 24)
497 return;
498
499 QString name = tzFormat.cap(1).trimmed();
500 if (name.isEmpty())
501 return;
502
503 ui->lineEditName->setText(name);
504 ui->doubleSpinBoxOffset->setValue(offset);
505
506 //TODO: Clean this up. The offset and the end point are not obligatory?
507 int count = tzFormat.captureCount();
508 if (count > 2)
509 {
510 QString dstName = tzFormat.cap(3).trimmed();
511 if (dstName.isEmpty())
512 return;
513 QString dstOffsetString = tzFormat.cap(4).trimmed();
514 if (!dstOffsetString.isEmpty())
515 {
516 double dstOffset = TimeZoneConfigurationWindow::readTzOffsetString(dstOffsetString);
517 if (fabs(dstOffset) >= 24)
518 return;
519
520 ui->checkBoxOffsetDst->setChecked(true);
521 ui->doubleSpinBoxOffsetDst->setValue(dstOffset);
522 }
523 else
524 {
525 ui->checkBoxOffsetDst->setChecked(false);
526 ui->doubleSpinBoxOffsetDst->setValue(offset + 1);
527 }
528
529 QString dstStartString = tzFormat.cap(5).trimmed();
530 if (!readDstEndpoint(dstStartString, DstStart))
531 return;
532 QString dstEndString = tzFormat.cap(6).trimmed();
533 if (!readDstEndpoint(dstEndString, DstEnd))
534 return;
535
536 ui->checkBoxDst->setChecked(true);
537 ui->lineEditNameDst->setText(dstName);
538 }
539
540
541}
5420
=== removed file 'plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.hpp'
--- plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.hpp 2012-02-13 18:59:16 +0000
+++ plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.hpp 1970-01-01 00:00:00 +0000
@@ -1,73 +0,0 @@
1/*
2 * Time zone configuration plug-in for Stellarium
3 *
4 * Copyright (C) 2010 Bogdan Marinov
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _DEFINE_TIME_ZONE_HPP_
21#define _DEFINE_TIME_ZONE_HPP_
22
23#include "StelDialog.hpp"
24
25class Ui_defineTimeZoneForm;
26class QRegExpValidator;
27class QSpinBox;
28
29class DefineTimeZoneWindow : public StelDialog
30{
31 Q_OBJECT
32
33public:
34 DefineTimeZoneWindow();
35 ~DefineTimeZoneWindow();
36
37 //! Fills the fields of the form with the time zone described in the string.
38 //! Call after createDialogContent() or setVisible() to avoid a crash.
39 void setTimeZone(QString timeZoneString);
40
41public slots:
42 void retranslate();
43
44signals:
45 void timeZoneDefined(QString timeZoneString);
46
47protected:
48 void createDialogContent();
49
50private:
51 Ui_defineTimeZoneForm * ui;
52
53 QRegExpValidator * timeZoneNameValidator;
54
55 void resetWindowState();
56 void populateDateLists();
57
58 void updateDayNumberMaximum(int monthIndex, QSpinBox * spinBoxDay);
59
60 enum DstEndpoint {DstStart, DstEnd};
61 //! \returns false if #string is not a valid TZ DST end point description.
62 bool readDstEndpoint(const QString& string, DstEndpoint endpoint);
63 void setEndPointDate(int ordinalDate, bool leapYear, DstEndpoint endpoint);
64
65private slots:
66 void useDefinition();
67 void updateDstOffset(double normalOffset);
68 void updateDayNumberMaximumDstStart(int monthIndex);
69 void updateDayNumberMaximumDstEnd(int monthIndex);
70};
71
72
73#endif //_DEFINE_TIME_ZONE_HPP_
740
=== removed file 'plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.cpp'
--- plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.cpp 2016-01-22 11:05:08 +0000
+++ plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.cpp 1970-01-01 00:00:00 +0000
@@ -1,285 +0,0 @@
1/*
2 * Time zone configuration plug-in for Stellarium
3 *
4 * Copyright (C) 2010 Bogdan Marinov
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "TimeZoneConfiguration.hpp"
21#include "TimeZoneConfigurationWindow.hpp"
22#include "DefineTimeZoneWindow.hpp"
23#include "ui_timeZoneConfigurationWindow.h"
24
25#include "StelApp.hpp"
26#include "StelLocaleMgr.hpp"
27#include "StelModuleMgr.hpp"
28
29TimeZoneConfigurationWindow::TimeZoneConfigurationWindow()
30{
31 ui = new Ui_timeZoneConfigurationWindowForm();
32 dialogName = "TimeZoneConfiguration";
33 timeZoneConfiguration = GETSTELMODULE(TimeZoneConfiguration);
34 defineTimeZoneWindow = NULL;
35}
36
37TimeZoneConfigurationWindow::~TimeZoneConfigurationWindow()
38{
39 delete ui;
40 if (defineTimeZoneWindow)
41 delete defineTimeZoneWindow;
42}
43
44void TimeZoneConfigurationWindow::retranslate()
45{
46 if (dialog)
47 {
48 ui->retranslateUi(dialog);
49 updateAboutText();
50 }
51}
52
53void TimeZoneConfigurationWindow::createDialogContent()
54{
55 ui->setupUi(dialog);
56
57 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
58 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
59 connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
60 connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(saveTimeZoneSettings()));
61 connect(ui->pushButtonEditTimeZone, SIGNAL(clicked()), this, SLOT(openDefineTimeZoneWindow()));
62
63 connect(ui->radioButtonTimeDefault, SIGNAL(toggled(bool)), this, SLOT(setTimeFormat(bool)));
64 connect(ui->radioButtonTime12Hour, SIGNAL(toggled(bool)), this, SLOT(setTimeFormat(bool)));
65 connect(ui->radioButtonTime24Hour, SIGNAL(toggled(bool)), this, SLOT(setTimeFormat(bool)));
66
67 connect(ui->radioButtonDateDefault, SIGNAL(toggled(bool)), this, SLOT(setDateFormat(bool)));
68 connect(ui->radioButtonDateDMY, SIGNAL(toggled(bool)), this, SLOT(setDateFormat(bool)));
69 connect(ui->radioButtonDateMDY, SIGNAL(toggled(bool)), this, SLOT(setDateFormat(bool)));
70 connect(ui->radioButtonDateYMD, SIGNAL(toggled(bool)), this, SLOT(setDateFormat(bool)));
71
72 updateDisplayFormatSwitches();
73
74 QString currentTimeZoneString = timeZoneConfiguration->readTimeZone();
75 //ui->lineEditCurrent->setText(currentTimeZoneString);
76 ui->lineEditUserDefined->setText(currentTimeZoneString);
77 ui->frameUserDefined->setEnabled(false);
78
79 if (currentTimeZoneString.startsWith("SCT"))
80 {
81 if (currentTimeZoneString == "SCT+0")
82 {
83 ui->radioButtonUtc->setChecked(true);
84 }
85 else
86 {
87 ui->radioButtonOffset->setChecked(true);
88 double offset = readTzOffsetString(currentTimeZoneString.mid(3));
89 ui->doubleSpinBoxOffset->setValue(offset);
90 }
91 }
92 else if (currentTimeZoneString == "system_default")
93 {
94 ui->radioButtonLocalSettings->setChecked(true);
95 }
96 else
97 {
98 ui->radioButtonUserDefined->setChecked(true);
99 }
100
101 updateAboutText();
102}
103
104void TimeZoneConfigurationWindow::updateAboutText()
105{
106 ui->labelTitle->setText(q_("Time Zone plug-in"));
107 QString version = QString(q_("Version %1")).arg(TIME_ZONE_CONFIGURATION_VERSION);
108 ui->labelVersion->setText(version);
109}
110
111void TimeZoneConfigurationWindow::saveTimeZoneSettings()
112{
113 QString timeZoneString;
114 if (ui->radioButtonUtc->isChecked())
115 {
116 timeZoneString = "SCT+0";//"Stellarium Custom Time" :)
117 }
118 else if (ui->radioButtonOffset->isChecked())
119 {
120 timeZoneString = QString("SCT").append(getTzOffsetStringFrom(ui->doubleSpinBoxOffset));
121 }
122 else if (ui->radioButtonUserDefined->isChecked())
123 {
124 timeZoneString = ui->lineEditUserDefined->text();
125 }
126 else
127 {
128 timeZoneString = "system_default";
129 }
130
131 timeZoneConfiguration->setTimeZone(timeZoneString);
132}
133
134void TimeZoneConfigurationWindow::openDefineTimeZoneWindow()
135{
136 dialog->setEnabled(false);
137
138 if (defineTimeZoneWindow == NULL)
139 {
140 defineTimeZoneWindow = new DefineTimeZoneWindow();
141 connect(defineTimeZoneWindow, SIGNAL(timeZoneDefined(QString)), this, SLOT(timeZoneDefined(QString)));
142 connect(defineTimeZoneWindow, SIGNAL(visibleChanged(bool)), this, SLOT(closeDefineTimeZoneWindow(bool)));
143 }
144
145 defineTimeZoneWindow->setVisible(true);
146 defineTimeZoneWindow->setTimeZone(ui->lineEditUserDefined->text());
147}
148
149void TimeZoneConfigurationWindow::closeDefineTimeZoneWindow(bool show)
150{
151 if (show)
152 return;
153
154 disconnect(defineTimeZoneWindow, SIGNAL(timeZoneDefined(QString)), this, SLOT(timeZoneDefined(QString)));
155 disconnect(defineTimeZoneWindow, SIGNAL(visibleChanged(bool)), this, SLOT(closeDefineTimeZoneWindow(bool)));
156 delete defineTimeZoneWindow;
157 defineTimeZoneWindow = NULL;
158
159 dialog->setEnabled(true);
160}
161
162void TimeZoneConfigurationWindow::timeZoneDefined(QString timeZoneDefinition)
163{
164 ui->lineEditUserDefined->setText(timeZoneDefinition);
165}
166
167double TimeZoneConfigurationWindow::readTzOffsetString(const QString& string)
168{
169 const QChar signChar = string.at(0);
170 //Offset is POSIX style: UTF - local time = offset,
171 //so invert the sign:
172 const int sign = (signChar == '-') ? 1 : -1;
173 int hours, minutes, seconds;
174 readTzTimeString((signChar.isDigit()) ? string : string.mid(1),
175 hours, minutes, seconds);
176 const double offset = sign * (hours + floor(((minutes * 60 + seconds)/3600.0) * 100) / 100.0);//Round to the second digit
177 return offset;
178}
179
180void TimeZoneConfigurationWindow::readTzTimeString(const QString& string,
181 int& hours,
182 int& minutes,
183 int& seconds)
184{
185 hours = 0;
186 minutes = 0;
187 seconds = 0;
188
189 QRegExp tzTimeFormat("(\\d{1,2})(?:\\:(\\d{1,2})(?:\\:(\\d{1,2}))?)?");
190 if (!tzTimeFormat.exactMatch(string))
191 return;
192
193 int count = tzTimeFormat.captureCount();
194 switch (count)
195 {
196 case 3:
197 seconds = tzTimeFormat.cap(3).toInt();
198 //Fallthrough!
199 case 2:
200 minutes = tzTimeFormat.cap(2).toInt();
201 //Fallthrough!
202 case 1:
203 default:
204 hours = tzTimeFormat.cap(1).toInt();
205 }
206}
207
208QString TimeZoneConfigurationWindow::getTzOffsetStringFrom(QDoubleSpinBox * spinBox)
209{
210 Q_ASSERT(spinBox);
211
212 int offset = spinBox->value() * 3600;
213 //Offset is POSIX style: UTC - local time = offset,
214 //so invert the sign:
215 QChar offsetSign = (offset > 0) ? '-' : '+';
216 offset = abs(offset);
217 int offsetSeconds = offset % 60; offset /= 60.;
218 int offsetMinutes = offset % 60; offset /= 60.;
219 int offsetHours = offset;
220
221 return QString("%1%2:%3:%4").arg(offsetSign).arg(offsetHours, 2, 10, QChar('0')).arg(offsetMinutes, 2, 10, QChar('0')).arg(offsetSeconds, 2, 10, QChar('0'));
222}
223
224void TimeZoneConfigurationWindow::updateDisplayFormatSwitches()
225{
226 StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
227
228 QString timeFormat = localeManager.getTimeFormatStr();
229 if (timeFormat == "12h")
230 ui->radioButtonTime12Hour->setChecked(true);
231 else if (timeFormat == "24h")
232 ui->radioButtonTime24Hour->setChecked(true);
233 else
234 ui->radioButtonTimeDefault->setChecked(true);
235
236 QString dateFormat = localeManager.getDateFormatStr();
237 if (dateFormat == "yyyymmdd")
238 ui->radioButtonDateYMD->setChecked(true);
239 else if (dateFormat == "ddmmyyyy")
240 ui->radioButtonDateDMY->setChecked(true);
241 else if (dateFormat == "mmddyyyy")
242 ui->radioButtonDateMDY->setChecked(true);
243 else
244 ui->radioButtonDateDefault->setChecked(true);
245}
246
247void TimeZoneConfigurationWindow::setTimeFormat(bool)
248{
249 //TODO: This will break if the settings' format is changed.
250 //It's a pity StelLocaleMgr::sTimeFormatToString() is private...
251 QString selectedFormat;
252 if (ui->radioButtonTime12Hour->isChecked())
253 selectedFormat = "12h";
254 else if (ui->radioButtonTime24Hour->isChecked())
255 selectedFormat = "24h";
256 else
257 selectedFormat = "system_default";
258
259 StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
260 if (selectedFormat == localeManager.getTimeFormatStr())
261 return;
262 localeManager.setTimeFormatStr(selectedFormat);
263 timeZoneConfiguration->saveDisplayFormats();
264}
265
266void TimeZoneConfigurationWindow::setDateFormat(bool)
267{
268 //TODO: This will break if the settings' format is changed.
269 //It's a pity StelLocaleMgr::sDateFormatToString() is private...
270 QString selectedFormat;
271 if (ui->radioButtonDateYMD->isChecked())
272 selectedFormat = "yyyymmdd";
273 else if (ui->radioButtonDateDMY->isChecked())
274 selectedFormat = "ddmmyyyy";
275 else if (ui->radioButtonDateMDY->isChecked())
276 selectedFormat = "mmddyyyy";
277 else
278 selectedFormat = "system_default";
279
280 StelLocaleMgr & localeManager = StelApp::getInstance().getLocaleMgr();
281 if (selectedFormat == localeManager.getDateFormatStr())
282 return;
283 localeManager.setDateFormatStr(selectedFormat);
284 timeZoneConfiguration->saveDisplayFormats();
285}
2860
=== removed file 'plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.hpp'
--- plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.hpp 2012-02-13 18:59:16 +0000
+++ plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.hpp 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
1/*
2 * Time zone configuration plug-in for Stellarium
3 *
4 * Copyright (C) 2010 Bogdan Marinov
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _TIME_ZONE_CONFIGURATION_WINDOW_HPP_
21#define _TIME_ZONE_CONFIGURATION_WINDOW_HPP_
22
23#include "StelDialog.hpp"
24
25#include <QString>
26#include <QDoubleSpinBox>
27
28class Ui_timeZoneConfigurationWindowForm;
29class TimeZoneConfiguration;
30class DefineTimeZoneWindow;
31
32//! Main window of the Time Zone configuration plug-in.
33class TimeZoneConfigurationWindow : public StelDialog
34{
35 Q_OBJECT
36
37public:
38 TimeZoneConfigurationWindow();
39 ~TimeZoneConfigurationWindow();
40
41 //! Parses an offset string in the format [+|-]hh[:mm[:ss]].
42 //! \returns a fraction of hours. The sign is inverted,
43 //! as in the TZ format offset = (UTC - local time),
44 //! and the traditional offset = (local time - UTC).
45 static double readTzOffsetString(const QString& string);
46
47 //! Parses a time string in the format hh[:mm[:ss]] to separate values.
48 //! Used both by readTzOffsetString() and in DefineTimeZoneWindow.
49 static void readTzTimeString(const QString& string, int& hour, int& minutes, int& seconds);
50
51 //! Converts a decimal fraction of hours to a string containing a signed
52 //! offset in the format used in the TZ variable.
53 //! The sign is inverted, as in the TZ format offset = (UTC - local time),
54 //! not the traditional offset = (local time - UTC).
55 static QString getTzOffsetStringFrom(QDoubleSpinBox * spinBox);
56
57public slots:
58 void retranslate();
59
60protected:
61 void createDialogContent();
62
63private:
64 Ui_timeZoneConfigurationWindowForm * ui;
65 DefineTimeZoneWindow * defineTimeZoneWindow;
66 TimeZoneConfiguration * timeZoneConfiguration;
67
68 void updateAboutText();
69
70private slots:
71 void saveTimeZoneSettings();
72 void openDefineTimeZoneWindow();
73 void closeDefineTimeZoneWindow(bool);
74 void timeZoneDefined(QString timeZoneDefinition);
75
76 void setTimeFormat(bool);
77 void setDateFormat(bool);
78 void updateDisplayFormatSwitches();
79};
80
81
82#endif //_TIME_ZONE_CONFIGURATION_WINDOW_HPP_
830
=== removed file 'plugins/TimeZoneConfiguration/src/gui/defineTimeZone.ui'
--- plugins/TimeZoneConfiguration/src/gui/defineTimeZone.ui 2011-11-17 16:55:28 +0000
+++ plugins/TimeZoneConfiguration/src/gui/defineTimeZone.ui 1970-01-01 00:00:00 +0000
@@ -1,621 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>defineTimeZoneForm</class>
4 <widget class="QWidget" name="defineTimeZoneForm">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>450</width>
10 <height>474</height>
11 </rect>
12 </property>
13 <layout class="QVBoxLayout" name="verticalLayout">
14 <property name="spacing">
15 <number>0</number>
16 </property>
17 <property name="margin">
18 <number>0</number>
19 </property>
20 <item>
21 <widget class="BarFrame" name="TitleBar">
22 <property name="sizePolicy">
23 <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
24 <horstretch>0</horstretch>
25 <verstretch>0</verstretch>
26 </sizepolicy>
27 </property>
28 <property name="minimumSize">
29 <size>
30 <width>0</width>
31 <height>25</height>
32 </size>
33 </property>
34 <property name="maximumSize">
35 <size>
36 <width>16777215</width>
37 <height>30</height>
38 </size>
39 </property>
40 <property name="focusPolicy">
41 <enum>Qt::NoFocus</enum>
42 </property>
43 <property name="autoFillBackground">
44 <bool>false</bool>
45 </property>
46 <property name="frameShape">
47 <enum>QFrame::StyledPanel</enum>
48 </property>
49 <layout class="QHBoxLayout">
50 <property name="spacing">
51 <number>6</number>
52 </property>
53 <property name="leftMargin">
54 <number>0</number>
55 </property>
56 <property name="topMargin">
57 <number>0</number>
58 </property>
59 <property name="rightMargin">
60 <number>4</number>
61 </property>
62 <property name="bottomMargin">
63 <number>0</number>
64 </property>
65 <item>
66 <spacer name="leftSpacer">
67 <property name="orientation">
68 <enum>Qt::Horizontal</enum>
69 </property>
70 <property name="sizeHint" stdset="0">
71 <size>
72 <width>40</width>
73 <height>20</height>
74 </size>
75 </property>
76 </spacer>
77 </item>
78 <item>
79 <widget class="QLabel" name="stelWindowTitle">
80 <property name="text">
81 <string>Define a time zone</string>
82 </property>
83 </widget>
84 </item>
85 <item>
86 <spacer name="rightSpacer">
87 <property name="orientation">
88 <enum>Qt::Horizontal</enum>
89 </property>
90 <property name="sizeHint" stdset="0">
91 <size>
92 <width>40</width>
93 <height>20</height>
94 </size>
95 </property>
96 </spacer>
97 </item>
98 <item>
99 <widget class="QPushButton" name="closeStelWindow">
100 <property name="minimumSize">
101 <size>
102 <width>16</width>
103 <height>16</height>
104 </size>
105 </property>
106 <property name="maximumSize">
107 <size>
108 <width>16</width>
109 <height>16</height>
110 </size>
111 </property>
112 <property name="focusPolicy">
113 <enum>Qt::NoFocus</enum>
114 </property>
115 <property name="text">
116 <string/>
117 </property>
118 </widget>
119 </item>
120 </layout>
121 </widget>
122 </item>
123 <item>
124 <widget class="QGroupBox" name="groupBoxTimeZone">
125 <property name="title">
126 <string>Time zone</string>
127 </property>
128 <layout class="QVBoxLayout" name="verticalLayoutTimeZone">
129 <property name="margin">
130 <number>0</number>
131 </property>
132 <item>
133 <layout class="QHBoxLayout" name="horizontalLayoutName">
134 <item>
135 <widget class="QLabel" name="labelName">
136 <property name="text">
137 <string>Timezone name:</string>
138 </property>
139 </widget>
140 </item>
141 <item>
142 <spacer name="horizontalSpacerName">
143 <property name="orientation">
144 <enum>Qt::Horizontal</enum>
145 </property>
146 <property name="sizeHint" stdset="0">
147 <size>
148 <width>40</width>
149 <height>20</height>
150 </size>
151 </property>
152 </spacer>
153 </item>
154 <item>
155 <widget class="QLineEdit" name="lineEditName"/>
156 </item>
157 </layout>
158 </item>
159 <item>
160 <layout class="QHBoxLayout" name="horizontalLayoutOffset">
161 <item>
162 <widget class="QLabel" name="labelOffset">
163 <property name="text">
164 <string>Offset from UTC (hours):</string>
165 </property>
166 </widget>
167 </item>
168 <item>
169 <spacer name="horizontalSpacer">
170 <property name="orientation">
171 <enum>Qt::Horizontal</enum>
172 </property>
173 <property name="sizeHint" stdset="0">
174 <size>
175 <width>40</width>
176 <height>20</height>
177 </size>
178 </property>
179 </spacer>
180 </item>
181 <item>
182 <widget class="QDoubleSpinBox" name="doubleSpinBoxOffset">
183 <property name="wrapping">
184 <bool>true</bool>
185 </property>
186 <property name="minimum">
187 <double>-24.000000000000000</double>
188 </property>
189 <property name="maximum">
190 <double>24.000000000000000</double>
191 </property>
192 <property name="singleStep">
193 <double>0.250000000000000</double>
194 </property>
195 </widget>
196 </item>
197 </layout>
198 </item>
199 <item>
200 <widget class="QCheckBox" name="checkBoxDst">
201 <property name="text">
202 <string>Daylight saving time (summer time)</string>
203 </property>
204 </widget>
205 </item>
206 <item>
207 <widget class="QFrame" name="frameDst">
208 <layout class="QVBoxLayout" name="verticalLayoutDst">
209 <property name="spacing">
210 <number>0</number>
211 </property>
212 <property name="margin">
213 <number>0</number>
214 </property>
215 <item>
216 <widget class="QFrame" name="frame">
217 <layout class="QVBoxLayout" name="verticalLayoutDstMain">
218 <property name="margin">
219 <number>0</number>
220 </property>
221 <item>
222 <layout class="QHBoxLayout" name="horizontalLayoutNameDst">
223 <item>
224 <widget class="QLabel" name="labelNameDst">
225 <property name="sizePolicy">
226 <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
227 <horstretch>0</horstretch>
228 <verstretch>0</verstretch>
229 </sizepolicy>
230 </property>
231 <property name="text">
232 <string>DST timezone name:</string>
233 </property>
234 </widget>
235 </item>
236 <item>
237 <spacer name="horizontalSpacerNameDst">
238 <property name="orientation">
239 <enum>Qt::Horizontal</enum>
240 </property>
241 <property name="sizeHint" stdset="0">
242 <size>
243 <width>40</width>
244 <height>20</height>
245 </size>
246 </property>
247 </spacer>
248 </item>
249 <item>
250 <widget class="QLineEdit" name="lineEditNameDst"/>
251 </item>
252 </layout>
253 </item>
254 <item>
255 <layout class="QHBoxLayout" name="horizontalLayoutOffsetDst">
256 <item>
257 <widget class="QCheckBox" name="checkBoxOffsetDst">
258 <property name="text">
259 <string>DST offset from UTC (hours):</string>
260 </property>
261 </widget>
262 </item>
263 <item>
264 <spacer name="horizontalSpacerOffsetDst">
265 <property name="orientation">
266 <enum>Qt::Horizontal</enum>
267 </property>
268 <property name="sizeHint" stdset="0">
269 <size>
270 <width>0</width>
271 <height>0</height>
272 </size>
273 </property>
274 </spacer>
275 </item>
276 <item>
277 <widget class="QDoubleSpinBox" name="doubleSpinBoxOffsetDst">
278 <property name="wrapping">
279 <bool>true</bool>
280 </property>
281 <property name="minimum">
282 <double>-24.000000000000000</double>
283 </property>
284 <property name="maximum">
285 <double>24.000000000000000</double>
286 </property>
287 <property name="singleStep">
288 <double>0.250000000000000</double>
289 </property>
290 </widget>
291 </item>
292 </layout>
293 </item>
294 </layout>
295 </widget>
296 </item>
297 <item>
298 <widget class="QGroupBox" name="groupBoxDstStart">
299 <property name="title">
300 <string>Daylight saving time start</string>
301 </property>
302 <property name="checkable">
303 <bool>true</bool>
304 </property>
305 <property name="checked">
306 <bool>false</bool>
307 </property>
308 <layout class="QGridLayout" name="gridLayoutDstStart">
309 <property name="margin">
310 <number>0</number>
311 </property>
312 <item row="1" column="0" colspan="2">
313 <widget class="QRadioButton" name="radioButtonDstStartDay">
314 <property name="text">
315 <string>Day:</string>
316 </property>
317 </widget>
318 </item>
319 <item row="1" column="5">
320 <widget class="QComboBox" name="comboBoxDstStartMonth"/>
321 </item>
322 <item row="4" column="0" colspan="2">
323 <widget class="QCheckBox" name="checkBoxDstStartTime">
324 <property name="text">
325 <string>Time of change:</string>
326 </property>
327 </widget>
328 </item>
329 <item row="4" column="2" colspan="4">
330 <widget class="QTimeEdit" name="timeEditDstStart">
331 <property name="wrapping">
332 <bool>true</bool>
333 </property>
334 <property name="time">
335 <time>
336 <hour>2</hour>
337 <minute>0</minute>
338 <second>0</second>
339 </time>
340 </property>
341 <property name="displayFormat">
342 <string notr="true">HH:mm:ss</string>
343 </property>
344 </widget>
345 </item>
346 <item row="2" column="0" colspan="2">
347 <widget class="QRadioButton" name="radioButtonDstStartDate">
348 <property name="text">
349 <string>Date:</string>
350 </property>
351 </widget>
352 </item>
353 <item row="2" column="2" colspan="4">
354 <widget class="QFrame" name="frameDstStartDate">
355 <layout class="QHBoxLayout" name="horizontalLayout">
356 <property name="margin">
357 <number>0</number>
358 </property>
359 <item>
360 <widget class="QSpinBox" name="spinBoxDstStartDateDay"/>
361 </item>
362 <item>
363 <widget class="QComboBox" name="comboBoxDstStartDateMonth"/>
364 </item>
365 </layout>
366 </widget>
367 </item>
368 <item row="1" column="3" colspan="2">
369 <widget class="QComboBox" name="comboBoxDstStartWeek"/>
370 </item>
371 <item row="1" column="2">
372 <widget class="QComboBox" name="comboBoxDstStartDay"/>
373 </item>
374 </layout>
375 </widget>
376 </item>
377 <item>
378 <widget class="QGroupBox" name="groupBoxDstEnd">
379 <property name="title">
380 <string>Daylight saving time end</string>
381 </property>
382 <property name="checkable">
383 <bool>true</bool>
384 </property>
385 <property name="checked">
386 <bool>false</bool>
387 </property>
388 <layout class="QGridLayout" name="gridLayout_4">
389 <property name="margin">
390 <number>0</number>
391 </property>
392 <item row="1" column="0" colspan="2">
393 <widget class="QRadioButton" name="radioButtonDstEndDay">
394 <property name="text">
395 <string>Day:</string>
396 </property>
397 </widget>
398 </item>
399 <item row="1" column="5">
400 <widget class="QComboBox" name="comboBoxDstEndMonth"/>
401 </item>
402 <item row="4" column="0" colspan="2">
403 <widget class="QCheckBox" name="checkBoxDstEndTime">
404 <property name="text">
405 <string>Time of change:</string>
406 </property>
407 </widget>
408 </item>
409 <item row="4" column="2" colspan="4">
410 <widget class="QTimeEdit" name="timeEditDstEnd">
411 <property name="wrapping">
412 <bool>true</bool>
413 </property>
414 <property name="time">
415 <time>
416 <hour>2</hour>
417 <minute>0</minute>
418 <second>0</second>
419 </time>
420 </property>
421 <property name="displayFormat">
422 <string notr="true">HH:mm:ss</string>
423 </property>
424 </widget>
425 </item>
426 <item row="3" column="0" colspan="2">
427 <widget class="QRadioButton" name="radioButtonDstEndDate">
428 <property name="text">
429 <string>Date:</string>
430 </property>
431 </widget>
432 </item>
433 <item row="3" column="2" colspan="4">
434 <widget class="QFrame" name="frameDstEndDate">
435 <layout class="QHBoxLayout" name="horizontalLayoutDstEndDate">
436 <property name="margin">
437 <number>0</number>
438 </property>
439 <item>
440 <widget class="QSpinBox" name="spinBoxDstEndDateDay"/>
441 </item>
442 <item>
443 <widget class="QComboBox" name="comboBoxDstEndDateMonth"/>
444 </item>
445 </layout>
446 </widget>
447 </item>
448 <item row="1" column="3" colspan="2">
449 <widget class="QComboBox" name="comboBoxDstEndWeek"/>
450 </item>
451 <item row="1" column="2">
452 <widget class="QComboBox" name="comboBoxDstEndDay"/>
453 </item>
454 </layout>
455 </widget>
456 </item>
457 </layout>
458 </widget>
459 </item>
460 <item>
461 <spacer name="verticalSpacer">
462 <property name="orientation">
463 <enum>Qt::Vertical</enum>
464 </property>
465 <property name="sizeHint" stdset="0">
466 <size>
467 <width>20</width>
468 <height>40</height>
469 </size>
470 </property>
471 </spacer>
472 </item>
473 <item>
474 <widget class="QPushButton" name="pushButtonUseDefinition">
475 <property name="text">
476 <string>Use this definition</string>
477 </property>
478 </widget>
479 </item>
480 </layout>
481 </widget>
482 </item>
483 </layout>
484 </widget>
485 <customwidgets>
486 <customwidget>
487 <class>BarFrame</class>
488 <extends>QFrame</extends>
489 <header>Dialog.hpp</header>
490 <container>1</container>
491 </customwidget>
492 </customwidgets>
493 <tabstops>
494 <tabstop>lineEditName</tabstop>
495 <tabstop>doubleSpinBoxOffset</tabstop>
496 <tabstop>checkBoxDst</tabstop>
497 <tabstop>lineEditNameDst</tabstop>
498 <tabstop>checkBoxOffsetDst</tabstop>
499 <tabstop>doubleSpinBoxOffsetDst</tabstop>
500 <tabstop>radioButtonDstStartDay</tabstop>
501 <tabstop>groupBoxDstStart</tabstop>
502 <tabstop>comboBoxDstStartDay</tabstop>
503 <tabstop>comboBoxDstStartWeek</tabstop>
504 <tabstop>comboBoxDstStartMonth</tabstop>
505 <tabstop>radioButtonDstStartDate</tabstop>
506 <tabstop>spinBoxDstStartDateDay</tabstop>
507 <tabstop>comboBoxDstStartDateMonth</tabstop>
508 <tabstop>checkBoxDstStartTime</tabstop>
509 <tabstop>timeEditDstStart</tabstop>
510 <tabstop>groupBoxDstEnd</tabstop>
511 <tabstop>radioButtonDstEndDay</tabstop>
512 <tabstop>comboBoxDstEndDay</tabstop>
513 <tabstop>comboBoxDstEndWeek</tabstop>
514 <tabstop>comboBoxDstEndMonth</tabstop>
515 <tabstop>radioButtonDstEndDate</tabstop>
516 <tabstop>spinBoxDstEndDateDay</tabstop>
517 <tabstop>comboBoxDstEndDateMonth</tabstop>
518 <tabstop>checkBoxDstEndTime</tabstop>
519 <tabstop>timeEditDstEnd</tabstop>
520 <tabstop>pushButtonUseDefinition</tabstop>
521 </tabstops>
522 <resources/>
523 <connections>
524 <connection>
525 <sender>checkBoxDst</sender>
526 <signal>toggled(bool)</signal>
527 <receiver>frameDst</receiver>
528 <slot>setVisible(bool)</slot>
529 <hints>
530 <hint type="sourcelabel">
531 <x>230</x>
532 <y>125</y>
533 </hint>
534 <hint type="destinationlabel">
535 <x>228</x>
536 <y>316</y>
537 </hint>
538 </hints>
539 </connection>
540 <connection>
541 <sender>checkBoxOffsetDst</sender>
542 <signal>toggled(bool)</signal>
543 <receiver>doubleSpinBoxOffsetDst</receiver>
544 <slot>setEnabled(bool)</slot>
545 <hints>
546 <hint type="sourcelabel">
547 <x>172</x>
548 <y>186</y>
549 </hint>
550 <hint type="destinationlabel">
551 <x>348</x>
552 <y>188</y>
553 </hint>
554 </hints>
555 </connection>
556 <connection>
557 <sender>checkBoxDstEndTime</sender>
558 <signal>toggled(bool)</signal>
559 <receiver>timeEditDstEnd</receiver>
560 <slot>setEnabled(bool)</slot>
561 <hints>
562 <hint type="sourcelabel">
563 <x>95</x>
564 <y>427</y>
565 </hint>
566 <hint type="destinationlabel">
567 <x>362</x>
568 <y>430</y>
569 </hint>
570 </hints>
571 </connection>
572 <connection>
573 <sender>checkBoxDstStartTime</sender>
574 <signal>toggled(bool)</signal>
575 <receiver>timeEditDstStart</receiver>
576 <slot>setEnabled(bool)</slot>
577 <hints>
578 <hint type="sourcelabel">
579 <x>115</x>
580 <y>298</y>
581 </hint>
582 <hint type="destinationlabel">
583 <x>187</x>
584 <y>294</y>
585 </hint>
586 </hints>
587 </connection>
588 <connection>
589 <sender>groupBoxDstStart</sender>
590 <signal>toggled(bool)</signal>
591 <receiver>groupBoxDstEnd</receiver>
592 <slot>setChecked(bool)</slot>
593 <hints>
594 <hint type="sourcelabel">
595 <x>117</x>
596 <y>243</y>
597 </hint>
598 <hint type="destinationlabel">
599 <x>123</x>
600 <y>362</y>
601 </hint>
602 </hints>
603 </connection>
604 <connection>
605 <sender>groupBoxDstEnd</sender>
606 <signal>toggled(bool)</signal>
607 <receiver>groupBoxDstStart</receiver>
608 <slot>setChecked(bool)</slot>
609 <hints>
610 <hint type="sourcelabel">
611 <x>301</x>
612 <y>354</y>
613 </hint>
614 <hint type="destinationlabel">
615 <x>295</x>
616 <y>286</y>
617 </hint>
618 </hints>
619 </connection>
620 </connections>
621</ui>
6220
=== removed file 'plugins/TimeZoneConfiguration/src/gui/timeZoneConfigurationWindow.ui'
--- plugins/TimeZoneConfiguration/src/gui/timeZoneConfigurationWindow.ui 2013-12-23 00:22:34 +0000
+++ plugins/TimeZoneConfiguration/src/gui/timeZoneConfigurationWindow.ui 1970-01-01 00:00:00 +0000
@@ -1,585 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>timeZoneConfigurationWindowForm</class>
4 <widget class="QWidget" name="timeZoneConfigurationWindowForm">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>448</width>
10 <height>480</height>
11 </rect>
12 </property>
13 <layout class="QVBoxLayout" name="verticalLayout">
14 <property name="spacing">
15 <number>0</number>
16 </property>
17 <property name="leftMargin">
18 <number>0</number>
19 </property>
20 <property name="topMargin">
21 <number>0</number>
22 </property>
23 <property name="rightMargin">
24 <number>0</number>
25 </property>
26 <property name="bottomMargin">
27 <number>0</number>
28 </property>
29 <item>
30 <widget class="BarFrame" name="TitleBar">
31 <property name="sizePolicy">
32 <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
33 <horstretch>0</horstretch>
34 <verstretch>0</verstretch>
35 </sizepolicy>
36 </property>
37 <property name="minimumSize">
38 <size>
39 <width>0</width>
40 <height>25</height>
41 </size>
42 </property>
43 <property name="maximumSize">
44 <size>
45 <width>16777215</width>
46 <height>30</height>
47 </size>
48 </property>
49 <property name="focusPolicy">
50 <enum>Qt::NoFocus</enum>
51 </property>
52 <property name="autoFillBackground">
53 <bool>false</bool>
54 </property>
55 <property name="frameShape">
56 <enum>QFrame::StyledPanel</enum>
57 </property>
58 <layout class="QHBoxLayout">
59 <property name="spacing">
60 <number>6</number>
61 </property>
62 <property name="leftMargin">
63 <number>0</number>
64 </property>
65 <property name="topMargin">
66 <number>0</number>
67 </property>
68 <property name="rightMargin">
69 <number>4</number>
70 </property>
71 <property name="bottomMargin">
72 <number>0</number>
73 </property>
74 <item>
75 <spacer name="leftSpacer">
76 <property name="orientation">
77 <enum>Qt::Horizontal</enum>
78 </property>
79 <property name="sizeHint" stdset="0">
80 <size>
81 <width>40</width>
82 <height>20</height>
83 </size>
84 </property>
85 </spacer>
86 </item>
87 <item>
88 <widget class="QLabel" name="stelWindowTitle">
89 <property name="text">
90 <string>Time zone</string>
91 </property>
92 </widget>
93 </item>
94 <item>
95 <spacer name="rightSpacer">
96 <property name="orientation">
97 <enum>Qt::Horizontal</enum>
98 </property>
99 <property name="sizeHint" stdset="0">
100 <size>
101 <width>40</width>
102 <height>20</height>
103 </size>
104 </property>
105 </spacer>
106 </item>
107 <item>
108 <widget class="QPushButton" name="closeStelWindow">
109 <property name="minimumSize">
110 <size>
111 <width>16</width>
112 <height>16</height>
113 </size>
114 </property>
115 <property name="maximumSize">
116 <size>
117 <width>16</width>
118 <height>16</height>
119 </size>
120 </property>
121 <property name="focusPolicy">
122 <enum>Qt::NoFocus</enum>
123 </property>
124 <property name="text">
125 <string/>
126 </property>
127 </widget>
128 </item>
129 </layout>
130 </widget>
131 </item>
132 <item>
133 <widget class="QTabWidget" name="tabWidget">
134 <widget class="QWidget" name="tabTimeZone">
135 <attribute name="title">
136 <string>Time zone</string>
137 </attribute>
138 <layout class="QVBoxLayout" name="verticalLayoutTimeZone">
139 <property name="spacing">
140 <number>0</number>
141 </property>
142 <property name="leftMargin">
143 <number>0</number>
144 </property>
145 <property name="topMargin">
146 <number>0</number>
147 </property>
148 <property name="rightMargin">
149 <number>0</number>
150 </property>
151 <property name="bottomMargin">
152 <number>0</number>
153 </property>
154 <item>
155 <widget class="QGroupBox" name="groupBoxTimeZone">
156 <property name="minimumSize">
157 <size>
158 <width>0</width>
159 <height>400</height>
160 </size>
161 </property>
162 <property name="title">
163 <string>Time zone</string>
164 </property>
165 <layout class="QGridLayout" name="gridLayoutCurrent">
166 <property name="leftMargin">
167 <number>0</number>
168 </property>
169 <property name="topMargin">
170 <number>0</number>
171 </property>
172 <property name="rightMargin">
173 <number>0</number>
174 </property>
175 <property name="bottomMargin">
176 <number>0</number>
177 </property>
178 <property name="verticalSpacing">
179 <number>8</number>
180 </property>
181 <item row="0" column="0" colspan="2">
182 <widget class="QLabel" name="labelTimeZoneInfo">
183 <property name="text">
184 <string>By default, the time displayed in Stellarium is interpreted as the local time in the system's time zone, not in the displayed location's time zone. This behaviour can be changed by changing Stellarium's global time zone settings.</string>
185 </property>
186 <property name="wordWrap">
187 <bool>true</bool>
188 </property>
189 </widget>
190 </item>
191 <item row="1" column="0" colspan="2">
192 <widget class="QRadioButton" name="radioButtonLocalSettings">
193 <property name="text">
194 <string>Use system settings (default)</string>
195 </property>
196 </widget>
197 </item>
198 <item row="2" column="0" colspan="2">
199 <widget class="QRadioButton" name="radioButtonUtc">
200 <property name="text">
201 <string>Universal Coordinated Time (UTC)</string>
202 </property>
203 </widget>
204 </item>
205 <item row="3" column="0">
206 <widget class="QRadioButton" name="radioButtonOffset">
207 <property name="text">
208 <string>Offset from UTC (hours):</string>
209 </property>
210 </widget>
211 </item>
212 <item row="3" column="1">
213 <widget class="QDoubleSpinBox" name="doubleSpinBoxOffset">
214 <property name="wrapping">
215 <bool>true</bool>
216 </property>
217 <property name="decimals">
218 <number>2</number>
219 </property>
220 <property name="minimum">
221 <double>-24.000000000000000</double>
222 </property>
223 <property name="maximum">
224 <double>24.000000000000000</double>
225 </property>
226 <property name="singleStep">
227 <double>0.250000000000000</double>
228 </property>
229 </widget>
230 </item>
231 <item row="4" column="0" colspan="2">
232 <widget class="QLabel" name="labelOffset">
233 <property name="text">
234 <string>(offset = local time - UTC time)</string>
235 </property>
236 <property name="alignment">
237 <set>Qt::AlignCenter</set>
238 </property>
239 </widget>
240 </item>
241 <item row="5" column="0">
242 <widget class="QRadioButton" name="radioButtonUserDefined">
243 <property name="text">
244 <string>User-defined:</string>
245 </property>
246 </widget>
247 </item>
248 <item row="5" column="1">
249 <widget class="QFrame" name="frameUserDefined">
250 <layout class="QHBoxLayout" name="horizontalLayout">
251 <property name="leftMargin">
252 <number>0</number>
253 </property>
254 <property name="topMargin">
255 <number>0</number>
256 </property>
257 <property name="rightMargin">
258 <number>0</number>
259 </property>
260 <property name="bottomMargin">
261 <number>0</number>
262 </property>
263 <item>
264 <widget class="QLineEdit" name="lineEditUserDefined"/>
265 </item>
266 <item>
267 <widget class="QPushButton" name="pushButtonEditTimeZone">
268 <property name="text">
269 <string notr="true">...</string>
270 </property>
271 </widget>
272 </item>
273 </layout>
274 </widget>
275 </item>
276 <item row="7" column="0" colspan="2">
277 <widget class="QPushButton" name="pushButtonSave">
278 <property name="text">
279 <string>Save settings</string>
280 </property>
281 </widget>
282 </item>
283 <item row="8" column="0" colspan="2">
284 <widget class="QLabel" name="labelRestart">
285 <property name="text">
286 <string>Any changes will take effect the next time Stellarium is started.</string>
287 </property>
288 <property name="alignment">
289 <set>Qt::AlignCenter</set>
290 </property>
291 <property name="wordWrap">
292 <bool>true</bool>
293 </property>
294 </widget>
295 </item>
296 <item row="9" column="0" colspan="2">
297 <spacer name="verticalSpacerTimeZone">
298 <property name="orientation">
299 <enum>Qt::Vertical</enum>
300 </property>
301 <property name="sizeHint" stdset="0">
302 <size>
303 <width>0</width>
304 <height>0</height>
305 </size>
306 </property>
307 </spacer>
308 </item>
309 </layout>
310 </widget>
311 </item>
312 </layout>
313 </widget>
314 <widget class="QWidget" name="tabDisplayFormats">
315 <attribute name="title">
316 <string>Display formats</string>
317 </attribute>
318 <layout class="QVBoxLayout" name="verticalLayoutTabTimeFormat">
319 <property name="spacing">
320 <number>0</number>
321 </property>
322 <property name="leftMargin">
323 <number>0</number>
324 </property>
325 <property name="topMargin">
326 <number>0</number>
327 </property>
328 <property name="rightMargin">
329 <number>0</number>
330 </property>
331 <property name="bottomMargin">
332 <number>0</number>
333 </property>
334 <item>
335 <widget class="QGroupBox" name="groupBoxDisplayFormats">
336 <property name="title">
337 <string>Display formats</string>
338 </property>
339 <property name="alignment">
340 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
341 </property>
342 <layout class="QVBoxLayout" name="verticalLayout_4">
343 <property name="leftMargin">
344 <number>0</number>
345 </property>
346 <property name="topMargin">
347 <number>0</number>
348 </property>
349 <property name="rightMargin">
350 <number>0</number>
351 </property>
352 <property name="bottomMargin">
353 <number>0</number>
354 </property>
355 <item>
356 <widget class="QLabel" name="labelDisplayFormats">
357 <property name="text">
358 <string>These settings control the way time and date are displayed in the bottom bar.</string>
359 </property>
360 <property name="wordWrap">
361 <bool>true</bool>
362 </property>
363 </widget>
364 </item>
365 <item>
366 <widget class="QGroupBox" name="groupBoxTimeFormat">
367 <property name="title">
368 <string>Time display format</string>
369 </property>
370 <layout class="QVBoxLayout" name="verticalLayoutTimeFormat">
371 <property name="leftMargin">
372 <number>0</number>
373 </property>
374 <property name="topMargin">
375 <number>0</number>
376 </property>
377 <property name="rightMargin">
378 <number>0</number>
379 </property>
380 <property name="bottomMargin">
381 <number>0</number>
382 </property>
383 <item>
384 <widget class="QRadioButton" name="radioButtonTimeDefault">
385 <property name="text">
386 <string>System default</string>
387 </property>
388 </widget>
389 </item>
390 <item>
391 <widget class="QRadioButton" name="radioButtonTime12Hour">
392 <property name="text">
393 <string>12-hour format</string>
394 </property>
395 </widget>
396 </item>
397 <item>
398 <widget class="QRadioButton" name="radioButtonTime24Hour">
399 <property name="text">
400 <string>24-hour format</string>
401 </property>
402 </widget>
403 </item>
404 </layout>
405 </widget>
406 </item>
407 <item>
408 <widget class="QGroupBox" name="groupBoxDateFormat">
409 <property name="title">
410 <string>Date display format</string>
411 </property>
412 <layout class="QVBoxLayout" name="verticalLayoutDateFormat">
413 <property name="leftMargin">
414 <number>0</number>
415 </property>
416 <property name="topMargin">
417 <number>0</number>
418 </property>
419 <property name="rightMargin">
420 <number>0</number>
421 </property>
422 <property name="bottomMargin">
423 <number>0</number>
424 </property>
425 <item>
426 <widget class="QRadioButton" name="radioButtonDateDefault">
427 <property name="text">
428 <string>System default</string>
429 </property>
430 </widget>
431 </item>
432 <item>
433 <widget class="QRadioButton" name="radioButtonDateYMD">
434 <property name="text">
435 <string>yyyy-mm-dd (ISO 8601)</string>
436 </property>
437 </widget>
438 </item>
439 <item>
440 <widget class="QRadioButton" name="radioButtonDateDMY">
441 <property name="text">
442 <string>dd-mm-yyyy</string>
443 </property>
444 </widget>
445 </item>
446 <item>
447 <widget class="QRadioButton" name="radioButtonDateMDY">
448 <property name="text">
449 <string>mm-dd-yyyy</string>
450 </property>
451 </widget>
452 </item>
453 </layout>
454 </widget>
455 </item>
456 </layout>
457 </widget>
458 </item>
459 <item>
460 <spacer name="verticalSpacerDisplayFormats">
461 <property name="orientation">
462 <enum>Qt::Vertical</enum>
463 </property>
464 <property name="sizeHint" stdset="0">
465 <size>
466 <width>0</width>
467 <height>0</height>
468 </size>
469 </property>
470 </spacer>
471 </item>
472 </layout>
473 </widget>
474 <widget class="QWidget" name="tabAbout">
475 <attribute name="title">
476 <string comment="tab in plugin windows">About</string>
477 </attribute>
478 <layout class="QVBoxLayout" name="verticalLayout_3">
479 <item>
480 <widget class="QLabel" name="labelTitle">
481 <property name="styleSheet">
482 <string notr="true">QLabel {
483 font: bold 18pt ;
484}</string>
485 </property>
486 <property name="text">
487 <string notr="true">Time Zone plug-in</string>
488 </property>
489 </widget>
490 </item>
491 <item>
492 <widget class="QLabel" name="labelVersion">
493 <property name="text">
494 <string notr="true">Version %1</string>
495 </property>
496 </widget>
497 </item>
498 <item>
499 <widget class="QLabel" name="labelCopyright">
500 <property name="text">
501 <string notr="true">Copyright &amp;copy; 2010 Bogdan Marinov</string>
502 </property>
503 <property name="textFormat">
504 <enum>Qt::RichText</enum>
505 </property>
506 </widget>
507 </item>
508 <item>
509 <widget class="QLabel" name="labelLicense">
510 <property name="sizePolicy">
511 <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
512 <horstretch>0</horstretch>
513 <verstretch>0</verstretch>
514 </sizepolicy>
515 </property>
516 <property name="text">
517 <string notr="true">This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
518
519This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
520
521You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.</string>
522 </property>
523 <property name="alignment">
524 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
525 </property>
526 <property name="wordWrap">
527 <bool>true</bool>
528 </property>
529 <property name="textInteractionFlags">
530 <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
531 </property>
532 </widget>
533 </item>
534 </layout>
535 </widget>
536 </widget>
537 </item>
538 </layout>
539 </widget>
540 <customwidgets>
541 <customwidget>
542 <class>BarFrame</class>
543 <extends>QFrame</extends>
544 <header>Dialog.hpp</header>
545 <container>1</container>
546 </customwidget>
547 </customwidgets>
548 <tabstops>
549 <tabstop>tabWidget</tabstop>
550 <tabstop>radioButtonLocalSettings</tabstop>
551 <tabstop>radioButtonUtc</tabstop>
552 <tabstop>radioButtonOffset</tabstop>
553 <tabstop>doubleSpinBoxOffset</tabstop>
554 <tabstop>radioButtonUserDefined</tabstop>
555 <tabstop>lineEditUserDefined</tabstop>
556 <tabstop>pushButtonEditTimeZone</tabstop>
557 <tabstop>pushButtonSave</tabstop>
558 <tabstop>radioButtonTimeDefault</tabstop>
559 <tabstop>radioButtonTime12Hour</tabstop>
560 <tabstop>radioButtonTime24Hour</tabstop>
561 <tabstop>radioButtonDateDefault</tabstop>
562 <tabstop>radioButtonDateYMD</tabstop>
563 <tabstop>radioButtonDateDMY</tabstop>
564 <tabstop>radioButtonDateMDY</tabstop>
565 </tabstops>
566 <resources/>
567 <connections>
568 <connection>
569 <sender>radioButtonUserDefined</sender>
570 <signal>toggled(bool)</signal>
571 <receiver>frameUserDefined</receiver>
572 <slot>setEnabled(bool)</slot>
573 <hints>
574 <hint type="sourcelabel">
575 <x>79</x>
576 <y>404</y>
577 </hint>
578 <hint type="destinationlabel">
579 <x>296</x>
580 <y>404</y>
581 </hint>
582 </hints>
583 </connection>
584 </connections>
585</ui>
5860
=== modified file 'po/stellarium/POTFILES.in'
--- po/stellarium/POTFILES.in 2016-10-22 13:40:38 +0000
+++ po/stellarium/POTFILES.in 2016-10-25 16:10:21 +0000
@@ -85,11 +85,6 @@
85plugins/TelescopeControl/src/ui_telescopeConfigurationDialog.h85plugins/TelescopeControl/src/ui_telescopeConfigurationDialog.h
86plugins/TelescopeControl/src/ui_telescopeDialog.h86plugins/TelescopeControl/src/ui_telescopeDialog.h
87plugins/TelescopeControl/src/ui_storedPointsDialog.h87plugins/TelescopeControl/src/ui_storedPointsDialog.h
88plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.cpp
89plugins/TimeZoneConfiguration/src/gui/DefineTimeZoneWindow.cpp
90plugins/TimeZoneConfiguration/src/gui/TimeZoneConfigurationWindow.cpp
91plugins/TimeZoneConfiguration/src/ui_defineTimeZone.h
92plugins/TimeZoneConfiguration/src/ui_timeZoneConfigurationWindow.h
93plugins/TextUserInterface/src/TextUserInterface.cpp88plugins/TextUserInterface/src/TextUserInterface.cpp
94plugins/TextUserInterface/src/TuiNodeBool.cpp89plugins/TextUserInterface/src/TuiNodeBool.cpp
95plugins/TextUserInterface/src/TuiNodeColor.cpp90plugins/TextUserInterface/src/TuiNodeColor.cpp
9691
=== modified file 'src/core/StelApp.cpp'
--- src/core/StelApp.cpp 2016-10-03 16:08:03 +0000
+++ src/core/StelApp.cpp 2016-10-25 16:10:21 +0000
@@ -124,10 +124,6 @@
124Q_IMPORT_PLUGIN(SolarSystemEditorStelPluginInterface)124Q_IMPORT_PLUGIN(SolarSystemEditorStelPluginInterface)
125#endif125#endif
126126
127#ifdef USE_STATIC_PLUGIN_TIMEZONECONFIGURATION
128Q_IMPORT_PLUGIN(TimeZoneConfigurationStelPluginInterface)
129#endif
130
131#ifdef USE_STATIC_PLUGIN_METEORSHOWERS127#ifdef USE_STATIC_PLUGIN_METEORSHOWERS
132Q_IMPORT_PLUGIN(MeteorShowersStelPluginInterface)128Q_IMPORT_PLUGIN(MeteorShowersStelPluginInterface)
133#endif129#endif
134130
=== modified file 'src/core/StelCore.cpp'
--- src/core/StelCore.cpp 2016-10-09 05:03:17 +0000
+++ src/core/StelCore.cpp 2016-10-25 16:10:21 +0000
@@ -45,6 +45,7 @@
45#include <QSettings>45#include <QSettings>
46#include <QDebug>46#include <QDebug>
47#include <QMetaEnum>47#include <QMetaEnum>
48#include <QTimeZone>
4849
49#include <iostream>50#include <iostream>
50#include <fstream>51#include <fstream>
@@ -78,7 +79,8 @@
78 , JD(0.,0.)79 , JD(0.,0.)
79 , presetSkyTime(0.)80 , presetSkyTime(0.)
80 , milliSecondsOfLastJDUpdate(0.)81 , milliSecondsOfLastJDUpdate(0.)
81 , jdOfLastJDUpdate(0.)82 , jdOfLastJDUpdate(0.)
83 , flagUseDST(true)
82 , deltaTCustomNDot(-26.0)84 , deltaTCustomNDot(-26.0)
83 , deltaTCustomYear(1820.0)85 , deltaTCustomYear(1820.0)
84 , de430Available(false)86 , de430Available(false)
@@ -118,7 +120,8 @@
118 currentProjectorParams.devicePixelsPerPixel = StelApp::getInstance().getDevicePixelsPerPixel();120 currentProjectorParams.devicePixelsPerPixel = StelApp::getInstance().getDevicePixelsPerPixel();
119121
120 flagUseNutation=conf->value("astro/flag_nutation", true).toBool();122 flagUseNutation=conf->value("astro/flag_nutation", true).toBool();
121 flagUseTopocentricCoordinates=conf->value("astro/flag_topocentric_coordinates", true).toBool(); 123 flagUseTopocentricCoordinates=conf->value("astro/flag_topocentric_coordinates", true).toBool();
124 flagUseDST=conf->value("localization/flag_dst", true).toBool();
122}125}
123126
124127
@@ -164,6 +167,8 @@
164 }167 }
165 position = new StelObserver(location);168 position = new StelObserver(location);
166169
170 setCurrentTimeZone(conf->value("localization/time_zone", getCurrentLocation().timeZone).toString());
171
167 // Delta-T stuff172 // Delta-T stuff
168 // Define default algorithm for time correction (Delta T)173 // Define default algorithm for time correction (Delta T)
169 QString tmpDT = conf->value("navigation/time_correction_algorithm", "EspenakMeeus").toString();174 QString tmpDT = conf->value("navigation/time_correction_algorithm", "EspenakMeeus").toString();
@@ -194,7 +199,7 @@
194 setInitTodayTime(QTime::fromString(conf->value("navigation/today_time", "22:00").toString()));199 setInitTodayTime(QTime::fromString(conf->value("navigation/today_time", "22:00").toString()));
195 startupTimeMode = conf->value("navigation/startup_time_mode", "actual").toString().toLower();200 startupTimeMode = conf->value("navigation/startup_time_mode", "actual").toString().toLower();
196 if (startupTimeMode=="preset") 201 if (startupTimeMode=="preset")
197 setJD(presetSkyTime - StelUtils::getGMTShiftFromQT(presetSkyTime) * JD_HOUR);202 setJD(presetSkyTime - getUTCOffset(presetSkyTime) * JD_HOUR);
198 else if (startupTimeMode=="today")203 else if (startupTimeMode=="today")
199 setTodayTime(getInitTodayTime());204 setTodayTime(getInitTodayTime());
200205
@@ -1136,6 +1141,115 @@
1136 }1141 }
1137}1142}
11381143
1144float StelCore::getUTCOffset(const double JD) const
1145{
1146 int year, month, day, hour, minute, second;
1147 StelUtils::getDateFromJulianDay(JD, &year, &month, &day);
1148 StelUtils::getTimeFromJulianDay(JD, &hour, &minute, &second);
1149 // as analogous to second statement in getJDFromDate, nkerr
1150 if ( year <= 0 )
1151 {
1152 year = year - 1;
1153 }
1154 //getTime/DateFromJulianDay returns UTC time, not local time
1155 QDateTime universal(QDate(year, month, day), QTime(hour, minute, second), Qt::UTC);
1156 if (!universal.isValid())
1157 {
1158 //qWarning() << "JD " << QString("%1").arg(JD) << " out of bounds of QT help with GMT shift, using current datetime";
1159 // Assumes the GMT shift was always the same before year -4710
1160 universal = QDateTime(QDate(-4710, month, day), QTime(hour, minute, second), Qt::UTC);
1161 }
1162
1163 StelLocation loc = getCurrentLocation();
1164 QString tzName = getCurrentTimeZone();
1165
1166 int shiftInSeconds = 0;
1167 if (tzName=="system_default")
1168 {
1169 QDateTime local = universal.toLocalTime();
1170 //Both timezones should be interpreted as UTC because secsTo() converts both
1171 //times to UTC if their zones have different daylight saving time rules.
1172 local.setTimeSpec(Qt::UTC);
1173 shiftInSeconds = universal.secsTo(local);
1174 }
1175 else
1176 {
1177 QTimeZone* tz = new QTimeZone(tzName.toUtf8());
1178 if (tz->isValid() && loc.planetName=="Earth" && year>=1886)
1179 {
1180 if (getUseDST())
1181 shiftInSeconds = tz->offsetFromUtc(universal);
1182 else
1183 shiftInSeconds = tz->standardTimeOffset(universal);
1184 }
1185 else
1186 shiftInSeconds = (loc.longitude/15.f)*3600.f; // Local Mean Solar Time
1187
1188 if (tzName=="LTST")
1189 shiftInSeconds += getSolutionEquationOfTime(JD)*60;
1190
1191 }
1192
1193 float shiftInHours = shiftInSeconds / 3600.0f;
1194 return shiftInHours;
1195}
1196
1197QString StelCore::getCurrentTimeZone() const
1198{
1199 return currentTimeZone;
1200}
1201
1202void StelCore::setCurrentTimeZone(const QString& tz)
1203{
1204 currentTimeZone = tz;
1205}
1206
1207bool StelCore::getUseDST() const
1208{
1209 return flagUseDST;
1210}
1211
1212void StelCore::setUseDST(const bool b)
1213{
1214 flagUseDST = b;
1215 StelApp::getInstance().getSettings()->setValue("localization/flag_dst", b);
1216}
1217
1218double StelCore::getSolutionEquationOfTime(const double JDE) const
1219{
1220 double tau = (JDE - 2451545.0)/365250.0;
1221 double sunMeanLongitude = 280.4664567 + tau*(360007.6892779 + tau*(0.03032028 + tau*(1./49931. - tau*(1./15300. - tau/2000000.))));
1222
1223 // reduce the angle
1224 sunMeanLongitude = std::fmod(sunMeanLongitude, 360.);
1225 // force it to be the positive remainder, so that 0 <= angle < 360
1226 sunMeanLongitude = std::fmod(sunMeanLongitude + 360., 360.);
1227
1228 Vec3d pos = GETSTELMODULE(StelObjectMgr)->searchByName("Sun")->getEquinoxEquatorialPos(this);
1229 double ra, dec;
1230 StelUtils::rectToSphe(&ra, &dec, pos);
1231
1232 // covert radians to degrees and reduce the angle
1233 double alpha = std::fmod(ra*180./M_PI, 360.);
1234 // force it to be the positive remainder, so that 0 <= angle < 360
1235 alpha = std::fmod(alpha + 360., 360.);
1236
1237 double deltaPsi, deltaEps;
1238 getNutationAngles(JDE, &deltaPsi, &deltaEps); // these are radians!
1239 //double equation = 4*(sunMeanLongitude - 0.0057183 - alpha + get_nutation_longitude(JDE)*cos(get_mean_ecliptical_obliquity(JDE)));
1240 double equation = 4*(sunMeanLongitude - 0.0057183 - alpha + deltaPsi*180./M_PI*cos(getPrecessionAngleVondrakEpsilon(JDE)));
1241 // The equation of time is always smaller 20 minutes in absolute value
1242 if (qAbs(equation)>20)
1243 {
1244 // If absolute value of the equation of time appears to be too large, add 24 hours (1440 minutes) to or subtract it from our result
1245 if (equation>0.)
1246 equation -= 1440.;
1247 else
1248 equation += 1440.;
1249 }
1250
1251 return equation;
1252}
11391253
1140//! Set stellarium time to current real world time1254//! Set stellarium time to current real world time
1141void StelCore::setTimeNow()1255void StelCore::setTimeNow()
@@ -1150,7 +1264,7 @@
1150 {1264 {
1151 dt.setTime(target);1265 dt.setTime(target);
1152 // don't forget to adjust for timezone / daylight savings.1266 // don't forget to adjust for timezone / daylight savings.
1153 double JD = StelUtils::qDateTimeToJd(dt)-(StelUtils::getGMTShiftFromQT(StelUtils::getJDFromSystem()) * JD_HOUR);1267 double JD = StelUtils::qDateTimeToJd(dt)-(getUTCOffset(StelUtils::getJDFromSystem()) * JD_HOUR);
1154 setJD(JD);1268 setJD(JD);
1155 }1269 }
1156 else1270 else
11571271
=== modified file 'src/core/StelCore.hpp'
--- src/core/StelCore.hpp 2016-10-09 05:03:17 +0000
+++ src/core/StelCore.hpp 2016-10-25 16:10:21 +0000
@@ -274,6 +274,11 @@
274 //! Get the informations on the current location274 //! Get the informations on the current location
275 const StelLocation& getCurrentLocation() const;275 const StelLocation& getCurrentLocation() const;
276276
277 float getUTCOffset(const double JD) const;
278
279 QString getCurrentTimeZone() const;
280 void setCurrentTimeZone(const QString& tz);
281
277 const QSharedPointer<class Planet> getCurrentPlanet() const;282 const QSharedPointer<class Planet> getCurrentPlanet() const;
278283
279 //! Unfortunately we also need this.284 //! Unfortunately we also need this.
@@ -430,6 +435,14 @@
430 //! It is still frequently used in the literature.435 //! It is still frequently used in the literature.
431 double getJDE() const;436 double getJDE() const;
432437
438 //! Get solution of equation of time
439 //! Source: J. Meeus "Astronomical Algorithms" (2nd ed., with corrections as of August 10, 2009) p.183-187.
440 //! @param JDE JD in Dynamical Time (previously called Ephemeris Time)
441 //! @return time in minutes
442 double getSolutionEquationOfTime(const double JDE) const;
443
444 bool getUseDST() const;
445 void setUseDST(const bool b);
433446
434 //! Set the current date in Modified Julian Day (UT).447 //! Set the current date in Modified Julian Day (UT).
435 //! MJD is simply JD-2400000.5, getting rid of large numbers and starting days at midnight.448 //! MJD is simply JD-2400000.5, getting rid of large numbers and starting days at midnight.
@@ -727,13 +740,16 @@
727 double timeSpeed; // Positive : forward, Negative : Backward, 1 = 1sec/sec740 double timeSpeed; // Positive : forward, Negative : Backward, 1 = 1sec/sec
728 //double JDay; // Current time in Julian day. IN V0.12 TO V0.14, this was JD in TT, and all places where UT was required had to subtract getDeltaT() explicitly.741 //double JDay; // Current time in Julian day. IN V0.12 TO V0.14, this was JD in TT, and all places where UT was required had to subtract getDeltaT() explicitly.
729 QPair<double,double> JD; // From 0.14 on: JD.first=JD_UT, JD.second=DeltaT=TT-UT. To gain JD_TT, compute JDE=JD.first+JD.second or better just call getJDE()742 QPair<double,double> JD; // From 0.14 on: JD.first=JD_UT, JD.second=DeltaT=TT-UT. To gain JD_TT, compute JDE=JD.first+JD.second or better just call getJDE()
730 // Use is best with calls getJD()/setJD() and getJDE()/setJDE() to explicitly state which flavour of JD you need.743 // Use is best with calls getJD()/setJD() and getJDE()/setJDE() to explicitly state which flavour of JD you need.
731 double presetSkyTime;744 double presetSkyTime;
732 QTime initTodayTime;745 QTime initTodayTime;
733 QString startupTimeMode;746 QString startupTimeMode;
734 double milliSecondsOfLastJDUpdate; // Time in seconds when the time rate or time last changed747 double milliSecondsOfLastJDUpdate; // Time in seconds when the time rate or time last changed
735 double jdOfLastJDUpdate; // JD when the time rate or time last changed748 double jdOfLastJDUpdate; // JD when the time rate or time last changed
736749
750 QString currentTimeZone;
751 bool flagUseDST;
752
737 // Variables for custom equation of Delta-T753 // Variables for custom equation of Delta-T
738 Vec3f deltaTCustomEquationCoeff;754 Vec3f deltaTCustomEquationCoeff;
739 float deltaTCustomNDot;755 float deltaTCustomNDot;
740756
=== modified file 'src/core/StelLocaleMgr.cpp'
--- src/core/StelLocaleMgr.cpp 2016-10-22 13:40:38 +0000
+++ src/core/StelLocaleMgr.cpp 2016-10-25 16:10:21 +0000
@@ -27,7 +27,6 @@
27#include <QSettings>27#include <QSettings>
28#include <QString>28#include <QString>
29#include <QTextStream>29#include <QTextStream>
30
31#include <QFile>30#include <QFile>
3231
33#include <ctime>32#include <ctime>
@@ -37,9 +36,7 @@
37StelLocaleMgr::StelLocaleMgr()36StelLocaleMgr::StelLocaleMgr()
38 : skyTranslator(NULL)37 : skyTranslator(NULL)
39 , timeFormat()38 , timeFormat()
40 , dateFormat()39 , dateFormat()
41 , timeZoneMode()
42 , GMTShift(0)
43{40{
44 // Load from file41 // Load from file
45 QString path = StelFileMgr::findFile("data/countryCodes.dat");42 QString path = StelFileMgr::findFile("data/countryCodes.dat");
@@ -57,6 +54,8 @@
57 in >> countryCodeToStringMap;54 in >> countryCodeToStringMap;
58 file.close();55 file.close();
59 }56 }
57
58 core = StelApp::getInstance().getCore();
60}59}
6160
6261
@@ -119,33 +118,6 @@
119118
120 timeFormat = stringToSTimeFormat(conf->value("localization/time_display_format", "system_default").toString());119 timeFormat = stringToSTimeFormat(conf->value("localization/time_display_format", "system_default").toString());
121 dateFormat = stringToSDateFormat(conf->value("localization/date_display_format", "system_default").toString());120 dateFormat = stringToSDateFormat(conf->value("localization/date_display_format", "system_default").toString());
122 // time_zone used to be in init_location section of config,
123 // so use that as fallback when reading config - Rob
124 QString tzstr = conf->value("localization/time_zone", conf->value("init_location/time_zone", "system_default").toString()).toString();
125 if (tzstr == "system_default")
126 {
127 timeZoneMode = STzSystemDefault;
128 // Set the program global intern timezones variables from the system locale
129 #ifdef _MSC_BUILD
130 _tzset();
131 #else
132 tzset();
133 #endif
134 }
135 else
136 {
137 if (tzstr == "gmt+x") // TODO : handle GMT+X timezones form
138 {
139 timeZoneMode = STzGMTShift;
140 // GMTShift = x;
141 }
142 else
143 {
144 // We have a custom time zone name
145 timeZoneMode = STzCustom;
146 setCustomTzName(tzstr);
147 }
148 }
149}121}
150122
151/*************************************************************************123/*************************************************************************
@@ -214,16 +186,7 @@
214// Return the time in ISO 8601 format that is : %Y-%m-%d %H:%M:%S186// Return the time in ISO 8601 format that is : %Y-%m-%d %H:%M:%S
215QString StelLocaleMgr::getISO8601TimeLocal(double JD) const187QString StelLocaleMgr::getISO8601TimeLocal(double JD) const
216{188{
217 double shift = 0.0;189 return StelUtils::julianDayToISO8601String(JD + core->getUTCOffset(JD)*0.041666666666);
218 if (timeZoneMode == STzGMTShift)
219 {
220 shift = GMTShift;
221 }
222 else
223 {
224 shift = StelUtils::getGMTShiftFromQT(JD)*0.041666666666;
225 }
226 return StelUtils::julianDayToISO8601String(JD + shift);
227}190}
228191
229//! get the six ints from an ISO8601 date time, understood to be local time, make a jdate out192//! get the six ints from an ISO8601 date time, understood to be local time, make a jdate out
@@ -237,11 +200,7 @@
237 return 0.0;200 return 0.0;
238 }201 }
239 202
240 // modified by shift203 jd -= core->getUTCOffset(jd)*0.041666666666;
241 if (timeZoneMode == STzGMTShift)
242 jd -= GMTShift;
243 else
244 jd -= StelUtils::getGMTShiftFromQT(jd)*0.041666666666;
245 return jd;204 return jd;
246}205}
247206
@@ -250,15 +209,7 @@
250QString StelLocaleMgr::getPrintableDateLocal(double JD) const209QString StelLocaleMgr::getPrintableDateLocal(double JD) const
251{210{
252 int year, month, day, dayOfWeek;211 int year, month, day, dayOfWeek;
253 double shift = 0.0;212 double shift = core->getUTCOffset(JD)*0.041666666666;
254 if (timeZoneMode == STzGMTShift)
255 {
256 shift = GMTShift;
257 }
258 else
259 {
260 shift = StelUtils::getGMTShiftFromQT(JD)*0.041666666666;
261 }
262 StelUtils::getDateFromJulianDay(JD+shift, &year, &month, &day);213 StelUtils::getDateFromJulianDay(JD+shift, &year, &month, &day);
263 dayOfWeek = (int)floor(fmod(JD, 7));214 dayOfWeek = (int)floor(fmod(JD, 7));
264 QString str;215 QString str;
@@ -288,15 +239,8 @@
288QString StelLocaleMgr::getPrintableTimeLocal(double JD) const239QString StelLocaleMgr::getPrintableTimeLocal(double JD) const
289{240{
290 int hour, minute, second;241 int hour, minute, second;
291 double shift = 0.0;242 double shift = core->getUTCOffset(JD)*0.041666666666;
292 if (timeZoneMode == STzGMTShift)243
293 {
294 shift = GMTShift;
295 }
296 else
297 {
298 shift = StelUtils::getGMTShiftFromQT(JD)*0.041666666666;
299 }
300 StelUtils::getTimeFromJulianDay(JD+shift, &hour, &minute, &second);244 StelUtils::getTimeFromJulianDay(JD+shift, &hour, &minute, &second);
301245
302 QTime t(hour, minute, second);246 QTime t(hour, minute, second);
@@ -317,12 +261,32 @@
317261
318QString StelLocaleMgr::getPrintableTimeZoneLocal(double JD) const262QString StelLocaleMgr::getPrintableTimeZoneLocal(double JD) const
319{263{
320 double shift = StelUtils::getGMTShiftFromQT(JD);264 if (core->getCurrentLocation().planetName=="Earth")
321 QTime tz = QTime(0, 0, 0).addSecs(3600*qAbs(shift));265 {
322 if(shift<0.0f)266 QString timeZone = "UTC";
323 return "UTC-" + tz.toString("hh:mm");267 QString currTZ = core->getCurrentTimeZone();
268 QString timeZoneST = "";
269
270 if (JD<=2409907.5 || currTZ.contains("auto"))
271 timeZoneST = "LMST";
272
273 if (currTZ.contains("LMST") || currTZ.contains("LTST"))
274 timeZoneST = currTZ;
275
276 float shift = core->getUTCOffset(JD);
277 QTime tz = QTime(0, 0, 0).addSecs(3600*qAbs(shift));
278 if(shift<0.0f)
279 timeZone.append("-" + tz.toString("hh:mm"));
280 else
281 timeZone.append("+" + tz.toString("hh:mm"));
282
283 if (!timeZoneST.isEmpty())
284 timeZone.append(" (" + timeZoneST + ")");
285
286 return timeZone;
287 }
324 else288 else
325 return "UTC+" + tz.toString("hh:mm");289 return QString();
326}290}
327291
328// Convert the time format enum to its associated string and reverse292// Convert the time format enum to its associated string and reverse
@@ -385,30 +349,6 @@
385 return dfmt;349 return dfmt;
386}350}
387351
388void StelLocaleMgr::setCustomTzName(const QString& tzname)
389{
390 customTzName = tzname;
391 timeZoneMode = STzCustom;
392
393 if( customTzName != "")
394 {
395 // set the TZ environement variable and update c locale stuff
396 #ifdef _MSC_BUILD
397 _putenv(_strdup(qPrintable("TZ=" + customTzName)));
398 _tzset();
399 #else
400 putenv(strdup(qPrintable("TZ=" + customTzName)));
401 tzset();
402 #endif
403 }
404}
405
406float StelLocaleMgr::getGMTShift(double JD) const
407{
408 if (timeZoneMode == STzGMTShift) return GMTShift;
409 else return StelUtils::getGMTShiftFromQT(JD);
410}
411
412// Convert a 2 letter country code to string352// Convert a 2 letter country code to string
413QString StelLocaleMgr::countryCodeToString(const QString& countryCode)353QString StelLocaleMgr::countryCodeToString(const QString& countryCode)
414{354{
@@ -425,3 +365,4 @@
425 res.sort();365 res.sort();
426 return res;366 return res;
427}367}
368
428369
=== modified file 'src/core/StelLocaleMgr.hpp'
--- src/core/StelLocaleMgr.hpp 2016-10-22 07:48:38 +0000
+++ src/core/StelLocaleMgr.hpp 2016-10-25 16:10:21 +0000
@@ -21,6 +21,7 @@
21#define _STELLOCALEMGR_HPP_21#define _STELLOCALEMGR_HPP_
2222
23#include "StelTranslator.hpp"23#include "StelTranslator.hpp"
24#include "StelCore.hpp"
2425
25//! @class StelLocaleMgr26//! @class StelLocaleMgr
26//! Manage i18n operations such as message translation and date/time localization.27//! Manage i18n operations such as message translation and date/time localization.
@@ -101,11 +102,6 @@
101 //! Get the format string which describes the current date format (Qt style).102 //! Get the format string which describes the current date format (Qt style).
102 QString getQtDateFormatStr(void) const;103 QString getQtDateFormatStr(void) const;
103 104
104 //! Set the time zone.
105 //! @param tZ the time zone string as parsed from the TZ environment
106 //! varibale by the tzset function from libc.
107 void setCustomTimezone(QString tZ) { setCustomTzName(tZ); }
108
109 //! @enum STimeFormat105 //! @enum STimeFormat
110 //! The time display format.106 //! The time display format.
111 enum STimeFormat {107 enum STimeFormat {
@@ -131,35 +127,7 @@
131127
132 //! Get a localized, formatted string representation of the time zone of a Julian date.128 //! Get a localized, formatted string representation of the time zone of a Julian date.
133 QString getPrintableTimeZoneLocal(double JD) const;129 QString getPrintableTimeZoneLocal(double JD) const;
134 130
135 //! @enum STzFormat
136 enum STzFormat
137 {
138 STzCustom, //!< User-specified timezone.
139 STzGMTShift, //!< GMT + offset.
140 STzSystemDefault //!< System default.
141 };
142
143 //! Get the current time shift at observator time zone with respect to GMT time.
144 void setGMTShift(int t)
145 {
146 GMTShift=t;
147 }
148 //! Get the current time shift in hours at observator time zone with respect to GMT time.
149 float getGMTShift(double JD = 0) const;
150 //! Set the timezone by a TZ-style string (see tzset in the libc manual).
151 void setCustomTzName(const QString& tzname);
152 //! Get the timezone name (a TZ-style string - see tzset in the libc manual).
153 QString getCustomTzName(void) const
154 {
155 return customTzName;
156 }
157 //! Get the current timezone format mode.
158 STzFormat getTzFormat(void) const
159 {
160 return timeZoneMode;
161 }
162
163 //! Return the time in ISO 8601 format that is : %Y-%m-%dT%H:%M:%S131 //! Return the time in ISO 8601 format that is : %Y-%m-%dT%H:%M:%S
164 //! @param JD the time and date expressed as a Julian date value.132 //! @param JD the time and date expressed as a Julian date value.
165 QString getISO8601TimeLocal(double JD) const;133 QString getISO8601TimeLocal(double JD) const;
@@ -180,15 +148,12 @@
180private:148private:
181 // The translator used for astronomical object naming149 // The translator used for astronomical object naming
182 StelTranslator* skyTranslator;150 StelTranslator* skyTranslator;
151 StelCore* core;
183 152
184 // Date and time variables153 // Date and time variables
185 STimeFormat timeFormat;154 STimeFormat timeFormat;
186 SDateFormat dateFormat;155 SDateFormat dateFormat;
187 STzFormat timeZoneMode; // Can be the system default or a user defined value156
188
189 QString customTzName; // Something like "Europe/Paris"
190 float GMTShift; // Time shift between GMT time and local time in hour. (positive for Est of GMT)
191
192 // Convert the time format enum to its associated string and reverse157 // Convert the time format enum to its associated string and reverse
193 STimeFormat stringToSTimeFormat(const QString&) const;158 STimeFormat stringToSTimeFormat(const QString&) const;
194 QString sTimeFormatToString(STimeFormat) const;159 QString sTimeFormatToString(STimeFormat) const;
195160
=== modified file 'src/core/StelLocationMgr.cpp'
--- src/core/StelLocationMgr.cpp 2016-10-22 15:05:57 +0000
+++ src/core/StelLocationMgr.cpp 2016-10-25 16:10:21 +0000
@@ -391,6 +391,7 @@
391 .arg(longitude<0 ? QString("%1W").arg(-longitude, 0, 'f', 6) : QString("%1E").arg(longitude, 0, 'f', 6))391 .arg(longitude<0 ? QString("%1W").arg(-longitude, 0, 'f', 6) : QString("%1E").arg(longitude, 0, 'f', 6))
392 .arg(ipTimeZone.isEmpty() ? "" : ipTimeZone);392 .arg(ipTimeZone.isEmpty() ? "" : ipTimeZone);
393 location=StelLocation::createFromLine(locLine); // in lack of a regular constructor ;-)393 location=StelLocation::createFromLine(locLine); // in lack of a regular constructor ;-)
394 core->setCurrentTimeZone(ipTimeZone.isEmpty() ? "LMST" : ipTimeZone);
394 core->moveObserverTo(location, 0.0f, 0.0f);395 core->moveObserverTo(location, 0.0f, 0.0f);
395 QSettings* conf = StelApp::getInstance().getSettings();396 QSettings* conf = StelApp::getInstance().getSettings();
396 conf->setValue("init_location/last_location", QString("%1,%2").arg(latitude).arg(longitude));397 conf->setValue("init_location/last_location", QString("%1,%2").arg(latitude).arg(longitude));
@@ -436,3 +437,4 @@
436 }437 }
437 return results;438 return results;
438}439}
440
439441
=== modified file 'src/gui/AstroCalcDialog.cpp'
--- src/gui/AstroCalcDialog.cpp 2016-10-15 17:21:05 +0000
+++ src/gui/AstroCalcDialog.cpp 2016-10-25 16:10:21 +0000
@@ -113,7 +113,7 @@
113 populateMajorPlanetList();113 populateMajorPlanetList();
114 populateGroupCelestialBodyList();114 populateGroupCelestialBodyList();
115115
116 double JD = core->getJD() + StelUtils::getGMTShiftFromQT(core->getJD())/24;116 double JD = core->getJD() + core->getUTCOffset(core->getJD())/24;
117 ui->dateFromDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD));117 ui->dateFromDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD));
118 ui->dateToDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD + 30.f));118 ui->dateToDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD + 30.f));
119 ui->phenomenFromDateEdit->setDateTime(StelUtils::jdToQDateTime(JD));119 ui->phenomenFromDateEdit->setDateTime(StelUtils::jdToQDateTime(JD));
@@ -181,8 +181,9 @@
181181
182 initListPlanetaryPositions();182 initListPlanetaryPositions();
183183
184 double JD = StelApp::getInstance().getCore()->getJD();184 StelCore* core = StelApp::getInstance().getCore();
185 ui->positionsTimeLabel->setText(q_("Positions on %1").arg(StelUtils::jdToQDateTime(JD + StelUtils::getGMTShiftFromQT(JD)/24).toString("yyyy-MM-dd hh:mm")));185 double JD = core->getJD();
186 ui->positionsTimeLabel->setText(q_("Positions on %1").arg(StelUtils::jdToQDateTime(JD + core->getUTCOffset(JD)/24).toString("yyyy-MM-dd hh:mm")));
186187
187 foreach (const PlanetP& planet, allPlanets)188 foreach (const PlanetP& planet, allPlanets)
188 {189 {
@@ -338,7 +339,7 @@
338 {339 {
339 double currentJD = core->getJD(); // save current JD340 double currentJD = core->getJD(); // save current JD
340 double firstJD = StelUtils::qDateTimeToJd(ui->dateFromDateTimeEdit->dateTime());341 double firstJD = StelUtils::qDateTimeToJd(ui->dateFromDateTimeEdit->dateTime());
341 firstJD = firstJD - StelUtils::getGMTShiftFromQT(firstJD)/24;342 firstJD = firstJD - core->getUTCOffset(firstJD)/24;
342 int elements = (int)((StelUtils::qDateTimeToJd(ui->dateToDateTimeEdit->dateTime()) - firstJD)/currentStep);343 int elements = (int)((StelUtils::qDateTimeToJd(ui->dateToDateTimeEdit->dateTime()) - firstJD)/currentStep);
343 EphemerisListJ2000.clear();344 EphemerisListJ2000.clear();
344 EphemerisListJ2000.reserve(elements);345 EphemerisListJ2000.reserve(elements);
@@ -351,11 +352,11 @@
351 core->update(0); // force update to get new coordinates 352 core->update(0); // force update to get new coordinates
352 Vec3d pos = obj->getJ2000EquatorialPos(core);353 Vec3d pos = obj->getJ2000EquatorialPos(core);
353 EphemerisListJ2000.append(pos);354 EphemerisListJ2000.append(pos);
354 EphemerisListDates.append(StelUtils::jdToQDateTime(JD + StelUtils::getGMTShiftFromQT(JD)/24).toString("yyyy-MM-dd"));355 EphemerisListDates.append(StelUtils::jdToQDateTime(JD + core->getUTCOffset(JD)/24).toString("yyyy-MM-dd"));
355 StelUtils::rectToSphe(&ra,&dec,pos);356 StelUtils::rectToSphe(&ra,&dec,pos);
356 ACTreeWidgetItem *treeItem = new ACTreeWidgetItem(ui->ephemerisTreeWidget);357 ACTreeWidgetItem *treeItem = new ACTreeWidgetItem(ui->ephemerisTreeWidget);
357 // local date and time358 // local date and time
358 treeItem->setText(EphemerisDate, StelUtils::jdToQDateTime(JD + StelUtils::getGMTShiftFromQT(JD)/24).toString("yyyy-MM-dd hh:mm:ss"));359 treeItem->setText(EphemerisDate, StelUtils::jdToQDateTime(JD + core->getUTCOffset(JD)/24).toString("yyyy-MM-dd hh:mm:ss"));
359 treeItem->setText(EphemerisJD, QString::number(JD, 'f', 5));360 treeItem->setText(EphemerisJD, QString::number(JD, 'f', 5));
360 treeItem->setText(EphemerisRA, StelUtils::radToHmsStr(ra));361 treeItem->setText(EphemerisRA, StelUtils::radToHmsStr(ra));
361 treeItem->setTextAlignment(EphemerisRA, Qt::AlignRight);362 treeItem->setTextAlignment(EphemerisRA, Qt::AlignRight);
@@ -573,7 +574,7 @@
573 QString date = modelIndex.sibling(modelIndex.row(), PhenomenaDate).data().toString();574 QString date = modelIndex.sibling(modelIndex.row(), PhenomenaDate).data().toString();
574 bool ok;575 bool ok;
575 double JD = StelUtils::getJulianDayFromISO8601String(date.left(10) + "T" + date.right(8), &ok);576 double JD = StelUtils::getJulianDayFromISO8601String(date.left(10) + "T" + date.right(8), &ok);
576 JD -= StelUtils::getGMTShiftFromQT(JD)/24.;577 JD -= core->getUTCOffset(JD)/24.;
577578
578 if (objectMgr->findAndSelectI18n(name) || objectMgr->findAndSelect(name))579 if (objectMgr->findAndSelectI18n(name) || objectMgr->findAndSelect(name))
579 {580 {
@@ -712,8 +713,8 @@
712 double currentJD = core->getJD(); // save current JD713 double currentJD = core->getJD(); // save current JD
713 double startJD = StelUtils::qDateTimeToJd(ui->phenomenFromDateEdit->dateTime());714 double startJD = StelUtils::qDateTimeToJd(ui->phenomenFromDateEdit->dateTime());
714 double stopJD = StelUtils::qDateTimeToJd(ui->phenomenToDateEdit->dateTime());715 double stopJD = StelUtils::qDateTimeToJd(ui->phenomenToDateEdit->dateTime());
715 startJD = startJD - StelUtils::getGMTShiftFromQT(startJD)/24;716 startJD = startJD - core->getUTCOffset(startJD)/24;
716 stopJD = stopJD - StelUtils::getGMTShiftFromQT(stopJD)/24;717 stopJD = stopJD - core->getUTCOffset(stopJD)/24;
717718
718 if (obj2Type<9)719 if (obj2Type<9)
719 {720 {
@@ -805,7 +806,7 @@
805 ACTreeWidgetItem *treeItem = new ACTreeWidgetItem(ui->phenomenaTreeWidget);806 ACTreeWidgetItem *treeItem = new ACTreeWidgetItem(ui->phenomenaTreeWidget);
806 treeItem->setText(PhenomenaType, phenomenType);807 treeItem->setText(PhenomenaType, phenomenType);
807 // local date and time808 // local date and time
808 treeItem->setText(PhenomenaDate, StelUtils::jdToQDateTime(it.key() + StelUtils::getGMTShiftFromQT(it.key())/24).toString("yyyy-MM-dd hh:mm:ss"));809 treeItem->setText(PhenomenaDate, StelUtils::jdToQDateTime(it.key() + core->getUTCOffset(it.key())/24).toString("yyyy-MM-dd hh:mm:ss"));
809 treeItem->setText(PhenomenaObject1, object1->getNameI18n());810 treeItem->setText(PhenomenaObject1, object1->getNameI18n());
810 treeItem->setText(PhenomenaObject2, object2->getNameI18n());811 treeItem->setText(PhenomenaObject2, object2->getNameI18n());
811 treeItem->setText(PhenomenaSeparation, StelUtils::radToDmsStr(separation));812 treeItem->setText(PhenomenaSeparation, StelUtils::radToDmsStr(separation));
@@ -954,7 +955,7 @@
954 ACTreeWidgetItem *treeItem = new ACTreeWidgetItem(ui->phenomenaTreeWidget);955 ACTreeWidgetItem *treeItem = new ACTreeWidgetItem(ui->phenomenaTreeWidget);
955 treeItem->setText(PhenomenaType, phenomenType);956 treeItem->setText(PhenomenaType, phenomenType);
956 // local date and time957 // local date and time
957 treeItem->setText(PhenomenaDate, StelUtils::jdToQDateTime(it.key() + StelUtils::getGMTShiftFromQT(it.key())/24).toString("yyyy-MM-dd hh:mm:ss"));958 treeItem->setText(PhenomenaDate, StelUtils::jdToQDateTime(it.key() + core->getUTCOffset(it.key())/24).toString("yyyy-MM-dd hh:mm:ss"));
958 treeItem->setText(PhenomenaObject1, object1->getNameI18n());959 treeItem->setText(PhenomenaObject1, object1->getNameI18n());
959 if (!object2->getNameI18n().isEmpty())960 if (!object2->getNameI18n().isEmpty())
960 treeItem->setText(PhenomenaObject2, object2->getNameI18n());961 treeItem->setText(PhenomenaObject2, object2->getNameI18n());
961962
=== modified file 'src/gui/BookmarksDialog.cpp'
--- src/gui/BookmarksDialog.cpp 2016-08-24 13:32:23 +0000
+++ src/gui/BookmarksDialog.cpp 2016-10-25 16:10:21 +0000
@@ -156,7 +156,7 @@
156 if (dateTimeFlag)156 if (dateTimeFlag)
157 {157 {
158 JD = core->getJD();158 JD = core->getJD();
159 JDs = StelUtils::julianDayToISO8601String(JD + StelUtils::getGMTShiftFromQT(JD)/24.).replace("T", " ");159 JDs = StelUtils::julianDayToISO8601String(JD + core->getUTCOffset(JD)/24.).replace("T", " ");
160 }160 }
161161
162 QString Location = "";162 QString Location = "";
@@ -277,7 +277,7 @@
277 if (!JD.isEmpty())277 if (!JD.isEmpty())
278 {278 {
279 bm.jd = JD;279 bm.jd = JD;
280 JDs = StelUtils::julianDayToISO8601String(JD.toDouble() + StelUtils::getGMTShiftFromQT(JD.toDouble())/24.).replace("T", " ");280 JDs = StelUtils::julianDayToISO8601String(JD.toDouble() + core->getUTCOffset(JD.toDouble())/24.).replace("T", " ");
281 }281 }
282 QString Location = bookmarkData.value("location").toString();282 QString Location = bookmarkData.value("location").toString();
283 if (!Location.isEmpty())283 if (!Location.isEmpty())
284284
=== modified file 'src/gui/ConfigurationDialog.cpp'
--- src/gui/ConfigurationDialog.cpp 2016-10-10 04:45:16 +0000
+++ src/gui/ConfigurationDialog.cpp 2016-10-25 16:10:21 +0000
@@ -988,7 +988,7 @@
988{988{
989 StelCore* core = StelApp::getInstance().getCore();989 StelCore* core = StelApp::getInstance().getCore();
990 double JD = core->getJD();990 double JD = core->getJD();
991 ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD+StelUtils::getGMTShiftFromQT(JD)/24));991 ui->fixedDateTimeEdit->setDateTime(StelUtils::jdToQDateTime(JD+core->getUTCOffset(JD)/24));
992 ui->fixedTimeRadio->setChecked(true);992 ui->fixedTimeRadio->setChecked(true);
993 setStartupTimeMode();993 setStartupTimeMode();
994}994}
995995
=== modified file 'src/gui/DateTimeDialog.cpp'
--- src/gui/DateTimeDialog.cpp 2016-05-16 12:35:53 +0000
+++ src/gui/DateTimeDialog.cpp 2016-10-25 16:10:21 +0000
@@ -54,9 +54,10 @@
54void DateTimeDialog::createDialogContent()54void DateTimeDialog::createDialogContent()
55{55{
56 ui->setupUi(dialog);56 ui->setupUi(dialog);
57 double jd = StelApp::getInstance().getCore()->getJD();57 StelCore *core = StelApp::getInstance().getCore();
58 double jd = core->getJD();
58 // UTC -> local tz59 // UTC -> local tz
59 setDateTime(jd + (StelApp::getInstance().getLocaleMgr().getGMTShift(jd)/24.0));60 setDateTime(jd + (core->getUTCOffset(jd)/24.0));
6061
61 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));62 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
62 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));63 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
@@ -202,7 +203,7 @@
202{203{
203 double cjd;204 double cjd;
204 StelUtils::getJDFromDate(&cjd, year, month, day, hour, minute, second);205 StelUtils::getJDFromDate(&cjd, year, month, day, hour, minute, second);
205 cjd -= (StelApp::getInstance().getLocaleMgr().getGMTShift(cjd)/24.0); // local tz -> UTC206 cjd -= (StelApp::getInstance().getCore()->getUTCOffset(cjd)/24.0); // local tz -> UTC
206207
207 return cjd;208 return cjd;
208}209}
@@ -232,7 +233,7 @@
232{233{
233 if (this->visible()) {234 if (this->visible()) {
234 // JD and MJD should be at the UTC scale on the window!235 // JD and MJD should be at the UTC scale on the window!
235 double newJdC = newJd + StelApp::getInstance().getLocaleMgr().getGMTShift(newJd)/24.0; // UTC -> local tz236 double newJdC = newJd + StelApp::getInstance().getCore()->getUTCOffset(newJd)/24.0; // UTC -> local tz
236 StelUtils::getDateFromJulianDay(newJdC, &year, &month, &day);237 StelUtils::getDateFromJulianDay(newJdC, &year, &month, &day);
237 StelUtils::getTimeFromJulianDay(newJdC, &hour, &minute, &second);238 StelUtils::getTimeFromJulianDay(newJdC, &hour, &minute, &second);
238 jd = newJd;239 jd = newJd;
239240
=== modified file 'src/gui/LocationDialog.cpp'
--- src/gui/LocationDialog.cpp 2016-06-13 16:32:42 +0000
+++ src/gui/LocationDialog.cpp 2016-10-25 16:10:21 +0000
@@ -40,6 +40,7 @@
40#include <QSortFilterProxyModel>40#include <QSortFilterProxyModel>
41#include <QTimer>41#include <QTimer>
42#include <QStringListModel>42#include <QStringListModel>
43#include <QTimeZone>
4344
44LocationDialog::LocationDialog(QObject* parent)45LocationDialog::LocationDialog(QObject* parent)
45 : StelDialog(parent)46 : StelDialog(parent)
@@ -64,6 +65,7 @@
64 ui->retranslateUi(dialog);65 ui->retranslateUi(dialog);
65 populatePlanetList();66 populatePlanetList();
66 populateCountryList();67 populateCountryList();
68 populateTimeZonesList();
67 }69 }
68}70}
6971
@@ -113,6 +115,7 @@
113115
114 populatePlanetList();116 populatePlanetList();
115 populateCountryList();117 populateCountryList();
118 populateTimeZonesList();
116119
117 connect(ui->citySearchLineEdit, SIGNAL(textChanged(const QString&)), proxyModel, SLOT(setFilterWildcard(const QString&)));120 connect(ui->citySearchLineEdit, SIGNAL(textChanged(const QString&)), proxyModel, SLOT(setFilterWildcard(const QString&)));
118 connect(ui->citiesListView, SIGNAL(clicked(const QModelIndex&)),121 connect(ui->citiesListView, SIGNAL(clicked(const QModelIndex&)),
@@ -137,13 +140,24 @@
137 ui->useIpQueryCheckBox->setChecked(true);140 ui->useIpQueryCheckBox->setChecked(true);
138 b = false;141 b = false;
139 }142 }
143 updateDefaultLocationControls(b);
144
145 customTimeZone = conf->value("localization/time_zone", "").toString();
146 if (!customTimeZone.isEmpty())
147 b = true;
148 else
149 b = false;
150 updateTimeZoneControls(b);
140151
141 setFieldsFromLocation(currentLocation);152 setFieldsFromLocation(currentLocation);
142 updateDefaultLocationControls(b);
143153
144 connect(ui->useIpQueryCheckBox, SIGNAL(clicked(bool)), this, SLOT(ipQueryLocation(bool)));154 connect(ui->useIpQueryCheckBox, SIGNAL(clicked(bool)), this, SLOT(ipQueryLocation(bool)));
145 connect(ui->useAsDefaultLocationCheckBox, SIGNAL(clicked(bool)), this, SLOT(setDefaultLocation(bool)));155 connect(ui->useAsDefaultLocationCheckBox, SIGNAL(clicked(bool)), this, SLOT(setDefaultLocation(bool)));
146 connect(ui->pushButtonReturnToDefault, SIGNAL(clicked()), core, SLOT(returnToDefaultLocation()));156 connect(ui->pushButtonReturnToDefault, SIGNAL(clicked()), core, SLOT(returnToDefaultLocation()));
157 connect(ui->useCustomTimeZoneCheckBox, SIGNAL(clicked(bool)), this, SLOT(updateTimeZoneControls(bool)));
158
159 ui->dstCheckBox->setChecked(core->getUseDST());
160 connect(ui->dstCheckBox, SIGNAL(clicked(bool)), core, SLOT(setUseDST(bool)));
147161
148 connectEditSignals();162 connectEditSignals();
149163
@@ -178,7 +192,7 @@
178 }192 }
179193
180 const QString& key1 = currentLocation.getID();194 const QString& key1 = currentLocation.getID();
181 const QString& key2 = locationFromFields().getID();195 const QString& key2 = locationFromFields().getID();
182 if (key1!=key2)196 if (key1!=key2)
183 {197 {
184 setFieldsFromLocation(currentLocation);198 setFieldsFromLocation(currentLocation);
@@ -192,6 +206,7 @@
192 disconnect(ui->altitudeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPositionFromCoords(int)));206 disconnect(ui->altitudeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPositionFromCoords(int)));
193 disconnect(ui->planetNameComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(moveToAnotherPlanet(const QString&)));207 disconnect(ui->planetNameComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(moveToAnotherPlanet(const QString&)));
194 disconnect(ui->countryNameComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(reportEdit()));208 disconnect(ui->countryNameComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(reportEdit()));
209 disconnect(ui->timeZoneNameComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(saveTimeZone()));
195 disconnect(ui->cityNameLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(reportEdit()));210 disconnect(ui->cityNameLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(reportEdit()));
196}211}
197212
@@ -202,6 +217,7 @@
202 connect(ui->altitudeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPositionFromCoords(int)));217 connect(ui->altitudeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setPositionFromCoords(int)));
203 connect(ui->planetNameComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(moveToAnotherPlanet(const QString&)));218 connect(ui->planetNameComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(moveToAnotherPlanet(const QString&)));
204 connect(ui->countryNameComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(reportEdit()));219 connect(ui->countryNameComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(reportEdit()));
220 connect(ui->timeZoneNameComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(saveTimeZone()));
205 connect(ui->cityNameLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(reportEdit()));221 connect(ui->cityNameLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(reportEdit()));
206}222}
207223
@@ -230,6 +246,19 @@
230 idx = ui->planetNameComboBox->findData(QVariant("Earth"), Qt::UserRole, Qt::MatchCaseSensitive);246 idx = ui->planetNameComboBox->findData(QVariant("Earth"), Qt::UserRole, Qt::MatchCaseSensitive);
231 }247 }
232 ui->planetNameComboBox->setCurrentIndex(idx);248 ui->planetNameComboBox->setCurrentIndex(idx);
249
250 QString tz = loc.timeZone;
251 if (!customTimeZone.isEmpty())
252 tz = customTimeZone;
253 idx = ui->timeZoneNameComboBox->findData(tz, Qt::UserRole, Qt::MatchCaseSensitive);
254 if (idx==-1)
255 {
256 // Use LMST as default
257 idx = ui->timeZoneNameComboBox->findData(QVariant("LMST"), Qt::UserRole, Qt::MatchCaseSensitive);
258 }
259 ui->timeZoneNameComboBox->setCurrentIndex(idx);
260 StelApp::getInstance().getCore()->setCurrentTimeZone(tz);
261
233 setMapForLocation(loc);262 setMapForLocation(loc);
234263
235 // Set pointer position264 // Set pointer position
@@ -335,6 +364,7 @@
335 {364 {
336 countries->addItem(q_(name), name);365 countries->addItem(q_(name), name);
337 }366 }
367 countries->addItem(QChar(0x2014), "");
338 //Restore the selection368 //Restore the selection
339 index = countries->findData(selectedCountryId, Qt::UserRole, Qt::MatchCaseSensitive);369 index = countries->findData(selectedCountryId, Qt::UserRole, Qt::MatchCaseSensitive);
340 countries->setCurrentIndex(index);370 countries->setCurrentIndex(index);
@@ -343,6 +373,41 @@
343373
344}374}
345375
376void LocationDialog::populateTimeZonesList()
377{
378 Q_ASSERT(ui->timeZoneNameComboBox);
379
380 QComboBox* timeZones = ui->timeZoneNameComboBox;
381 // Return a list of all the known time zone names (from Qt)
382 QStringList tzNames;
383 QList<QByteArray> tzList = QTimeZone::availableTimeZoneIds();
384 QList<QByteArray>::iterator i;
385 for (i = tzList.begin(); i!= tzList.end(); ++i)
386 tzNames.append(*i);
387
388 tzNames.sort();
389
390 //Save the current selection to be restored later
391 timeZones->blockSignals(true);
392 int index = timeZones->currentIndex();
393 QVariant selectedTzId = timeZones->itemData(index);
394 timeZones->clear();
395 //For each time zone, display the localized name and store the original as user
396 //data. Unfortunately, there's no other way to do this than with a cycle.
397 foreach(const QString& name, tzNames)
398 {
399 timeZones->addItem(q_(name), name);
400 }
401 timeZones->addItem(q_("Local Mean Solar Time"), "LMST");
402 timeZones->addItem(q_("Local True Solar Time"), "LTST");
403 timeZones->addItem(q_("System default"), "system_default");
404 //Restore the selection
405 index = timeZones->findData(selectedTzId, Qt::UserRole, Qt::MatchCaseSensitive);
406 timeZones->setCurrentIndex(index);
407 timeZones->blockSignals(false);
408
409}
410
346// Create a StelLocation instance from the fields411// Create a StelLocation instance from the fields
347StelLocation LocationDialog::locationFromFields() const412StelLocation LocationDialog::locationFromFields() const
348{413{
@@ -362,6 +427,12 @@
362 else427 else
363 loc.country = ui->countryNameComboBox->itemData(index).toString();428 loc.country = ui->countryNameComboBox->itemData(index).toString();
364429
430 index = ui->timeZoneNameComboBox->currentIndex();
431 if (index < 0)
432 loc.timeZone = QString(); //As returned by QComboBox::currentText()
433 else
434 loc.timeZone = ui->timeZoneNameComboBox->itemData(index).toString();
435
365 return loc;436 return loc;
366}437}
367438
@@ -383,12 +454,14 @@
383 loc.longitude = longitude;454 loc.longitude = longitude;
384 setFieldsFromLocation(loc);455 setFieldsFromLocation(loc);
385 StelApp::getInstance().getCore()->moveObserverTo(loc, 0.);456 StelApp::getInstance().getCore()->moveObserverTo(loc, 0.);
457 if (customTimeZone.isEmpty())
458 ui->timeZoneNameComboBox->setCurrentIndex(ui->timeZoneNameComboBox->findData("LMST", Qt::UserRole, Qt::MatchCaseSensitive));
386 // GZ: Filter location list for nearby sites. I assume Earth locations are better known. With only few locations on other planets in the list, 30 degrees seem OK.459 // GZ: Filter location list for nearby sites. I assume Earth locations are better known. With only few locations on other planets in the list, 30 degrees seem OK.
387 LocationMap results = StelApp::getInstance().getLocationMgr().pickLocationsNearby(loc.planetName, longitude, latitude, loc.planetName=="Earth" ? 3.0f: 30.0f);460 LocationMap results = StelApp::getInstance().getLocationMgr().pickLocationsNearby(loc.planetName, longitude, latitude, loc.planetName=="Earth" ? 3.0f: 30.0f);
388 pickedModel->setStringList(results.keys());461 pickedModel->setStringList(results.keys());
389 proxyModel->setSourceModel(pickedModel);462 proxyModel->setSourceModel(pickedModel);
390 proxyModel->sort(0, Qt::AscendingOrder);463 proxyModel->sort(0, Qt::AscendingOrder);
391 ui->citySearchLineEdit->clear();464 ui->citySearchLineEdit->clear();
392}465}
393466
394// Called when the planet name is changed by hand467// Called when the planet name is changed by hand
@@ -422,6 +495,10 @@
422 LocationMap results = locMgr.pickLocationsNearby(loc.planetName, 0.0f, 0.0f, 180.0f);495 LocationMap results = locMgr.pickLocationsNearby(loc.planetName, 0.0f, 0.0f, 180.0f);
423 pickedModel->setStringList(results.keys());496 pickedModel->setStringList(results.keys());
424 proxyModel->setSourceModel(pickedModel);497 proxyModel->setSourceModel(pickedModel);
498 ui->countryNameComboBox->setCurrentIndex(ui->countryNameComboBox->findData("", Qt::UserRole, Qt::MatchCaseSensitive));
499 if (customTimeZone.isEmpty())
500 ui->timeZoneNameComboBox->setCurrentIndex(ui->timeZoneNameComboBox->findData("LMST", Qt::UserRole, Qt::MatchCaseSensitive));
501
425 }502 }
426 proxyModel->sort(0, Qt::AscendingOrder);503 proxyModel->sort(0, Qt::AscendingOrder);
427 ui->citySearchLineEdit->clear();504 ui->citySearchLineEdit->clear();
@@ -443,6 +520,14 @@
443 ui->mapLabel->setCursorPos(loc.longitude, loc.latitude);520 ui->mapLabel->setCursorPos(loc.longitude, loc.latitude);
444}521}
445522
523void LocationDialog::saveTimeZone()
524{
525 QString tz = ui->timeZoneNameComboBox->itemData(ui->timeZoneNameComboBox->currentIndex()).toString();
526 StelApp::getInstance().getCore()->setCurrentTimeZone(tz);
527 if (ui->useCustomTimeZoneCheckBox->isChecked())
528 StelApp::getInstance().getSettings()->setValue("localization/time_zone", tz);
529}
530
446void LocationDialog::reportEdit()531void LocationDialog::reportEdit()
447{532{
448 if (isEditingNew==false)533 if (isEditingNew==false)
@@ -473,6 +558,7 @@
473 }558 }
474 ui->addLocationToListPushButton->setEnabled(isEditingNew && canSave);559 ui->addLocationToListPushButton->setEnabled(isEditingNew && canSave);
475 ui->deleteLocationFromListPushButton->setEnabled(locationMgr.canDeleteUserLocation(loc.getID()));560 ui->deleteLocationFromListPushButton->setEnabled(locationMgr.canDeleteUserLocation(loc.getID()));
561 ui->timeZoneNameComboBox->setEnabled(isEditingNew && canSave);
476}562}
477563
478// Called when the user clicks on the save button564// Called when the user clicks on the save button
@@ -535,6 +621,29 @@
535 ui->useAsDefaultLocationCheckBox->setEnabled(!currentIsDefault);621 ui->useAsDefaultLocationCheckBox->setEnabled(!currentIsDefault);
536}622}
537623
624void LocationDialog::updateTimeZoneControls(bool useCustomTimeZone)
625{
626 if (useCustomTimeZone)
627 {
628 ui->useCustomTimeZoneCheckBox->setChecked(true);
629 saveTimeZone();
630 }
631 else
632 {
633 StelLocation loc = StelApp::getInstance().getCore()->getCurrentLocation();
634 int idx = ui->timeZoneNameComboBox->findData(loc.timeZone, Qt::UserRole, Qt::MatchCaseSensitive);
635 if (idx==-1)
636 {
637 // Use LMST as default
638 idx = ui->timeZoneNameComboBox->findData(QVariant("LMST"), Qt::UserRole, Qt::MatchCaseSensitive);
639 }
640 ui->timeZoneNameComboBox->setCurrentIndex(idx);
641 StelApp::getInstance().getSettings()->remove("localization/time_zone");
642 }
643
644 ui->timeZoneNameComboBox->setEnabled(useCustomTimeZone);
645}
646
538// called when the user clicks on the IP Query button647// called when the user clicks on the IP Query button
539void LocationDialog::ipQueryLocation(bool state)648void LocationDialog::ipQueryLocation(bool state)
540{649{
@@ -548,6 +657,8 @@
548 locMgr.locationFromIP(); // This just triggers asynchronous lookup.657 locMgr.locationFromIP(); // This just triggers asynchronous lookup.
549 ui->useAsDefaultLocationCheckBox->setChecked(!state);658 ui->useAsDefaultLocationCheckBox->setChecked(!state);
550 ui->pushButtonReturnToDefault->setEnabled(!state);659 ui->pushButtonReturnToDefault->setEnabled(!state);
660 ui->useCustomTimeZoneCheckBox->setChecked(!state);
661 updateTimeZoneControls(!state);
551 connectEditSignals();662 connectEditSignals();
552 ui->citySearchLineEdit->setFocus();663 ui->citySearchLineEdit->setFocus();
553 }664 }
554665
=== modified file 'src/gui/LocationDialog.hpp'
--- src/gui/LocationDialog.hpp 2015-08-31 20:19:42 +0000
+++ src/gui/LocationDialog.hpp 2016-10-25 16:10:21 +0000
@@ -74,6 +74,12 @@
74 //! The original names are kept in the user data field of each QComboBox74 //! The original names are kept in the user data field of each QComboBox
75 //! item.75 //! item.
76 void populateCountryList();76 void populateCountryList();
77
78 //! Populates the drop-down list of time zones.
79 //! The displayed names are localized in the current interface language.
80 //! The original names are kept in the user data field of each QComboBox
81 //! item.
82 void populateTimeZonesList();
77 83
78private slots:84private slots:
79 //! Called whenever the StelLocationMgr is updated85 //! Called whenever the StelLocationMgr is updated
@@ -81,6 +87,8 @@
8187
82 //! To be called when user edits any field88 //! To be called when user edits any field
83 void reportEdit();89 void reportEdit();
90
91 void saveTimeZone();
84 92
85 //! Update the widget to make sure it is synchrone if the location is changed programmatically93 //! Update the widget to make sure it is synchrone if the location is changed programmatically
86 //! This function should be called repeatidly with e.g. a timer94 //! This function should be called repeatidly with e.g. a timer
@@ -115,15 +123,20 @@
115 123
116 //! Called when the user wants to use the current location as default124 //! Called when the user wants to use the current location as default
117 void setDefaultLocation(bool state);125 void setDefaultLocation(bool state);
118 126
127 //! Updates the check state and the enabled/disabled status.
128 void updateTimeZoneControls(bool useCustomTimeZone);
129
119private:130private:
120 QString lastPlanet;131 QString lastPlanet;
132 QString customTimeZone;
121 QStringListModel* allModel;133 QStringListModel* allModel;
122 QStringListModel* pickedModel;134 QStringListModel* pickedModel;
123 QSortFilterProxyModel *proxyModel;135 QSortFilterProxyModel *proxyModel;
124136
125 //! Updates the check state and the enabled/disabled status.137 //! Updates the check state and the enabled/disabled status.
126 void updateDefaultLocationControls(bool currentIsDefault);138 void updateDefaultLocationControls(bool currentIsDefault);
139
127};140};
128141
129#endif // _LOCATIONDIALOG_HPP_142#endif // _LOCATIONDIALOG_HPP_
130143
=== modified file 'src/gui/StelGuiItems.cpp'
--- src/gui/StelGuiItems.cpp 2016-09-16 14:19:52 +0000
+++ src/gui/StelGuiItems.cpp 2016-10-25 16:10:21 +0000
@@ -626,6 +626,17 @@
626 newDateInfo = QString("JD %1").arg(jd, 0, 'f', 6);626 newDateInfo = QString("JD %1").arg(jd, 0, 'f', 6);
627 }627 }
628628
629 QString currTZ = QString("%1: %2").arg(q_("Time zone")).arg(core->getCurrentTimeZone());
630 if (currTZ.contains("system_default"))
631 currTZ = QString("%1: %2").arg(q_("Time zone")).arg(q_("System default"));
632
633 QString planetName = core->getCurrentLocation().planetName;
634 if (currTZ.contains("LMST") || currTZ.contains("auto") || (planetName=="Earth" && jd<=2409907.5) || planetName!="Earth")
635 currTZ = q_("Local Mean Solar Time");
636
637 if (currTZ.contains("LTST"))
638 currTZ = q_("Local True Solar Time");
639
629 if (datetime->text()!=newDateInfo)640 if (datetime->text()!=newDateInfo)
630 {641 {
631 updatePos = true; 642 updatePos = true;
@@ -641,10 +652,11 @@
641 else652 else
642 deltaTInfo = QString("%1s%2").arg(deltaT, 3, 'f', 3).arg(validRangeMarker);653 deltaTInfo = QString("%1s%2").arg(deltaT, 3, 'f', 3).arg(validRangeMarker);
643654
644 datetime->setToolTip(QString("<p style='white-space:pre'>%1T = %2 [n-dot @ -23.8946\"/cy%3%4]<br>%5</p>").arg(QChar(0x0394)).arg(deltaTInfo).arg(QChar(0x00B2)).arg(sigmaInfo).arg(newDateAppx));655 datetime->setToolTip(QString("<p style='white-space:pre'>%1T = %2 [n-dot @ -23.8946\"/cy%3%4]<br>%5<br>%6</p>").arg(QChar(0x0394)).arg(deltaTInfo).arg(QChar(0x00B2)).arg(sigmaInfo).arg(newDateAppx).arg(currTZ));
645 }656 }
646 else657 else
647 datetime->setToolTip(QString("%1").arg(newDateAppx));658 datetime->setToolTip(QString("<p style='white-space:pre'>%1<br>%2</p>").arg(newDateAppx).arg(currTZ));
659
648 if (qApp->property("text_texture")==true) // CLI option -t given?660 if (qApp->property("text_texture")==true) // CLI option -t given?
649 {661 {
650 datetime->setVisible(false); // hide normal thingy.662 datetime->setVisible(false); // hide normal thingy.
651663
=== modified file 'src/gui/configurationDialog.ui'
--- src/gui/configurationDialog.ui 2016-08-24 13:32:23 +0000
+++ src/gui/configurationDialog.ui 2016-10-25 16:10:21 +0000
@@ -7,7 +7,7 @@
7 <x>0</x>7 <x>0</x>
8 <y>0</y>8 <y>0</y>
9 <width>512</width>9 <width>512</width>
10 <height>548</height>10 <height>563</height>
11 </rect>11 </rect>
12 </property>12 </property>
13 <layout class="QVBoxLayout">13 <layout class="QVBoxLayout">
@@ -148,7 +148,7 @@
148 <item row="1" column="0">148 <item row="1" column="0">
149 <widget class="QStackedWidget" name="configurationStackedWidget">149 <widget class="QStackedWidget" name="configurationStackedWidget">
150 <property name="currentIndex">150 <property name="currentIndex">
151 <number>0</number>151 <number>2</number>
152 </property>152 </property>
153 <widget class="QWidget" name="page">153 <widget class="QWidget" name="page">
154 <layout class="QVBoxLayout" name="verticalLayout_10">154 <layout class="QVBoxLayout" name="verticalLayout_10">
@@ -495,6 +495,18 @@
495 <string>Selected object information</string>495 <string>Selected object information</string>
496 </property>496 </property>
497 <layout class="QGridLayout" name="gridLayout_2">497 <layout class="QGridLayout" name="gridLayout_2">
498 <property name="leftMargin">
499 <number>0</number>
500 </property>
501 <property name="topMargin">
502 <number>0</number>
503 </property>
504 <property name="rightMargin">
505 <number>0</number>
506 </property>
507 <property name="bottomMargin">
508 <number>0</number>
509 </property>
498 <item row="0" column="0">510 <item row="0" column="0">
499 <widget class="QRadioButton" name="allSelectedInfoRadio">511 <widget class="QRadioButton" name="allSelectedInfoRadio">
500 <property name="toolTip">512 <property name="toolTip">
@@ -766,16 +778,6 @@
766 <property name="bottomMargin">778 <property name="bottomMargin">
767 <number>0</number>779 <number>0</number>
768 </property>780 </property>
769 <item row="0" column="0">
770 <widget class="QCheckBox" name="enableKeysNavigationCheckBox">
771 <property name="toolTip">
772 <string>Allow keyboard to pan and zoom</string>
773 </property>
774 <property name="text">
775 <string>Enable keyboard navigation</string>
776 </property>
777 </widget>
778 </item>
779 <item row="1" column="0">781 <item row="1" column="0">
780 <widget class="QCheckBox" name="enableMouseNavigationCheckBox">782 <widget class="QCheckBox" name="enableMouseNavigationCheckBox">
781 <property name="toolTip">783 <property name="toolTip">
@@ -793,6 +795,16 @@
793 </property>795 </property>
794 </widget>796 </widget>
795 </item>797 </item>
798 <item row="0" column="0">
799 <widget class="QCheckBox" name="enableKeysNavigationCheckBox">
800 <property name="toolTip">
801 <string>Allow keyboard to pan and zoom</string>
802 </property>
803 <property name="text">
804 <string>Enable keyboard navigation</string>
805 </property>
806 </widget>
807 </item>
796 <item row="1" column="1">808 <item row="1" column="1">
797 <layout class="QHBoxLayout" name="_8">809 <layout class="QHBoxLayout" name="_8">
798 <item>810 <item>
@@ -866,63 +878,6 @@
866 <property name="bottomMargin">878 <property name="bottomMargin">
867 <number>0</number>879 <number>0</number>
868 </property>880 </property>
869 <item row="2" column="0">
870 <layout class="QHBoxLayout" name="_4">
871 <item>
872 <widget class="QRadioButton" name="fixedTimeRadio">
873 <property name="toolTip">
874 <string>Use a specific date and time when Stellarium starts up</string>
875 </property>
876 <property name="text">
877 <string>Other:</string>
878 </property>
879 </widget>
880 </item>
881 <item>
882 <widget class="QDateTimeEdit" name="fixedDateTimeEdit">
883 <property name="minimumSize">
884 <size>
885 <width>0</width>
886 <height>24</height>
887 </size>
888 </property>
889 <property name="maximumSize">
890 <size>
891 <width>16777215</width>
892 <height>24</height>
893 </size>
894 </property>
895 <property name="date">
896 <date>
897 <year>1952</year>
898 <month>5</month>
899 <day>11</day>
900 </date>
901 </property>
902 <property name="time">
903 <time>
904 <hour>0</hour>
905 <minute>42</minute>
906 <second>0</second>
907 </time>
908 </property>
909 <property name="calendarPopup">
910 <bool>true</bool>
911 </property>
912 </widget>
913 </item>
914 </layout>
915 </item>
916 <item row="2" column="1">
917 <widget class="QPushButton" name="fixedDateTimeCurrentButton">
918 <property name="toolTip">
919 <string>Use current local date and time</string>
920 </property>
921 <property name="text">
922 <string>use current</string>
923 </property>
924 </widget>
925 </item>
926 <item row="0" column="0">881 <item row="0" column="0">
927 <widget class="QRadioButton" name="systemTimeRadio">882 <widget class="QRadioButton" name="systemTimeRadio">
928 <property name="toolTip">883 <property name="toolTip">
@@ -991,6 +946,63 @@
991 </item>946 </item>
992 </layout>947 </layout>
993 </item>948 </item>
949 <item row="2" column="0">
950 <layout class="QHBoxLayout" name="_4">
951 <item>
952 <widget class="QRadioButton" name="fixedTimeRadio">
953 <property name="toolTip">
954 <string>Use a specific date and time when Stellarium starts up</string>
955 </property>
956 <property name="text">
957 <string>Other:</string>
958 </property>
959 </widget>
960 </item>
961 <item>
962 <widget class="QDateTimeEdit" name="fixedDateTimeEdit">
963 <property name="minimumSize">
964 <size>
965 <width>0</width>
966 <height>24</height>
967 </size>
968 </property>
969 <property name="maximumSize">
970 <size>
971 <width>16777215</width>
972 <height>24</height>
973 </size>
974 </property>
975 <property name="date">
976 <date>
977 <year>1952</year>
978 <month>5</month>
979 <day>11</day>
980 </date>
981 </property>
982 <property name="time">
983 <time>
984 <hour>0</hour>
985 <minute>42</minute>
986 <second>0</second>
987 </time>
988 </property>
989 <property name="calendarPopup">
990 <bool>true</bool>
991 </property>
992 </widget>
993 </item>
994 </layout>
995 </item>
996 <item row="2" column="1">
997 <widget class="QPushButton" name="fixedDateTimeCurrentButton">
998 <property name="toolTip">
999 <string>Use current local date and time</string>
1000 </property>
1001 <property name="text">
1002 <string>use current</string>
1003 </property>
1004 </widget>
1005 </item>
994 </layout>1006 </layout>
995 </widget>1007 </widget>
996 </item>1008 </item>
@@ -1139,6 +1151,18 @@
1139 <string>Planetarium options</string>1151 <string>Planetarium options</string>
1140 </property>1152 </property>
1141 <layout class="QGridLayout" name="gridLayoutOptions">1153 <layout class="QGridLayout" name="gridLayoutOptions">
1154 <property name="leftMargin">
1155 <number>0</number>
1156 </property>
1157 <property name="topMargin">
1158 <number>0</number>
1159 </property>
1160 <property name="rightMargin">
1161 <number>0</number>
1162 </property>
1163 <property name="bottomMargin">
1164 <number>0</number>
1165 </property>
1142 <item row="3" column="0">1166 <item row="3" column="0">
1143 <widget class="QCheckBox" name="autoEnableAtmosphereCheckBox">1167 <widget class="QCheckBox" name="autoEnableAtmosphereCheckBox">
1144 <property name="toolTip">1168 <property name="toolTip">
@@ -1774,7 +1798,7 @@
1774 <customwidget>1798 <customwidget>
1775 <class>BarFrame</class>1799 <class>BarFrame</class>
1776 <extends>QFrame</extends>1800 <extends>QFrame</extends>
1777 <header location="global">Dialog.hpp</header>1801 <header>Dialog.hpp</header>
1778 <container>1</container>1802 <container>1</container>
1779 </customwidget>1803 </customwidget>
1780 </customwidgets>1804 </customwidgets>
17811805
=== modified file 'src/gui/locationDialogGui.ui'
--- src/gui/locationDialogGui.ui 2014-08-16 16:27:46 +0000
+++ src/gui/locationDialogGui.ui 2016-10-25 16:10:21 +0000
@@ -7,7 +7,7 @@
7 <x>0</x>7 <x>0</x>
8 <y>0</y>8 <y>0</y>
9 <width>700</width>9 <width>700</width>
10 <height>460</height>10 <height>506</height>
11 </rect>11 </rect>
12 </property>12 </property>
13 <property name="styleSheet">13 <property name="styleSheet">
@@ -393,18 +393,99 @@
393 <property name="bottomMargin">393 <property name="bottomMargin">
394 <number>0</number>394 <number>0</number>
395 </property>395 </property>
396 <item row="1" column="2" colspan="2">396 <item row="2" column="1" colspan="3">
397 <spacer name="verticalSpacer">397 <widget class="QFrame" name="frame_3">
398 <property name="orientation">398 <property name="minimumSize">
399 <enum>Qt::Vertical</enum>
400 </property>
401 <property name="sizeHint" stdset="0">
402 <size>399 <size>
403 <width>20</width>400 <width>0</width>
404 <height>40</height>401 <height>0</height>
405 </size>402 </size>
406 </property>403 </property>
407 </spacer>404 <property name="frameShape">
405 <enum>QFrame::StyledPanel</enum>
406 </property>
407 <property name="frameShadow">
408 <enum>QFrame::Raised</enum>
409 </property>
410 <layout class="QHBoxLayout" name="horizontalLayout">
411 <property name="leftMargin">
412 <number>0</number>
413 </property>
414 <property name="topMargin">
415 <number>0</number>
416 </property>
417 <property name="rightMargin">
418 <number>0</number>
419 </property>
420 <property name="bottomMargin">
421 <number>0</number>
422 </property>
423 <item>
424 <spacer name="horizontalSpacer">
425 <property name="orientation">
426 <enum>Qt::Horizontal</enum>
427 </property>
428 <property name="sizeHint" stdset="0">
429 <size>
430 <width>40</width>
431 <height>20</height>
432 </size>
433 </property>
434 </spacer>
435 </item>
436 <item>
437 <widget class="QPushButton" name="addLocationToListPushButton">
438 <property name="enabled">
439 <bool>false</bool>
440 </property>
441 <property name="minimumSize">
442 <size>
443 <width>100</width>
444 <height>0</height>
445 </size>
446 </property>
447 <property name="focusPolicy">
448 <enum>Qt::NoFocus</enum>
449 </property>
450 <property name="text">
451 <string>Add to list</string>
452 </property>
453 </widget>
454 </item>
455 <item>
456 <widget class="QPushButton" name="deleteLocationFromListPushButton">
457 <property name="enabled">
458 <bool>false</bool>
459 </property>
460 <property name="minimumSize">
461 <size>
462 <width>60</width>
463 <height>0</height>
464 </size>
465 </property>
466 <property name="focusPolicy">
467 <enum>Qt::NoFocus</enum>
468 </property>
469 <property name="text">
470 <string>Delete from list</string>
471 </property>
472 </widget>
473 </item>
474 <item>
475 <widget class="QPushButton" name="pushButtonReturnToDefault">
476 <property name="enabled">
477 <bool>false</bool>
478 </property>
479 <property name="focusPolicy">
480 <enum>Qt::NoFocus</enum>
481 </property>
482 <property name="text">
483 <string>Return to default location</string>
484 </property>
485 </widget>
486 </item>
487 </layout>
488 </widget>
408 </item>489 </item>
409 <item row="0" column="1">490 <item row="0" column="1">
410 <widget class="QFrame" name="frame_4">491 <widget class="QFrame" name="frame_4">
@@ -436,6 +517,20 @@
436 <property name="horizontalSpacing">517 <property name="horizontalSpacing">
437 <number>6</number>518 <number>6</number>
438 </property>519 </property>
520 <item row="5" column="0" colspan="2">
521 <widget class="QCheckBox" name="useAsDefaultLocationCheckBox">
522 <property name="text">
523 <string>Use current location as default</string>
524 </property>
525 </widget>
526 </item>
527 <item row="1" column="0">
528 <widget class="QLabel" name="label">
529 <property name="text">
530 <string>Longitude:</string>
531 </property>
532 </widget>
533 </item>
439 <item row="0" column="0">534 <item row="0" column="0">
440 <widget class="QLabel" name="label_5">535 <widget class="QLabel" name="label_5">
441 <property name="text">536 <property name="text">
@@ -443,26 +538,10 @@
443 </property>538 </property>
444 </widget>539 </widget>
445 </item>540 </item>
446 <item row="0" column="1">541 <item row="4" column="0" colspan="2">
447 <widget class="AngleSpinBox" name="latitudeSpinBox">542 <widget class="QCheckBox" name="useIpQueryCheckBox">
448 <property name="minimumSize">
449 <size>
450 <width>180</width>
451 <height>24</height>
452 </size>
453 </property>
454 <property name="toolTip">
455 <string>You can enter values in decimal degrees, or using dms format, for example: +1d 12m 8s</string>
456 </property>
457 <property name="alignment">
458 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
459 </property>
460 </widget>
461 </item>
462 <item row="1" column="0">
463 <widget class="QLabel" name="label">
464 <property name="text">543 <property name="text">
465 <string>Longitude:</string>544 <string>Get location from Network</string>
466 </property>545 </property>
467 </widget>546 </widget>
468 </item>547 </item>
@@ -482,13 +561,6 @@
482 </property>561 </property>
483 </widget>562 </widget>
484 </item>563 </item>
485 <item row="2" column="0">
486 <widget class="QLabel" name="label_7">
487 <property name="text">
488 <string>Altitude:</string>
489 </property>
490 </widget>
491 </item>
492 <item row="2" column="1">564 <item row="2" column="1">
493 <widget class="QSpinBox" name="altitudeSpinBox">565 <widget class="QSpinBox" name="altitudeSpinBox">
494 <property name="minimumSize">566 <property name="minimumSize">
@@ -517,100 +589,42 @@
517 </property>589 </property>
518 </widget>590 </widget>
519 </item>591 </item>
520 </layout>592 <item row="0" column="1">
521 </widget>593 <widget class="AngleSpinBox" name="latitudeSpinBox">
522 </item>594 <property name="minimumSize">
523 <item row="2" column="1" colspan="3">595 <size>
524 <widget class="QFrame" name="frame_3">596 <width>180</width>
525 <property name="minimumSize">597 <height>24</height>
526 <size>598 </size>
527 <width>0</width>599 </property>
528 <height>0</height>600 <property name="toolTip">
529 </size>601 <string>You can enter values in decimal degrees, or using dms format, for example: +1d 12m 8s</string>
530 </property>602 </property>
531 <property name="frameShape">603 <property name="alignment">
532 <enum>QFrame::StyledPanel</enum>604 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
533 </property>605 </property>
534 <property name="frameShadow">606 </widget>
535 <enum>QFrame::Raised</enum>607 </item>
536 </property>608 <item row="2" column="0">
537 <layout class="QHBoxLayout" name="horizontalLayout">609 <widget class="QLabel" name="label_7">
538 <property name="leftMargin">
539 <number>0</number>
540 </property>
541 <property name="topMargin">
542 <number>0</number>
543 </property>
544 <property name="rightMargin">
545 <number>0</number>
546 </property>
547 <property name="bottomMargin">
548 <number>0</number>
549 </property>
550 <item>
551 <widget class="QPushButton" name="pushButtonReturnToDefault">
552 <property name="enabled">
553 <bool>false</bool>
554 </property>
555 <property name="focusPolicy">
556 <enum>Qt::NoFocus</enum>
557 </property>
558 <property name="text">610 <property name="text">
559 <string>Return to default location</string>611 <string>Altitude:</string>
560 </property>612 </property>
561 </widget>613 </widget>
562 </item>614 </item>
563 <item>615 <item row="3" column="0">
564 <spacer name="horizontalSpacer">616 <spacer name="verticalSpacer">
565 <property name="orientation">617 <property name="orientation">
566 <enum>Qt::Horizontal</enum>618 <enum>Qt::Vertical</enum>
567 </property>619 </property>
568 <property name="sizeHint" stdset="0">620 <property name="sizeHint" stdset="0">
569 <size>621 <size>
570 <width>40</width>622 <width>20</width>
571 <height>20</height>623 <height>40</height>
572 </size>624 </size>
573 </property>625 </property>
574 </spacer>626 </spacer>
575 </item>627 </item>
576 <item>
577 <widget class="QPushButton" name="deleteLocationFromListPushButton">
578 <property name="enabled">
579 <bool>false</bool>
580 </property>
581 <property name="minimumSize">
582 <size>
583 <width>60</width>
584 <height>0</height>
585 </size>
586 </property>
587 <property name="focusPolicy">
588 <enum>Qt::NoFocus</enum>
589 </property>
590 <property name="text">
591 <string>Delete</string>
592 </property>
593 </widget>
594 </item>
595 <item>
596 <widget class="QPushButton" name="addLocationToListPushButton">
597 <property name="enabled">
598 <bool>false</bool>
599 </property>
600 <property name="minimumSize">
601 <size>
602 <width>100</width>
603 <height>0</height>
604 </size>
605 </property>
606 <property name="focusPolicy">
607 <enum>Qt::NoFocus</enum>
608 </property>
609 <property name="text">
610 <string>Add to list</string>
611 </property>
612 </widget>
613 </item>
614 </layout>628 </layout>
615 </widget>629 </widget>
616 </item>630 </item>
@@ -654,10 +668,31 @@
654 <property name="bottomMargin">668 <property name="bottomMargin">
655 <number>0</number>669 <number>0</number>
656 </property>670 </property>
657 <item row="0" column="0">671 <item row="1" column="1">
658 <widget class="QLabel" name="label_3">672 <widget class="QComboBox" name="countryNameComboBox">
659 <property name="text">673 <property name="sizePolicy">
660 <string>Name/City:</string>674 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
675 <horstretch>0</horstretch>
676 <verstretch>0</verstretch>
677 </sizepolicy>
678 </property>
679 <property name="minimumSize">
680 <size>
681 <width>0</width>
682 <height>24</height>
683 </size>
684 </property>
685 <property name="maximumSize">
686 <size>
687 <width>16777215</width>
688 <height>24</height>
689 </size>
690 </property>
691 <property name="editable">
692 <bool>true</bool>
693 </property>
694 <property name="insertPolicy">
695 <enum>QComboBox::NoInsert</enum>
661 </property>696 </property>
662 </widget>697 </widget>
663 </item>698 </item>
@@ -668,41 +703,6 @@
668 </property>703 </property>
669 </widget>704 </widget>
670 </item>705 </item>
671 <item row="1" column="0">
672 <widget class="QLabel" name="label_4">
673 <property name="text">
674 <string>Country:</string>
675 </property>
676 </widget>
677 </item>
678 <item row="1" column="1">
679 <widget class="QComboBox" name="countryNameComboBox">
680 <property name="sizePolicy">
681 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
682 <horstretch>0</horstretch>
683 <verstretch>0</verstretch>
684 </sizepolicy>
685 </property>
686 <property name="minimumSize">
687 <size>
688 <width>0</width>
689 <height>24</height>
690 </size>
691 </property>
692 <property name="maximumSize">
693 <size>
694 <width>16777215</width>
695 <height>24</height>
696 </size>
697 </property>
698 <property name="editable">
699 <bool>true</bool>
700 </property>
701 <property name="insertPolicy">
702 <enum>QComboBox::NoInsert</enum>
703 </property>
704 </widget>
705 </item>
706 <item row="2" column="0">706 <item row="2" column="0">
707 <widget class="QLabel" name="label_6">707 <widget class="QLabel" name="label_6">
708 <property name="text">708 <property name="text">
@@ -710,6 +710,58 @@
710 </property>710 </property>
711 </widget>711 </widget>
712 </item>712 </item>
713 <item row="4" column="0" colspan="2">
714 <widget class="QCheckBox" name="useCustomTimeZoneCheckBox">
715 <property name="text">
716 <string>Use custom time zone</string>
717 </property>
718 </widget>
719 </item>
720 <item row="3" column="0">
721 <widget class="QLabel" name="timeZoneLabel">
722 <property name="text">
723 <string>Time zone:</string>
724 </property>
725 </widget>
726 </item>
727 <item row="0" column="0">
728 <widget class="QLabel" name="label_3">
729 <property name="text">
730 <string>Name/City:</string>
731 </property>
732 </widget>
733 </item>
734 <item row="3" column="1">
735 <widget class="QComboBox" name="timeZoneNameComboBox">
736 <property name="enabled">
737 <bool>true</bool>
738 </property>
739 <property name="sizePolicy">
740 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
741 <horstretch>0</horstretch>
742 <verstretch>0</verstretch>
743 </sizepolicy>
744 </property>
745 <property name="minimumSize">
746 <size>
747 <width>0</width>
748 <height>24</height>
749 </size>
750 </property>
751 <property name="maximumSize">
752 <size>
753 <width>16777215</width>
754 <height>24</height>
755 </size>
756 </property>
757 <property name="editable">
758 <bool>true</bool>
759 </property>
760 <property name="insertPolicy">
761 <enum>QComboBox::NoInsert</enum>
762 </property>
763 </widget>
764 </item>
713 <item row="2" column="1">765 <item row="2" column="1">
714 <widget class="QComboBox" name="planetNameComboBox">766 <widget class="QComboBox" name="planetNameComboBox">
715 <property name="sizePolicy">767 <property name="sizePolicy">
@@ -738,23 +790,26 @@
738 </property>790 </property>
739 </widget>791 </widget>
740 </item>792 </item>
793 <item row="1" column="0">
794 <widget class="QLabel" name="label_4">
795 <property name="text">
796 <string>Country:</string>
797 </property>
798 </widget>
799 </item>
800 <item row="5" column="0" colspan="2">
801 <widget class="QCheckBox" name="dstCheckBox">
802 <property name="toolTip">
803 <string/>
804 </property>
805 <property name="text">
806 <string>Enable daylight saving time</string>
807 </property>
808 </widget>
809 </item>
741 </layout>810 </layout>
742 </widget>811 </widget>
743 </item>812 </item>
744 <item row="3" column="1">
745 <widget class="QCheckBox" name="useAsDefaultLocationCheckBox">
746 <property name="text">
747 <string>Use current location as default</string>
748 </property>
749 </widget>
750 </item>
751 <item row="3" column="3">
752 <widget class="QCheckBox" name="useIpQueryCheckBox">
753 <property name="text">
754 <string>Get location from Network</string>
755 </property>
756 </widget>
757 </item>
758 </layout>813 </layout>
759 </widget>814 </widget>
760 </item>815 </item>
761816
=== modified file 'src/scripting/StelMainScriptAPI.cpp'
--- src/scripting/StelMainScriptAPI.cpp 2016-10-10 04:45:16 +0000
+++ src/scripting/StelMainScriptAPI.cpp 2016-10-25 16:10:21 +0000
@@ -175,7 +175,7 @@
175 if (spec=="utc")175 if (spec=="utc")
176 return StelUtils::julianDayToISO8601String(getJDay());176 return StelUtils::julianDayToISO8601String(getJDay());
177 else177 else
178 return StelUtils::julianDayToISO8601String(getJDay()+StelUtils::getGMTShiftFromQT(getJDay())/24);178 return StelUtils::julianDayToISO8601String(getJDay()+StelApp::getInstance().getCore()->getUTCOffset(getJDay())/24);
179}179}
180180
181QString StelMainScriptAPI::getDeltaT() const181QString StelMainScriptAPI::getDeltaT() const