Commit 96582290 authored by Oliver Bock's avatar Oliver Bock

Added orbit controls to GUI

parent 07513a3b
......@@ -39,7 +39,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
setPulsarSpinFrequency(0.5f);
m_pulsarRotationAngle = 0.0f;
setOrbitFrequency(0.25f);
setOrbitFrequency(0.2f);
setOrbitRadius(4.0f);
m_orbitRotationAngle = 0.0f;
}
......
......@@ -35,7 +35,9 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
connect(ui.actionStop, SIGNAL(activated()),
ui.pulsarGlWidget, SLOT(stopAnimation()));
on_sliderSpinFrequency_valueChanged(ui.sliderSpinFrequency->value());
on_sliderPulsarSpinFrequency_valueChanged(ui.sliderPulsarSpinFrequency->value());
on_sliderOrbitRadius_valueChanged(ui.sliderOrbitRadius->value());
on_sliderOrbitFrequency_valueChanged(ui.sliderOrbitFrequency->value());
}
PulsatingScience::~PulsatingScience()
......@@ -43,8 +45,20 @@ PulsatingScience::~PulsatingScience()
}
void PulsatingScience::on_sliderSpinFrequency_valueChanged(int value)
void PulsatingScience::on_sliderPulsarSpinFrequency_valueChanged(int value)
{
ui.pulsarGlWidget->setPulsarSpinFrequency(value / 10.0);
ui.lcdSpinFrequency->display(QString::number(value / 10.0, 'f', 1));
ui.lcdPulsarSpinFrequency->display(QString::number(value / 10.0, 'f', 1));
}
void PulsatingScience::on_sliderOrbitRadius_valueChanged(int value)
{
ui.pulsarGlWidget->setOrbitRadius(value);
ui.lcdOrbitRadius->display(QString::number(value, 'f', 1));
}
void PulsatingScience::on_sliderOrbitFrequency_valueChanged(int value)
{
ui.pulsarGlWidget->setOrbitFrequency(value / 10.0);
ui.lcdOrbitFrequency->display(QString::number(value / 10.0, 'f', 1));
}
......@@ -33,7 +33,9 @@ public:
~PulsatingScience();
public slots:
void on_sliderSpinFrequency_valueChanged(int value);
void on_sliderPulsarSpinFrequency_valueChanged(int value);
void on_sliderOrbitRadius_valueChanged(int value);
void on_sliderOrbitFrequency_valueChanged(int value);
private:
Ui::PulsatingScienceClass ui;
......
......@@ -35,18 +35,18 @@
<number>8</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents" >
<layout class="QGridLayout" name="gridLayout_2" >
<layout class="QGridLayout" name="gridLayout_3" >
<item row="0" column="0" >
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Spin Frequency:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="sliderSpinFrequency" >
<item row="0" column="1" >
<widget class="QSlider" name="sliderPulsarSpinFrequency" >
<property name="statusTip" >
<string>Use this slider to adjust the spin frequency</string>
</property>
......@@ -71,13 +71,16 @@
<property name="invertedControls" >
<bool>false</bool>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="lcdSpinFrequency" >
<property name="smallDecimalPoint" >
<bool>false</bool>
</property>
<item row="0" column="2" >
<widget class="QLCDNumber" name="lcdPulsarSpinFrequency" >
<property name="numDigits" >
<number>6</number>
</property>
......@@ -89,6 +92,93 @@
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Orbit Radius:</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Orbit Frequency:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QSlider" name="sliderOrbitRadius" >
<property name="minimum" >
<number>1</number>
</property>
<property name="maximum" >
<number>10</number>
</property>
<property name="pageStep" >
<number>2</number>
</property>
<property name="value" >
<number>4</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLCDNumber" name="lcdOrbitRadius" >
<property name="numDigits" >
<number>6</number>
</property>
<property name="segmentStyle" >
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0" >
<double>4.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QLCDNumber" name="lcdOrbitFrequency" >
<property name="numDigits" >
<number>6</number>
</property>
<property name="segmentStyle" >
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0" >
<double>0.200000000000000</double>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QSlider" name="sliderOrbitFrequency" >
<property name="minimum" >
<number>1</number>
</property>
<property name="maximum" >
<number>20</number>
</property>
<property name="value" >
<number>2</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval" >
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
......
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