Merge lp:~peppujols/stellarium/printsky into lp:stellarium
- printsky
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~peppujols/stellarium/printsky |
Merge into: | lp:stellarium |
Diff against target: |
1859 lines (+1671/-29) 18 files modified
CMakeLists.txt (+4/-13) plugins/CMakeLists.txt (+18/-16) plugins/PrintSky/CMakeLists.txt (+11/-0) plugins/PrintSky/PrintSky.qrc (+6/-0) plugins/PrintSky/nightStyle.css (+31/-0) plugins/PrintSky/normalStyle.css (+31/-0) plugins/PrintSky/src/CMakeLists.txt (+69/-0) plugins/PrintSky/src/PrintSky.cpp (+171/-0) plugins/PrintSky/src/PrintSky.hpp (+70/-0) plugins/PrintSky/src/gui/PrintSkyDialog.cpp (+611/-0) plugins/PrintSky/src/gui/PrintSkyDialog.hpp (+98/-0) plugins/PrintSky/src/gui/StelDialogPrintSky.cpp (+134/-0) plugins/PrintSky/src/gui/StelDialogPrintSky.hpp (+52/-0) plugins/PrintSky/src/gui/printskyDialog.ui (+350/-0) src/CMakeLists.txt (+6/-0) src/StelMainGraphicsView.cpp (+4/-0) src/StelMainGraphicsView.hpp (+4/-0) src/core/modules/StarMgr.cpp (+1/-0) |
To merge this branch: | bzr merge lp:~peppujols/stellarium/printsky |
Related bugs: | |
Related blueprints: |
Print sky and some aditional data
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Fabien Chéreau | Needs Fixing | ||
Bogdan Marinov | Abstain | ||
Matthew Gates | Pending | ||
Review via email: mp+45571@code.launchpad.net |
This proposal supersedes a proposal from 2010-12-01.
This proposal has been superseded by a proposal from 2011-05-23.
Commit message
Description of the change
Matthew Gates (matthew-porpoisehead) wrote : Posted in a previous version of this proposal | # |
Bogdan Marinov (daggerstab) wrote : Posted in a previous version of this proposal | # |
I agree that it needs some fixing.
Matthew, Pep, did you see the experimental build of Stellarium I've uploaded here?
https:/
One of the two new plug-ins included in it is a _fixed_ version of Print Sky.
I can provide a patch with my changes. The main problem: it seems that the absolute coordinates used assume a resolution of 300 DPI (dots per inch). If the printer uses a higher resolution, the text appears too small and/or with wrong line spacing. My patch also includes some improvements to the interface.
treaves (treaves) wrote : Posted in a previous version of this proposal | # |
There are several of unused method arguments. For places where you can not change the signature, please use the Q_UNUSED macro.
I'll look over it more when I get home from work; all I had time for was a simple compile check, and that's what showed the above feedback.
Bogdan Marinov (daggerstab) wrote : Posted in a previous version of this proposal | # |
I've uploaded a branch with the changes I made to the plug-in when I added it to the experimental build and I've proposed it for merging into Pep Pujols' original branch.
https:/
I have also uploaded to Scribd a sample of what the output from my version looks like:
http://
Bogdan Marinov (daggerstab) wrote : Posted in a previous version of this proposal | # |
Just a comment - as the feature freeze is in effect, this should be merged only AFTER the release of 0.10.6 this weekend.
Skimming the code, I've noticed several unresolved merge conflicts, with Bazaar conflict markup in the source files.
Pep, if you set Bazaar to use the same e-mail address as the one you use in Launchpad, Launchpad will put a link to your profile page when it lists the revisions that you have committed. (See "Unmerged revisions" bellow: the author is listed as "Propietario", and there is no link.)
I'll build the plug-in and look deeper into the code later.
Pep Pujols (peppujols) wrote : Posted in a previous version of this proposal | # |
> Just a comment - as the feature freeze is in effect, this should be merged only AFTER the release of 0.10.6 this weekend.
>
Ok. No problem.
> Skimming the code, I've noticed several unresolved merge conflicts, with Bazaar conflict markup in the source files.
>
Yes, I should first pull and merge the trunk to my branch (resolving
conflicts) before push my branch to propose to merge?
> Pep, if you set Bazaar to use the same e-mail address as the one you use in Launchpad, Launchpad will put a link to your profile page when it lists the revisions that you have committed. (See "Unmerged revisions" bellow: the author is listed as "Propietario", and there is no link.)
Oh, yeah, I installed the bzr on a new PC and I forget to define my
credentials and EMail. I do it. In the future the new revisions will be
correct.
> I'll build the plug-in and look deeper into the code later.
Thanks.
Pep.
Bogdan Marinov (daggerstab) wrote : | # |
I'll pass this time. There are several issues with the code, some caused by the fact that it has been merged from Timothy Reaves' private branch (for example, the package name, etc.). I can fix them when merging it in the trunk.
What I really want to know is what Fabien thinks about the changes in the core code (in StarMgr) - whether this is the right way to extract such data and if there is a way to make it less intrusive.
treaves (treaves) wrote : | # |
Oops. Forgot the package name. :)
I name them based on the branch so that I can tell which one I have open in the IDE. I wonder if bazaar support macros like some SCM, so that it could be set on branch / checkout.
Pep Pujols (peppujols) wrote : | # |
Ok.
Pep Pujols.
> Review: Abstain
> I'll pass this time. There are several issues with the code, some caused by the fact that it has been merged from Timothy Reaves' private branch (for example, the package name, etc.). I can fix them when merging it in the trunk.
>
> What I really want to know is what Fabien thinks about the changes in the core code (in StarMgr) - whether this is the right way to extract such data and if there is a way to make it less intrusive.
Fabien Chéreau (xalioth) wrote : | # |
Hi, thanks Bogdan for pinging me again and again.. Pep I'm really sorry for not reviewing the code before..
So here are some stuff I saw (I didn't look in detail at the GUI code; but it's OK you're responsible for it):
1- You canot do that!
-PROJECT(
+PROJECT(Printsky)
and that:
- #SET(CMAKE_
+ SET(CMAKE_
2- Do you really need all the #pragma mark xxxx ?
3- You will need to merge from trunk (there are some minor conflicts). I know it's my fault because it tool me too long to review this code :(
4- The changes in StarMgr are not needed I think. All you need is to compute the radius for various stars magnitudes. You should only use the StelSkyDrawer:
In theory you could do everything without touching at the core's code, except the CMakefiles to declare your plugin.
Fabien
- 4715. By Pep Pujols
-
Merge Trunk
- 4716. By Pep Pujols
-
Fixed some points: Invalid defines, removed pragma marks, reallocation owner metod from StarMgr to PrintSkyDialog
- 4717. By Pep Pujols
-
Merged from trunk
Pep Pujols (peppujols) wrote : | # |
Hi.
> So here are some stuff I saw (I didn't look in detail at the GUI code; but it's OK you're responsible for it):
>
> 1- You canot do that!
> -PROJECT(
> +PROJECT(Printsky)
> and that:
> - #SET(CMAKE_
> + SET(CMAKE_
>
Yes, sorry.
> 2- Do you really need all the #pragma mark xxxx ?
No, I removed this code.
> 3- You will need to merge from trunk (there are some minor conflicts). I know it's my fault because it tool me too long to review this code :(
Done.
> 4- The changes in StarMgr are not needed I think. All you need is to compute the radius for various stars magnitudes. You should only use the StelSkyDrawer:
>
>
> In theory you could do everything without touching at the core's code, except the CMakefiles to declare your plugin.
>
Ok. I removed the method from StarMgr and I have placed it in my
pluguin, with simplified code.
I resubmited to proposal to merge again.
Regards.
Pep.
- 4718. By Pep Pujols
-
More simplified method getListMagnitud
eRadius. Small patch to plugin info definition. - 4719. By Pep Pujols
-
Fixed style dialog wrong
- 4720. By Pep Pujols
-
Merged from trunk
- 4721. By Pep Pujols
-
Merged from trunk (atmosphere refraction)
- 4722. By Pep Pujols
-
Added GNU GPL header to the main class.
- 4723. By Pep Pujols
-
Merge from code refactoring
Unmerged revisions
- 4723. By Pep Pujols
-
Merge from code refactoring
- 4722. By Pep Pujols
-
Added GNU GPL header to the main class.
- 4721. By Pep Pujols
-
Merged from trunk (atmosphere refraction)
- 4720. By Pep Pujols
-
Merged from trunk
- 4719. By Pep Pujols
-
Fixed style dialog wrong
- 4718. By Pep Pujols
-
More simplified method getListMagnitud
eRadius. Small patch to plugin info definition. - 4717. By Pep Pujols
-
Merged from trunk
- 4716. By Pep Pujols
-
Fixed some points: Invalid defines, removed pragma marks, reallocation owner metod from StarMgr to PrintSkyDialog
- 4715. By Pep Pujols
-
Merge Trunk
- 4714. By Pep Pujols
-
Merged in trunk, and corrected ISO C++ bug
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2011-01-25 00:02:27 +0000 |
3 | +++ CMakeLists.txt 2011-05-23 18:33:38 +0000 |
4 | @@ -58,18 +58,9 @@ |
5 | IF(APPLE) |
6 | SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-common -Wall -Wextra") |
7 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common -Wall -Wextra -Wno-unused-parameter") |
8 | - |
9 | - # uncomment one of the following, depending on minimum OS level you want |
10 | - #SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.5") |
11 | - #SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk/") |
12 | - #SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6") |
13 | - #SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk/") |
14 | - |
15 | - # uncomment one of the following, depending on what platforms you want. |
16 | - # NOTE: Qt build for Cocoa is Intel only. Qt with Carbon is both, but does not seem |
17 | - # to handle 64bit well. |
18 | - #SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64;ppc;ppc64") |
19 | - #SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64") |
20 | +# SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.5") |
21 | +# SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk/") |
22 | + # Universal binary |
23 | #SET(CMAKE_OSX_ARCHITECTURES "x86_64") |
24 | ENDIF() |
25 | |
26 | @@ -146,6 +137,7 @@ |
27 | SET(USE_PLUGIN_TIMEZONECONFIGURATION 1 CACHE BOOL "Define whether the TimeZoneConfiguration plugin should be created.") |
28 | SET(USE_PLUGIN_VIRGO 0 CACHE BOOL "Define whether the VirGO plugin should be created.") |
29 | SET(USE_PLUGIN_SOLARSYSTEMEDITOR 1 CACHE BOOL "Define whether the Solar System Editor should be built.") |
30 | +SET(USE_PLUGIN_PRINTSKY 1 CACHE BOOL "Define wheter the PrintSky plugin should be created.") |
31 | |
32 | ########## Static plugins need to define includes and libraries |
33 | ########## for the compilation of Stellarium itself |
34 | @@ -153,7 +145,6 @@ |
35 | IF (USE_PLUGIN_SVMT) |
36 | SET(QT_USE_QTXML TRUE) # For SVMT we also need QtXml module |
37 | SET(QT_USE_QTDECLARATIVE TRUE) # For SVMT we also need QML module, this line doesn't seem to work right now |
38 | - SET(QT_USE_QTWEBKIT TRUE) # For SVMT we also need QML module, this line doesn't seem to work right now |
39 | ENDIF() |
40 | |
41 | IF (USE_PLUGIN_VIRGO) |
42 | |
43 | === modified file 'plugins/CMakeLists.txt' |
44 | --- plugins/CMakeLists.txt 2011-01-14 00:10:42 +0000 |
45 | +++ plugins/CMakeLists.txt 2011-05-23 18:33:38 +0000 |
46 | @@ -6,14 +6,20 @@ |
47 | ADD_DEFINITIONS(-DQT_DLL) |
48 | ADD_DEFINITIONS(-D_REENTRANT) |
49 | |
50 | +IF (USE_PLUGIN_HELLOSTELMODULE) |
51 | + ADD_SUBDIRECTORY( HelloStelModule ) |
52 | +ENDIF() |
53 | IF (USE_PLUGIN_ANGLEMEASURE) |
54 | ADD_SUBDIRECTORY( AngleMeasure ) |
55 | ENDIF() |
56 | IF (USE_PLUGIN_COMPASSMARKS) |
57 | ADD_SUBDIRECTORY( CompassMarks ) |
58 | ENDIF() |
59 | -IF (USE_PLUGIN_HELLOSTELMODULE) |
60 | - ADD_SUBDIRECTORY( HelloStelModule ) |
61 | +IF (USE_PLUGIN_SATELLITES) |
62 | + ADD_SUBDIRECTORY( Satellites ) |
63 | +ENDIF() |
64 | +IF (USE_PLUGIN_TELESCOPECONTROL) |
65 | + ADD_SUBDIRECTORY( TelescopeControl ) |
66 | ENDIF() |
67 | IF (USE_PLUGIN_LOGBOOK) |
68 | ADD_SUBDIRECTORY( LogBook ) |
69 | @@ -21,27 +27,23 @@ |
70 | IF (USE_PLUGIN_OCULARS) |
71 | ADD_SUBDIRECTORY( Oculars ) |
72 | ENDIF() |
73 | -IF (USE_PLUGIN_SATELLITES) |
74 | - ADD_SUBDIRECTORY( Satellites ) |
75 | -ENDIF() |
76 | -IF (USE_PLUGIN_SOLARSYSTEMEDITOR) |
77 | - ADD_SUBDIRECTORY( SolarSystemEditor ) |
78 | -ENDIF() |
79 | -IF (USE_PLUGIN_SVMT) |
80 | - SET(SOURCE_SVMT_PATH "../../svmt/" CACHE PATH "The location of the SVMT plugin main directory i.e. the one containing the top level CMakeLists.txt") |
81 | - ADD_SUBDIRECTORY( ${SOURCE_SVMT_PATH} svmt ) |
82 | -ENDIF() |
83 | -IF (USE_PLUGIN_TELESCOPECONTROL) |
84 | - ADD_SUBDIRECTORY( TelescopeControl ) |
85 | -ENDIF() |
86 | IF (USE_PLUGIN_TEXTUSERINTERFACE) |
87 | ADD_SUBDIRECTORY( TextUserInterface ) |
88 | ENDIF() |
89 | IF (USE_PLUGIN_TIMEZONECONFIGURATION) |
90 | ADD_SUBDIRECTORY( TimeZoneConfiguration ) |
91 | ENDIF() |
92 | +IF (USE_PLUGIN_SVMT) |
93 | + SET(SOURCE_SVMT_PATH "../../svmt/" CACHE PATH "The location of the SVMT plugin main directory i.e. the one containing the top level CMakeLists.txt") |
94 | + ADD_SUBDIRECTORY( ${SOURCE_SVMT_PATH} svmt ) |
95 | +ENDIF() |
96 | IF (USE_PLUGIN_VIRGO) |
97 | SET(VIRGO_PROJECT_PATH "../extmodules/VirGO/" CACHE PATH "The location of the VirGO plugin main directory i.e. the one containing the top level CMakeLists.txt") |
98 | ADD_SUBDIRECTORY( ${VIRGO_PROJECT_PATH} VirGO ) |
99 | ENDIF() |
100 | - |
101 | +IF (USE_PLUGIN_SOLARSYSTEMEDITOR) |
102 | + ADD_SUBDIRECTORY( SolarSystemEditor ) |
103 | +ENDIF() |
104 | +IF (USE_PLUGIN_PRINTSKY) |
105 | + ADD_SUBDIRECTORY( PrintSky ) |
106 | +ENDIF() |
107 | |
108 | === added directory 'plugins/PrintSky' |
109 | === added file 'plugins/PrintSky/CMakeLists.txt' |
110 | --- plugins/PrintSky/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
111 | +++ plugins/PrintSky/CMakeLists.txt 2011-05-23 18:33:38 +0000 |
112 | @@ -0,0 +1,11 @@ |
113 | +# This is the cmake config file for the PrintSky plugin |
114 | +SET(PRINTSKY_VERSION "0.1.0") |
115 | + |
116 | +ADD_SUBDIRECTORY( src ) |
117 | + |
118 | +IF(APPLE) |
119 | + SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/Library/Application\ Support/Stellarium) |
120 | +ElSE(APPLE) |
121 | + SET(CMAKE_INSTALL_PREFIX $ENV{HOME}/.stellarium) |
122 | +ENDIF(APPLE) |
123 | +INSTALL(FILES DESTINATION "modules/PrintSky") |
124 | |
125 | === added file 'plugins/PrintSky/PrintSky.qrc' |
126 | --- plugins/PrintSky/PrintSky.qrc 1970-01-01 00:00:00 +0000 |
127 | +++ plugins/PrintSky/PrintSky.qrc 2011-05-23 18:33:38 +0000 |
128 | @@ -0,0 +1,6 @@ |
129 | +<RCC> |
130 | + <qresource prefix="printsky"> |
131 | + <file>nightStyle.css</file> |
132 | + <file>normalStyle.css</file> |
133 | + </qresource> |
134 | +</RCC> |
135 | |
136 | === added file 'plugins/PrintSky/nightStyle.css' |
137 | --- plugins/PrintSky/nightStyle.css 1970-01-01 00:00:00 +0000 |
138 | +++ plugins/PrintSky/nightStyle.css 2011-05-23 18:33:38 +0000 |
139 | @@ -0,0 +1,31 @@ |
140 | +QTabBar { |
141 | + border: none; |
142 | + margin: 0px; |
143 | + padding: 0px; |
144 | + font-weight: bold; |
145 | + color: rgb(120, 0, 0); |
146 | + background-color: rgb(22, 0, 0); |
147 | + font-size: 14px; |
148 | +} |
149 | + |
150 | +QTabBar::tab { |
151 | + border: 0px; |
152 | + margin: 0px; |
153 | + padding: 4px 1ex; |
154 | + min-height: 28px; |
155 | + /*font-size: 14px; <-- Causes text being cut by the frame*/ |
156 | +} |
157 | + |
158 | +QTabBar::tab:selected { |
159 | + border: none; |
160 | + margin: 0px; |
161 | + border-top-left-radius: 10px; |
162 | + border-top-right-radius: 10px; |
163 | + color: rgb(220, 0, 0); |
164 | + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(68, 0, 0), stop: 1 rgb(86, 0, 0)); |
165 | +} |
166 | + |
167 | +QTabWidget::pane { |
168 | + margin-top: 0px; |
169 | + border-top: none; |
170 | +} |
171 | |
172 | === added file 'plugins/PrintSky/normalStyle.css' |
173 | --- plugins/PrintSky/normalStyle.css 1970-01-01 00:00:00 +0000 |
174 | +++ plugins/PrintSky/normalStyle.css 2011-05-23 18:33:38 +0000 |
175 | @@ -0,0 +1,31 @@ |
176 | +QTabBar { |
177 | + border: none; |
178 | + margin: 0px; |
179 | + padding: 0px; |
180 | + font-weight: bold; |
181 | + color: rgb(170, 173, 164); |
182 | + background-color: rgb(31, 31, 31); |
183 | + font-size: 14px; |
184 | +} |
185 | + |
186 | +QTabBar::tab { |
187 | + border: 0px; |
188 | + margin: 0px; |
189 | + padding: 4px 1ex; |
190 | + min-height: 28px; |
191 | + /*font-size: 14px; <-- Causes text being cut by the frame*/ |
192 | +} |
193 | + |
194 | +QTabBar::tab:selected { |
195 | + border: none; |
196 | + margin: 0px; |
197 | + border-top-left-radius: 10px; |
198 | + border-top-right-radius: 10px; |
199 | + color: rgb(220, 223, 214); |
200 | + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(68, 69, 72), stop: 1 rgb(86, 87, 90)); |
201 | +} |
202 | + |
203 | +QTabWidget::pane { |
204 | + margin-top: 0px; |
205 | + border-top: none; |
206 | +} |
207 | |
208 | === added directory 'plugins/PrintSky/src' |
209 | === added file 'plugins/PrintSky/src/CMakeLists.txt' |
210 | --- plugins/PrintSky/src/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
211 | +++ plugins/PrintSky/src/CMakeLists.txt 2011-05-23 18:33:38 +0000 |
212 | @@ -0,0 +1,69 @@ |
213 | +INCLUDE_DIRECTORIES( |
214 | + . |
215 | + gui |
216 | + ${CMAKE_BINARY_DIR}/plugins/PrintSky/src |
217 | +) |
218 | +LINK_DIRECTORIES(${BUILD_DIR}/src) |
219 | + |
220 | +SET(PrintSky_SRCS |
221 | + PrintSky.hpp |
222 | + PrintSky.cpp |
223 | + gui/PrintSkyDialog.hpp |
224 | + gui/PrintSkyDialog.cpp |
225 | + gui/StelDialogPrintSky.hpp |
226 | + gui/StelDialogPrintSky.cpp |
227 | + ) |
228 | + |
229 | +################# compiles resources files ############ |
230 | +SET(PrintSky_RES ../PrintSky.qrc) |
231 | +QT4_ADD_RESOURCES(PrintSky_RES_CXX ${PrintSky_RES}) |
232 | + |
233 | +################# compiles .ui files ############ |
234 | +SET(PrintSky_UIS |
235 | + gui/printskyDialog.ui |
236 | +) |
237 | +QT4_WRAP_UI(PrintSky_UIS_H ${PrintSky_UIS}) |
238 | + |
239 | +# Add here all the files which require moc compilation |
240 | +# that is, all the headers with SIGNAL/SLOTS/PLUGIN_INTERFACE etc.. |
241 | +SET(PrintSky_MOC_HDRS |
242 | + PrintSky.hpp |
243 | + gui/PrintSkyDialog.hpp |
244 | + gui/StelDialogPrintSky.hpp |
245 | + ) |
246 | + |
247 | +# After this call, PrintSky_MOC_SRCS = moc_PrintSky.cxx |
248 | +QT4_WRAP_CPP(PrintSky_MOC_SRCS ${PrintSky_MOC_HDRS}) |
249 | + |
250 | +SET(extLinkerOption ${QT_LIBRARIES} ${FreeType2_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES} ${ICONV_LIBRARIES} ${INTL_LIBRARIES}) |
251 | + |
252 | +############### For building the dynamic library ###################### |
253 | +IF(BUILD_DYNAMIC_PLUGINS) |
254 | + ADD_LIBRARY(PrintSky MODULE ${PrintSky_SRCS} ${PrintSky_MOC_SRCS} ${PrintSky_RES_CXX} ${PrintSky_UIS_H}) |
255 | + IF(APPLE) |
256 | + FIND_LIBRARY(OPENGL_LIBRARY OpenGL) |
257 | + MARK_AS_ADVANCED(OPENGL_LIBRARY) |
258 | + SET_TARGET_PROPERTIES(PrintSky PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" SUFFIX ".dylib") |
259 | + ENDIF(APPLE) |
260 | + |
261 | + IF(WIN32) |
262 | + SET_TARGET_PROPERTIES(PrintSky PROPERTIES LINK_FLAGS "-enable-runtime-pseudo-reloc -Wl,--allow-multiple-definition" ) |
263 | + SET(StelMain stelMain) |
264 | + ELSE(WIN32) |
265 | + SET(StelMain ) |
266 | + ENDIF(WIN32) |
267 | + |
268 | + TARGET_LINK_LIBRARIES(PrintSky ${StelMain} ${extLinkerOption}) |
269 | + INSTALL(TARGETS PrintSky DESTINATION "modules/${PACKAGE}") |
270 | +ENDIF() |
271 | + |
272 | +############### For building the static library ###################### |
273 | +IF(BUILD_STATIC_PLUGINS) |
274 | + ADD_LIBRARY(PrintSky-static STATIC ${PrintSky_SRCS} ${PrintSky_MOC_SRCS} ${PrintSky_RES_CXX} ${PrintSky_UIS_H}) |
275 | + # The library target "PrintSky-static" has a default OUTPUT_NAME of "PrintSky-static", so change it. |
276 | + SET_TARGET_PROPERTIES(PrintSky-static PROPERTIES OUTPUT_NAME "PrintSky") |
277 | + TARGET_LINK_LIBRARIES(PrintSky-static ${extLinkerOption}) |
278 | + SET_TARGET_PROPERTIES(PrintSky-static PROPERTIES COMPILE_FLAGS "-fPIC -DQT_STATICPLUGIN") |
279 | + ADD_DEPENDENCIES(AllStaticPlugins PrintSky-static) |
280 | +ENDIF() |
281 | + |
282 | |
283 | === added file 'plugins/PrintSky/src/PrintSky.cpp' |
284 | --- plugins/PrintSky/src/PrintSky.cpp 1970-01-01 00:00:00 +0000 |
285 | +++ plugins/PrintSky/src/PrintSky.cpp 2011-05-23 18:33:38 +0000 |
286 | @@ -0,0 +1,171 @@ |
287 | +#include <QDebug> |
288 | +#include <QKeyEvent> |
289 | +#include "StelProjector.hpp" |
290 | +#include "StelPainter.hpp" |
291 | +#include "StelApp.hpp" |
292 | +#include "StelCore.hpp" |
293 | +#include "StelFileMgr.hpp" |
294 | +#include "StelLocaleMgr.hpp" |
295 | +#include "StelModuleMgr.hpp" |
296 | +#include "StelGui.hpp" |
297 | +#include "StelGuiItems.hpp" |
298 | +#include "StelIniParser.hpp" |
299 | +#include "StelVertexArray.hpp" |
300 | +#include "PrintSky.hpp" |
301 | +#include <QAction> |
302 | +#include "StelMainGraphicsView.hpp" |
303 | +#include <QGLWidget> |
304 | + |
305 | +//! This method is the one called automatically by the StelModuleMgr just |
306 | +//! after loading the dynamic library |
307 | +StelModule* PrintSkyStelPluginInterface::getStelModule() const |
308 | +{ |
309 | + return new PrintSky(); |
310 | +} |
311 | + |
312 | +StelPluginInfo PrintSkyStelPluginInterface::getPluginInfo() const |
313 | +{ |
314 | + // Allow to load the resources when used as a static plugin |
315 | + Q_INIT_RESOURCE(PrintSky); |
316 | + |
317 | + StelPluginInfo info; |
318 | + info.id = "PrintSky"; |
319 | + info.displayedName = "Print Sky"; |
320 | + info.authors = "Pep Pujols"; |
321 | + info.contact = "maslarocaxica@gmail.com"; |
322 | + info.description = "Provides an system printing sky"; |
323 | + return info; |
324 | +} |
325 | + |
326 | +Q_EXPORT_PLUGIN2(PrintSky, PrintSkyStelPluginInterface) |
327 | + |
328 | +PrintSky::PrintSky() |
329 | +{ |
330 | + setObjectName("PrintSky"); |
331 | + useInvertColors=scaleToFit=false; |
332 | + printData=true; |
333 | +} |
334 | + |
335 | +PrintSky::~PrintSky() |
336 | +{ |
337 | + delete printskyDialog; |
338 | + printskyDialog = NULL; |
339 | +} |
340 | + |
341 | +void PrintSky::init() |
342 | +{ |
343 | + printskyDialog = new PrintSkyDialog(); |
344 | + |
345 | + // create action for enable/disable & hook up signals |
346 | + StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); |
347 | + Q_ASSERT(gui); |
348 | + |
349 | + gui->addGuiActions("actionInit_Printing_Sky", N_("Printing Sky"), "Ctrl+P", "Plugin Key Bindings", true, false); |
350 | + gui->getGuiActions("actionInit_Printing_Sky")->setChecked(true); |
351 | + connect(gui->getGuiActions("actionInit_Printing_Sky"), SIGNAL(triggered()), this, SLOT(initPrintingSky())); |
352 | + |
353 | + try |
354 | + { |
355 | + //Make sure that "/modules/PrintSky" exists |
356 | + StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir() + "/modules/PrintSky/"); |
357 | + |
358 | + StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable); |
359 | + QString printskyIniPath = StelFileMgr::findFile("modules/PrintSky/", flags) + "printsky.ini"; |
360 | + |
361 | + QSettings settings(printskyIniPath, QSettings::IniFormat); |
362 | + useInvertColors = settings.value("use_invert_colors", 0.0).toBool(); |
363 | + scaleToFit=settings.value("use_scale_to_fit", true).toBool(); |
364 | + orientation=settings.value("orientation", "Portrait").toString(); |
365 | + printData=settings.value("print_data", true).toBool(); |
366 | + printSSEphemerides=settings.value("print_SS_ephemerides", true).toBool(); |
367 | + } |
368 | + catch (std::runtime_error& e) |
369 | + { |
370 | + qWarning() << "WARNING: unable to locate printsky.ini file or create a default one for PrintSky plugin: " << e.what(); |
371 | + } |
372 | + |
373 | + //Load the module's custom style sheets |
374 | + QFile styleSheetFile; |
375 | + styleSheetFile.setFileName(":/printsky/normalStyle.css"); |
376 | + if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) |
377 | + { |
378 | + normalStyleSheet = styleSheetFile.readAll(); |
379 | + } |
380 | + styleSheetFile.close(); |
381 | + styleSheetFile.setFileName(":/printsky/nightStyle.css"); |
382 | + if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) |
383 | + { |
384 | + nightStyleSheet = styleSheetFile.readAll(); |
385 | + } |
386 | + styleSheetFile.close(); |
387 | + |
388 | +} |
389 | + |
390 | +void PrintSky::update(double deltaTime) |
391 | +{ |
392 | +} |
393 | + |
394 | +//! Draw any parts on the screen which are for our module |
395 | +void PrintSky::draw(StelCore* core) |
396 | +{ |
397 | +} |
398 | + |
399 | +//! Determine which "layer" the plagin's drawing will happen on. |
400 | +double PrintSky::getCallOrder(StelModuleActionName actionName) const |
401 | +{ |
402 | + return 0; |
403 | +} |
404 | + |
405 | +void PrintSky::handleKeys(QKeyEvent* event) |
406 | +{ |
407 | + event->setAccepted(false); |
408 | +} |
409 | + |
410 | +void PrintSky::handleMouseClicks(class QMouseEvent* event) |
411 | +{ |
412 | + event->setAccepted(false); |
413 | + |
414 | +} |
415 | + |
416 | +bool PrintSky::handleMouseMoves(int x, int y, Qt::MouseButtons b) |
417 | +{ |
418 | + return false; |
419 | +} |
420 | + |
421 | +//! Show dialog printing enabling preview and print buttons |
422 | +void PrintSky::initPrintingSky() |
423 | +{ |
424 | + printskyDialog->setVisible(true); |
425 | + printskyDialog->enableOutputOptions(true); |
426 | +} |
427 | + |
428 | + |
429 | +const StelStyle PrintSky::getModuleStyleSheet(const StelStyle& style) |
430 | +{ |
431 | + StelStyle pluginStyle(style); |
432 | + if (style.confSectionName == "color") |
433 | + { |
434 | + pluginStyle.qtStyleSheet.append(normalStyleSheet); |
435 | + } |
436 | + else |
437 | + { |
438 | + pluginStyle.qtStyleSheet.append(nightStyleSheet); |
439 | + } |
440 | + return pluginStyle; |
441 | +} |
442 | + |
443 | +void PrintSky::setStelStyle(const QString& section) |
444 | +{ |
445 | + printskyDialog->updateStyle(); |
446 | +} |
447 | + |
448 | +bool PrintSky::configureGui(bool show) |
449 | +{ |
450 | + if (show) |
451 | + { |
452 | + printskyDialog->setVisible(true); |
453 | + printskyDialog->enableOutputOptions(false); |
454 | + } |
455 | + |
456 | + return true; |
457 | +} |
458 | |
459 | === added file 'plugins/PrintSky/src/PrintSky.hpp' |
460 | --- plugins/PrintSky/src/PrintSky.hpp 1970-01-01 00:00:00 +0000 |
461 | +++ plugins/PrintSky/src/PrintSky.hpp 2011-05-23 18:33:38 +0000 |
462 | @@ -0,0 +1,70 @@ |
463 | +#ifndef PrintSky_H |
464 | +#define PrintSky_H |
465 | + |
466 | +#include "StelModule.hpp" |
467 | +#include <QPrinter> |
468 | +#include <QPrintPreviewWidget> |
469 | +#include <QPrintPreviewDialog> |
470 | +#include "StelStyle.hpp" |
471 | +#include "PrintSkyDialog.hpp" |
472 | + |
473 | +//class PrintSky |
474 | +class PrintSky : public StelModule |
475 | +{ |
476 | + Q_OBJECT |
477 | +public: |
478 | + PrintSky(); |
479 | + virtual ~PrintSky(); |
480 | + |
481 | + |
482 | + /////////////////////////////////////////////////////////////////////////// |
483 | + // Methods defined in the StelModule class |
484 | + virtual void init(); |
485 | + virtual bool configureGui(bool show=true); |
486 | + virtual void update(double deltaTime); |
487 | + virtual void draw(StelCore* core); |
488 | + virtual double getCallOrder(StelModuleActionName actionName) const; |
489 | + virtual void handleKeys(class QKeyEvent* event); |
490 | + virtual void handleMouseClicks(class QMouseEvent* event); |
491 | + virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b); |
492 | + virtual void setStelStyle(const QString& style); |
493 | + |
494 | + //! Returns the module-specific style sheet. |
495 | + //! The main StelStyle instance should be passed. |
496 | + const StelStyle getModuleStyleSheet(const StelStyle& style); |
497 | + |
498 | +public slots: |
499 | + |
500 | + //! Show dialog printing enabling preview and print buttons |
501 | + void initPrintingSky(); |
502 | + |
503 | +private slots: |
504 | + |
505 | +private: |
506 | + |
507 | + //Styles |
508 | + QByteArray normalStyleSheet; |
509 | + QByteArray nightStyleSheet; |
510 | + |
511 | + //Printing options |
512 | + bool useInvertColors, scaleToFit, printData, printSSEphemerides; |
513 | + QString orientation; |
514 | + |
515 | + PrintSkyDialog *printskyDialog; |
516 | +}; |
517 | + |
518 | +#include "fixx11h.h" |
519 | +#include <QObject> |
520 | +#include "StelPluginInterface.hpp" |
521 | + |
522 | +//! This class is used by Qt to manage a plug-in interface |
523 | +class PrintSkyStelPluginInterface : public QObject, public StelPluginInterface |
524 | +{ |
525 | + Q_OBJECT |
526 | + Q_INTERFACES(StelPluginInterface) |
527 | +public: |
528 | + virtual StelModule* getStelModule() const; |
529 | + virtual StelPluginInfo getPluginInfo() const; |
530 | + }; |
531 | + |
532 | +#endif // PrintSky_H |
533 | |
534 | === added directory 'plugins/PrintSky/src/gui' |
535 | === added file 'plugins/PrintSky/src/gui/PrintSkyDialog.cpp' |
536 | --- plugins/PrintSky/src/gui/PrintSkyDialog.cpp 1970-01-01 00:00:00 +0000 |
537 | +++ plugins/PrintSky/src/gui/PrintSkyDialog.cpp 2011-05-23 18:33:38 +0000 |
538 | @@ -0,0 +1,611 @@ |
539 | +/* |
540 | + * Copyright (C) 2010 Pep Pujols |
541 | + * |
542 | + * This program is free software; you can redistribute it and/or |
543 | + * modify it under the terms of the GNU General Public License |
544 | + * as published by the Free Software Foundation; either version 2 |
545 | + * of the License, or (at your option) any later version. |
546 | + * |
547 | + * This program is distributed in the hope that it will be useful, |
548 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
549 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
550 | + * GNU General Public License for more details. |
551 | + * |
552 | + * You should have received a copy of the GNU General Public License |
553 | + * along with this program; if not, write to the Free Software |
554 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
555 | + */ |
556 | + |
557 | +#include "PrintSkyDialog.hpp" |
558 | +#include "ui_printskyDialog.h" |
559 | +#include "PrintSky.hpp" |
560 | +#include <QAction> |
561 | +#include <QGLWidget> |
562 | +#include <QPrintDialog> |
563 | +#include <QTimer> |
564 | +#include <QGraphicsWidget> |
565 | + |
566 | +#include "StelApp.hpp" |
567 | +#include "StelGui.hpp" |
568 | +#include "StelFileMgr.hpp" |
569 | +#include "StelModuleMgr.hpp" |
570 | +#include "StelMainGraphicsView.hpp" |
571 | +#include "StelTranslator.hpp" |
572 | +#include "StelNavigator.hpp" |
573 | +#include "StelCore.hpp" |
574 | +#include "StelLocaleMgr.hpp" |
575 | +#include "StelMovementMgr.hpp" |
576 | +#include "StelSkyDrawer.hpp" |
577 | +#include "StarMgr.hpp" |
578 | +#include "SolarSystem.hpp" |
579 | +#include "Planet.hpp" |
580 | + |
581 | +#include <QDataWidgetMapper> |
582 | +#include <QDebug> |
583 | +#include <QFrame> |
584 | +#include <QSettings> |
585 | + |
586 | + |
587 | +PrintSkyDialog::PrintSkyDialog() |
588 | +{ |
589 | + ui = new Ui_printskyDialogForm; |
590 | +} |
591 | + |
592 | +PrintSkyDialog::~PrintSkyDialog() |
593 | +{ |
594 | + //These exist only if the window has been shown once: |
595 | + if (dialog) |
596 | + { |
597 | + } |
598 | + |
599 | + delete ui; |
600 | + ui = NULL; |
601 | + |
602 | +} |
603 | + |
604 | +/* ********************************************************************* */ |
605 | +void PrintSkyDialog::languageChanged() |
606 | +{ |
607 | + if (dialog) { |
608 | + ui->retranslateUi(dialog); |
609 | + } |
610 | +} |
611 | + |
612 | +void PrintSkyDialog::updateStyle() |
613 | +{ |
614 | + if(dialog) { |
615 | + gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); |
616 | + Q_ASSERT(gui); |
617 | + const StelStyle pluginStyle = GETSTELMODULE(PrintSky)->getModuleStyleSheet(gui->getStelStyle()); |
618 | + dialog->setStyleSheet(pluginStyle.qtStyleSheet); |
619 | + //ui->textBrowser->document()->setDefaultStyleSheet(QString(pluginStyle.htmlStyleSheet)); |
620 | + } |
621 | +} |
622 | + |
623 | +void PrintSkyDialog::styleChanged() |
624 | +{ |
625 | + // Nothing for now |
626 | +} |
627 | + |
628 | +/* ********************************************************************* */ |
629 | +void PrintSkyDialog::closeWindow() |
630 | +{ |
631 | + setVisible(false); |
632 | + StelMainGraphicsView::getInstance().scene()->setActiveWindow(0); |
633 | +} |
634 | + |
635 | + |
636 | +/* ********************************************************************* */ |
637 | +void PrintSkyDialog::invertColorsStateChanged(int state) |
638 | +{ |
639 | + bool shouldInvert = (state == Qt::Checked); |
640 | + |
641 | + try |
642 | + { |
643 | + StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable); |
644 | + QString printskyIniPath = StelFileMgr::findFile("modules/PrintSky/", flags) + "printsky.ini"; |
645 | + QSettings settings(printskyIniPath, QSettings::IniFormat); |
646 | + bool useInvertColors = settings.value("use_invert_colors", 0.0).toBool(); |
647 | + if (state != useInvertColors) |
648 | + { |
649 | + settings.setValue("use_invert_colors", shouldInvert); |
650 | + emit(invertColorsChanged(shouldInvert)); |
651 | + } |
652 | + } |
653 | + catch (std::runtime_error& e) |
654 | + { |
655 | + qWarning() << "WARNING: unable to locate printsky.ini file or create a default one for PrintSky plugin: " << e.what(); |
656 | + } |
657 | + |
658 | +} |
659 | + |
660 | +/* ********************************************************************* */ |
661 | +void PrintSkyDialog::scaleToFitStateChanged(int state) |
662 | +{ |
663 | + bool shouldScale = (state == Qt::Checked); |
664 | + |
665 | + try |
666 | + { |
667 | + StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable); |
668 | + QString printskyIniPath = StelFileMgr::findFile("modules/PrintSky/", flags) + "printsky.ini"; |
669 | + QSettings settings(printskyIniPath, QSettings::IniFormat); |
670 | + bool useScaleToFit = settings.value("use_scale_to_fit", 0.0).toBool(); |
671 | + if (state != useScaleToFit) |
672 | + { |
673 | + settings.setValue("use_scale_to_fit", shouldScale); |
674 | + emit(scaleToFitChanged(shouldScale)); |
675 | + } |
676 | + } |
677 | + catch (std::runtime_error& e) |
678 | + { |
679 | + qWarning() << "WARNING: unable to locate printsky.ini file or create a default one for PrintSky plugin: " << e.what(); |
680 | + } |
681 | + |
682 | +} |
683 | + |
684 | +/* ********************************************************************* */ |
685 | +void PrintSkyDialog::orientationStateChanged(bool state) |
686 | +{ |
687 | + QString newOrientation=(ui->orientationPortraitRadioButton->isChecked()? "Portrait": "Landscape"); |
688 | + |
689 | + try |
690 | + { |
691 | + StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable); |
692 | + QString printskyIniPath = StelFileMgr::findFile("modules/PrintSky/", flags) + "printsky.ini"; |
693 | + QSettings settings(printskyIniPath, QSettings::IniFormat); |
694 | + QString currentOrientation = settings.value("orientation", "Portrait").toString(); |
695 | + if (newOrientation != currentOrientation) |
696 | + { |
697 | + settings.setValue("orientation", newOrientation); |
698 | + emit(orientationChanged(true)); |
699 | + } |
700 | + } |
701 | + catch (std::runtime_error& e) |
702 | + { |
703 | + qWarning() << "WARNING: unable to locate printsky.ini file or create a default one for PrintSky plugin: " << e.what(); |
704 | + } |
705 | + |
706 | +} |
707 | + |
708 | +/* ********************************************************************* */ |
709 | +void PrintSkyDialog::printDataStateChanged(int state) |
710 | +{ |
711 | + bool shouldPrint = (state == Qt::Checked); |
712 | + |
713 | + try |
714 | + { |
715 | + StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable); |
716 | + QString printskyIniPath = StelFileMgr::findFile("modules/PrintSky/", flags) + "printsky.ini"; |
717 | + QSettings settings(printskyIniPath, QSettings::IniFormat); |
718 | + bool printData = settings.value("print_data", 0.0).toBool(); |
719 | + if (state != printData) |
720 | + { |
721 | + settings.setValue("print_data", shouldPrint); |
722 | + emit(printDataChanged(shouldPrint)); |
723 | + } |
724 | + } |
725 | + catch (std::runtime_error& e) |
726 | + { |
727 | + qWarning() << "WARNING: unable to locate printsky.ini file or create a default one for PrintSky plugin: " << e.what(); |
728 | + } |
729 | + |
730 | +} |
731 | + |
732 | +/* ********************************************************************* */ |
733 | +void PrintSkyDialog::printSSEphemeridesStateChanged(int state) |
734 | +{ |
735 | + bool shouldPrint = (state == Qt::Checked); |
736 | + |
737 | + try |
738 | + { |
739 | + StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable); |
740 | + QString printskyIniPath = StelFileMgr::findFile("modules/PrintSky/", flags) + "printsky.ini"; |
741 | + QSettings settings(printskyIniPath, QSettings::IniFormat); |
742 | + bool printSSEphemerides = settings.value("print_SS_ephemerides", 0.0).toBool(); |
743 | + if (state != printSSEphemerides) |
744 | + { |
745 | + settings.setValue("print_SS_ephemerides", shouldPrint); |
746 | + emit(printSSEphemeridesChanged(shouldPrint)); |
747 | + } |
748 | + } |
749 | + catch (std::runtime_error& e) |
750 | + { |
751 | + qWarning() << "WARNING: unable to locate printsky.ini file or create a default one for PrintSky plugin: " << e.what(); |
752 | + } |
753 | + |
754 | +} |
755 | + |
756 | + |
757 | +/* ********************************************************************* */ |
758 | +void PrintSkyDialog::createDialogContent() |
759 | +{ |
760 | + |
761 | + ui->setupUi(dialog); |
762 | + |
763 | + //Now the rest of the actions. |
764 | + connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); |
765 | + connect(ui->invertColorsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(invertColorsStateChanged(int))); |
766 | + connect(ui->scaleToFitCheckBox, SIGNAL(stateChanged(int)), this, SLOT(scaleToFitStateChanged(int))); |
767 | + connect(ui->previewSkyPushButton, SIGNAL(clicked()), this, SLOT(previewSky())); |
768 | + connect(ui->printSkyPushButton, SIGNAL(clicked()), this, SLOT(printSky())); |
769 | + connect(ui->orientationPortraitRadioButton, SIGNAL(toggled(bool)), this, SLOT(orientationStateChanged(bool))); |
770 | + connect(ui->printDataCheckBox, SIGNAL(stateChanged(int)), this, SLOT(printDataStateChanged(int))); |
771 | + connect(ui->printSSEphemeridesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(printSSEphemeridesStateChanged(int))); |
772 | + |
773 | + // set the initial state |
774 | + try |
775 | + { |
776 | + StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable); |
777 | + QString printskyIniPath = StelFileMgr::findFile("modules/PrintSky/", flags) + "printsky.ini"; |
778 | + QSettings settings(printskyIniPath, QSettings::IniFormat); |
779 | + bool useInvertColors = settings.value("use_invert_colors", false).toBool(); |
780 | + if (useInvertColors) |
781 | + { |
782 | + ui->invertColorsCheckBox->setCheckState(Qt::Checked); |
783 | + } |
784 | + bool useScaleToFit = settings.value("use_scale_to_fit", true).toBool(); |
785 | + if (useScaleToFit) |
786 | + { |
787 | + ui->scaleToFitCheckBox->setCheckState(Qt::Checked); |
788 | + } |
789 | + QString orientation=settings.value("orientation", "Portrait").toString(); |
790 | + if (orientation=="Portrait") |
791 | + ui->orientationPortraitRadioButton->setChecked(true); |
792 | + if (orientation=="Landscape") |
793 | + ui->orientationLandscapeRadioButton->setChecked(true); |
794 | + bool printData = settings.value("print_data", true).toBool(); |
795 | + if (printData) |
796 | + { |
797 | + ui->printDataCheckBox->setCheckState(Qt::Checked); |
798 | + } |
799 | + bool printSSEphemerides = settings.value("print_SS_ephemerides", true).toBool(); |
800 | + if (printSSEphemerides) |
801 | + { |
802 | + ui->printSSEphemeridesCheckBox->setCheckState(Qt::Checked); |
803 | + } |
804 | + |
805 | + } |
806 | + catch (std::runtime_error& e) |
807 | + { |
808 | + qWarning() << "WARNING: unable to locate printsky.ini file or create a default one for PrintSky plugin: " << e.what(); |
809 | + } |
810 | + |
811 | + |
812 | + //Initialize the style |
813 | + updateStyle(); |
814 | +} |
815 | + |
816 | +//! Print report on a preview window |
817 | +void PrintSkyDialog::previewSky() |
818 | +{ |
819 | + currentVisibilityGui = gui->getVisible(); |
820 | + gui->setVisible(false); |
821 | + dialog->setVisible(false); |
822 | + |
823 | + outputOption = true; |
824 | + |
825 | + QTimer::singleShot(50, this, SLOT(executePrinterOutputOption())); |
826 | +} |
827 | + |
828 | +//! Draw contents report |
829 | +void PrintSkyDialog::printDataSky(QPrinter * printer) |
830 | +{ |
831 | + QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); |
832 | + |
833 | + QPainter painter(printer); |
834 | + |
835 | + QGLWidget* glQGLWidget=(QGLWidget *) StelMainGraphicsView::getInstance().getStelQGLWidget(); |
836 | + Q_ASSERT(glQGLWidget); |
837 | + |
838 | + |
839 | + QImage img=glQGLWidget->grabFrameBuffer(); |
840 | + |
841 | + int imageYPos=(printDataOption? 400: 0); |
842 | + |
843 | + QSize sizeReal=printer->pageRect().size(); |
844 | + sizeReal.setHeight(sizeReal.height()-imageYPos); |
845 | + |
846 | + if (scaleToFitOption) |
847 | + img=img.scaled(sizeReal, Qt::KeepAspectRatio, Qt::SmoothTransformation); |
848 | + |
849 | + if (invertColorsOption) |
850 | + img.invertPixels(); |
851 | + |
852 | + int imageXPos=(printer->pageRect().width()-img.width())/2; |
853 | + |
854 | + painter.drawImage(imageXPos, 0, img); |
855 | + |
856 | + StelCore* core = StelApp::getInstance().getCore(); |
857 | + StelLocation locationData=core->getNavigator()->getCurrentLocation(); |
858 | + double jd = core->getNavigator()->getJDay(); |
859 | + |
860 | + QFont font("DejaVu Sans", 10, QFont::Normal); |
861 | + font.setPixelSize(printer->pageRect().width()/60); |
862 | + painter.setFont(font); |
863 | + int lineSpacing=font.pixelSize()+5; |
864 | + |
865 | + //qDebug() << "PrintSky: printer debugging information:"; |
866 | + //qDebug() << "Current printer resolution:" << printer->resolution(); |
867 | + //qDebug() << "Supported printer resolutions:" << printer->supportedResolutions(); |
868 | + //qDebug() << "Page size (size index, 0-30)" << printer->paperSize(); |
869 | + //For the paper size index, see http://doc.qt.nokia.com/qprinter.html#PaperSize-enum |
870 | + //qDebug() << "Pixel Size:" << font.pixelSize(); |
871 | + //qDebug() << "Paper Rect: "<< printer->paperRect(); |
872 | + //qDebug() << "Page Rect: "<< printer->pageRect(); |
873 | + |
874 | + if (printDataOption) |
875 | + { |
876 | + int posY=img.height()+lineSpacing; |
877 | + |
878 | + QRect surfaceData(printer->pageRect().left(), posY, printer->pageRect().width(), printer->pageRect().height()-posY); |
879 | + |
880 | + painter.drawText(surfaceData.adjusted(0, 0, 0, -(surfaceData.height()-lineSpacing)), Qt::AlignCenter, "CHART INFORMATION"); |
881 | + |
882 | + QString printLatitude=StelUtils::radToDmsStr((std::fabs(locationData.latitude)/180.)*M_PI); |
883 | + QString printLongitude=StelUtils::radToDmsStr((std::fabs(locationData.longitude)/180.)*M_PI); |
884 | + |
885 | + QString location = QString("Location: %1\t%2\t%3\t%4\t%5\t%6m") |
886 | + .arg(locationData.name) |
887 | + .arg(locationData.country) |
888 | + .arg(locationData.planetName) |
889 | + .arg(locationData.latitude<0 ? QString("%1S").arg(printLatitude) : QString("%1N").arg(printLatitude)) |
890 | + .arg(locationData.longitude<0 ? QString("%1W").arg(printLongitude) : QString("%1E").arg(printLongitude)) |
891 | + .arg(locationData.altitude); |
892 | + painter.drawText(surfaceData.adjusted(50, lineSpacing, 0, 0), Qt::AlignLeft, location); |
893 | + |
894 | + QString time="Local time: "; |
895 | + QString newDate = StelApp::getInstance().getLocaleMgr().getPrintableDateLocal(jd) +" " |
896 | + +StelApp::getInstance().getLocaleMgr().getPrintableTimeLocal(jd)+QString(" (GMT%1%2)").arg(StelApp::getInstance().getLocaleMgr().getGMTShift(jd)>=0? '+':'-').arg(StelApp::getInstance().getLocaleMgr().getGMTShift(jd)); |
897 | + time+=newDate; |
898 | + painter.drawText(surfaceData.adjusted(50, (lineSpacing)*2, 0, 0), Qt::AlignLeft, time); |
899 | + |
900 | + QString str; |
901 | + QTextStream wos(&str); |
902 | + wos << "FOV: " << qSetRealNumberPrecision(3) << core->getMovementMgr()->getCurrentFov() << QChar(0x00B0); |
903 | + painter.drawText(surfaceData.adjusted(50, (lineSpacing)*3, 0, 0), Qt::AlignLeft, *wos.string()); |
904 | + |
905 | + painter.drawText(surfaceData.adjusted(surfaceData.width()-(15*font.pixelSize()), 0, 0, 0), Qt::AlignLeft, "Radius-magnitude relation"); |
906 | + |
907 | + QList< QPair<float,float> > listPairsMagnitudesRadius=getListMagnitudeRadius(core); |
908 | + |
909 | + int xPos=-(12*font.pixelSize()), yPos=lineSpacing+10; |
910 | + for (int icount=1; icount<=listPairsMagnitudesRadius.count(); ++icount) |
911 | + { |
912 | + painter.drawText(surfaceData.adjusted(surfaceData.width()+xPos, yPos, 0, 0), Qt::AlignLeft, QString("%1").arg(listPairsMagnitudesRadius.at(icount-1).first)); |
913 | + painter.setBrush(Qt::SolidPattern); |
914 | + painter.drawEllipse(QPoint(surfaceData.left() + surfaceData.width() + xPos - 40, surfaceData.top() + yPos + (font.pixelSize()/2)), |
915 | + (int) std::ceil(listPairsMagnitudesRadius.at(icount - 1).second), |
916 | + (int) std::ceil(listPairsMagnitudesRadius.at(icount - 1).second)); |
917 | + yPos+=lineSpacing; |
918 | + if (yPos+lineSpacing>=surfaceData.height()) |
919 | + { |
920 | + xPos+=200; |
921 | + yPos=lineSpacing+10; |
922 | + } |
923 | + } |
924 | + } |
925 | + |
926 | + // Print solar system ephemerides |
927 | + if (printSSEphemeridesOption) |
928 | + { |
929 | + |
930 | + SolarSystem* ssmgr = GETSTELMODULE(SolarSystem); |
931 | + |
932 | + double geographicLongitude=-locationData.longitude*M_PI/180.; |
933 | + double geographicLatitude=locationData.latitude*M_PI/180.; |
934 | + |
935 | + PlanetP pHome=ssmgr->searchByEnglishName(locationData.planetName); |
936 | + double standardSideralTime=pHome->getSiderealTime(((int) jd)+0.5)*M_PI/180.; |
937 | + |
938 | + QStringList allBodiesNames=ssmgr->getAllPlanetEnglishNames(); |
939 | + allBodiesNames.sort(); |
940 | + bool doHeader=true; |
941 | + int yPos; |
942 | + bool oddLine=false; |
943 | + for (int iBodyName=1; iBodyName<=allBodiesNames.count(); ++iBodyName) |
944 | + { |
945 | + QString englishName=allBodiesNames.at(iBodyName-1); |
946 | + PlanetP p=ssmgr->searchByEnglishName(englishName); |
947 | + double dec, ra; |
948 | + StelUtils::rectToSphe(&ra,&dec, p->getEquinoxEquatorialPos(core->getNavigator())); |
949 | + double standardAltitude=-0.5667; |
950 | + if (englishName=="Sun") |
951 | + standardAltitude=-0.8333; |
952 | + if (englishName=="Moon") |
953 | + standardAltitude=0.125; |
954 | + standardAltitude*=M_PI/180.; |
955 | + |
956 | + double cosH=(std::sin(standardAltitude)-(std::sin(geographicLatitude)*std::sin(dec)))/(std::cos(geographicLatitude)*std::cos(dec)); |
957 | + |
958 | + if (englishName!=locationData.planetName && cosH>=-1. && cosH<=1.) |
959 | + { |
960 | + |
961 | + if (doHeader) |
962 | + { |
963 | + |
964 | + yPos=50; |
965 | + printer->newPage(); |
966 | + painter.drawText(0, 0, printer->paperRect().width(), yPos, Qt::AlignCenter, "SOLAR SYSTEM EPHEMERIDES"); |
967 | + |
968 | + int ratioWidth=300.*(double) font.pixelSize()/45.; |
969 | + int xPos=printer->pageRect().left()-ratioWidth;; |
970 | + yPos+=(lineSpacing)*2; |
971 | + |
972 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, "Name"); |
973 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, "RA"); |
974 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, "Dec"); |
975 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, "Rising"); |
976 | + painter.drawText(QRect(xPos, yPos-font.pixelSize()-10, ratioWidth, font.pixelSize()), Qt::AlignCenter, "Local Time"); |
977 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, "Transit"); |
978 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, "Setting"); |
979 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, "Dist.(AU)"); |
980 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, "Ap.Mag."); |
981 | + yPos+=lineSpacing; |
982 | + doHeader=false; |
983 | + } |
984 | + |
985 | + |
986 | + double angleH=std::acos(cosH); |
987 | + double transit=((ra+geographicLongitude-standardSideralTime)/(2*M_PI)); |
988 | + if (transit>1.) |
989 | + transit-=1.; |
990 | + if (transit<0) |
991 | + transit+=1.; |
992 | + |
993 | + double rising=transit-angleH/(2*M_PI); |
994 | + if (rising>1.) |
995 | + rising-=1.; |
996 | + if (rising<0.) |
997 | + rising+=1.; |
998 | + |
999 | + double setting=transit+angleH/(2*M_PI); |
1000 | + if (setting>1.) |
1001 | + setting-=1.; |
1002 | + if (setting<0.) |
1003 | + setting+=1.; |
1004 | + |
1005 | + int shift=StelApp::getInstance().getLocaleMgr().getGMTShift(jd); |
1006 | + |
1007 | + int ratioWidth=300.*(double) font.pixelSize()/45.; |
1008 | + int xPos=printer->pageRect().left()-ratioWidth; |
1009 | + |
1010 | + oddLine=!oddLine; |
1011 | + |
1012 | + |
1013 | + painter.setPen(Qt::NoPen); |
1014 | + painter.setBrush((oddLine? Qt::white: Qt::gray)); |
1015 | + painter.drawRect(QRect(xPos+ratioWidth, yPos, ratioWidth*8, font.pixelSize())); |
1016 | + painter.setPen(Qt::SolidLine); |
1017 | + |
1018 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignLeft, englishName); |
1019 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignRight, QString("%1").arg(StelUtils::radToHmsStr(ra))); |
1020 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignRight, QString("%1").arg(StelUtils::radToDmsStr(dec))); |
1021 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, QString("%1").arg(printableTime(rising, shift))); |
1022 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, QString("%1").arg(printableTime(transit, shift))); |
1023 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignCenter, QString("%1").arg(printableTime(setting, shift))); |
1024 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignRight, QString("%1").arg(p->getDistance(), 0, 'g', 5)); |
1025 | + painter.drawText(QRect(xPos+=ratioWidth, yPos, ratioWidth, font.pixelSize()), Qt::AlignRight, QString("%1").arg(p->getVMagnitude(core->getNavigator()), 0, 'g', 3)); |
1026 | + |
1027 | + yPos+=lineSpacing; |
1028 | + if (yPos+((lineSpacing)*3)>=printer->pageRect().top()+printer->pageRect().height()) |
1029 | + doHeader=true; |
1030 | + } |
1031 | + } |
1032 | + } |
1033 | + QApplication::restoreOverrideCursor(); |
1034 | +} |
1035 | + |
1036 | +//! Print report direct to printer |
1037 | +void PrintSkyDialog::printSky() |
1038 | +{ |
1039 | + currentVisibilityGui=gui->getVisible(); |
1040 | + gui->setVisible(false); |
1041 | + dialog->setVisible(false); |
1042 | + |
1043 | + outputOption=false; |
1044 | + |
1045 | + QTimer::singleShot(50, this, SLOT(executePrinterOutputOption())); |
1046 | + |
1047 | +} |
1048 | + |
1049 | +//! Read the printer parameters and run the output option selected (Print/Preview) |
1050 | +void PrintSkyDialog::executePrinterOutputOption() |
1051 | +{ |
1052 | + //Options for printing image. |
1053 | + invertColorsOption=false; |
1054 | + scaleToFitOption=true; |
1055 | + orientationOption="Portrait"; |
1056 | + printDataOption=true; |
1057 | + printSSEphemeridesOption=true; |
1058 | + |
1059 | + try |
1060 | + { |
1061 | + StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable); |
1062 | + QString printskyIniPath = StelFileMgr::findFile("modules/PrintSky/", flags) + "printsky.ini"; |
1063 | + QSettings settings(printskyIniPath, QSettings::IniFormat); |
1064 | + invertColorsOption=settings.value("use_invert_colors", false).toBool(); |
1065 | + scaleToFitOption=settings.value("use_scale_to_fit", true).toBool(); |
1066 | + orientationOption=settings.value("orientation", "Portrait").toString(); |
1067 | + printDataOption=settings.value("print_data", true).toBool(); |
1068 | + printSSEphemeridesOption=settings.value("print_SS_ephemerides", true).toBool(); |
1069 | + } |
1070 | + catch (std::runtime_error& e) |
1071 | + { |
1072 | + qWarning() << "WARNING: unable to locate printsky.ini file or create a default one for PrintSky plugin: " << e.what(); |
1073 | + } |
1074 | + |
1075 | + |
1076 | + //QPrinter printer(QPrinter::HighResolution); |
1077 | + QPrinter printer(QPrinter::ScreenResolution); |
1078 | + printer.setResolution(300); |
1079 | + printer.setDocName("STELLARIUM REPORT"); |
1080 | + printer.setOrientation((orientationOption=="Portrait"? QPrinter::Portrait: QPrinter::Landscape)); |
1081 | + |
1082 | + if (outputOption) |
1083 | + { |
1084 | + //QPrintPreviewDialog oPrintPreviewDialog(&printer, &StelMainGraphicsView::getInstance()); |
1085 | + QPrintPreviewDialog oPrintPreviewDialog(&printer); |
1086 | + connect(&oPrintPreviewDialog, SIGNAL(paintRequested(QPrinter *)), this, SLOT(printDataSky(QPrinter *))); |
1087 | + oPrintPreviewDialog.exec(); |
1088 | + } |
1089 | + else |
1090 | + { |
1091 | + //QPrintDialog dialogPrinter(&printer, &StelMainGraphicsView::getInstance()); |
1092 | + QPrintDialog dialogPrinter(&printer); |
1093 | + if (dialogPrinter.exec() == QDialog::Accepted) |
1094 | + printDataSky(&printer); |
1095 | + } |
1096 | + |
1097 | + gui->setVisible(currentVisibilityGui); |
1098 | + ((QGraphicsWidget*)StelMainGraphicsView::getInstance().getStelAppGraphicsWidget())->setFocus(Qt::OtherFocusReason); |
1099 | +} |
1100 | + |
1101 | + |
1102 | + |
1103 | +void PrintSkyDialog::enableOutputOptions(bool enable) |
1104 | +{ |
1105 | + ui->buttonsFrame->setVisible(enable); |
1106 | +} |
1107 | + |
1108 | + |
1109 | +QString PrintSkyDialog::printableTime(double time, int shift) |
1110 | +{ |
1111 | + time*=24.; |
1112 | + time+=shift; |
1113 | + if (time>=24.) |
1114 | + time-=24.; |
1115 | + if (time<0) |
1116 | + time+=24.; |
1117 | + int hour=(int) time; |
1118 | + time-=hour; |
1119 | + time*=60; |
1120 | + int minute=(int) time; |
1121 | + return(QString("%1:%2").arg(hour, 2, 10, QChar('0')).arg(minute, 2, 10, QChar('0'))); |
1122 | +} |
1123 | + |
1124 | +//! Get relations between magnitude stars and draw radius |
1125 | +QList< QPair<float, float> > PrintSkyDialog::getListMagnitudeRadius(StelCore *core) |
1126 | +{ |
1127 | + QList< QPair<float, float> > listPairsMagnitudesRadius; |
1128 | + StelSkyDrawer* skyDrawer = core->getSkyDrawer(); |
1129 | + |
1130 | + |
1131 | + float rcmag_table[1]; |
1132 | + for (int mag=-30; mag<100; ++mag) |
1133 | + { |
1134 | + skyDrawer->computeRCMag(mag,rcmag_table); |
1135 | + if (rcmag_table[0]>0. && rcmag_table[0]<13.) |
1136 | + { |
1137 | + QPair<float, float> pairMagnitudeRadius; |
1138 | + pairMagnitudeRadius.first=mag; |
1139 | + pairMagnitudeRadius.second=rcmag_table[0]; |
1140 | + bool found=false; |
1141 | + for (int icount=1; !found && icount<=listPairsMagnitudesRadius.count();++icount) |
1142 | + found=listPairsMagnitudesRadius.at(icount-1).first==pairMagnitudeRadius.first; |
1143 | + if (!found) |
1144 | + listPairsMagnitudesRadius << pairMagnitudeRadius; |
1145 | + } |
1146 | + } |
1147 | + |
1148 | + return(listPairsMagnitudesRadius); |
1149 | +} |
1150 | |
1151 | === added file 'plugins/PrintSky/src/gui/PrintSkyDialog.hpp' |
1152 | --- plugins/PrintSky/src/gui/PrintSkyDialog.hpp 1970-01-01 00:00:00 +0000 |
1153 | +++ plugins/PrintSky/src/gui/PrintSkyDialog.hpp 2011-05-23 18:33:38 +0000 |
1154 | @@ -0,0 +1,98 @@ |
1155 | +/* |
1156 | + * Copyright (C) 2010 Pep Pujols |
1157 | + * |
1158 | + * This program is free software; you can redistribute it and/or |
1159 | + * modify it under the terms of the GNU General Public License |
1160 | + * as published by the Free Software Foundation; either version 2 |
1161 | + * of the License, or (at your option) any later version. |
1162 | + * |
1163 | + * This program is distributed in the hope that it will be useful, |
1164 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1165 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1166 | + * GNU General Public License for more details. |
1167 | + * |
1168 | + * You should have received a copy of the GNU General Public License |
1169 | + * along with this program; if not, write to the Free Software |
1170 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1171 | + */ |
1172 | + |
1173 | +#ifndef _PRINTSKYDIALOG_HPP_ |
1174 | +#define _PRINTSKYDIALOG_HPP_ |
1175 | + |
1176 | +#include <QObject> |
1177 | +#include "StelDialogPrintSky.hpp" |
1178 | +#include "StelStyle.hpp" |
1179 | +#include <QPrinter> |
1180 | +#include <QPrintPreviewWidget> |
1181 | +#include <QPrintPreviewDialog> |
1182 | +#include "StelGui.hpp" |
1183 | + |
1184 | +class Ui_printskyDialogForm; |
1185 | + |
1186 | + |
1187 | +class PrintSkyDialog : public StelDialogPrintSky |
1188 | +{ |
1189 | + Q_OBJECT |
1190 | + |
1191 | +public: |
1192 | + PrintSkyDialog(); |
1193 | + virtual ~PrintSkyDialog(); |
1194 | + void languageChanged(); |
1195 | + void updateStyle(); |
1196 | + |
1197 | + //! Notify that the application style changed |
1198 | + void styleChanged(); |
1199 | + void enableOutputOptions(bool enable); |
1200 | + |
1201 | +public slots: |
1202 | + void closeWindow(); |
1203 | + |
1204 | + //! Print report on a preview window |
1205 | + void previewSky(); |
1206 | + //! Read the printer parameters and run the output option selected (Print/Preview) |
1207 | + void executePrinterOutputOption(); |
1208 | + //! Print report direct to printer |
1209 | + void printSky(); |
1210 | + |
1211 | +signals: |
1212 | + void invertColorsChanged(bool state); |
1213 | + void scaleToFitChanged(bool state); |
1214 | + void orientationChanged(bool state); |
1215 | + void printDataChanged(bool state); |
1216 | + void printSSEphemeridesChanged(bool state); |
1217 | + |
1218 | +protected: |
1219 | + //! Initialize the dialog widgets and connect the signals/slots |
1220 | + virtual void createDialogContent(); |
1221 | + Ui_printskyDialogForm* ui; |
1222 | + |
1223 | +private slots: |
1224 | + void invertColorsStateChanged(int state); |
1225 | + //! Draw contents report |
1226 | + //! @param printer the paint device to paint on a print |
1227 | + void printDataSky(QPrinter * printer); |
1228 | + void scaleToFitStateChanged(int state); |
1229 | + void orientationStateChanged(bool state); |
1230 | + void printDataStateChanged(int state); |
1231 | + void printSSEphemeridesStateChanged(int state); |
1232 | + |
1233 | +private: |
1234 | + |
1235 | + //Gui |
1236 | + StelGui* gui; |
1237 | + bool currentVisibilityGui; |
1238 | + |
1239 | + //! Printing options |
1240 | + bool outputOption; |
1241 | + bool invertColorsOption; |
1242 | + bool scaleToFitOption; |
1243 | + QString orientationOption; |
1244 | + bool printDataOption; |
1245 | + bool printSSEphemeridesOption; |
1246 | + QString printableTime(double time, int shift); |
1247 | + QList< QPair<float, float> > getListMagnitudeRadius(StelCore *core); |
1248 | + |
1249 | + |
1250 | +}; |
1251 | + |
1252 | +#endif // _OCULARDIALOG_HPP_ |
1253 | |
1254 | === added file 'plugins/PrintSky/src/gui/StelDialogPrintSky.cpp' |
1255 | --- plugins/PrintSky/src/gui/StelDialogPrintSky.cpp 1970-01-01 00:00:00 +0000 |
1256 | +++ plugins/PrintSky/src/gui/StelDialogPrintSky.cpp 2011-05-23 18:33:38 +0000 |
1257 | @@ -0,0 +1,134 @@ |
1258 | +/* |
1259 | + * Stellarium |
1260 | + * Copyright (C) 2008 Fabien Chereau |
1261 | + * |
1262 | + * This program is free software; you can redistribute it and/or |
1263 | + * modify it under the terms of the GNU General Public License |
1264 | + * as published by the Free Software Foundation; either version 2 |
1265 | + * of the License, or (at your option) any later version. |
1266 | + * |
1267 | + * This program is distributed in the hope that it will be useful, |
1268 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1269 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1270 | + * GNU General Public License for more details. |
1271 | + * |
1272 | + * You should have received a copy of the GNU General Public License |
1273 | + * along with this program; if not, write to the Free Software |
1274 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1275 | +*/ |
1276 | + |
1277 | + |
1278 | +#include "StelDialogPrintSky.hpp" |
1279 | +#include "StelMainGraphicsView.hpp" |
1280 | +#include "StelMainWindow.hpp" |
1281 | + |
1282 | +#include <QDebug> |
1283 | +#include <QDialog> |
1284 | +#include <QGraphicsProxyWidget> |
1285 | +#include <QStyleOptionGraphicsItem> |
1286 | + |
1287 | +class CustomProxy : public QGraphicsProxyWidget |
1288 | +{ |
1289 | + public: |
1290 | + CustomProxy(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0) : QGraphicsProxyWidget(parent, wFlags) |
1291 | + { |
1292 | + setFocusPolicy(Qt::StrongFocus); |
1293 | + } |
1294 | + //! Reimplement this method to add windows decorations. Currently there are invisible 2 px decorations |
1295 | + void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
1296 | + { |
1297 | +/* QStyleOptionTitleBar bar; |
1298 | + initStyleOption(&bar); |
1299 | + bar.subControls = QStyle::SC_TitleBarCloseButton; |
1300 | + qWarning() << style()->subControlRect(QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton); |
1301 | + QGraphicsProxyWidget::paintWindowFrame(painter, option, widget);*/ |
1302 | + } |
1303 | + protected: |
1304 | + |
1305 | + virtual bool event(QEvent* event) |
1306 | + { |
1307 | + if (event->type()==QEvent::WindowDeactivate) |
1308 | + { |
1309 | + widget()->setWindowOpacity(0.4); |
1310 | + } |
1311 | + if (event->type()==QEvent::WindowActivate) |
1312 | + { |
1313 | + widget()->setWindowOpacity(0.9); |
1314 | + } |
1315 | + return QGraphicsProxyWidget::event(event); |
1316 | + } |
1317 | +}; |
1318 | + |
1319 | +StelDialogPrintSky::StelDialogPrintSky() : dialog(NULL) |
1320 | +{ |
1321 | +} |
1322 | + |
1323 | +StelDialogPrintSky::~StelDialogPrintSky() |
1324 | +{ |
1325 | +} |
1326 | + |
1327 | + |
1328 | +void StelDialogPrintSky::close() |
1329 | +{ |
1330 | + setVisible(false); |
1331 | + StelMainGraphicsView::getInstance().scene()->setActiveWindow(0); |
1332 | + ((QGraphicsWidget*)StelMainGraphicsView::getInstance().getStelAppGraphicsWidget())->setFocus(Qt::OtherFocusReason); |
1333 | +} |
1334 | + |
1335 | +void StelDialogPrintSky::setVisible(bool v) |
1336 | +{ |
1337 | + if (v) |
1338 | + { |
1339 | + |
1340 | + QSize screenSize = StelMainWindow::getInstance().size(); |
1341 | + if (dialog) |
1342 | + { |
1343 | + dialog->show(); |
1344 | + StelMainGraphicsView::getInstance().scene()->setActiveWindow(proxy); |
1345 | + // If the main window has been resized, it is possible the dialog |
1346 | + // will be off screen. Check for this and move it to a visible |
1347 | + // position if necessary |
1348 | + QPointF newPos = proxy->pos(); |
1349 | + if (newPos.x()>=screenSize.width()) |
1350 | + newPos.setX(screenSize.width() - dialog->size().width()); |
1351 | + if (newPos.y()>=screenSize.height()) |
1352 | + newPos.setY(screenSize.height() - dialog->size().height()); |
1353 | + if (newPos != dialog->pos()) |
1354 | + proxy->setPos(newPos); |
1355 | + |
1356 | + proxy->setFocus(); |
1357 | + return; |
1358 | + } |
1359 | + dialog = new QDialog(NULL); |
1360 | + connect(dialog, SIGNAL(rejected()), this, SLOT(close())); |
1361 | + createDialogContent(); |
1362 | + |
1363 | + proxy = new CustomProxy(NULL, Qt::Tool); |
1364 | + proxy->setWidget(dialog); |
1365 | + QRectF bound = proxy->boundingRect(); |
1366 | + |
1367 | + // centre with dialog according to current window size. |
1368 | + proxy->setPos((int)((screenSize.width()-bound.width())/2), (int)((screenSize.height()-bound.height())/2)); |
1369 | + StelMainGraphicsView::getInstance().scene()->addItem(proxy); |
1370 | + proxy->setWindowFrameMargins(2,0,2,2); |
1371 | + |
1372 | + // The caching is buggy on all plateforms with Qt 4.5.2 |
1373 | + |
1374 | +#if QT_VERSION==0x040502 |
1375 | + proxy->setCacheMode(QGraphicsItem::NoCache); |
1376 | +#else |
1377 | + proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache); |
1378 | +#endif |
1379 | + |
1380 | + proxy->setZValue(100); |
1381 | + StelMainGraphicsView::getInstance().scene()->setActiveWindow(proxy); |
1382 | + proxy->setFocus(); |
1383 | + } |
1384 | + else |
1385 | + { |
1386 | + dialog->hide(); |
1387 | + emit visibleChanged(false); |
1388 | + //proxy->clearFocus(); |
1389 | + StelMainGraphicsView::getInstance().scene()->setActiveWindow(0); |
1390 | + } |
1391 | +} |
1392 | |
1393 | === added file 'plugins/PrintSky/src/gui/StelDialogPrintSky.hpp' |
1394 | --- plugins/PrintSky/src/gui/StelDialogPrintSky.hpp 1970-01-01 00:00:00 +0000 |
1395 | +++ plugins/PrintSky/src/gui/StelDialogPrintSky.hpp 2011-05-23 18:33:38 +0000 |
1396 | @@ -0,0 +1,52 @@ |
1397 | +/* |
1398 | + * Stellarium |
1399 | + * Copyright (C) 2008 Fabien Chereau |
1400 | + * |
1401 | + * This program is free software; you can redistribute it and/or |
1402 | + * modify it under the terms of the GNU General Public License |
1403 | + * as published by the Free Software Foundation; either version 2 |
1404 | + * of the License, or (at your option) any later version. |
1405 | + * |
1406 | + * This program is distributed in the hope that it will be useful, |
1407 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1408 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1409 | + * GNU General Public License for more details. |
1410 | + * |
1411 | + * You should have received a copy of the GNU General Public License |
1412 | + * along with this program; if not, write to the Free Software |
1413 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1414 | +*/ |
1415 | + |
1416 | +#ifndef _STELDIALOGPRINTSKY_HPP_ |
1417 | +#define _STELDIALOGPRINTSKY_HPP_ |
1418 | + |
1419 | +#include <QObject> |
1420 | + |
1421 | +//! @class StelDialog |
1422 | +//! A local copy of StelDialog, the base class for all the GUI windows in Stellarium, included to allow the plug-in to be |
1423 | +//! loaded dynamically on Windows. (An "Invalid access to memory location" error is thrown otherwise.) |
1424 | +class StelDialogPrintSky : public QObject |
1425 | +{ |
1426 | + Q_OBJECT |
1427 | +public: |
1428 | + StelDialogPrintSky(); |
1429 | + virtual ~StelDialogPrintSky(); |
1430 | + //! Retranslate the content of the dialog |
1431 | + virtual void languageChanged()=0; |
1432 | + |
1433 | +public slots: |
1434 | + void setVisible(bool); |
1435 | + void close(); |
1436 | +signals: |
1437 | + void visibleChanged(bool); |
1438 | + |
1439 | +protected: |
1440 | + //! Initialize the dialog widgets and connect the signals/slots |
1441 | + virtual void createDialogContent()=0; |
1442 | + |
1443 | + //! The main dialog |
1444 | + QWidget* dialog; |
1445 | + class CustomProxy* proxy; |
1446 | +}; |
1447 | + |
1448 | +#endif // _STELDIALOGPRINTSKY_HPP_ |
1449 | |
1450 | === added file 'plugins/PrintSky/src/gui/printskyDialog.ui' |
1451 | --- plugins/PrintSky/src/gui/printskyDialog.ui 1970-01-01 00:00:00 +0000 |
1452 | +++ plugins/PrintSky/src/gui/printskyDialog.ui 2011-05-23 18:33:38 +0000 |
1453 | @@ -0,0 +1,350 @@ |
1454 | +<?xml version="1.0" encoding="UTF-8"?> |
1455 | +<ui version="4.0"> |
1456 | + <class>printskyDialogForm</class> |
1457 | + <widget class="QWidget" name="printskyDialogForm"> |
1458 | + <property name="geometry"> |
1459 | + <rect> |
1460 | + <x>0</x> |
1461 | + <y>0</y> |
1462 | + <width>500</width> |
1463 | + <height>300</height> |
1464 | + </rect> |
1465 | + </property> |
1466 | + <property name="sizePolicy"> |
1467 | + <sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding"> |
1468 | + <horstretch>0</horstretch> |
1469 | + <verstretch>0</verstretch> |
1470 | + </sizepolicy> |
1471 | + </property> |
1472 | + <property name="minimumSize"> |
1473 | + <size> |
1474 | + <width>300</width> |
1475 | + <height>300</height> |
1476 | + </size> |
1477 | + </property> |
1478 | + <layout class="QVBoxLayout" name="verticalLayout_2"> |
1479 | + <property name="spacing"> |
1480 | + <number>0</number> |
1481 | + </property> |
1482 | + <property name="margin"> |
1483 | + <number>0</number> |
1484 | + </property> |
1485 | + <item> |
1486 | + <widget class="BarFrame" name="LocationBar"> |
1487 | + <property name="sizePolicy"> |
1488 | + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> |
1489 | + <horstretch>0</horstretch> |
1490 | + <verstretch>0</verstretch> |
1491 | + </sizepolicy> |
1492 | + </property> |
1493 | + <property name="maximumSize"> |
1494 | + <size> |
1495 | + <width>16777215</width> |
1496 | + <height>25</height> |
1497 | + </size> |
1498 | + </property> |
1499 | + <property name="frameShape"> |
1500 | + <enum>QFrame::StyledPanel</enum> |
1501 | + </property> |
1502 | + <property name="frameShadow"> |
1503 | + <enum>QFrame::Raised</enum> |
1504 | + </property> |
1505 | + <layout class="QHBoxLayout" name="horizontalLayout_7"> |
1506 | + <property name="spacing"> |
1507 | + <number>6</number> |
1508 | + </property> |
1509 | + <property name="leftMargin"> |
1510 | + <number>0</number> |
1511 | + </property> |
1512 | + <property name="topMargin"> |
1513 | + <number>0</number> |
1514 | + </property> |
1515 | + <property name="rightMargin"> |
1516 | + <number>4</number> |
1517 | + </property> |
1518 | + <property name="bottomMargin"> |
1519 | + <number>0</number> |
1520 | + </property> |
1521 | + <item> |
1522 | + <spacer name="spacer_2"> |
1523 | + <property name="orientation"> |
1524 | + <enum>Qt::Horizontal</enum> |
1525 | + </property> |
1526 | + <property name="sizeHint" stdset="0"> |
1527 | + <size> |
1528 | + <width>40</width> |
1529 | + <height>20</height> |
1530 | + </size> |
1531 | + </property> |
1532 | + </spacer> |
1533 | + </item> |
1534 | + <item> |
1535 | + <widget class="QLabel" name="stelWindowTitle"> |
1536 | + <property name="text"> |
1537 | + <string>Print sky</string> |
1538 | + </property> |
1539 | + </widget> |
1540 | + </item> |
1541 | + <item> |
1542 | + <spacer name="spacer"> |
1543 | + <property name="orientation"> |
1544 | + <enum>Qt::Horizontal</enum> |
1545 | + </property> |
1546 | + <property name="sizeHint" stdset="0"> |
1547 | + <size> |
1548 | + <width>40</width> |
1549 | + <height>20</height> |
1550 | + </size> |
1551 | + </property> |
1552 | + </spacer> |
1553 | + </item> |
1554 | + <item> |
1555 | + <widget class="QPushButton" name="closeStelWindow"> |
1556 | + <property name="minimumSize"> |
1557 | + <size> |
1558 | + <width>16</width> |
1559 | + <height>16</height> |
1560 | + </size> |
1561 | + </property> |
1562 | + <property name="maximumSize"> |
1563 | + <size> |
1564 | + <width>16</width> |
1565 | + <height>16</height> |
1566 | + </size> |
1567 | + </property> |
1568 | + <property name="focusPolicy"> |
1569 | + <enum>Qt::NoFocus</enum> |
1570 | + </property> |
1571 | + <property name="text"> |
1572 | + <string/> |
1573 | + </property> |
1574 | + </widget> |
1575 | + </item> |
1576 | + </layout> |
1577 | + </widget> |
1578 | + </item> |
1579 | + <item> |
1580 | + <widget class="QFrame" name="Contents"> |
1581 | + <property name="sizePolicy"> |
1582 | + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> |
1583 | + <horstretch>0</horstretch> |
1584 | + <verstretch>0</verstretch> |
1585 | + </sizepolicy> |
1586 | + </property> |
1587 | + <property name="frameShape"> |
1588 | + <enum>QFrame::StyledPanel</enum> |
1589 | + </property> |
1590 | + <property name="frameShadow"> |
1591 | + <enum>QFrame::Raised</enum> |
1592 | + </property> |
1593 | + <layout class="QVBoxLayout" name="verticalLayout_4"> |
1594 | + <property name="spacing"> |
1595 | + <number>0</number> |
1596 | + </property> |
1597 | + <property name="margin"> |
1598 | + <number>0</number> |
1599 | + </property> |
1600 | + <item> |
1601 | + <widget class="QTabWidget" name="Tabs"> |
1602 | + <property name="currentIndex"> |
1603 | + <number>0</number> |
1604 | + </property> |
1605 | + <widget class="QWidget" name="General"> |
1606 | + <attribute name="title"> |
1607 | + <string>General</string> |
1608 | + </attribute> |
1609 | + <layout class="QVBoxLayout" name="verticalLayout_3"> |
1610 | + <property name="spacing"> |
1611 | + <number>0</number> |
1612 | + </property> |
1613 | + <property name="margin"> |
1614 | + <number>0</number> |
1615 | + </property> |
1616 | + <item> |
1617 | + <widget class="QGroupBox" name="groupBox"> |
1618 | + <property name="title"> |
1619 | + <string>Options</string> |
1620 | + </property> |
1621 | + <layout class="QGridLayout" name="gridLayout_2"> |
1622 | + <property name="margin"> |
1623 | + <number>0</number> |
1624 | + </property> |
1625 | + <item row="0" column="0" colspan="2"> |
1626 | + <layout class="QVBoxLayout" name="verticalLayout"> |
1627 | + <item> |
1628 | + <widget class="QCheckBox" name="invertColorsCheckBox"> |
1629 | + <property name="text"> |
1630 | + <string>Invert colors</string> |
1631 | + </property> |
1632 | + </widget> |
1633 | + </item> |
1634 | + <item> |
1635 | + <widget class="QCheckBox" name="scaleToFitCheckBox"> |
1636 | + <property name="text"> |
1637 | + <string>Scale to fit</string> |
1638 | + </property> |
1639 | + </widget> |
1640 | + </item> |
1641 | + <item> |
1642 | + <widget class="QCheckBox" name="printDataCheckBox"> |
1643 | + <property name="text"> |
1644 | + <string>Print scene information</string> |
1645 | + </property> |
1646 | + </widget> |
1647 | + </item> |
1648 | + <item> |
1649 | + <widget class="QCheckBox" name="printSSEphemeridesCheckBox"> |
1650 | + <property name="text"> |
1651 | + <string>Print Solar System ephemerides</string> |
1652 | + </property> |
1653 | + </widget> |
1654 | + </item> |
1655 | + </layout> |
1656 | + </item> |
1657 | + <item row="0" column="2"> |
1658 | + <widget class="QGroupBox" name="orientationGroupBox"> |
1659 | + <property name="title"> |
1660 | + <string>Orientation</string> |
1661 | + </property> |
1662 | + <layout class="QVBoxLayout" name="verticalLayout_5"> |
1663 | + <property name="margin"> |
1664 | + <number>0</number> |
1665 | + </property> |
1666 | + <item> |
1667 | + <widget class="QRadioButton" name="orientationPortraitRadioButton"> |
1668 | + <property name="text"> |
1669 | + <string>Portrait</string> |
1670 | + </property> |
1671 | + <property name="checked"> |
1672 | + <bool>true</bool> |
1673 | + </property> |
1674 | + </widget> |
1675 | + </item> |
1676 | + <item> |
1677 | + <widget class="QRadioButton" name="orientationLandscapeRadioButton"> |
1678 | + <property name="text"> |
1679 | + <string>Landscape</string> |
1680 | + </property> |
1681 | + </widget> |
1682 | + </item> |
1683 | + </layout> |
1684 | + </widget> |
1685 | + </item> |
1686 | + <item row="1" column="0" colspan="3"> |
1687 | + <widget class="QFrame" name="buttonsFrame"> |
1688 | + <layout class="QHBoxLayout" name="horizontalLayout"> |
1689 | + <item> |
1690 | + <widget class="QPushButton" name="previewSkyPushButton"> |
1691 | + <property name="text"> |
1692 | + <string>Preview</string> |
1693 | + </property> |
1694 | + </widget> |
1695 | + </item> |
1696 | + <item> |
1697 | + <widget class="QPushButton" name="printSkyPushButton"> |
1698 | + <property name="text"> |
1699 | + <string>Print</string> |
1700 | + </property> |
1701 | + </widget> |
1702 | + </item> |
1703 | + </layout> |
1704 | + </widget> |
1705 | + </item> |
1706 | + </layout> |
1707 | + </widget> |
1708 | + </item> |
1709 | + <item> |
1710 | + <spacer name="verticalSpacer"> |
1711 | + <property name="orientation"> |
1712 | + <enum>Qt::Vertical</enum> |
1713 | + </property> |
1714 | + <property name="sizeHint" stdset="0"> |
1715 | + <size> |
1716 | + <width>20</width> |
1717 | + <height>40</height> |
1718 | + </size> |
1719 | + </property> |
1720 | + </spacer> |
1721 | + </item> |
1722 | + </layout> |
1723 | + </widget> |
1724 | + <widget class="QWidget" name="About"> |
1725 | + <attribute name="title"> |
1726 | + <string>About</string> |
1727 | + </attribute> |
1728 | + <layout class="QGridLayout" name="gridLayout"> |
1729 | + <item row="1" column="0"> |
1730 | + <widget class="QLabel" name="labelAbout"> |
1731 | + <property name="text"> |
1732 | + <string>This plugin allows the user to preview and print the current screen and some aditional data as the current location, the screen time adding the GMT difference, and also a relation radius magnitude as a field reference. |
1733 | + |
1734 | +In a optional second page you can get some Solar System ephemerides. |
1735 | + |
1736 | +Use Ctrl+P to open the print window.</string> |
1737 | + </property> |
1738 | + <property name="textFormat"> |
1739 | + <enum>Qt::AutoText</enum> |
1740 | + </property> |
1741 | + <property name="alignment"> |
1742 | + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> |
1743 | + </property> |
1744 | + <property name="wordWrap"> |
1745 | + <bool>true</bool> |
1746 | + </property> |
1747 | + </widget> |
1748 | + </item> |
1749 | + <item row="2" column="0"> |
1750 | + <spacer name="verticalSpacer_2"> |
1751 | + <property name="orientation"> |
1752 | + <enum>Qt::Vertical</enum> |
1753 | + </property> |
1754 | + <property name="sizeHint" stdset="0"> |
1755 | + <size> |
1756 | + <width>20</width> |
1757 | + <height>40</height> |
1758 | + </size> |
1759 | + </property> |
1760 | + </spacer> |
1761 | + </item> |
1762 | + <item row="0" column="0"> |
1763 | + <widget class="QLabel" name="label"> |
1764 | + <property name="text"> |
1765 | + <string>Author: <a href="mailto:maslarocaxica@gmail.com">Pep Pujols</a> (with fixes by Bogdan Marinov)</string> |
1766 | + </property> |
1767 | + <property name="openExternalLinks"> |
1768 | + <bool>true</bool> |
1769 | + </property> |
1770 | + </widget> |
1771 | + </item> |
1772 | + </layout> |
1773 | + </widget> |
1774 | + </widget> |
1775 | + </item> |
1776 | + </layout> |
1777 | + </widget> |
1778 | + </item> |
1779 | + </layout> |
1780 | + </widget> |
1781 | + <customwidgets> |
1782 | + <customwidget> |
1783 | + <class>BarFrame</class> |
1784 | + <extends>QFrame</extends> |
1785 | + <header>Dialog.hpp</header> |
1786 | + <container>1</container> |
1787 | + </customwidget> |
1788 | + </customwidgets> |
1789 | + <tabstops> |
1790 | + <tabstop>Tabs</tabstop> |
1791 | + <tabstop>invertColorsCheckBox</tabstop> |
1792 | + <tabstop>scaleToFitCheckBox</tabstop> |
1793 | + <tabstop>printDataCheckBox</tabstop> |
1794 | + <tabstop>printSSEphemeridesCheckBox</tabstop> |
1795 | + <tabstop>orientationPortraitRadioButton</tabstop> |
1796 | + <tabstop>orientationLandscapeRadioButton</tabstop> |
1797 | + <tabstop>previewSkyPushButton</tabstop> |
1798 | + <tabstop>printSkyPushButton</tabstop> |
1799 | + <tabstop>labelAbout</tabstop> |
1800 | + </tabstops> |
1801 | + <resources/> |
1802 | + <connections/> |
1803 | +</ui> |
1804 | |
1805 | === modified file 'src/CMakeLists.txt' |
1806 | --- src/CMakeLists.txt 2011-01-05 14:26:19 +0000 |
1807 | +++ src/CMakeLists.txt 2011-05-23 18:33:38 +0000 |
1808 | @@ -580,6 +580,12 @@ |
1809 | SET(STELLARIUM_STATIC_PLUGINS_LIBRARIES ${STELLARIUM_STATIC_PLUGINS_LIBRARIES} ${CMAKE_BINARY_DIR}/plugins/VirGO/src/${CMAKE_CFG_INTDIR}/libVirGO.a ${CFITSIO_LIBRARIES}) |
1810 | ADD_DEFINITIONS(-DUSE_STATIC_PLUGIN_VIRGO) |
1811 | ENDIF() |
1812 | + |
1813 | + IF (USE_PLUGIN_PRINTSKY) |
1814 | + SET(STELLARIUM_STATIC_PLUGINS_LIBRARIES ${STELLARIUM_STATIC_PLUGINS_LIBRARIES} "${CMAKE_BINARY_DIR}/plugins/PrintSky/src/${CMAKE_CFG_INTDIR}/libPrintSky.a") |
1815 | + ADD_DEFINITIONS(-DUSE_STATIC_PLUGIN_PRINTSKY) |
1816 | + ENDIF() |
1817 | + |
1818 | ENDIF() |
1819 | |
1820 | |
1821 | |
1822 | === modified file 'src/StelMainGraphicsView.cpp' |
1823 | --- src/StelMainGraphicsView.cpp 2010-11-12 15:29:52 +0000 |
1824 | +++ src/StelMainGraphicsView.cpp 2011-05-23 18:33:38 +0000 |
1825 | @@ -101,6 +101,10 @@ |
1826 | Q_IMPORT_PLUGIN(TimeZoneConfiguration) |
1827 | #endif |
1828 | |
1829 | +#ifdef USE_STATIC_PLUGIN_PRINTSKY |
1830 | +Q_IMPORT_PLUGIN(PrintSky) |
1831 | +#endif |
1832 | + |
1833 | // Initialize static variables |
1834 | StelMainGraphicsView* StelMainGraphicsView::singleton = NULL; |
1835 | |
1836 | |
1837 | === modified file 'src/StelMainGraphicsView.hpp' |
1838 | --- src/StelMainGraphicsView.hpp 2010-09-09 11:50:25 +0000 |
1839 | +++ src/StelMainGraphicsView.hpp 2011-05-23 18:33:38 +0000 |
1840 | @@ -65,6 +65,10 @@ |
1841 | StelScriptMgr& getScriptMgr() {return *scriptMgr;} |
1842 | #endif |
1843 | |
1844 | + //! Return the QGLWidget encapsulating the Stellarium main sky view. |
1845 | + //! Use its layout if you want to rendering OpenGL Graphics. |
1846 | + StelQGLWidget* getStelQGLWidget() {return glWidget;} |
1847 | + |
1848 | public slots: |
1849 | |
1850 | /////////////////////////////////////////////////////////////////////////// |
1851 | |
1852 | === modified file 'src/core/modules/StarMgr.cpp' |
1853 | --- src/core/modules/StarMgr.cpp 2011-01-29 18:14:28 +0000 |
1854 | +++ src/core/modules/StarMgr.cpp 2011-05-23 18:33:38 +0000 |
1855 | @@ -949,3 +949,4 @@ |
1856 | setFlagSciNames(skyCultureDir.startsWith("western")); |
1857 | updateI18n(); |
1858 | } |
1859 | + |
I found a couple of without looking into the code:
1. The preview window shows badly corrupted fonts. I think the font size is too big and/or the line spacing is not big enough. See http:// i.imgur. com/ccR7I. png
2. The configuration dialog form design is not so good. Spacers and a tab level layout should be used to make the form re-sizable. I would also prefer the colouration to be the same as the other configuration dialogs (this is probably just a matter of copying the stylesheet from the Satellite or Occural plugin).
Matthew