Merge lp:~guillaume-chereau/stellarium/no-qml1 into lp:stellarium
- no-qml1
- Merge into trunk
Proposed by
Guillaume Chereau
Status: | Merged |
---|---|
Merged at revision: | 7865 |
Proposed branch: | lp:~guillaume-chereau/stellarium/no-qml1 |
Merge into: | lp:stellarium |
Diff against target: |
854 lines (+186/-124) 23 files modified
CMakeLists.txt (+0/-2) data/mainRes.qrc (+0/-1) data/qml/main.qml (+0/-39) plugins/ArchaeoLines/src/CMakeLists.txt (+1/-1) plugins/EquationOfTime/src/CMakeLists.txt (+1/-1) plugins/Exoplanets/src/CMakeLists.txt (+1/-1) plugins/FOV/src/CMakeLists.txt (+1/-1) plugins/MeteorShowers/src/CMakeLists.txt (+1/-1) plugins/NavStars/src/CMakeLists.txt (+1/-1) plugins/Observability/src/CMakeLists.txt (+1/-1) plugins/Oculars/src/CMakeLists.txt (+1/-1) plugins/PointerCoordinates/src/CMakeLists.txt (+1/-1) plugins/Pulsars/src/CMakeLists.txt (+1/-1) plugins/Quasars/src/CMakeLists.txt (+1/-1) plugins/Satellites/src/CMakeLists.txt (+1/-1) plugins/SolarSystemEditor/src/CMakeLists.txt (+1/-1) plugins/Supernovae/src/CMakeLists.txt (+1/-1) plugins/TelescopeControl/src/CMakeLists.txt (+1/-1) plugins/TextUserInterface/src/CMakeLists.txt (+1/-1) plugins/TimeZoneConfiguration/src/CMakeLists.txt (+1/-1) src/CMakeLists.txt (+11/-11) src/StelMainView.cpp (+150/-46) src/StelMainView.hpp (+8/-8) |
To merge this branch: | bzr merge lp:~guillaume-chereau/stellarium/no-qml1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexander Wolf | Approve | ||
Review via email: mp+269144@code.launchpad.net |
Commit message
Description of the change
This should remove all references to QDeclarative. This module is now deprecated in Qt 5, and we only used it for the night mode shader. I reimplemented the shader directly in C++.
To post a comment you must log in.
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 2015-08-01 19:24:54 +0000 |
3 | +++ CMakeLists.txt 2015-08-26 03:52:16 +0000 |
4 | @@ -213,7 +213,6 @@ |
5 | MESSAGE(STATUS "Found Qt5: ${QMAKE_LOCATION} (found suitable version \"${Qt5Core_VERSION_STRING}\")") |
6 | ENDIF() |
7 | FIND_PACKAGE(Qt5Concurrent REQUIRED) |
8 | -FIND_PACKAGE(Qt5Declarative REQUIRED) |
9 | FIND_PACKAGE(Qt5Gui REQUIRED) |
10 | FIND_PACKAGE(Qt5Network REQUIRED) |
11 | FIND_PACKAGE(Qt5OpenGL REQUIRED) |
12 | @@ -336,7 +335,6 @@ |
13 | GET_TARGET_PROPERTY(QtOpenGL_location Qt5::OpenGL LOCATION) |
14 | GET_TARGET_PROPERTY(QtNetwork_location Qt5::Network LOCATION) |
15 | GET_TARGET_PROPERTY(QtWidgets_location Qt5::Widgets LOCATION) |
16 | - GET_TARGET_PROPERTY(QtDeclarative_location Qt5::Declarative LOCATION) |
17 | GET_TARGET_PROPERTY(QtSql_location Qt5::Sql LOCATION) |
18 | GET_TARGET_PROPERTY(QtXmlPatterns_location Qt5::XmlPatterns LOCATION) |
19 | IF(ENABLE_SCRIPTING) |
20 | |
21 | === modified file 'data/mainRes.qrc' |
22 | --- data/mainRes.qrc 2013-12-11 06:51:27 +0000 |
23 | +++ data/mainRes.qrc 2015-08-26 03:52:16 +0000 |
24 | @@ -4,7 +4,6 @@ |
25 | </qresource> |
26 | <qresource prefix="/"> |
27 | <file>shaders/xyYToRGB.glsl</file> |
28 | - <file>qml/main.qml</file> |
29 | <file>splash.png</file> |
30 | </qresource> |
31 | </RCC> |
32 | |
33 | === removed file 'data/qml/main.qml' |
34 | --- data/qml/main.qml 2014-05-03 17:58:17 +0000 |
35 | +++ data/qml/main.qml 1970-01-01 00:00:00 +0000 |
36 | @@ -1,39 +0,0 @@ |
37 | - |
38 | -import QtQuick 1.0 |
39 | -import Qt.labs.shaders 1.0 |
40 | -import Stellarium 1.0 |
41 | - |
42 | -Rectangle { |
43 | - ShaderEffectItem { |
44 | - property variant source: ShaderEffectSource { sourceItem: all; hideSource: true } |
45 | - anchors.fill: all |
46 | - blending: false |
47 | - visible: stelApp.nightMode |
48 | - |
49 | - fragmentShader: |
50 | - " |
51 | - varying highp vec2 qt_TexCoord0; |
52 | - uniform sampler2D source; |
53 | - void main(void) |
54 | - { |
55 | - mediump vec3 color = texture2D(source, qt_TexCoord0).rgb; |
56 | - mediump float luminance = max(max(color.r, color.g), color.b); |
57 | - gl_FragColor = vec4(luminance, 0.0, 0.0, 1.0); |
58 | - } |
59 | - " |
60 | - } |
61 | - |
62 | - Item { |
63 | - id: all |
64 | - anchors.fill: parent |
65 | - StelSky { |
66 | - anchors.fill: parent |
67 | - } |
68 | - |
69 | - // This will generate a single big QGraphicsWidget, and initialize |
70 | - // Stellarium GUI into it. |
71 | - StelGui { |
72 | - anchors.fill: parent |
73 | - } |
74 | - } |
75 | -} |
76 | |
77 | === modified file 'plugins/ArchaeoLines/src/CMakeLists.txt' |
78 | --- plugins/ArchaeoLines/src/CMakeLists.txt 2015-04-01 13:21:32 +0000 |
79 | +++ plugins/ArchaeoLines/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
80 | @@ -21,7 +21,7 @@ |
81 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) |
82 | |
83 | ADD_LIBRARY(ArchaeoLines-static STATIC ${ArchaeoLines_SRCS} ${ArchaeoLines_RES_CXX} ${ArchaeoLines_UIS_H}) |
84 | -QT5_USE_MODULES(ArchaeoLines-static Core Network Widgets Declarative) |
85 | +QT5_USE_MODULES(ArchaeoLines-static Core Network Widgets) |
86 | # The library target "ArchaeoLines-static" has a default OUTPUT_NAME of "ArchaeoLines-static", so change it. |
87 | SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES OUTPUT_NAME "ArchaeoLines") |
88 | TARGET_LINK_LIBRARIES(ArchaeoLines-static ${extLinkerOption}) |
89 | |
90 | === modified file 'plugins/EquationOfTime/src/CMakeLists.txt' |
91 | --- plugins/EquationOfTime/src/CMakeLists.txt 2014-02-07 18:16:29 +0000 |
92 | +++ plugins/EquationOfTime/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
93 | @@ -26,7 +26,7 @@ |
94 | SET(extLinkerOption ${OPENGL_LIBRARIES}) |
95 | |
96 | ADD_LIBRARY(EquationOfTime-static STATIC ${EQUATIONOFTIME_SRCS} ${EQUATIONOFTIME_RES_CXX} ${EQUATIONOFTIME_UIS_H}) |
97 | -QT5_USE_MODULES(EquationOfTime-static Core Declarative Network) |
98 | +QT5_USE_MODULES(EquationOfTime-static Core Network Gui Widgets) |
99 | SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES OUTPUT_NAME "EquationOfTime") |
100 | TARGET_LINK_LIBRARIES(EquationOfTime-static ${extLinkerOption}) |
101 | SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
102 | |
103 | === modified file 'plugins/Exoplanets/src/CMakeLists.txt' |
104 | --- plugins/Exoplanets/src/CMakeLists.txt 2013-10-10 16:59:22 +0000 |
105 | +++ plugins/Exoplanets/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
106 | @@ -27,7 +27,7 @@ |
107 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) |
108 | |
109 | ADD_LIBRARY(Exoplanets-static STATIC ${Exoplanets_SRCS} ${Exoplanets_RES_CXX} ${ExoplanetsDialog_UIS_H}) |
110 | -QT5_USE_MODULES(Exoplanets-static Core Declarative Network Widgets) |
111 | +QT5_USE_MODULES(Exoplanets-static Core Network Widgets) |
112 | SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES OUTPUT_NAME "Exoplanets") |
113 | TARGET_LINK_LIBRARIES(Exoplanets-static ${extLinkerOption}) |
114 | SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
115 | |
116 | === modified file 'plugins/FOV/src/CMakeLists.txt' |
117 | --- plugins/FOV/src/CMakeLists.txt 2014-02-16 12:58:17 +0000 |
118 | +++ plugins/FOV/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
119 | @@ -23,7 +23,7 @@ |
120 | SET(extLinkerOption ${OPENGL_LIBRARIES}) |
121 | |
122 | ADD_LIBRARY(FOV-static STATIC ${FOV_SRCS} ${FOV_RES_CXX} ${FOV_UIS_H}) |
123 | -QT5_USE_MODULES(FOV-static Core Declarative Network) |
124 | +QT5_USE_MODULES(FOV-static Core Network Widgets) |
125 | SET_TARGET_PROPERTIES(FOV-static PROPERTIES OUTPUT_NAME "FOV") |
126 | TARGET_LINK_LIBRARIES(FOV-static ${extLinkerOption}) |
127 | SET_TARGET_PROPERTIES(FOV-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
128 | |
129 | === modified file 'plugins/MeteorShowers/src/CMakeLists.txt' |
130 | --- plugins/MeteorShowers/src/CMakeLists.txt 2015-07-28 08:00:00 +0000 |
131 | +++ plugins/MeteorShowers/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
132 | @@ -36,7 +36,7 @@ |
133 | SET(extLinkerOption ${QT_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES} ${ICONV_LIBRARIES} ${INTL_LIBRARIES}) |
134 | |
135 | ADD_LIBRARY(MeteorShowers-static STATIC ${MeteorShowers_SRCS} ${MeteorShowers_MOC_SRCS} ${MeteorShowers_RES_CXX} ${MeteorShowersDialog_UIS_H}) |
136 | -QT5_USE_MODULES(MeteorShowers-static Core Declarative Network) |
137 | +QT5_USE_MODULES(MeteorShowers-static Core Network Widgets) |
138 | SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES OUTPUT_NAME "MeteorShowers") |
139 | TARGET_LINK_LIBRARIES(MeteorShowers-static ${extLinkerOption}) |
140 | SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
141 | |
142 | === modified file 'plugins/NavStars/src/CMakeLists.txt' |
143 | --- plugins/NavStars/src/CMakeLists.txt 2014-01-10 15:27:08 +0000 |
144 | +++ plugins/NavStars/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
145 | @@ -16,7 +16,7 @@ |
146 | SET(extLinkerOption ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) |
147 | |
148 | ADD_LIBRARY(NavStars-static STATIC ${NavStars_SRCS} ${NavStars_RES_CXX}) |
149 | -QT5_USE_MODULES(NavStars-static Core Declarative Network) |
150 | +QT5_USE_MODULES(NavStars-static Core Network Widgets) |
151 | SET_TARGET_PROPERTIES(NavStars-static PROPERTIES OUTPUT_NAME "NavStars") |
152 | TARGET_LINK_LIBRARIES(NavStars-static ${extLinkerOption}) |
153 | SET_TARGET_PROPERTIES(NavStars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
154 | |
155 | === modified file 'plugins/Observability/src/CMakeLists.txt' |
156 | --- plugins/Observability/src/CMakeLists.txt 2013-10-10 16:59:22 +0000 |
157 | +++ plugins/Observability/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
158 | @@ -28,7 +28,7 @@ |
159 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) |
160 | |
161 | ADD_LIBRARY(Observability-static STATIC ${Observability_SRCS} ${Observability_RES_CXX} ${ObservabilityDialog_UIS_H}) |
162 | -QT5_USE_MODULES(Observability-static Core Declarative Network) |
163 | +QT5_USE_MODULES(Observability-static Core Network Widgets) |
164 | SET_TARGET_PROPERTIES(Observability-static PROPERTIES OUTPUT_NAME "Observability") |
165 | TARGET_LINK_LIBRARIES(Observability-static ${extLinkerOption}) |
166 | SET_TARGET_PROPERTIES(Observability-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
167 | |
168 | === modified file 'plugins/Oculars/src/CMakeLists.txt' |
169 | --- plugins/Oculars/src/CMakeLists.txt 2014-07-12 08:35:25 +0000 |
170 | +++ plugins/Oculars/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
171 | @@ -38,7 +38,7 @@ |
172 | |
173 | ADD_LIBRARY(Oculars-static STATIC ${Oculars_SRCS} ${Oculars_RES_CXX} ${Oculars_UIS_H}) |
174 | SET_TARGET_PROPERTIES(Oculars-static PROPERTIES OUTPUT_NAME "Oculars") |
175 | -QT5_USE_MODULES(Oculars-static Core Declarative Network OpenGL Widgets) |
176 | +QT5_USE_MODULES(Oculars-static Core Network OpenGL Widgets) |
177 | |
178 | TARGET_LINK_LIBRARIES(Oculars-static ${StelMain} ${extLinkerOption}) |
179 | SET_TARGET_PROPERTIES(Oculars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
180 | |
181 | === modified file 'plugins/PointerCoordinates/src/CMakeLists.txt' |
182 | --- plugins/PointerCoordinates/src/CMakeLists.txt 2014-04-06 08:14:17 +0000 |
183 | +++ plugins/PointerCoordinates/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
184 | @@ -26,7 +26,7 @@ |
185 | SET(extLinkerOption ${OPENGL_LIBRARIES}) |
186 | |
187 | ADD_LIBRARY(PointerCoordinates-static STATIC ${POINTERCOORDINATES_SRCS} ${POINTERCOORDINATES_RES_CXX} ${POINTERCOORDINATES_UIS_H}) |
188 | -QT5_USE_MODULES(PointerCoordinates-static Core Declarative Network) |
189 | +QT5_USE_MODULES(PointerCoordinates-static Core Network Widgets) |
190 | SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES OUTPUT_NAME "PointerCoordinates") |
191 | TARGET_LINK_LIBRARIES(PointerCoordinates-static ${extLinkerOption}) |
192 | SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
193 | |
194 | === modified file 'plugins/Pulsars/src/CMakeLists.txt' |
195 | --- plugins/Pulsars/src/CMakeLists.txt 2013-10-10 16:59:22 +0000 |
196 | +++ plugins/Pulsars/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
197 | @@ -28,7 +28,7 @@ |
198 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) |
199 | |
200 | ADD_LIBRARY(Pulsars-static STATIC ${Pulsars_SRCS} ${Pulsars_RES_CXX} ${PulsarsDialog_UIS_H}) |
201 | -QT5_USE_MODULES(Pulsars-static Core Declarative Network) |
202 | +QT5_USE_MODULES(Pulsars-static Core Network Widgets) |
203 | SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES OUTPUT_NAME "Pulsars") |
204 | TARGET_LINK_LIBRARIES(Pulsars-static ${extLinkerOption}) |
205 | SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
206 | |
207 | === modified file 'plugins/Quasars/src/CMakeLists.txt' |
208 | --- plugins/Quasars/src/CMakeLists.txt 2013-10-10 16:59:22 +0000 |
209 | +++ plugins/Quasars/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
210 | @@ -28,7 +28,7 @@ |
211 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) |
212 | |
213 | ADD_LIBRARY(Quasars-static STATIC ${Quasars_SRCS} ${Quasars_RES_CXX} ${QuasarsDialog_UIS_H}) |
214 | -QT5_USE_MODULES(Quasars-static Core Declarative Network) |
215 | +QT5_USE_MODULES(Quasars-static Core Network Widgets) |
216 | SET_TARGET_PROPERTIES(Quasars-static PROPERTIES OUTPUT_NAME "Quasars") |
217 | TARGET_LINK_LIBRARIES(Quasars-static ${extLinkerOption}) |
218 | SET_TARGET_PROPERTIES(Quasars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
219 | |
220 | === modified file 'plugins/Satellites/src/CMakeLists.txt' |
221 | --- plugins/Satellites/src/CMakeLists.txt 2014-01-25 10:45:14 +0000 |
222 | +++ plugins/Satellites/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
223 | @@ -50,7 +50,7 @@ |
224 | SET(extLinkerOption ${OPENGL_LIBRARIES}) |
225 | |
226 | ADD_LIBRARY(Satellites-static STATIC ${Satellites_SRCS} ${Satellites_RES_CXX} ${SatellitesDialog_UIS_H}) |
227 | -QT5_USE_MODULES(Satellites-static Core Declarative Network OpenGL) |
228 | +QT5_USE_MODULES(Satellites-static Core Network OpenGL) |
229 | # The library target "Satellites-static" has a default OUTPUT_NAME of "Satellites-static", so change it. |
230 | SET_TARGET_PROPERTIES(Satellites-static PROPERTIES OUTPUT_NAME "Satellites") |
231 | TARGET_LINK_LIBRARIES(Satellites-static ${StelMain} ${extLinkerOption}) |
232 | |
233 | === modified file 'plugins/SolarSystemEditor/src/CMakeLists.txt' |
234 | --- plugins/SolarSystemEditor/src/CMakeLists.txt 2013-10-10 16:59:22 +0000 |
235 | +++ plugins/SolarSystemEditor/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
236 | @@ -30,7 +30,7 @@ |
237 | SET(extLinkerOption ${OPENGL_LIBRARIES}) |
238 | |
239 | ADD_LIBRARY(SolarSystemEditor-static STATIC ${SolarSystemEditor_SRCS} ${SolarSystemEditor_RES_CXX} ${SolarSystemEditor_UIS_H}) |
240 | -QT5_USE_MODULES(SolarSystemEditor-static Core Declarative Network) |
241 | +QT5_USE_MODULES(SolarSystemEditor-static Core Network Widgets) |
242 | SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES OUTPUT_NAME "SolarSystemEditor") |
243 | TARGET_LINK_LIBRARIES(SolarSystemEditor-static ${extLinkerOption}) |
244 | SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
245 | |
246 | === modified file 'plugins/Supernovae/src/CMakeLists.txt' |
247 | --- plugins/Supernovae/src/CMakeLists.txt 2013-10-10 16:59:22 +0000 |
248 | +++ plugins/Supernovae/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
249 | @@ -28,7 +28,7 @@ |
250 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) |
251 | |
252 | ADD_LIBRARY(Supernovae-static STATIC ${Supernovae_SRCS} ${Supernovae_RES_CXX} ${SupernovaeDialog_UIS_H}) |
253 | -QT5_USE_MODULES(Supernovae-static Core Declarative Network) |
254 | +QT5_USE_MODULES(Supernovae-static Core Network Widgets) |
255 | SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES OUTPUT_NAME "Supernovae") |
256 | TARGET_LINK_LIBRARIES(Supernovae-static ${extLinkerOption}) |
257 | SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
258 | |
259 | === modified file 'plugins/TelescopeControl/src/CMakeLists.txt' |
260 | --- plugins/TelescopeControl/src/CMakeLists.txt 2015-06-30 18:51:58 +0000 |
261 | +++ plugins/TelescopeControl/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
262 | @@ -64,6 +64,6 @@ |
263 | ADD_LIBRARY(TelescopeControl-static STATIC ${TelescopeControl_SRCS} ${TelescopeControl_RES_CXX} ${TelescopeControl_UIS_H}) |
264 | SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES OUTPUT_NAME "TelescopeControl") |
265 | TARGET_LINK_LIBRARIES(TelescopeControl-static ${extLinkerOption}) |
266 | -QT5_USE_MODULES(TelescopeControl-static Core Network Widgets Declarative OpenGL) |
267 | +QT5_USE_MODULES(TelescopeControl-static Core Network Widgets OpenGL) |
268 | SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
269 | ADD_DEPENDENCIES(AllStaticPlugins TelescopeControl-static) |
270 | |
271 | === modified file 'plugins/TextUserInterface/src/CMakeLists.txt' |
272 | --- plugins/TextUserInterface/src/CMakeLists.txt 2013-10-10 16:59:22 +0000 |
273 | +++ plugins/TextUserInterface/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
274 | @@ -31,7 +31,7 @@ |
275 | SET(extLinkerOption ${OPENGL_LIBRARIES}) |
276 | |
277 | ADD_LIBRARY(TextUserInterface-static STATIC ${TextUserInterface_SRCS}) |
278 | -QT5_USE_MODULES(TextUserInterface-static Core Declarative) |
279 | +QT5_USE_MODULES(TextUserInterface-static Core Widgets) |
280 | # The library target "TextUserInterface-static" has a default OUTPUT_NAME of "TextUserInterface-static", so change it. |
281 | SET_TARGET_PROPERTIES(TextUserInterface-static PROPERTIES OUTPUT_NAME "TextUserInterface") |
282 | TARGET_LINK_LIBRARIES(TextUserInterface-static ${extLinkerOption}) |
283 | |
284 | === modified file 'plugins/TimeZoneConfiguration/src/CMakeLists.txt' |
285 | --- plugins/TimeZoneConfiguration/src/CMakeLists.txt 2013-10-10 16:59:22 +0000 |
286 | +++ plugins/TimeZoneConfiguration/src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
287 | @@ -26,7 +26,7 @@ |
288 | SET(extLinkerOption ${OPENGL_LIBRARIES}) |
289 | |
290 | ADD_LIBRARY(TimeZoneConfiguration-static STATIC ${TimeZoneConfiguration_SRCS} ${TimeZoneConfiguration_RES_CXX} ${TimeZoneConfiguration_UIS_H}) |
291 | -QT5_USE_MODULES(TimeZoneConfiguration-static Core Declarative Network) |
292 | +QT5_USE_MODULES(TimeZoneConfiguration-static Core Network Gui Widgets) |
293 | SET_TARGET_PROPERTIES(TimeZoneConfiguration-static PROPERTIES OUTPUT_NAME "TimeZoneConfiguration") |
294 | TARGET_LINK_LIBRARIES(TimeZoneConfiguration-static ${extLinkerOption}) |
295 | SET_TARGET_PROPERTIES(TimeZoneConfiguration-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
296 | |
297 | === modified file 'src/CMakeLists.txt' |
298 | --- src/CMakeLists.txt 2015-08-22 22:18:04 +0000 |
299 | +++ src/CMakeLists.txt 2015-08-26 03:52:16 +0000 |
300 | @@ -423,7 +423,7 @@ |
301 | IF(GENERATE_STELMAINLIB) |
302 | ADD_LIBRARY(stelMain SHARED ${stellarium_lib_SRCS} ${stellarium_RES_CXX}) |
303 | TARGET_LINK_LIBRARIES(stelMain ${extLinkerOption} ${STELLARIUM_STATIC_PLUGINS_LIBRARIES}) |
304 | - QT5_USE_MODULES(stelMain Core Concurrent Declarative Gui Network OpenGL Script Widgets) |
305 | + QT5_USE_MODULES(stelMain Core Concurrent Gui Network OpenGL Script Widgets) |
306 | IF(ENABLE_SOUND) |
307 | QT5_USE_MODULES(stelMain Multimedia) |
308 | ENDIF() |
309 | @@ -437,7 +437,7 @@ |
310 | # This will add the ANGLE lib if the Qt version supports it. |
311 | TARGET_LINK_LIBRARIES(stellarium ${Qt5Gui_LIBRARIES} ${Qt5Gui_OPENGL_LIBRARIES}) |
312 | |
313 | - QT5_USE_MODULES(stellarium Core Concurrent Declarative Gui Network OpenGL Script Widgets) |
314 | + QT5_USE_MODULES(stellarium Core Concurrent Gui Network OpenGL Script Widgets) |
315 | IF(ENABLE_SOUND) |
316 | QT5_USE_MODULES(stellarium Multimedia) |
317 | ENDIF() |
318 | @@ -477,7 +477,7 @@ |
319 | SET(tests_testDates_SRCS ${tests_testDates_SRCS} ${zlib_SRCS}) |
320 | ENDIF() |
321 | ADD_EXECUTABLE(testDates EXCLUDE_FROM_ALL ${tests_testDates_SRCS}) |
322 | -QT5_USE_MODULES(testDates Core Gui Widgets Script Declarative Test) |
323 | +QT5_USE_MODULES(testDates Core Gui Widgets Script Test) |
324 | TARGET_LINK_LIBRARIES(testDates ${extLinkerOptionTest}) |
325 | ADD_DEPENDENCIES(buildTests testDates) |
326 | ADD_TEST(testDates) |
327 | @@ -488,7 +488,7 @@ |
328 | core/StelFileMgr.hpp |
329 | core/StelFileMgr.cpp) |
330 | ADD_EXECUTABLE(testStelFileMgr EXCLUDE_FROM_ALL ${tests_testStelFileMgr_SRCS}) |
331 | -QT5_USE_MODULES(testStelFileMgr Core Gui Widgets Script Declarative Test) |
332 | +QT5_USE_MODULES(testStelFileMgr Core Gui Widgets Script Test) |
333 | TARGET_LINK_LIBRARIES(testStelFileMgr ${extLinkerOptionTest}) |
334 | ADD_DEPENDENCIES(buildTests testStelFileMgr) |
335 | ADD_TEST(testStelFileMgr) |
336 | @@ -544,7 +544,7 @@ |
337 | # core/StelTranslator.hpp |
338 | # ${glues_lib_SRCS}) |
339 | #ADD_EXECUTABLE(testStelSphericalIndex EXCLUDE_FROM_ALL ${tests_testStelSphericalIndex_SRCS}) |
340 | -#QT5_USE_MODULES(testStelSphericalIndex Core Gui Widgets OpenGL Script Declarative Test) |
341 | +#QT5_USE_MODULES(testStelSphericalIndex Core Gui Widgets OpenGL Script Test) |
342 | #TARGET_LINK_LIBRARIES(testStelSphericalIndex ${extLinkerOptionTest}) |
343 | #ADD_DEPENDENCIES(buildTests testStelSphericalIndex) |
344 | |
345 | @@ -554,7 +554,7 @@ |
346 | core/StelJsonParser.hpp |
347 | core/StelJsonParser.cpp) |
348 | ADD_EXECUTABLE(testStelJsonParser EXCLUDE_FROM_ALL ${tests_testStelJsonParser_SRCS}) |
349 | -QT5_USE_MODULES(testStelJsonParser Core Gui Widgets Script Declarative Test) |
350 | +QT5_USE_MODULES(testStelJsonParser Core Gui Widgets Script Test) |
351 | TARGET_LINK_LIBRARIES(testStelJsonParser ${extLinkerOptionTest}) |
352 | ADD_DEPENDENCIES(buildTests testStelJsonParser) |
353 | ADD_TEST(testStelJsonParser) |
354 | @@ -579,7 +579,7 @@ |
355 | SET(tests_testDeltaT_SRCS ${tests_testDeltaT_SRCS} ${zlib_SRCS}) |
356 | ENDIF() |
357 | ADD_EXECUTABLE(testDeltaT EXCLUDE_FROM_ALL ${tests_testDeltaT_SRCS}) |
358 | -QT5_USE_MODULES(testDeltaT Core Gui Widgets Script Declarative Test) |
359 | +QT5_USE_MODULES(testDeltaT Core Gui Widgets Script Test) |
360 | TARGET_LINK_LIBRARIES(testDeltaT ${extLinkerOptionTest}) |
361 | ADD_DEPENDENCIES(buildTests testDeltaT) |
362 | ADD_TEST(testDeltaT) |
363 | @@ -594,7 +594,7 @@ |
364 | SET(tests_testConversions_SRCS ${tests_testConversions_SRCS} ${zlib_SRCS}) |
365 | ENDIF() |
366 | ADD_EXECUTABLE(testConversions EXCLUDE_FROM_ALL ${tests_testConversions_SRCS}) |
367 | -QT5_USE_MODULES(testConversions Core Gui Widgets Script Declarative Test) |
368 | +QT5_USE_MODULES(testConversions Core Gui Widgets Script Test) |
369 | TARGET_LINK_LIBRARIES(testConversions ${extLinkerOptionTest}) |
370 | ADD_DEPENDENCIES(buildTests testConversions) |
371 | ADD_TEST(testConversions) |
372 | @@ -605,7 +605,7 @@ |
373 | core/RefractionExtinction.hpp |
374 | core/RefractionExtinction.cpp) |
375 | ADD_EXECUTABLE(testExtinction EXCLUDE_FROM_ALL ${tests_testExtinction_SRCS}) |
376 | -QT5_USE_MODULES(testExtinction Core Gui Widgets Script Declarative Test) |
377 | +QT5_USE_MODULES(testExtinction Core Gui Widgets Script Test) |
378 | TARGET_LINK_LIBRARIES(testExtinction ${extLinkerOptionTest}) |
379 | ADD_DEPENDENCIES(buildTests testExtinction) |
380 | ADD_TEST(testExtinction) |
381 | @@ -622,7 +622,7 @@ |
382 | SET(tests_testRefraction_SRCS ${tests_testRefraction_SRCS} ${zlib_SRCS}) |
383 | ENDIF() |
384 | ADD_EXECUTABLE(testRefraction EXCLUDE_FROM_ALL ${tests_testRefraction_SRCS}) |
385 | -QT5_USE_MODULES(testRefraction Core Gui Widgets Script Declarative Test) |
386 | +QT5_USE_MODULES(testRefraction Core Gui Widgets Script Test) |
387 | TARGET_LINK_LIBRARIES(testRefraction ${extLinkerOptionTest}) |
388 | ADD_DEPENDENCIES(buildTests testRefraction) |
389 | ADD_TEST(testRefraction) |
390 | @@ -639,7 +639,7 @@ |
391 | SET(tests_testPrecession_SRCS ${tests_testPrecession_SRCS} ${zlib_SRCS}) |
392 | ENDIF() |
393 | ADD_EXECUTABLE(testPrecession EXCLUDE_FROM_ALL ${tests_testPrecession_SRCS}) |
394 | -QT5_USE_MODULES(testPrecession Core Gui Widgets Script Declarative Test) |
395 | +QT5_USE_MODULES(testPrecession Core Gui Widgets Script Test) |
396 | TARGET_LINK_LIBRARIES(testPrecession ${extLinkerOptionTest}) |
397 | ADD_DEPENDENCIES(buildTests testPrecession) |
398 | ADD_TEST(testPrecession) |
399 | |
400 | === modified file 'src/StelMainView.cpp' |
401 | --- src/StelMainView.cpp 2015-08-18 18:33:37 +0000 |
402 | +++ src/StelMainView.cpp 2015-08-26 03:52:16 +0000 |
403 | @@ -30,7 +30,6 @@ |
404 | #include "StelActionMgr.hpp" |
405 | #include "StelOpenGL.hpp" |
406 | |
407 | -#include <QDeclarativeItem> |
408 | #include <QDebug> |
409 | #include <QDir> |
410 | #if STEL_USE_NEW_OPENGL_WIDGETS |
411 | @@ -41,6 +40,10 @@ |
412 | #include <QApplication> |
413 | #include <QDesktopWidget> |
414 | #include <QGuiApplication> |
415 | +#include <QGraphicsSceneMouseEvent> |
416 | +#include <QGraphicsAnchorLayout> |
417 | +#include <QGraphicsWidget> |
418 | +#include <QGraphicsEffect> |
419 | #include <QFileInfo> |
420 | #include <QIcon> |
421 | #include <QMoveEvent> |
422 | @@ -53,23 +56,108 @@ |
423 | #include <QWidget> |
424 | #include <QWindow> |
425 | #include <QMessageBox> |
426 | -#include <QDeclarativeContext> |
427 | #ifdef Q_OS_WIN |
428 | #include <QPinchGesture> |
429 | #endif |
430 | #include <QOpenGLShader> |
431 | #include <QOpenGLShaderProgram> |
432 | +#include <QGLFramebufferObject> |
433 | +#include <QGLShaderProgram> |
434 | |
435 | #include <clocale> |
436 | |
437 | // Initialize static variables |
438 | StelMainView* StelMainView::singleton = NULL; |
439 | |
440 | +// A custom QGraphicsEffect to apply the night mode on top of the screen. |
441 | +class NightModeGraphicsEffect : public QGraphicsEffect |
442 | +{ |
443 | +public: |
444 | + NightModeGraphicsEffect(QObject* parent = NULL); |
445 | +protected: |
446 | + virtual void draw(QPainter* painter); |
447 | +private: |
448 | + QGLFramebufferObject* fbo; |
449 | + QGLShaderProgram *program; |
450 | + struct { |
451 | + int pos; |
452 | + int texCoord; |
453 | + int source; |
454 | + } vars; |
455 | +}; |
456 | + |
457 | +NightModeGraphicsEffect::NightModeGraphicsEffect(QObject* parent) : |
458 | + QGraphicsEffect(parent) |
459 | + , fbo(NULL) |
460 | +{ |
461 | + program = new QGLShaderProgram(this); |
462 | + QString vertexCode = |
463 | + "attribute highp vec4 a_pos;\n" |
464 | + "attribute highp vec2 a_texCoord;\n" |
465 | + "varying highp vec2 v_texCoord;\n" |
466 | + "void main(void)\n" |
467 | + "{\n" |
468 | + "v_texCoord = a_texCoord;\n" |
469 | + "gl_Position = a_pos;\n" |
470 | + "}\n"; |
471 | + QString fragmentCode = |
472 | + "varying highp vec2 v_texCoord;\n" |
473 | + "uniform sampler2D u_source;\n" |
474 | + "void main(void)\n" |
475 | + "{\n" |
476 | + " mediump vec3 color = texture2D(u_source, v_texCoord).rgb;\n" |
477 | + " mediump float luminance = max(max(color.r, color.g), color.b);\n" |
478 | + " gl_FragColor = vec4(luminance, 0.0, 0.0, 1.0);\n" |
479 | + "}\n"; |
480 | + program->addShaderFromSourceCode(QGLShader::Vertex, vertexCode); |
481 | + program->addShaderFromSourceCode(QGLShader::Fragment, fragmentCode); |
482 | + program->link(); |
483 | + vars.pos = program->attributeLocation("a_pos"); |
484 | + vars.texCoord = program->attributeLocation("a_texCoord"); |
485 | + vars.source = program->uniformLocation("u_source"); |
486 | +} |
487 | + |
488 | +void NightModeGraphicsEffect::draw(QPainter* painter) |
489 | +{ |
490 | + QSize size(painter->device()->width(), painter->device()->height()); |
491 | + if (fbo && fbo->size() != size) |
492 | + { |
493 | + delete fbo; |
494 | + fbo = NULL; |
495 | + } |
496 | + if (!fbo) |
497 | + { |
498 | + QGLFramebufferObjectFormat format; |
499 | + format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); |
500 | + format.setInternalTextureFormat(GL_RGBA); |
501 | + fbo = new QGLFramebufferObject(size, format); |
502 | + } |
503 | + QPainter fboPainter(fbo); |
504 | + drawSource(&fboPainter); |
505 | + |
506 | + painter->save(); |
507 | + painter->beginNativePainting(); |
508 | + program->bind(); |
509 | + const GLfloat pos[] = {-1, -1, +1, -1, -1, +1, +1, +1}; |
510 | + const GLfloat texCoord[] = {0, 0, 1, 0, 0, 1, 1, 1}; |
511 | + program->setUniformValue(vars.source, 0); |
512 | + program->setAttributeArray(vars.pos, pos, 2); |
513 | + program->setAttributeArray(vars.texCoord, texCoord, 2); |
514 | + program->enableAttributeArray(vars.pos); |
515 | + program->enableAttributeArray(vars.texCoord); |
516 | + QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); |
517 | + f->glBindTexture(GL_TEXTURE_2D, fbo->texture()); |
518 | + f->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); |
519 | + program->release(); |
520 | + painter->endNativePainting(); |
521 | + painter->restore(); |
522 | +} |
523 | + |
524 | //! Render Stellarium sky. |
525 | -class StelSkyItem : public QDeclarativeItem |
526 | +class StelSkyItem : public QGraphicsWidget |
527 | { |
528 | public: |
529 | - StelSkyItem(QDeclarativeItem* parent = NULL); |
530 | + StelSkyItem(QGraphicsItem* parent = NULL); |
531 | void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); |
532 | protected: |
533 | void mousePressEvent(QGraphicsSceneMouseEvent* event); |
534 | @@ -78,12 +166,13 @@ |
535 | void wheelEvent(QGraphicsSceneWheelEvent *event); |
536 | void keyPressEvent(QKeyEvent *event); |
537 | void keyReleaseEvent(QKeyEvent *event); |
538 | + void resizeEvent(QGraphicsSceneResizeEvent* event); |
539 | #ifdef Q_OS_WIN |
540 | bool event(QEvent * e); |
541 | #endif |
542 | private: |
543 | double previousPaintTime; |
544 | - void onSizeChanged(); |
545 | + // void onSizeChanged(); |
546 | #ifdef Q_OS_WIN |
547 | void pinchTriggered(QPinchGesture *gesture); |
548 | bool gestureEvent(QGestureEvent *event); |
549 | @@ -91,16 +180,18 @@ |
550 | }; |
551 | |
552 | //! Initialize and render Stellarium gui. |
553 | -class StelGuiItem : public QDeclarativeItem |
554 | +class StelGuiItem : public QGraphicsWidget |
555 | { |
556 | public: |
557 | - StelGuiItem(QDeclarativeItem* parent = NULL); |
558 | + StelGuiItem(QGraphicsItem* parent = NULL); |
559 | +protected: |
560 | + void resizeEvent(QGraphicsSceneResizeEvent* event); |
561 | private: |
562 | QGraphicsWidget *widget; |
563 | - void onSizeChanged(); |
564 | + // void onSizeChanged(); |
565 | }; |
566 | |
567 | -StelSkyItem::StelSkyItem(QDeclarativeItem* parent) |
568 | +StelSkyItem::StelSkyItem(QGraphicsItem* parent) |
569 | { |
570 | Q_UNUSED(parent); |
571 | setObjectName("SkyItem"); |
572 | @@ -111,16 +202,14 @@ |
573 | grabGesture(Qt::PinchGesture); |
574 | #endif |
575 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton); |
576 | - connect(this, &StelSkyItem::widthChanged, this, &StelSkyItem::onSizeChanged); |
577 | - connect(this, &StelSkyItem::heightChanged, this, &StelSkyItem::onSizeChanged); |
578 | previousPaintTime = StelApp::getTotalRunTime(); |
579 | - StelMainView::getInstance().skyItem = this; |
580 | - setFocus(true); |
581 | + setFocus(); |
582 | } |
583 | |
584 | -void StelSkyItem::onSizeChanged() |
585 | +void StelSkyItem::resizeEvent(QGraphicsSceneResizeEvent* event) |
586 | { |
587 | - StelApp::getInstance().glWindowHasBeenResized(x(), y(), width(), height()); |
588 | + QGraphicsWidget::resizeEvent(event); |
589 | + StelApp::getInstance().glWindowHasBeenResized(scenePos().x(), scene()->sceneRect().height()-(scenePos().y()+geometry().height()), geometry().width(), geometry().height()); |
590 | } |
591 | |
592 | void StelSkyItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
593 | @@ -144,9 +233,9 @@ |
594 | void StelSkyItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
595 | { |
596 | //To get back the focus from dialogs |
597 | - this->setFocus(true); |
598 | + this->setFocus(); |
599 | QPointF pos = event->scenePos(); |
600 | - pos.setY(height() - 1 - pos.y()); |
601 | + pos.setY(size().height() - 1 - pos.y()); |
602 | QMouseEvent newEvent(QEvent::MouseButtonPress, QPoint(pos.x(), pos.y()), event->button(), event->buttons(), event->modifiers()); |
603 | StelApp::getInstance().handleClick(&newEvent); |
604 | } |
605 | @@ -154,7 +243,7 @@ |
606 | void StelSkyItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) |
607 | { |
608 | QPointF pos = event->scenePos(); |
609 | - pos.setY(height() - 1 - pos.y()); |
610 | + pos.setY(size().height() - 1 - pos.y()); |
611 | QMouseEvent newEvent(QEvent::MouseButtonRelease, QPoint(pos.x(), pos.y()), event->button(), event->buttons(), event->modifiers()); |
612 | StelApp::getInstance().handleClick(&newEvent); |
613 | } |
614 | @@ -162,14 +251,14 @@ |
615 | void StelSkyItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) |
616 | { |
617 | QPointF pos = event->scenePos(); |
618 | - pos.setY(height() - 1 - pos.y()); |
619 | + pos.setY(size().height() - 1 - pos.y()); |
620 | StelApp::getInstance().handleMove(pos.x(), pos.y(), event->buttons()); |
621 | } |
622 | |
623 | void StelSkyItem::wheelEvent(QGraphicsSceneWheelEvent *event) |
624 | { |
625 | QPointF pos = event->scenePos(); |
626 | - pos.setY(height() - 1 - pos.y()); |
627 | + pos.setY(size().height() - 1 - pos.y()); |
628 | QWheelEvent newEvent(QPoint(pos.x(),pos.y()), event->delta(), event->buttons(), event->modifiers(), event->orientation()); |
629 | StelApp::getInstance().handleWheel(&newEvent); |
630 | } |
631 | @@ -208,7 +297,7 @@ |
632 | pinchTriggered(static_cast<QPinchGesture *>(pinch)); |
633 | |
634 | return true; |
635 | -} |
636 | +c |
637 | |
638 | void StelSkyItem::pinchTriggered(QPinchGesture *gesture) |
639 | { |
640 | @@ -234,24 +323,18 @@ |
641 | } |
642 | |
643 | |
644 | -StelGuiItem::StelGuiItem(QDeclarativeItem* parent) : QDeclarativeItem(parent) |
645 | +StelGuiItem::StelGuiItem(QGraphicsItem* parent) : QGraphicsWidget(parent) |
646 | { |
647 | - connect(this, &StelGuiItem::widthChanged, this, &StelGuiItem::onSizeChanged); |
648 | - connect(this, &StelGuiItem::heightChanged, this, &StelGuiItem::onSizeChanged); |
649 | widget = new QGraphicsWidget(this); |
650 | - StelMainView::getInstance().guiWidget = widget; |
651 | StelApp::getInstance().getGui()->init(widget); |
652 | } |
653 | |
654 | -void StelGuiItem::onSizeChanged() |
655 | +void StelGuiItem::resizeEvent(QGraphicsSceneResizeEvent* event) |
656 | { |
657 | - // I wish I could find a way to let Qt automatically resize the widget |
658 | - // when the QDeclarativeItem size changes. |
659 | - widget->setGeometry(0, 0, width(), height()); |
660 | + widget->setGeometry(0, 0, size().width(), size().height()); |
661 | StelApp::getInstance().getGui()->forceRefreshGui(); |
662 | } |
663 | |
664 | - |
665 | #if STEL_USE_NEW_OPENGL_WIDGETS |
666 | |
667 | class StelQOpenGLWidget : public QOpenGLWidget |
668 | @@ -323,7 +406,7 @@ |
669 | |
670 | |
671 | StelMainView::StelMainView(QWidget* parent) |
672 | - : QDeclarativeView(parent), gui(NULL), |
673 | + : QGraphicsView(parent), guiItem(NULL), gui(NULL), |
674 | flagInvertScreenShotColors(false), |
675 | screenShotPrefix("stellarium-"), |
676 | screenShotDir(""), |
677 | @@ -394,6 +477,11 @@ |
678 | |
679 | setViewport(glWidget); |
680 | |
681 | + setScene(new QGraphicsScene(this)); |
682 | + scene()->setItemIndexMethod(QGraphicsScene::NoIndex); |
683 | + rootItem = new QGraphicsWidget(); |
684 | + rootItem->setFocusPolicy(Qt::NoFocus); |
685 | + |
686 | // Workaround (see Bug #940638) Although we have already explicitly set |
687 | // LC_NUMERIC to "C" in main.cpp there seems to be a bug in OpenGL where |
688 | // it will silently reset LC_NUMERIC to the value of LC_ALL during OpenGL |
689 | @@ -403,11 +491,18 @@ |
690 | // End workaround |
691 | } |
692 | |
693 | +void StelMainView::resizeEvent(QResizeEvent* event) |
694 | +{ |
695 | + scene()->setSceneRect(QRect(QPoint(0, 0), event->size())); |
696 | + rootItem->setGeometry(0,0,event->size().width(),event->size().height()); |
697 | + QGraphicsView::resizeEvent(event); |
698 | +} |
699 | + |
700 | void StelMainView::focusSky() { |
701 | StelMainView::getInstance().scene()->setActiveWindow(0); |
702 | - QGraphicsObject* skyItem = rootObject()->findChild<QGraphicsObject*>("SkyItem"); |
703 | - Q_ASSERT(skyItem); |
704 | - skyItem->setFocus(); |
705 | + // QGraphicsObject* skyItem = rootObject()->findChild<QGraphicsObject*>("SkyItem"); |
706 | + // Q_ASSERT(skyItem); |
707 | + // skyItem->setFocus(); |
708 | } |
709 | |
710 | StelMainView::~StelMainView() |
711 | @@ -444,12 +539,20 @@ |
712 | |
713 | StelPainter::initGLShaders(); |
714 | |
715 | - setResizeMode(QDeclarativeView::SizeRootObjectToView); |
716 | - qmlRegisterType<StelSkyItem>("Stellarium", 1, 0, "StelSky"); |
717 | - qmlRegisterType<StelGuiItem>("Stellarium", 1, 0, "StelGui"); |
718 | - rootContext()->setContextProperty("stelApp", stelApp); |
719 | - setSource(QUrl("qrc:/qml/main.qml")); |
720 | - |
721 | + skyItem = new StelSkyItem(); |
722 | + guiItem = new StelGuiItem(); |
723 | + QGraphicsAnchorLayout* l = new QGraphicsAnchorLayout(rootItem); |
724 | + l->setSpacing(0); |
725 | + l->setContentsMargins(0,0,0,0); |
726 | + l->addCornerAnchors(skyItem, Qt::TopLeftCorner, l, Qt::TopLeftCorner); |
727 | + l->addCornerAnchors(skyItem, Qt::BottomRightCorner, l, Qt::BottomRightCorner); |
728 | + l->addCornerAnchors(guiItem, Qt::BottomLeftCorner, l, Qt::BottomLeftCorner); |
729 | + l->addCornerAnchors(guiItem, Qt::TopRightCorner, l, Qt::TopRightCorner); |
730 | + rootItem->setLayout(l); |
731 | + scene()->addItem(rootItem); |
732 | + nightModeEffect = new NightModeGraphicsEffect(this); |
733 | + rootItem->setGraphicsEffect(nightModeEffect); |
734 | + |
735 | QSize size = glWidget->windowHandle()->screen()->size(); |
736 | size = QSize(conf->value("video/screen_w", size.width()).toInt(), |
737 | conf->value("video/screen_h", size.height()).toInt()); |
738 | @@ -515,6 +618,7 @@ |
739 | { |
740 | // So that the bottom bar tooltips get properly rendered in night mode. |
741 | setProperty("nightMode", StelApp::getInstance().getVisionModeNight()); |
742 | + nightModeEffect->setEnabled(StelApp::getInstance().getVisionModeNight()); |
743 | } |
744 | |
745 | // This is a series of various diagnostics based on "bugs" reported for 0.13.0 and 0.13.1. |
746 | @@ -974,25 +1078,25 @@ |
747 | // restored. |
748 | if (event->buttons() || QGuiApplication::overrideCursor()!=0) |
749 | thereWasAnEvent(); // Refresh screen ASAP |
750 | - QDeclarativeView::mouseMoveEvent(event); |
751 | + QGraphicsView::mouseMoveEvent(event); |
752 | } |
753 | |
754 | void StelMainView::mousePressEvent(QMouseEvent* event) |
755 | { |
756 | thereWasAnEvent(); // Refresh screen ASAP |
757 | - QDeclarativeView::mousePressEvent(event); |
758 | + QGraphicsView::mousePressEvent(event); |
759 | } |
760 | |
761 | void StelMainView::mouseReleaseEvent(QMouseEvent* event) |
762 | { |
763 | thereWasAnEvent(); // Refresh screen ASAP |
764 | - QDeclarativeView::mouseReleaseEvent(event); |
765 | + QGraphicsView::mouseReleaseEvent(event); |
766 | } |
767 | |
768 | void StelMainView::wheelEvent(QWheelEvent* event) |
769 | { |
770 | thereWasAnEvent(); // Refresh screen ASAP |
771 | - QDeclarativeView::wheelEvent(event); |
772 | + QGraphicsView::wheelEvent(event); |
773 | } |
774 | |
775 | void StelMainView::moveEvent(QMoveEvent * event) |
776 | @@ -1018,13 +1122,13 @@ |
777 | event->setAccepted(true); |
778 | return; |
779 | } |
780 | - QDeclarativeView::keyPressEvent(event); |
781 | + QGraphicsView::keyPressEvent(event); |
782 | } |
783 | |
784 | void StelMainView::keyReleaseEvent(QKeyEvent* event) |
785 | { |
786 | thereWasAnEvent(); // Refresh screen ASAP |
787 | - QDeclarativeView::keyReleaseEvent(event); |
788 | + QGraphicsView::keyReleaseEvent(event); |
789 | } |
790 | |
791 | |
792 | |
793 | === modified file 'src/StelMainView.hpp' |
794 | --- src/StelMainView.hpp 2015-08-18 13:22:27 +0000 |
795 | +++ src/StelMainView.hpp 2015-08-26 03:52:16 +0000 |
796 | @@ -20,8 +20,8 @@ |
797 | #ifndef _STELMAINGRAPHICSVIEW_HPP_ |
798 | #define _STELMAINGRAPHICSVIEW_HPP_ |
799 | |
800 | -#include <QDeclarativeView> |
801 | #include <QCoreApplication> |
802 | +#include <QGraphicsView> |
803 | #include <QEventLoop> |
804 | #include <QOpenGLContext> |
805 | |
806 | @@ -30,7 +30,6 @@ |
807 | // has not been done. As soon as Qt5.4 is out, we should finish this migration process! |
808 | #define STEL_USE_NEW_OPENGL_WIDGETS 0 |
809 | |
810 | -class QDeclarativeItem; |
811 | #if STEL_USE_NEW_OPENGL_WIDGETS |
812 | class QOpenGLWidget; |
813 | class StelQOpenGLWidget; |
814 | @@ -47,7 +46,7 @@ |
815 | //! @class StelMainView |
816 | //! Reimplement a QGraphicsView for Stellarium. |
817 | //! It is the class creating the singleton GL Widget, the main StelApp instance as well as the main GUI. |
818 | -class StelMainView : public QDeclarativeView |
819 | +class StelMainView : public QGraphicsView |
820 | { |
821 | friend class StelGuiItem; |
822 | friend class StelSkyItem; |
823 | @@ -75,7 +74,7 @@ |
824 | void focusSky(); |
825 | //! Return the parent gui widget, this should be used as parent to all |
826 | //! the StelDialog instances. |
827 | - QGraphicsWidget* getGuiWidget() const {return guiWidget;} |
828 | + QGraphicsWidget* getGuiWidget() const {return guiItem;} |
829 | //! Return mouse position coordinates |
830 | QPoint getMousePos(); |
831 | public slots: |
832 | @@ -137,6 +136,7 @@ |
833 | virtual void wheelEvent(QWheelEvent* wheelEvent); |
834 | virtual void moveEvent(QMoveEvent* event); |
835 | virtual void closeEvent(QCloseEvent* event); |
836 | + virtual void resizeEvent(QResizeEvent* event); |
837 | |
838 | //! Update the mouse pointer state and schedule next redraw. |
839 | //! This method is called automatically by Qt. |
840 | @@ -171,10 +171,10 @@ |
841 | //! The StelMainView singleton |
842 | static StelMainView* singleton; |
843 | |
844 | - //! This is created by the StelGuiItem, but need to be publicly |
845 | - //! accessible so that StelDialog instances can reparent to it. |
846 | - QGraphicsWidget *guiWidget; |
847 | - QDeclarativeItem* skyItem; |
848 | + QGraphicsWidget* rootItem; |
849 | + QGraphicsWidget* skyItem; |
850 | + QGraphicsWidget* guiItem; |
851 | + QGraphicsEffect* nightModeEffect; |
852 | |
853 | //! The openGL window |
854 | #if STEL_USE_NEW_OPENGL_WIDGETS |
It works good for me