Commit 02874e52 authored by Bryant's avatar Bryant

Mouse support now indicated by QGC_MOUSE_ENABLED_* macros.

parent e540ddb9
......@@ -419,12 +419,13 @@ contains(DEFINES, DISABLE_XBEE) {
#
contains(DEFINES, DISABLE_3DMOUSE) {
message("Skipping support for 3DConnexion mice (manual override)")
DEFINES -= DISABLE_3DMOUSE
} else:LinuxBuild {
exists(/usr/local/lib/libxdrvlib.so) {
message("Including support for 3DConnexion mice")
DEFINES +=
MOUSE_ENABLED_LINUX \
QGC_MOUSE_ENABLED_LINUX \
ParameterCheck # Hack: Has to be defined for magellan usage
HEADERS += src/input/Mouse6dofInput.h
......@@ -436,7 +437,7 @@ contains(DEFINES, DISABLE_3DMOUSE) {
} else:WindowsBuild {
message("Including support for 3DConnexion mice")
DEFINES += MOUSE_ENABLED_WIN
DEFINES += QGC_MOUSE_ENABLED_WIN
INCLUDEPATH += libs/thirdParty/3DMouse/win
......
......@@ -11,7 +11,7 @@
#include "UASManager.h"
#include "QMessageBox"
#ifdef MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_LINUX
#include <QX11Info>
#include <X11/Xlib.h>
#ifdef Success
......@@ -21,9 +21,9 @@ extern "C"
{
#include "xdrvlib.h"
}
#endif // MOUSE_ENABLED_LINUX
#endif // QGC_MOUSE_ENABLED_LINUX
#ifdef MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
Mouse6dofInput::Mouse6dofInput(Mouse3DInput* mouseInput) :
mouse3DMax(0.075), // TODO: check maximum value fot plugged device
uas(NULL),
......@@ -45,9 +45,9 @@ Mouse6dofInput::Mouse6dofInput(Mouse3DInput* mouseInput) :
//connect(mouseInput, SIGNAL(On3dmouseKeyUp(int)), this, SLOT(FUNCTION(int)));
}
#endif //MOUSE_ENABLED_WIN
#endif //QGC_MOUSE_ENABLED_WIN
#ifdef MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_LINUX
Mouse6dofInput::Mouse6dofInput(QWidget* parent) :
mouse3DMax(350.0), // TODO: check maximum value fot plugged device
uas(NULL),
......@@ -109,7 +109,7 @@ Mouse6dofInput::Mouse6dofInput(QWidget* parent) :
}
}
#endif //MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_LINUX
Mouse6dofInput::~Mouse6dofInput()
......@@ -191,7 +191,7 @@ void Mouse6dofInput::run()
}
}
#ifdef MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
void Mouse6dofInput::motion3DMouse(std::vector<float> &motionData)
{
if (motionData.size() < 6) return;
......@@ -220,9 +220,9 @@ void Mouse6dofInput::motion3DMouse(std::vector<float> &motionData)
//qDebug() << "NEW 3D MOUSE VALUES -- X" << xValue << " -- Y" << yValue << " -- Z" << zValue << " -- A" << aValue << " -- B" << bValue << " -- C" << cValue;
}
#endif //MOUSE_ENABLED_WIN
#endif //QGC_MOUSE_ENABLED_WIN
#ifdef MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
void Mouse6dofInput::button3DMouseDown(int button)
{
switch(button)
......@@ -245,9 +245,9 @@ void Mouse6dofInput::button3DMouseDown(int button)
break;
}
}
#endif //MOUSE_ENABLED_WIN
#endif //QGC_MOUSE_ENABLED_WIN
#ifdef MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_LINUX
void Mouse6dofInput::handleX11Event(XEvent *event)
{
//qDebug("XEvent occured...");
......@@ -327,4 +327,4 @@ void Mouse6dofInput::handleX11Event(XEvent *event)
}
}
}
#endif //MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_LINUX
......@@ -11,9 +11,9 @@
#include <QThread>
#ifdef MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
#include "Mouse3DInput.h"
#endif //MOUSE_ENABLED_WIN
#endif //QGC_MOUSE_ENABLED_WIN
#include "UASInterface.h"
......@@ -22,12 +22,12 @@ class Mouse6dofInput : public QThread
Q_OBJECT
public:
#ifdef MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
Mouse6dofInput(Mouse3DInput* mouseInput);
#endif //MOUSE_ENABLED_WIN
#ifdef MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_LINUX
Mouse6dofInput(QWidget* parent);
#endif //MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_LINUX
~Mouse6dofInput();
void run();
......@@ -78,16 +78,16 @@ signals:
public slots:
void setActiveUAS(UASInterface* uas);
#ifdef MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
/** @brief Get a motion input from 3DMouse */
void motion3DMouse(std::vector<float> &motionData);
/** @brief Get a button input from 3DMouse */
void button3DMouseDown(int button);
#endif //MOUSE_ENABLED_WIN
#ifdef MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_LINUX
/** @brief Get an XEvent to check it for an 3DMouse event (motion or button) */
void handleX11Event(XEvent* event);
#endif //MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_LINUX
};
......
......@@ -279,19 +279,19 @@ void MainWindow::init()
joystickWidget = 0;
joystick = new JoystickInput();
#ifdef MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
emit initStatusChanged(tr("Initializing 3D mouse interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
mouseInput = new Mouse3DInput(this);
mouse = new Mouse6dofInput(mouseInput);
#endif //MOUSE_ENABLED_WIN
#endif //QGC_MOUSE_ENABLED_WIN
#if MOUSE_ENABLED_LINUX
#if QGC_MOUSE_ENABLED_LINUX
emit initStatusChanged(tr("Initializing 3D mouse interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
mouse = new Mouse6dofInput(this);
connect(this, SIGNAL(x11EventOccured(XEvent*)), mouse, SLOT(handleX11Event(XEvent*)));
#endif //MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_LINUX
// Connect link
if (autoReconnect)
......@@ -2023,11 +2023,11 @@ bool MainWindow::dockWidgetTitleBarsEnabled() const
return menuActionHelper->dockWidgetTitleBarsEnabled();
}
#ifdef MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_LINUX
bool MainWindow::x11Event(XEvent *event)
{
emit x11EventOccured(event);
//qDebug("XEvent occured...");
return false;
}
#endif // MOUSE_ENABLED_LINUX
#endif // QGC_MOUSE_ENABLED_LINUX
......@@ -51,9 +51,9 @@ This file is part of the QGROUNDCONTROL project
#include "ObjectDetectionView.h"
#include "submainwindow.h"
#include "input/JoystickInput.h"
#if (defined MOUSE_ENABLED_WIN) | (defined MOUSE_ENABLED_LINUX)
#if (defined QGC_MOUSE_ENABLED_WIN) | (defined QGC_MOUSE_ENABLED_LINUX)
#include "Mouse6dofInput.h"
#endif // MOUSE_ENABLED_WIN
#endif // QGC_MOUSE_ENABLED_WIN
#include "DebugConsole.h"
#include "ParameterInterface.h"
#include "HDDisplay.h"
......@@ -303,10 +303,10 @@ signals:
/** Emitted when any value changes from any source */
void valueChanged(const int uasId, const QString& name, const QString& unit, const QVariant& value, const quint64 msec);
#ifdef MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_LINUX
/** @brief Forward X11Event to catch 3DMouse inputs */
void x11EventOccured(XEvent *event);
#endif //MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_LINUX
public:
QGCMAVLinkLogPlayer* getLogPlayer()
......@@ -465,17 +465,17 @@ protected:
JoystickInput* joystick;
#ifdef MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
/** @brief 3d Mouse support (WIN only) */
Mouse3DInput* mouseInput; ///< 3dConnexion 3dMouse SDK
Mouse6dofInput* mouse; ///< Implementation for 3dMouse input
#endif // MOUSE_ENABLED_WIN
#endif // QGC_MOUSE_ENABLED_WIN
#ifdef MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_LINUX
/** @brief Reimplementation of X11Event to handle 3dMouse Events (magellan) */
bool x11Event(XEvent *event);
Mouse6dofInput* mouse; ///< Implementation for 3dMouse input
#endif // MOUSE_ENABLED_LINUX
#endif // QGC_MOUSE_ENABLED_LINUX
/** User interface actions **/
QAction* connectUASAct;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment