Merge lp:~alexwolf/stellarium/coordinates-plugin into lp:stellarium

Proposed by Alexander Wolf
Status: Superseded
Proposed branch: lp:~alexwolf/stellarium/coordinates-plugin
Merge into: lp:stellarium
Diff against target: 1490 lines (+1407/-0)
12 files modified
CMakeLists.txt (+1/-0)
plugins/PointerCoordinates/CMakeLists.txt (+18/-0)
plugins/PointerCoordinates/COPYING (+340/-0)
plugins/PointerCoordinates/resources/PointerCoordinates.qrc (+6/-0)
plugins/PointerCoordinates/src/CMakeLists.txt (+33/-0)
plugins/PointerCoordinates/src/PointerCoordinates.cpp (+250/-0)
plugins/PointerCoordinates/src/PointerCoordinates.hpp (+160/-0)
plugins/PointerCoordinates/src/gui/PointerCoordinatesWindow.cpp (+132/-0)
plugins/PointerCoordinates/src/gui/PointerCoordinatesWindow.hpp (+64/-0)
plugins/PointerCoordinates/src/gui/pointerCoordinatesWindow.ui (+396/-0)
po/stellarium/POTFILES.in (+3/-0)
src/core/StelApp.cpp (+4/-0)
To merge this branch: bzr merge lp:~alexwolf/stellarium/coordinates-plugin
Reviewer Review Type Date Requested Status
Bogdan Marinov Needs Fixing
Review via email: mp+213663@code.launchpad.net

This proposal has been superseded by a proposal from 2014-04-06.

Description of the change

I propose for merge of implementation for feature request "Coordinates of the mouse pointer" (Bug #1122643).

I made it as the Coordinates plugin, which can:
- show equatorial coordinates of the mouse pointer for epoch
 J2000.0;
- change size of font for string with coordinates;
- show coordinates on the screen at startup.

If users will want then we can extend this plugin via follows features:
- choosing frame for the coordinates;
- choosing place for string with coordinates.

To post a comment you must log in.
Revision history for this message
Bogdan Marinov (daggerstab) wrote :
Download full text (3.2 KiB)

A first-look issue: I suggest changing the main class/ID/displayed name of the plug-in. "Coordinates" is a too generic name for a type/class - there are many things that could be called "coordinates" in an astronomy application and I'm afraid of a naming conflict. It's also not a very clear name when displayed in the plug-in list. I suggest expanding it to something like "MouseCoordinates", "PointerCoordinates" or even "PointerCoordinatesDisplay".

Something that needs cleanup: the comment/documentation of Coordinates::restoreDefaults() mentions the Pulsars plugin. :)

The configuration file uses lower-case name of the plugin for section title. The practice so far seems to be to use the same capitalization as the name of the plugin (i.e. "Coordinates" instead of "coordinates"). There's no explicit rule, but starting with a capital letter has the advantage of putting all the plugins' sections in the beginning of the file.

Speaking of configuration, having a special flag for "enabled at startup" seems redundant when combined with a "save settings" button: the usual practice in Stellarium is to save the current state of the main "enabled" flag when "save settings" is clicked.(This also means a checkbox in the configuration window synched with the main flag like the toolbar button.)

There's also redundancy with having a "reset configuration" function that writes default values to the file and a "load configuration" section that provides defaults when reading from the file. If you have the latter, resetting the configuration requires simply deleting the section, loading the defaults and then saving the current configuration. In general, you should avoid having to define a default value for a property in several places - setting the default only in one place helps avoiding errors (and work) if/when the default value has to be changed.

There is translation support, but "messageCoordinates" is unused and remains empty. Is this something planned for future versions of the plugin, or something left over from development?

I think that the coordinate display should at least mention the coordinate system - for a user unfamiliar with the code, it won't be very clear what those numbers are. :) You can re-use the standard message for ra/dec/J2000 from the selected object info field. This could be a possible use for the messageCoordinates variable.

Everything so far were things that need to be addressed in some way before a merge. Now some things that are more subjective (a.k.a. my opinions) that can be worked before or after a merge:

I think that the placement of the coordinates message is awkward and it will conflict with, for example, the equation of time plug-in. I think I will be able to find a way to display the mouse pointer information in the same way selected object info is displayed - either replacing that box when no object is selected, or inserting pointer information above or below or on the right side of the screen. Would you be interested in that?

The merge proposal mentions offering different types of coordinates. I think that we can use the existing object info flags, especially if we go with the text-box way.

And generally, this feat...

Read more...

review: Needs Fixing
6686. By Alexander Wolf

refactor code of the plugin

6687. By Alexander Wolf

sync with trunk

6688. By Alexander Wolf

added selector for place of displaying of the string with coordinates of the mouse pointer

6689. By Alexander Wolf

added translation support for GUI of Pointer Coordinates pluign

6690. By Alexander Wolf

sync with @trunk

6691. By Alexander Wolf

fix potential bugs

Unmerged revisions

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-03-16 14:53:55 +0000
3+++ CMakeLists.txt 2014-04-06 10:44:47 +0000
4@@ -169,6 +169,7 @@
5 ADD_PLUGIN(Novae 1)
6 ADD_PLUGIN(Observability 1)
7 ADD_PLUGIN(Oculars 1)
8+ADD_PLUGIN(PointerCoordinates 1)
9 ADD_PLUGIN(Pulsars 1)
10 ADD_PLUGIN(Quasars 1)
11 ADD_PLUGIN(Satellites 1)
12
13=== added directory 'plugins/PointerCoordinates'
14=== added file 'plugins/PointerCoordinates/CMakeLists.txt'
15--- plugins/PointerCoordinates/CMakeLists.txt 1970-01-01 00:00:00 +0000
16+++ plugins/PointerCoordinates/CMakeLists.txt 2014-04-06 10:44:47 +0000
17@@ -0,0 +1,18 @@
18+SET(POINTERCOORDINATES_MAJOR "0")
19+SET(POINTERCOORDINATES_MINOR "1")
20+SET(POINTERCOORDINATES_PATCH "0")
21+SET(POINTERCOORDINATES_VERSION "${POINTERCOORDINATES_MAJOR}.${POINTERCOORDINATES_MINOR}.${POINTERCOORDINATES_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(-DPOINTERCOORDINATES_PLUGIN_VERSION="${POINTERCOORDINATES_VERSION}")
30+
31+ADD_SUBDIRECTORY( src )
32+
33+INSTALL(FILES DESTINATION "modules/PointerCoordinates")
34+
35+
36
37=== added file 'plugins/PointerCoordinates/COPYING'
38--- plugins/PointerCoordinates/COPYING 1970-01-01 00:00:00 +0000
39+++ plugins/PointerCoordinates/COPYING 2014-04-06 10:44:47 +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/PointerCoordinates/resources'
388=== added file 'plugins/PointerCoordinates/resources/PointerCoordinates.qrc'
389--- plugins/PointerCoordinates/resources/PointerCoordinates.qrc 1970-01-01 00:00:00 +0000
390+++ plugins/PointerCoordinates/resources/PointerCoordinates.qrc 2014-04-06 10:44:47 +0000
391@@ -0,0 +1,6 @@
392+<RCC>
393+ <qresource prefix="/PointerCoordinates">
394+ <file>bt_PointerCoordinates_Off.png</file>
395+ <file>bt_PointerCoordinates_On.png</file>
396+ </qresource>
397+</RCC>
398
399=== added file 'plugins/PointerCoordinates/resources/bt_PointerCoordinates_Off.png'
400Binary files plugins/PointerCoordinates/resources/bt_PointerCoordinates_Off.png 1970-01-01 00:00:00 +0000 and plugins/PointerCoordinates/resources/bt_PointerCoordinates_Off.png 2014-04-06 10:44:47 +0000 differ
401=== added file 'plugins/PointerCoordinates/resources/bt_PointerCoordinates_On.png'
402Binary files plugins/PointerCoordinates/resources/bt_PointerCoordinates_On.png 1970-01-01 00:00:00 +0000 and plugins/PointerCoordinates/resources/bt_PointerCoordinates_On.png 2014-04-06 10:44:47 +0000 differ
403=== added directory 'plugins/PointerCoordinates/src'
404=== added file 'plugins/PointerCoordinates/src/CMakeLists.txt'
405--- plugins/PointerCoordinates/src/CMakeLists.txt 1970-01-01 00:00:00 +0000
406+++ plugins/PointerCoordinates/src/CMakeLists.txt 2014-04-06 10:44:47 +0000
407@@ -0,0 +1,33 @@
408+INCLUDE_DIRECTORIES(
409+ ${CMAKE_BINARY_DIR}
410+ ${CMAKE_BINARY_DIR}/plugins/PointerCoordinates/src
411+ ${CMAKE_BINARY_DIR}/plugins/PointerCoordinates/src/gui
412+ . gui)
413+
414+LINK_DIRECTORIES(${BUILD_DIR}/src)
415+
416+SET(POINTERCOORDINATES_SRCS
417+ PointerCoordinates.hpp
418+ PointerCoordinates.cpp
419+ gui/PointerCoordinatesWindow.hpp
420+ gui/PointerCoordinatesWindow.cpp
421+ )
422+
423+SET(POINTERCOORDINATES_UIS
424+ gui/pointerCoordinatesWindow.ui
425+)
426+
427+QT5_WRAP_UI(POINTERCOORDINATES_UIS_H ${POINTERCOORDINATES_UIS})
428+
429+################# compiles resources files ############
430+SET(POINTERCOORDINATES_RES ../resources/PointerCoordinates.qrc)
431+QT5_ADD_RESOURCES(POINTERCOORDINATES_RES_CXX ${POINTERCOORDINATES_RES})
432+
433+SET(extLinkerOption ${OPENGL_LIBRARIES})
434+
435+ADD_LIBRARY(PointerCoordinates-static STATIC ${POINTERCOORDINATES_SRCS} ${POINTERCOORDINATES_RES_CXX} ${POINTERCOORDINATES_UIS_H})
436+QT5_USE_MODULES(PointerCoordinates-static Core Declarative Network)
437+SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES OUTPUT_NAME "PointerCoordinates")
438+TARGET_LINK_LIBRARIES(PointerCoordinates-static ${extLinkerOption})
439+SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
440+ADD_DEPENDENCIES(AllStaticPlugins PointerCoordinates-static)
441
442=== added file 'plugins/PointerCoordinates/src/PointerCoordinates.cpp'
443--- plugins/PointerCoordinates/src/PointerCoordinates.cpp 1970-01-01 00:00:00 +0000
444+++ plugins/PointerCoordinates/src/PointerCoordinates.cpp 2014-04-06 10:44:47 +0000
445@@ -0,0 +1,250 @@
446+/*
447+ * Pointer Coordinates 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 "PointerCoordinates.hpp"
478+#include "PointerCoordinatesWindow.hpp"
479+
480+#include <QFontMetrics>
481+#include <QSettings>
482+#include <QPixmap>
483+#include <QPair>
484+#include <QMetaEnum>
485+#include <cmath>
486+
487+StelModule* PointerCoordinatesStelPluginInterface::getStelModule() const
488+{
489+ return new PointerCoordinates();
490+}
491+
492+StelPluginInfo PointerCoordinatesStelPluginInterface::getPluginInfo() const
493+{
494+ // Allow to load the resources when used as a static plugin
495+ Q_INIT_RESOURCE(PointerCoordinates);
496+
497+ StelPluginInfo info;
498+ info.id = "PointerCoordinates";
499+ info.displayedName = N_("Pointer Coordinates");
500+ info.authors = "Alexander Wolf";
501+ info.contact = "http://stellarium.org";
502+ info.description = N_("This plugin shows the coordinates of the mouse pointer.");
503+ info.version = POINTERCOORDINATES_PLUGIN_VERSION;
504+ return info;
505+}
506+
507+PointerCoordinates::PointerCoordinates()
508+ : flagShowCoordinates(false),
509+ toolbarButton(NULL)
510+{
511+ setObjectName("PointerCoordinates");
512+ mainWindow = new PointerCoordinatesWindow();
513+}
514+
515+PointerCoordinates::~PointerCoordinates()
516+{
517+ delete mainWindow;
518+}
519+
520+void PointerCoordinates::init()
521+{
522+ StelApp &app = StelApp::getInstance();
523+ conf = app.getSettings();
524+ gui = dynamic_cast<StelGui*>(app.getGui());
525+
526+ if (!conf->childGroups().contains("PointerCoordinates"))
527+ {
528+ qDebug() << "PointerCoordinates: no coordinates section exists in main config file - creating with defaults";
529+ restoreDefaultConfiguration();
530+ }
531+
532+ // populate settings from main config file.
533+ loadConfiguration();
534+
535+ addAction("actionShow_MousePointer_Coordinates", N_("Pointer Coordinates"), N_("Show equatorial coordinates (J2000.0) of the mouse pointer"), "enabled", "");
536+
537+ enableCoordinates(getFlagEnableAtStartup());
538+ setFlagShowCoordinatesButton(flagShowCoordinatesButton);
539+}
540+
541+void PointerCoordinates::deinit()
542+{
543+ //
544+}
545+
546+void PointerCoordinates::draw(StelCore *core)
547+{
548+ if (!isEnabled())
549+ return;
550+
551+ const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000, StelCore::RefractionAuto);
552+ StelPainter sPainter(prj);
553+ sPainter.setColor(textColor[0], textColor[1], textColor[2], 1.f);
554+ font.setPixelSize(getFontSize());
555+ sPainter.setFont(font);
556+
557+ QPoint p = QCursor::pos(); // get screen coordinates of mouse cursor
558+ Vec3d mousePosition;
559+ float wh = prj->getViewportWidth()/2; // get half of width of the screen
560+ float hh = prj->getViewportHeight()/2; // get half of height of the screen
561+ float mx = p.x()-wh; // point 0 in center of the screen, axis X directed to right
562+ float my = p.y()-hh; // point 0 in center of the screen, axis Y directed to bottom
563+ // calculate position of mouse cursor via position of center of the screen (and invert axis Y)
564+ prj->unProject(prj->getViewportPosX()+wh+mx, prj->getViewportPosY()+hh+1-my, mousePosition);
565+
566+ double dec_j2000, ra_j2000;
567+ StelUtils::rectToSphe(&ra_j2000,&dec_j2000,mousePosition); // Calculate RA/DE (J2000.0) and show it...
568+ QString coordsText = QString("%1/%2").arg(StelUtils::radToHmsStr(ra_j2000, true)).arg(StelUtils::radToDmsStr(dec_j2000, true));
569+
570+ sPainter.drawText(getCoordinatesPlace(coordsText).first, getCoordinatesPlace(coordsText).second, coordsText);
571+}
572+
573+void PointerCoordinates::enableCoordinates(bool b)
574+{
575+ flagShowCoordinates = b;
576+}
577+
578+double PointerCoordinates::getCallOrder(StelModuleActionName actionName) const
579+{
580+ if (actionName==StelModule::ActionDraw)
581+ return StelApp::getInstance().getModuleMgr().getModule("LandscapeMgr")->getCallOrder(actionName)+10.;
582+ return 0;
583+}
584+
585+bool PointerCoordinates::configureGui(bool show)
586+{
587+ if (show)
588+ {
589+ mainWindow->setVisible(true);
590+ }
591+
592+ return true;
593+}
594+
595+void PointerCoordinates::restoreDefaultConfiguration(void)
596+{
597+ // Remove the whole section from the configuration file
598+ conf->remove("PointerCoordinates");
599+ // Load the default values...
600+ loadConfiguration();
601+ // ... then save them.
602+ saveConfiguration();
603+ // But this doesn't save the color, so...
604+ conf->beginGroup("PointerCoordinates");
605+ conf->setValue("text_color", "1,0.5,0");
606+ conf->endGroup();
607+}
608+
609+void PointerCoordinates::loadConfiguration(void)
610+{
611+ conf->beginGroup("PointerCoordinates");
612+
613+ setFlagEnableAtStartup(conf->value("enable_at_startup", false).toBool());
614+ textColor = StelUtils::strToVec3f(conf->value("text_color", "1,0.5,0").toString());
615+ setFontSize(conf->value("font_size", 14).toInt());
616+ flagShowCoordinatesButton = conf->value("flag_show_button", true).toBool();
617+ setCurrentCoordinatesPlaceKey(conf->value("current_displaying_place", "TopRight").toString());
618+
619+ conf->endGroup();
620+}
621+
622+void PointerCoordinates::saveConfiguration(void)
623+{
624+ conf->beginGroup("PointerCoordinates");
625+
626+ conf->setValue("enable_at_startup", getFlagEnableAtStartup());
627+ conf->setValue("flag_show_button", getFlagShowCoordinatesButton());
628+ conf->setValue("current_displaying_place", getCurrentCoordinatesPlaceKey());
629+ //conf->setValue("text_color", "1,0.5,0");
630+ conf->setValue("font_size", getFontSize());
631+
632+ conf->endGroup();
633+}
634+
635+void PointerCoordinates::setFlagShowCoordinatesButton(bool b)
636+{
637+ if (b==true) {
638+ if (toolbarButton==NULL) {
639+ // Create the button
640+ toolbarButton = new StelButton(NULL,
641+ QPixmap(":/PointerCoordinates/bt_PointerCoordinates_On.png"),
642+ QPixmap(":/PointerCoordinates/bt_PointerCoordinates_Off.png"),
643+ QPixmap(":/graphicGui/glow32x32.png"),
644+ "actionShow_MousePointer_Coordinates");
645+ }
646+ gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
647+ } else {
648+ gui->getButtonBar()->hideButton("actionShow_MousePointer_Coordinates");
649+ }
650+ flagShowCoordinatesButton = b;
651+}
652+
653+// Set the current place of the string with coordinates from its key
654+void PointerCoordinates::setCurrentCoordinatesPlaceKey(QString key)
655+{
656+ const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOfEnumerator("CoordinatesPlace"));
657+ CoordinatesPlace coordPlace = (CoordinatesPlace)en.keyToValue(key.toLatin1().data());
658+ if (coordPlace<0)
659+ {
660+ qWarning() << "Unknown coordinates place: " << key << "setting \"TopRight\" instead";
661+ coordPlace = TopRight;
662+ }
663+ setCurrentCoordinatesPlace(coordPlace);
664+}
665+
666+//Get the current place of the string with coordinates
667+QString PointerCoordinates::getCurrentCoordinatesPlaceKey() const
668+{
669+ return metaObject()->enumerator(metaObject()->indexOfEnumerator("CoordinatesPlace")).key(currentPlace);
670+}
671+
672+QPair<int, int> PointerCoordinates::getCoordinatesPlace(QString text)
673+{
674+ int x = 0, y = 0;
675+ float coeff = 1.5;
676+ QFontMetrics fm(font);
677+ QSize fs = fm.size(Qt::TextSingleLine, text);
678+ switch(getCurrentCoordinatesPlace())
679+ {
680+ case TopCenter:
681+ x = gui->getSkyGui()->getSkyGuiWidth()/2 - fs.width()/2;
682+ y = gui->getSkyGui()->getSkyGuiHeight() - fs.height()*coeff;
683+ break;
684+ case TopRight:
685+ x = 3*gui->getSkyGui()->getSkyGuiWidth()/4 - fs.width()/2;
686+ y = gui->getSkyGui()->getSkyGuiHeight() - fs.height()*coeff;
687+ break;
688+ case RightBottomCorner:
689+ x = gui->getSkyGui()->getSkyGuiWidth() - fs.width() - 10*coeff;
690+ y = fs.height();
691+ break;
692+ }
693+ return qMakePair(x, y);
694+}
695+
696
697=== added file 'plugins/PointerCoordinates/src/PointerCoordinates.hpp'
698--- plugins/PointerCoordinates/src/PointerCoordinates.hpp 1970-01-01 00:00:00 +0000
699+++ plugins/PointerCoordinates/src/PointerCoordinates.hpp 2014-04-06 10:44:47 +0000
700@@ -0,0 +1,160 @@
701+/*
702+ * Pointer Coordinates plug-in for Stellarium
703+ *
704+ * Copyright (C) 2014 Alexander Wolf
705+ *
706+ * This program is free software; you can redistribute it and/or
707+ * modify it under the terms of the GNU General Public License
708+ * as published by the Free Software Foundation; either version 2
709+ * of the License, or (at your option) any later version.
710+ *
711+ * This program is distributed in the hope that it will be useful,
712+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
713+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
714+ * GNU General Public License for more details.
715+ *
716+ * You should have received a copy of the GNU General Public License
717+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
718+ */
719+
720+#ifndef _POINTERCOORDINATES_HPP_
721+#define _POINTERCOORDINATES_HPP_
722+
723+#include "StelGui.hpp"
724+#include "StelModule.hpp"
725+
726+#include <QFont>
727+#include <QString>
728+#include <QPair>
729+
730+class QPixmap;
731+class StelButton;
732+class PointerCoordinatesWindow;
733+
734+class PointerCoordinates : public StelModule
735+{
736+ Q_OBJECT
737+ Q_ENUMS(CoordinatesPlace)
738+ Q_PROPERTY(bool enabled
739+ READ isEnabled
740+ WRITE enableCoordinates)
741+
742+public:
743+ //! @enum CoordinatesPlace
744+ //! Available places of string with coordinates
745+ enum CoordinatesPlace
746+ {
747+ TopCenter, //!< The top center of the screen
748+ TopRight, //!< In center of the top right half of the screen
749+ RightBottomCorner //!< The right bottom corner of the screen
750+ };
751+
752+
753+ PointerCoordinates();
754+ virtual ~PointerCoordinates();
755+
756+ virtual void init();
757+ virtual void deinit();
758+ virtual void update(double) {;}
759+ virtual void draw(StelCore *core);
760+ virtual double getCallOrder(StelModuleActionName actionName) const;
761+ virtual bool configureGui(bool show);
762+
763+ //! Set up the plugin with default values. This means clearing out the PointerCoordinates section in the
764+ //! main config.ini (if one already exists), and populating it with default values.
765+ void restoreDefaultConfiguration(void);
766+
767+ //! Read (or re-read) settings from the main config file. This will be called from init and also
768+ //! when restoring defaults (i.e. from the configuration dialog / restore defaults button).
769+ void loadConfiguration(void);
770+
771+ //! Save the settings to the main configuration file.
772+ void saveConfiguration(void);
773+
774+ //! Is plugin enabled?
775+ bool isEnabled() const
776+ {
777+ return flagShowCoordinates;
778+ }
779+
780+ //! Get font size for messages
781+ int getFontSize(void)
782+ {
783+ return fontSize;
784+ }
785+ bool getFlagEnableAtStartup(void)
786+ {
787+ return flagEnableAtStartup;
788+ }
789+ bool getFlagShowCoordinatesButton(void)
790+ {
791+ return flagShowCoordinatesButton;
792+ }
793+
794+ QPair<int, int> getCoordinatesPlace(QString text);
795+
796+public slots:
797+ //! Enable plugin usage
798+ void enableCoordinates(bool b);
799+ //! Enable plugin usage at startup
800+ void setFlagEnableAtStartup(bool b)
801+ {
802+ flagEnableAtStartup=b;
803+ }
804+ //! Set font size for message
805+ void setFontSize(int size)
806+ {
807+ fontSize=size;
808+ }
809+ //! Display plugin button on toolbar
810+ void setFlagShowCoordinatesButton(bool b);
811+
812+ //! Set the current place of the string with coordinates
813+ void setCurrentCoordinatesPlace(CoordinatesPlace place)
814+ {
815+ currentPlace = place;
816+ }
817+ //! Get the current place of the string with coordinates
818+ CoordinatesPlace getCurrentCoordinatesPlace() const
819+ {
820+ return currentPlace;
821+ }
822+ //! Get the current place of the string with coordinates
823+ QString getCurrentCoordinatesPlaceKey(void) const;
824+ //! Set the current place of the string with coordinates from its key
825+ void setCurrentCoordinatesPlaceKey(QString key);
826+
827+private:
828+ PointerCoordinatesWindow* mainWindow;
829+ QSettings* conf;
830+ StelGui* gui;
831+
832+ // The current place for string with coordinates
833+ CoordinatesPlace currentPlace;
834+
835+ QFont font;
836+ bool flagShowCoordinates;
837+ bool flagEnableAtStartup;
838+ bool flagShowCoordinatesButton;
839+ Vec3f textColor;
840+ Vec3d coordinatesPoint;
841+ int fontSize;
842+ StelButton* toolbarButton;
843+};
844+
845+
846+#include <QObject>
847+#include "StelPluginInterface.hpp"
848+
849+//! This class is used by Qt to manage a plug-in interface
850+class PointerCoordinatesStelPluginInterface : public QObject, public StelPluginInterface
851+{
852+ Q_OBJECT
853+ Q_PLUGIN_METADATA(IID "stellarium.StelGuiPluginInterface/1.0")
854+ Q_INTERFACES(StelPluginInterface)
855+public:
856+ virtual StelModule* getStelModule() const;
857+ virtual StelPluginInfo getPluginInfo() const;
858+};
859+
860+#endif /* _POINTERCOORDINATES_HPP_ */
861
862=== added directory 'plugins/PointerCoordinates/src/gui'
863=== added file 'plugins/PointerCoordinates/src/gui/PointerCoordinatesWindow.cpp'
864--- plugins/PointerCoordinates/src/gui/PointerCoordinatesWindow.cpp 1970-01-01 00:00:00 +0000
865+++ plugins/PointerCoordinates/src/gui/PointerCoordinatesWindow.cpp 2014-04-06 10:44:47 +0000
866@@ -0,0 +1,132 @@
867+/*
868+ * Pointer Coordinates plug-in for Stellarium
869+ *
870+ * Copyright (C) 2014 Alexander Wolf
871+ *
872+ * This program is free software; you can redistribute it and/or
873+ * modify it under the terms of the GNU General Public License
874+ * as published by the Free Software Foundation; either version 2
875+ * of the License, or (at your option) any later version.
876+ *
877+ * This program is distributed in the hope that it will be useful,
878+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
879+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
880+ * GNU General Public License for more details.
881+ *
882+ * You should have received a copy of the GNU General Public License
883+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
884+ */
885+
886+#include "PointerCoordinates.hpp"
887+#include "PointerCoordinatesWindow.hpp"
888+#include "ui_pointerCoordinatesWindow.h"
889+
890+#include "StelApp.hpp"
891+#include "StelLocaleMgr.hpp"
892+#include "StelModule.hpp"
893+#include "StelModuleMgr.hpp"
894+
895+PointerCoordinatesWindow::PointerCoordinatesWindow()
896+{
897+ ui = new Ui_pointerCoordinatesWindowForm();
898+}
899+
900+PointerCoordinatesWindow::~PointerCoordinatesWindow()
901+{
902+ delete ui;
903+}
904+
905+void PointerCoordinatesWindow::retranslate()
906+{
907+ if (dialog)
908+ {
909+ ui->retranslateUi(dialog);
910+ updateAboutText();
911+ populateCoordinatesPlacesList();
912+ }
913+}
914+
915+void PointerCoordinatesWindow::createDialogContent()
916+{
917+ coord = GETSTELMODULE(PointerCoordinates);
918+ ui->setupUi(dialog);
919+
920+ connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
921+ connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
922+
923+ populateValues();
924+
925+ connect(ui->checkBoxEnableAtStartup, SIGNAL(clicked(bool)), coord, SLOT(setFlagEnableAtStartup(bool)));
926+ connect(ui->spinBoxFontSize, SIGNAL(valueChanged(int)), coord, SLOT(setFontSize(int)));
927+ connect(ui->checkBoxShowButton, SIGNAL(clicked(bool)), coord, SLOT(setFlagShowCoordinatesButton(bool)));
928+
929+ // Place of the string with coordinates
930+ populateCoordinatesPlacesList();
931+ int idx = ui->placeComboBox->findData(coord->getCurrentCoordinatesPlaceKey(), Qt::UserRole, Qt::MatchCaseSensitive);
932+ if (idx==-1)
933+ {
934+ // Use TopRight as default
935+ idx = ui->placeComboBox->findData(QVariant("TopRight"), Qt::UserRole, Qt::MatchCaseSensitive);
936+ }
937+ ui->placeComboBox->setCurrentIndex(idx);
938+ connect(ui->placeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setCoordinatesPlace(int)));
939+
940+ connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(saveCoordinatesSettings()));
941+ connect(ui->pushButtonReset, SIGNAL(clicked()), this, SLOT(resetCoordinatesSettings()));
942+
943+ updateAboutText();
944+}
945+
946+void PointerCoordinatesWindow::populateValues()
947+{
948+ ui->checkBoxEnableAtStartup->setChecked(coord->getFlagEnableAtStartup());
949+ ui->spinBoxFontSize->setValue(coord->getFontSize());
950+ ui->checkBoxShowButton->setChecked(coord->getFlagShowCoordinatesButton());
951+}
952+
953+void PointerCoordinatesWindow::updateAboutText()
954+{
955+ ui->labelTitle->setText(q_("Pointer Coordinates plug-in"));
956+ QString version = QString(q_("Version %1")).arg(POINTERCOORDINATES_PLUGIN_VERSION);
957+ ui->labelVersion->setText(version);
958+}
959+
960+void PointerCoordinatesWindow::saveCoordinatesSettings()
961+{
962+ coord->saveConfiguration();
963+}
964+
965+void PointerCoordinatesWindow::resetCoordinatesSettings()
966+{
967+ coord->restoreDefaultConfiguration();
968+ populateValues();
969+}
970+
971+void PointerCoordinatesWindow::populateCoordinatesPlacesList()
972+{
973+ Q_ASSERT(ui->placeComboBox);
974+
975+ QComboBox* places = ui->placeComboBox;
976+
977+ //Save the current selection to be restored later
978+ places->blockSignals(true);
979+ int index = places->currentIndex();
980+ QVariant selectedPlaceId = places->itemData(index);
981+ places->clear();
982+ //For each algorithm, display the localized name and store the key as user
983+ //data. Unfortunately, there's no other way to do this than with a cycle.
984+ places->addItem(q_("The top center of the screen"), "TopCenter");
985+ places->addItem(q_("In center of the top right half of the screen"), "TopRight");
986+ places->addItem(q_("The right bottom corner of the screen"), "RightBottomCorner");
987+
988+ //Restore the selection
989+ index = places->findData(selectedPlaceId, Qt::UserRole, Qt::MatchCaseSensitive);
990+ places->setCurrentIndex(index);
991+ places->blockSignals(false);
992+}
993+
994+void PointerCoordinatesWindow::setCoordinatesPlace(int placeID)
995+{
996+ QString currentPlaceID = ui->placeComboBox->itemData(placeID).toString();
997+ coord->setCurrentCoordinatesPlaceKey(currentPlaceID);
998+}
999
1000=== added file 'plugins/PointerCoordinates/src/gui/PointerCoordinatesWindow.hpp'
1001--- plugins/PointerCoordinates/src/gui/PointerCoordinatesWindow.hpp 1970-01-01 00:00:00 +0000
1002+++ plugins/PointerCoordinates/src/gui/PointerCoordinatesWindow.hpp 2014-04-06 10:44:47 +0000
1003@@ -0,0 +1,64 @@
1004+/*
1005+ * Pointer Coordinates plug-in for Stellarium
1006+ *
1007+ * Copyright (C) 2014 Alexander Wolf
1008+ *
1009+ * This program is free software; you can redistribute it and/or
1010+ * modify it under the terms of the GNU General Public License
1011+ * as published by the Free Software Foundation; either version 2
1012+ * of the License, or (at your option) any later version.
1013+ *
1014+ * This program is distributed in the hope that it will be useful,
1015+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1016+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1017+ * GNU General Public License for more details.
1018+ *
1019+ * You should have received a copy of the GNU General Public License
1020+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1021+ */
1022+
1023+#ifndef _POINTER_COORDINATES_WINDOW_HPP_
1024+#define _POINTER_COORDINATES_WINDOW_HPP_
1025+
1026+#include "StelDialog.hpp"
1027+
1028+#include <QString>
1029+#include <QDoubleSpinBox>
1030+
1031+class Ui_pointerCoordinatesWindowForm;
1032+class PointerCoordinates;
1033+
1034+//! Main window of the Pointer Coordinates plug-in.
1035+class PointerCoordinatesWindow : public StelDialog
1036+{
1037+ Q_OBJECT
1038+
1039+public:
1040+ PointerCoordinatesWindow();
1041+ ~PointerCoordinatesWindow();
1042+
1043+public slots:
1044+ void retranslate();
1045+
1046+protected:
1047+ void createDialogContent();
1048+
1049+private:
1050+ Ui_pointerCoordinatesWindowForm* ui;
1051+ PointerCoordinates* coord;
1052+
1053+ void updateAboutText();
1054+ void populateValues();
1055+
1056+private slots:
1057+ void saveCoordinatesSettings();
1058+ void resetCoordinatesSettings();
1059+
1060+ void populateCoordinatesPlacesList();
1061+ void setCoordinatesPlace(int placeID);
1062+
1063+
1064+};
1065+
1066+
1067+#endif /* _POINTER_COORDINATES_WINDOW_HPP_ */
1068
1069=== added file 'plugins/PointerCoordinates/src/gui/pointerCoordinatesWindow.ui'
1070--- plugins/PointerCoordinates/src/gui/pointerCoordinatesWindow.ui 1970-01-01 00:00:00 +0000
1071+++ plugins/PointerCoordinates/src/gui/pointerCoordinatesWindow.ui 2014-04-06 10:44:47 +0000
1072@@ -0,0 +1,396 @@
1073+<?xml version="1.0" encoding="UTF-8"?>
1074+<ui version="4.0">
1075+ <class>pointerCoordinatesWindowForm</class>
1076+ <widget class="QWidget" name="pointerCoordinatesWindowForm">
1077+ <property name="geometry">
1078+ <rect>
1079+ <x>0</x>
1080+ <y>0</y>
1081+ <width>520</width>
1082+ <height>461</height>
1083+ </rect>
1084+ </property>
1085+ <layout class="QVBoxLayout" name="verticalLayout">
1086+ <property name="spacing">
1087+ <number>0</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>0</number>
1097+ </property>
1098+ <property name="bottomMargin">
1099+ <number>0</number>
1100+ </property>
1101+ <item>
1102+ <widget class="BarFrame" name="TitleBar">
1103+ <property name="sizePolicy">
1104+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
1105+ <horstretch>0</horstretch>
1106+ <verstretch>0</verstretch>
1107+ </sizepolicy>
1108+ </property>
1109+ <property name="minimumSize">
1110+ <size>
1111+ <width>0</width>
1112+ <height>25</height>
1113+ </size>
1114+ </property>
1115+ <property name="maximumSize">
1116+ <size>
1117+ <width>16777215</width>
1118+ <height>30</height>
1119+ </size>
1120+ </property>
1121+ <property name="focusPolicy">
1122+ <enum>Qt::NoFocus</enum>
1123+ </property>
1124+ <property name="autoFillBackground">
1125+ <bool>false</bool>
1126+ </property>
1127+ <property name="frameShape">
1128+ <enum>QFrame::StyledPanel</enum>
1129+ </property>
1130+ <layout class="QHBoxLayout">
1131+ <property name="spacing">
1132+ <number>6</number>
1133+ </property>
1134+ <property name="leftMargin">
1135+ <number>0</number>
1136+ </property>
1137+ <property name="topMargin">
1138+ <number>0</number>
1139+ </property>
1140+ <property name="rightMargin">
1141+ <number>4</number>
1142+ </property>
1143+ <property name="bottomMargin">
1144+ <number>0</number>
1145+ </property>
1146+ <item>
1147+ <spacer name="leftSpacer">
1148+ <property name="orientation">
1149+ <enum>Qt::Horizontal</enum>
1150+ </property>
1151+ <property name="sizeHint" stdset="0">
1152+ <size>
1153+ <width>40</width>
1154+ <height>20</height>
1155+ </size>
1156+ </property>
1157+ </spacer>
1158+ </item>
1159+ <item>
1160+ <widget class="QLabel" name="stelWindowTitle">
1161+ <property name="text">
1162+ <string>Pointer Coordinates</string>
1163+ </property>
1164+ </widget>
1165+ </item>
1166+ <item>
1167+ <spacer name="rightSpacer">
1168+ <property name="orientation">
1169+ <enum>Qt::Horizontal</enum>
1170+ </property>
1171+ <property name="sizeHint" stdset="0">
1172+ <size>
1173+ <width>40</width>
1174+ <height>20</height>
1175+ </size>
1176+ </property>
1177+ </spacer>
1178+ </item>
1179+ <item>
1180+ <widget class="QPushButton" name="closeStelWindow">
1181+ <property name="minimumSize">
1182+ <size>
1183+ <width>16</width>
1184+ <height>16</height>
1185+ </size>
1186+ </property>
1187+ <property name="maximumSize">
1188+ <size>
1189+ <width>16</width>
1190+ <height>16</height>
1191+ </size>
1192+ </property>
1193+ <property name="focusPolicy">
1194+ <enum>Qt::NoFocus</enum>
1195+ </property>
1196+ <property name="text">
1197+ <string/>
1198+ </property>
1199+ </widget>
1200+ </item>
1201+ </layout>
1202+ </widget>
1203+ </item>
1204+ <item>
1205+ <widget class="QTabWidget" name="tabWidget">
1206+ <property name="currentIndex">
1207+ <number>0</number>
1208+ </property>
1209+ <widget class="QWidget" name="tabCoordinates">
1210+ <attribute name="title">
1211+ <string>Pointer Coordinates</string>
1212+ </attribute>
1213+ <layout class="QVBoxLayout" name="verticalLayoutTimeZone">
1214+ <property name="spacing">
1215+ <number>0</number>
1216+ </property>
1217+ <property name="leftMargin">
1218+ <number>0</number>
1219+ </property>
1220+ <property name="topMargin">
1221+ <number>0</number>
1222+ </property>
1223+ <property name="rightMargin">
1224+ <number>0</number>
1225+ </property>
1226+ <property name="bottomMargin">
1227+ <number>0</number>
1228+ </property>
1229+ <item>
1230+ <widget class="QGroupBox" name="groupBoxCoordinates">
1231+ <property name="minimumSize">
1232+ <size>
1233+ <width>0</width>
1234+ <height>400</height>
1235+ </size>
1236+ </property>
1237+ <property name="title">
1238+ <string>Pointer Coordinates</string>
1239+ </property>
1240+ <property name="alignment">
1241+ <set>Qt::AlignCenter</set>
1242+ </property>
1243+ <layout class="QVBoxLayout" name="verticalLayout_2">
1244+ <property name="leftMargin">
1245+ <number>0</number>
1246+ </property>
1247+ <property name="topMargin">
1248+ <number>0</number>
1249+ </property>
1250+ <property name="rightMargin">
1251+ <number>0</number>
1252+ </property>
1253+ <property name="bottomMargin">
1254+ <number>0</number>
1255+ </property>
1256+ <item>
1257+ <widget class="QLabel" name="labelCoordinatesDescription">
1258+ <property name="text">
1259+ <string>Show equatorial coordinates of the mouse cursor for epoch J2000.0 </string>
1260+ </property>
1261+ <property name="wordWrap">
1262+ <bool>true</bool>
1263+ </property>
1264+ </widget>
1265+ </item>
1266+ <item>
1267+ <widget class="Line" name="line">
1268+ <property name="baseSize">
1269+ <size>
1270+ <width>0</width>
1271+ <height>1</height>
1272+ </size>
1273+ </property>
1274+ <property name="frameShadow">
1275+ <enum>QFrame::Plain</enum>
1276+ </property>
1277+ <property name="lineWidth">
1278+ <number>1</number>
1279+ </property>
1280+ <property name="midLineWidth">
1281+ <number>1</number>
1282+ </property>
1283+ <property name="orientation">
1284+ <enum>Qt::Horizontal</enum>
1285+ </property>
1286+ </widget>
1287+ </item>
1288+ <item>
1289+ <widget class="QCheckBox" name="checkBoxEnableAtStartup">
1290+ <property name="text">
1291+ <string>Enable displaying coordinates at startup</string>
1292+ </property>
1293+ </widget>
1294+ </item>
1295+ <item>
1296+ <widget class="QCheckBox" name="checkBoxShowButton">
1297+ <property name="text">
1298+ <string>Show plug-ins button on toolbar</string>
1299+ </property>
1300+ </widget>
1301+ </item>
1302+ <item>
1303+ <layout class="QHBoxLayout" name="horizontalLayout">
1304+ <item>
1305+ <widget class="QLabel" name="labelFontSize">
1306+ <property name="text">
1307+ <string>Font size:</string>
1308+ </property>
1309+ </widget>
1310+ </item>
1311+ <item>
1312+ <widget class="QSpinBox" name="spinBoxFontSize">
1313+ <property name="minimum">
1314+ <number>10</number>
1315+ </property>
1316+ <property name="maximum">
1317+ <number>50</number>
1318+ </property>
1319+ <property name="value">
1320+ <number>14</number>
1321+ </property>
1322+ </widget>
1323+ </item>
1324+ </layout>
1325+ </item>
1326+ <item>
1327+ <layout class="QHBoxLayout" name="horizontalLayout_3">
1328+ <item>
1329+ <widget class="QLabel" name="placeLabel">
1330+ <property name="toolTip">
1331+ <string>Place of the string with coordinates of the mouse pointer</string>
1332+ </property>
1333+ <property name="text">
1334+ <string>Place of the string:</string>
1335+ </property>
1336+ </widget>
1337+ </item>
1338+ <item>
1339+ <widget class="QComboBox" name="placeComboBox">
1340+ <property name="editable">
1341+ <bool>true</bool>
1342+ </property>
1343+ <property name="insertPolicy">
1344+ <enum>QComboBox::NoInsert</enum>
1345+ </property>
1346+ <property name="sizeAdjustPolicy">
1347+ <enum>QComboBox::AdjustToContents</enum>
1348+ </property>
1349+ </widget>
1350+ </item>
1351+ </layout>
1352+ </item>
1353+ <item>
1354+ <layout class="QHBoxLayout" name="horizontalLayout_2">
1355+ <item>
1356+ <widget class="QPushButton" name="pushButtonSave">
1357+ <property name="text">
1358+ <string>Save settings</string>
1359+ </property>
1360+ </widget>
1361+ </item>
1362+ <item>
1363+ <widget class="QPushButton" name="pushButtonReset">
1364+ <property name="text">
1365+ <string>Restore defaults</string>
1366+ </property>
1367+ </widget>
1368+ </item>
1369+ </layout>
1370+ </item>
1371+ <item>
1372+ <spacer name="verticalSpacer">
1373+ <property name="orientation">
1374+ <enum>Qt::Vertical</enum>
1375+ </property>
1376+ <property name="sizeHint" stdset="0">
1377+ <size>
1378+ <width>20</width>
1379+ <height>40</height>
1380+ </size>
1381+ </property>
1382+ </spacer>
1383+ </item>
1384+ </layout>
1385+ </widget>
1386+ </item>
1387+ </layout>
1388+ </widget>
1389+ <widget class="QWidget" name="tabAbout">
1390+ <attribute name="title">
1391+ <string comment="tab in plugin windows">About</string>
1392+ </attribute>
1393+ <layout class="QVBoxLayout" name="verticalLayout_3">
1394+ <item>
1395+ <widget class="QLabel" name="labelTitle">
1396+ <property name="styleSheet">
1397+ <string notr="true">QLabel {
1398+ font: bold 18pt ;
1399+}</string>
1400+ </property>
1401+ <property name="text">
1402+ <string notr="true">Pointer Coordinates plug-in</string>
1403+ </property>
1404+ </widget>
1405+ </item>
1406+ <item>
1407+ <widget class="QLabel" name="labelVersion">
1408+ <property name="text">
1409+ <string notr="true">Version %1</string>
1410+ </property>
1411+ </widget>
1412+ </item>
1413+ <item>
1414+ <widget class="QLabel" name="labelCopyright">
1415+ <property name="text">
1416+ <string notr="true">Copyright &amp;copy; 2014 Alexander Wolf</string>
1417+ </property>
1418+ <property name="textFormat">
1419+ <enum>Qt::RichText</enum>
1420+ </property>
1421+ </widget>
1422+ </item>
1423+ <item>
1424+ <widget class="QLabel" name="labelLicense">
1425+ <property name="sizePolicy">
1426+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
1427+ <horstretch>0</horstretch>
1428+ <verstretch>0</verstretch>
1429+ </sizepolicy>
1430+ </property>
1431+ <property name="text">
1432+ <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.
1433+
1434+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.
1435+
1436+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>
1437+ </property>
1438+ <property name="alignment">
1439+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
1440+ </property>
1441+ <property name="wordWrap">
1442+ <bool>true</bool>
1443+ </property>
1444+ <property name="textInteractionFlags">
1445+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
1446+ </property>
1447+ </widget>
1448+ </item>
1449+ </layout>
1450+ </widget>
1451+ </widget>
1452+ </item>
1453+ </layout>
1454+ </widget>
1455+ <customwidgets>
1456+ <customwidget>
1457+ <class>BarFrame</class>
1458+ <extends>QFrame</extends>
1459+ <header>Dialog.hpp</header>
1460+ <container>1</container>
1461+ </customwidget>
1462+ </customwidgets>
1463+ <tabstops>
1464+ <tabstop>tabWidget</tabstop>
1465+ </tabstops>
1466+ <resources/>
1467+ <connections/>
1468+</ui>
1469
1470=== modified file 'po/stellarium/POTFILES.in'
1471--- po/stellarium/POTFILES.in 2014-03-10 14:06:18 +0000
1472+++ po/stellarium/POTFILES.in 2014-04-06 10:44:47 +0000
1473@@ -121,3 +121,6 @@
1474 plugins/MeteorShowers/src/MeteorShower.cpp
1475 plugins/MeteorShowers/src/gui/MeteorShowerDialog.cpp
1476 plugins/MeteorShowers/src/ui_meteorShowerDialog.h
1477+plugins/PointerCoordinates/src/PointerCoordinates.cpp
1478+plugins/PointerCoordinates/src/gui/PointerCoordinatesWindow.cpp
1479+plugins/PointerCoordinates/src/ui_pointerCoordinatesWindow.h
1480\ No newline at end of file
1481
1482=== modified file 'src/core/StelApp.cpp'
1483--- src/core/StelApp.cpp 2014-03-24 13:24:14 +0000
1484+++ src/core/StelApp.cpp 2014-04-06 10:44:47 +0000
1485@@ -163,6 +163,10 @@
1486 Q_IMPORT_PLUGIN(FOVStelPluginInterface)
1487 #endif
1488
1489+#ifdef USE_STATIC_PLUGIN_POINTERCOORDINATES
1490+Q_IMPORT_PLUGIN(PointerCoordinatesStelPluginInterface)
1491+#endif
1492+
1493 #ifdef USE_STATIC_PLUGIN_OBSERVABILITY
1494 Q_IMPORT_PLUGIN(ObservabilityStelPluginInterface)
1495 #endif