src/SimulatorWindow.h
author František Kučera <franta-hg@frantovo.cz>
Thu, 14 Mar 2019 21:37:43 +0100
branchv_0
changeset 6 f81d43b74209
parent 4 a874deb6a536
child 10 da93f3667a52
permissions -rw-r--r--
Option: Periodic updates (each 20 ms)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Spacenav Simulator Qt
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, either version 3 of the License, or
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 * (at your option) any later version.
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 *
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 * GNU General Public License for more details.
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 *
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
 */
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
#pragma once
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include <vector>
4
a874deb6a536 tidy up includes
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    21
#include <QMainWindow>
a874deb6a536 tidy up includes
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    22
#include <QCheckBox>
a874deb6a536 tidy up includes
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    23
#include <QSlider>
a874deb6a536 tidy up includes
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    24
#include <QPushButton>
6
f81d43b74209 Option: Periodic updates (each 20 ms)
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    25
#include <QTimer>
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
2
a27850958a67 emit button and motion events
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    27
#include "MotionEvent.h"
a27850958a67 emit button and motion events
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    28
#include "ButtonEvent.h"
a27850958a67 emit button and motion events
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    29
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
class SimulatorWindow : public QMainWindow {
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
	Q_OBJECT
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
public:
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	SimulatorWindow();
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	SimulatorWindow(const SimulatorWindow& orig);
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
	virtual ~SimulatorWindow();
2
a27850958a67 emit button and motion events
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    36
signals:
3
42d64bd73232 connect slots, print events to stdout
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    37
	void motionEvent(MotionEvent e);
42d64bd73232 connect slots, print events to stdout
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    38
	void buttonEvent(ButtonEvent e);
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
private:
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	std::vector<QCheckBox*> buttons;
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
	std::vector<QSlider*> motions;
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
	std::vector<QSlider*> rotations;
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
	QPushButton* centerButton;
6
f81d43b74209 Option: Periodic updates (each 20 ms)
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    44
	QCheckBox* periodicButton;
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
	QSlider* createSlider(QWidget* parent);
6
f81d43b74209 Option: Periodic updates (each 20 ms)
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    46
	QTimer* timer;
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
private slots:
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
	void centerAll();
2
a27850958a67 emit button and motion events
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    50
	void sendMotionEvent();
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
};