]> git.defcon.no Git - joysticktest/commitdiff
Working test with Qt GUI. Threaded, with no thread safety. master
authorJon Langseth <jon.langseth@lilug.no>
Sat, 4 Dec 2010 20:20:12 +0000 (21:20 +0100)
committerJon Langseth <jon.langseth@lilug.no>
Sat, 4 Dec 2010 20:20:12 +0000 (21:20 +0100)
JoystickView.pro [new file with mode: 0644]
Makefile [new file with mode: 0644]
joystickdata.cpp [new file with mode: 0644]
joystickdata.h [new file with mode: 0644]
joystickthread.cpp [new file with mode: 0644]
joystickthread.h [new file with mode: 0644]
joystickview.cpp [new file with mode: 0644]
joystickview.h [new file with mode: 0644]
joystickview.png [new file with mode: 0644]
joystickview.ui [new file with mode: 0644]
main.cpp [new file with mode: 0644]

diff --git a/JoystickView.pro b/JoystickView.pro
new file mode 100644 (file)
index 0000000..de3dca8
--- /dev/null
@@ -0,0 +1,13 @@
+# -------------------------------------------------
+# Project created by QtCreator 2010-12-01T17:33:12
+# -------------------------------------------------
+TARGET = JoystickView
+TEMPLATE = app
+SOURCES += main.cpp \
+    joystickview.cpp \
+    joystickdata.cpp \
+    joystickthread.cpp
+HEADERS += joystickview.h \
+    joystickdata.h \
+    joystickthread.h
+FORMS += joystickview.ui
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..f6f7bfd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,236 @@
+#############################################################################
+# Makefile for building: JoystickView
+# Generated by qmake (2.01a) (Qt 4.5.0) on: Wed Dec 1 19:48:45 2010
+# Project:  JoystickView.pro
+# Template: app
+# Command: /opt/qtsdk-2009.01/qt/bin/qmake -spec /opt/qtsdk-2009.01/qt/mkspecs/linux-g++-64 -unix CONFIG+=debug -o Makefile JoystickView.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC            = gcc
+CXX           = g++
+DEFINES       = -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS        = -m64 -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS      = -m64 -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH       = -I/opt/qtsdk-2009.01/qt/mkspecs/linux-g++-64 -I. -I/opt/qtsdk-2009.01/qt/include/QtCore -I/opt/qtsdk-2009.01/qt/include/QtGui -I/opt/qtsdk-2009.01/qt/include -I. -I.
+LINK          = g++
+LFLAGS        = -m64 -Wl,-rpath,/opt/qtsdk-2009.01/qt/lib
+LIBS          = $(SUBLIBS)  -L/opt/qtsdk-2009.01/qt/lib -lQtGui -L/opt/qtsdk-2009.01/qt/lib -L/usr/X11R6/lib64 -pthread -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
+AR            = ar cqs
+RANLIB        = 
+QMAKE         = /opt/qtsdk-2009.01/qt/bin/qmake
+TAR           = tar -cf
+COMPRESS      = gzip -9f
+COPY          = cp -f
+SED           = sed
+COPY_FILE     = $(COPY)
+COPY_DIR      = $(COPY) -r
+INSTALL_FILE  = install -m 644 -p
+INSTALL_DIR   = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE      = rm -f
+SYMLINK       = ln -sf
+DEL_DIR       = rmdir
+MOVE          = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR         = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR   = ./
+
+####### Files
+
+SOURCES       = main.cpp \
+               joystickview.cpp \
+               joystickdata.cpp \
+               joystickthread.cpp moc_joystickview.cpp \
+               moc_joystickdata.cpp
+OBJECTS       = main.o \
+               joystickview.o \
+               joystickdata.o \
+               joystickthread.o \
+               moc_joystickview.o \
+               moc_joystickdata.o
+DIST          = /opt/qtsdk-2009.01/qt/mkspecs/common/g++.conf \
+               /opt/qtsdk-2009.01/qt/mkspecs/common/unix.conf \
+               /opt/qtsdk-2009.01/qt/mkspecs/common/linux.conf \
+               /opt/qtsdk-2009.01/qt/mkspecs/qconfig.pri \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/qt_functions.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/qt_config.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/exclusive_builds.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/default_pre.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/debug.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/default_post.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/warn_on.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/qt.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/unix/thread.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/moc.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/resources.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/uic.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/yacc.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/lex.prf \
+               JoystickView.pro
+QMAKE_TARGET  = JoystickView
+DESTDIR       = 
+TARGET        = JoystickView
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+       $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET): ui_joystickview.h $(OBJECTS)  
+       $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: JoystickView.pro  /opt/qtsdk-2009.01/qt/mkspecs/linux-g++-64/qmake.conf /opt/qtsdk-2009.01/qt/mkspecs/common/g++.conf \
+               /opt/qtsdk-2009.01/qt/mkspecs/common/unix.conf \
+               /opt/qtsdk-2009.01/qt/mkspecs/common/linux.conf \
+               /opt/qtsdk-2009.01/qt/mkspecs/qconfig.pri \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/qt_functions.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/qt_config.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/exclusive_builds.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/default_pre.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/debug.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/default_post.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/warn_on.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/qt.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/unix/thread.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/moc.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/resources.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/uic.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/yacc.prf \
+               /opt/qtsdk-2009.01/qt/mkspecs/features/lex.prf \
+               /opt/qtsdk-2009.01/qt/lib/libQtGui.prl \
+               /opt/qtsdk-2009.01/qt/lib/libQtCore.prl
+       $(QMAKE) -spec /opt/qtsdk-2009.01/qt/mkspecs/linux-g++-64 -unix CONFIG+=debug -o Makefile JoystickView.pro
+/opt/qtsdk-2009.01/qt/mkspecs/common/g++.conf:
+/opt/qtsdk-2009.01/qt/mkspecs/common/unix.conf:
+/opt/qtsdk-2009.01/qt/mkspecs/common/linux.conf:
+/opt/qtsdk-2009.01/qt/mkspecs/qconfig.pri:
+/opt/qtsdk-2009.01/qt/mkspecs/features/qt_functions.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/qt_config.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/exclusive_builds.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/default_pre.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/debug.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/default_post.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/warn_on.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/qt.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/unix/thread.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/moc.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/resources.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/uic.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/yacc.prf:
+/opt/qtsdk-2009.01/qt/mkspecs/features/lex.prf:
+/opt/qtsdk-2009.01/qt/lib/libQtGui.prl:
+/opt/qtsdk-2009.01/qt/lib/libQtCore.prl:
+qmake:  FORCE
+       @$(QMAKE) -spec /opt/qtsdk-2009.01/qt/mkspecs/linux-g++-64 -unix CONFIG+=debug -o Makefile JoystickView.pro
+
+dist: 
+       @$(CHK_DIR_EXISTS) .tmp/JoystickView1.0.0 || $(MKDIR) .tmp/JoystickView1.0.0 
+       $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/JoystickView1.0.0/ && $(COPY_FILE) --parents joystickview.h joystickdata.h joystickthread.h .tmp/JoystickView1.0.0/ && $(COPY_FILE) --parents main.cpp joystickview.cpp joystickdata.cpp joystickthread.cpp .tmp/JoystickView1.0.0/ && $(COPY_FILE) --parents joystickview.ui .tmp/JoystickView1.0.0/ && (cd `dirname .tmp/JoystickView1.0.0` && $(TAR) JoystickView1.0.0.tar JoystickView1.0.0 && $(COMPRESS) JoystickView1.0.0.tar) && $(MOVE) `dirname .tmp/JoystickView1.0.0`/JoystickView1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/JoystickView1.0.0
+
+
+clean:compiler_clean 
+       -$(DEL_FILE) $(OBJECTS)
+       -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+       -$(DEL_FILE) $(TARGET) 
+       -$(DEL_FILE) Makefile
+
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_joystickview.cpp moc_joystickdata.cpp
+compiler_moc_header_clean:
+       -$(DEL_FILE) moc_joystickview.cpp moc_joystickdata.cpp
+moc_joystickview.cpp: joystickdata.h \
+               joystickthread.h \
+               joystickview.h
+       /opt/qtsdk-2009.01/qt/bin/moc $(DEFINES) $(INCPATH) joystickview.h -o moc_joystickview.cpp
+
+moc_joystickdata.cpp: joystickdata.h
+       /opt/qtsdk-2009.01/qt/bin/moc $(DEFINES) $(INCPATH) joystickdata.h -o moc_joystickdata.cpp
+
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+       -$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all: ui_joystickview.h
+compiler_uic_clean:
+       -$(DEL_FILE) ui_joystickview.h
+ui_joystickview.h: joystickview.ui
+       /opt/qtsdk-2009.01/qt/bin/uic joystickview.ui -o ui_joystickview.h
+
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean compiler_uic_clean 
+
+####### Compile
+
+main.o: main.cpp joystickview.h \
+               joystickdata.h \
+               joystickthread.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
+
+joystickview.o: joystickview.cpp joystickview.h \
+               joystickdata.h \
+               joystickthread.h \
+               ui_joystickview.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o joystickview.o joystickview.cpp
+
+joystickdata.o: joystickdata.cpp joystickdata.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o joystickdata.o joystickdata.cpp
+
+joystickthread.o: joystickthread.cpp joystickthread.h \
+               joystickdata.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o joystickthread.o joystickthread.cpp
+
+moc_joystickview.o: moc_joystickview.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_joystickview.o moc_joystickview.cpp
+
+moc_joystickdata.o: moc_joystickdata.cpp 
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_joystickdata.o moc_joystickdata.cpp
+
+####### Install
+
+install:   FORCE
+
+uninstall:   FORCE
+
+FORCE:
+
diff --git a/joystickdata.cpp b/joystickdata.cpp
new file mode 100644 (file)
index 0000000..54d0c5b
--- /dev/null
@@ -0,0 +1,42 @@
+#include "joystickdata.h"
+
+JoystickData::JoystickData()
+{
+    for (int i = 0; i<6; i++)
+    {
+        this->setAxis(i, 512);
+    }
+    for (int i = 0; i<10; i++)
+    {
+        this->setButton(i, 0);
+    }
+
+}
+
+void JoystickData::setAxis( int axis, int value )
+{
+    if (( axis < 0) || (axis > 5))
+        return;
+    value = (value/64) + 512; // Conversion from +/-32768 to 0..1024
+    axis_values[axis] = value;
+    emit valuechanged();
+}
+void JoystickData::setButton( int button, bool value )
+{
+    if (( button < 0) || (button > 9))
+        return;
+    button_values[button] = value;
+    emit valuechanged();
+}
+int JoystickData::getAxis( int axis )
+{
+    if (( axis < 0) || (axis > 5))
+        return -1;
+    return axis_values[axis];
+}
+bool JoystickData::getButton( int button )
+{
+    if (( button < 0) || (button > 9))
+        return 0;
+    return button_values[button];
+}
diff --git a/joystickdata.h b/joystickdata.h
new file mode 100644 (file)
index 0000000..16de377
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef JOYSTICKDATA_H
+#define JOYSTICKDATA_H
+
+#include <QObject>
+
+class JoystickData : public QObject
+{
+    Q_OBJECT
+
+private:
+    int axis_values[6];
+    bool button_values[10];
+
+public:
+    JoystickData();
+    void setAxis( int axis, int value );
+    void setButton( int button, bool value );
+    int getAxis( int axis );
+    bool getButton( int button );
+
+signals:
+    void valuechanged( );
+};
+
+#endif // JOYSTICKDATA_H
diff --git a/joystickthread.cpp b/joystickthread.cpp
new file mode 100644 (file)
index 0000000..bfd87ca
--- /dev/null
@@ -0,0 +1,79 @@
+#include "joystickthread.h"
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+int JoystickThread::open_joystick(char *joystick_device)
+{
+        joystick_fd = open(joystick_device, O_RDONLY | O_NONBLOCK);
+
+        return joystick_fd;
+}
+int JoystickThread::read_joystick_event(struct js_event *jse)
+{
+        int bytes;
+
+        bytes = read(joystick_fd, jse, sizeof(*jse));
+
+        if (bytes == -1)
+                return 0;
+
+        if (bytes == sizeof(*jse))
+                return 1;
+
+        return -1;
+}
+
+JoystickThread::JoystickThread(JoystickData *data, QString device)
+{
+    this->device = device;
+    this->jd = data;
+    this->joystick_fd = -1;
+    this->done = 0;
+
+}
+
+void JoystickThread::run()
+{
+        int fd, rc;
+
+        struct js_event jse;
+        fd = open_joystick(this->device.toLatin1().data());
+        if (fd < 0) {
+                return;
+        }
+        while (!done) {
+                rc = read_joystick_event(&jse);
+                usleep(1000);
+                if (rc == 1) {
+                    if (jse.type == JS_EVENT_AXIS)
+                    {
+                        if ( jse.number <= 5)
+                        {
+                            jd->setAxis(jse.number, jse.value);
+                        }
+                    }
+                    if (jse.type == JS_EVENT_BUTTON)
+                    {
+                        if ( jse.number <= 9)
+                        {
+                            jd->setButton(jse.number, jse.value);
+                        }
+                    }
+                }
+        }
+        close(joystick_fd);
+        joystick_fd = -1;
+        done = 0;
+        return;
+}
+void JoystickThread::stop()
+{
+    this->done = 1;
+    this->wait();
+}
diff --git a/joystickthread.h b/joystickthread.h
new file mode 100644 (file)
index 0000000..ac89156
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef JOYSTICKTHREAD_H
+#define JOYSTICKTHREAD_H
+
+#include <QThread>
+#include "joystickdata.h"
+
+#define JS_EVENT_BUTTON         0x01    /* button pressed/released */
+#define JS_EVENT_AXIS           0x02    /* joystick moved */
+#define JS_EVENT_INIT           0x80    /* initial state of device */
+#define JS_EVENT_AXISENUM       0x81    /* enumeration of available axis */
+#define JS_EVENT_BUTTONENUM     0x81    /* enumeration of available buttons */
+
+struct js_event {
+        unsigned int time;    /* event timestamp in milliseconds */
+        short value;          /* value */
+        unsigned char type;   /* event type */
+        unsigned char number; /* axis/button number */
+};
+
+class JoystickThread : public QThread
+{
+private:
+    JoystickData *jd;
+    int open_joystick(char *joystick_device);
+    int read_joystick_event(struct js_event *jse);
+    
+    int done;   
+    int joystick_fd;
+    QString device;
+    
+public:
+    JoystickThread(JoystickData *jd, const QString device);
+     void run();
+     void stop();
+};
+
+#endif // JOYSTICKTHREAD_H
diff --git a/joystickview.cpp b/joystickview.cpp
new file mode 100644 (file)
index 0000000..c2db695
--- /dev/null
@@ -0,0 +1,73 @@
+#include "joystickview.h"
+#include "ui_joystickview.h"
+#include "joystickdata.h"
+#include "joystickthread.h"
+#include <QCheckBox>
+#include <QSlider>
+
+QSlider *sliders[6];
+QCheckBox *btns[10];
+
+JoystickView::JoystickView(QWidget *parent)
+    : QMainWindow(parent), ui(new Ui::JoystickView)
+{
+    this->jd = new JoystickData();
+    this->jthread = new JoystickThread(jd, "/dev/input/js0");
+
+    ui->setupUi(this);
+    ui->textbox->setPlainText("Starting");
+
+    QObject::connect(this, SIGNAL(forceupdate()), this, SLOT(updateValues()));
+    QObject::connect(jd, SIGNAL(valuechanged()), this, SLOT(updateValues()));
+    jthread->start();
+
+    sliders[0] = ui->axis1;
+    sliders[1] = ui->axis2;
+    sliders[2] = ui->axis3;
+    sliders[3] = ui->axis4;
+    sliders[4] = ui->axis5;
+    sliders[5] = ui->axis6;
+
+    btns[0] = ui->button1;
+    btns[1] = ui->button2;
+    btns[2] = ui->button3;
+    btns[3] = ui->button4;
+    btns[4] = ui->button5;
+    btns[5] = ui->button6;
+    btns[6] = ui->button7;
+    btns[7] = ui->button8;
+    btns[8] = ui->button9;
+    btns[9] = ui->button10;
+    this->update();
+}
+
+JoystickView::~JoystickView()
+{
+    delete ui;
+}
+
+void JoystickView::updateValues(void)
+{
+    QString output("");
+
+    output.append("Axis> ");
+    //ui->textbox->appendPlainText("Update\n");
+    for ( int i = 0; i < 6; i++ )
+    {
+        sliders[i]->setValue( jd->getAxis(i) );
+        output.append(QString::number(i) + ":" + QString::number(jd->getAxis(i)) + " " );
+    }
+    output.append("\nButtons>");
+    for ( int i = 0; i < 10; i++ )
+    {
+        btns[i]->setChecked( jd->getButton(i) );
+        output.append(QString::number(i) + ":" + QString::number(jd->getButton(i)) + " " );
+    }
+    ui->textbox->appendPlainText(output + "\n");
+}
+
+void JoystickView::on_pushButton_clicked()
+{
+    jthread->stop();
+    QApplication::quit();
+}
diff --git a/joystickview.h b/joystickview.h
new file mode 100644 (file)
index 0000000..206d15c
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef JOYSTICKVIEW_H
+#define JOYSTICKVIEW_H
+
+#include <QtGui/QMainWindow>
+#include "joystickdata.h"
+#include "joystickthread.h"
+
+namespace Ui
+{
+    class JoystickView;
+}
+
+class JoystickView : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    JoystickView(QWidget *parent = 0);
+    ~JoystickView();
+
+private:
+    Ui::JoystickView *ui;
+    JoystickData *jd;
+    JoystickThread *jthread;
+
+public slots:
+    void updateValues(void);
+private slots:
+    void on_pushButton_clicked();
+signals:
+    void forceupdate(void);
+};
+
+#endif // JOYSTICKVIEW_H
diff --git a/joystickview.png b/joystickview.png
new file mode 100644 (file)
index 0000000..aa168ca
Binary files /dev/null and b/joystickview.png differ
diff --git a/joystickview.ui b/joystickview.ui
new file mode 100644 (file)
index 0000000..e1efd42
--- /dev/null
@@ -0,0 +1,290 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>JoystickView</class>
+ <widget class="QMainWindow" name="JoystickView">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>521</width>
+    <height>507</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>JoystickView</string>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <widget class="QSlider" name="axis1">
+    <property name="geometry">
+     <rect>
+      <x>90</x>
+      <y>13</y>
+      <width>20</width>
+      <height>171</height>
+     </rect>
+    </property>
+    <property name="maximum">
+     <number>1024</number>
+    </property>
+    <property name="value">
+     <number>512</number>
+    </property>
+    <property name="orientation">
+     <enum>Qt::Vertical</enum>
+    </property>
+   </widget>
+   <widget class="QSlider" name="axis2">
+    <property name="geometry">
+     <rect>
+      <x>150</x>
+      <y>13</y>
+      <width>20</width>
+      <height>171</height>
+     </rect>
+    </property>
+    <property name="maximum">
+     <number>1024</number>
+    </property>
+    <property name="value">
+     <number>512</number>
+    </property>
+    <property name="orientation">
+     <enum>Qt::Vertical</enum>
+    </property>
+   </widget>
+   <widget class="QSlider" name="axis3">
+    <property name="geometry">
+     <rect>
+      <x>210</x>
+      <y>13</y>
+      <width>20</width>
+      <height>171</height>
+     </rect>
+    </property>
+    <property name="maximum">
+     <number>1024</number>
+    </property>
+    <property name="value">
+     <number>512</number>
+    </property>
+    <property name="orientation">
+     <enum>Qt::Vertical</enum>
+    </property>
+   </widget>
+   <widget class="QSlider" name="axis4">
+    <property name="geometry">
+     <rect>
+      <x>270</x>
+      <y>13</y>
+      <width>20</width>
+      <height>171</height>
+     </rect>
+    </property>
+    <property name="maximum">
+     <number>1024</number>
+    </property>
+    <property name="value">
+     <number>512</number>
+    </property>
+    <property name="orientation">
+     <enum>Qt::Vertical</enum>
+    </property>
+   </widget>
+   <widget class="QSlider" name="axis6">
+    <property name="geometry">
+     <rect>
+      <x>390</x>
+      <y>10</y>
+      <width>20</width>
+      <height>171</height>
+     </rect>
+    </property>
+    <property name="maximum">
+     <number>1024</number>
+    </property>
+    <property name="value">
+     <number>512</number>
+    </property>
+    <property name="orientation">
+     <enum>Qt::Vertical</enum>
+    </property>
+   </widget>
+   <widget class="QSlider" name="axis5">
+    <property name="geometry">
+     <rect>
+      <x>330</x>
+      <y>13</y>
+      <width>20</width>
+      <height>171</height>
+     </rect>
+    </property>
+    <property name="maximum">
+     <number>1024</number>
+    </property>
+    <property name="value">
+     <number>512</number>
+    </property>
+    <property name="orientation">
+     <enum>Qt::Vertical</enum>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="button1">
+    <property name="geometry">
+     <rect>
+      <x>150</x>
+      <y>190</y>
+      <width>16</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="button2">
+    <property name="geometry">
+     <rect>
+      <x>170</x>
+      <y>190</y>
+      <width>16</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="button3">
+    <property name="geometry">
+     <rect>
+      <x>190</x>
+      <y>190</y>
+      <width>16</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="button4">
+    <property name="geometry">
+     <rect>
+      <x>210</x>
+      <y>190</y>
+      <width>16</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="button5">
+    <property name="geometry">
+     <rect>
+      <x>230</x>
+      <y>190</y>
+      <width>16</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="button6">
+    <property name="geometry">
+     <rect>
+      <x>250</x>
+      <y>190</y>
+      <width>16</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="button7">
+    <property name="geometry">
+     <rect>
+      <x>270</x>
+      <y>190</y>
+      <width>16</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="button8">
+    <property name="geometry">
+     <rect>
+      <x>290</x>
+      <y>190</y>
+      <width>16</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="button9">
+    <property name="geometry">
+     <rect>
+      <x>310</x>
+      <y>190</y>
+      <width>16</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="button10">
+    <property name="geometry">
+     <rect>
+      <x>330</x>
+      <y>190</y>
+      <width>16</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QPlainTextEdit" name="textbox">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>220</y>
+      <width>441</width>
+      <height>271</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton">
+    <property name="geometry">
+     <rect>
+      <x>400</x>
+      <y>190</y>
+      <width>83</width>
+      <height>26</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>EXIT</string>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QStatusBar" name="statusBar"/>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/main.cpp b/main.cpp
new file mode 100644 (file)
index 0000000..a983708
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,10 @@
+#include <QtGui/QApplication>
+#include "joystickview.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    JoystickView w;
+    w.show();
+    return a.exec();
+}