Merge lp:~stellarium/stellarium/night-mode-shader into lp:stellarium

Proposed by Guillaume Chereau
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
Reviewer Review Type Date Requested Status
Alexander Wolf Approve
Review via email: mp+191558@code.launchpad.net

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.

To post a comment you must log in.
Revision history for this message
Alexander Wolf (alexwolf) wrote :

I've tested it on linux and this feature worked good for me. I think simplification of some parts of Stellarium is good idea.

review: Approve
Revision history for this message
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.

Revision history for this message
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

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

I'm added configurable color of planet's pointer and now this patch possible has conflicts in SolarSystem.cpp file.

Revision history for this message
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/default_config.ini'
--- data/default_config.ini 2013-10-07 14:36:24 +0000
+++ data/default_config.ini 2013-10-17 06:10:44 +0000
@@ -149,35 +149,6 @@
149script_console_function_color = 0.0,1.0,0.0149script_console_function_color = 0.0,1.0,0.0
150script_console_constant_color = 1.0,0.5,0.5150script_console_constant_color = 1.0,0.5,0.5
151151
152[night_color]
153default_color = 0.7,0.0,0.0
154gui_base_color = 0.7,0.0,0.0
155gui_text_color = 0.9,0.0,0.0
156azimuthal_color = 0.4,0.0,0.0
157equatorial_color = 0.4,0.0,0.0
158equator_color = 0.6,0.0,0.0
159ecliptic_color = 0.6,0.0,0.0
160meridian_color = 0.6,0.0,0.0
161horizon_color = 0.2,0.6,0.2
162const_lines_color = 0.2,0.0,0.0
163const_names_color = 0.5,0.0,0.0
164const_boundary_color = 0.3,0.0,0.0
165nebula_label_color = 0.7,0.0,0.0
166nebula_circle_color = 1.0,0.0,0.0
167star_label_color = 0.5,0.0,0.0
168star_circle_color = 0.2,0.2,0.8
169cardinal_color = 0.8,0.0,0.0
170planet_names_color = 0.7,0.0,0.0
171planet_orbits_color = 0.7,0.0,0.0
172object_trails_color = 1.0,0.0,0.0
173telescope_label_color = 0.6,0.0,0.0
174telescope_circle_color = 0.6,0.0,0.0
175script_console_keyword_color = 1.0,0.0,0.0
176script_console_module_color = 1.0,0.0,0.0
177script_console_comment_color = 1.0,0.0,0.0
178script_console_function_color = 1.0,0.0,0.0
179script_console_constant_color = 1.0,0.0,0.0
180
181[tui]152[tui]
182flag_enable_tui_menu = true153flag_enable_tui_menu = true
183flag_show_gravity_ui = false154flag_show_gravity_ui = false
184155
=== modified file 'data/qml/main.qml'
--- data/qml/main.qml 2013-08-28 18:30:47 +0000
+++ data/qml/main.qml 2013-10-17 06:10:44 +0000
@@ -1,16 +1,40 @@
11
2import QtQuick 1.02import QtQuick 1.0
3import Qt.labs.shaders 1.0
3import Stellarium 1.04import Stellarium 1.0
45
5Rectangle {6Rectangle {
67
7 StelSky {8 Item {
8 anchors.fill: parent9 id: all
9 }10 anchors.fill: parent
10 11 StelSky {
11 // This will generate a single big QGraphicsWidget, and initialize12 anchors.fill: parent
12 // Stellarium GUI into it.13 }
13 StelGui {14
14 anchors.fill: parent15 // This will generate a single big QGraphicsWidget, and initialize
15 }16 // Stellarium GUI into it.
17 StelGui {
18 anchors.fill: parent
19 }
20 }
21
22 ShaderEffectItem {
23 property variant source: ShaderEffectSource { sourceItem: all; hideSource: true }
24 anchors.fill: all
25 blending: false
26 visible: stelApp.nightMode
27
28 fragmentShader: "
29 varying highp vec2 qt_TexCoord0;
30 uniform sampler2D source;
31 void main(void)
32 {
33 mediump vec3 color = texture2D(source, qt_TexCoord0).rgb;
34 mediump float luminance = max(max(color.r, color.g), color.b);
35 gl_FragColor = vec4(luminance, 0.0, 0.0, 1.0);
36
37 }
38 "
39 }
16}40}
1741
=== modified file 'plugins/AngleMeasure/src/AngleMeasure.cpp'
--- plugins/AngleMeasure/src/AngleMeasure.cpp 2013-10-01 22:05:10 +0000
+++ plugins/AngleMeasure/src/AngleMeasure.cpp 2013-10-17 06:10:44 +0000
@@ -151,17 +151,6 @@
151 const StelProjectorP prj = core->getProjection(StelCore::FrameEquinoxEqu);151 const StelProjectorP prj = core->getProjection(StelCore::FrameEquinoxEqu);
152 StelPainter painter(prj);152 StelPainter painter(prj);
153 painter.setFont(font);153 painter.setFont(font);
154 Vec3f tColor, lColor;
155 if (StelApp::getInstance().getVisionModeNight())
156 {
157 tColor = StelUtils::getNightColor(textColor);
158 lColor = StelUtils::getNightColor(lineColor);
159 }
160 else
161 {
162 tColor = textColor;
163 lColor = lineColor;
164 }
165154
166 if (lineVisible.getInterstate() > 0.000001f)155 if (lineVisible.getInterstate() > 0.000001f)
167 {156 {
@@ -172,7 +161,7 @@
172 Vec3d xy;161 Vec3d xy;
173 if (prj->project(perp1EndPoint,xy))162 if (prj->project(perp1EndPoint,xy))
174 {163 {
175 painter.setColor(tColor[0], tColor[1], tColor[2], lineVisible.getInterstate());164 painter.setColor(textColor[0], textColor[1], textColor[2], lineVisible.getInterstate());
176 painter.drawText(xy[0], xy[1], angleText, 0, 15, 15);165 painter.drawText(xy[0], xy[1], angleText, 0, 15, 15);
177 }166 }
178167
@@ -181,7 +170,7 @@
181 glEnable(GL_BLEND);170 glEnable(GL_BLEND);
182 171
183 // main line is a great circle 172 // main line is a great circle
184 painter.setColor(lColor[0], lColor[1], lColor[2], lineVisible.getInterstate());173 painter.setColor(lineColor[0], lineColor[1], lineColor[2], lineVisible.getInterstate());
185 painter.drawGreatCircleArc(startPoint, endPoint, NULL);174 painter.drawGreatCircleArc(startPoint, endPoint, NULL);
186175
187 // End lines176 // End lines
@@ -191,7 +180,7 @@
191180
192 if (messageFader.getInterstate() > 0.000001f)181 if (messageFader.getInterstate() > 0.000001f)
193 {182 {
194 painter.setColor(tColor[0], tColor[1], tColor[2], messageFader.getInterstate());183 painter.setColor(textColor[0], textColor[1], textColor[2], messageFader.getInterstate());
195 int x = 83;184 int x = 83;
196 int y = 120;185 int y = 120;
197 int ls = painter.getFontMetrics().lineSpacing();186 int ls = painter.getFontMetrics().lineSpacing();
198187
=== modified file 'plugins/CompassMarks/src/CompassMarks.cpp'
--- plugins/CompassMarks/src/CompassMarks.cpp 2013-10-01 22:05:10 +0000
+++ plugins/CompassMarks/src/CompassMarks.cpp 2013-10-17 06:10:44 +0000
@@ -146,13 +146,7 @@
146 StelPainter painter(prj);146 StelPainter painter(prj);
147 painter.setFont(font);147 painter.setFont(font);
148148
149 Vec3f mColor;149 painter.setColor(markColor[0], markColor[1], markColor[2], markFader.getInterstate());
150 if (StelApp::getInstance().getVisionModeNight())
151 mColor = StelUtils::getNightColor(markColor);
152 else
153 mColor = markColor;
154
155 painter.setColor(mColor[0], mColor[1], mColor[2], markFader.getInterstate());
156 glDisable(GL_TEXTURE_2D);150 glDisable(GL_TEXTURE_2D);
157 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);151 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
158 glEnable(GL_BLEND);152 glEnable(GL_BLEND);
159153
=== modified file 'plugins/Exoplanets/src/Exoplanet.cpp'
--- plugins/Exoplanets/src/Exoplanet.cpp 2013-10-16 16:55:17 +0000
+++ plugins/Exoplanets/src/Exoplanet.cpp 2013-10-17 06:10:44 +0000
@@ -342,7 +342,7 @@
342342
343Vec3f Exoplanet::getInfoColor(void) const343Vec3f Exoplanet::getInfoColor(void) const
344{344{
345 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0);345 return Vec3f(1.0, 1.0, 1.0);
346}346}
347347
348float Exoplanet::getVMagnitude(const StelCore* core) const348float Exoplanet::getVMagnitude(const StelCore* core) const
@@ -411,9 +411,6 @@
411 if (hasHabitableExoplanets)411 if (hasHabitableExoplanets)
412 color = Vec3f(1.f,0.5f,0.f);412 color = Vec3f(1.f,0.5f,0.f);
413413
414 if (StelApp::getInstance().getVisionModeNight())
415 color = StelUtils::getNightColor(color);
416
417 double mag = getVMagnitudeWithExtinction(core);414 double mag = getVMagnitudeWithExtinction(core);
418415
419 StelUtils::spheToRect(RA, DE, XYZ);416 StelUtils::spheToRect(RA, DE, XYZ);
420417
=== modified file 'plugins/Novae/src/Nova.cpp'
--- plugins/Novae/src/Nova.cpp 2013-10-16 16:55:17 +0000
+++ plugins/Novae/src/Nova.cpp 2013-10-17 06:10:44 +0000
@@ -150,7 +150,7 @@
150150
151Vec3f Nova::getInfoColor(void) const151Vec3f Nova::getInfoColor(void) const
152{152{
153 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0);153 return Vec3f(1.0, 1.0, 1.0);
154}154}
155155
156float Nova::getVMagnitude(const StelCore* core) const156float Nova::getVMagnitude(const StelCore* core) const
@@ -285,9 +285,6 @@
285 StarMgr* smgr = GETSTELMODULE(StarMgr); // It's need for checking displaying of labels for stars285 StarMgr* smgr = GETSTELMODULE(StarMgr); // It's need for checking displaying of labels for stars
286286
287 Vec3f color = Vec3f(1.f,1.f,1.f);287 Vec3f color = Vec3f(1.f,1.f,1.f);
288 if (StelApp::getInstance().getVisionModeNight())
289 color = StelUtils::getNightColor(color);
290
291 RCMag rcMag;288 RCMag rcMag;
292 float size, shift;289 float size, shift;
293 double mag;290 double mag;
294291
=== modified file 'plugins/Oculars/src/Oculars.cpp'
--- plugins/Oculars/src/Oculars.cpp 2013-10-11 18:31:08 +0000
+++ plugins/Oculars/src/Oculars.cpp 2013-10-17 06:10:44 +0000
@@ -809,11 +809,7 @@
809 xPosition = xPosition - 0.5 * (metrics.width(labelText));809 xPosition = xPosition - 0.5 * (metrics.width(labelText));
810 int yPosition = projectorParams.viewportCenter[1];810 int yPosition = projectorParams.viewportCenter[1];
811 yPosition = yPosition - 0.5 * (metrics.height());811 yPosition = yPosition - 0.5 * (metrics.height());
812 const char *tcolor;812 const char *tcolor = "#99FF99";
813 if (StelApp::getInstance().getVisionModeNight())
814 tcolor = "#C40303";
815 else
816 tcolor = "#99FF99";
817 usageMessageLabelID = labelManager->labelScreen(labelText, xPosition, yPosition,813 usageMessageLabelID = labelManager->labelScreen(labelText, xPosition, yPosition,
818 true, font.pixelSize(), tcolor);814 true, font.pixelSize(), tcolor);
819 }815 }
820816
=== modified file 'plugins/Oculars/src/gui/OcularsGuiPanel.cpp'
--- plugins/Oculars/src/gui/OcularsGuiPanel.cpp 2013-10-01 22:05:10 +0000
+++ plugins/Oculars/src/gui/OcularsGuiPanel.cpp 2013-10-17 06:10:44 +0000
@@ -1033,36 +1033,11 @@
1033 fieldLensMultipler->setFont(font);1033 fieldLensMultipler->setFont(font);
1034}1034}
10351035
1036void OcularsGuiPanel::setButtonsNightMode(bool nightMode)
1037{
1038 //Reused from SkyGui, with modifications
1039 foreach (QGraphicsItem *child, QGraphicsItem::childItems())
1040 {
1041 foreach (QGraphicsItem *grandchild, child->childItems())
1042 {
1043 StelButton* button = qgraphicsitem_cast<StelButton*>(grandchild);
1044 if (button)
1045 button->setRedMode(nightMode);
1046 }
1047 }
1048}
1049
1050void OcularsGuiPanel::setColorScheme(const QString &schemeName)1036void OcularsGuiPanel::setColorScheme(const QString &schemeName)
1051{1037{
1052 if (schemeName == "night_color")1038 borderPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5));
1053 {1039 borderPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2));
1054 borderPath->setPen(QColor::fromRgbF(0.7,0.2,0.2,0.5));1040 setControlsColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9));
1055 borderPath->setBrush(QColor::fromRgbF(0.23, 0.13, 0.03, 0.2));
1056 setControlsColor(QColor::fromRgbF(0.9, 0.33, 0.33, 0.9));
1057 setButtonsNightMode(true);
1058 }
1059 else
1060 {
1061 borderPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5));
1062 borderPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2));
1063 setControlsColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9));
1064 setButtonsNightMode(false);
1065 }
1066}1041}
10671042
1068QPixmap OcularsGuiPanel::createPixmapFromText(const QString& text,1043QPixmap OcularsGuiPanel::createPixmapFromText(const QString& text,
10691044
=== modified file 'plugins/Oculars/src/gui/OcularsGuiPanel.hpp'
--- plugins/Oculars/src/gui/OcularsGuiPanel.hpp 2013-02-27 17:01:24 +0000
+++ plugins/Oculars/src/gui/OcularsGuiPanel.hpp 2013-10-17 06:10:44 +0000
@@ -130,8 +130,6 @@
130130
131 void setControlsColor(const QColor& color);131 void setControlsColor(const QColor& color);
132 void setControlsFont(const QFont& font);132 void setControlsFont(const QFont& font);
133 //! Sets the night mode flag on all StelButton-s.
134 void setButtonsNightMode(bool nightMode);
135133
136 static QPixmap createPixmapFromText(const QString& text,134 static QPixmap createPixmapFromText(const QString& text,
137 int width,135 int width,
138136
=== modified file 'plugins/Pulsars/src/Pulsar.cpp'
--- plugins/Pulsars/src/Pulsar.cpp 2013-10-16 16:55:17 +0000
+++ plugins/Pulsars/src/Pulsar.cpp 2013-10-17 06:10:44 +0000
@@ -228,7 +228,7 @@
228228
229Vec3f Pulsar::getInfoColor(void) const229Vec3f Pulsar::getInfoColor(void) const
230{230{
231 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0);231 return Vec3f(1.0, 1.0, 1.0);
232}232}
233233
234float Pulsar::getVMagnitude(const StelCore* core) const234float Pulsar::getVMagnitude(const StelCore* core) const
@@ -331,9 +331,6 @@
331 StelSkyDrawer* sd = core->getSkyDrawer(); 331 StelSkyDrawer* sd = core->getSkyDrawer();
332332
333 Vec3f color = Vec3f(0.4f,0.5f,1.2f);333 Vec3f color = Vec3f(0.4f,0.5f,1.2f);
334 if (StelApp::getInstance().getVisionModeNight())
335 color = StelUtils::getNightColor(color);
336
337 double mag = getVMagnitudeWithExtinction(core);334 double mag = getVMagnitudeWithExtinction(core);
338335
339 StelUtils::spheToRect(RA, DE, XYZ); 336 StelUtils::spheToRect(RA, DE, XYZ);
340337
=== modified file 'plugins/Quasars/src/Quasar.cpp'
--- plugins/Quasars/src/Quasar.cpp 2013-10-16 16:55:17 +0000
+++ plugins/Quasars/src/Quasar.cpp 2013-10-17 06:10:44 +0000
@@ -143,7 +143,7 @@
143143
144Vec3f Quasar::getInfoColor(void) const144Vec3f Quasar::getInfoColor(void) const
145{145{
146 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0);146 return Vec3f(1.0, 1.0, 1.0);
147}147}
148148
149float Quasar::getVMagnitude(const StelCore* core) const149float Quasar::getVMagnitude(const StelCore* core) const
@@ -168,9 +168,6 @@
168168
169 Vec3f color = sd->indexToColor(BvToColorIndex(bV))*0.75f;169 Vec3f color = sd->indexToColor(BvToColorIndex(bV))*0.75f;
170 Vec3f dcolor = Vec3f(1.2f,0.5f,0.4f);170 Vec3f dcolor = Vec3f(1.2f,0.5f,0.4f);
171 if (StelApp::getInstance().getVisionModeNight())
172 dcolor = StelUtils::getNightColor(dcolor);
173
174 RCMag rcMag;171 RCMag rcMag;
175 float size, shift=0;172 float size, shift=0;
176 double mag;173 double mag;
177174
=== modified file 'plugins/Satellites/src/Satellite.cpp'
--- plugins/Satellites/src/Satellite.cpp 2013-10-16 16:55:17 +0000
+++ plugins/Satellites/src/Satellite.cpp 2013-10-17 06:10:44 +0000
@@ -96,27 +96,15 @@
96 list = map.value("orbitColor", QVariantList()).toList();96 list = map.value("orbitColor", QVariantList()).toList();
97 if (list.count() == 3)97 if (list.count() == 3)
98 {98 {
99 orbitColorNormal[0] = list.at(0).toDouble();99 orbitColor[0] = list.at(0).toDouble();
100 orbitColorNormal[1] = list.at(1).toDouble();100 orbitColor[1] = list.at(1).toDouble();
101 orbitColorNormal[2] = list.at(2).toDouble();101 orbitColor[2] = list.at(2).toDouble();
102 }102 }
103 else103 else
104 {104 {
105 orbitColorNormal = hintColor;105 orbitColor = hintColor;
106 }106 }
107107
108 // Set the night color of orbit lines to red with the
109 // intensity of the average of the RGB for the day color.
110 float orbitColorBrightness = (orbitColorNormal[0] + orbitColorNormal[1] + orbitColorNormal[2])/3;
111 orbitColorNight[0] = orbitColorBrightness;
112 orbitColorNight[1] = 0;
113 orbitColorNight[2] = 0;
114
115 if (StelApp::getInstance().getVisionModeNight())
116 orbitColor = &orbitColorNight;
117 else
118 orbitColor = &orbitColorNormal;
119
120 if (map.contains("comms"))108 if (map.contains("comms"))
121 {109 {
122 foreach(const QVariant &comm, map.value("comms").toList())110 foreach(const QVariant &comm, map.value("comms").toList())
@@ -185,7 +173,7 @@
185 map.insert("userDefined", userDefined);173 map.insert("userDefined", userDefined);
186 QVariantList col, orbitCol;174 QVariantList col, orbitCol;
187 col << roundToDp(hintColor[0],3) << roundToDp(hintColor[1], 3) << roundToDp(hintColor[2], 3);175 col << roundToDp(hintColor[0],3) << roundToDp(hintColor[1], 3) << roundToDp(hintColor[2], 3);
188 orbitCol << roundToDp(orbitColorNormal[0], 3) << roundToDp(orbitColorNormal[1], 3) << roundToDp(orbitColorNormal[2],3);176 orbitCol << roundToDp(orbitColor[0], 3) << roundToDp(orbitColor[1], 3) << roundToDp(orbitColor[2],3);
189 map["hintColor"] = col;177 map["hintColor"] = col;
190 map["orbitColor"] = orbitCol;178 map["orbitColor"] = orbitCol;
191 QVariantList commList;179 QVariantList commList;
@@ -352,7 +340,7 @@
352340
353Vec3f Satellite::getInfoColor(void) const341Vec3f Satellite::getInfoColor(void) const
354{342{
355 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : hintColor;343 return hintColor;
356}344}
357345
358float Satellite::getVMagnitude(const StelCore* core) const346float Satellite::getVMagnitude(const StelCore* core) const
@@ -510,7 +498,7 @@
510 XYZ = getJ2000EquatorialPos(core);498 XYZ = getJ2000EquatorialPos(core);
511 Vec3f drawColor;499 Vec3f drawColor;
512 (visibility==RADAR_NIGHT) ? drawColor = Vec3f(0.2f,0.2f,0.2f) : drawColor = hintColor;500 (visibility==RADAR_NIGHT) ? drawColor = Vec3f(0.2f,0.2f,0.2f) : drawColor = hintColor;
513 StelApp::getInstance().getVisionModeNight() ? glColor4f(0.6,0.0,0.0,1.0) : glColor4f(drawColor[0],drawColor[1],drawColor[2], Satellite::hintBrightness);501 glColor4f(drawColor[0],drawColor[1],drawColor[2], Satellite::hintBrightness);
514502
515 StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);503 StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);
516504
@@ -555,7 +543,7 @@
555 // Draw end (fading) parts of orbit lines one segment at a time.543 // Draw end (fading) parts of orbit lines one segment at a time.
556 if (i<=orbitLineFadeSegments || orbitLineSegments-i < orbitLineFadeSegments)544 if (i<=orbitLineFadeSegments || orbitLineSegments-i < orbitLineFadeSegments)
557 {545 {
558 painter.setColor((*orbitColor)[0], (*orbitColor)[1], (*orbitColor)[2], hintBrightness * calculateOrbitSegmentIntensity(i));546 painter.setColor(orbitColor[0], orbitColor[1], orbitColor[2], hintBrightness * calculateOrbitSegmentIntensity(i));
559 painter.drawGreatCircleArc(previousPosition, position, &viewportHalfspace);547 painter.drawGreatCircleArc(previousPosition, position, &viewportHalfspace);
560 }548 }
561 else549 else
@@ -566,7 +554,7 @@
566 }554 }
567555
568 // Draw center section of orbit in one go556 // Draw center section of orbit in one go
569 painter.setColor((*orbitColor)[0], (*orbitColor)[1], (*orbitColor)[2], hintBrightness);557 painter.setColor(orbitColor[0], orbitColor[1], orbitColor[2], hintBrightness);
570 painter.drawGreatCircleArcs(vertexArray, &viewportHalfspace);558 painter.drawGreatCircleArcs(vertexArray, &viewportHalfspace);
571559
572 glEnable(GL_TEXTURE_2D);560 glEnable(GL_TEXTURE_2D);
@@ -587,15 +575,6 @@
587 }575 }
588}576}
589577
590void Satellite::setNightColors(bool night)
591{
592 if (night)
593 orbitColor = &orbitColorNight;
594 else
595 orbitColor = &orbitColorNormal;
596}
597
598
599void Satellite::computeOrbitPoints()578void Satellite::computeOrbitPoints()
600{579{
601 gTimeSpan computeInterval(0, 0, 0, orbitLineSegmentDuration);580 gTimeSpan computeInterval(0, 0, 0, orbitLineSegmentDuration);
602581
=== modified file 'plugins/Satellites/src/Satellite.hpp'
--- plugins/Satellites/src/Satellite.hpp 2013-10-16 16:55:17 +0000
+++ plugins/Satellites/src/Satellite.hpp 2013-10-17 06:10:44 +0000
@@ -169,7 +169,6 @@
169 //! returns 0 - 1.0 for the DRAWORBIT_FADE_NUMBER segments at169 //! returns 0 - 1.0 for the DRAWORBIT_FADE_NUMBER segments at
170 //! each end of an orbit, with 1 in the middle.170 //! each end of an orbit, with 1 in the middle.
171 float calculateOrbitSegmentIntensity(int segNum);171 float calculateOrbitSegmentIntensity(int segNum);
172 void setNightColors(bool night);
173172
174private:173private:
175 bool initialized;174 bool initialized;
@@ -237,9 +236,7 @@
237236
238 //Satellite Orbit Draw237 //Satellite Orbit Draw
239 QFont font;238 QFont font;
240 Vec3f orbitColorNormal;239 Vec3f orbitColor;
241 Vec3f orbitColorNight;
242 Vec3f* orbitColor;
243 double lastEpochCompForOrbit; //measured in Julian Days240 double lastEpochCompForOrbit; //measured in Julian Days
244 double epochTime; //measured in Julian Days241 double epochTime; //measured in Julian Days
245 QList<Vec3d> orbitPoints; //orbit points represented by ElAzPos vectors242 QList<Vec3d> orbitPoints; //orbit points represented by ElAzPos vectors
246243
=== modified file 'plugins/Satellites/src/Satellites.cpp'
--- plugins/Satellites/src/Satellites.cpp 2013-10-01 22:05:10 +0000
+++ plugins/Satellites/src/Satellites.cpp 2013-10-17 06:10:44 +0000
@@ -246,17 +246,6 @@
246 return true;246 return true;
247}247}
248248
249void Satellites::setStelStyle(const QString& mode)
250{
251 foreach(const SatelliteP& sat, satellites)
252 {
253 if (sat->initialized)
254 {
255 sat->setNightColors(mode=="night_color");
256 }
257 }
258}
259
260const StelStyle Satellites::getModuleStyleSheet(const StelStyle& style)249const StelStyle Satellites::getModuleStyleSheet(const StelStyle& style)
261{250{
262 StelStyle pluginStyle(style);251 StelStyle pluginStyle(style);
@@ -1555,10 +1544,7 @@
1555 // Compute 2D pos and return if outside screen1544 // Compute 2D pos and return if outside screen
1556 if (!prj->project(pos, screenpos))1545 if (!prj->project(pos, screenpos))
1557 return;1546 return;
1558 if (StelApp::getInstance().getVisionModeNight())1547 glColor3f(0.4f,0.5f,0.8f);
1559 glColor3f(0.8f,0.0f,0.0f);
1560 else
1561 glColor3f(0.4f,0.5f,0.8f);
1562 texPointer->bind();1548 texPointer->bind();
15631549
1564 glEnable(GL_TEXTURE_2D);1550 glEnable(GL_TEXTURE_2D);
15651551
=== modified file 'plugins/Satellites/src/Satellites.hpp'
--- plugins/Satellites/src/Satellites.hpp 2013-10-01 01:11:14 +0000
+++ plugins/Satellites/src/Satellites.hpp 2013-10-17 06:10:44 +0000
@@ -435,7 +435,6 @@
435 void saveCatalog(QString path=QString());435 void saveCatalog(QString path=QString());
436436
437private slots:437private slots:
438 void setStelStyle(const QString& section);
439438
440private:439private:
441 //! Add to the current collection the satellite described by the data.440 //! Add to the current collection the satellite described by the data.
442441
=== modified file 'plugins/Supernovae/src/Supernova.cpp'
--- plugins/Supernovae/src/Supernova.cpp 2013-10-16 16:55:17 +0000
+++ plugins/Supernovae/src/Supernova.cpp 2013-10-17 06:10:44 +0000
@@ -148,7 +148,7 @@
148148
149Vec3f Supernova::getInfoColor(void) const149Vec3f Supernova::getInfoColor(void) const
150{150{
151 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.0) : Vec3f(1.0, 1.0, 1.0);151 return Vec3f(1.0, 1.0, 1.0);
152}152}
153153
154float Supernova::getVMagnitude(const StelCore* core) const154float Supernova::getVMagnitude(const StelCore* core) const
@@ -225,9 +225,6 @@
225 StarMgr* smgr = GETSTELMODULE(StarMgr); // It's need for checking displaying of labels for stars225 StarMgr* smgr = GETSTELMODULE(StarMgr); // It's need for checking displaying of labels for stars
226226
227 Vec3f color = Vec3f(1.f,1.f,1.f);227 Vec3f color = Vec3f(1.f,1.f,1.f);
228 if (StelApp::getInstance().getVisionModeNight())
229 color = StelUtils::getNightColor(color);
230
231 RCMag rcMag;228 RCMag rcMag;
232 float size, shift;229 float size, shift;
233 double mag;230 double mag;
234231
=== modified file 'plugins/TelescopeControl/src/clients/TelescopeClient.hpp'
--- plugins/TelescopeControl/src/clients/TelescopeClient.hpp 2012-02-23 07:48:31 +0000
+++ plugins/TelescopeControl/src/clients/TelescopeClient.hpp 2013-10-17 06:10:44 +0000
@@ -62,7 +62,7 @@
62 QString getNameI18n(void) const {return nameI18n;}62 QString getNameI18n(void) const {return nameI18n;}
63 Vec3f getInfoColor(void) const63 Vec3f getInfoColor(void) const
64 {64 {
65 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8, 0.2, 0.2) : Vec3f(1, 1, 1);65 return Vec3f(1, 1, 1);
66 }66 }
67 //! TelescopeClient supports the following InfoStringGroup flags:67 //! TelescopeClient supports the following InfoStringGroup flags:
68 //! - Name68 //! - Name
6969
=== modified file 'src/StelMainView.cpp'
--- src/StelMainView.cpp 2013-10-05 18:52:05 +0000
+++ src/StelMainView.cpp 2013-10-17 06:10:44 +0000
@@ -46,6 +46,7 @@
46#include <QTimer>46#include <QTimer>
47#include <QWidget>47#include <QWidget>
48#include <QWindow>48#include <QWindow>
49#include <QDeclarativeContext>
4950
50// Initialize static variables51// Initialize static variables
51StelMainView* StelMainView::singleton = NULL;52StelMainView* StelMainView::singleton = NULL;
@@ -112,7 +113,7 @@
112 StelApp::getInstance().draw();113 StelApp::getInstance().draw();
113114
114 painter->endNativePainting();115 painter->endNativePainting();
115 // update();116 update();
116}117}
117118
118void StelSkyItem::mousePressEvent(QGraphicsSceneMouseEvent *event)119void StelSkyItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
@@ -300,6 +301,7 @@
300 setResizeMode(QDeclarativeView::SizeRootObjectToView);301 setResizeMode(QDeclarativeView::SizeRootObjectToView);
301 qmlRegisterType<StelSkyItem>("Stellarium", 1, 0, "StelSky");302 qmlRegisterType<StelSkyItem>("Stellarium", 1, 0, "StelSky");
302 qmlRegisterType<StelGuiItem>("Stellarium", 1, 0, "StelGui");303 qmlRegisterType<StelGuiItem>("Stellarium", 1, 0, "StelGui");
304 rootContext()->setContextProperty("stelApp", stelApp);
303 setSource(QUrl("qrc:/qml/qml/main.qml"));305 setSource(QUrl("qrc:/qml/qml/main.qml"));
304 306
305 QScreen* screen = glWidget->windowHandle()->screen();307 QScreen* screen = glWidget->windowHandle()->screen();
306308
=== modified file 'src/core/StelApp.cpp'
--- src/core/StelApp.cpp 2013-10-13 20:39:02 +0000
+++ src/core/StelApp.cpp 2013-10-17 06:10:44 +0000
@@ -423,9 +423,8 @@
423 initScriptMgr(conf);423 initScriptMgr(conf);
424424
425 // Initialisation of the color scheme425 // Initialisation of the color scheme
426 bool tmp = confSettings->value("viewing/flag_night").toBool();426 emit colorSchemeChanged("color");
427 flagNightVision=!tmp; // fool caching427 setVisionModeNight(confSettings->value("viewing/flag_night").toBool());
428 setVisionModeNight(tmp);
429428
430 // Initialisation of the render of solar shadows429 // Initialisation of the render of solar shadows
431 //setRenderSolarShadows(confSettings->value("viewing/flag_render_solar_shadows", true).toBool());430 //setRenderSolarShadows(confSettings->value("viewing/flag_render_solar_shadows", true).toBool());
@@ -663,7 +662,7 @@
663 if (flagNightVision!=b)662 if (flagNightVision!=b)
664 {663 {
665 flagNightVision=b;664 flagNightVision=b;
666 emit(colorSchemeChanged(b ? "night_color" : "color"));665 emit(visionNightModeChanged(b));
667 }666 }
668}667}
669668
670669
=== modified file 'src/core/StelApp.hpp'
--- src/core/StelApp.hpp 2013-10-13 20:39:02 +0000
+++ src/core/StelApp.hpp 2013-10-17 06:10:44 +0000
@@ -59,7 +59,7 @@
59class StelApp : public QObject59class StelApp : public QObject
60{60{
61 Q_OBJECT61 Q_OBJECT
62 Q_PROPERTY(bool nightMode READ getVisionModeNight WRITE setVisionModeNight)62 Q_PROPERTY(bool nightMode READ getVisionModeNight WRITE setVisionModeNight NOTIFY visionNightModeChanged)
6363
64public:64public:
65 friend class StelAppGraphicsWidget;65 friend class StelAppGraphicsWidget;
@@ -140,7 +140,7 @@
140 QSettings* getSettings() {return confSettings;}140 QSettings* getSettings() {return confSettings;}
141141
142 //! Return the currently used style142 //! Return the currently used style
143 QString getCurrentStelStyle() {return flagNightVision ? "night_color" : "color";}143 QString getCurrentStelStyle() {return "color";}
144144
145 //! Update all object according to the deltaTime in seconds.145 //! Update all object according to the deltaTime in seconds.
146 void update(double deltaTime);146 void update(double deltaTime);
@@ -212,6 +212,7 @@
212 void reportFileDownloadFinished(QNetworkReply* reply);212 void reportFileDownloadFinished(QNetworkReply* reply);
213 213
214signals:214signals:
215 void visionNightModeChanged(bool);
215 void colorSchemeChanged(const QString&);216 void colorSchemeChanged(const QString&);
216 void languageChanged();217 void languageChanged();
217 void skyCultureChanged(const QString&);218 void skyCultureChanged(const QString&);
218219
=== modified file 'src/core/StelSkyDrawer.cpp'
--- src/core/StelSkyDrawer.cpp 2013-10-09 20:58:58 +0000
+++ src/core/StelSkyDrawer.cpp 2013-10-17 06:10:44 +0000
@@ -442,21 +442,14 @@
442 sPainter->enableTexture2d(true);442 sPainter->enableTexture2d(true);
443 glBlendFunc(GL_ONE, GL_ONE);443 glBlendFunc(GL_ONE, GL_ONE);
444 glEnable(GL_BLEND); 444 glEnable(GL_BLEND);
445 if (StelApp::getInstance().getVisionModeNight())445 sPainter->setColor(color[0]*cmag, color[1]*cmag, color[2]*cmag);
446 sPainter->setColor(color[0]*cmag, 0.0, 0.0);
447 else
448 sPainter->setColor(color[0]*cmag, color[1]*cmag, color[2]*cmag);
449
450 sPainter->drawSprite2dMode(win[0], win[1], rmag);446 sPainter->drawSprite2dMode(win[0], win[1], rmag);
451 }447 }
452448
453 unsigned char starColor[3] = {0, 0, 0};449 unsigned char starColor[3] = {0, 0, 0};
454 starColor[0] = (unsigned char)std::min((int)(color[0]*tw*255+0.5f), 255);450 starColor[0] = (unsigned char)std::min((int)(color[0]*tw*255+0.5f), 255);
455 if (!StelApp::getInstance().getVisionModeNight())451 starColor[1] = (unsigned char)std::min((int)(color[1]*tw*255+0.5f), 255);
456 {452 starColor[2] = (unsigned char)std::min((int)(color[2]*tw*255+0.5f), 255);
457 starColor[1] = (unsigned char)std::min((int)(color[1]*tw*255+0.5f), 255);
458 starColor[2] = (unsigned char)std::min((int)(color[2]*tw*255+0.5f), 255);
459 }
460 453
461 // Store the drawing instructions in the vertex arrays454 // Store the drawing instructions in the vertex arrays
462 StarVertex* vx = &(vertexArray[nbPointSources*6]);455 StarVertex* vx = &(vertexArray[nbPointSources*6]);
@@ -500,11 +493,7 @@
500 cmag = qMax(0.f, 1.f-(pixRadius*3.f+100-rmag)/100);493 cmag = qMax(0.f, 1.f-(pixRadius*3.f+100-rmag)/100);
501 Vec3f win;494 Vec3f win;
502 painter->getProjector()->project(v, win);495 painter->getProjector()->project(v, win);
503 Vec3f c = color;496 painter->setColor(color[0]*cmag, color[1]*cmag, color[2]*cmag);
504 if (StelApp::getInstance().getVisionModeNight())
505 c = StelUtils::getNightColor(c);
506
507 painter->setColor(c[0]*cmag, c[1]*cmag, c[2]*cmag);
508 painter->drawSprite2dMode(win[0], win[1], rmag);497 painter->drawSprite2dMode(win[0], win[1], rmag);
509 noStarHalo = true;498 noStarHalo = true;
510 }499 }
511500
=== modified file 'src/core/modules/Constellation.cpp'
--- src/core/modules/Constellation.cpp 2013-09-07 13:01:20 +0000
+++ src/core/modules/Constellation.cpp 2013-10-17 06:10:44 +0000
@@ -128,10 +128,7 @@
128 const float intensity = artFader.getInterstate();128 const float intensity = artFader.getInterstate();
129 if (artTexture && intensity && region.intersects(boundingCap))129 if (artTexture && intensity && region.intersects(boundingCap))
130 {130 {
131 if (StelApp::getInstance().getVisionModeNight())131 sPainter.setColor(intensity,intensity,intensity);
132 sPainter.setColor(intensity, 0.0, 0.0);
133 else
134 sPainter.setColor(intensity,intensity,intensity);
135132
136 // The texture is not fully loaded133 // The texture is not fully loaded
137 if (artTexture->bind()==false)134 if (artTexture->bind()==false)
138135
=== modified file 'src/core/modules/GridLinesMgr.cpp'
--- src/core/modules/GridLinesMgr.cpp 2013-10-01 22:05:10 +0000
+++ src/core/modules/GridLinesMgr.cpp 2013-10-17 06:10:44 +0000
@@ -311,19 +311,7 @@
311 glEnable(GL_BLEND);311 glEnable(GL_BLEND);
312 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode312 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
313 Vec4f textColor(color[0], color[1], color[2], 0);313 Vec4f textColor(color[0], color[1], color[2], 0);
314 if (StelApp::getInstance().getVisionModeNight())314 sPainter.setColor(color[0],color[1],color[2], fader.getInterstate());
315 {
316 // instead of a filter which just zeros G&B, set the red
317 // value to the mean brightness of RGB.
318 float red = (color[0] + color[1] + color[2]) / 3.0;
319 textColor[0] = red;
320 textColor[1] = 0.; textColor[2] = 0.;
321 sPainter.setColor(red, 0, 0, fader.getInterstate());
322 }
323 else
324 {
325 sPainter.setColor(color[0],color[1],color[2], fader.getInterstate());
326 }
327315
328 textColor*=2;316 textColor*=2;
329 textColor[3]=fader.getInterstate();317 textColor[3]=fader.getInterstate();
330318
=== modified file 'src/core/modules/Landscape.cpp'
--- src/core/modules/Landscape.cpp 2013-09-23 20:24:50 +0000
+++ src/core/modules/Landscape.cpp 2013-10-17 06:10:44 +0000
@@ -351,10 +351,9 @@
351 transfo->combine(Mat4d::translation(Vec3d(0.,0.,vpos)));351 transfo->combine(Mat4d::translation(Vec3d(0.,0.,vpos)));
352 sPainter.setProjector(core->getProjection(transfo));352 sPainter.setProjector(core->getProjection(transfo));
353 glBlendFunc(GL_ONE, GL_ONE);353 glBlendFunc(GL_ONE, GL_ONE);
354 const float nightModeFilter = StelApp::getInstance().getVisionModeNight() ? 0.f : 1.f;
355 sPainter.setColor(fogFader.getInterstate()*(0.1f+0.1f*skyBrightness),354 sPainter.setColor(fogFader.getInterstate()*(0.1f+0.1f*skyBrightness),
356 fogFader.getInterstate()*(0.1f+0.1f*skyBrightness)*nightModeFilter,355 fogFader.getInterstate()*(0.1f+0.1f*skyBrightness),
357 fogFader.getInterstate()*(0.1f+0.1f*skyBrightness)*nightModeFilter);356 fogFader.getInterstate()*(0.1f+0.1f*skyBrightness));
358 fogTex->bind();357 fogTex->bind();
359 const float height = (tanMode||calibrated) ? radius*std::tan(fogAltAngle*M_PI/180.) : radius*std::sin(fogAltAngle*M_PI/180.);358 const float height = (tanMode||calibrated) ? radius*std::tan(fogAltAngle*M_PI/180.) : radius*std::sin(fogAltAngle*M_PI/180.);
360 sPainter.sCylinder(radius, height, 64, 1);359 sPainter.sCylinder(radius, height, 64, 1);
@@ -379,10 +378,7 @@
379378
380 if (!landFader.getInterstate())379 if (!landFader.getInterstate())
381 return;380 return;
382 if (StelApp::getInstance().getVisionModeNight())381 sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate());
383 sPainter.setColor(skyBrightness*nightBrightness, 0.0, 0.0, landFader.getInterstate());
384 else
385 sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate());
386382
387 foreach (const LOSSide& side, precomputedSides)383 foreach (const LOSSide& side, precomputedSides)
388 {384 {
@@ -404,10 +400,7 @@
404 transfo->combine(Mat4d::zrotation((groundAngleRotateZ-angleRotateZOffset)*M_PI/180.f) * Mat4d::translation(Vec3d(0,0,vshift)));400 transfo->combine(Mat4d::zrotation((groundAngleRotateZ-angleRotateZOffset)*M_PI/180.f) * Mat4d::translation(Vec3d(0,0,vshift)));
405401
406 sPainter.setProjector(core->getProjection(transfo));402 sPainter.setProjector(core->getProjection(transfo));
407 if (StelApp::getInstance().getVisionModeNight())403 sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate());
408 sPainter.setColor(skyBrightness*nightBrightness, 0.0, 0.0, landFader.getInterstate());
409 else
410 sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate());
411404
412 groundTex->bind();405 groundTex->bind();
413 sPainter.setArrays((Vec3d*)groundVertexArr.constData(), (Vec2f*)groundTexCoordArr.constData());406 sPainter.setArrays((Vec3d*)groundVertexArr.constData(), (Vec2f*)groundTexCoordArr.constData());
@@ -462,10 +455,7 @@
462455
463 // Normal transparency mode456 // Normal transparency mode
464 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);457 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
465 if (StelApp::getInstance().getVisionModeNight())458 sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate());
466 sPainter.setColor(skyBrightness*nightBrightness, 0.0, 0.0, landFader.getInterstate());
467 else
468 sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate());
469459
470460
471 glEnable(GL_CULL_FACE);461 glEnable(GL_CULL_FACE);
@@ -530,11 +520,7 @@
530520
531 // Normal transparency mode521 // Normal transparency mode
532 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);522 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
533 if (StelApp::getInstance().getVisionModeNight())523 sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate());
534 sPainter.setColor(skyBrightness*nightBrightness, 0.0, 0.0, landFader.getInterstate());
535 else
536 sPainter.setColor(skyBrightness, skyBrightness, skyBrightness, landFader.getInterstate());
537
538524
539 glEnable(GL_CULL_FACE);525 glEnable(GL_CULL_FACE);
540 sPainter.enableTexture2d(true);526 sPainter.enableTexture2d(true);
541527
=== modified file 'src/core/modules/MilkyWay.cpp'
--- src/core/modules/MilkyWay.cpp 2013-09-22 20:28:42 +0000
+++ src/core/modules/MilkyWay.cpp 2013-10-17 06:10:44 +0000
@@ -85,11 +85,7 @@
8585
86 // This RGB color corresponds to the night blue scotopic color = 0.25, 0.25 in xyY mode.86 // This RGB color corresponds to the night blue scotopic color = 0.25, 0.25 in xyY mode.
87 // since milky way is always seen white RGB value in the texture (1.0,1.0,1.0)87 // since milky way is always seen white RGB value in the texture (1.0,1.0,1.0)
88 Vec3f c;88 Vec3f c = Vec3f(0.34165f, 0.429666f, 0.63586f);
89 if (StelApp::getInstance().getVisionModeNight())
90 c = Vec3f(0.34165f, 0.f, 0.f);
91 else
92 c = Vec3f(0.34165f, 0.429666f, 0.63586f);
9389
94 float lum = core->getSkyDrawer()->surfacebrightnessToLuminance(13.5f);90 float lum = core->getSkyDrawer()->surfacebrightnessToLuminance(13.5f);
9591
9692
=== modified file 'src/core/modules/Nebula.cpp'
--- src/core/modules/Nebula.cpp 2013-10-16 16:55:17 +0000
+++ src/core/modules/Nebula.cpp 2013-10-17 06:10:44 +0000
@@ -142,8 +142,7 @@
142142
143Vec3f Nebula::getInfoColor(void) const143Vec3f Nebula::getInfoColor(void) const
144{144{
145 Vec3f col = ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("NebulaMgr"))->getLabelsColor();145 return ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("NebulaMgr"))->getLabelsColor();
146 return StelApp::getInstance().getVisionModeNight() ? StelUtils::getNightColor(col) : col;
147}146}
148147
149double Nebula::getCloseViewFov(const StelCore*) const148double Nebula::getCloseViewFov(const StelCore*) const
@@ -166,8 +165,6 @@
166 glBlendFunc(GL_ONE, GL_ONE);165 glBlendFunc(GL_ONE, GL_ONE);
167 float lum = 1.f;//qMin(1,4.f/getOnScreenSize(core))*0.8;166 float lum = 1.f;//qMin(1,4.f/getOnScreenSize(core))*0.8;
168 Vec3f col(circleColor[0]*lum*hintsBrightness, circleColor[1]*lum*hintsBrightness, circleColor[2]*lum*hintsBrightness);167 Vec3f col(circleColor[0]*lum*hintsBrightness, circleColor[1]*lum*hintsBrightness, circleColor[2]*lum*hintsBrightness);
169 if (StelApp::getInstance().getVisionModeNight())
170 col = StelUtils::getNightColor(col);
171168
172 sPainter.setColor(col[0], col[1], col[2], 1);169 sPainter.setColor(col[0], col[1], col[2], 1);
173 switch (nType) {170 switch (nType) {
@@ -209,8 +206,6 @@
209 return;206 return;
210207
211 Vec3f col(labelColor[0], labelColor[1], labelColor[2]);208 Vec3f col(labelColor[0], labelColor[1], labelColor[2]);
212 if (StelApp::getInstance().getVisionModeNight())
213 col = StelUtils::getNightColor(col);
214209
215 sPainter.setColor(col[0], col[1], col[2], hintsBrightness);210 sPainter.setColor(col[0], col[1], col[2], hintsBrightness);
216 float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()->getPixelPerRadAtCenter();211 float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()->getPixelPerRadAtCenter();
217212
=== modified file 'src/core/modules/NebulaMgr.cpp'
--- src/core/modules/NebulaMgr.cpp 2013-10-11 23:49:02 +0000
+++ src/core/modules/NebulaMgr.cpp 2013-10-17 06:10:44 +0000
@@ -192,11 +192,8 @@
192 Vec3d pos=obj->getJ2000EquatorialPos(core);192 Vec3d pos=obj->getJ2000EquatorialPos(core);
193193
194 // Compute 2D pos and return if outside screen194 // Compute 2D pos and return if outside screen
195 if (!prj->projectInPlace(pos)) return; 195 if (!prj->projectInPlace(pos)) return;
196 if (StelApp::getInstance().getVisionModeNight())196 sPainter.setColor(0.4f,0.5f,0.8f);
197 sPainter.setColor(0.8f,0.0f,0.0f);
198 else
199 sPainter.setColor(0.4f,0.5f,0.8f);
200197
201 texPointer->bind();198 texPointer->bind();
202199
203200
=== modified file 'src/core/modules/Planet.cpp'
--- src/core/modules/Planet.cpp 2013-10-16 16:55:17 +0000
+++ src/core/modules/Planet.cpp 2013-10-17 06:10:44 +0000
@@ -245,10 +245,7 @@
245245
246Vec3f Planet::getInfoColor(void) const246Vec3f Planet::getInfoColor(void) const
247{247{
248 Vec3f col = ((SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem"))->getLabelsColor();248 return ((SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem"))->getLabelsColor();
249 if (StelApp::getInstance().getVisionModeNight())
250 col = StelUtils::getNightColor(col);
251 return col;
252}249}
253250
254251
@@ -873,16 +870,8 @@
873 static Vec4f diffuse = Vec4f(2.f,2.f,2.f,1.f);870 static Vec4f diffuse = Vec4f(2.f,2.f,2.f,1.f);
874 static Vec4f zero = Vec4f(0.f,0.f,0.f,0.f);871 static Vec4f zero = Vec4f(0.f,0.f,0.f,0.f);
875 static Vec4f ambient = Vec4f(0.02f,0.02f,0.02f,0.02f);872 static Vec4f ambient = Vec4f(0.02f,0.02f,0.02f,0.02f);
876 if (StelApp::getInstance().getVisionModeNight())873 diffuse[1] = 2.; diffuse[2] = 2.;
877 {874 ambient[1] = 0.02; ambient[2] = 0.02;
878 diffuse[1] = 0.; diffuse[2] = 0.;
879 ambient[1] = 0.; ambient[2] = 0.;
880 }
881 else
882 {
883 diffuse[1] = 2.; diffuse[2] = 2.;
884 ambient[1] = 0.02; ambient[2] = 0.02;
885 }
886 sPainter->getLight().setAmbient(ambient);875 sPainter->getLight().setAmbient(ambient);
887 sPainter->getLight().setDiffuse(diffuse);876 sPainter->getLight().setDiffuse(diffuse);
888 sPainter->getLight().setSpecular(zero);877 sPainter->getLight().setSpecular(zero);
@@ -966,10 +955,7 @@
966 }955 }
967 }956 }
968 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);957 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
969 if (StelApp::getInstance().getVisionModeNight())958 painter->setColor(1.f, 1.f, 1.f);
970 painter->setColor(1.f, 0.f, 0.f);
971 else
972 painter->setColor(1.f, 1.f, 1.f);
973959
974 painter->enableTexture2d(true);960 painter->enableTexture2d(true);
975 glDisable(GL_BLEND);961 glDisable(GL_BLEND);
@@ -1131,11 +1117,7 @@
11311117
1132 // Normal transparency mode1118 // Normal transparency mode
1133 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);1119 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1134 if (StelApp::getInstance().getVisionModeNight())1120 sPainter->setColor(1.f, 1.f, 1.f);
1135 sPainter->setColor(1.f, 0.f, 0.f);
1136 else
1137 sPainter->setColor(1.f, 1.f, 1.f);
1138
1139 sPainter->enableTexture2d(true);1121 sPainter->enableTexture2d(true);
1140 glEnable(GL_CULL_FACE);1122 glEnable(GL_CULL_FACE);
1141 glEnable(GL_BLEND);1123 glEnable(GL_BLEND);
11421124
=== modified file 'src/core/modules/SolarSystem.cpp'
--- src/core/modules/SolarSystem.cpp 2013-10-01 22:05:10 +0000
+++ src/core/modules/SolarSystem.cpp 2013-10-17 06:10:44 +0000
@@ -176,10 +176,7 @@
176176
177177
178 StelPainter sPainter(prj);178 StelPainter sPainter(prj);
179 if (StelApp::getInstance().getVisionModeNight())179 sPainter.setColor(1.0f,0.3f,0.3f);
180 sPainter.setColor(1.0f,0.0f,0.0f);
181 else
182 sPainter.setColor(1.0f,0.3f,0.3f);
183180
184 float size = obj->getAngularSize(core)*M_PI/180.*prj->getPixelPerRadAtCenter()*2.;181 float size = obj->getAngularSize(core)*M_PI/180.*prj->getPixelPerRadAtCenter()*2.;
185 size+=40.f + 10.f*std::sin(2.f * StelApp::getInstance().getTotalRunTime());182 size+=40.f + 10.f*std::sin(2.f * StelApp::getInstance().getTotalRunTime());
186183
=== modified file 'src/core/modules/StarMgr.cpp'
--- src/core/modules/StarMgr.cpp 2013-10-13 20:39:02 +0000
+++ src/core/modules/StarMgr.cpp 2013-10-17 06:10:44 +0000
@@ -351,9 +351,6 @@
351 return;351 return;
352352
353 Vec3f c(obj->getInfoColor());353 Vec3f c(obj->getInfoColor());
354 if (StelApp::getInstance().getVisionModeNight())
355 c = StelUtils::getNightColor(c);
356
357 sPainter.setColor(c[0], c[1], c[2]);354 sPainter.setColor(c[0], c[1], c[2]);
358 texPointer->bind();355 texPointer->bind();
359 sPainter.enableTexture2d(true);356 sPainter.enableTexture2d(true);
360357
=== modified file 'src/core/modules/StarWrapper.hpp'
--- src/core/modules/StarWrapper.hpp 2013-10-16 16:55:17 +0000
+++ src/core/modules/StarWrapper.hpp 2013-10-17 06:10:44 +0000
@@ -81,7 +81,7 @@
81 }81 }
82 Vec3f getInfoColor(void) const82 Vec3f getInfoColor(void) const
83 {83 {
84 return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8, 0.0, 0.0) : StelSkyDrawer::indexToColor(s->bV);84 return StelSkyDrawer::indexToColor(s->bV);
85 }85 }
86 float getVMagnitude(const StelCore* core) const86 float getVMagnitude(const StelCore* core) const
87 {87 {
8888
=== modified file 'src/core/modules/ZoneArray.cpp'
--- src/core/modules/ZoneArray.cpp 2013-10-11 23:49:02 +0000
+++ src/core/modules/ZoneArray.cpp 2013-10-17 06:10:44 +0000
@@ -556,7 +556,7 @@
556 if (drawer->drawPointSource(sPainter, vf, *tmpRcmag, s->bV, !isInsideViewport) && s->hasName() && extinctedMagIndex < maxMagStarName && s->hasComponentID()<=1)556 if (drawer->drawPointSource(sPainter, vf, *tmpRcmag, s->bV, !isInsideViewport) && s->hasName() && extinctedMagIndex < maxMagStarName && s->hasComponentID()<=1)
557 {557 {
558 const float offset = tmpRcmag->radius*0.7f;558 const float offset = tmpRcmag->radius*0.7f;
559 const Vec3f& colorr = (StelApp::getInstance().getVisionModeNight() ? Vec3f(0.8f, 0.0f, 0.0f) : StelSkyDrawer::indexToColor(s->bV))*0.75f;559 const Vec3f colorr = StelSkyDrawer::indexToColor(s->bV)*0.75f;
560 sPainter->setColor(colorr[0], colorr[1], colorr[2],names_brightness);560 sPainter->setColor(colorr[0], colorr[1], colorr[2],names_brightness);
561 sPainter->drawText(Vec3d(vf[0], vf[1], vf[2]), s->getNameI18n(), 0, offset, offset, false);561 sPainter->drawText(Vec3d(vf[0], vf[1], vf[2]), s->getNameI18n(), 0, offset, offset, false);
562 }562 }
563563
=== modified file 'src/gui/ConfigurationDialog.cpp'
--- src/gui/ConfigurationDialog.cpp 2013-10-16 16:55:17 +0000
+++ src/gui/ConfigurationDialog.cpp 2013-10-17 06:10:44 +0000
@@ -65,7 +65,7 @@
65#include <QComboBox>65#include <QComboBox>
66#include <QDir>66#include <QDir>
6767
68ConfigurationDialog::ConfigurationDialog(StelGui* agui) : StelDialog(agui), starCatalogDownloadReply(NULL), currentDownloadFile(NULL), progressBar(NULL), gui(agui)68ConfigurationDialog::ConfigurationDialog(StelGui* agui, QObject* parent) : StelDialog(parent), starCatalogDownloadReply(NULL), currentDownloadFile(NULL), progressBar(NULL), gui(agui)
69{69{
70 ui = new Ui_configurationDialogForm;70 ui = new Ui_configurationDialogForm;
71 customDeltaTEquationDialog = NULL;71 customDeltaTEquationDialog = NULL;
@@ -116,25 +116,6 @@
116 // Nothing for now116 // Nothing for now
117}117}
118118
119void ConfigurationDialog::updateIconsColor()
120{
121 QPixmap pixmap(50, 50);
122 QStringList icons;
123 icons << "main" << "info" << "navigation" << "tools" << "scripts" << "plugins";
124 bool redIcon = false;
125 if (StelApp::getInstance().getVisionModeNight())
126 redIcon = true;
127
128 foreach(const QString &iconName, icons)
129 {
130 pixmap.load(":/graphicGui/tabicon-" + iconName +".png");
131 if (redIcon)
132 pixmap = StelButton::makeRed(pixmap);
133
134 ui->stackListWidget->item(icons.indexOf(iconName))->setIcon(QIcon(pixmap));
135 }
136}
137
138void ConfigurationDialog::createDialogContent()119void ConfigurationDialog::createDialogContent()
139{120{
140 const StelProjectorP proj = StelApp::getInstance().getCore()->getProjection(StelCore::FrameJ2000);121 const StelProjectorP proj = StelApp::getInstance().getCore()->getProjection(StelCore::FrameJ2000);
@@ -144,11 +125,9 @@
144125
145 ui->setupUi(dialog);126 ui->setupUi(dialog);
146 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));127 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
147 connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(QString)), this, SLOT(updateIconsColor()));
148128
149 // Set the main tab activated by default129 // Set the main tab activated by default
150 ui->configurationStackedWidget->setCurrentIndex(0);130 ui->configurationStackedWidget->setCurrentIndex(0);
151 updateIconsColor();
152 ui->stackListWidget->setCurrentRow(0);131 ui->stackListWidget->setCurrentRow(0);
153132
154 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));133 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
155134
=== modified file 'src/gui/ConfigurationDialog.hpp'
--- src/gui/ConfigurationDialog.hpp 2013-09-09 23:21:42 +0000
+++ src/gui/ConfigurationDialog.hpp 2013-10-17 06:10:44 +0000
@@ -37,14 +37,13 @@
37{37{
38 Q_OBJECT38 Q_OBJECT
39public:39public:
40 ConfigurationDialog(StelGui* agui);40 ConfigurationDialog(StelGui* agui, QObject* parent);
41 virtual ~ConfigurationDialog();41 virtual ~ConfigurationDialog();
42 //! Notify that the application style changed42 //! Notify that the application style changed
43 void styleChanged();43 void styleChanged();
4444
45public slots:45public slots:
46 void retranslate();46 void retranslate();
47 void updateIconsColor();
4847
49protected:48protected:
50 //! Initialize the dialog widgets and connect the signals/slots49 //! Initialize the dialog widgets and connect the signals/slots
5150
=== modified file 'src/gui/DateTimeDialog.cpp'
--- src/gui/DateTimeDialog.cpp 2013-08-30 22:42:40 +0000
+++ src/gui/DateTimeDialog.cpp 2013-10-17 06:10:44 +0000
@@ -31,7 +31,8 @@
31#include <QFrame>31#include <QFrame>
32#include <QLineEdit>32#include <QLineEdit>
3333
34DateTimeDialog::DateTimeDialog() :34DateTimeDialog::DateTimeDialog(QObject* parent) :
35 StelDialog(parent),
35 year(0),36 year(0),
36 month(0),37 month(0),
37 day(0),38 day(0),
3839
=== modified file 'src/gui/DateTimeDialog.hpp'
--- src/gui/DateTimeDialog.hpp 2012-02-13 18:59:16 +0000
+++ src/gui/DateTimeDialog.hpp 2013-10-17 06:10:44 +0000
@@ -30,7 +30,7 @@
30{30{
31 Q_OBJECT31 Q_OBJECT
32public:32public:
33 DateTimeDialog();33 DateTimeDialog(QObject* parent);
34 ~DateTimeDialog();34 ~DateTimeDialog();
35 double newJd();35 double newJd();
36 bool valid(int y, int m, int d, int h, int min, int s);36 bool valid(int y, int m, int d, int h, int min, int s);
3737
=== modified file 'src/gui/HelpDialog.cpp'
--- src/gui/HelpDialog.cpp 2013-09-13 07:33:37 +0000
+++ src/gui/HelpDialog.cpp 2013-10-17 06:10:44 +0000
@@ -45,7 +45,7 @@
45#include "StelStyle.hpp"45#include "StelStyle.hpp"
46#include "StelActionMgr.hpp"46#include "StelActionMgr.hpp"
4747
48HelpDialog::HelpDialog()48HelpDialog::HelpDialog(QObject* parent) : StelDialog(parent)
49{49{
50 ui = new Ui_helpDialogForm;50 ui = new Ui_helpDialogForm;
51}51}
@@ -73,32 +73,11 @@
73 }73 }
74}74}
7575
76void HelpDialog::updateIconsColor()
77{
78 QPixmap pixmap(50, 50);
79 QStringList icons;
80 icons << "help" << "info" << "logs";
81 bool redIcon = false;
82 if (StelApp::getInstance().getVisionModeNight())
83 redIcon = true;
84
85 foreach(const QString &iconName, icons)
86 {
87 pixmap.load(":/graphicGui/tabicon-" + iconName +".png");
88 if (redIcon)
89 pixmap = StelButton::makeRed(pixmap);
90
91 ui->stackListWidget->item(icons.indexOf(iconName))->setIcon(QIcon(pixmap));
92 }
93}
94
95void HelpDialog::createDialogContent()76void HelpDialog::createDialogContent()
96{77{
97 ui->setupUi(dialog);78 ui->setupUi(dialog);
98 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));79 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
99 connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(QString)), this, SLOT(updateIconsColor()));
100 ui->stackedWidget->setCurrentIndex(0);80 ui->stackedWidget->setCurrentIndex(0);
101 updateIconsColor();
102 ui->stackListWidget->setCurrentRow(0);81 ui->stackListWidget->setCurrentRow(0);
103 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));82 connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
10483
10584
=== modified file 'src/gui/HelpDialog.hpp'
--- src/gui/HelpDialog.hpp 2013-09-13 07:33:37 +0000
+++ src/gui/HelpDialog.hpp 2013-10-17 06:10:44 +0000
@@ -32,7 +32,7 @@
32{32{
33 Q_OBJECT33 Q_OBJECT
34public:34public:
35 HelpDialog();35 HelpDialog(QObject* parent);
36 ~HelpDialog();36 ~HelpDialog();
3737
38 //! Notify that the application style changed38 //! Notify that the application style changed
@@ -40,7 +40,6 @@
4040
41public slots:41public slots:
42 void retranslate();42 void retranslate();
43 void updateIconsColor();
4443
45protected:44protected:
46 //! Initialize the dialog widgets and connect the signals/slots45 //! Initialize the dialog widgets and connect the signals/slots
4746
=== modified file 'src/gui/LocationDialog.cpp'
--- src/gui/LocationDialog.cpp 2013-09-22 19:42:45 +0000
+++ src/gui/LocationDialog.cpp 2013-10-17 06:10:44 +0000
@@ -41,10 +41,9 @@
41#include <QTimer>41#include <QTimer>
42#include <QStringListModel>42#include <QStringListModel>
4343
44LocationDialog::LocationDialog() : isEditingNew(false)44LocationDialog::LocationDialog(QObject* parent) : StelDialog(parent), isEditingNew(false)
45{45{
46 ui = new Ui_locationDialogForm;46 ui = new Ui_locationDialogForm;
47 lastVisionMode = StelApp::getInstance().getVisionModeNight();
48}47}
4948
50LocationDialog::~LocationDialog()49LocationDialog::~LocationDialog()
@@ -224,7 +223,7 @@
224void LocationDialog::setMapForLocation(const StelLocation& loc)223void LocationDialog::setMapForLocation(const StelLocation& loc)
225{224{
226 // Avoids usless processing225 // Avoids usless processing
227 if (lastPlanet==loc.planetName && lastVisionMode==StelApp::getInstance().getVisionModeNight())226 if (lastPlanet==loc.planetName)
228 return;227 return;
229228
230 QPixmap pixmap;229 QPixmap pixmap;
@@ -249,19 +248,9 @@
249 pixmap = QPixmap(path);248 pixmap = QPixmap(path);
250 }249 }
251 }250 }
252251 ui->mapLabel->setPixmap(pixmap);
253 if (StelApp::getInstance().getVisionModeNight())
254 {
255 ui->mapLabel->setPixmap(StelButton::makeRed(pixmap));
256 }
257 else
258 {
259 ui->mapLabel->setPixmap(pixmap);
260 }
261
262 // For caching252 // For caching
263 lastPlanet = loc.planetName;253 lastPlanet = loc.planetName;
264 lastVisionMode = StelApp::getInstance().getVisionModeNight();
265}254}
266255
267void LocationDialog::populatePlanetList()256void LocationDialog::populatePlanetList()
268257
=== modified file 'src/gui/LocationDialog.hpp'
--- src/gui/LocationDialog.hpp 2012-08-03 18:57:40 +0000
+++ src/gui/LocationDialog.hpp 2013-10-17 06:10:44 +0000
@@ -31,7 +31,7 @@
31{31{
32 Q_OBJECT32 Q_OBJECT
33public:33public:
34 LocationDialog();34 LocationDialog(QObject* parent);
35 virtual ~LocationDialog();35 virtual ~LocationDialog();
36 //! Notify that the application style changed36 //! Notify that the application style changed
37 void styleChanged();37 void styleChanged();
@@ -102,9 +102,7 @@
102 void setDefaultLocation();102 void setDefaultLocation();
103 103
104private:104private:
105 QString lastPlanet; 105 QString lastPlanet;
106 bool lastVisionMode;
107
108 //! Updates the check state and the enabled/disabled status.106 //! Updates the check state and the enabled/disabled status.
109 void updateDefaultLocationControls(bool currentIsDefault);107 void updateDefaultLocationControls(bool currentIsDefault);
110};108};
111109
=== modified file 'src/gui/SearchDialog.cpp'
--- src/gui/SearchDialog.cpp 2013-08-12 13:03:38 +0000
+++ src/gui/SearchDialog.cpp 2013-10-17 06:10:44 +0000
@@ -121,7 +121,7 @@
121121
122const char* SearchDialog::DEF_SIMBAD_URL = "http://simbad.u-strasbg.fr/";122const char* SearchDialog::DEF_SIMBAD_URL = "http://simbad.u-strasbg.fr/";
123123
124SearchDialog::SearchDialog() : simbadReply(NULL)124SearchDialog::SearchDialog(QObject* parent) : StelDialog(parent), simbadReply(NULL)
125{125{
126 ui = new Ui_searchDialogForm;126 ui = new Ui_searchDialogForm;
127 simbadSearcher = new SimbadSearcher(this);127 simbadSearcher = new SimbadSearcher(this);
128128
=== modified file 'src/gui/SearchDialog.hpp'
--- src/gui/SearchDialog.hpp 2013-08-12 13:03:38 +0000
+++ src/gui/SearchDialog.hpp 2013-10-17 06:10:44 +0000
@@ -67,7 +67,7 @@
67 Q_OBJECT67 Q_OBJECT
6868
69public:69public:
70 SearchDialog();70 SearchDialog(QObject* parent);
71 virtual ~SearchDialog();71 virtual ~SearchDialog();
72 //! Notify that the application style changed72 //! Notify that the application style changed
73 void styleChanged();73 void styleChanged();
7474
=== modified file 'src/gui/ShortcutsDialog.cpp'
--- src/gui/ShortcutsDialog.cpp 2013-10-07 14:36:24 +0000
+++ src/gui/ShortcutsDialog.cpp 2013-10-17 06:10:44 +0000
@@ -59,7 +59,8 @@
59}59}
6060
6161
62ShortcutsDialog::ShortcutsDialog() :62ShortcutsDialog::ShortcutsDialog(QObject* parent) :
63 StelDialog(parent),
63 ui(new Ui_shortcutsDialogForm),64 ui(new Ui_shortcutsDialogForm),
64 filterModel(new ShortcutsFilterModel(this)),65 filterModel(new ShortcutsFilterModel(this)),
65 mainModel(new QStandardItemModel(this))66 mainModel(new QStandardItemModel(this))
6667
=== modified file 'src/gui/ShortcutsDialog.hpp'
--- src/gui/ShortcutsDialog.hpp 2013-09-13 08:21:23 +0000
+++ src/gui/ShortcutsDialog.hpp 2013-10-17 06:10:44 +0000
@@ -55,7 +55,7 @@
55 Q_OBJECT55 Q_OBJECT
5656
57public:57public:
58 ShortcutsDialog();58 ShortcutsDialog(QObject* parent);
59 ~ShortcutsDialog();59 ~ShortcutsDialog();
6060
61 //! higlight items that have collisions with current lineEdits' state according to css.61 //! higlight items that have collisions with current lineEdits' state according to css.
6262
=== modified file 'src/gui/SkyGui.cpp'
--- src/gui/SkyGui.cpp 2013-10-16 16:55:17 +0000
+++ src/gui/SkyGui.cpp 2013-10-17 06:10:44 +0000
@@ -278,28 +278,10 @@
278278
279void SkyGui::setStelStyle(const QString& style)279void SkyGui::setStelStyle(const QString& style)
280{280{
281 if (style == "night_color")281 buttonBarPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5));
282 {282 buttonBarPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2));
283 buttonBarPath->setPen(QColor::fromRgbF(0.7,0.0,0.0,0.5));283 buttonBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9));
284 buttonBarPath->setBrush(QColor::fromRgbF(0.23, 0.0, 0.00, 0.2));284 winBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9));
285 buttonBar->setColor(QColor::fromRgbF(0.9, 0.0, 0.0, 0.9));
286 winBar->setColor(QColor::fromRgbF(0.9, 0.0, 0.0, 0.9));
287 winBar->setRedMode(true);
288 buttonBar->setRedMode(true);
289 btHorizAutoHide->setRedMode(true);
290 btVertAutoHide->setRedMode(true);
291 }
292 else
293 {
294 buttonBarPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5));
295 buttonBarPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2));
296 buttonBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9));
297 winBar->setColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9));
298 buttonBar->setRedMode(false);
299 winBar->setRedMode(false);
300 btHorizAutoHide->setRedMode(false);
301 btVertAutoHide->setRedMode(false);
302 }
303}285}
304286
305// Add a new progress bar in the lower right corner of the screen.287// Add a new progress bar in the lower right corner of the screen.
306288
=== modified file 'src/gui/StelDialog.cpp'
--- src/gui/StelDialog.cpp 2013-09-11 10:01:13 +0000
+++ src/gui/StelDialog.cpp 2013-10-17 06:10:44 +0000
@@ -48,13 +48,17 @@
4848
49 virtual bool event(QEvent* event)49 virtual bool event(QEvent* event)
50 {50 {
51 if (event->type()==QEvent::WindowDeactivate)51 switch (event->type())
52 {52 {
53 widget()->setWindowOpacity(0.4);53 case QEvent::WindowDeactivate:
54 }54 widget()->setWindowOpacity(0.4);
55 if (event->type()==QEvent::WindowActivate)55 break;
56 {56 case QEvent::WindowActivate:
57 widget()->setWindowOpacity(0.9);57 case QEvent::GrabMouse:
58 widget()->setWindowOpacity(0.9);
59 break;
60 default:
61 break;
58 }62 }
59 return QGraphicsProxyWidget::event(event);63 return QGraphicsProxyWidget::event(event);
60 }64 }
@@ -102,8 +106,10 @@
102 proxy->setFocus();106 proxy->setFocus();
103 return;107 return;
104 }108 }
105 109
110 QGraphicsWidget* parent = qobject_cast<QGraphicsWidget*>(this->parent());
106 dialog = new QDialog(NULL);111 dialog = new QDialog(NULL);
112 // dialog->setParent(parent);
107 StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());113 StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
108 Q_ASSERT(gui);114 Q_ASSERT(gui);
109 //dialog->setAttribute(Qt::WA_OpaquePaintEvent, true);115 //dialog->setAttribute(Qt::WA_OpaquePaintEvent, true);
@@ -111,7 +117,7 @@
111 createDialogContent();117 createDialogContent();
112 dialog->setStyleSheet(gui->getStelStyle().qtStyleSheet);118 dialog->setStyleSheet(gui->getStelStyle().qtStyleSheet);
113119
114 proxy = new CustomProxy(NULL, Qt::Tool);120 proxy = new CustomProxy(parent, Qt::Tool);
115 proxy->setWidget(dialog);121 proxy->setWidget(dialog);
116 QSizeF size = proxy->size();122 QSizeF size = proxy->size();
117123
@@ -122,7 +128,6 @@
122 if (newY <-0)128 if (newY <-0)
123 newY = 0;129 newY = 0;
124 proxy->setPos(newX, newY);130 proxy->setPos(newX, newY);
125 StelMainView::getInstance().scene()->addItem(proxy);
126 proxy->setWindowFrameMargins(2,0,2,2);131 proxy->setWindowFrameMargins(2,0,2,2);
127 // (this also changes the bounding rectangle size)132 // (this also changes the bounding rectangle size)
128133
129134
=== modified file 'src/gui/StelGui.cpp'
--- src/gui/StelGui.cpp 2013-09-29 17:32:30 +0000
+++ src/gui/StelGui.cpp 2013-10-17 06:10:44 +0000
@@ -154,13 +154,13 @@
154154
155 StelGuiBase::init(atopLevelGraphicsWidget);155 StelGuiBase::init(atopLevelGraphicsWidget);
156 skyGui = new SkyGui(atopLevelGraphicsWidget);156 skyGui = new SkyGui(atopLevelGraphicsWidget);
157 locationDialog = new LocationDialog();157 locationDialog = new LocationDialog(atopLevelGraphicsWidget);
158 helpDialog = new HelpDialog();158 helpDialog = new HelpDialog(atopLevelGraphicsWidget);
159 dateTimeDialog = new DateTimeDialog();159 dateTimeDialog = new DateTimeDialog(atopLevelGraphicsWidget);
160 searchDialog = new SearchDialog();160 searchDialog = new SearchDialog(atopLevelGraphicsWidget);
161 viewDialog = new ViewDialog();161 viewDialog = new ViewDialog(atopLevelGraphicsWidget);
162 shortcutsDialog = new ShortcutsDialog();162 shortcutsDialog = new ShortcutsDialog(atopLevelGraphicsWidget);
163 configurationDialog = new ConfigurationDialog(this);163 configurationDialog = new ConfigurationDialog(this, atopLevelGraphicsWidget);
164#ifdef ENABLE_SCRIPT_CONSOLE164#ifdef ENABLE_SCRIPT_CONSOLE
165 scriptConsole = new ScriptConsole();165 scriptConsole = new ScriptConsole();
166#endif166#endif
167167
=== modified file 'src/gui/StelGuiItems.cpp'
--- src/gui/StelGuiItems.cpp 2013-10-07 14:36:24 +0000
+++ src/gui/StelGuiItems.cpp 2013-10-17 06:10:44 +0000
@@ -72,18 +72,10 @@
72 Q_ASSERT(!pixOn.isNull());72 Q_ASSERT(!pixOn.isNull());
73 Q_ASSERT(!pixOff.isNull());73 Q_ASSERT(!pixOff.isNull());
7474
75 redMode = StelApp::getInstance().getVisionModeNight();
76 pixOnRed = StelButton::makeRed(pixOn);
77 pixOffRed = StelButton::makeRed(pixOff);
78 if (isTristate_)75 if (isTristate_)
79 {76 {
80 Q_ASSERT(!pixNoChange.isNull());77 Q_ASSERT(!pixNoChange.isNull());
81 pixNoChangeRed = StelButton::makeRed(pixNoChange);
82 }78 }
83 if (!pixHover.isNull())
84 pixHoverRed = StelButton::makeRed(pixHover);
85 if (!pixBackground.isNull())
86 pixBackgroundRed = StelButton::makeRed(pixBackground);
8779
88 setShapeMode(QGraphicsPixmapItem::BoundingRectShape);80 setShapeMode(QGraphicsPixmapItem::BoundingRectShape);
89 setAcceptHoverEvents(true);81 setAcceptHoverEvents(true);
@@ -197,15 +189,15 @@
197 QPainter painter(&pix);189 QPainter painter(&pix);
198 painter.setOpacity(opacity);190 painter.setOpacity(opacity);
199 if (!pixBackground.isNull() && noBckground==false)191 if (!pixBackground.isNull() && noBckground==false)
200 painter.drawPixmap(0, 0, redMode ? pixBackgroundRed : pixBackground);192 painter.drawPixmap(0, 0, pixBackground);
201 painter.drawPixmap(0, 0,193 painter.drawPixmap(0, 0,
202 (isTristate_ && checked == ButtonStateNoChange) ? (redMode ? pixNoChangeRed : pixNoChange) :194 (isTristate_ && checked == ButtonStateNoChange) ? (pixNoChange) :
203 (checked == ButtonStateOn) ? (redMode ? pixOnRed : pixOn) :195 (checked == ButtonStateOn) ? (pixOn) :
204 /* (checked == ButtonStateOff) ? */ (redMode ? pixOffRed : pixOff));196 /* (checked == ButtonStateOff) ? */ (pixOff));
205 if (hoverOpacity > 0)197 if (hoverOpacity > 0)
206 {198 {
207 painter.setOpacity(hoverOpacity * opacity);199 painter.setOpacity(hoverOpacity * opacity);
208 painter.drawPixmap(0, 0, redMode ? pixHoverRed : pixHover);200 painter.drawPixmap(0, 0, pixHover);
209 }201 }
210 setPixmap(pix);202 setPixmap(pix);
211}203}
@@ -225,28 +217,9 @@
225void StelButton::setBackgroundPixmap(const QPixmap &newBackground)217void StelButton::setBackgroundPixmap(const QPixmap &newBackground)
226{218{
227 pixBackground = newBackground;219 pixBackground = newBackground;
228 pixBackgroundRed = makeRed(newBackground);
229 updateIcon();220 updateIcon();
230}221}
231222
232QPixmap StelButton::makeRed(const QPixmap& p)
233{
234 QImage im = p.toImage().convertToFormat(QImage::Format_ARGB32);
235 Q_ASSERT(im.format()==QImage::Format_ARGB32);
236 QRgb* bits = (QRgb*)im.bits();
237 const QRgb* stop = bits+im.width()*im.height();
238 do
239 {
240 Vec3f col = StelUtils::getNightColor(Vec3f(qRed(*bits)/256.0, qGreen(*bits)/256.0, qBlue(*bits)/256.0));
241 *bits = qRgba((int)(256*col[0]), (int)(256*col[1]), (int)(256*col[2]), qAlpha(*bits));
242 ++bits;
243 }
244 while (bits!=stop);
245
246 return QPixmap::fromImage(im);
247}
248
249
250LeftStelBar::LeftStelBar(QGraphicsItem* parent) : QGraphicsItem(parent)223LeftStelBar::LeftStelBar(QGraphicsItem* parent) : QGraphicsItem(parent)
251{224{
252 // Create the help label225 // Create the help label
@@ -332,18 +305,6 @@
332 helpLabel->setBrush(c);305 helpLabel->setBrush(c);
333}306}
334307
335// Activate red mode for the buttons, i.e. will reduce the non red color component of the icon
336void LeftStelBar::setRedMode(bool b)
337{
338 foreach (QGraphicsItem *child, QGraphicsItem::childItems())
339 {
340 StelButton* bt = qgraphicsitem_cast<StelButton*>(child);
341 if (bt==0)
342 continue;
343 bt->setRedMode(b);
344 }
345}
346
347BottomStelBar::BottomStelBar(QGraphicsItem* parent,308BottomStelBar::BottomStelBar(QGraphicsItem* parent,
348 const QPixmap& pixLeft,309 const QPixmap& pixLeft,
349 const QPixmap& pixRight,310 const QPixmap& pixRight,
@@ -709,18 +670,6 @@
709 helpLabel->setBrush(c);670 helpLabel->setBrush(c);
710}671}
711672
712// Activate red mode for the buttons, i.e. will reduce the non red color component of the icon
713void BottomStelBar::setRedMode(bool b)
714{
715 foreach (QGraphicsItem *child, QGraphicsItem::childItems())
716 {
717 StelButton* bt = qgraphicsitem_cast<StelButton*>(child);
718 if (bt==0)
719 continue;
720 bt->setRedMode(b);
721 }
722}
723
724// Update the help label when a button is hovered673// Update the help label when a button is hovered
725void BottomStelBar::buttonHoverChanged(bool b)674void BottomStelBar::buttonHoverChanged(bool b)
726{675{
727676
=== modified file 'src/gui/StelGuiItems.hpp'
--- src/gui/StelGuiItems.hpp 2013-09-18 11:16:57 +0000
+++ src/gui/StelGuiItems.hpp 2013-10-17 06:10:44 +0000
@@ -108,17 +108,9 @@
108 //! Set the button opacity108 //! Set the button opacity
109 void setOpacity(double v) {opacity=v; updateIcon();}109 void setOpacity(double v) {opacity=v; updateIcon();}
110110
111 //! Activate red mode for this button, i.e. will reduce the non red color component of the icon
112 void setRedMode(bool b) {redMode=b; updateIcon();}
113
114 //! Set the background pixmap of the button.111 //! Set the background pixmap of the button.
115 //! A variant for night vision mode (pixBackgroundRed) is automatically
116 //! generated from the new background.
117 void setBackgroundPixmap(const QPixmap& newBackground);112 void setBackgroundPixmap(const QPixmap& newBackground);
118113
119 //! Transform the pixmap so that it look red for night vision mode
120 static QPixmap makeRed(const QPixmap& p);
121
122signals:114signals:
123 //! Triggered when the button state changes115 //! Triggered when the button state changes
124 void toggled(bool);116 void toggled(bool);
@@ -157,12 +149,6 @@
157 QPixmap pixHover;149 QPixmap pixHover;
158 QPixmap pixBackground;150 QPixmap pixBackground;
159151
160 QPixmap pixOnRed;
161 QPixmap pixOffRed;
162 QPixmap pixNoChangeRed;
163 QPixmap pixHoverRed;
164 QPixmap pixBackgroundRed;
165
166 int checked;152 int checked;
167153
168 QTimeLine* timeLine;154 QTimeLine* timeLine;
@@ -171,8 +157,6 @@
171 bool isTristate_;157 bool isTristate_;
172 double opacity;158 double opacity;
173 double hoverOpacity;159 double hoverOpacity;
174
175 bool redMode;
176};160};
177161
178// The button bar on the left containing windows toggle buttons162// The button bar on the left containing windows toggle buttons
@@ -189,8 +173,6 @@
189 QRectF boundingRectNoHelpLabel() const;173 QRectF boundingRectNoHelpLabel() const;
190 //! Set the color for all the sub elements174 //! Set the color for all the sub elements
191 void setColor(const QColor& c);175 void setColor(const QColor& c);
192 //! Activate red mode for the buttons, i.e. will reduce the non red color component of the icon
193 void setRedMode(bool b);
194private slots:176private slots:
195 //! Update the help label when a button is hovered177 //! Update the help label when a button is hovered
196 void buttonHoverChanged(bool b);178 void buttonHoverChanged(bool b);
@@ -230,9 +212,6 @@
230 //! Set the color for all the sub elements212 //! Set the color for all the sub elements
231 void setColor(const QColor& c);213 void setColor(const QColor& c);
232214
233 //! Activate red mode for the buttons, i.e. will reduce the non red color component of the icon
234 void setRedMode(bool b);
235
236 //! Set whether time must be displayed in the bottom bar215 //! Set whether time must be displayed in the bottom bar
237 void setFlagShowTime(bool b) {flagShowTime=b;}216 void setFlagShowTime(bool b) {flagShowTime=b;}
238 //! Set whether location info must be displayed in the bottom bar217 //! Set whether location info must be displayed in the bottom bar
239218
=== modified file 'src/gui/ViewDialog.cpp'
--- src/gui/ViewDialog.cpp 2013-09-27 03:25:58 +0000
+++ src/gui/ViewDialog.cpp 2013-10-17 06:10:44 +0000
@@ -53,7 +53,7 @@
53#include <QTimer>53#include <QTimer>
54#include <QDialog>54#include <QDialog>
5555
56ViewDialog::ViewDialog()56ViewDialog::ViewDialog(QObject* parent) : StelDialog(parent)
57{57{
58 ui = new Ui_viewDialogForm;58 ui = new Ui_viewDialogForm;
59 addRemoveLandscapesDialog = NULL;59 addRemoveLandscapesDialog = NULL;
@@ -92,25 +92,6 @@
92 }92 }
93}93}
9494
95void ViewDialog::updateIconsColor()
96{
97 QPixmap pixmap(50, 50);
98 QStringList icons;
99 icons << "sky" << "markings" << "landscape" << "starlore";
100 bool redIcon = false;
101 if (StelApp::getInstance().getVisionModeNight())
102 redIcon = true;
103
104 foreach(const QString &iconName, icons)
105 {
106 pixmap.load(":/graphicGui/tabicon-" + iconName +".png");
107 if (redIcon)
108 pixmap = StelButton::makeRed(pixmap);
109
110 ui->stackListWidget->item(icons.indexOf(iconName))->setIcon(QIcon(pixmap));
111 }
112}
113
114void ViewDialog::connectCheckBox(QCheckBox* checkBox, const QString& actionId)95void ViewDialog::connectCheckBox(QCheckBox* checkBox, const QString& actionId)
115{96{
116 StelAction* action = StelApp::getInstance().getStelActionManager()->findAction(actionId);97 StelAction* action = StelApp::getInstance().getStelActionManager()->findAction(actionId);
@@ -124,11 +105,9 @@
124{105{
125 ui->setupUi(dialog);106 ui->setupUi(dialog);
126 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));107 connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
127 connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(QString)), this, SLOT(updateIconsColor()));
128108
129 // Set the Sky tab activated by default109 // Set the Sky tab activated by default
130 ui->stackedWidget->setCurrentIndex(0);110 ui->stackedWidget->setCurrentIndex(0);
131 updateIconsColor();
132 ui->stackListWidget->setCurrentRow(0);111 ui->stackListWidget->setCurrentRow(0);
133112
134 //ui->viewTabWidget->removeTab(4);113 //ui->viewTabWidget->removeTab(4);
135114
=== modified file 'src/gui/ViewDialog.hpp'
--- src/gui/ViewDialog.hpp 2013-09-11 07:20:51 +0000
+++ src/gui/ViewDialog.hpp 2013-10-17 06:10:44 +0000
@@ -33,14 +33,13 @@
33{33{
34Q_OBJECT34Q_OBJECT
35public:35public:
36 ViewDialog();36 ViewDialog(QObject* parent);
37 virtual ~ViewDialog();37 virtual ~ViewDialog();
38 //! Notify that the application style changed38 //! Notify that the application style changed
39 void styleChanged();39 void styleChanged();
4040
41public slots:41public slots:
42 void retranslate();42 void retranslate();
43 void updateIconsColor();
4443
45protected:44protected:
46 Ui_viewDialogForm* ui;45 Ui_viewDialogForm* ui;