src/spacenav-simulator-qt.cpp
author František Kučera <franta-hg@frantovo.cz>
Thu, 14 Mar 2019 16:46:16 +0100
branchv_0
changeset 3 42d64bd73232
parent 1 9cd86b92aabb
child 10 da93f3667a52
permissions -rw-r--r--
connect slots, print events to stdout
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Spacenav Simulator Qt
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
bb36d1770a9e empty QT project linked to spnav library
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
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, either version 3 of the License, or
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 * (at your option) any later version.
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 *
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 * GNU General Public License for more details.
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 *
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
 */
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
#include <stdio.h>
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include <QApplication>
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
#include <QThread>
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    23
#include "SimulatorWindow.h"
3
42d64bd73232 connect slots, print events to stdout
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    24
#include "SimulatorSocketServer.h"
0
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
int main(int argc, char**argv) {
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
	setlocale(LC_ALL, "");
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
	QApplication app(argc, argv);
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    30
	SimulatorWindow w;
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    31
	w.show();
3
42d64bd73232 connect slots, print events to stdout
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    32
	
42d64bd73232 connect slots, print events to stdout
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    33
	SimulatorSocketServer socketServer;
42d64bd73232 connect slots, print events to stdout
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    34
	
42d64bd73232 connect slots, print events to stdout
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    35
	QObject::connect(&w, &SimulatorWindow::motionEvent, &socketServer, &SimulatorSocketServer::publishMotionEvent);
42d64bd73232 connect slots, print events to stdout
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    36
	QObject::connect(&w, &SimulatorWindow::buttonEvent, &socketServer, &SimulatorSocketServer::publishButtonEvent);
1
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    37
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    38
	int qtResultCode = app.exec();
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    39
9cd86b92aabb GUI draft
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    40
	return qtResultCode;
0
bb36d1770a9e empty QT project linked to spnav library
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
}