chore: cleanup SDL2 definitions (#6467)
This commit is contained in:
@@ -24,9 +24,8 @@ set(${PROJECT_NAME}_NAMES
|
||||
simulateduiwidgetGeneric
|
||||
)
|
||||
|
||||
if(SDL2_FOUND)
|
||||
set(${PROJECT_NAME}_NAMES
|
||||
${${PROJECT_NAME}_NAMES}
|
||||
if(TARGET SDL2::SDL2)
|
||||
list(APPEND ${PROJECT_NAME}_NAMES
|
||||
joystick
|
||||
joystickdialog
|
||||
)
|
||||
@@ -61,6 +60,10 @@ target_link_libraries(${PROJECT_NAME}
|
||||
Qt::Svg
|
||||
)
|
||||
|
||||
if(TARGET SDL2::SDL2)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2)
|
||||
endif()
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "simulatorinterface.h"
|
||||
#include "telemetrysimu.h"
|
||||
#include "trainersimu.h"
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
#include "joystickdialog.h"
|
||||
#endif
|
||||
#include "serialportsdialog.h"
|
||||
@@ -128,7 +128,7 @@ SimulatorMainWindow::SimulatorMainWindow(QWidget *parent, const QString & simula
|
||||
ui->actionReloadLua->setDisabled(true);
|
||||
if(!m_simulator->getCapability(SimulatorInterface::CAP_TELEM_FRSKY_SPORT))
|
||||
m_telemetryDockWidget->toggleViewAction()->setDisabled(true);
|
||||
#ifndef JOYSTICKS
|
||||
#ifndef USE_SDL
|
||||
ui->actionJoystickSettings->setDisabled(true);
|
||||
#endif
|
||||
|
||||
@@ -482,7 +482,7 @@ void SimulatorMainWindow::toggleRadioDocked(bool dock)
|
||||
|
||||
void SimulatorMainWindow::openJoystickDialog(bool)
|
||||
{
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
joystickDialog * jd = new joystickDialog(this);
|
||||
if (jd->exec() == QDialog::Accepted && m_simulatorWidget)
|
||||
m_simulatorWidget->setupJoysticks();
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "simulateduiwidget.h"
|
||||
#include "storage.h"
|
||||
#include "virtualjoystickwidget.h"
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
#include "joystick.h"
|
||||
#include "joystickdialog.h"
|
||||
#endif
|
||||
@@ -126,7 +126,7 @@ SimulatorWidget::~SimulatorWidget()
|
||||
delete radioUiWidget;
|
||||
delete vJoyLeft;
|
||||
delete vJoyRight;
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
delete joystick;
|
||||
#endif
|
||||
firmware = nullptr;
|
||||
@@ -607,7 +607,7 @@ void SimulatorWidget::setupRadioWidgets()
|
||||
|
||||
void SimulatorWidget::setupJoysticks()
|
||||
{
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
bool joysticksEnabled = false;
|
||||
|
||||
if (g.jsSupport()) {
|
||||
@@ -806,7 +806,7 @@ void SimulatorWidget::onRadioWidgetValueChange(const RadioWidget::RadioWidgetTyp
|
||||
|
||||
void SimulatorWidget::onjoystickAxisValueChanged(int axis, int value)
|
||||
{
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
static const int ttlSticks = 4;
|
||||
const int ttlKnobs = Boards::getCapability(m_board, Board::Pots);
|
||||
const int ttlFaders = Boards::getCapability(m_board, Board::Sliders);
|
||||
@@ -855,7 +855,7 @@ void SimulatorWidget::onjoystickAxisValueChanged(int axis, int value)
|
||||
|
||||
void SimulatorWidget::onjoystickButtonValueChanged(int button, bool state)
|
||||
{
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
|
||||
if (!joystick || button >= MAX_JS_BUTTONS)
|
||||
return;
|
||||
|
||||
@@ -38,7 +38,7 @@ class Firmware;
|
||||
class SimulatorInterface;
|
||||
class SimulatedUIWidget;
|
||||
class VirtualJoystickWidget;
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
class Joystick;
|
||||
#endif
|
||||
|
||||
@@ -149,7 +149,7 @@ class SimulatorWidget : public QWidget
|
||||
bool deleteTempRadioData = false;
|
||||
bool saveTempRadioData = false;
|
||||
|
||||
#ifdef JOYSTICKS
|
||||
#ifdef USE_SDL
|
||||
Joystick * joystick = nullptr;
|
||||
int switchDirection[MAX_JS_BUTTONS];
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user