pulsatingscience.cpp 3.81 KB
Newer Older
Oliver Bock's avatar
Oliver Bock committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/******************************************************************************
 *   Copyright (C) 2008 by Oliver Bock                                        *
 *   oliver.bock[AT]aei.mpg.de                                                *
 *                                                                            *
 *   This file is part of PulsatingScience.                                   *
 *                                                                            *
 *   PulsatingScience is free software: you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published        *
 *   by the Free Software Foundation, version 3 of the License.               *
 *                                                                            *
 *   PulsatingScience is distributed in the hope that it will be useful,      *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
 *   GNU General Public License for more details.                             *
 *                                                                            *
 *   You should have received a copy of the GNU General Public License        *
 *   along with PulsatingScience. If not, see <http://www.gnu.org/licenses/>. *
 *                                                                            *
 ******************************************************************************/

#include "pulsatingscience.h"

PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
{
	ui.setupUi(this);
26

Oliver Bock's avatar
Oliver Bock committed
27
28
29
30
	QAction* animControl = ui.dockAnimControl->toggleViewAction();
	animControl->setStatusTip("Toggle the animation control visibility");
	animControl->setShortcut(QKeySequence::fromString("Alt+A"));
	ui.menuView->addAction(animControl);
31
32
33
34
35
36
37
38
39
40

	connect(ui.actionRun, SIGNAL(activated()),
			ui.pulsarGlWidget, SLOT(runAnimation()));

	connect(ui.actionPause, SIGNAL(activated()),
				ui.pulsarGlWidget, SLOT(pauseAnimation()));

	connect(ui.actionStop, SIGNAL(activated()),
				ui.pulsarGlWidget, SLOT(stopAnimation()));

Oliver Bock's avatar
Oliver Bock committed
41
	on_sliderPulsarSpinFrequency_valueChanged(ui.sliderPulsarSpinFrequency->value());
42
43
	on_sliderPulsarSpinAxisInclination_valueChanged(ui.sliderPulsarSpinAxisInclination->value());
	on_sliderPulsarMagneticAxisInclination_valueChanged(ui.sliderPulsarMagneticAxisInclination->value());
Oliver Bock's avatar
Oliver Bock committed
44
45
	on_sliderOrbitRadius_valueChanged(ui.sliderOrbitRadius->value());
	on_sliderOrbitFrequency_valueChanged(ui.sliderOrbitFrequency->value());
Oliver Bock's avatar
Oliver Bock committed
46
47
48
49
50
51
}

PulsatingScience::~PulsatingScience()
{

}
52

Oliver Bock's avatar
Oliver Bock committed
53
void PulsatingScience::on_sliderPulsarSpinFrequency_valueChanged(int value)
54
{
Oliver Bock's avatar
Oliver Bock committed
55
	ui.pulsarGlWidget->setPulsarRotationDelta(value / 10.0);
Oliver Bock's avatar
Oliver Bock committed
56
57
58
	ui.lcdPulsarSpinFrequency->display(QString::number(value / 10.0, 'f', 1));
}

59
60
61
62
63
64
void PulsatingScience::on_sliderPulsarSpinAxisInclination_valueChanged(int value)
{
	ui.pulsarGlWidget->setPulsarSpinAxisInclination(value);
	ui.lcdPulsarSpinAxisInclination->display(QString::number(value));
}

65
66
67
68
69
70
void PulsatingScience::on_sliderPulsarMagneticAxisInclination_valueChanged(int value)
{
	ui.pulsarGlWidget->setPulsarMagneticAxisInclination(value);
	ui.lcdPulsarMagneticAxisInclination->display(QString::number(value));
}

Oliver Bock's avatar
Oliver Bock committed
71
72
73
74
75
76
77
78
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)
{
Oliver Bock's avatar
Oliver Bock committed
79
	ui.pulsarGlWidget->setOrbitRotationDelta(value / 10.0);
Oliver Bock's avatar
Oliver Bock committed
80
	ui.lcdOrbitFrequency->display(QString::number(value / 10.0, 'f', 1));
81
}
Oliver Bock's avatar
Oliver Bock committed
82
83
84
85
86
87
88
89
90
91

void PulsatingScience::on_actionMenu_bar_toggled(bool checked)
{
	checked ? ui.menuBar->show() : ui.menuBar->hide();
}

void PulsatingScience::on_actionStatus_bar_toggled(bool checked)
{
	checked ? ui.statusbar->show() : ui.statusbar->hide();
}