Commit 9ae07431 authored by Oliver Bock's avatar Oliver Bock

GUI improvements

* Polished labels/units
* Added more status tips
* Added view option: Rotation Axes (instead of activation just during mouse interaction)
* Added Run/Pause/Stop button states
* Added preliminary About dialog
parent 6f28fe9a
......@@ -52,6 +52,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
resetParameters();
m_showRotationAxes = false;
m_cameraInteraction = false;
m_mouseLastX = 0;
m_mouseLastY = 0;
......@@ -190,7 +191,7 @@ void PulsarAnimationWidget::paintGL()
glRotatef(m_pulsarRotationAngle, 0.0f, 1.0f, 0.0f);
// draw spin axis
if(m_cameraInteraction) {
if(m_showRotationAxes) {
glPushMatrix();
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, translucent);
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
......@@ -231,7 +232,7 @@ void PulsarAnimationWidget::paintGL()
glRotatef(-m_pulsarMagneticAxisInclination, 1.0f, 0.0f, 0.0f);
// draw magnetic axis (for both cones)
if(m_cameraInteraction) {
if(m_showRotationAxes) {
glPushMatrix();
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, translucent);
glTranslatef(0.0f, 0.0f, -5.0f);
......@@ -308,6 +309,13 @@ void PulsarAnimationWidget::updateFrame()
updateGL();
}
void PulsarAnimationWidget::showRotationAxes(bool enabled)
{
m_showRotationAxes = enabled;
updateGL();
}
void PulsarAnimationWidget::mousePressEvent(QMouseEvent *event)
{
Q_UNUSED(event);
......
......@@ -44,7 +44,6 @@ public:
void setPulsarSpinAxisInclination(const int degrees);
void setPulsarMagneticAxisInclination(const int degrees);
public slots:
void runAnimation();
void pauseAnimation();
......@@ -52,6 +51,8 @@ public slots:
void updateFrame();
void showRotationAxes(bool enabled);
protected:
void initializeGL();
void resizeGL(int w, int h);
......@@ -90,6 +91,7 @@ protected:
int m_pulsarSpinAxisInclination;
int m_pulsarMagneticAxisInclination;
bool m_showRotationAxes;
bool m_cameraInteraction;
int m_mouseLastX;
int m_mouseLastY;
......
......@@ -38,6 +38,9 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
connect(ui.actionStop, SIGNAL(activated()),
ui.pulsarGlWidget, SLOT(stopAnimation()));
connect(ui.actionRotationAxes, SIGNAL(toggled(bool)),
ui.pulsarGlWidget, SLOT(showRotationAxes(bool)));
on_sliderPulsarSpinFrequency_valueChanged(ui.sliderPulsarSpinFrequency->value());
on_sliderPulsarSpinAxisInclination_valueChanged(ui.sliderPulsarSpinAxisInclination->value());
on_sliderPulsarMagneticAxisInclination_valueChanged(ui.sliderPulsarMagneticAxisInclination->value());
......@@ -50,6 +53,34 @@ PulsatingScience::~PulsatingScience()
}
void PulsatingScience::on_pushRun_clicked()
{
if(ui.pushRun->isEnabled()) {
ui.pushRun->setEnabled(false);
ui.pushPause->setEnabled(true);
ui.pushStop->setEnabled(true);
}
else {
ui.pushRun->setEnabled(true);
ui.pushPause->setEnabled(false);
ui.pushStop->setEnabled(false);
}
}
void PulsatingScience::on_pushPause_clicked()
{
ui.pushRun->setEnabled(true);
ui.pushPause->setEnabled(false);
ui.pushStop->setEnabled(true);
}
void PulsatingScience::on_pushStop_clicked()
{
ui.pushRun->setEnabled(true);
ui.pushPause->setEnabled(false);
ui.pushStop->setEnabled(false);
}
void PulsatingScience::on_sliderPulsarSpinFrequency_valueChanged(int value)
{
ui.pulsarGlWidget->setPulsarRotationDelta(value / 10.0);
......@@ -89,3 +120,13 @@ void PulsatingScience::on_actionStatus_bar_toggled(bool checked)
{
checked ? ui.statusbar->show() : ui.statusbar->hide();
}
void PulsatingScience::on_actionAbout_activated()
{
QMessageBox::about(this, "About",
"<b>Pulsating Science</b><br>"
"International Year of Astronomy 2009<br><br>"
"Authors: Oliver Bock, Benjamin Knispel<br><br>"
"Copyright &copy; 2009 "
"<a href=\"http://www.aei.mpg.de\">Max-Planck-Institut f&uuml;r Gravitationsphysik</a>");
}
......@@ -22,6 +22,8 @@
#define PULSATINGSCIENCE_H
#include <QtGui/QMainWindow>
#include <QtGui/QMessageBox>
#include "ui_pulsatingscience.h"
class PulsatingScience : public QMainWindow
......@@ -33,6 +35,10 @@ public:
~PulsatingScience();
public slots:
void on_pushRun_clicked();
void on_pushPause_clicked();
void on_pushStop_clicked();
void on_sliderPulsarSpinFrequency_valueChanged(int value);
void on_sliderPulsarSpinAxisInclination_valueChanged(int value);
void on_sliderPulsarMagneticAxisInclination_valueChanged(int value);
......@@ -41,6 +47,7 @@ public slots:
void on_actionMenu_bar_toggled(bool checked);
void on_actionStatus_bar_toggled(bool checked);
void on_actionAbout_activated();
private:
Ui::PulsatingScienceClass ui;
......
......@@ -5,12 +5,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<width>629</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle" >
<string>PulsatingScience</string>
<string>Pulsating Science</string>
</property>
<property name="windowIcon" >
<iconset resource="pulsatingscience.qrc" >
......@@ -108,6 +108,9 @@
</item>
<item row="3" column="1" >
<widget class="QSlider" name="sliderOrbitRadius" >
<property name="statusTip" >
<string>Use this slider to adjust the orbit radius of the binary system</string>
</property>
<property name="minimum" >
<number>1</number>
</property>
......@@ -159,6 +162,9 @@
</item>
<item row="4" column="1" >
<widget class="QSlider" name="sliderOrbitFrequency" >
<property name="statusTip" >
<string>Use this slider to adjust the orbit frequency of the binary system</string>
</property>
<property name="minimum" >
<number>0</number>
</property>
......@@ -182,19 +188,22 @@
<item row="1" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Spin Axis Incl.</string>
<string>Spin Axis Inclination:</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Mag. Axis Incl.</string>
<string>Magn. Axis Inclination:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QSlider" name="sliderPulsarSpinAxisInclination" >
<property name="statusTip" >
<string>Use this slider to adjust the inclination of the spin axis with respect to the orbit axis</string>
</property>
<property name="maximum" >
<number>180</number>
</property>
......@@ -224,6 +233,9 @@
</item>
<item row="2" column="1" >
<widget class="QSlider" name="sliderPulsarMagneticAxisInclination" >
<property name="statusTip" >
<string>Use this slider to adjust the inclination of the magnetic pole axis with respect to the spin axis</string>
</property>
<property name="maximum" >
<number>180</number>
</property>
......@@ -251,12 +263,43 @@
</property>
</widget>
</item>
<item row="1" column="3" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>deg</string>
</property>
</widget>
</item>
<item row="2" column="3" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>deg</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>Hz</string>
</property>
</widget>
</item>
<item row="4" column="3" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Hz</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" >
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QPushButton" name="pushRun" >
<property name="statusTip" >
<string>Run the animation</string>
</property>
<property name="text" >
<string>Run</string>
</property>
......@@ -268,6 +311,12 @@
</item>
<item>
<widget class="QPushButton" name="pushPause" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="statusTip" >
<string>Pause the animation</string>
</property>
<property name="text" >
<string>Pause</string>
</property>
......@@ -279,6 +328,12 @@
</item>
<item>
<widget class="QPushButton" name="pushStop" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="statusTip" >
<string>Stop the animation</string>
</property>
<property name="text" >
<string>Stop</string>
</property>
......@@ -288,6 +343,33 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushAbout" >
<property name="statusTip" >
<string>About Pulsating Science</string>
</property>
<property name="text" >
<string>About</string>
</property>
<property name="icon" >
<iconset resource="pulsatingscience.qrc" >
<normaloff>:/icons/resources/help-about.png</normaloff>:/icons/resources/help-about.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
......@@ -298,7 +380,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<width>629</width>
<height>31</height>
</rect>
</property>
......@@ -307,6 +389,8 @@
<string>&amp;View</string>
</property>
<addaction name="actionMenu_bar" />
<addaction name="actionRotationAxes" />
<addaction name="separator" />
<addaction name="actionStatus_bar" />
</widget>
<widget class="QMenu" name="menuHelp" >
......@@ -474,6 +558,17 @@
<string>Alt+S</string>
</property>
</action>
<action name="actionRotationAxes" >
<property name="checkable" >
<bool>true</bool>
</property>
<property name="text" >
<string>Rotation Axes</string>
</property>
<property name="shortcut" >
<string>Alt+R</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
......@@ -551,5 +646,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>pushAbout</sender>
<signal>clicked()</signal>
<receiver>actionAbout</receiver>
<slot>trigger()</slot>
<hints>
<hint type="sourcelabel" >
<x>47</x>
<y>551</y>
</hint>
<hint type="destinationlabel" >
<x>-1</x>
<y>-1</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment