Move to Qt5 and Qt5Multimedia
This commit is contained in:
@@ -53,7 +53,8 @@ include_directories(
|
||||
${RADIO_SRC_DIRECTORY}/fonts/std
|
||||
)
|
||||
|
||||
qt4_wrap_ui(simulation_SRCS ${simulation_UIS})
|
||||
qt4_wrap_cpp(simulation_SRCS ${simulation_HDRS})
|
||||
qt5_wrap_ui(simulation_SRCS ${simulation_UIS})
|
||||
qt5_wrap_cpp(simulation_SRCS ${simulation_HDRS})
|
||||
|
||||
add_library(simulation ${simulation_SRCS})
|
||||
qt5_use_modules(simulation Widgets Xml)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtGui>
|
||||
#include <QStyleOption>
|
||||
|
||||
class ButtonsWidget : public QWidget
|
||||
{
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#include <QtGui>
|
||||
#include <stdint.h>
|
||||
#include "debugoutput.h"
|
||||
#include "ui_debugoutput.h"
|
||||
|
||||
@@ -18,7 +16,6 @@ DebugOutput::DebugOutput(QWidget * parent):
|
||||
QFont newFont("Courier", 9);
|
||||
ui->Output->setFont(newFont);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
DebugOutput::~DebugOutput()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#ifndef debugoutput_h
|
||||
#define debugoutput_h
|
||||
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtWidgets>
|
||||
#include "simulatorinterface.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
@@ -27,29 +27,31 @@ Joystick::~Joystick()
|
||||
|
||||
bool Joystick::open(int stick)
|
||||
{
|
||||
if ( isOpen() )
|
||||
if (isOpen())
|
||||
close();
|
||||
|
||||
joystick = SDL_JoystickOpen(stick);
|
||||
if ( joystick ) {
|
||||
if (joystick) {
|
||||
numAxes = SDL_JoystickNumAxes(joystick);
|
||||
numButtons = SDL_JoystickNumButtons(joystick);
|
||||
numHats = SDL_JoystickNumHats(joystick);
|
||||
numTrackballs = SDL_JoystickNumBalls(joystick);
|
||||
joystickTimer.start(eventTimeout);
|
||||
return TRUE;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "ERROR: couldn't open SDL joystick #%d", stick);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Joystick::close()
|
||||
{
|
||||
joystickTimer.stop();
|
||||
if ( joystick )
|
||||
if (joystick) {
|
||||
SDL_JoystickClose(joystick);
|
||||
joystick = NULL;
|
||||
joystick = NULL;
|
||||
}
|
||||
numAxes = numButtons = numHats = numTrackballs = 0;
|
||||
}
|
||||
|
||||
@@ -70,15 +72,19 @@ void Joystick::processEvents()
|
||||
emit axisValueChanged(i, moved);
|
||||
axes[i] = moved;
|
||||
axisRepeatTimers[i].restart();
|
||||
} else if (autoRepeat && moved != 0) {
|
||||
}
|
||||
else if (autoRepeat && moved != 0) {
|
||||
if ( axisRepeatTimers[i].elapsed() >= autoRepeatDelay ) {
|
||||
emit axisValueChanged(i, moved);
|
||||
axes[i] = moved;
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
axisRepeatTimers[i].restart();
|
||||
} else
|
||||
}
|
||||
else {
|
||||
emit axisValueChanged(i, 0);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < numButtons; i++) {
|
||||
Uint8 changed = SDL_JoystickGetButton(joystick, i);
|
||||
|
||||
@@ -31,7 +31,7 @@ class Joystick : public QObject
|
||||
|
||||
Joystick(QObject *parent = 0,
|
||||
int joystickEventTimeout = SDL_JOYSTICK_DEFAULT_EVENT_TIMEOUT,
|
||||
bool doAutoRepeat = TRUE,
|
||||
bool doAutoRepeat = true,
|
||||
int autoRepeatDelay = SDL_JOYSTICK_DEFAULT_AUTOREPEAT_DELAY);
|
||||
~Joystick();
|
||||
bool open(int);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "joystickdialog.h"
|
||||
#include "ui_joystickdialog.h"
|
||||
#include "appdata.h"
|
||||
#include <QtGui>
|
||||
|
||||
joystickDialog::joystickDialog(QWidget *parent, int stick) :
|
||||
QDialog(parent),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef JOYSTICKDIALOG_H
|
||||
#define JOYSTICKDIALOG_H
|
||||
|
||||
#include <QtWidgets>
|
||||
#include "joystick.h"
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class joystickDialog;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef SIMULATORDIALOG_H
|
||||
#define SIMULATORDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "modeledit/node.h"
|
||||
#include "telemetrysimu.h"
|
||||
#include "trainersimu.h"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QSlider>
|
||||
#include <QtGui>
|
||||
#include <QFrame>
|
||||
|
||||
class SliderWidget : public QSlider
|
||||
{
|
||||
|
||||
@@ -518,7 +518,7 @@ uint32_t TelemetrySimulator::GPSEmulator::getNextPacketData(uint32_t packetType)
|
||||
switch (packetType) {
|
||||
case GPS_LONG_LATI_FIRST_ID:
|
||||
sendLat = !sendLat;
|
||||
return sendLat ? encodeLatLon(lat, TRUE) : encodeLatLon(lon, FALSE);
|
||||
return sendLat ? encodeLatLon(lat, true) : encodeLatLon(lon, false);
|
||||
break;
|
||||
case GPS_TIME_DATE_FIRST_ID:
|
||||
sendDate = !sendDate;
|
||||
|
||||
Reference in New Issue
Block a user