diff -r bb36d1770a9e -r 9cd86b92aabb src/SimulatorWindow.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/SimulatorWindow.cpp Thu Mar 14 00:23:34 2019 +0100
@@ -0,0 +1,93 @@
+/**
+ * Spacenav Simulator Qt
+ * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
+ *
+ * This program 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, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program. If not, see .
+ */
+
+#include
+#include
+#include
+#include
+
+#include "SimulatorWindow.h"
+
+SimulatorWindow::SimulatorWindow() {
+ resize(640, 480);
+ setWindowTitle("Spacenav Simulator");
+
+ QWidget* centralwidget = new QWidget(this);
+ QFormLayout* formLayout = new QFormLayout(centralwidget);
+
+ int f = 0;
+
+ formLayout->setWidget(f++, QFormLayout::LabelRole, new QLabel("Buttons:", centralwidget));
+ std::vector buttonLabels = {"0", "1"};
+
+ for (QString b : buttonLabels) {
+ QCheckBox* button = new QCheckBox(centralwidget);
+ buttons.push_back(button);
+ formLayout->setWidget(f, QFormLayout::LabelRole, new QLabel(b, centralwidget));
+ formLayout->setWidget(f++, QFormLayout::FieldRole, button);
+ }
+
+ std::vector axisLabels = {"X", "Y", "Z"};
+
+ formLayout->setWidget(f++, QFormLayout::LabelRole, new QLabel("Motion:", centralwidget));
+ for (QString a : axisLabels) {
+ QSlider* slider = createSlider(centralwidget);
+ motions.push_back(slider);
+ formLayout->setWidget(f, QFormLayout::LabelRole, new QLabel(a, centralwidget));
+ formLayout->setWidget(f++, QFormLayout::FieldRole, slider);
+ }
+
+
+ formLayout->setWidget(f++, QFormLayout::LabelRole, new QLabel("Rotation:", centralwidget));
+ for (QString a : axisLabels) {
+ QSlider* slider = createSlider(centralwidget);
+ rotations.push_back(slider);
+ formLayout->setWidget(f, QFormLayout::LabelRole, new QLabel(a, centralwidget));
+ formLayout->setWidget(f++, QFormLayout::FieldRole, slider);
+ }
+
+ formLayout->setWidget(f++, QFormLayout::LabelRole, new QLabel("Actions:", centralwidget));
+ centerButton = new QPushButton("Center all", centralwidget);
+ connect(centerButton, &QPushButton::clicked, this, &SimulatorWindow::centerAll);
+ formLayout->setWidget(f++, QFormLayout::FieldRole, centerButton);
+
+
+ setCentralWidget(centralwidget);
+}
+
+SimulatorWindow::SimulatorWindow(const SimulatorWindow& orig) {
+}
+
+SimulatorWindow::~SimulatorWindow() {
+}
+
+QSlider* SimulatorWindow::createSlider(QWidget* parent) {
+ QSlider* slider = new QSlider(Qt::Orientation::Horizontal, parent);
+ rotations.push_back(slider);
+ slider->setRange(-500, 500);
+ slider->setValue(0);
+ slider->setTickPosition(QSlider::TicksBelow);
+ slider->setTickInterval(100);
+ slider->setSingleStep(1);
+ return slider;
+}
+
+void SimulatorWindow::centerAll() {
+ for (QSlider* s : motions) s->setValue(0);
+ for (QSlider* s : rotations) s->setValue(0);
+}