Merge lp:~alexwolf/stellarium/equation-of-time into lp:stellarium

Proposed by Alexander Wolf
Status: Merged
Merged at revision: 6547
Proposed branch: lp:~alexwolf/stellarium/equation-of-time
Merge into: lp:stellarium
Diff against target: 1541 lines (+1369/-24)
16 files modified
CMakeLists.txt (+1/-0)
plugins/EquationOfTime/CMakeLists.txt (+18/-0)
plugins/EquationOfTime/COPYING (+340/-0)
plugins/EquationOfTime/resources/EquationOfTime.qrc (+6/-0)
plugins/EquationOfTime/src/CMakeLists.txt (+33/-0)
plugins/EquationOfTime/src/EquationOfTime.cpp (+275/-0)
plugins/EquationOfTime/src/EquationOfTime.hpp (+134/-0)
plugins/EquationOfTime/src/gui/EquationOfTimeWindow.cpp (+92/-0)
plugins/EquationOfTime/src/gui/EquationOfTimeWindow.hpp (+60/-0)
plugins/EquationOfTime/src/gui/equationOfTimeWindow.ui (+357/-0)
po/stellarium/POTFILES.in (+3/-0)
src/core/StelApp.cpp (+4/-0)
src/core/planetsephems/sidereal_time.c (+29/-22)
src/core/planetsephems/sidereal_time.h (+2/-0)
src/gui/SkyGui.cpp (+12/-2)
src/gui/SkyGui.hpp (+3/-0)
To merge this branch: bzr merge lp:~alexwolf/stellarium/equation-of-time
Reviewer Review Type Date Requested Status
gzotti Approve
Review via email: mp+205011@code.launchpad.net

Description of the change

I propose for merging the plugin, which shows the solution of the equation of time on top of the screen. In future this plugin can be extend for generate the graph for equation of time for year.

To post a comment you must log in.
6544. By Alexander Wolf

added sources of algorithm

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

Hi Alex!

it crashes just after boot. :-( (Win7, i7/NVidia)

end of logfile:

=============
Loading constellation boundary data ...
Loaded 782 constellation boundary segments
StelPainter: initGLShaders()...
StelPainter: initGLShaders()... done
Creating GUI ...
ASSERT: "matAltAzModelView[0]==matAltAzModelView[0]" in file
C:\Stellarium_DEV\BZR\equation-of-time\src\core\StelCore.cpp, line 665
QWidget::repaint: Recursive repaint detected
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::worldTransform: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::setOpacity: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::setOpacity: Painter not active
QPainter::beginNativePainting: Painter not active
ASSERT: "matAltAzModelView[0]==matAltAzModelView[0]" in file
C:\Stellarium_DEV\BZR\equation-of-time\src\core\StelCore.cpp, line 665
=============

Not sure if the assert was guilty or the recursive repaint. The latter has
caused some occasional crashes for me in the past (will that be solved by
the changes for QML2?), but this is consistently failing now.

Kind regards,
Georg

On Mi, 5.02.2014, 18:23, Alexander Wolf wrote:
> Alexander Wolf has proposed merging
> lp:~alexwolf/stellarium/equation-of-time into lp:stellarium.
>
> Requested reviews:
> Stellarium (stellarium)
>
> For more details, see:
> https://code.launchpad.net/~alexwolf/stellarium/equation-of-time/+merge/205011
>
> I propose for merging the plugin, which shows the solution of the equation
> of time on top of the screen. In future this plugin can be extend for
> generate the graph for equation of time for year.
> --
> https://code.launchpad.net/~alexwolf/stellarium/equation-of-time/+merge/205011
> Your team Stellarium is requested to review the proposed merge of
> lp:~alexwolf/stellarium/equation-of-time into lp:stellarium.
>

6545. By Alexander Wolf

refactor code for getting size of scene

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

Dear Georg,

can you check plugin after refactoring?

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

Hi!

No change, I am afraid :-(

But during the crash, my config.ini is corrupted! It is left as empty
file. If I delete it, a new file is created, again empty.

BTW, plugins/EquationOfTime/src/EquationOfTime.cpp, near line 674, you may
use fmod(sunMeanLongitude, 360.0) for a faster modulo, then add 360 if <0.
But this is not causing the problems. Does it work for you on Windows?

Kind regards,
Georg

On Do, 6.02.2014, 18:05, Alexander Wolf wrote:
> Dear Georg,
>
> can you check plugin after refactoring?
> --
> https://code.launchpad.net/~alexwolf/stellarium/equation-of-time/+merge/205011
> Your team Stellarium is requested to review the proposed merge of
> lp:~alexwolf/stellarium/equation-of-time into lp:stellarium.
>

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

Dear Georg,

2014-02-07 gzotti <email address hidden>:

> No change, I am afraid :-(
>

bad news :(

> But during the crash, my config.ini is corrupted! It is left as empty
> file. If I delete it, a new file is created, again empty.
>

This is very odd. Just for test - this issue can be reproduced only when
plugin enabled or not (It can be reproduce for trunk too)?

> BTW, plugins/EquationOfTime/src/EquationOfTime.cpp, near line 674, you may
> use fmod(sunMeanLongitude, 360.0) for a faster modulo, then add 360 if <0.
> But this is not causing the problems. Does it work for you on Windows?
>

I'll check it on Windows tonight.

--
With best regards, Alexander

6546. By Alexander Wolf

code refactoring

6547. By Alexander Wolf

code refactoring

6548. By Alexander Wolf

code refactoring & optimizations

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

Dear Georg,

I fixed my stupid error and now plugin works on Windows too.

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

Indeed, it works now. Valuable addition, thank you!

Looking forward to the graphic solution! :-) Classical 8-figure with a dot representing the sun? This should have configurable screen position then.

G.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-02-06 15:37:56 +0000
3+++ CMakeLists.txt 2014-02-07 18:17:25 +0000
4@@ -171,6 +171,7 @@
5 ADD_PLUGIN(AngleMeasure 1)
6 ADD_PLUGIN(CompassMarks 1)
7 ADD_PLUGIN(Exoplanets 1)
8+ADD_PLUGIN(EquationOfTime 1)
9 ADD_PLUGIN(FOV 1)
10 ADD_PLUGIN(LogBook 0)
11 ADD_PLUGIN(NavStars 1)
12
13=== added directory 'plugins/EquationOfTime'
14=== added file 'plugins/EquationOfTime/CMakeLists.txt'
15--- plugins/EquationOfTime/CMakeLists.txt 1970-01-01 00:00:00 +0000
16+++ plugins/EquationOfTime/CMakeLists.txt 2014-02-07 18:17:25 +0000
17@@ -0,0 +1,18 @@
18+SET(EQUATIONOFTIME_MAJOR "0")
19+SET(EQUATIONOFTIME_MINOR "1")
20+SET(EQUATIONOFTIME_PATCH "0")
21+SET(EQUATIONOFTIME_VERSION "${EQUATIONOFTIME_MAJOR}.${EQUATIONOFTIME_MINOR}.${EQUATIONOFTIME_PATCH}")
22+
23+IF(APPLE)
24+ SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/Library/Application\ Support/Stellarium)
25+ElSE(APPLE)
26+ SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/.stellarium)
27+ENDIF(APPLE)
28+
29+ADD_DEFINITIONS(-DEQUATIONOFTIME_PLUGIN_VERSION="${EQUATIONOFTIME_VERSION}")
30+
31+ADD_SUBDIRECTORY( src )
32+
33+INSTALL(FILES DESTINATION "modules/EquationOfTime")
34+
35+
36
37=== added file 'plugins/EquationOfTime/COPYING'
38--- plugins/EquationOfTime/COPYING 1970-01-01 00:00:00 +0000
39+++ plugins/EquationOfTime/COPYING 2014-02-07 18:17:25 +0000
40@@ -0,0 +1,340 @@
41+ GNU GENERAL PUBLIC LICENSE
42+ Version 2, June 1991
43+
44+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
45+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
46+ Everyone is permitted to copy and distribute verbatim copies
47+ of this license document, but changing it is not allowed.
48+
49+ Preamble
50+
51+ The licenses for most software are designed to take away your
52+freedom to share and change it. By contrast, the GNU General Public
53+License is intended to guarantee your freedom to share and change free
54+software--to make sure the software is free for all its users. This
55+General Public License applies to most of the Free Software
56+Foundation's software and to any other program whose authors commit to
57+using it. (Some other Free Software Foundation software is covered by
58+the GNU Library General Public License instead.) You can apply it to
59+your programs, too.
60+
61+ When we speak of free software, we are referring to freedom, not
62+price. Our General Public Licenses are designed to make sure that you
63+have the freedom to distribute copies of free software (and charge for
64+this service if you wish), that you receive source code or can get it
65+if you want it, that you can change the software or use pieces of it
66+in new free programs; and that you know you can do these things.
67+
68+ To protect your rights, we need to make restrictions that forbid
69+anyone to deny you these rights or to ask you to surrender the rights.
70+These restrictions translate to certain responsibilities for you if you
71+distribute copies of the software, or if you modify it.
72+
73+ For example, if you distribute copies of such a program, whether
74+gratis or for a fee, you must give the recipients all the rights that
75+you have. You must make sure that they, too, receive or can get the
76+source code. And you must show them these terms so they know their
77+rights.
78+
79+ We protect your rights with two steps: (1) copyright the software, and
80+(2) offer you this license which gives you legal permission to copy,
81+distribute and/or modify the software.
82+
83+ Also, for each author's protection and ours, we want to make certain
84+that everyone understands that there is no warranty for this free
85+software. If the software is modified by someone else and passed on, we
86+want its recipients to know that what they have is not the original, so
87+that any problems introduced by others will not reflect on the original
88+authors' reputations.
89+
90+ Finally, any free program is threatened constantly by software
91+patents. We wish to avoid the danger that redistributors of a free
92+program will individually obtain patent licenses, in effect making the
93+program proprietary. To prevent this, we have made it clear that any
94+patent must be licensed for everyone's free use or not licensed at all.
95+
96+ The precise terms and conditions for copying, distribution and
97+modification follow.
98+
99
100+ GNU GENERAL PUBLIC LICENSE
101+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
102+
103+ 0. This License applies to any program or other work which contains
104+a notice placed by the copyright holder saying it may be distributed
105+under the terms of this General Public License. The "Program", below,
106+refers to any such program or work, and a "work based on the Program"
107+means either the Program or any derivative work under copyright law:
108+that is to say, a work containing the Program or a portion of it,
109+either verbatim or with modifications and/or translated into another
110+language. (Hereinafter, translation is included without limitation in
111+the term "modification".) Each licensee is addressed as "you".
112+
113+Activities other than copying, distribution and modification are not
114+covered by this License; they are outside its scope. The act of
115+running the Program is not restricted, and the output from the Program
116+is covered only if its contents constitute a work based on the
117+Program (independent of having been made by running the Program).
118+Whether that is true depends on what the Program does.
119+
120+ 1. You may copy and distribute verbatim copies of the Program's
121+source code as you receive it, in any medium, provided that you
122+conspicuously and appropriately publish on each copy an appropriate
123+copyright notice and disclaimer of warranty; keep intact all the
124+notices that refer to this License and to the absence of any warranty;
125+and give any other recipients of the Program a copy of this License
126+along with the Program.
127+
128+You may charge a fee for the physical act of transferring a copy, and
129+you may at your option offer warranty protection in exchange for a fee.
130+
131+ 2. You may modify your copy or copies of the Program or any portion
132+of it, thus forming a work based on the Program, and copy and
133+distribute such modifications or work under the terms of Section 1
134+above, provided that you also meet all of these conditions:
135+
136+ a) You must cause the modified files to carry prominent notices
137+ stating that you changed the files and the date of any change.
138+
139+ b) You must cause any work that you distribute or publish, that in
140+ whole or in part contains or is derived from the Program or any
141+ part thereof, to be licensed as a whole at no charge to all third
142+ parties under the terms of this License.
143+
144+ c) If the modified program normally reads commands interactively
145+ when run, you must cause it, when started running for such
146+ interactive use in the most ordinary way, to print or display an
147+ announcement including an appropriate copyright notice and a
148+ notice that there is no warranty (or else, saying that you provide
149+ a warranty) and that users may redistribute the program under
150+ these conditions, and telling the user how to view a copy of this
151+ License. (Exception: if the Program itself is interactive but
152+ does not normally print such an announcement, your work based on
153+ the Program is not required to print an announcement.)
154+
155
156+These requirements apply to the modified work as a whole. If
157+identifiable sections of that work are not derived from the Program,
158+and can be reasonably considered independent and separate works in
159+themselves, then this License, and its terms, do not apply to those
160+sections when you distribute them as separate works. But when you
161+distribute the same sections as part of a whole which is a work based
162+on the Program, the distribution of the whole must be on the terms of
163+this License, whose permissions for other licensees extend to the
164+entire whole, and thus to each and every part regardless of who wrote it.
165+
166+Thus, it is not the intent of this section to claim rights or contest
167+your rights to work written entirely by you; rather, the intent is to
168+exercise the right to control the distribution of derivative or
169+collective works based on the Program.
170+
171+In addition, mere aggregation of another work not based on the Program
172+with the Program (or with a work based on the Program) on a volume of
173+a storage or distribution medium does not bring the other work under
174+the scope of this License.
175+
176+ 3. You may copy and distribute the Program (or a work based on it,
177+under Section 2) in object code or executable form under the terms of
178+Sections 1 and 2 above provided that you also do one of the following:
179+
180+ a) Accompany it with the complete corresponding machine-readable
181+ source code, which must be distributed under the terms of Sections
182+ 1 and 2 above on a medium customarily used for software interchange; or,
183+
184+ b) Accompany it with a written offer, valid for at least three
185+ years, to give any third party, for a charge no more than your
186+ cost of physically performing source distribution, a complete
187+ machine-readable copy of the corresponding source code, to be
188+ distributed under the terms of Sections 1 and 2 above on a medium
189+ customarily used for software interchange; or,
190+
191+ c) Accompany it with the information you received as to the offer
192+ to distribute corresponding source code. (This alternative is
193+ allowed only for noncommercial distribution and only if you
194+ received the program in object code or executable form with such
195+ an offer, in accord with Subsection b above.)
196+
197+The source code for a work means the preferred form of the work for
198+making modifications to it. For an executable work, complete source
199+code means all the source code for all modules it contains, plus any
200+associated interface definition files, plus the scripts used to
201+control compilation and installation of the executable. However, as a
202+special exception, the source code distributed need not include
203+anything that is normally distributed (in either source or binary
204+form) with the major components (compiler, kernel, and so on) of the
205+operating system on which the executable runs, unless that component
206+itself accompanies the executable.
207+
208+If distribution of executable or object code is made by offering
209+access to copy from a designated place, then offering equivalent
210+access to copy the source code from the same place counts as
211+distribution of the source code, even though third parties are not
212+compelled to copy the source along with the object code.
213+
214
215+ 4. You may not copy, modify, sublicense, or distribute the Program
216+except as expressly provided under this License. Any attempt
217+otherwise to copy, modify, sublicense or distribute the Program is
218+void, and will automatically terminate your rights under this License.
219+However, parties who have received copies, or rights, from you under
220+this License will not have their licenses terminated so long as such
221+parties remain in full compliance.
222+
223+ 5. You are not required to accept this License, since you have not
224+signed it. However, nothing else grants you permission to modify or
225+distribute the Program or its derivative works. These actions are
226+prohibited by law if you do not accept this License. Therefore, by
227+modifying or distributing the Program (or any work based on the
228+Program), you indicate your acceptance of this License to do so, and
229+all its terms and conditions for copying, distributing or modifying
230+the Program or works based on it.
231+
232+ 6. Each time you redistribute the Program (or any work based on the
233+Program), the recipient automatically receives a license from the
234+original licensor to copy, distribute or modify the Program subject to
235+these terms and conditions. You may not impose any further
236+restrictions on the recipients' exercise of the rights granted herein.
237+You are not responsible for enforcing compliance by third parties to
238+this License.
239+
240+ 7. If, as a consequence of a court judgment or allegation of patent
241+infringement or for any other reason (not limited to patent issues),
242+conditions are imposed on you (whether by court order, agreement or
243+otherwise) that contradict the conditions of this License, they do not
244+excuse you from the conditions of this License. If you cannot
245+distribute so as to satisfy simultaneously your obligations under this
246+License and any other pertinent obligations, then as a consequence you
247+may not distribute the Program at all. For example, if a patent
248+license would not permit royalty-free redistribution of the Program by
249+all those who receive copies directly or indirectly through you, then
250+the only way you could satisfy both it and this License would be to
251+refrain entirely from distribution of the Program.
252+
253+If any portion of this section is held invalid or unenforceable under
254+any particular circumstance, the balance of the section is intended to
255+apply and the section as a whole is intended to apply in other
256+circumstances.
257+
258+It is not the purpose of this section to induce you to infringe any
259+patents or other property right claims or to contest validity of any
260+such claims; this section has the sole purpose of protecting the
261+integrity of the free software distribution system, which is
262+implemented by public license practices. Many people have made
263+generous contributions to the wide range of software distributed
264+through that system in reliance on consistent application of that
265+system; it is up to the author/donor to decide if he or she is willing
266+to distribute software through any other system and a licensee cannot
267+impose that choice.
268+
269+This section is intended to make thoroughly clear what is believed to
270+be a consequence of the rest of this License.
271+
272
273+ 8. If the distribution and/or use of the Program is restricted in
274+certain countries either by patents or by copyrighted interfaces, the
275+original copyright holder who places the Program under this License
276+may add an explicit geographical distribution limitation excluding
277+those countries, so that distribution is permitted only in or among
278+countries not thus excluded. In such case, this License incorporates
279+the limitation as if written in the body of this License.
280+
281+ 9. The Free Software Foundation may publish revised and/or new versions
282+of the General Public License from time to time. Such new versions will
283+be similar in spirit to the present version, but may differ in detail to
284+address new problems or concerns.
285+
286+Each version is given a distinguishing version number. If the Program
287+specifies a version number of this License which applies to it and "any
288+later version", you have the option of following the terms and conditions
289+either of that version or of any later version published by the Free
290+Software Foundation. If the Program does not specify a version number of
291+this License, you may choose any version ever published by the Free Software
292+Foundation.
293+
294+ 10. If you wish to incorporate parts of the Program into other free
295+programs whose distribution conditions are different, write to the author
296+to ask for permission. For software which is copyrighted by the Free
297+Software Foundation, write to the Free Software Foundation; we sometimes
298+make exceptions for this. Our decision will be guided by the two goals
299+of preserving the free status of all derivatives of our free software and
300+of promoting the sharing and reuse of software generally.
301+
302+ NO WARRANTY
303+
304+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
305+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
306+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
307+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
308+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
309+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
310+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
311+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
312+REPAIR OR CORRECTION.
313+
314+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
315+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
316+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
317+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
318+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
319+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
320+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
321+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
322+POSSIBILITY OF SUCH DAMAGES.
323+
324+ END OF TERMS AND CONDITIONS
325+
326
327+ How to Apply These Terms to Your New Programs
328+
329+ If you develop a new program, and you want it to be of the greatest
330+possible use to the public, the best way to achieve this is to make it
331+free software which everyone can redistribute and change under these terms.
332+
333+ To do so, attach the following notices to the program. It is safest
334+to attach them to the start of each source file to most effectively
335+convey the exclusion of warranty; and each file should have at least
336+the "copyright" line and a pointer to where the full notice is found.
337+
338+ <one line to give the program's name and a brief idea of what it does.>
339+ Copyright (C) <year> <name of author>
340+
341+ This program is free software; you can redistribute it and/or modify
342+ it under the terms of the GNU General Public License as published by
343+ the Free Software Foundation; either version 2 of the License, or
344+ (at your option) any later version.
345+
346+ This program is distributed in the hope that it will be useful,
347+ but WITHOUT ANY WARRANTY; without even the implied warranty of
348+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
349+ GNU General Public License for more details.
350+
351+ You should have received a copy of the GNU General Public License
352+ along with this program; if not, write to the Free Software
353+ Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
354+
355+
356+Also add information on how to contact you by electronic and paper mail.
357+
358+If the program is interactive, make it output a short notice like this
359+when it starts in an interactive mode:
360+
361+ Gnomovision version 69, Copyright (C) year name of author
362+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
363+ This is free software, and you are welcome to redistribute it
364+ under certain conditions; type `show c' for details.
365+
366+The hypothetical commands `show w' and `show c' should show the appropriate
367+parts of the General Public License. Of course, the commands you use may
368+be called something other than `show w' and `show c'; they could even be
369+mouse-clicks or menu items--whatever suits your program.
370+
371+You should also get your employer (if you work as a programmer) or your
372+school, if any, to sign a "copyright disclaimer" for the program, if
373+necessary. Here is a sample; alter the names:
374+
375+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
376+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
377+
378+ <signature of Ty Coon>, 1 April 1989
379+ Ty Coon, President of Vice
380+
381+This General Public License does not permit incorporating your program into
382+proprietary programs. If your program is a subroutine library, you may
383+consider it more useful to permit linking proprietary applications with the
384+library. If this is what you want to do, use the GNU Library General
385+Public License instead of this License.
386
387=== added directory 'plugins/EquationOfTime/resources'
388=== added file 'plugins/EquationOfTime/resources/EquationOfTime.qrc'
389--- plugins/EquationOfTime/resources/EquationOfTime.qrc 1970-01-01 00:00:00 +0000
390+++ plugins/EquationOfTime/resources/EquationOfTime.qrc 2014-02-07 18:17:25 +0000
391@@ -0,0 +1,6 @@
392+<RCC>
393+ <qresource prefix="/EquationOfTime" >
394+ <file>bt_EquationOfTime_On.png</file>
395+ <file>bt_EquationOfTime_Off.png</file>
396+ </qresource>
397+</RCC>
398
399=== added file 'plugins/EquationOfTime/resources/bt_EquationOfTime_Off.png'
400Binary files plugins/EquationOfTime/resources/bt_EquationOfTime_Off.png 1970-01-01 00:00:00 +0000 and plugins/EquationOfTime/resources/bt_EquationOfTime_Off.png 2014-02-07 18:17:25 +0000 differ
401=== added file 'plugins/EquationOfTime/resources/bt_EquationOfTime_On.png'
402Binary files plugins/EquationOfTime/resources/bt_EquationOfTime_On.png 1970-01-01 00:00:00 +0000 and plugins/EquationOfTime/resources/bt_EquationOfTime_On.png 2014-02-07 18:17:25 +0000 differ
403=== added directory 'plugins/EquationOfTime/src'
404=== added file 'plugins/EquationOfTime/src/CMakeLists.txt'
405--- plugins/EquationOfTime/src/CMakeLists.txt 1970-01-01 00:00:00 +0000
406+++ plugins/EquationOfTime/src/CMakeLists.txt 2014-02-07 18:17:25 +0000
407@@ -0,0 +1,33 @@
408+INCLUDE_DIRECTORIES(
409+ ${CMAKE_BINARY_DIR}
410+ ${CMAKE_BINARY_DIR}/plugins/EquationOfTime/src
411+ ${CMAKE_BINARY_DIR}/plugins/EquationOfTime/src/gui
412+ . gui)
413+
414+LINK_DIRECTORIES(${BUILD_DIR}/src)
415+
416+SET(EQUATIONOFTIME_SRCS
417+ EquationOfTime.hpp
418+ EquationOfTime.cpp
419+ gui/EquationOfTimeWindow.hpp
420+ gui/EquationOfTimeWindow.cpp
421+ )
422+
423+SET(EQUATIONOFTIME_UIS
424+ gui/equationOfTimeWindow.ui
425+)
426+
427+QT5_WRAP_UI(EQUATIONOFTIME_UIS_H ${EQUATIONOFTIME_UIS})
428+
429+################# compiles resources files ############
430+SET(EQUATIONOFTIME_RES ../resources/EquationOfTime.qrc)
431+QT5_ADD_RESOURCES(EQUATIONOFTIME_RES_CXX ${EQUATIONOFTIME_RES})
432+
433+SET(extLinkerOption ${OPENGL_LIBRARIES})
434+
435+ADD_LIBRARY(EquationOfTime-static STATIC ${EQUATIONOFTIME_SRCS} ${EQUATIONOFTIME_RES_CXX} ${EQUATIONOFTIME_UIS_H})
436+QT5_USE_MODULES(EquationOfTime-static Core Declarative Network)
437+SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES OUTPUT_NAME "EquationOfTime")
438+TARGET_LINK_LIBRARIES(EquationOfTime-static ${extLinkerOption})
439+SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
440+ADD_DEPENDENCIES(AllStaticPlugins EquationOfTime-static)
441
442=== added file 'plugins/EquationOfTime/src/EquationOfTime.cpp'
443--- plugins/EquationOfTime/src/EquationOfTime.cpp 1970-01-01 00:00:00 +0000
444+++ plugins/EquationOfTime/src/EquationOfTime.cpp 2014-02-07 18:17:25 +0000
445@@ -0,0 +1,275 @@
446+/*
447+ * Equation Of Time plug-in for Stellarium
448+ *
449+ * Copyright (C) 2014 Alexander Wolf
450+ *
451+ * This program is free software; you can redistribute it and/or
452+ * modify it under the terms of the GNU General Public License
453+ * as published by the Free Software Foundation; either version 2
454+ * of the License, or (at your option) any later version.
455+ *
456+ * This program is distributed in the hope that it will be useful,
457+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
458+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
459+ * GNU General Public License for more details.
460+ *
461+ * You should have received a copy of the GNU General Public License
462+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
463+ */
464+
465+#include "StelProjector.hpp"
466+#include "StelPainter.hpp"
467+#include "StelApp.hpp"
468+#include "StelCore.hpp"
469+#include "SkyGui.hpp"
470+#include "StelLocaleMgr.hpp"
471+#include "StelModuleMgr.hpp"
472+#include "StelFileMgr.hpp"
473+#include "StelGui.hpp"
474+#include "StelGuiItems.hpp"
475+#include "StelObjectMgr.hpp"
476+#include "StelUtils.hpp"
477+#include "Planet.hpp"
478+#include "EquationOfTime.hpp"
479+#include "EquationOfTimeWindow.hpp"
480+
481+#include "sidereal_time.h"
482+
483+#include <QFontMetrics>
484+#include <QSettings>
485+#include <QPixmap>
486+#include <cmath>
487+
488+StelModule* EquationOfTimeStelPluginInterface::getStelModule() const
489+{
490+ return new EquationOfTime();
491+}
492+
493+StelPluginInfo EquationOfTimeStelPluginInterface::getPluginInfo() const
494+{
495+ // Allow to load the resources when used as a static plugin
496+ Q_INIT_RESOURCE(EquationOfTime);
497+
498+ StelPluginInfo info;
499+ info.id = "EquationOfTime";
500+ info.displayedName = N_("Equation of Time");
501+ info.authors = "Alexander Wolf";
502+ info.contact = "http://stellarium.org";
503+ info.description = N_("This plugin shows the solution of the equation of time.");
504+ info.version = EQUATIONOFTIME_PLUGIN_VERSION;
505+ return info;
506+}
507+
508+EquationOfTime::EquationOfTime()
509+ : flagShowSolutionEquationOfTime(false),
510+ flagUseMsFormat(false),
511+ toolbarButton(NULL)
512+{
513+ setObjectName("EquationOfTime");
514+ mainWindow = new EquationOfTimeWindow();
515+}
516+
517+EquationOfTime::~EquationOfTime()
518+{
519+ delete mainWindow;
520+}
521+
522+void EquationOfTime::init()
523+{
524+ StelApp &app = StelApp::getInstance();
525+ conf = app.getSettings();
526+ gui = dynamic_cast<StelGui*>(app.getGui());
527+
528+ if (!conf->childGroups().contains("EquationOfTime"))
529+ {
530+ qDebug() << "EquationOfTime::init() no EquationOfTime section exists in main config file - creating with defaults";
531+ restoreDefaultConfigIni();
532+ }
533+
534+ // populate settings from main config file.
535+ readSettingsFromConfig();
536+
537+ addAction("actionShow_EquationOfTime", N_("Equation of Time"), N_("Show solution for Equation of Time"), "enabled", "");
538+
539+ enableEquationOfTime(getFlagEnableAtStartup());
540+ setFlagShowEOTButton(flagShowEOTButton);
541+
542+ // Initialize the message strings and make sure they are translated when
543+ // the language changes.
544+ updateMessageText();
545+ connect(&app, SIGNAL(languageChanged()), this, SLOT(updateMessageText()));
546+}
547+
548+void EquationOfTime::deinit()
549+{
550+ //
551+}
552+
553+void EquationOfTime::draw(StelCore *core)
554+{
555+ if (!isEnabled())
556+ return;
557+
558+ StelPainter sPainter(core->getProjection2d());
559+ sPainter.setColor(textColor[0], textColor[1], textColor[2], 1.f);
560+ font.setPixelSize(getFontSize());
561+ sPainter.setFont(font);
562+
563+ QString timeText;
564+ double time = getSolutionEquationOfTime(core->getJDay());
565+
566+ if (getFlagInvertedValue())
567+ time *= -1;
568+
569+ if (getFlagMsFormat())
570+ {
571+ double seconds = std::abs(round((time - (int)time)*60));
572+ QString messageSecondsValue;
573+ if (seconds<10.)
574+ messageSecondsValue = QString("0%1").arg(QString::number(seconds, 'f', 0));
575+ else
576+ messageSecondsValue = QString("%1").arg(QString::number(seconds, 'f', 0));
577+
578+ timeText = QString("%1: %2%3%4%5").arg(messageEquation, QString::number((int)time), messageEquationMinutes, messageSecondsValue, messageEquationSeconds);
579+ }
580+ else
581+ timeText = QString("%1: %2%3").arg(messageEquation, QString::number(time, 'f', 2), messageEquationMinutes);
582+
583+
584+ QFontMetrics fm(font);
585+ QSize fs = fm.size(Qt::TextSingleLine, timeText);
586+ if (core->getCurrentPlanet().data()->getEnglishName()=="Earth")
587+ sPainter.drawText(gui->getSkyGui()->getSkyGuiWidth()/2 - fs.width()/2, gui->getSkyGui()->getSkyGuiHeight() - fs.height()*1.5, timeText);
588+
589+ //qDebug() << timeText;
590+}
591+
592+void EquationOfTime::enableEquationOfTime(bool b)
593+{
594+ flagShowSolutionEquationOfTime = b;
595+}
596+
597+double EquationOfTime::getCallOrder(StelModuleActionName actionName) const
598+{
599+ if (actionName==StelModule::ActionDraw)
600+ return StelApp::getInstance().getModuleMgr().getModule("ConstellationMgr")->getCallOrder(actionName)+10.;
601+ return 0;
602+}
603+
604+bool EquationOfTime::configureGui(bool show)
605+{
606+ if (show)
607+ {
608+ mainWindow->setVisible(true);
609+ }
610+
611+ return true;
612+}
613+
614+void EquationOfTime::restoreDefaults(void)
615+{
616+ restoreDefaultConfigIni();
617+ readSettingsFromConfig();
618+}
619+
620+void EquationOfTime::restoreDefaultConfigIni(void)
621+{
622+ conf->beginGroup("EquationOfTime");
623+
624+ // delete all existing Equation Of Time settings...
625+ conf->remove("");
626+
627+ conf->setValue("enable_at_startup", false);
628+ conf->setValue("flag_use_ms_format", true);
629+ conf->setValue("flag_use_inverted_value", false);
630+ conf->setValue("flag_show_button", true);
631+ conf->setValue("text_color", "0,0.5,1");
632+ conf->setValue("font_size", 20);
633+
634+ conf->endGroup();
635+}
636+
637+void EquationOfTime::readSettingsFromConfig(void)
638+{
639+ conf->beginGroup("EquationOfTime");
640+
641+ setFlagEnableAtStartup(conf->value("enable_at_startup", false).toBool());
642+ setFlagMsFormat(conf->value("flag_use_ms_format", true).toBool());
643+ setFlagInvertedValue(conf->value("flag_use_inverted_value", false).toBool());
644+ textColor = StelUtils::strToVec3f(conf->value("text_color", "0,0.5,1").toString());
645+ setFontSize(conf->value("font_size", 20).toInt());
646+ flagShowEOTButton = conf->value("flag_show_button", true).toBool();
647+
648+ conf->endGroup();
649+}
650+
651+void EquationOfTime::saveSettingsToConfig(void)
652+{
653+ conf->beginGroup("EquationOfTime");
654+
655+ conf->setValue("enable_at_startup", getFlagEnableAtStartup());
656+ conf->setValue("flag_use_ms_format", getFlagMsFormat());
657+ conf->setValue("flag_use_inverted_value", getFlagInvertedValue());
658+ conf->setValue("flag_show_button", getFlagShowEOTButton());
659+ //conf->setValue("text_color", "0,0.5,1");
660+ conf->setValue("font_size", getFontSize());
661+
662+ conf->endGroup();
663+}
664+
665+double EquationOfTime::getSolutionEquationOfTime(const double JDay) const
666+{
667+ StelCore* core = StelApp::getInstance().getCore();
668+
669+ double tau = (JDay - 2451545.0)/365250.0;
670+ double sunMeanLongitude = 280.4664567 + tau*(360007.6892779 + tau*(0.03032028 + tau*(1/49931 - tau*(1/15300 - tau/2000000))));
671+
672+ int count = std::abs(sunMeanLongitude/360.);
673+ if (count==0) count = 1;
674+
675+ if (sunMeanLongitude>360.)
676+ sunMeanLongitude -= count*360.;
677+
678+ if (sunMeanLongitude<0.)
679+ sunMeanLongitude += (1+count)*360.;
680+
681+ Vec3d pos = GETSTELMODULE(StelObjectMgr)->searchByName("Sun")->getEquinoxEquatorialPos(core);
682+ double ra, dec;
683+ StelUtils::rectToSphe(&ra, &dec, pos);
684+ if (ra < 0.0)
685+ ra += 2.0*M_PI;
686+
687+ double alpha = ra*180./M_PI;
688+ if (alpha>360.)
689+ alpha -= count*360.;
690+
691+ return 4*(sunMeanLongitude - 0.0057183 - alpha + get_nutation_longitude(JDay)*cos(get_mean_ecliptical_obliquity(JDay)));
692+}
693+
694+void EquationOfTime::updateMessageText()
695+{
696+ messageEquation = q_("Equation of Time");
697+ // TRANSLATORS: minutes.
698+ messageEquationMinutes = qc_("m", "time");
699+ // TRANSLATORS: seconds.
700+ messageEquationSeconds = qc_("s", "time");
701+}
702+
703+void EquationOfTime::setFlagShowEOTButton(bool b)
704+{
705+ if (b==true) {
706+ if (toolbarButton==NULL) {
707+ // Create the button
708+ toolbarButton = new StelButton(NULL,
709+ QPixmap(":/EquationOfTime/bt_EquationOfTime_On.png"),
710+ QPixmap(":/EquationOfTime/bt_EquationOfTime_Off.png"),
711+ QPixmap(":/graphicGui/glow32x32.png"),
712+ "actionShow_EquationOfTime");
713+ }
714+ gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
715+ } else {
716+ gui->getButtonBar()->hideButton("actionShow_EquationOfTime");
717+ }
718+ flagShowEOTButton = b;
719+}
720+
721
722=== added file 'plugins/EquationOfTime/src/EquationOfTime.hpp'
723--- plugins/EquationOfTime/src/EquationOfTime.hpp 1970-01-01 00:00:00 +0000
724+++ plugins/EquationOfTime/src/EquationOfTime.hpp 2014-02-07 18:17:25 +0000
725@@ -0,0 +1,134 @@
726+/*
727+ * Equation Of Time plug-in for Stellarium
728+ *
729+ * Copyright (C) 2014 Alexander Wolf
730+ *
731+ * This program is free software; you can redistribute it and/or
732+ * modify it under the terms of the GNU General Public License
733+ * as published by the Free Software Foundation; either version 2
734+ * of the License, or (at your option) any later version.
735+ *
736+ * This program is distributed in the hope that it will be useful,
737+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
738+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
739+ * GNU General Public License for more details.
740+ *
741+ * You should have received a copy of the GNU General Public License
742+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
743+ */
744+
745+#ifndef _EQUATIONOFTIME_HPP_
746+#define _EQUATIONOFTIME_HPP_
747+
748+#include "StelGui.hpp"
749+#include "StelModule.hpp"
750+
751+#include <QFont>
752+#include <QString>
753+
754+class QPixmap;
755+class StelButton;
756+class EquationOfTimeWindow;
757+
758+class EquationOfTime : public StelModule
759+{
760+ Q_OBJECT
761+ Q_PROPERTY(bool enabled
762+ READ isEnabled
763+ WRITE enableEquationOfTime)
764+
765+public:
766+ EquationOfTime();
767+ virtual ~EquationOfTime();
768+
769+ virtual void init();
770+ virtual void deinit();
771+ virtual void update(double) {;}
772+ virtual void draw(StelCore *core);
773+ virtual double getCallOrder(StelModuleActionName actionName) const;
774+ virtual bool configureGui(bool show);
775+
776+ //! Set up the plugin with default values. This means clearing out the Pulsars section in the
777+ //! main config.ini (if one already exists), and populating it with default values.
778+ void restoreDefaults(void);
779+
780+ //! Read (or re-read) settings from the main config file. This will be called from init and also
781+ //! when restoring defaults (i.e. from the configuration dialog / restore defaults button).
782+ void readSettingsFromConfig(void);
783+
784+ //! Save the settings to the main configuration file.
785+ void saveSettingsToConfig(void);
786+
787+ //! Get solution of equation of time
788+ //! Source: J. Meeus "Astronomical Algorithms" (2nd ed., with corrections as of August 10, 2009) p.183-187.
789+ //! @param JDay JD
790+ //! @return time in minutes
791+ double getSolutionEquationOfTime(const double JDay) const;
792+
793+ //! Is plugin enabled?
794+ bool isEnabled() const {return flagShowSolutionEquationOfTime;}
795+
796+ //! Get font size for messages
797+ int getFontSize(void) { return fontSize; }
798+ //! Get status of usage minutes and seconds for value of equation
799+ bool getFlagMsFormat(void) { return flagUseMsFormat; }
800+ //! Get status of usage inverted values for equation of time
801+ bool getFlagInvertedValue(void) { return flagUseInvertedValue; }
802+ bool getFlagEnableAtStartup(void) { return flagEnableAtStartup; }
803+ bool getFlagShowEOTButton(void) { return flagShowEOTButton; }
804+
805+public slots:
806+ //! Enable plugin usage
807+ void enableEquationOfTime(bool b);
808+ //! Enable usage inverted value for equation of time (switch sign of equation)
809+ void setFlagInvertedValue(bool b) { flagUseInvertedValue=b; }
810+ //! Enable usage minutes and seconds for value
811+ void setFlagMsFormat(bool b) { flagUseMsFormat=b; }
812+ //! Enable plugin usage at startup
813+ void setFlagEnableAtStartup(bool b) { flagEnableAtStartup=b; }
814+ //! Set font size for message
815+ void setFontSize(int size) { fontSize=size; }
816+ //! Display plugin button on toolbar
817+ void setFlagShowEOTButton(bool b);
818+
819+private slots:
820+ void updateMessageText();
821+
822+private:
823+ // if existing, delete EquationOfTime section in main config.ini, then create with default values
824+ void restoreDefaultConfigIni(void);
825+
826+ EquationOfTimeWindow* mainWindow;
827+ QSettings* conf;
828+ StelGui* gui;
829+
830+ QFont font;
831+ bool flagShowSolutionEquationOfTime;
832+ bool flagUseInvertedValue;
833+ bool flagUseMsFormat;
834+ bool flagEnableAtStartup;
835+ bool flagShowEOTButton;
836+ QString messageEquation;
837+ QString messageEquationMinutes;
838+ QString messageEquationSeconds;
839+ Vec3f textColor;
840+ int fontSize;
841+ StelButton* toolbarButton;
842+};
843+
844+
845+#include <QObject>
846+#include "StelPluginInterface.hpp"
847+
848+//! This class is used by Qt to manage a plug-in interface
849+class EquationOfTimeStelPluginInterface : public QObject, public StelPluginInterface
850+{
851+ Q_OBJECT
852+ Q_PLUGIN_METADATA(IID "stellarium.StelGuiPluginInterface/1.0")
853+ Q_INTERFACES(StelPluginInterface)
854+public:
855+ virtual StelModule* getStelModule() const;
856+ virtual StelPluginInfo getPluginInfo() const;
857+};
858+
859+#endif /* _EQUATIONOFTIME_HPP_ */
860
861=== added directory 'plugins/EquationOfTime/src/gui'
862=== added file 'plugins/EquationOfTime/src/gui/EquationOfTimeWindow.cpp'
863--- plugins/EquationOfTime/src/gui/EquationOfTimeWindow.cpp 1970-01-01 00:00:00 +0000
864+++ plugins/EquationOfTime/src/gui/EquationOfTimeWindow.cpp 2014-02-07 18:17:25 +0000
865@@ -0,0 +1,92 @@
866+/*
867+ * Equation of Time plug-in for Stellarium
868+ *
869+ * Copyright (C) 2014 Alexander Wolf
870+ *
871+ * This program is free software; you can redistribute it and/or
872+ * modify it under the terms of the GNU General Public License
873+ * as published by the Free Software Foundation; either version 2
874+ * of the License, or (at your option) any later version.
875+ *
876+ * This program is distributed in the hope that it will be useful,
877+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
878+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
879+ * GNU General Public License for more details.
880+ *
881+ * You should have received a copy of the GNU General Public License
882+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
883+ */
884+
885+#include "EquationOfTime.hpp"
886+#include "EquationOfTimeWindow.hpp"
887+#include "ui_equationOfTimeWindow.h"
888+
889+#include "StelApp.hpp"
890+#include "StelLocaleMgr.hpp"
891+#include "StelModule.hpp"
892+#include "StelModuleMgr.hpp"
893+
894+EquationOfTimeWindow::EquationOfTimeWindow()
895+{
896+ ui = new Ui_equationOfTimeWindowForm();
897+}
898+
899+EquationOfTimeWindow::~EquationOfTimeWindow()
900+{
901+ delete ui;
902+}
903+
904+void EquationOfTimeWindow::retranslate()
905+{
906+ if (dialog)
907+ {
908+ ui->retranslateUi(dialog);
909+ updateAboutText();
910+ }
911+}
912+
913+void EquationOfTimeWindow::createDialogContent()
914+{
915+ eq = GETSTELMODULE(EquationOfTime);
916+ ui->setupUi(dialog);
917+
918+ connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
919+ connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
920+
921+ ui->checkBoxEnableAtStartup->setChecked(eq->getFlagEnableAtStartup());
922+ connect(ui->checkBoxEnableAtStartup, SIGNAL(clicked(bool)), eq, SLOT(setFlagEnableAtStartup(bool)));
923+
924+ ui->checkBoxInvertedValue->setChecked(eq->getFlagInvertedValue());
925+ connect(ui->checkBoxInvertedValue, SIGNAL(clicked(bool)), eq, SLOT(setFlagInvertedValue(bool)));
926+
927+ ui->checkBoxMsFormat->setChecked(eq->getFlagMsFormat());
928+ connect(ui->checkBoxMsFormat, SIGNAL(clicked(bool)), eq, SLOT(setFlagMsFormat(bool)));
929+
930+ ui->spinBoxFontSize->setValue(eq->getFontSize());
931+ connect(ui->spinBoxFontSize, SIGNAL(valueChanged(int)), eq, SLOT(setFontSize(int)));
932+
933+ ui->checkBoxShowButton->setChecked(eq->getFlagShowEOTButton());
934+ connect(ui->checkBoxShowButton, SIGNAL(clicked(bool)), eq, SLOT(setFlagShowEOTButton(bool)));
935+
936+ connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(saveEquationOfTimeSettings()));
937+ connect(ui->pushButtonReset, SIGNAL(clicked()), this, SLOT(resetEquationOfTimeSettings()));
938+
939+ updateAboutText();
940+}
941+
942+void EquationOfTimeWindow::updateAboutText()
943+{
944+ ui->labelTitle->setText(q_("Equation of Time plug-in"));
945+ QString version = QString(q_("Version %1")).arg(EQUATIONOFTIME_PLUGIN_VERSION);
946+ ui->labelVersion->setText(version);
947+}
948+
949+void EquationOfTimeWindow::saveEquationOfTimeSettings()
950+{
951+ eq->saveSettingsToConfig();
952+}
953+
954+void EquationOfTimeWindow::resetEquationOfTimeSettings()
955+{
956+ eq->restoreDefaults();
957+}
958
959=== added file 'plugins/EquationOfTime/src/gui/EquationOfTimeWindow.hpp'
960--- plugins/EquationOfTime/src/gui/EquationOfTimeWindow.hpp 1970-01-01 00:00:00 +0000
961+++ plugins/EquationOfTime/src/gui/EquationOfTimeWindow.hpp 2014-02-07 18:17:25 +0000
962@@ -0,0 +1,60 @@
963+/*
964+ * Equation of Time plug-in for Stellarium
965+ *
966+ * Copyright (C) 2014 Alexander Wolf
967+ *
968+ * This program is free software; you can redistribute it and/or
969+ * modify it under the terms of the GNU General Public License
970+ * as published by the Free Software Foundation; either version 2
971+ * of the License, or (at your option) any later version.
972+ *
973+ * This program is distributed in the hope that it will be useful,
974+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
975+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
976+ * GNU General Public License for more details.
977+ *
978+ * You should have received a copy of the GNU General Public License
979+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
980+ */
981+
982+#ifndef _EQUATION_OF_TIME_WINDOW_HPP_
983+#define _EQUATION_OF_TIME_WINDOW_HPP_
984+
985+#include "StelDialog.hpp"
986+
987+#include <QString>
988+#include <QDoubleSpinBox>
989+
990+class Ui_equationOfTimeWindowForm;
991+class EquationOfTime;
992+
993+//! Main window of the Equation of Time plug-in.
994+class EquationOfTimeWindow : public StelDialog
995+{
996+ Q_OBJECT
997+
998+public:
999+ EquationOfTimeWindow();
1000+ ~EquationOfTimeWindow();
1001+
1002+public slots:
1003+ void retranslate();
1004+
1005+protected:
1006+ void createDialogContent();
1007+
1008+private:
1009+ Ui_equationOfTimeWindowForm* ui;
1010+ EquationOfTime* eq;
1011+
1012+ void updateAboutText();
1013+
1014+private slots:
1015+ void saveEquationOfTimeSettings();
1016+ void resetEquationOfTimeSettings();
1017+
1018+
1019+};
1020+
1021+
1022+#endif /* _EQUATION_OF_TIME_WINDOW_HPP_ */
1023
1024=== added file 'plugins/EquationOfTime/src/gui/equationOfTimeWindow.ui'
1025--- plugins/EquationOfTime/src/gui/equationOfTimeWindow.ui 1970-01-01 00:00:00 +0000
1026+++ plugins/EquationOfTime/src/gui/equationOfTimeWindow.ui 2014-02-07 18:17:25 +0000
1027@@ -0,0 +1,357 @@
1028+<?xml version="1.0" encoding="UTF-8"?>
1029+<ui version="4.0">
1030+ <class>equationOfTimeWindowForm</class>
1031+ <widget class="QWidget" name="equationOfTimeWindowForm">
1032+ <property name="geometry">
1033+ <rect>
1034+ <x>0</x>
1035+ <y>0</y>
1036+ <width>486</width>
1037+ <height>461</height>
1038+ </rect>
1039+ </property>
1040+ <layout class="QVBoxLayout" name="verticalLayout">
1041+ <property name="spacing">
1042+ <number>0</number>
1043+ </property>
1044+ <property name="leftMargin">
1045+ <number>0</number>
1046+ </property>
1047+ <property name="topMargin">
1048+ <number>0</number>
1049+ </property>
1050+ <property name="rightMargin">
1051+ <number>0</number>
1052+ </property>
1053+ <property name="bottomMargin">
1054+ <number>0</number>
1055+ </property>
1056+ <item>
1057+ <widget class="BarFrame" name="TitleBar">
1058+ <property name="sizePolicy">
1059+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
1060+ <horstretch>0</horstretch>
1061+ <verstretch>0</verstretch>
1062+ </sizepolicy>
1063+ </property>
1064+ <property name="minimumSize">
1065+ <size>
1066+ <width>0</width>
1067+ <height>25</height>
1068+ </size>
1069+ </property>
1070+ <property name="maximumSize">
1071+ <size>
1072+ <width>16777215</width>
1073+ <height>30</height>
1074+ </size>
1075+ </property>
1076+ <property name="focusPolicy">
1077+ <enum>Qt::NoFocus</enum>
1078+ </property>
1079+ <property name="autoFillBackground">
1080+ <bool>false</bool>
1081+ </property>
1082+ <property name="frameShape">
1083+ <enum>QFrame::StyledPanel</enum>
1084+ </property>
1085+ <layout class="QHBoxLayout">
1086+ <property name="spacing">
1087+ <number>6</number>
1088+ </property>
1089+ <property name="leftMargin">
1090+ <number>0</number>
1091+ </property>
1092+ <property name="topMargin">
1093+ <number>0</number>
1094+ </property>
1095+ <property name="rightMargin">
1096+ <number>4</number>
1097+ </property>
1098+ <property name="bottomMargin">
1099+ <number>0</number>
1100+ </property>
1101+ <item>
1102+ <spacer name="leftSpacer">
1103+ <property name="orientation">
1104+ <enum>Qt::Horizontal</enum>
1105+ </property>
1106+ <property name="sizeHint" stdset="0">
1107+ <size>
1108+ <width>40</width>
1109+ <height>20</height>
1110+ </size>
1111+ </property>
1112+ </spacer>
1113+ </item>
1114+ <item>
1115+ <widget class="QLabel" name="stelWindowTitle">
1116+ <property name="text">
1117+ <string>Equation of Time</string>
1118+ </property>
1119+ </widget>
1120+ </item>
1121+ <item>
1122+ <spacer name="rightSpacer">
1123+ <property name="orientation">
1124+ <enum>Qt::Horizontal</enum>
1125+ </property>
1126+ <property name="sizeHint" stdset="0">
1127+ <size>
1128+ <width>40</width>
1129+ <height>20</height>
1130+ </size>
1131+ </property>
1132+ </spacer>
1133+ </item>
1134+ <item>
1135+ <widget class="QPushButton" name="closeStelWindow">
1136+ <property name="minimumSize">
1137+ <size>
1138+ <width>16</width>
1139+ <height>16</height>
1140+ </size>
1141+ </property>
1142+ <property name="maximumSize">
1143+ <size>
1144+ <width>16</width>
1145+ <height>16</height>
1146+ </size>
1147+ </property>
1148+ <property name="focusPolicy">
1149+ <enum>Qt::NoFocus</enum>
1150+ </property>
1151+ <property name="text">
1152+ <string/>
1153+ </property>
1154+ </widget>
1155+ </item>
1156+ </layout>
1157+ </widget>
1158+ </item>
1159+ <item>
1160+ <widget class="QTabWidget" name="tabWidget">
1161+ <property name="currentIndex">
1162+ <number>0</number>
1163+ </property>
1164+ <widget class="QWidget" name="tabEquationOfTime">
1165+ <attribute name="title">
1166+ <string>Equation of Time</string>
1167+ </attribute>
1168+ <layout class="QVBoxLayout" name="verticalLayoutTimeZone">
1169+ <property name="spacing">
1170+ <number>0</number>
1171+ </property>
1172+ <property name="leftMargin">
1173+ <number>0</number>
1174+ </property>
1175+ <property name="topMargin">
1176+ <number>0</number>
1177+ </property>
1178+ <property name="rightMargin">
1179+ <number>0</number>
1180+ </property>
1181+ <property name="bottomMargin">
1182+ <number>0</number>
1183+ </property>
1184+ <item>
1185+ <widget class="QGroupBox" name="groupBoxEOT">
1186+ <property name="minimumSize">
1187+ <size>
1188+ <width>0</width>
1189+ <height>400</height>
1190+ </size>
1191+ </property>
1192+ <property name="title">
1193+ <string>Equation of Time</string>
1194+ </property>
1195+ <property name="alignment">
1196+ <set>Qt::AlignCenter</set>
1197+ </property>
1198+ <layout class="QGridLayout" name="gridLayoutCurrent">
1199+ <property name="leftMargin">
1200+ <number>0</number>
1201+ </property>
1202+ <property name="topMargin">
1203+ <number>0</number>
1204+ </property>
1205+ <property name="rightMargin">
1206+ <number>0</number>
1207+ </property>
1208+ <property name="bottomMargin">
1209+ <number>0</number>
1210+ </property>
1211+ <property name="verticalSpacing">
1212+ <number>8</number>
1213+ </property>
1214+ <item row="8" column="0" colspan="4">
1215+ <spacer name="verticalSpacerTimeZone">
1216+ <property name="orientation">
1217+ <enum>Qt::Vertical</enum>
1218+ </property>
1219+ <property name="sizeHint" stdset="0">
1220+ <size>
1221+ <width>0</width>
1222+ <height>0</height>
1223+ </size>
1224+ </property>
1225+ </spacer>
1226+ </item>
1227+ <item row="2" column="0" colspan="2">
1228+ <widget class="QCheckBox" name="checkBoxEnableAtStartup">
1229+ <property name="text">
1230+ <string>Enable display at startup</string>
1231+ </property>
1232+ </widget>
1233+ </item>
1234+ <item row="0" column="0" rowspan="2" colspan="4">
1235+ <widget class="QLabel" name="labelEOTDescription">
1236+ <property name="text">
1237+ <string>The equation of time describes the discrepancy between two kinds of solar time. These are apparent solar time, which directly tracks the motion of the sun, and mean solar time, which tracks a fictitious &quot;mean&quot; sun with noons 24 hours apart. There is no universally accepted definition of the sign of the equation of time. Some publications show it as positive when a sundial is ahead of a clock; others when the clock is ahead of the sundial. In the English-speaking world, the former usage is the more common, but is not always followed. Anyone who makes use of a published table or graph should first check its sign usage.</string>
1238+ </property>
1239+ <property name="wordWrap">
1240+ <bool>true</bool>
1241+ </property>
1242+ </widget>
1243+ </item>
1244+ <item row="7" column="2" colspan="2">
1245+ <widget class="QPushButton" name="pushButtonReset">
1246+ <property name="text">
1247+ <string>Restore defaults</string>
1248+ </property>
1249+ </widget>
1250+ </item>
1251+ <item row="2" column="2">
1252+ <widget class="QLabel" name="labelFontSize">
1253+ <property name="text">
1254+ <string>Font size:</string>
1255+ </property>
1256+ </widget>
1257+ </item>
1258+ <item row="2" column="3">
1259+ <widget class="QSpinBox" name="spinBoxFontSize">
1260+ <property name="minimum">
1261+ <number>1</number>
1262+ </property>
1263+ <property name="maximum">
1264+ <number>50</number>
1265+ </property>
1266+ <property name="value">
1267+ <number>20</number>
1268+ </property>
1269+ </widget>
1270+ </item>
1271+ <item row="3" column="0" colspan="2">
1272+ <widget class="QCheckBox" name="checkBoxShowButton">
1273+ <property name="text">
1274+ <string>Show plug-ins button on toolbar</string>
1275+ </property>
1276+ </widget>
1277+ </item>
1278+ <item row="7" column="0" colspan="2">
1279+ <widget class="QPushButton" name="pushButtonSave">
1280+ <property name="text">
1281+ <string>Save settings</string>
1282+ </property>
1283+ </widget>
1284+ </item>
1285+ <item row="4" column="0" colspan="2">
1286+ <widget class="QCheckBox" name="checkBoxMsFormat">
1287+ <property name="text">
1288+ <string>Use minutes and seconds</string>
1289+ </property>
1290+ </widget>
1291+ </item>
1292+ <item row="3" column="2" colspan="2">
1293+ <widget class="QCheckBox" name="checkBoxInvertedValue">
1294+ <property name="text">
1295+ <string>Use inverted value for EOT</string>
1296+ </property>
1297+ </widget>
1298+ </item>
1299+ </layout>
1300+ </widget>
1301+ </item>
1302+ </layout>
1303+ </widget>
1304+ <widget class="QWidget" name="tabAbout">
1305+ <attribute name="title">
1306+ <string comment="tab in plugin windows">About</string>
1307+ </attribute>
1308+ <layout class="QVBoxLayout" name="verticalLayout_3">
1309+ <item>
1310+ <widget class="QLabel" name="labelTitle">
1311+ <property name="styleSheet">
1312+ <string notr="true">QLabel {
1313+ font: bold 18pt ;
1314+}</string>
1315+ </property>
1316+ <property name="text">
1317+ <string notr="true">Equation of Time plug-in</string>
1318+ </property>
1319+ </widget>
1320+ </item>
1321+ <item>
1322+ <widget class="QLabel" name="labelVersion">
1323+ <property name="text">
1324+ <string notr="true">Version %1</string>
1325+ </property>
1326+ </widget>
1327+ </item>
1328+ <item>
1329+ <widget class="QLabel" name="labelCopyright">
1330+ <property name="text">
1331+ <string notr="true">Copyright &amp;copy; 2014 Alexander Wolf</string>
1332+ </property>
1333+ <property name="textFormat">
1334+ <enum>Qt::RichText</enum>
1335+ </property>
1336+ </widget>
1337+ </item>
1338+ <item>
1339+ <widget class="QLabel" name="labelLicense">
1340+ <property name="sizePolicy">
1341+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
1342+ <horstretch>0</horstretch>
1343+ <verstretch>0</verstretch>
1344+ </sizepolicy>
1345+ </property>
1346+ <property name="text">
1347+ <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.
1348+
1349+This 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.
1350+
1351+You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.</string>
1352+ </property>
1353+ <property name="alignment">
1354+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
1355+ </property>
1356+ <property name="wordWrap">
1357+ <bool>true</bool>
1358+ </property>
1359+ <property name="textInteractionFlags">
1360+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
1361+ </property>
1362+ </widget>
1363+ </item>
1364+ </layout>
1365+ </widget>
1366+ </widget>
1367+ </item>
1368+ </layout>
1369+ </widget>
1370+ <customwidgets>
1371+ <customwidget>
1372+ <class>BarFrame</class>
1373+ <extends>QFrame</extends>
1374+ <header>Dialog.hpp</header>
1375+ <container>1</container>
1376+ </customwidget>
1377+ </customwidgets>
1378+ <tabstops>
1379+ <tabstop>tabWidget</tabstop>
1380+ <tabstop>pushButtonSave</tabstop>
1381+ </tabstops>
1382+ <resources/>
1383+ <connections/>
1384+</ui>
1385
1386=== modified file 'po/stellarium/POTFILES.in'
1387--- po/stellarium/POTFILES.in 2014-01-19 14:24:06 +0000
1388+++ po/stellarium/POTFILES.in 2014-02-07 18:17:25 +0000
1389@@ -112,3 +112,6 @@
1390 plugins/FOV/src/gui/FOVWindow.cpp
1391 plugins/FOV/src/ui_fovWindow.h
1392 plugins/NavStars/src/NavStars.cpp
1393+plugins/EquationOfTime/src/EquationOfTime.cpp
1394+plugins/EquationOfTime/src/gui/EquationOfTimeWindow.cpp
1395+plugins/EquationOfTime/src/ui_equationOfTimeWindow.h
1396\ No newline at end of file
1397
1398=== modified file 'src/core/StelApp.cpp'
1399--- src/core/StelApp.cpp 2014-02-05 14:47:03 +0000
1400+++ src/core/StelApp.cpp 2014-02-07 18:17:25 +0000
1401@@ -151,6 +151,10 @@
1402 Q_IMPORT_PLUGIN(ExoplanetsStelPluginInterface)
1403 #endif
1404
1405+#ifdef USE_STATIC_PLUGIN_EQUATIONOFTIME
1406+Q_IMPORT_PLUGIN(EquationOfTimeStelPluginInterface)
1407+#endif
1408+
1409 #ifdef USE_STATIC_PLUGIN_FOV
1410 Q_IMPORT_PLUGIN(FOVStelPluginInterface)
1411 #endif
1412
1413=== modified file 'src/core/planetsephems/sidereal_time.c'
1414--- src/core/planetsephems/sidereal_time.c 2013-12-27 09:25:21 +0000
1415+++ src/core/planetsephems/sidereal_time.c 2014-02-07 18:17:25 +0000
1416@@ -332,18 +332,18 @@
1417 * Formula 11.1, 11.4 pg 83 */
1418 double get_mean_sidereal_time (double JD)
1419 {
1420- double sidereal;
1421- double T;
1422+ double sidereal;
1423+ double T;
1424
1425- T = (JD - 2451545.0) / 36525.0;
1426+ T = (JD - 2451545.0) / 36525.0;
1427
1428- /* calc mean angle */
1429- sidereal = 280.46061837 + (360.98564736629 * (JD - 2451545.0)) + (0.000387933 * T * T) - (T * T * T / 38710000.0);
1430+ /* calc mean angle */
1431+ sidereal = 280.46061837 + (360.98564736629 * (JD - 2451545.0)) + (0.000387933 * T * T) - (T * T * T / 38710000.0);
1432
1433- /* add a convenient multiple of 360 degrees */
1434- sidereal = range_degrees (sidereal);
1435+ /* add a convenient multiple of 360 degrees */
1436+ sidereal = range_degrees (sidereal);
1437
1438- return sidereal;
1439+ return sidereal;
1440 }
1441
1442
1443@@ -352,27 +352,34 @@
1444 * Formula 11.1, 11.4 pg 83 */
1445 double get_apparent_sidereal_time (double JD)
1446 {
1447- double correction, sidereal;
1448- struct ln_nutation nutation;
1449+ double correction, sidereal;
1450+ struct ln_nutation nutation;
1451
1452- /* get the mean sidereal time */
1453- sidereal = get_mean_sidereal_time (JD);
1454+ /* get the mean sidereal time */
1455+ sidereal = get_mean_sidereal_time (JD);
1456
1457- /* add corrections for nutation in longitude and for the true obliquity of
1458- the ecliptic */
1459- get_nutation (JD, &nutation);
1460+ /* add corrections for nutation in longitude and for the true obliquity of
1461+ the ecliptic */
1462+ get_nutation (JD, &nutation);
1463
1464- /* GZ: This was the only place where this was used. I added the summation here. */
1465- correction = (nutation.longitude * cos ((nutation.ecliptic+nutation.obliquity)*M_PI/180.));
1466+ /* GZ: This was the only place where this was used. I added the summation here. */
1467+ correction = (nutation.longitude * cos ((nutation.ecliptic+nutation.obliquity)*M_PI/180.));
1468
1469- sidereal += correction;
1470+ sidereal += correction;
1471
1472- return (sidereal);
1473+ return (sidereal);
1474 }
1475
1476 double get_mean_ecliptical_obliquity(double JDE)
1477 {
1478- struct ln_nutation nutation;
1479- get_nutation(JDE, &nutation);
1480- return nutation.ecliptic;
1481+ struct ln_nutation nutation;
1482+ get_nutation(JDE, &nutation);
1483+ return nutation.ecliptic;
1484+}
1485+
1486+double get_nutation_longitude(double JDE)
1487+{
1488+ struct ln_nutation nutation;
1489+ get_nutation(JDE, &nutation);
1490+ return nutation.longitude;
1491 }
1492
1493=== modified file 'src/core/planetsephems/sidereal_time.h'
1494--- src/core/planetsephems/sidereal_time.h 2014-01-23 11:11:41 +0000
1495+++ src/core/planetsephems/sidereal_time.h 2014-02-07 18:17:25 +0000
1496@@ -32,6 +32,8 @@
1497 double get_apparent_sidereal_time (double JD);
1498 /* Calculate mean ecliptical obliquity in degrees. */
1499 double get_mean_ecliptical_obliquity(double JDE);
1500+/* Calculate nutation in longitude in degrees. */
1501+double get_nutation_longitude(double JDE);
1502
1503 #ifdef __cplusplus
1504 }
1505
1506=== modified file 'src/gui/SkyGui.cpp'
1507--- src/gui/SkyGui.cpp 2014-01-20 14:56:57 +0000
1508+++ src/gui/SkyGui.cpp 2014-02-07 18:17:25 +0000
1509@@ -234,11 +234,21 @@
1510 }
1511 }
1512
1513+int SkyGui::getSkyGuiWidth() const
1514+{
1515+ return geometry().width();
1516+}
1517+
1518+int SkyGui::getSkyGuiHeight() const
1519+{
1520+ return geometry().height();
1521+}
1522+
1523 //! Update the position of the button bars in the main window
1524 void SkyGui::updateBarsPos()
1525 {
1526- const int ww = geometry().width();
1527- const int hh = geometry().height();
1528+ const int ww = getSkyGuiWidth();
1529+ const int hh = getSkyGuiHeight();
1530 bool updatePath = false;
1531
1532 // Use a position cache to avoid useless redraw triggered by the position set if the bars don't move
1533
1534=== modified file 'src/gui/SkyGui.hpp'
1535--- src/gui/SkyGui.hpp 2013-09-29 17:05:33 +0000
1536+++ src/gui/SkyGui.hpp 2014-02-07 18:17:25 +0000
1537@@ -66,6 +66,9 @@
1538 void init(class StelGui* stelGui);
1539
1540 virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget* = 0);
1541+
1542+ int getSkyGuiWidth() const;
1543+ int getSkyGuiHeight() const;
1544
1545 protected:
1546 virtual void resizeEvent(QGraphicsSceneResizeEvent* event);