Merge lp:~stellarium/stellarium/night-mode-shader into lp:stellarium
- night-mode-shader
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Alexander Wolf |
Approved revision: | 6321 |
Merged at revision: | 6329 |
Proposed branch: | lp:~stellarium/stellarium/night-mode-shader |
Merge into: | lp:stellarium |
Diff against target: |
1598 lines (+141/-484) 51 files modified
data/default_config.ini (+0/-29) data/qml/main.qml (+33/-9) plugins/AngleMeasure/src/AngleMeasure.cpp (+3/-14) plugins/CompassMarks/src/CompassMarks.cpp (+1/-7) plugins/Exoplanets/src/Exoplanet.cpp (+1/-4) plugins/Novae/src/Nova.cpp (+1/-4) plugins/Oculars/src/Oculars.cpp (+1/-5) plugins/Oculars/src/gui/OcularsGuiPanel.cpp (+3/-28) plugins/Oculars/src/gui/OcularsGuiPanel.hpp (+0/-2) plugins/Pulsars/src/Pulsar.cpp (+1/-4) plugins/Quasars/src/Quasar.cpp (+1/-4) plugins/Satellites/src/Satellite.cpp (+9/-30) plugins/Satellites/src/Satellite.hpp (+1/-4) plugins/Satellites/src/Satellites.cpp (+1/-15) plugins/Satellites/src/Satellites.hpp (+0/-1) plugins/Supernovae/src/Supernova.cpp (+1/-4) plugins/TelescopeControl/src/clients/TelescopeClient.hpp (+1/-1) src/StelMainView.cpp (+3/-1) src/core/StelApp.cpp (+3/-4) src/core/StelApp.hpp (+3/-2) src/core/StelSkyDrawer.cpp (+4/-15) src/core/modules/Constellation.cpp (+1/-4) src/core/modules/GridLinesMgr.cpp (+1/-13) src/core/modules/Landscape.cpp (+6/-20) src/core/modules/MilkyWay.cpp (+1/-5) src/core/modules/Nebula.cpp (+1/-6) src/core/modules/NebulaMgr.cpp (+2/-5) src/core/modules/Planet.cpp (+5/-23) src/core/modules/SolarSystem.cpp (+1/-4) src/core/modules/StarMgr.cpp (+0/-3) src/core/modules/StarWrapper.hpp (+1/-1) src/core/modules/ZoneArray.cpp (+1/-1) src/gui/ConfigurationDialog.cpp (+1/-22) src/gui/ConfigurationDialog.hpp (+1/-2) src/gui/DateTimeDialog.cpp (+2/-1) src/gui/DateTimeDialog.hpp (+1/-1) src/gui/HelpDialog.cpp (+1/-22) src/gui/HelpDialog.hpp (+1/-2) src/gui/LocationDialog.cpp (+3/-14) src/gui/LocationDialog.hpp (+2/-4) src/gui/SearchDialog.cpp (+1/-1) src/gui/SearchDialog.hpp (+1/-1) src/gui/ShortcutsDialog.cpp (+2/-1) src/gui/ShortcutsDialog.hpp (+1/-1) src/gui/SkyGui.cpp (+4/-22) src/gui/StelDialog.cpp (+15/-10) src/gui/StelGui.cpp (+7/-7) src/gui/StelGuiItems.cpp (+5/-56) src/gui/StelGuiItems.hpp (+0/-21) src/gui/ViewDialog.cpp (+1/-22) src/gui/ViewDialog.hpp (+1/-2) |
To merge this branch: | bzr merge lp:~stellarium/stellarium/night-mode-shader |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexander Wolf | Approve | ||
Review via email: mp+191558@code.launchpad.net |
Commit message
Description of the change
This branch uses a fragment shader to implement the night mode.
It makes most of the code much simpler because the modules and the GUI don't need to check for night mode anymore.
I tested it on my linux machine, but it would be good to check if there is no problem on windows or different machines before merging.
gzotti (georg-zotti) wrote : | # |
Seems good. Win7/64, NVidia GTX580M, Qt5.1.1
I have not dealt with QML so far. What happens with plugin content rendered by other shaders? Will this be mixed/filtered with the QML?
G.
Guillaume Chereau (guillaume-chereau) wrote : | # |
On Thu, Oct 17, 2013 at 7:24 PM, gzotti <email address hidden> wrote:
> Seems good. Win7/64, NVidia GTX580M, Qt5.1.1
>
> I have not dealt with QML so far. What happens with plugin content rendered by other shaders? Will this be mixed/filtered with the QML?
Yes, normally the ShaderEffect forces Qt to render all the scene into
a buffer, and then apply the effect on this buffer, so this should be
OK.
--
Guillaume
<email address hidden>
+886 970422910
Alexander Wolf (alexwolf) wrote : | # |
I'm added configurable color of planet's pointer and now this patch possible has conflicts in SolarSystem.cpp file.
barrykgerdes (barrygastro) wrote : | # |
Hi Alex
A few days ago I mentioned how washed out all the planets were in Windows
It is something to do with how the program handles the lighting = true/false in the ssystem.ini file
I have done a blanket change to the entry lighting = true to lighting = false as the default for this parameter.
This has fixed the problem.
Barry
Preview Diff
1 | === modified file 'data/default_config.ini' |
2 | --- data/default_config.ini 2013-10-07 14:36:24 +0000 |
3 | +++ data/default_config.ini 2013-10-17 06:10:44 +0000 |
4 | @@ -149,35 +149,6 @@ |
5 | script_console_function_color = 0.0,1.0,0.0 |
6 | script_console_constant_color = 1.0,0.5,0.5 |
7 | |
8 | -[night_color] |
9 | -default_color = 0.7,0.0,0.0 |
10 | -gui_base_color = 0.7,0.0,0.0 |
11 | -gui_text_color = 0.9,0.0,0.0 |
12 | -azimuthal_color = 0.4,0.0,0.0 |
13 | -equatorial_color = 0.4,0.0,0.0 |
14 | -equator_color = 0.6,0.0,0.0 |
15 | -ecliptic_color = 0.6,0.0,0.0 |
16 | -meridian_color = 0.6,0.0,0.0 |
17 | -horizon_color = 0.2,0.6,0.2 |
18 | -const_lines_color = 0.2,0.0,0.0 |
19 | -const_names_color = 0.5,0.0,0.0 |
20 | -const_boundary_color = 0.3,0.0,0.0 |
21 | -nebula_label_color = 0.7,0.0,0.0 |
22 | -nebula_circle_color = 1.0,0.0,0.0 |
23 | -star_label_color = 0.5,0.0,0.0 |
24 | -star_circle_color = 0.2,0.2,0.8 |
25 | -cardinal_color = 0.8,0.0,0.0 |
26 | -planet_names_color = 0.7,0.0,0.0 |
27 | -planet_orbits_color = 0.7,0.0,0.0 |
28 | -object_trails_color = 1.0,0.0,0.0 |
29 | -telescope_label_color = 0.6,0.0,0.0 |
30 | -telescope_circle_color = 0.6,0.0,0.0 |
31 | -script_console_keyword_color = 1.0,0.0,0.0 |
32 | -script_console_module_color = 1.0,0.0,0.0 |
33 | -script_console_comment_color = 1.0,0.0,0.0 |
34 | -script_console_function_color = 1.0,0.0,0.0 |
35 | -script_console_constant_color = 1.0,0.0,0.0 |
36 | - |
37 | [tui] |
38 | flag_enable_tui_menu = true |
39 | flag_show_gravity_ui = false |
40 | |
41 | === modified file 'data/qml/main.qml' |
42 | --- data/qml/main.qml 2013-08-28 18:30:47 +0000 |
43 | +++ data/qml/main.qml 2013-10-17 06:10:44 +0000 |
44 | @@ -1,16 +1,40 @@ |
45 | |
46 | import QtQuick 1.0 |
47 | +import Qt.labs.shaders 1.0 |
48 | import Stellarium 1.0 |
49 | |
50 | Rectangle { |
51 | |
52 | - StelSky { |
53 | - anchors.fill: parent |
54 | - } |
55 | - |
56 | - // This will generate a single big QGraphicsWidget, and initialize |
57 | - // Stellarium GUI into it. |
58 | - StelGui { |
59 | - anchors.fill: parent |
60 | - } |
61 | + Item { |
62 | + id: all |
63 | + anchors.fill: parent |
64 | + StelSky { |
65 | + anchors.fill: parent |
66 | + } |
67 | + |
68 | + // This will generate a single big QGraphicsWidget, and initialize |
69 | + // Stellarium GUI into it. |
70 | + StelGui { |
71 | + anchors.fill: parent |
72 | + } |
73 | + } |
74 | + |
75 | + ShaderEffectItem { |
76 | + property variant source: ShaderEffectSource { sourceItem: all; hideSource: true } |
77 | + anchors.fill: all |
78 | + blending: false |
79 | + visible: stelApp.nightMode |
80 | + |
81 | + fragmentShader: " |
82 | + varying highp vec2 qt_TexCoord0; |
83 | + uniform sampler2D source; |
84 | + void main(void) |
85 | + { |
86 | + mediump vec3 color = texture2D(source, qt_TexCoord0).rgb; |
87 | + mediump float luminance = max(max(color.r, color.g), color.b); |
88 | + gl_FragColor = vec4(luminance, 0.0, 0.0, 1.0); |
89 | + |
90 | + } |
91 | + " |
92 | + } |
93 | } |
94 | |
95 | === modified file 'plugins/AngleMeasure/src/AngleMeasure.cpp' |
96 | --- plugins/AngleMeasure/src/AngleMeasure.cpp 2013-10-01 22:05:10 +0000 |
97 | +++ plugins/AngleMeasure/src/AngleMeasure.cpp 2013-10-17 06:10:44 +0000 |
98 | @@ -151,17 +151,6 @@ |
99 | const StelProjectorP prj = core->getProjection(StelCore::FrameEquinoxEqu); |
100 | StelPainter painter(prj); |
101 | painter.setFont(font); |
102 | - Vec3f tColor, lColor; |
103 | - if (StelApp::getInstance().getVisionModeNight()) |
104 | - { |
105 | - tColor = StelUtils::getNightColor(textColor); |
106 | - lColor = StelUtils::getNightColor(lineColor); |
107 | - } |
108 | - else |
109 | - { |
110 | - tColor = textColor; |
111 | - lColor = lineColor; |
112 | - } |
113 | |
114 | if (lineVisible.getInterstate() > 0.000001f) |
115 | { |
116 | @@ -172,7 +161,7 @@ |
117 | Vec3d xy; |
118 | if (prj->project(perp1EndPoint,xy)) |
119 | { |
120 | - painter.setColor(tColor[0], tColor[1], tColor[2], lineVisible.getInterstate()); |
121 | + painter.setColor(textColor[0], textColor[1], textColor[2], lineVisible.getInterstate()); |
122 | painter.drawText(xy[0], xy[1], angleText, 0, 15, 15); |
123 | } |
124 | |
125 | @@ -181,7 +170,7 @@ |
126 | glEnable(GL_BLEND); |
127 | |
128 | // main line is a great circle |
129 | - painter.setColor(lColor[0], lColor[1], lColor[2], lineVisible.getInterstate()); |
130 | + painter.setColor(lineColor[0], lineColor[1], lineColor[2], lineVisible.getInterstate()); |
131 | painter.drawGreatCircleArc(startPoint, endPoint, NULL); |
132 | |
133 | // End lines |
134 | @@ -191,7 +180,7 @@ |
135 | |
136 | if (messageFader.getInterstate() > 0.000001f) |
137 | { |
138 | - painter.setColor(tColor[0], tColor[1], tColor[2], messageFader.getInterstate()); |
139 | + painter.setColor(textColor[0], textColor[1], textColor[2], messageFader.getInterstate()); |
140 | int x = 83; |
141 | int y = 120; |
142 | int ls = painter.getFontMetrics().lineSpacing(); |
143 | |
144 | === modified file 'plugins/CompassMarks/src/CompassMarks.cpp' |
145 | --- plugins/CompassMarks/src/CompassMarks.cpp 2013-10-01 22:05:10 +0000 |
146 | +++ plugins/CompassMarks/src/CompassMarks.cpp 2013-10-17 06:10:44 +0000 |
147 | @@ -146,13 +146,7 @@ |
148 | StelPainter painter(prj); |
149 | painter.setFont(font); |
150 | |
151 | - Vec3f mColor; |
152 | - if (StelApp::getInstance().getVisionModeNight()) |
153 | - mColor = StelUtils::getNightColor(markColor); |
154 | - else |
155 | - mColor = markColor; |
156 | - |
157 | - painter.setColor(mColor[0], mColor[1], mColor[2], markFader.getInterstate()); |
158 | + painter.setColor(markColor[0], markColor[1], markColor[2], markFader.getInterstate()); |
159 | glDisable(GL_TEXTURE_2D); |
160 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
161 | glEnable(GL_BLEND); |
162 | |
163 | === modified file 'plugins/Exoplanets/src/Exoplanet.cpp' |
164 | --- plugins/Exoplanets/src/Exoplanet.cpp 2013-10-16 16:55:17 +0000 |
165 | +++ plugins/Exoplanets/src/Exoplanet.cpp 2013-10-17 06:10:44 +0000 |
166 | @@ -342,7 +342,7 @@ |
167 | |
168 | Vec3f Exoplanet::getInfoColor(void) const |
169 | { |
170 | - return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); |
171 | + return Vec3f(1.0, 1.0, 1.0); |
172 | } |
173 | |
174 | float Exoplanet::getVMagnitude(const StelCore* core) const |
175 | @@ -411,9 +411,6 @@ |
176 | if (hasHabitableExoplanets) |
177 | color = Vec3f(1.f,0.5f,0.f); |
178 | |
179 | - if (StelApp::getInstance().getVisionModeNight()) |
180 | - color = StelUtils::getNightColor(color); |
181 | - |
182 | double mag = getVMagnitudeWithExtinction(core); |
183 | |
184 | StelUtils::spheToRect(RA, DE, XYZ); |
185 | |
186 | === modified file 'plugins/Novae/src/Nova.cpp' |
187 | --- plugins/Novae/src/Nova.cpp 2013-10-16 16:55:17 +0000 |
188 | +++ plugins/Novae/src/Nova.cpp 2013-10-17 06:10:44 +0000 |
189 | @@ -150,7 +150,7 @@ |
190 | |
191 | Vec3f Nova::getInfoColor(void) const |
192 | { |
193 | - return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); |
194 | + return Vec3f(1.0, 1.0, 1.0); |
195 | } |
196 | |
197 | float Nova::getVMagnitude(const StelCore* core) const |
198 | @@ -285,9 +285,6 @@ |
199 | StarMgr* smgr = GETSTELMODULE(StarMgr); // It's need for checking displaying of labels for stars |
200 | |
201 | Vec3f color = Vec3f(1.f,1.f,1.f); |
202 | - if (StelApp::getInstance().getVisionModeNight()) |
203 | - color = StelUtils::getNightColor(color); |
204 | - |
205 | RCMag rcMag; |
206 | float size, shift; |
207 | double mag; |
208 | |
209 | === modified file 'plugins/Oculars/src/Oculars.cpp' |
210 | --- plugins/Oculars/src/Oculars.cpp 2013-10-11 18:31:08 +0000 |
211 | +++ plugins/Oculars/src/Oculars.cpp 2013-10-17 06:10:44 +0000 |
212 | @@ -809,11 +809,7 @@ |
213 | xPosition = xPosition - 0.5 * (metrics.width(labelText)); |
214 | int yPosition = projectorParams.viewportCenter[1]; |
215 | yPosition = yPosition - 0.5 * (metrics.height()); |
216 | - const char *tcolor; |
217 | - if (StelApp::getInstance().getVisionModeNight()) |
218 | - tcolor = "#C40303"; |
219 | - else |
220 | - tcolor = "#99FF99"; |
221 | + const char *tcolor = "#99FF99"; |
222 | usageMessageLabelID = labelManager->labelScreen(labelText, xPosition, yPosition, |
223 | true, font.pixelSize(), tcolor); |
224 | } |
225 | |
226 | === modified file 'plugins/Oculars/src/gui/OcularsGuiPanel.cpp' |
227 | --- plugins/Oculars/src/gui/OcularsGuiPanel.cpp 2013-10-01 22:05:10 +0000 |
228 | +++ plugins/Oculars/src/gui/OcularsGuiPanel.cpp 2013-10-17 06:10:44 +0000 |
229 | @@ -1033,36 +1033,11 @@ |
230 | fieldLensMultipler->setFont(font); |
231 | } |
232 | |
233 | -void OcularsGuiPanel::setButtonsNightMode(bool nightMode) |
234 | -{ |
235 | - //Reused from SkyGui, with modifications |
236 | - foreach (QGraphicsItem *child, QGraphicsItem::childItems()) |
237 | - { |
238 | - foreach (QGraphicsItem *grandchild, child->childItems()) |
239 | - { |
240 | - StelButton* button = qgraphicsitem_cast<StelButton*>(grandchild); |
241 | - if (button) |
242 | - button->setRedMode(nightMode); |
243 | - } |
244 | - } |
245 | -} |
246 | - |
247 | void OcularsGuiPanel::setColorScheme(const QString &schemeName) |
248 | { |
249 | - if (schemeName == "night_color") |
250 | - { |
251 | - borderPath->setPen(QColor::fromRgbF(0.7,0.2,0.2,0.5)); |
252 | - borderPath->setBrush(QColor::fromRgbF(0.23, 0.13, 0.03, 0.2)); |
253 | - setControlsColor(QColor::fromRgbF(0.9, 0.33, 0.33, 0.9)); |
254 | - setButtonsNightMode(true); |
255 | - } |
256 | - else |
257 | - { |
258 | - borderPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5)); |
259 | - borderPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2)); |
260 | - setControlsColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9)); |
261 | - setButtonsNightMode(false); |
262 | - } |
263 | + borderPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5)); |
264 | + borderPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2)); |
265 | + setControlsColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9)); |
266 | } |
267 | |
268 | QPixmap OcularsGuiPanel::createPixmapFromText(const QString& text, |
269 | |
270 | === modified file 'plugins/Oculars/src/gui/OcularsGuiPanel.hpp' |
271 | --- plugins/Oculars/src/gui/OcularsGuiPanel.hpp 2013-02-27 17:01:24 +0000 |
272 | +++ plugins/Oculars/src/gui/OcularsGuiPanel.hpp 2013-10-17 06:10:44 +0000 |
273 | @@ -130,8 +130,6 @@ |
274 | |
275 | void setControlsColor(const QColor& color); |
276 | void setControlsFont(const QFont& font); |
277 | - //! Sets the night mode flag on all StelButton-s. |
278 | - void setButtonsNightMode(bool nightMode); |
279 | |
280 | static QPixmap createPixmapFromText(const QString& text, |
281 | int width, |
282 | |
283 | === modified file 'plugins/Pulsars/src/Pulsar.cpp' |
284 | --- plugins/Pulsars/src/Pulsar.cpp 2013-10-16 16:55:17 +0000 |
285 | +++ plugins/Pulsars/src/Pulsar.cpp 2013-10-17 06:10:44 +0000 |
286 | @@ -228,7 +228,7 @@ |
287 | |
288 | Vec3f Pulsar::getInfoColor(void) const |
289 | { |
290 | - return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); |
291 | + return Vec3f(1.0, 1.0, 1.0); |
292 | } |
293 | |
294 | float Pulsar::getVMagnitude(const StelCore* core) const |
295 | @@ -331,9 +331,6 @@ |
296 | StelSkyDrawer* sd = core->getSkyDrawer(); |
297 | |
298 | Vec3f color = Vec3f(0.4f,0.5f,1.2f); |
299 | - if (StelApp::getInstance().getVisionModeNight()) |
300 | - color = StelUtils::getNightColor(color); |
301 | - |
302 | double mag = getVMagnitudeWithExtinction(core); |
303 | |
304 | StelUtils::spheToRect(RA, DE, XYZ); |
305 | |
306 | === modified file 'plugins/Quasars/src/Quasar.cpp' |
307 | --- plugins/Quasars/src/Quasar.cpp 2013-10-16 16:55:17 +0000 |
308 | +++ plugins/Quasars/src/Quasar.cpp 2013-10-17 06:10:44 +0000 |
309 | @@ -143,7 +143,7 @@ |
310 | |
311 | Vec3f Quasar::getInfoColor(void) const |
312 | { |
313 | - return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); |
314 | + return Vec3f(1.0, 1.0, 1.0); |
315 | } |
316 | |
317 | float Quasar::getVMagnitude(const StelCore* core) const |
318 | @@ -168,9 +168,6 @@ |
319 | |
320 | Vec3f color = sd->indexToColor(BvToColorIndex(bV))*0.75f; |
321 | Vec3f dcolor = Vec3f(1.2f,0.5f,0.4f); |
322 | - if (StelApp::getInstance().getVisionModeNight()) |
323 | - dcolor = StelUtils::getNightColor(dcolor); |
324 | - |
325 | RCMag rcMag; |
326 | float size, shift=0; |
327 | double mag; |
328 | |
329 | === modified file 'plugins/Satellites/src/Satellite.cpp' |
330 | --- plugins/Satellites/src/Satellite.cpp 2013-10-16 16:55:17 +0000 |
331 | +++ plugins/Satellites/src/Satellite.cpp 2013-10-17 06:10:44 +0000 |
332 | @@ -96,27 +96,15 @@ |
333 | list = map.value("orbitColor", QVariantList()).toList(); |
334 | if (list.count() == 3) |
335 | { |
336 | - orbitColorNormal[0] = list.at(0).toDouble(); |
337 | - orbitColorNormal[1] = list.at(1).toDouble(); |
338 | - orbitColorNormal[2] = list.at(2).toDouble(); |
339 | + orbitColor[0] = list.at(0).toDouble(); |
340 | + orbitColor[1] = list.at(1).toDouble(); |
341 | + orbitColor[2] = list.at(2).toDouble(); |
342 | } |
343 | else |
344 | { |
345 | - orbitColorNormal = hintColor; |
346 | + orbitColor = hintColor; |
347 | } |
348 | |
349 | - // Set the night color of orbit lines to red with the |
350 | - // intensity of the average of the RGB for the day color. |
351 | - float orbitColorBrightness = (orbitColorNormal[0] + orbitColorNormal[1] + orbitColorNormal[2])/3; |
352 | - orbitColorNight[0] = orbitColorBrightness; |
353 | - orbitColorNight[1] = 0; |
354 | - orbitColorNight[2] = 0; |
355 | - |
356 | - if (StelApp::getInstance().getVisionModeNight()) |
357 | - orbitColor = &orbitColorNight; |
358 | - else |
359 | - orbitColor = &orbitColorNormal; |
360 | - |
361 | if (map.contains("comms")) |
362 | { |
363 | foreach(const QVariant &comm, map.value("comms").toList()) |
364 | @@ -185,7 +173,7 @@ |
365 | map.insert("userDefined", userDefined); |
366 | QVariantList col, orbitCol; |
367 | col << roundToDp(hintColor[0],3) << roundToDp(hintColor[1], 3) << roundToDp(hintColor[2], 3); |
368 | - orbitCol << roundToDp(orbitColorNormal[0], 3) << roundToDp(orbitColorNormal[1], 3) << roundToDp(orbitColorNormal[2],3); |
369 | + orbitCol << roundToDp(orbitColor[0], 3) << roundToDp(orbitColor[1], 3) << roundToDp(orbitColor[2],3); |
370 | map["hintColor"] = col; |
371 | map["orbitColor"] = orbitCol; |
372 | QVariantList commList; |
373 | @@ -352,7 +340,7 @@ |
374 | |
375 | Vec3f Satellite::getInfoColor(void) const |
376 | { |
377 | - return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : hintColor; |
378 | + return hintColor; |
379 | } |
380 | |
381 | float Satellite::getVMagnitude(const StelCore* core) const |
382 | @@ -510,7 +498,7 @@ |
383 | XYZ = getJ2000EquatorialPos(core); |
384 | Vec3f drawColor; |
385 | (visibility==RADAR_NIGHT) ? drawColor = Vec3f(0.2f,0.2f,0.2f) : drawColor = hintColor; |
386 | - StelApp::getInstance().getVisionModeNight() ? glColor4f(0.6,0.0,0.0,1.0) : glColor4f(drawColor[0],drawColor[1],drawColor[2], Satellite::hintBrightness); |
387 | + glColor4f(drawColor[0],drawColor[1],drawColor[2], Satellite::hintBrightness); |
388 | |
389 | StelProjectorP prj = core->getProjection(StelCore::FrameJ2000); |
390 | |
391 | @@ -555,7 +543,7 @@ |
392 | // Draw end (fading) parts of orbit lines one segment at a time. |
393 | if (i<=orbitLineFadeSegments || orbitLineSegments-i < orbitLineFadeSegments) |
394 | { |
395 | - painter.setColor((*orbitColor)[0], (*orbitColor)[1], (*orbitColor)[2], hintBrightness * calculateOrbitSegmentIntensity(i)); |
396 | + painter.setColor(orbitColor[0], orbitColor[1], orbitColor[2], hintBrightness * calculateOrbitSegmentIntensity(i)); |
397 | painter.drawGreatCircleArc(previousPosition, position, &viewportHalfspace); |
398 | } |
399 | else |
400 | @@ -566,7 +554,7 @@ |
401 | } |
402 | |
403 | // Draw center section of orbit in one go |
404 | - painter.setColor((*orbitColor)[0], (*orbitColor)[1], (*orbitColor)[2], hintBrightness); |
405 | + painter.setColor(orbitColor[0], orbitColor[1], orbitColor[2], hintBrightness); |
406 | painter.drawGreatCircleArcs(vertexArray, &viewportHalfspace); |
407 | |
408 | glEnable(GL_TEXTURE_2D); |
409 | @@ -587,15 +575,6 @@ |
410 | } |
411 | } |
412 | |
413 | -void Satellite::setNightColors(bool night) |
414 | -{ |
415 | - if (night) |
416 | - orbitColor = &orbitColorNight; |
417 | - else |
418 | - orbitColor = &orbitColorNormal; |
419 | -} |
420 | - |
421 | - |
422 | void Satellite::computeOrbitPoints() |
423 | { |
424 | gTimeSpan computeInterval(0, 0, 0, orbitLineSegmentDuration); |
425 | |
426 | === modified file 'plugins/Satellites/src/Satellite.hpp' |
427 | --- plugins/Satellites/src/Satellite.hpp 2013-10-16 16:55:17 +0000 |
428 | +++ plugins/Satellites/src/Satellite.hpp 2013-10-17 06:10:44 +0000 |
429 | @@ -169,7 +169,6 @@ |
430 | //! returns 0 - 1.0 for the DRAWORBIT_FADE_NUMBER segments at |
431 | //! each end of an orbit, with 1 in the middle. |
432 | float calculateOrbitSegmentIntensity(int segNum); |
433 | - void setNightColors(bool night); |
434 | |
435 | private: |
436 | bool initialized; |
437 | @@ -237,9 +236,7 @@ |
438 | |
439 | //Satellite Orbit Draw |
440 | QFont font; |
441 | - Vec3f orbitColorNormal; |
442 | - Vec3f orbitColorNight; |
443 | - Vec3f* orbitColor; |
444 | + Vec3f orbitColor; |
445 | double lastEpochCompForOrbit; //measured in Julian Days |
446 | double epochTime; //measured in Julian Days |
447 | QList<Vec3d> orbitPoints; //orbit points represented by ElAzPos vectors |
448 | |
449 | === modified file 'plugins/Satellites/src/Satellites.cpp' |
450 | --- plugins/Satellites/src/Satellites.cpp 2013-10-01 22:05:10 +0000 |
451 | +++ plugins/Satellites/src/Satellites.cpp 2013-10-17 06:10:44 +0000 |
452 | @@ -246,17 +246,6 @@ |
453 | return true; |
454 | } |
455 | |
456 | -void Satellites::setStelStyle(const QString& mode) |
457 | -{ |
458 | - foreach(const SatelliteP& sat, satellites) |
459 | - { |
460 | - if (sat->initialized) |
461 | - { |
462 | - sat->setNightColors(mode=="night_color"); |
463 | - } |
464 | - } |
465 | -} |
466 | - |
467 | const StelStyle Satellites::getModuleStyleSheet(const StelStyle& style) |
468 | { |
469 | StelStyle pluginStyle(style); |
470 | @@ -1555,10 +1544,7 @@ |
471 | // Compute 2D pos and return if outside screen |
472 | if (!prj->project(pos, screenpos)) |
473 | return; |
474 | - if (StelApp::getInstance().getVisionModeNight()) |
475 | - glColor3f(0.8f,0.0f,0.0f); |
476 | - else |
477 | - glColor3f(0.4f,0.5f,0.8f); |
478 | + glColor3f(0.4f,0.5f,0.8f); |
479 | texPointer->bind(); |
480 | |
481 | glEnable(GL_TEXTURE_2D); |
482 | |
483 | === modified file 'plugins/Satellites/src/Satellites.hpp' |
484 | --- plugins/Satellites/src/Satellites.hpp 2013-10-01 01:11:14 +0000 |
485 | +++ plugins/Satellites/src/Satellites.hpp 2013-10-17 06:10:44 +0000 |
486 | @@ -435,7 +435,6 @@ |
487 | void saveCatalog(QString path=QString()); |
488 | |
489 | private slots: |
490 | - void setStelStyle(const QString& section); |
491 | |
492 | private: |
493 | //! Add to the current collection the satellite described by the data. |
494 | |
495 | === modified file 'plugins/Supernovae/src/Supernova.cpp' |
496 | --- plugins/Supernovae/src/Supernova.cpp 2013-10-16 16:55:17 +0000 |
497 | +++ plugins/Supernovae/src/Supernova.cpp 2013-10-17 06:10:44 +0000 |
498 | @@ -148,7 +148,7 @@ |
499 | |
500 | Vec3f Supernova::getInfoColor(void) const |
501 | { |
502 | - return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0); |
503 | + return Vec3f(1.0, 1.0, 1.0); |
504 | } |
505 | |
506 | float Supernova::getVMagnitude(const StelCore* core) const |
507 | @@ -225,9 +225,6 @@ |
508 | StarMgr* smgr = GETSTELMODULE(StarMgr); // It's need for checking displaying of labels for stars |
509 | |
510 | Vec3f color = Vec3f(1.f,1.f,1.f); |
511 | - if (StelApp::getInstance().getVisionModeNight()) |
512 | - color = StelUtils::getNightColor(color); |
513 | - |
514 | RCMag rcMag; |
515 | float size, shift; |
516 | double mag; |
517 | |
518 | === modified file 'plugins/TelescopeControl/src/clients/TelescopeClient.hpp' |
519 | --- plugins/TelescopeControl/src/clients/TelescopeClient.hpp 2012-02-23 07:48:31 +0000 |
520 | +++ plugins/TelescopeControl/src/clients/TelescopeClient.hpp 2013-10-17 06:10:44 +0000 |
521 | @@ -62,7 +62,7 @@ |
522 | QString getNameI18n(void) const {return nameI18n;} |
523 | Vec3f getInfoColor(void) const |
524 | { |
525 | - return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8, 0.2, 0.2) : Vec3f(1, 1, 1); |
526 | + return Vec3f(1, 1, 1); |
527 | } |
528 | //! TelescopeClient supports the following InfoStringGroup flags: |
529 | //! - Name |
530 | |
531 | === modified file 'src/StelMainView.cpp' |
532 | --- src/StelMainView.cpp 2013-10-05 18:52:05 +0000 |
533 | +++ src/StelMainView.cpp 2013-10-17 06:10:44 +0000 |
534 | @@ -46,6 +46,7 @@ |
535 | #include <QTimer> |
536 | #include <QWidget> |
537 | #include <QWindow> |
538 | +#include <QDeclarativeContext> |
539 | |
540 | // Initialize static variables |
541 | StelMainView* StelMainView::singleton = NULL; |
542 | @@ -112,7 +113,7 @@ |
543 | StelApp::getInstance().draw(); |
544 | |
545 | painter->endNativePainting(); |
546 | - // update(); |
547 | + update(); |
548 | } |
549 | |
550 | void StelSkyItem::mousePressEvent(QGraphicsSceneMouseEvent *event) |
551 | @@ -300,6 +301,7 @@ |
552 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
553 | qmlRegisterType<StelSkyItem>("Stellarium", 1, 0, "StelSky"); |
554 | qmlRegisterType<StelGuiItem>("Stellarium", 1, 0, "StelGui"); |
555 | + rootContext()->setContextProperty("stelApp", stelApp); |
556 | setSource(QUrl("qrc:/qml/qml/main.qml")); |
557 | |
558 | QScreen* screen = glWidget->windowHandle()->screen(); |
559 | |
560 | === modified file 'src/core/StelApp.cpp' |
561 | --- src/core/StelApp.cpp 2013-10-13 20:39:02 +0000 |
562 | +++ src/core/StelApp.cpp 2013-10-17 06:10:44 +0000 |
563 | @@ -423,9 +423,8 @@ |
564 | initScriptMgr(conf); |
565 | |
566 | // Initialisation of the color scheme |
567 | - bool tmp = confSettings->value("viewing/flag_night").toBool(); |
568 | - flagNightVision=!tmp; // fool caching |
569 | - setVisionModeNight(tmp); |
570 | + emit colorSchemeChanged("color"); |
571 | + setVisionModeNight(confSettings->value("viewing/flag_night").toBool()); |
572 | |
573 | // Initialisation of the render of solar shadows |
574 | //setRenderSolarShadows(confSettings->value("viewing/flag_render_solar_shadows", true).toBool()); |
575 | @@ -663,7 +662,7 @@ |
576 | if (flagNightVision!=b) |
577 | { |
578 | flagNightVision=b; |
579 | - emit(colorSchemeChanged(b ? "night_color" : "color")); |
580 | + emit(visionNightModeChanged(b)); |
581 | } |
582 | } |
583 | |
584 | |
585 | === modified file 'src/core/StelApp.hpp' |
586 | --- src/core/StelApp.hpp 2013-10-13 20:39:02 +0000 |
587 | +++ src/core/StelApp.hpp 2013-10-17 06:10:44 +0000 |
588 | @@ -59,7 +59,7 @@ |
589 | class StelApp : public QObject |
590 | { |
591 | Q_OBJECT |
592 | - Q_PROPERTY(bool nightMode READ getVisionModeNight WRITE setVisionModeNight) |
593 | + Q_PROPERTY(bool nightMode READ getVisionModeNight WRITE setVisionModeNight NOTIFY visionNightModeChanged) |
594 | |
595 | public: |
596 | friend class StelAppGraphicsWidget; |
597 | @@ -140,7 +140,7 @@ |
598 | QSettings* getSettings() {return confSettings;} |
599 | |
600 | //! Return the currently used style |
601 | - QString getCurrentStelStyle() {return flagNightVision ? "night_color" : "color";} |
602 | + QString getCurrentStelStyle() {return "color";} |
603 | |
604 | //! Update all object according to the deltaTime in seconds. |
605 | void update(double deltaTime); |
606 | @@ -212,6 +212,7 @@ |
607 | void reportFileDownloadFinished(QNetworkReply* reply); |
608 | |
609 | signals: |
610 | + void visionNightModeChanged(bool); |
611 | void colorSchemeChanged(const QString&); |
612 | void languageChanged(); |
613 | void skyCultureChanged(const QString&); |
614 | |
615 | === modified file 'src/core/StelSkyDrawer.cpp' |
616 | --- src/core/StelSkyDrawer.cpp 2013-10-09 20:58:58 +0000 |
617 | +++ src/core/StelSkyDrawer.cpp 2013-10-17 06:10:44 +0000 |
618 | @@ -442,21 +442,14 @@ |
619 | sPainter->enableTexture2d(true); |
620 | glBlendFunc(GL_ONE, GL_ONE); |
621 | glEnable(GL_BLEND); |
622 | - if (StelApp::getInstance().getVisionModeNight()) |
623 | - sPainter->setColor(color[0]*cmag, 0.0, 0.0); |
624 | - else |
625 | - sPainter->setColor(color[0]*cmag, color[1]*cmag, color[2]*cmag); |
626 | - |
627 | + sPainter->setColor(color[0]*cmag, color[1]*cmag, color[2]*cmag); |
628 | sPainter->drawSprite2dMode(win[0], win[1], rmag); |
629 | } |
630 | |
631 | unsigned char starColor[3] = {0, 0, 0}; |
632 | starColor[0] = (unsigned char)std::min((int)(color[0]*tw*255+0.5f), 255); |
633 | - if (!StelApp::getInstance().getVisionModeNight()) |
634 | - { |
635 | - starColor[1] = (unsigned char)std::min((int)(color[1]*tw*255+0.5f), 255); |
636 | - starColor[2] = (unsigned char)std::min((int)(color[2]*tw*255+0.5f), 255); |
637 | - } |
638 | + starColor[1] = (unsigned char)std::min((int)(color[1]*tw*255+0.5f), 255); |
639 | + starColor[2] = (unsigned char)std::min((int)(color[2]*tw*255+0.5f), 255); |
640 | |
641 | // Store the drawing instructions in the vertex arrays |
642 | StarVertex* vx = &(vertexArray[nbPointSources*6]); |
643 | @@ -500,11 +493,7 @@ |
644 | cmag = qMax(0.f, 1.f-(pixRadius*3.f+100-rmag)/100); |
645 | Vec3f win; |
646 | painter->getProjector()->project(v, win); |
647 | - Vec3f c = color; |
648 | - if (StelApp::getInstance().getVisionModeNight()) |
649 | - c = StelUtils::getNightColor(c); |
650 | - |
651 | - painter->setColor(c[0]*cmag, c[1]*cmag, c[2]*cmag); |
652 | + painter->setColor(color[0]*cmag, color[1]*cmag, color[2]*cmag); |
653 | painter->drawSprite2dMode(win[0], win[1], rmag); |
654 | noStarHalo = true; |
655 | } |
656 | |
657 | === modified file 'src/core/modules/Constellation.cpp' |
658 | --- src/core/modules/Constellation.cpp 2013-09-07 13:01:20 +0000 |
659 | +++ src/core/modules/Constellation.cpp 2013-10-17 06:10:44 +0000 |
660 | @@ -128,10 +128,7 @@ |
661 | const float intensity = artFader.getInterstate(); |
662 | if (artTexture && intensity && region.intersects(boundingCap)) |
663 | { |
664 | - if (StelApp::getInstance().getVisionModeNight()) |
665 | - sPainter.setColor(intensity, 0.0, 0.0); |
666 | - else |
667 | - sPainter.setColor(intensity,intensity,intensity); |
668 | + sPainter.setColor(intensity,intensity,intensity); |
669 | |
670 | // The texture is not fully loaded |
671 | if (artTexture->bind()==false) |
672 | |
673 | === modified file 'src/core/modules/GridLinesMgr.cpp' |
674 | --- src/core/modules/GridLinesMgr.cpp 2013-10-01 22:05:10 +0000 |
675 | +++ src/core/modules/GridLinesMgr.cpp 2013-10-17 06:10:44 +0000 |
676 | @@ -311,19 +311,7 @@ |
677 | glEnable(GL_BLEND); |
678 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode |
679 | Vec4f textColor(color[0], color[1], color[2], 0); |
680 | - if (StelApp::getInstance().getVisionModeNight()) |
681 | - { |
682 | - // instead of a filter which just zeros G&B, set the red |
683 | - // value to the mean brightness of RGB. |
684 | - float red = (color[0] + color[1] + color[2]) / 3.0; |
685 | - textColor[0] = red; |
686 | - textColor[1] = 0.; textColor[2] = 0.; |
687 | - sPainter.setColor(red, 0, 0, fader.getInterstate()); |
688 | - } |
689 | - else |
690 | - { |
691 | - sPainter.setColor(color[0],color[1],color[2], fader.getInterstate()); |
692 | - } |
693 | + sPainter.setColor(color[0],color[1],color[2], fader.getInterstate()); |
694 | |
695 | textColor*=2; |
696 | textColor[3]=fader.getInterstate(); |
697 | |
698 | === modified file 'src/core/modules/Landscape.cpp' |
699 | --- src/core/modules/Landscape.cpp 2013-09-23 20:24:50 +0000 |
700 | +++ src/core/modules/Landscape.cpp 2013-10-17 06:10:44 +0000 |
701 | @@ -351,10 +351,9 @@ |
702 | transfo->combine(Mat4d::translation(Vec3d(0.,0.,vpos))); |
703 | sPainter.setProjector(core->getProjection(transfo)); |
704 | glBlendFunc(GL_ONE, GL_ONE); |
705 | - const float nightModeFilter = StelApp::getInstance().getVisionModeNight() ? 0.f : 1.f; |
706 | sPainter.setColor(fogFader.getInterstate()*(0.1f+0.1f*skyBrightness), |
707 | - fogFader.getInterstate()*(0.1f+0.1f*skyBrightness)*nightModeFilter, |
708 | - fogFader.getInterstate()*(0.1f+0.1f*skyBrightness)*nightModeFilter); |
709 | + fogFader.getInterstate()*(0.1f+0.1f*skyBrightness), |
710 | + fogFader.getInterstate()*(0.1f+0.1f*skyBrightness)); |
711 | fogTex->bind(); |
712 | const float height = (tanMode||calibrated) ? radius*std::tan(fogAltAngle*M_PI/180.) : radius*std::sin(fogAltAngle*M_PI/180.); |
713 | sPainter.sCylinder(radius, height, 64, 1); |
714 | @@ -379,10 +378,7 @@ |
715 | |
716 | if (!landFader.getInterstate()) |
717 | return; |
718 | - if (StelApp::getInstance().getVisionModeNight()) |
719 | - sPainter.setColor(skyBrightness*nightBrightness, 0.0, 0.0, landFader.getInterstate()); |
720 | - else |
721 | - sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate()); |
722 | + sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate()); |
723 | |
724 | foreach (const LOSSide& side, precomputedSides) |
725 | { |
726 | @@ -404,10 +400,7 @@ |
727 | transfo->combine(Mat4d::zrotation((groundAngleRotateZ-angleRotateZOffset)*M_PI/180.f) * Mat4d::translation(Vec3d(0,0,vshift))); |
728 | |
729 | sPainter.setProjector(core->getProjection(transfo)); |
730 | - if (StelApp::getInstance().getVisionModeNight()) |
731 | - sPainter.setColor(skyBrightness*nightBrightness, 0.0, 0.0, landFader.getInterstate()); |
732 | - else |
733 | - sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate()); |
734 | + sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate()); |
735 | |
736 | groundTex->bind(); |
737 | sPainter.setArrays((Vec3d*)groundVertexArr.constData(), (Vec2f*)groundTexCoordArr.constData()); |
738 | @@ -462,10 +455,7 @@ |
739 | |
740 | // Normal transparency mode |
741 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
742 | - if (StelApp::getInstance().getVisionModeNight()) |
743 | - sPainter.setColor(skyBrightness*nightBrightness, 0.0, 0.0, landFader.getInterstate()); |
744 | - else |
745 | - sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate()); |
746 | + sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate()); |
747 | |
748 | |
749 | glEnable(GL_CULL_FACE); |
750 | @@ -530,11 +520,7 @@ |
751 | |
752 | // Normal transparency mode |
753 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
754 | - if (StelApp::getInstance().getVisionModeNight()) |
755 | - sPainter.setColor(skyBrightness*nightBrightness, 0.0, 0.0, landFader.getInterstate()); |
756 | - else |
757 | - sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate()); |
758 | - |
759 | + sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate()); |
760 | |
761 | glEnable(GL_CULL_FACE); |
762 | sPainter.enableTexture2d(true); |
763 | |
764 | === modified file 'src/core/modules/MilkyWay.cpp' |
765 | --- src/core/modules/MilkyWay.cpp 2013-09-22 20:28:42 +0000 |
766 | +++ src/core/modules/MilkyWay.cpp 2013-10-17 06:10:44 +0000 |
767 | @@ -85,11 +85,7 @@ |
768 | |
769 | // This RGB color corresponds to the night blue scotopic color = 0.25, 0.25 in xyY mode. |
770 | // since milky way is always seen white RGB value in the texture (1.0,1.0,1.0) |
771 | - Vec3f c; |
772 | - if (StelApp::getInstance().getVisionModeNight()) |
773 | - c = Vec3f(0.34165f, 0.f, 0.f); |
774 | - else |
775 | - c = Vec3f(0.34165f, 0.429666f, 0.63586f); |
776 | + Vec3f c = Vec3f(0.34165f, 0.429666f, 0.63586f); |
777 | |
778 | float lum = core->getSkyDrawer()->surfacebrightnessToLuminance(13.5f); |
779 | |
780 | |
781 | === modified file 'src/core/modules/Nebula.cpp' |
782 | --- src/core/modules/Nebula.cpp 2013-10-16 16:55:17 +0000 |
783 | +++ src/core/modules/Nebula.cpp 2013-10-17 06:10:44 +0000 |
784 | @@ -142,8 +142,7 @@ |
785 | |
786 | Vec3f Nebula::getInfoColor(void) const |
787 | { |
788 | - Vec3f col = ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("NebulaMgr"))->getLabelsColor(); |
789 | - return StelApp::getInstance().getVisionModeNight() ? StelUtils::getNightColor(col) : col; |
790 | + return ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("NebulaMgr"))->getLabelsColor(); |
791 | } |
792 | |
793 | double Nebula::getCloseViewFov(const StelCore*) const |
794 | @@ -166,8 +165,6 @@ |
795 | glBlendFunc(GL_ONE, GL_ONE); |
796 | float lum = 1.f;//qMin(1,4.f/getOnScreenSize(core))*0.8; |
797 | Vec3f col(circleColor[0]*lum*hintsBrightness, circleColor[1]*lum*hintsBrightness, circleColor[2]*lum*hintsBrightness); |
798 | - if (StelApp::getInstance().getVisionModeNight()) |
799 | - col = StelUtils::getNightColor(col); |
800 | |
801 | sPainter.setColor(col[0], col[1], col[2], 1); |
802 | switch (nType) { |
803 | @@ -209,8 +206,6 @@ |
804 | return; |
805 | |
806 | Vec3f col(labelColor[0], labelColor[1], labelColor[2]); |
807 | - if (StelApp::getInstance().getVisionModeNight()) |
808 | - col = StelUtils::getNightColor(col); |
809 | |
810 | sPainter.setColor(col[0], col[1], col[2], hintsBrightness); |
811 | float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()->getPixelPerRadAtCenter(); |
812 | |
813 | === modified file 'src/core/modules/NebulaMgr.cpp' |
814 | --- src/core/modules/NebulaMgr.cpp 2013-10-11 23:49:02 +0000 |
815 | +++ src/core/modules/NebulaMgr.cpp 2013-10-17 06:10:44 +0000 |
816 | @@ -192,11 +192,8 @@ |
817 | Vec3d pos=obj->getJ2000EquatorialPos(core); |
818 | |
819 | // Compute 2D pos and return if outside screen |
820 | - if (!prj->projectInPlace(pos)) return; |
821 | - if (StelApp::getInstance().getVisionModeNight()) |
822 | - sPainter.setColor(0.8f,0.0f,0.0f); |
823 | - else |
824 | - sPainter.setColor(0.4f,0.5f,0.8f); |
825 | + if (!prj->projectInPlace(pos)) return; |
826 | + sPainter.setColor(0.4f,0.5f,0.8f); |
827 | |
828 | texPointer->bind(); |
829 | |
830 | |
831 | === modified file 'src/core/modules/Planet.cpp' |
832 | --- src/core/modules/Planet.cpp 2013-10-16 16:55:17 +0000 |
833 | +++ src/core/modules/Planet.cpp 2013-10-17 06:10:44 +0000 |
834 | @@ -245,10 +245,7 @@ |
835 | |
836 | Vec3f Planet::getInfoColor(void) const |
837 | { |
838 | - Vec3f col = ((SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem"))->getLabelsColor(); |
839 | - if (StelApp::getInstance().getVisionModeNight()) |
840 | - col = StelUtils::getNightColor(col); |
841 | - return col; |
842 | + return ((SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem"))->getLabelsColor(); |
843 | } |
844 | |
845 | |
846 | @@ -873,16 +870,8 @@ |
847 | static Vec4f diffuse = Vec4f(2.f,2.f,2.f,1.f); |
848 | static Vec4f zero = Vec4f(0.f,0.f,0.f,0.f); |
849 | static Vec4f ambient = Vec4f(0.02f,0.02f,0.02f,0.02f); |
850 | - if (StelApp::getInstance().getVisionModeNight()) |
851 | - { |
852 | - diffuse[1] = 0.; diffuse[2] = 0.; |
853 | - ambient[1] = 0.; ambient[2] = 0.; |
854 | - } |
855 | - else |
856 | - { |
857 | - diffuse[1] = 2.; diffuse[2] = 2.; |
858 | - ambient[1] = 0.02; ambient[2] = 0.02; |
859 | - } |
860 | + diffuse[1] = 2.; diffuse[2] = 2.; |
861 | + ambient[1] = 0.02; ambient[2] = 0.02; |
862 | sPainter->getLight().setAmbient(ambient); |
863 | sPainter->getLight().setDiffuse(diffuse); |
864 | sPainter->getLight().setSpecular(zero); |
865 | @@ -966,10 +955,7 @@ |
866 | } |
867 | } |
868 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
869 | - if (StelApp::getInstance().getVisionModeNight()) |
870 | - painter->setColor(1.f, 0.f, 0.f); |
871 | - else |
872 | - painter->setColor(1.f, 1.f, 1.f); |
873 | + painter->setColor(1.f, 1.f, 1.f); |
874 | |
875 | painter->enableTexture2d(true); |
876 | glDisable(GL_BLEND); |
877 | @@ -1131,11 +1117,7 @@ |
878 | |
879 | // Normal transparency mode |
880 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
881 | - if (StelApp::getInstance().getVisionModeNight()) |
882 | - sPainter->setColor(1.f, 0.f, 0.f); |
883 | - else |
884 | - sPainter->setColor(1.f, 1.f, 1.f); |
885 | - |
886 | + sPainter->setColor(1.f, 1.f, 1.f); |
887 | sPainter->enableTexture2d(true); |
888 | glEnable(GL_CULL_FACE); |
889 | glEnable(GL_BLEND); |
890 | |
891 | === modified file 'src/core/modules/SolarSystem.cpp' |
892 | --- src/core/modules/SolarSystem.cpp 2013-10-01 22:05:10 +0000 |
893 | +++ src/core/modules/SolarSystem.cpp 2013-10-17 06:10:44 +0000 |
894 | @@ -176,10 +176,7 @@ |
895 | |
896 | |
897 | StelPainter sPainter(prj); |
898 | - if (StelApp::getInstance().getVisionModeNight()) |
899 | - sPainter.setColor(1.0f,0.0f,0.0f); |
900 | - else |
901 | - sPainter.setColor(1.0f,0.3f,0.3f); |
902 | + sPainter.setColor(1.0f,0.3f,0.3f); |
903 | |
904 | float size = obj->getAngularSize(core)*M_PI/180.*prj->getPixelPerRadAtCenter()*2.; |
905 | size+=40.f + 10.f*std::sin(2.f * StelApp::getInstance().getTotalRunTime()); |
906 | |
907 | === modified file 'src/core/modules/StarMgr.cpp' |
908 | --- src/core/modules/StarMgr.cpp 2013-10-13 20:39:02 +0000 |
909 | +++ src/core/modules/StarMgr.cpp 2013-10-17 06:10:44 +0000 |
910 | @@ -351,9 +351,6 @@ |
911 | return; |
912 | |
913 | Vec3f c(obj->getInfoColor()); |
914 | - if (StelApp::getInstance().getVisionModeNight()) |
915 | - c = StelUtils::getNightColor(c); |
916 | - |
917 | sPainter.setColor(c[0], c[1], c[2]); |
918 | texPointer->bind(); |
919 | sPainter.enableTexture2d(true); |
920 | |
921 | === modified file 'src/core/modules/StarWrapper.hpp' |
922 | --- src/core/modules/StarWrapper.hpp 2013-10-16 16:55:17 +0000 |
923 | +++ src/core/modules/StarWrapper.hpp 2013-10-17 06:10:44 +0000 |
924 | @@ -81,7 +81,7 @@ |
925 | } |
926 | Vec3f getInfoColor(void) const |
927 | { |
928 | - return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8, 0.0, 0.0) : StelSkyDrawer::indexToColor(s->bV); |
929 | + return StelSkyDrawer::indexToColor(s->bV); |
930 | } |
931 | float getVMagnitude(const StelCore* core) const |
932 | { |
933 | |
934 | === modified file 'src/core/modules/ZoneArray.cpp' |
935 | --- src/core/modules/ZoneArray.cpp 2013-10-11 23:49:02 +0000 |
936 | +++ src/core/modules/ZoneArray.cpp 2013-10-17 06:10:44 +0000 |
937 | @@ -556,7 +556,7 @@ |
938 | if (drawer->drawPointSource(sPainter, vf, *tmpRcmag, s->bV, !isInsideViewport) && s->hasName() && extinctedMagIndex < maxMagStarName && s->hasComponentID()<=1) |
939 | { |
940 | const float offset = tmpRcmag->radius*0.7f; |
941 | - const Vec3f& colorr = (StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8f, 0.0f, 0.0f) : StelSkyDrawer::indexToColor(s->bV))*0.75f; |
942 | + const Vec3f colorr = StelSkyDrawer::indexToColor(s->bV)*0.75f; |
943 | sPainter->setColor(colorr[0], colorr[1], colorr[2],names_brightness); |
944 | sPainter->drawText(Vec3d(vf[0], vf[1], vf[2]), s->getNameI18n(), 0, offset, offset, false); |
945 | } |
946 | |
947 | === modified file 'src/gui/ConfigurationDialog.cpp' |
948 | --- src/gui/ConfigurationDialog.cpp 2013-10-16 16:55:17 +0000 |
949 | +++ src/gui/ConfigurationDialog.cpp 2013-10-17 06:10:44 +0000 |
950 | @@ -65,7 +65,7 @@ |
951 | #include <QComboBox> |
952 | #include <QDir> |
953 | |
954 | -ConfigurationDialog::ConfigurationDialog(StelGui* agui) : StelDialog(agui), starCatalogDownloadReply(NULL), currentDownloadFile(NULL), progressBar(NULL), gui(agui) |
955 | +ConfigurationDialog::ConfigurationDialog(StelGui* agui, QObject* parent) : StelDialog(parent), starCatalogDownloadReply(NULL), currentDownloadFile(NULL), progressBar(NULL), gui(agui) |
956 | { |
957 | ui = new Ui_configurationDialogForm; |
958 | customDeltaTEquationDialog = NULL; |
959 | @@ -116,25 +116,6 @@ |
960 | // Nothing for now |
961 | } |
962 | |
963 | -void ConfigurationDialog::updateIconsColor() |
964 | -{ |
965 | - QPixmap pixmap(50, 50); |
966 | - QStringList icons; |
967 | - icons << "main" << "info" << "navigation" << "tools" << "scripts" << "plugins"; |
968 | - bool redIcon = false; |
969 | - if (StelApp::getInstance().getVisionModeNight()) |
970 | - redIcon = true; |
971 | - |
972 | - foreach(const QString &iconName, icons) |
973 | - { |
974 | - pixmap.load(":/graphicGui/tabicon-" + iconName +".png"); |
975 | - if (redIcon) |
976 | - pixmap = StelButton::makeRed(pixmap); |
977 | - |
978 | - ui->stackListWidget->item(icons.indexOf(iconName))->setIcon(QIcon(pixmap)); |
979 | - } |
980 | -} |
981 | - |
982 | void ConfigurationDialog::createDialogContent() |
983 | { |
984 | const StelProjectorP proj = StelApp::getInstance().getCore()->getProjection(StelCore::FrameJ2000); |
985 | @@ -144,11 +125,9 @@ |
986 | |
987 | ui->setupUi(dialog); |
988 | connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); |
989 | - connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(QString)), this, SLOT(updateIconsColor())); |
990 | |
991 | // Set the main tab activated by default |
992 | ui->configurationStackedWidget->setCurrentIndex(0); |
993 | - updateIconsColor(); |
994 | ui->stackListWidget->setCurrentRow(0); |
995 | |
996 | connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); |
997 | |
998 | === modified file 'src/gui/ConfigurationDialog.hpp' |
999 | --- src/gui/ConfigurationDialog.hpp 2013-09-09 23:21:42 +0000 |
1000 | +++ src/gui/ConfigurationDialog.hpp 2013-10-17 06:10:44 +0000 |
1001 | @@ -37,14 +37,13 @@ |
1002 | { |
1003 | Q_OBJECT |
1004 | public: |
1005 | - ConfigurationDialog(StelGui* agui); |
1006 | + ConfigurationDialog(StelGui* agui, QObject* parent); |
1007 | virtual ~ConfigurationDialog(); |
1008 | //! Notify that the application style changed |
1009 | void styleChanged(); |
1010 | |
1011 | public slots: |
1012 | void retranslate(); |
1013 | - void updateIconsColor(); |
1014 | |
1015 | protected: |
1016 | //! Initialize the dialog widgets and connect the signals/slots |
1017 | |
1018 | === modified file 'src/gui/DateTimeDialog.cpp' |
1019 | --- src/gui/DateTimeDialog.cpp 2013-08-30 22:42:40 +0000 |
1020 | +++ src/gui/DateTimeDialog.cpp 2013-10-17 06:10:44 +0000 |
1021 | @@ -31,7 +31,8 @@ |
1022 | #include <QFrame> |
1023 | #include <QLineEdit> |
1024 | |
1025 | -DateTimeDialog::DateTimeDialog() : |
1026 | +DateTimeDialog::DateTimeDialog(QObject* parent) : |
1027 | + StelDialog(parent), |
1028 | year(0), |
1029 | month(0), |
1030 | day(0), |
1031 | |
1032 | === modified file 'src/gui/DateTimeDialog.hpp' |
1033 | --- src/gui/DateTimeDialog.hpp 2012-02-13 18:59:16 +0000 |
1034 | +++ src/gui/DateTimeDialog.hpp 2013-10-17 06:10:44 +0000 |
1035 | @@ -30,7 +30,7 @@ |
1036 | { |
1037 | Q_OBJECT |
1038 | public: |
1039 | - DateTimeDialog(); |
1040 | + DateTimeDialog(QObject* parent); |
1041 | ~DateTimeDialog(); |
1042 | double newJd(); |
1043 | bool valid(int y, int m, int d, int h, int min, int s); |
1044 | |
1045 | === modified file 'src/gui/HelpDialog.cpp' |
1046 | --- src/gui/HelpDialog.cpp 2013-09-13 07:33:37 +0000 |
1047 | +++ src/gui/HelpDialog.cpp 2013-10-17 06:10:44 +0000 |
1048 | @@ -45,7 +45,7 @@ |
1049 | #include "StelStyle.hpp" |
1050 | #include "StelActionMgr.hpp" |
1051 | |
1052 | -HelpDialog::HelpDialog() |
1053 | +HelpDialog::HelpDialog(QObject* parent) : StelDialog(parent) |
1054 | { |
1055 | ui = new Ui_helpDialogForm; |
1056 | } |
1057 | @@ -73,32 +73,11 @@ |
1058 | } |
1059 | } |
1060 | |
1061 | -void HelpDialog::updateIconsColor() |
1062 | -{ |
1063 | - QPixmap pixmap(50, 50); |
1064 | - QStringList icons; |
1065 | - icons << "help" << "info" << "logs"; |
1066 | - bool redIcon = false; |
1067 | - if (StelApp::getInstance().getVisionModeNight()) |
1068 | - redIcon = true; |
1069 | - |
1070 | - foreach(const QString &iconName, icons) |
1071 | - { |
1072 | - pixmap.load(":/graphicGui/tabicon-" + iconName +".png"); |
1073 | - if (redIcon) |
1074 | - pixmap = StelButton::makeRed(pixmap); |
1075 | - |
1076 | - ui->stackListWidget->item(icons.indexOf(iconName))->setIcon(QIcon(pixmap)); |
1077 | - } |
1078 | -} |
1079 | - |
1080 | void HelpDialog::createDialogContent() |
1081 | { |
1082 | ui->setupUi(dialog); |
1083 | connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); |
1084 | - connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(QString)), this, SLOT(updateIconsColor())); |
1085 | ui->stackedWidget->setCurrentIndex(0); |
1086 | - updateIconsColor(); |
1087 | ui->stackListWidget->setCurrentRow(0); |
1088 | connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); |
1089 | |
1090 | |
1091 | === modified file 'src/gui/HelpDialog.hpp' |
1092 | --- src/gui/HelpDialog.hpp 2013-09-13 07:33:37 +0000 |
1093 | +++ src/gui/HelpDialog.hpp 2013-10-17 06:10:44 +0000 |
1094 | @@ -32,7 +32,7 @@ |
1095 | { |
1096 | Q_OBJECT |
1097 | public: |
1098 | - HelpDialog(); |
1099 | + HelpDialog(QObject* parent); |
1100 | ~HelpDialog(); |
1101 | |
1102 | //! Notify that the application style changed |
1103 | @@ -40,7 +40,6 @@ |
1104 | |
1105 | public slots: |
1106 | void retranslate(); |
1107 | - void updateIconsColor(); |
1108 | |
1109 | protected: |
1110 | //! Initialize the dialog widgets and connect the signals/slots |
1111 | |
1112 | === modified file 'src/gui/LocationDialog.cpp' |
1113 | --- src/gui/LocationDialog.cpp 2013-09-22 19:42:45 +0000 |
1114 | +++ src/gui/LocationDialog.cpp 2013-10-17 06:10:44 +0000 |
1115 | @@ -41,10 +41,9 @@ |
1116 | #include <QTimer> |
1117 | #include <QStringListModel> |
1118 | |
1119 | -LocationDialog::LocationDialog() : isEditingNew(false) |
1120 | +LocationDialog::LocationDialog(QObject* parent) : StelDialog(parent), isEditingNew(false) |
1121 | { |
1122 | ui = new Ui_locationDialogForm; |
1123 | - lastVisionMode = StelApp::getInstance().getVisionModeNight(); |
1124 | } |
1125 | |
1126 | LocationDialog::~LocationDialog() |
1127 | @@ -224,7 +223,7 @@ |
1128 | void LocationDialog::setMapForLocation(const StelLocation& loc) |
1129 | { |
1130 | // Avoids usless processing |
1131 | - if (lastPlanet==loc.planetName && lastVisionMode==StelApp::getInstance().getVisionModeNight()) |
1132 | + if (lastPlanet==loc.planetName) |
1133 | return; |
1134 | |
1135 | QPixmap pixmap; |
1136 | @@ -249,19 +248,9 @@ |
1137 | pixmap = QPixmap(path); |
1138 | } |
1139 | } |
1140 | - |
1141 | - if (StelApp::getInstance().getVisionModeNight()) |
1142 | - { |
1143 | - ui->mapLabel->setPixmap(StelButton::makeRed(pixmap)); |
1144 | - } |
1145 | - else |
1146 | - { |
1147 | - ui->mapLabel->setPixmap(pixmap); |
1148 | - } |
1149 | - |
1150 | + ui->mapLabel->setPixmap(pixmap); |
1151 | // For caching |
1152 | lastPlanet = loc.planetName; |
1153 | - lastVisionMode = StelApp::getInstance().getVisionModeNight(); |
1154 | } |
1155 | |
1156 | void LocationDialog::populatePlanetList() |
1157 | |
1158 | === modified file 'src/gui/LocationDialog.hpp' |
1159 | --- src/gui/LocationDialog.hpp 2012-08-03 18:57:40 +0000 |
1160 | +++ src/gui/LocationDialog.hpp 2013-10-17 06:10:44 +0000 |
1161 | @@ -31,7 +31,7 @@ |
1162 | { |
1163 | Q_OBJECT |
1164 | public: |
1165 | - LocationDialog(); |
1166 | + LocationDialog(QObject* parent); |
1167 | virtual ~LocationDialog(); |
1168 | //! Notify that the application style changed |
1169 | void styleChanged(); |
1170 | @@ -102,9 +102,7 @@ |
1171 | void setDefaultLocation(); |
1172 | |
1173 | private: |
1174 | - QString lastPlanet; |
1175 | - bool lastVisionMode; |
1176 | - |
1177 | + QString lastPlanet; |
1178 | //! Updates the check state and the enabled/disabled status. |
1179 | void updateDefaultLocationControls(bool currentIsDefault); |
1180 | }; |
1181 | |
1182 | === modified file 'src/gui/SearchDialog.cpp' |
1183 | --- src/gui/SearchDialog.cpp 2013-08-12 13:03:38 +0000 |
1184 | +++ src/gui/SearchDialog.cpp 2013-10-17 06:10:44 +0000 |
1185 | @@ -121,7 +121,7 @@ |
1186 | |
1187 | const char* SearchDialog::DEF_SIMBAD_URL = "http://simbad.u-strasbg.fr/"; |
1188 | |
1189 | -SearchDialog::SearchDialog() : simbadReply(NULL) |
1190 | +SearchDialog::SearchDialog(QObject* parent) : StelDialog(parent), simbadReply(NULL) |
1191 | { |
1192 | ui = new Ui_searchDialogForm; |
1193 | simbadSearcher = new SimbadSearcher(this); |
1194 | |
1195 | === modified file 'src/gui/SearchDialog.hpp' |
1196 | --- src/gui/SearchDialog.hpp 2013-08-12 13:03:38 +0000 |
1197 | +++ src/gui/SearchDialog.hpp 2013-10-17 06:10:44 +0000 |
1198 | @@ -67,7 +67,7 @@ |
1199 | Q_OBJECT |
1200 | |
1201 | public: |
1202 | - SearchDialog(); |
1203 | + SearchDialog(QObject* parent); |
1204 | virtual ~SearchDialog(); |
1205 | //! Notify that the application style changed |
1206 | void styleChanged(); |
1207 | |
1208 | === modified file 'src/gui/ShortcutsDialog.cpp' |
1209 | --- src/gui/ShortcutsDialog.cpp 2013-10-07 14:36:24 +0000 |
1210 | +++ src/gui/ShortcutsDialog.cpp 2013-10-17 06:10:44 +0000 |
1211 | @@ -59,7 +59,8 @@ |
1212 | } |
1213 | |
1214 | |
1215 | -ShortcutsDialog::ShortcutsDialog() : |
1216 | +ShortcutsDialog::ShortcutsDialog(QObject* parent) : |
1217 | + StelDialog(parent), |
1218 | ui(new Ui_shortcutsDialogForm), |
1219 | filterModel(new ShortcutsFilterModel(this)), |
1220 | mainModel(new QStandardItemModel(this)) |
1221 | |
1222 | === modified file 'src/gui/ShortcutsDialog.hpp' |
1223 | --- src/gui/ShortcutsDialog.hpp 2013-09-13 08:21:23 +0000 |
1224 | +++ src/gui/ShortcutsDialog.hpp 2013-10-17 06:10:44 +0000 |
1225 | @@ -55,7 +55,7 @@ |
1226 | Q_OBJECT |
1227 | |
1228 | public: |
1229 | - ShortcutsDialog(); |
1230 | + ShortcutsDialog(QObject* parent); |
1231 | ~ShortcutsDialog(); |
1232 | |
1233 | //! higlight items that have collisions with current lineEdits' state according to css. |
1234 | |
1235 | === modified file 'src/gui/SkyGui.cpp' |
1236 | --- src/gui/SkyGui.cpp 2013-10-16 16:55:17 +0000 |
1237 | +++ src/gui/SkyGui.cpp 2013-10-17 06:10:44 +0000 |
1238 | @@ -278,28 +278,10 @@ |
1239 | |
1240 | void SkyGui::setStelStyle(const QString& style) |
1241 | { |
1242 | - if (style == "night_color") |
1243 | - { |
1244 | - buttonBarPath->setPen(QColor::fromRgbF(0.7,0.0,0.0,0.5)); |
1245 | - buttonBarPath->setBrush(QColor::fromRgbF(0.23, 0.0, 0.00, 0.2)); |
1246 | - buttonBar->setColor(QColor::fromRgbF(0.9, 0.0, 0.0, 0.9)); |
1247 | - winBar->setColor(QColor::fromRgbF(0.9, 0.0, 0.0, 0.9)); |
1248 | - winBar->setRedMode(true); |
1249 | - buttonBar->setRedMode(true); |
1250 | - btHorizAutoHide->setRedMode(true); |
1251 | - btVertAutoHide->setRedMode(true); |
1252 | - } |
1253 | - else |
1254 | - { |
1255 | - buttonBarPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5)); |
1256 | - buttonBarPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2)); |
1257 | - buttonBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9)); |
1258 | - winBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9)); |
1259 | - buttonBar->setRedMode(false); |
1260 | - winBar->setRedMode(false); |
1261 | - btHorizAutoHide->setRedMode(false); |
1262 | - btVertAutoHide->setRedMode(false); |
1263 | - } |
1264 | + buttonBarPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5)); |
1265 | + buttonBarPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2)); |
1266 | + buttonBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9)); |
1267 | + winBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9)); |
1268 | } |
1269 | |
1270 | // Add a new progress bar in the lower right corner of the screen. |
1271 | |
1272 | === modified file 'src/gui/StelDialog.cpp' |
1273 | --- src/gui/StelDialog.cpp 2013-09-11 10:01:13 +0000 |
1274 | +++ src/gui/StelDialog.cpp 2013-10-17 06:10:44 +0000 |
1275 | @@ -48,13 +48,17 @@ |
1276 | |
1277 | virtual bool event(QEvent* event) |
1278 | { |
1279 | - if (event->type()==QEvent::WindowDeactivate) |
1280 | - { |
1281 | - widget()->setWindowOpacity(0.4); |
1282 | - } |
1283 | - if (event->type()==QEvent::WindowActivate) |
1284 | - { |
1285 | - widget()->setWindowOpacity(0.9); |
1286 | + switch (event->type()) |
1287 | + { |
1288 | + case QEvent::WindowDeactivate: |
1289 | + widget()->setWindowOpacity(0.4); |
1290 | + break; |
1291 | + case QEvent::WindowActivate: |
1292 | + case QEvent::GrabMouse: |
1293 | + widget()->setWindowOpacity(0.9); |
1294 | + break; |
1295 | + default: |
1296 | + break; |
1297 | } |
1298 | return QGraphicsProxyWidget::event(event); |
1299 | } |
1300 | @@ -102,8 +106,10 @@ |
1301 | proxy->setFocus(); |
1302 | return; |
1303 | } |
1304 | - |
1305 | + |
1306 | + QGraphicsWidget* parent = qobject_cast<QGraphicsWidget*>(this->parent()); |
1307 | dialog = new QDialog(NULL); |
1308 | + // dialog->setParent(parent); |
1309 | StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); |
1310 | Q_ASSERT(gui); |
1311 | //dialog->setAttribute(Qt::WA_OpaquePaintEvent, true); |
1312 | @@ -111,7 +117,7 @@ |
1313 | createDialogContent(); |
1314 | dialog->setStyleSheet(gui->getStelStyle().qtStyleSheet); |
1315 | |
1316 | - proxy = new CustomProxy(NULL, Qt::Tool); |
1317 | + proxy = new CustomProxy(parent, Qt::Tool); |
1318 | proxy->setWidget(dialog); |
1319 | QSizeF size = proxy->size(); |
1320 | |
1321 | @@ -122,7 +128,6 @@ |
1322 | if (newY <-0) |
1323 | newY = 0; |
1324 | proxy->setPos(newX, newY); |
1325 | - StelMainView::getInstance().scene()->addItem(proxy); |
1326 | proxy->setWindowFrameMargins(2,0,2,2); |
1327 | // (this also changes the bounding rectangle size) |
1328 | |
1329 | |
1330 | === modified file 'src/gui/StelGui.cpp' |
1331 | --- src/gui/StelGui.cpp 2013-09-29 17:32:30 +0000 |
1332 | +++ src/gui/StelGui.cpp 2013-10-17 06:10:44 +0000 |
1333 | @@ -154,13 +154,13 @@ |
1334 | |
1335 | StelGuiBase::init(atopLevelGraphicsWidget); |
1336 | skyGui = new SkyGui(atopLevelGraphicsWidget); |
1337 | - locationDialog = new LocationDialog(); |
1338 | - helpDialog = new HelpDialog(); |
1339 | - dateTimeDialog = new DateTimeDialog(); |
1340 | - searchDialog = new SearchDialog(); |
1341 | - viewDialog = new ViewDialog(); |
1342 | - shortcutsDialog = new ShortcutsDialog(); |
1343 | - configurationDialog = new ConfigurationDialog(this); |
1344 | + locationDialog = new LocationDialog(atopLevelGraphicsWidget); |
1345 | + helpDialog = new HelpDialog(atopLevelGraphicsWidget); |
1346 | + dateTimeDialog = new DateTimeDialog(atopLevelGraphicsWidget); |
1347 | + searchDialog = new SearchDialog(atopLevelGraphicsWidget); |
1348 | + viewDialog = new ViewDialog(atopLevelGraphicsWidget); |
1349 | + shortcutsDialog = new ShortcutsDialog(atopLevelGraphicsWidget); |
1350 | + configurationDialog = new ConfigurationDialog(this, atopLevelGraphicsWidget); |
1351 | #ifdef ENABLE_SCRIPT_CONSOLE |
1352 | scriptConsole = new ScriptConsole(); |
1353 | #endif |
1354 | |
1355 | === modified file 'src/gui/StelGuiItems.cpp' |
1356 | --- src/gui/StelGuiItems.cpp 2013-10-07 14:36:24 +0000 |
1357 | +++ src/gui/StelGuiItems.cpp 2013-10-17 06:10:44 +0000 |
1358 | @@ -72,18 +72,10 @@ |
1359 | Q_ASSERT(!pixOn.isNull()); |
1360 | Q_ASSERT(!pixOff.isNull()); |
1361 | |
1362 | - redMode = StelApp::getInstance().getVisionModeNight(); |
1363 | - pixOnRed = StelButton::makeRed(pixOn); |
1364 | - pixOffRed = StelButton::makeRed(pixOff); |
1365 | if (isTristate_) |
1366 | { |
1367 | Q_ASSERT(!pixNoChange.isNull()); |
1368 | - pixNoChangeRed = StelButton::makeRed(pixNoChange); |
1369 | } |
1370 | - if (!pixHover.isNull()) |
1371 | - pixHoverRed = StelButton::makeRed(pixHover); |
1372 | - if (!pixBackground.isNull()) |
1373 | - pixBackgroundRed = StelButton::makeRed(pixBackground); |
1374 | |
1375 | setShapeMode(QGraphicsPixmapItem::BoundingRectShape); |
1376 | setAcceptHoverEvents(true); |
1377 | @@ -197,15 +189,15 @@ |
1378 | QPainter painter(&pix); |
1379 | painter.setOpacity(opacity); |
1380 | if (!pixBackground.isNull() && noBckground==false) |
1381 | - painter.drawPixmap(0, 0, redMode ? pixBackgroundRed : pixBackground); |
1382 | + painter.drawPixmap(0, 0, pixBackground); |
1383 | painter.drawPixmap(0, 0, |
1384 | - (isTristate_ && checked == ButtonStateNoChange) ? (redMode ? pixNoChangeRed : pixNoChange) : |
1385 | - (checked == ButtonStateOn) ? (redMode ? pixOnRed : pixOn) : |
1386 | - /* (checked == ButtonStateOff) ? */ (redMode ? pixOffRed : pixOff)); |
1387 | + (isTristate_ && checked == ButtonStateNoChange) ? (pixNoChange) : |
1388 | + (checked == ButtonStateOn) ? (pixOn) : |
1389 | + /* (checked == ButtonStateOff) ? */ (pixOff)); |
1390 | if (hoverOpacity > 0) |
1391 | { |
1392 | painter.setOpacity(hoverOpacity * opacity); |
1393 | - painter.drawPixmap(0, 0, redMode ? pixHoverRed : pixHover); |
1394 | + painter.drawPixmap(0, 0, pixHover); |
1395 | } |
1396 | setPixmap(pix); |
1397 | } |
1398 | @@ -225,28 +217,9 @@ |
1399 | void StelButton::setBackgroundPixmap(const QPixmap &newBackground) |
1400 | { |
1401 | pixBackground = newBackground; |
1402 | - pixBackgroundRed = makeRed(newBackground); |
1403 | updateIcon(); |
1404 | } |
1405 | |
1406 | -QPixmap StelButton::makeRed(const QPixmap& p) |
1407 | -{ |
1408 | - QImage im = p.toImage().convertToFormat(QImage::Format_ARGB32); |
1409 | - Q_ASSERT(im.format()==QImage::Format_ARGB32); |
1410 | - QRgb* bits = (QRgb*)im.bits(); |
1411 | - const QRgb* stop = bits+im.width()*im.height(); |
1412 | - do |
1413 | - { |
1414 | - Vec3f col = StelUtils::getNightColor(Vec3f(qRed(*bits)/256.0, qGreen(*bits)/256.0, qBlue(*bits)/256.0)); |
1415 | - *bits = qRgba((int)(256*col[0]), (int)(256*col[1]), (int)(256*col[2]), qAlpha(*bits)); |
1416 | - ++bits; |
1417 | - } |
1418 | - while (bits!=stop); |
1419 | - |
1420 | - return QPixmap::fromImage(im); |
1421 | -} |
1422 | - |
1423 | - |
1424 | LeftStelBar::LeftStelBar(QGraphicsItem* parent) : QGraphicsItem(parent) |
1425 | { |
1426 | // Create the help label |
1427 | @@ -332,18 +305,6 @@ |
1428 | helpLabel->setBrush(c); |
1429 | } |
1430 | |
1431 | -// Activate red mode for the buttons, i.e. will reduce the non red color component of the icon |
1432 | -void LeftStelBar::setRedMode(bool b) |
1433 | -{ |
1434 | - foreach (QGraphicsItem *child, QGraphicsItem::childItems()) |
1435 | - { |
1436 | - StelButton* bt = qgraphicsitem_cast<StelButton*>(child); |
1437 | - if (bt==0) |
1438 | - continue; |
1439 | - bt->setRedMode(b); |
1440 | - } |
1441 | -} |
1442 | - |
1443 | BottomStelBar::BottomStelBar(QGraphicsItem* parent, |
1444 | const QPixmap& pixLeft, |
1445 | const QPixmap& pixRight, |
1446 | @@ -709,18 +670,6 @@ |
1447 | helpLabel->setBrush(c); |
1448 | } |
1449 | |
1450 | -// Activate red mode for the buttons, i.e. will reduce the non red color component of the icon |
1451 | -void BottomStelBar::setRedMode(bool b) |
1452 | -{ |
1453 | - foreach (QGraphicsItem *child, QGraphicsItem::childItems()) |
1454 | - { |
1455 | - StelButton* bt = qgraphicsitem_cast<StelButton*>(child); |
1456 | - if (bt==0) |
1457 | - continue; |
1458 | - bt->setRedMode(b); |
1459 | - } |
1460 | -} |
1461 | - |
1462 | // Update the help label when a button is hovered |
1463 | void BottomStelBar::buttonHoverChanged(bool b) |
1464 | { |
1465 | |
1466 | === modified file 'src/gui/StelGuiItems.hpp' |
1467 | --- src/gui/StelGuiItems.hpp 2013-09-18 11:16:57 +0000 |
1468 | +++ src/gui/StelGuiItems.hpp 2013-10-17 06:10:44 +0000 |
1469 | @@ -108,17 +108,9 @@ |
1470 | //! Set the button opacity |
1471 | void setOpacity(double v) {opacity=v; updateIcon();} |
1472 | |
1473 | - //! Activate red mode for this button, i.e. will reduce the non red color component of the icon |
1474 | - void setRedMode(bool b) {redMode=b; updateIcon();} |
1475 | - |
1476 | //! Set the background pixmap of the button. |
1477 | - //! A variant for night vision mode (pixBackgroundRed) is automatically |
1478 | - //! generated from the new background. |
1479 | void setBackgroundPixmap(const QPixmap& newBackground); |
1480 | |
1481 | - //! Transform the pixmap so that it look red for night vision mode |
1482 | - static QPixmap makeRed(const QPixmap& p); |
1483 | - |
1484 | signals: |
1485 | //! Triggered when the button state changes |
1486 | void toggled(bool); |
1487 | @@ -157,12 +149,6 @@ |
1488 | QPixmap pixHover; |
1489 | QPixmap pixBackground; |
1490 | |
1491 | - QPixmap pixOnRed; |
1492 | - QPixmap pixOffRed; |
1493 | - QPixmap pixNoChangeRed; |
1494 | - QPixmap pixHoverRed; |
1495 | - QPixmap pixBackgroundRed; |
1496 | - |
1497 | int checked; |
1498 | |
1499 | QTimeLine* timeLine; |
1500 | @@ -171,8 +157,6 @@ |
1501 | bool isTristate_; |
1502 | double opacity; |
1503 | double hoverOpacity; |
1504 | - |
1505 | - bool redMode; |
1506 | }; |
1507 | |
1508 | // The button bar on the left containing windows toggle buttons |
1509 | @@ -189,8 +173,6 @@ |
1510 | QRectF boundingRectNoHelpLabel() const; |
1511 | //! Set the color for all the sub elements |
1512 | void setColor(const QColor& c); |
1513 | - //! Activate red mode for the buttons, i.e. will reduce the non red color component of the icon |
1514 | - void setRedMode(bool b); |
1515 | private slots: |
1516 | //! Update the help label when a button is hovered |
1517 | void buttonHoverChanged(bool b); |
1518 | @@ -230,9 +212,6 @@ |
1519 | //! Set the color for all the sub elements |
1520 | void setColor(const QColor& c); |
1521 | |
1522 | - //! Activate red mode for the buttons, i.e. will reduce the non red color component of the icon |
1523 | - void setRedMode(bool b); |
1524 | - |
1525 | //! Set whether time must be displayed in the bottom bar |
1526 | void setFlagShowTime(bool b) {flagShowTime=b;} |
1527 | //! Set whether location info must be displayed in the bottom bar |
1528 | |
1529 | === modified file 'src/gui/ViewDialog.cpp' |
1530 | --- src/gui/ViewDialog.cpp 2013-09-27 03:25:58 +0000 |
1531 | +++ src/gui/ViewDialog.cpp 2013-10-17 06:10:44 +0000 |
1532 | @@ -53,7 +53,7 @@ |
1533 | #include <QTimer> |
1534 | #include <QDialog> |
1535 | |
1536 | -ViewDialog::ViewDialog() |
1537 | +ViewDialog::ViewDialog(QObject* parent) : StelDialog(parent) |
1538 | { |
1539 | ui = new Ui_viewDialogForm; |
1540 | addRemoveLandscapesDialog = NULL; |
1541 | @@ -92,25 +92,6 @@ |
1542 | } |
1543 | } |
1544 | |
1545 | -void ViewDialog::updateIconsColor() |
1546 | -{ |
1547 | - QPixmap pixmap(50, 50); |
1548 | - QStringList icons; |
1549 | - icons << "sky" << "markings" << "landscape" << "starlore"; |
1550 | - bool redIcon = false; |
1551 | - if (StelApp::getInstance().getVisionModeNight()) |
1552 | - redIcon = true; |
1553 | - |
1554 | - foreach(const QString &iconName, icons) |
1555 | - { |
1556 | - pixmap.load(":/graphicGui/tabicon-" + iconName +".png"); |
1557 | - if (redIcon) |
1558 | - pixmap = StelButton::makeRed(pixmap); |
1559 | - |
1560 | - ui->stackListWidget->item(icons.indexOf(iconName))->setIcon(QIcon(pixmap)); |
1561 | - } |
1562 | -} |
1563 | - |
1564 | void ViewDialog::connectCheckBox(QCheckBox* checkBox, const QString& actionId) |
1565 | { |
1566 | StelAction* action = StelApp::getInstance().getStelActionManager()->findAction(actionId); |
1567 | @@ -124,11 +105,9 @@ |
1568 | { |
1569 | ui->setupUi(dialog); |
1570 | connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); |
1571 | - connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(QString)), this, SLOT(updateIconsColor())); |
1572 | |
1573 | // Set the Sky tab activated by default |
1574 | ui->stackedWidget->setCurrentIndex(0); |
1575 | - updateIconsColor(); |
1576 | ui->stackListWidget->setCurrentRow(0); |
1577 | |
1578 | //ui->viewTabWidget->removeTab(4); |
1579 | |
1580 | === modified file 'src/gui/ViewDialog.hpp' |
1581 | --- src/gui/ViewDialog.hpp 2013-09-11 07:20:51 +0000 |
1582 | +++ src/gui/ViewDialog.hpp 2013-10-17 06:10:44 +0000 |
1583 | @@ -33,14 +33,13 @@ |
1584 | { |
1585 | Q_OBJECT |
1586 | public: |
1587 | - ViewDialog(); |
1588 | + ViewDialog(QObject* parent); |
1589 | virtual ~ViewDialog(); |
1590 | //! Notify that the application style changed |
1591 | void styleChanged(); |
1592 | |
1593 | public slots: |
1594 | void retranslate(); |
1595 | - void updateIconsColor(); |
1596 | |
1597 | protected: |
1598 | Ui_viewDialogForm* ui; |
I've tested it on linux and this feature worked good for me. I think simplification of some parts of Stellarium is good idea.