pulsatingscience.cpp 3.19 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
42
43
	on_sliderPulsarSpinFrequency_valueChanged(ui.sliderPulsarSpinFrequency->value());
	on_sliderOrbitRadius_valueChanged(ui.sliderOrbitRadius->value());
	on_sliderOrbitFrequency_valueChanged(ui.sliderOrbitFrequency->value());
Oliver Bock's avatar
Oliver Bock committed
44
45
46
47
48
49
}

PulsatingScience::~PulsatingScience()
{

}
50

Oliver Bock's avatar
Oliver Bock committed
51
void PulsatingScience::on_sliderPulsarSpinFrequency_valueChanged(int value)
52
53
{
	ui.pulsarGlWidget->setPulsarSpinFrequency(value / 10.0);
Oliver Bock's avatar
Oliver Bock committed
54
55
56
57
58
59
60
61
62
63
64
65
66
	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));
67
}
Oliver Bock's avatar
Oliver Bock committed
68
69
70
71
72
73
74
75
76
77

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();
}