Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
einsteinathome
pulsatingscience
Commits
1251c71c
Commit
1251c71c
authored
Sep 16, 2011
by
Oliver Bock
Browse files
Added menu bar option to toggle flash visibility
parent
2e189760
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
src/pulsaranimationwidget.cpp
View file @
1251c71c
...
...
@@ -96,6 +96,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
// initial view features
m_showOrbits
=
false
;
m_showRotationAxes
=
false
;
m_showPulseFlashes
=
true
;
m_cameraInteraction
=
false
;
// initial view settings
...
...
@@ -555,12 +556,14 @@ void PulsarAnimationWidget::paintGL()
renderText
(
10
,
10
,
-
100
,
QString
::
fromLocal8Bit
(
"Max-Planck-Insitut für Gravitationsphysik"
),
font
);
// render pulse "flash"
int
profileIndex
=
(
int
)
round
(
m_pulsarRotationAngle
);
profileIndex
=
profileIndex
==
360
?
0
:
profileIndex
;
GLfloat
flashAlpha
=
m_pulseProfile
[
profileIndex
];
glColor4f
(
1.0
,
1.0
,
0.0
,
0.75
*
flashAlpha
);
glTranslatef
(
0.0
,
0.0
,
-
1.0
);
glRectf
(
0.0
,
0.0
,
width
(),
height
());
if
(
m_showPulseFlashes
)
{
int
profileIndex
=
(
int
)
round
(
m_pulsarRotationAngle
);
profileIndex
=
profileIndex
==
360
?
0
:
profileIndex
;
GLfloat
flashAlpha
=
m_pulseProfile
[
profileIndex
];
glColor4f
(
1.0
,
1.0
,
0.0
,
0.75
*
flashAlpha
);
glTranslatef
(
0.0
,
0.0
,
-
1.0
);
glRectf
(
0.0
,
0.0
,
width
(),
height
());
}
// restore original state
glMatrixMode
(
GL_PROJECTION
);
...
...
@@ -621,6 +624,13 @@ void PulsarAnimationWidget::showRotationAxes(bool enabled)
updateGL
();
}
void
PulsarAnimationWidget
::
showPulseFlashes
(
bool
enabled
)
{
m_showPulseFlashes
=
enabled
;
updateGL
();
}
void
PulsarAnimationWidget
::
mousePressEvent
(
QMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
...
...
src/pulsaranimationwidget.h
View file @
1251c71c
...
...
@@ -57,6 +57,7 @@ public slots:
void
showOrbits
(
bool
enabled
);
void
showRotationAxes
(
bool
enabled
);
void
showPulseFlashes
(
bool
enabled
);
signals:
void
pulsarSemiMajorAxisUpdated
(
double
value
);
...
...
@@ -117,6 +118,7 @@ private:
bool
m_showOrbits
;
bool
m_showRotationAxes
;
bool
m_showPulseFlashes
;
bool
m_cameraInteraction
;
int
m_mouseLastX
;
...
...
src/pulsatingscience.cpp
View file @
1251c71c
...
...
@@ -42,6 +42,7 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
// inital status (based on GUI)
m_permanentOrbits
=
ui
.
actionPermanent_orbits
->
isChecked
();
m_rotationAxesVisible
=
ui
.
actionRotationAxes
->
isChecked
();
m_pulseFlashesVisible
=
ui
.
actionPulseFlashes
->
isChecked
();
m_menuBarVisible
=
ui
.
actionMenu_bar
->
isChecked
();
m_statusBarVisible
=
ui
.
actionStatus_bar
->
isChecked
();
m_animControlVisible
=
true
;
...
...
@@ -59,6 +60,8 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
m_permanentOrbitsShortcut
->
setEnabled
(
false
);
m_rotationAxesShortcut
=
new
QShortcut
(
ui
.
actionRotationAxes
->
shortcut
(),
this
);
m_rotationAxesShortcut
->
setEnabled
(
false
);
m_pulseFlashesShortcut
=
new
QShortcut
(
ui
.
actionPulseFlashes
->
shortcut
(),
this
);
m_pulseFlashesShortcut
->
setEnabled
(
false
);
m_menuBarShortcut
=
new
QShortcut
(
ui
.
actionMenu_bar
->
shortcut
(),
this
);
m_menuBarShortcut
->
setEnabled
(
false
);
m_fullscreenShortcut
=
new
QShortcut
(
ui
.
actionFullscreen
->
shortcut
(),
this
);
...
...
@@ -103,6 +106,9 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
connect
(
ui
.
actionRotationAxes
,
SIGNAL
(
toggled
(
bool
)),
ui
.
pulsarGlWidget
,
SLOT
(
showRotationAxes
(
bool
)));
connect
(
ui
.
actionPulseFlashes
,
SIGNAL
(
toggled
(
bool
)),
ui
.
pulsarGlWidget
,
SLOT
(
showPulseFlashes
(
bool
)));
connect
(
ui
.
pulsarGlWidget
,
SIGNAL
(
pulsarSemiMajorAxisUpdated
(
double
)),
this
,
SLOT
(
updatePulsarSemiMajorAxisValue
(
double
)));
...
...
@@ -153,6 +159,11 @@ PulsatingScience::~PulsatingScience()
delete
m_rotationAxesShortcut
;
}
if
(
m_pulseFlashesShortcut
)
{
m_pulseFlashesShortcut
->
disconnect
();
delete
m_pulseFlashesShortcut
;
}
if
(
m_menuBarShortcut
)
{
m_menuBarShortcut
->
disconnect
();
delete
m_menuBarShortcut
;
...
...
@@ -303,6 +314,21 @@ void PulsatingScience::on_actionRotationAxes_toggled(bool checked) {
m_rotationAxesVisible
=
checked
;
}
void
PulsatingScience
::
pulseFlashesToggled
()
{
if
(
m_pulseFlashesVisible
)
{
on_actionPulseFlashes_toggled
(
false
);
ui
.
actionPulseFlashes
->
setChecked
(
false
);
}
else
{
on_actionPulseFlashes_toggled
(
true
);
ui
.
actionPulseFlashes
->
setChecked
(
true
);
}
}
void
PulsatingScience
::
on_actionPulseFlashes_toggled
(
bool
checked
)
{
m_pulseFlashesVisible
=
checked
;
}
void
PulsatingScience
::
menuBarToggled
()
{
if
(
ui
.
menuBar
->
isVisible
())
{
...
...
@@ -333,6 +359,8 @@ void PulsatingScience::on_actionMenu_bar_toggled(bool checked)
m_permanentOrbitsShortcut
->
setEnabled
(
false
);
m_rotationAxesShortcut
->
disconnect
();
m_rotationAxesShortcut
->
setEnabled
(
false
);
m_pulseFlashesShortcut
->
disconnect
();
m_pulseFlashesShortcut
->
setEnabled
(
false
);
m_fullscreenShortcut
->
disconnect
();
m_fullscreenShortcut
->
setEnabled
(
false
);
m_menuBarShortcut
->
disconnect
();
...
...
@@ -353,6 +381,8 @@ void PulsatingScience::on_actionMenu_bar_toggled(bool checked)
connect
(
m_permanentOrbitsShortcut
,
SIGNAL
(
activated
()),
this
,
SLOT
(
permanentOrbitsToggled
()));
m_rotationAxesShortcut
->
setEnabled
(
true
);
connect
(
m_rotationAxesShortcut
,
SIGNAL
(
activated
()),
this
,
SLOT
(
rotationAxesToggled
()));
m_pulseFlashesShortcut
->
setEnabled
(
true
);
connect
(
m_pulseFlashesShortcut
,
SIGNAL
(
activated
()),
this
,
SLOT
(
pulseFlashesToggled
()));
m_fullscreenShortcut
->
setEnabled
(
true
);
connect
(
m_fullscreenShortcut
,
SIGNAL
(
activated
()),
this
,
SLOT
(
fullscreenToggled
()));
m_menuBarShortcut
->
setEnabled
(
true
);
...
...
src/pulsatingscience.h
View file @
1251c71c
...
...
@@ -60,6 +60,8 @@ public slots:
void
on_actionPermanent_orbits_toggled
(
bool
checked
);
void
rotationAxesToggled
();
void
on_actionRotationAxes_toggled
(
bool
checked
);
void
pulseFlashesToggled
();
void
on_actionPulseFlashes_toggled
(
bool
checked
);
void
fullscreenToggled
();
void
on_actionFullscreen_toggled
(
bool
checked
);
void
menuBarToggled
();
...
...
@@ -83,6 +85,7 @@ private:
QShortcut
*
m_stopShortcut
;
QShortcut
*
m_permanentOrbitsShortcut
;
QShortcut
*
m_rotationAxesShortcut
;
QShortcut
*
m_pulseFlashesShortcut
;
QShortcut
*
m_menuBarShortcut
;
QShortcut
*
m_fullscreenShortcut
;
QShortcut
*
m_fullscreenESCShortcut
;
...
...
@@ -90,6 +93,7 @@ private:
bool
m_permanentOrbits
;
bool
m_rotationAxesVisible
;
bool
m_pulseFlashesVisible
;
bool
m_menuBarVisible
;
bool
m_statusBarVisible
;
bool
m_animControlVisible
;
...
...
src/pulsatingscience.ui
View file @
1251c71c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment