diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 81fb6ee91..5743412e2 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -72,50 +72,9 @@ ELSE( ) LINK_DIRECTORIES( /usr/local/lib ) ENDIF( ) -INCLUDE_DIRECTORIES( ${XSD_INCLUDE_DIR} ) - -FIND_PACKAGE( Subversion ) -SET( C9X_WC_REVISION 0 ) -IF( Subversion_FOUND ) - # Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} C9X ) -ENDIF( ) - set(RADIO_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}/../../radio/src) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${RADIO_SRC_DIRECTORY}/../.. - ${RADIO_SRC_DIRECTORY} - ${RADIO_SRC_DIRECTORY}/fonts/std - ${RADIO_SRC_DIRECTORY}/lua/src -) - -set(TH9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/th9x) -add_custom_command( - OUTPUT ${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp - COMMAND ${CMAKE_COMMAND} -E make_directory ${TH9X_CHECKOUT_DIRECTORY} - COMMAND cd ${TH9X_CHECKOUT_DIRECTORY} && svn checkout http://th9x.googlecode.com/svn/trunk/src@285 . - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/th9x/th9xsimulator.cpp ${TH9X_CHECKOUT_DIRECTORY} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/th9x/th9xsimulator.cpp -) - -set(ER9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/er9x) -add_custom_command( - OUTPUT ${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp - COMMAND ${CMAKE_COMMAND} -E make_directory ${ER9X_CHECKOUT_DIRECTORY} - COMMAND cd ${ER9X_CHECKOUT_DIRECTORY} && svn checkout http://er9x.googlecode.com/svn/trunk/src@790 . - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/er9x/er9xsimulator.cpp ${ER9X_CHECKOUT_DIRECTORY} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/er9x/er9xsimulator.cpp -) - -set(ERSKY9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/ersky9x) -add_custom_command( - OUTPUT ${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp - COMMAND ${CMAKE_COMMAND} -E make_directory ${ERSKY9X_CHECKOUT_DIRECTORY} - COMMAND cd ${ERSKY9X_CHECKOUT_DIRECTORY} && svn checkout http://ersky9x.googlecode.com/svn/trunk/src@170 . - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp ${ERSKY9X_CHECKOUT_DIRECTORY} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp -) +set(SIMU_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}/simulator) +set(COMPANION_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}) add_custom_command( OUTPUT ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm @@ -124,7 +83,18 @@ add_custom_command( WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY} ) +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${PROJECT_SOURCE_DIR}/../.. + ${SIMU_SRC_DIRECTORY} + ${RADIO_SRC_DIRECTORY} + ${RADIO_SRC_DIRECTORY}/fonts/std + ${RADIO_SRC_DIRECTORY}/lua/src + ${XSD_INCLUDE_DIR} +) + add_subdirectory(modeledit) +add_subdirectory(simulator) SET( companion_SRCS eeprominterface.cpp @@ -135,10 +105,8 @@ SET( companion_SRCS ${PROJECT_BINARY_DIR}/radio.cxx firmwares/th9x/th9xeeprom.cpp firmwares/th9x/th9xinterface.cpp - ${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp firmwares/er9x/er9xeeprom.cpp firmwares/er9x/er9xinterface.cpp - ${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp firmwares/gruvin9x/gruvin9xeeprom.cpp firmwares/gruvin9x/gruvin9xinterface.cpp firmwares/opentx/opentxeeprom.cpp @@ -153,7 +121,6 @@ SET( companion_SRCS firmwares/opentx/opentxsimulator.cpp firmwares/ersky9x/ersky9xeeprom.cpp firmwares/ersky9x/ersky9xinterface.cpp - ${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm helpers.cpp mdichild.cpp @@ -172,8 +139,6 @@ SET( companion_SRCS fusesdialog.cpp logsdialog.cpp downloaddialog.cpp - simulatordialog.cpp - xsimulatordialog.cpp splashlibrary.cpp mainwindow.cpp main.cpp @@ -196,12 +161,6 @@ SET( companion_MOC_HDRS splashlabel.h burndialog.h downloaddialog.h - cursorwidget.h - menuwidget.h - simulatordialog.h - xcursorwidget.h - xmenuwidget.h - xsimulatordialog.h generaledit.h modelslist.h mdichild.h @@ -220,8 +179,6 @@ SET( companion_UIS logsdialog.ui apppreferencesdialog.ui fwpreferencesdialog.ui - simulatordialog.ui - xsimulatordialog.ui burnconfigdialog.ui downloaddialog.ui generaledit.ui @@ -233,25 +190,6 @@ SET( companion_UIS modelconfigdialog.ui ) -IF ( SDL_FOUND ) - SET( companion_SRCS - ${companion_SRCS} - joystick.cpp - joystickdialog.cpp - ) - - SET( companion_MOC_HDRS - ${companion_MOC_HDRS} - joystick.h - joystickdialog.h - ) - - SET( companion_UIS - ${companion_UIS} - joystickdialog.ui - ) -ENDIF( ) - SET( companion_RCS companion.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc @@ -322,7 +260,7 @@ ELSE( ) ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${companion_SRCS} ${companion_QM} ) ENDIF( ) -TARGET_LINK_LIBRARIES( ${PROJECT_NAME} modeledit ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ) +TARGET_LINK_LIBRARIES( ${PROJECT_NAME} modeledit simulation ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ) IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") INSTALL( TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index c687f7563..36f1b27cc 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -992,13 +992,13 @@ void RegisterEepromInterfaces() { QSettings settings; int rev4a = settings.value("rev4asupport",0).toInt(); - eepromInterfaces.push_back(new Open9xInterface(BOARD_STOCK)); - eepromInterfaces.push_back(new Open9xInterface(BOARD_M128)); - eepromInterfaces.push_back(new Open9xInterface(BOARD_GRUVIN9X)); - eepromInterfaces.push_back(new Open9xInterface(BOARD_SKY9X)); - eepromInterfaces.push_back(new Open9xInterface(BOARD_TARANIS)); + eepromInterfaces.push_back(new OpenTxInterface(BOARD_STOCK)); + eepromInterfaces.push_back(new OpenTxInterface(BOARD_M128)); + eepromInterfaces.push_back(new OpenTxInterface(BOARD_GRUVIN9X)); + eepromInterfaces.push_back(new OpenTxInterface(BOARD_SKY9X)); + eepromInterfaces.push_back(new OpenTxInterface(BOARD_TARANIS)); if (rev4a) - eepromInterfaces.push_back(new Open9xInterface(BOARD_TARANIS_REV4a)); + eepromInterfaces.push_back(new OpenTxInterface(BOARD_TARANIS_REV4a)); eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_STOCK)); eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X)); eepromInterfaces.push_back(new Ersky9xInterface()); @@ -1010,26 +1010,11 @@ QList firmwares; FirmwareVariant default_firmware_variant; FirmwareVariant current_firmware_variant; -const char * ER9X_STAMP = "http://er9x.googlecode.com/svn/trunk/src/stamp-er9x.h"; -const char * ERSKY9X_STAMP = "http://ersky9x.googlecode.com/svn/trunk/src/stamp-ersky9x.h"; - void RegisterFirmwares() { - firmwares.push_back(new FirmwareInfo("th9x", QObject::tr("th9x"), new Th9xInterface(), "http://th9x.googlecode.com/svn/trunk/%1.bin", "http://th9x.googlecode.com/svn/trunk/src/stamp-th9x.h")); - - firmwares.push_back(new FirmwareInfo("er9x", QObject::tr("er9x"), new Er9xInterface(), "http://er9x.googlecode.com/svn/trunk/%1.hex", ER9X_STAMP)); - FirmwareInfo * er9x = firmwares.last(); - - Option er9x_options[] = { { "noht", "", 0 }, { "frsky", "", 0 }, { "frsky-noht", "", 0 }, { "jeti", "", 0 }, { "ardupilot", "", 0 }, { "nmea", "", 0 }, { NULL } }; - er9x->addOptions(er9x_options); - er9x->addOption("noht"); - RegisterOpen9xFirmwares(); -#ifndef __APPLE__ - firmwares.push_back(new FirmwareInfo("ersky9x", QObject::tr("ersky9x"), new Ersky9xInterface(), "http://ersky9x.googlecode.com/svn/trunk/ersky9x_rom.bin", ERSKY9X_STAMP)); -#endif default_firmware_variant = GetFirmwareVariant("opentx-9x-heli-templates-en"); - + current_firmware_variant = default_firmware_variant; RegisterEepromInterfaces(); } @@ -1070,7 +1055,6 @@ FirmwareVariant GetFirmwareVariant(QString id) FirmwareVariant result; foreach(FirmwareInfo * firmware, firmwares) { - if (id.contains(firmware->id+"-") || (!id.contains("-") && id.contains(firmware->id))) { result.id = id; result.firmware = firmware; diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 60f99b41a..b9c863ea4 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -950,7 +950,6 @@ enum Capability { FlightPhases, FlightModesName, FlightPhasesHaveFades, - SimulatorType, Mixes, MixesWithoutExpo, Timers, @@ -1059,15 +1058,8 @@ enum Capability { HasFasOffset, HasMahPersistent, MultiposPots, - MultiposPotsPositions -}; - -enum UseContext { - DefaultContext, - TimerContext, - FlightPhaseContext, - MixerContext, - ExpoContext, + MultiposPotsPositions, + SimulatorVariant, }; class SimulatorInterface; @@ -1102,7 +1094,7 @@ class EEPROMInterface virtual int isAvailable(Protocol proto, int port=0) = 0; - virtual SimulatorInterface * getSimulator() = 0; + virtual SimulatorInterface * getSimulator() { return NULL; } virtual const int getEEpromSize() = 0; diff --git a/companion/src/firmwares/er9x/er9xinterface.cpp b/companion/src/firmwares/er9x/er9xinterface.cpp index d28b472b2..90df5e51b 100644 --- a/companion/src/firmwares/er9x/er9xinterface.cpp +++ b/companion/src/firmwares/er9x/er9xinterface.cpp @@ -303,7 +303,7 @@ int Er9xInterface::isAvailable(Protocol prot, int port) SimulatorInterface * Er9xInterface::getSimulator() { - return new Er9xSimulator(this); + return NULL; // new Er9xSimulator(this); } diff --git a/companion/src/firmwares/ersky9x/ersky9xinterface.cpp b/companion/src/firmwares/ersky9x/ersky9xinterface.cpp index dd65c0c92..97ed8fd5b 100644 --- a/companion/src/firmwares/ersky9x/ersky9xinterface.cpp +++ b/companion/src/firmwares/ersky9x/ersky9xinterface.cpp @@ -343,7 +343,7 @@ int Ersky9xInterface::isAvailable(Protocol prot, int port) SimulatorInterface * Ersky9xInterface::getSimulator() { - return new Ersky9xSimulator(this); + return NULL; // new Ersky9xSimulator(this); } diff --git a/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp index 0d2f07771..fb101b359 100644 --- a/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp @@ -105,7 +105,7 @@ uint8_t getStickMode() using namespace Open9xGruvin9x; -Open9xGruvin9xSimulator::Open9xGruvin9xSimulator(Open9xInterface * open9xInterface): +Open9xGruvin9xSimulator::Open9xGruvin9xSimulator(OpenTxInterface * open9xInterface): open9xInterface(open9xInterface) { } @@ -128,15 +128,23 @@ bool Open9xGruvin9xSimulator::lcdChanged(bool & lightEnable) #include "simulatorimport.h" } -void Open9xGruvin9xSimulator::start(RadioData &radioData, bool tests) +void Open9xGruvin9xSimulator::start(QByteArray & eeprom, bool tests) { g_rotenc[0] = 0; g_rotenc[1] = 0; - open9xInterface->save(&eeprom[0], radioData, SIMU_GRUVIN9X_VARIANTS); + memcpy(Open9xGruvin9x::eeprom, eeprom.data(), std::min(sizeof(Open9xGruvin9x::eeprom), eeprom.size())); StartEepromThread(NULL); StartMainThread(tests); } +void Open9xGruvin9xSimulator::start(const char * filename, bool tests) +{ + g_rotenc[0] = 0; + g_rotenc[1] = 0; + StartEepromThread(filename); + StartMainThread(tests); +} + void Open9xGruvin9xSimulator::stop() { StopMainThread(); diff --git a/companion/src/firmwares/opentx/opentxGruvin9xsimulator.h b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.h index 8216c7a04..6fb3e320a 100644 --- a/companion/src/firmwares/opentx/opentxGruvin9xsimulator.h +++ b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.h @@ -20,15 +20,17 @@ #include "simulatorinterface.h" class RadioData; -class Open9xInterface; +class OpenTxInterface; class Open9xGruvin9xSimulator : public SimulatorInterface { public: - Open9xGruvin9xSimulator(Open9xInterface *); + Open9xGruvin9xSimulator(OpenTxInterface *); - virtual void start(RadioData & radioData, bool tests); + virtual void start(QByteArray & eeprom, bool tests=true); + + virtual void start(const char * filename, bool tests=true); virtual void stop(); @@ -54,7 +56,7 @@ class Open9xGruvin9xSimulator : public SimulatorInterface { protected: - Open9xInterface * open9xInterface; + OpenTxInterface * open9xInterface; }; #endif diff --git a/companion/src/firmwares/opentx/opentxM128simulator.cpp b/companion/src/firmwares/opentx/opentxM128simulator.cpp index f169a10d3..a03045c2d 100644 --- a/companion/src/firmwares/opentx/opentxM128simulator.cpp +++ b/companion/src/firmwares/opentx/opentxM128simulator.cpp @@ -103,7 +103,7 @@ uint8_t getStickMode() using namespace Open9xM128; -Open9xM128Simulator::Open9xM128Simulator(Open9xInterface * open9xInterface): +Open9xM128Simulator::Open9xM128Simulator(OpenTxInterface * open9xInterface): open9xInterface(open9xInterface) { } @@ -126,13 +126,19 @@ bool Open9xM128Simulator::lcdChanged(bool & lightEnable) #include "simulatorimport.h" } -void Open9xM128Simulator::start(RadioData &radioData, bool tests) +void Open9xM128Simulator::start(QByteArray & eeprom, bool tests) { - open9xInterface->save(&eeprom[0], radioData, SIMU_M128_VARIANTS); + memcpy(Open9xM128::eeprom, eeprom.data(), std::min(sizeof(Open9xM128::eeprom), eeprom.size())); StartEepromThread(NULL); StartMainThread(tests); } +void Open9xM128Simulator::start(const char * filename, bool tests) +{ + StartEepromThread(filename); + StartMainThread(tests); +} + void Open9xM128Simulator::stop() { StopMainThread(); diff --git a/companion/src/firmwares/opentx/opentxM128simulator.h b/companion/src/firmwares/opentx/opentxM128simulator.h index dc43edc5f..862c7ada9 100644 --- a/companion/src/firmwares/opentx/opentxM128simulator.h +++ b/companion/src/firmwares/opentx/opentxM128simulator.h @@ -20,15 +20,17 @@ #include "simulatorinterface.h" class RadioData; -class Open9xInterface; +class OpenTxInterface; class Open9xM128Simulator : public SimulatorInterface { public: - Open9xM128Simulator(Open9xInterface *); + Open9xM128Simulator(OpenTxInterface *); - virtual void start(RadioData & radioData, bool tests); + virtual void start(QByteArray & eeprom, bool tests=true); + + virtual void start(const char * filename, bool tests=true); virtual void stop(); @@ -54,7 +56,7 @@ class Open9xM128Simulator : public SimulatorInterface { protected: - Open9xInterface * open9xInterface; + OpenTxInterface * open9xInterface; }; #endif diff --git a/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp index b9f5f294e..dbe13b6d8 100644 --- a/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp @@ -132,7 +132,7 @@ uint8_t getStickMode() using namespace Open9xSky9x; -Open9xSky9xSimulator::Open9xSky9xSimulator(Open9xInterface * open9xInterface): +Open9xSky9xSimulator::Open9xSky9xSimulator(OpenTxInterface * open9xInterface): open9xInterface(open9xInterface) { QSettings settings; @@ -162,14 +162,21 @@ bool Open9xSky9xSimulator::lcdChanged(bool & lightEnable) #include "simulatorimport.h" } -void Open9xSky9xSimulator::start(RadioData &radioData, bool tests) +void Open9xSky9xSimulator::start(QByteArray & eeprom, bool tests) { g_rotenc[0] = 0; - open9xInterface->save(&eeprom[0], radioData); + memcpy(Open9xSky9x::eeprom, eeprom.data(), std::min(sizeof(Open9xSky9x::eeprom), eeprom.size())); StartEepromThread(NULL); StartMainThread(tests); } +void Open9xSky9xSimulator::start(const char * filename, bool tests) +{ + g_rotenc[0] = 0; + StartEepromThread(filename); + StartMainThread(tests); +} + void Open9xSky9xSimulator::stop() { StopMainThread(); diff --git a/companion/src/firmwares/opentx/opentxSky9xsimulator.h b/companion/src/firmwares/opentx/opentxSky9xsimulator.h index 95463fbab..0489fea1d 100644 --- a/companion/src/firmwares/opentx/opentxSky9xsimulator.h +++ b/companion/src/firmwares/opentx/opentxSky9xsimulator.h @@ -20,15 +20,17 @@ #include "simulatorinterface.h" class RadioData; -class Open9xInterface; +class OpenTxInterface; class Open9xSky9xSimulator : public SimulatorInterface { public: - Open9xSky9xSimulator(Open9xInterface *); + Open9xSky9xSimulator(OpenTxInterface *); - virtual void start(RadioData & radioData, bool tests); + virtual void start(QByteArray & eeprom, bool tests=true); + + virtual void start(const char * filename, bool tests=true); virtual void stop(); @@ -54,7 +56,7 @@ class Open9xSky9xSimulator : public SimulatorInterface { protected: - Open9xInterface * open9xInterface; + OpenTxInterface * open9xInterface; }; #endif diff --git a/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp b/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp index 266dd8c7f..4ce1bed6e 100644 --- a/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp +++ b/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp @@ -177,7 +177,7 @@ void resetTrims() using namespace Open9xX9D; -OpentxTaranisSimulator::OpentxTaranisSimulator(Open9xInterface * open9xInterface): +OpentxTaranisSimulator::OpentxTaranisSimulator(OpenTxInterface * open9xInterface): open9xInterface(open9xInterface) { taranisSimulatorBoard = GetEepromInterface()->getBoard(); @@ -208,13 +208,19 @@ bool OpentxTaranisSimulator::lcdChanged(bool & lightEnable) #include "simulatorimport.h" } -void OpentxTaranisSimulator::start(RadioData &radioData, bool tests) +void OpentxTaranisSimulator::start(QByteArray & eeprom, bool tests) { - open9xInterface->save(Open9xX9D::eeprom, radioData); + memcpy(Open9xX9D::eeprom, eeprom.data(), std::min(sizeof(Open9xX9D::eeprom), eeprom.size())); StartEepromThread(NULL); StartMainThread(tests); } +void OpentxTaranisSimulator::start(const char * filename, bool tests) +{ + StartEepromThread(filename); + StartMainThread(tests); +} + void OpentxTaranisSimulator::stop() { StopMainThread(); diff --git a/companion/src/firmwares/opentx/opentxTaranisSimulator.h b/companion/src/firmwares/opentx/opentxTaranisSimulator.h index c14f9c16c..bd2da1d2a 100644 --- a/companion/src/firmwares/opentx/opentxTaranisSimulator.h +++ b/companion/src/firmwares/opentx/opentxTaranisSimulator.h @@ -20,15 +20,17 @@ #include "simulatorinterface.h" class RadioData; -class Open9xInterface; +class OpenTxInterface; class OpentxTaranisSimulator : public SimulatorInterface { public: - OpentxTaranisSimulator(Open9xInterface *); + OpentxTaranisSimulator(OpenTxInterface *); - virtual void start(RadioData & radioData, bool tests); + virtual void start(QByteArray & eeprom, bool tests=true); + + virtual void start(const char * filename, bool tests=true); virtual void stop(); @@ -54,7 +56,7 @@ class OpentxTaranisSimulator : public SimulatorInterface { protected: - Open9xInterface * open9xInterface; + OpenTxInterface * open9xInterface; }; #endif diff --git a/companion/src/firmwares/opentx/opentxeeprom.h b/companion/src/firmwares/opentx/opentxeeprom.h index 50421ea0f..3a5f3ffa0 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.h +++ b/companion/src/firmwares/opentx/opentxeeprom.h @@ -30,8 +30,6 @@ #define SIMU_STOCK_VARIANTS (GVARS_VARIANT|FRSKY_VARIANT) #define SIMU_M128_VARIANTS (M128_VARIANT|SIMU_STOCK_VARIANTS) -#define SIMU_GRUVIN9X_VARIANTS (0) -#define SIMU_ARM_VARIANTS (0) #define O9X_MAX_TIMERS 2 #define O9X_MAX_PHASES 5 diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 16dbfeca9..420127df4 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -42,18 +42,18 @@ size_t SizeOfArray( T(&)[ N ] ) return N; } -Open9xInterface::Open9xInterface(BoardEnum board): +OpenTxInterface::OpenTxInterface(BoardEnum board): EEPROMInterface(board), efile(new EFile()) { } -Open9xInterface::~Open9xInterface() +OpenTxInterface::~OpenTxInterface() { delete efile; } -const char * Open9xInterface::getName() +const char * OpenTxInterface::getName() { switch (board) { case BOARD_STOCK: @@ -73,7 +73,7 @@ const char * Open9xInterface::getName() } } -const int Open9xInterface::getEEpromSize() +const int OpenTxInterface::getEEpromSize() { switch (board) { case BOARD_STOCK: @@ -93,7 +93,7 @@ const int Open9xInterface::getEEpromSize() } } -const int Open9xInterface::getMaxModels() +const int OpenTxInterface::getMaxModels() { if (IS_ARM(board)) return 60; @@ -106,7 +106,7 @@ const int Open9xInterface::getMaxModels() } template -bool Open9xInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode) +bool OpenTxInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode) { T _model; @@ -139,7 +139,7 @@ bool Open9xInterface::loadModel(ModelData &model, uint8_t *data, int index, unsi } template -bool Open9xInterface::loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant) +bool OpenTxInterface::loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant) { T open9xModel(model, board, version, variant); @@ -166,7 +166,7 @@ bool Open9xInterface::loadModelVariant(unsigned int index, ModelData &model, uin return true; } -bool Open9xInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode) +bool OpenTxInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode) { if (version == 201) { return loadModel(model, data, index, stickMode); @@ -247,7 +247,7 @@ bool Open9xInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data } template -bool Open9xInterface::loadGeneral(GeneralSettings &settings, unsigned int version) +bool OpenTxInterface::loadGeneral(GeneralSettings &settings, unsigned int version) { QByteArray eepromData(sizeof(settings), 0); // GeneralSettings should be always bigger than the EEPROM struct T open9xSettings(settings, board, version); @@ -263,7 +263,7 @@ bool Open9xInterface::loadGeneral(GeneralSettings &settings, unsigned int versio } template -bool Open9xInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, uint32_t version, uint32_t variant) +bool OpenTxInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, uint32_t version, uint32_t variant) { T open9xSettings(settings, board, version, variant); // open9xSettings.Dump(); @@ -274,7 +274,7 @@ bool Open9xInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, ui } template -bool Open9xInterface::saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant) +bool OpenTxInterface::saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant) { T open9xModel(model, board, version, variant); // open9xModel.Dump(); @@ -284,12 +284,12 @@ bool Open9xInterface::saveModel(unsigned int index, ModelData &model, unsigned i return (sz == eeprom.size()); } -bool Open9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) +bool OpenTxInterface::loadxml(RadioData &radioData, QDomDocument &doc) { return false; } -bool Open9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size) +bool OpenTxInterface::load(RadioData &radioData, uint8_t *eeprom, int size) { std::cout << "trying " << getName() << " import..."; @@ -350,7 +350,7 @@ bool Open9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size) return true; } -int Open9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version) +int OpenTxInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version) { EEPROMWarnings.clear(); @@ -403,7 +403,7 @@ int Open9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varian return size; } -int Open9xInterface::getSize(ModelData &model) +int OpenTxInterface::getSize(ModelData &model) { if (board == BOARD_SKY9X) return 0; @@ -426,7 +426,7 @@ int Open9xInterface::getSize(ModelData &model) return efile->size(0); } -int Open9xInterface::getSize(GeneralSettings &settings) +int OpenTxInterface::getSize(GeneralSettings &settings) { if (board == BOARD_SKY9X) return 0; @@ -446,7 +446,7 @@ int Open9xInterface::getSize(GeneralSettings &settings) return efile->size(0); } -int Open9xInterface::getCapability(const Capability capability) +int OpenTxInterface::getCapability(const Capability capability) { switch (capability) { case OwnerName: @@ -456,11 +456,6 @@ int Open9xInterface::getCapability(const Capability capability) return 1; else return 0; - case SimulatorType: - if (IS_TARANIS(board)) - return 1; - else - return 0; case HasBeeper: if (IS_ARM(board)) return 0; @@ -687,12 +682,19 @@ int Open9xInterface::getCapability(const Capability capability) return IS_TARANIS(board) ? 2 : 0; case MultiposPotsPositions: return IS_TARANIS(board) ? 6 : 0; + case SimulatorVariant: + if (board == BOARD_STOCK) + return SIMU_STOCK_VARIANTS; + else if (board == BOARD_M128) + return SIMU_M128_VARIANTS; + else + return 0; default: return 0; } } -int Open9xInterface::isAvailable(Protocol proto, int port) +int OpenTxInterface::isAvailable(Protocol proto, int port) { if (IS_TARANIS(board)) { switch (port) { @@ -777,7 +779,7 @@ int Open9xInterface::isAvailable(Protocol proto, int port) } } -SimulatorInterface * Open9xInterface::getSimulator() +SimulatorInterface * OpenTxInterface::getSimulator() { switch (board) { case BOARD_STOCK: @@ -789,7 +791,6 @@ SimulatorInterface * Open9xInterface::getSimulator() case BOARD_SKY9X: return new Open9xSky9xSimulator(this); case BOARD_TARANIS: - return new OpentxTaranisSimulator(this); case BOARD_TARANIS_REV4a: return new OpentxTaranisSimulator(this); default: @@ -802,7 +803,7 @@ size_t getSizeA(T (&)[SIZE]) { return SIZE; } -bool Open9xInterface::checkVersion(unsigned int version) +bool OpenTxInterface::checkVersion(unsigned int version) { switch(version) { case 201: @@ -868,7 +869,7 @@ bool Open9xInterface::checkVersion(unsigned int version) return true; } -bool Open9xInterface::checkVariant(unsigned int version, unsigned int variant) +bool OpenTxInterface::checkVariant(unsigned int version, unsigned int variant) { if (board == BOARD_M128 && !(variant & 0x8000)) { if (version == 212) { @@ -890,7 +891,7 @@ bool Open9xInterface::checkVariant(unsigned int version, unsigned int variant) } } -bool Open9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) +bool OpenTxInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) { std::cout << "trying " << getName() << " backup import..."; @@ -1015,7 +1016,7 @@ void RegisterOpen9xFirmwares() Option extr_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "jeti", QObject::tr("Support for jeti telemetry mod"), 0 }, { "ardupilot", QObject::tr("Support for receiving ardupilot data"), 0 }, { "nmea", QObject::tr("Support for receiving NMEA data"), 0 }, { "mavlink", QObject::tr("Support for MAVLINK devices"), MAVLINK_VARIANT }, { NULL } }; Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE at field") }, { "faimode", QObject::tr("FAI MODE always enabled") }, { NULL } }; /* 9x board */ - open9x = new Open9xFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), new Open9xInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK), getrnurl(BOARD_STOCK), false); + open9x = new Open9xFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), new OpenTxInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK), getrnurl(BOARD_STOCK), false); open9x->addOptions(ext_options); open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); @@ -1052,7 +1053,7 @@ void RegisterOpen9xFirmwares() firmwares.push_back(open9x); /* 9x board with M128 chip */ - open9x = new Open9xFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), new Open9xInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false); + open9x = new Open9xFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), new OpenTxInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false); open9x->addOptions(ext_options); open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); @@ -1084,7 +1085,7 @@ void RegisterOpen9xFirmwares() firmwares.push_back(open9x); /* 9XR board */ - open9x = new Open9xFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), new Open9xInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK),getrnurl(BOARD_STOCK), false); + open9x = new Open9xFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), new OpenTxInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK),getrnurl(BOARD_STOCK), false); open9x->addOptions(extr_options); open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); @@ -1118,7 +1119,7 @@ void RegisterOpen9xFirmwares() firmwares.push_back(open9x); /* 9XR board with M128 chip */ - open9x = new Open9xFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), new Open9xInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false); + open9x = new Open9xFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), new OpenTxInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false); open9x->addOptions(extr_options); open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); @@ -1148,7 +1149,7 @@ void RegisterOpen9xFirmwares() firmwares.push_back(open9x); /* Gruvin9x board */ - open9x = new Open9xFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), new Open9xInterface(BOARD_GRUVIN9X), geturl(BOARD_GRUVIN9X), getstamp(BOARD_GRUVIN9X),getrnurl(BOARD_GRUVIN9X), false); + open9x = new Open9xFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), new OpenTxInterface(BOARD_GRUVIN9X), geturl(BOARD_GRUVIN9X), getstamp(BOARD_GRUVIN9X),getrnurl(BOARD_GRUVIN9X), false); open9x->setVariantBase(FRSKY_VARIANT); open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); @@ -1178,7 +1179,7 @@ void RegisterOpen9xFirmwares() #ifndef __APPLE__ /* SKY9X board */ - open9x = new Open9xFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), new Open9xInterface(BOARD_SKY9X), geturl(BOARD_SKY9X), getstamp(BOARD_SKY9X),getrnurl(BOARD_SKY9X), true); + open9x = new Open9xFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), new OpenTxInterface(BOARD_SKY9X), geturl(BOARD_SKY9X), getstamp(BOARD_SKY9X),getrnurl(BOARD_SKY9X), true); open9x->setVariantBase(FRSKY_VARIANT); open9x->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support")); open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu")); @@ -1203,7 +1204,7 @@ void RegisterOpen9xFirmwares() #endif /* Taranis board */ - open9x = new Open9xFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), new Open9xInterface(BOARD_TARANIS), geturl(BOARD_TARANIS), getstamp(BOARD_TARANIS),getrnurl(BOARD_TARANIS), true); + open9x = new Open9xFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), new OpenTxInterface(BOARD_TARANIS), geturl(BOARD_TARANIS), getstamp(BOARD_TARANIS),getrnurl(BOARD_TARANIS), true); open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support")); open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu")); open9x->addOption("nogvars", QObject::tr("Disable Global variables")); @@ -1215,7 +1216,7 @@ void RegisterOpen9xFirmwares() QSettings settings; int rev4a = settings.value("rev4asupport",0).toInt(); if (rev4a) { - open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), new Open9xInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true); + open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("OpenTX for FrSky Taranis Rev4a"), new OpenTxInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true); open9x->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support")); open9x->addOption("notemplates", QObject::tr("Disable TEMPLATES menu")); open9x->addOption("nogvars", QObject::tr("Disable Global variables")); diff --git a/companion/src/firmwares/opentx/opentxinterface.h b/companion/src/firmwares/opentx/opentxinterface.h index fb7f3df5c..aef381164 100644 --- a/companion/src/firmwares/opentx/opentxinterface.h +++ b/companion/src/firmwares/opentx/opentxinterface.h @@ -23,13 +23,13 @@ class EFile; -class Open9xInterface : public EEPROMInterface +class OpenTxInterface : public EEPROMInterface { public: - Open9xInterface(BoardEnum board); + OpenTxInterface(BoardEnum board); - virtual ~Open9xInterface(); + virtual ~OpenTxInterface(); virtual const char * getName(); diff --git a/companion/src/firmwares/opentx/opentxsimulator.cpp b/companion/src/firmwares/opentx/opentxsimulator.cpp index 9037afa86..dfb7025ea 100644 --- a/companion/src/firmwares/opentx/opentxsimulator.cpp +++ b/companion/src/firmwares/opentx/opentxsimulator.cpp @@ -107,7 +107,7 @@ uint8_t getStickMode() using namespace Open9x; -Open9xSimulator::Open9xSimulator(Open9xInterface * open9xInterface): +Open9xSimulator::Open9xSimulator(OpenTxInterface * open9xInterface): open9xInterface(open9xInterface) { #define INIT_IMPORT @@ -132,13 +132,20 @@ bool Open9xSimulator::lcdChanged(bool & lightEnable) #include "simulatorimport.h" } -void Open9xSimulator::start(RadioData &radioData, bool tests) +void Open9xSimulator::start(QByteArray & eeprom, bool tests) { - open9xInterface->save(&Open9x::eeprom[0], radioData, SIMU_STOCK_VARIANTS); + memcpy(&Open9x::eeprom[0], eeprom.data(), 2048); StartEepromThread(NULL); StartMainThread(tests); } +void Open9xSimulator::start(const char * filename, bool tests) +{ + // open9xInterface->save(&Open9x::eeprom[0], radioData, SIMU_STOCK_VARIANTS); + StartEepromThread(filename); + StartMainThread(tests); +} + void Open9xSimulator::stop() { StopMainThread(); diff --git a/companion/src/firmwares/opentx/opentxsimulator.h b/companion/src/firmwares/opentx/opentxsimulator.h index 84970eb1f..a4e24b3ba 100644 --- a/companion/src/firmwares/opentx/opentxsimulator.h +++ b/companion/src/firmwares/opentx/opentxsimulator.h @@ -19,15 +19,17 @@ #include "simulatorinterface.h" -class Open9xInterface; +class OpenTxInterface; class Open9xSimulator : public SimulatorInterface { public: - Open9xSimulator(Open9xInterface *); + Open9xSimulator(OpenTxInterface *); - virtual void start(RadioData &radioData, bool tests); + virtual void start(QByteArray & eeprom, bool tests=true); + + virtual void start(const char * filename, bool tests=true); virtual void stop(); @@ -53,7 +55,7 @@ class Open9xSimulator : public SimulatorInterface { protected: - Open9xInterface * open9xInterface; + OpenTxInterface * open9xInterface; }; diff --git a/companion/src/firmwares/th9x/th9xinterface.cpp b/companion/src/firmwares/th9x/th9xinterface.cpp index 8e3e36ab6..306d83797 100644 --- a/companion/src/firmwares/th9x/th9xinterface.cpp +++ b/companion/src/firmwares/th9x/th9xinterface.cpp @@ -202,5 +202,5 @@ int Th9xInterface::isAvailable(Protocol proto, int port) SimulatorInterface * Th9xInterface::getSimulator() { - return new Th9xSimulator(this); + return NULL; // new Th9xSimulator(this); } diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index e3d98d9fa..c93044bcc 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -1,5 +1,6 @@ #include #include "helpers.h" +#include "simulatordialog.h" QString getPhaseName(int val, char * phasename) { @@ -945,3 +946,34 @@ CompanionIcon::CompanionIcon(QString baseimage) addFile(":/themes/"+theme+"/48/"+baseimage, QSize(48,48)); } +void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx) +{ + if (GetEepromInterface()->getSimulator()) { + RadioData * simuData = new RadioData(radioData); + unsigned int flags = 0; + if (modelIdx >= 0) { + flags |= SIMULATOR_FLAGS_NOTX; + simuData->generalSettings.currModel = modelIdx; + } + if (radioData.generalSettings.stickMode & 1) { + flags |= SIMULATOR_FLAGS_STICK_MODE_LEFT; + } + BoardEnum board = GetEepromInterface()->getBoard(); + SimulatorDialog * sd; + if (IS_TARANIS(board)) + sd = new SimulatorDialogTaranis(parent, flags); + else + sd = new SimulatorDialog9X(parent, flags); + QByteArray eeprom(GetEepromInterface()->getEEpromSize(), 0); + GetEepromInterface()->save((uint8_t *)eeprom.data(), *simuData, GetEepromInterface()->getCapability(SimulatorVariant)); + delete simuData; + sd->start(eeprom); + sd->exec(); + delete sd; + } + else { + QMessageBox::warning(NULL, + QObject::tr("Warning"), + QObject::tr("Simulator for this firmware is not yet available")); + } +} diff --git a/companion/src/helpers.h b/companion/src/helpers.h index ad22a4e7c..fc2e3d427 100644 --- a/companion/src/helpers.h +++ b/companion/src/helpers.h @@ -131,4 +131,6 @@ QString getFrSkySrc(int index); float ValToTim(int value); int TimToVal(float value); +void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx); + #endif // HELPERS_H diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index 498e342af..c32f6c8e0 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -48,8 +48,6 @@ #include "generaledit.h" #include "avroutputdialog.h" #include "burnconfigdialog.h" -#include "simulatordialog.h" -#include "xsimulatordialog.h" #include "printdialog.h" #include "burndialog.h" #include "helpers.h" @@ -142,25 +140,7 @@ void MdiChild::setModified() void MdiChild::on_SimulateTxButton_clicked() { - if (GetEepromInterface()->getSimulator()) { - if (GetEepromInterface()->getCapability(SimulatorType)==1) { - xsimulatorDialog * sd = new xsimulatorDialog(this); - sd->loadParams(radioData); - sd->exec(); - delete sd; - } - else { - simulatorDialog * sd = new simulatorDialog(this); - sd->loadParams(radioData); - sd->exec(); - delete sd; - } - } - else { - QMessageBox::warning(NULL, - QObject::tr("Warning"), - QObject::tr("Simulator for this firmware is not yet available")); - } + startSimulation(this, radioData, -1); } void MdiChild::OpenEditWindow(bool wizard=false) @@ -647,22 +627,9 @@ void MdiChild::burnTo() // write to Tx void MdiChild::simulate() { - if(ui->modelsList->currentRow()<1) return; - if (GetEepromInterface()->getSimulator()) { - if (GetEepromInterface()->getCapability(SimulatorType)) { - xsimulatorDialog sd(this); - sd.loadParams(radioData, ui->modelsList->currentRow()-1); - sd.exec(); - } else { - simulatorDialog sd(this); - sd.loadParams(radioData, ui->modelsList->currentRow()-1); - sd.exec(); - } - } else { - QMessageBox::warning(NULL, - QObject::tr("Warning"), - QObject::tr("Simulator for this firmware is not yet available")); - } + if (ui->modelsList->currentRow() >= 1) { + startSimulation(this, radioData, ui->modelsList->currentRow()-1); + } } void MdiChild::print(int model, QString filename) diff --git a/companion/src/modeledit/modeledit.cpp b/companion/src/modeledit/modeledit.cpp index 9336f913b..0013877c5 100644 --- a/companion/src/modeledit/modeledit.cpp +++ b/companion/src/modeledit/modeledit.cpp @@ -107,35 +107,13 @@ void ModelEdit::on_pushButton_clicked() launchSimulation(); } -// TODO merge both -#include "simulatordialog.h" -#include "xsimulatordialog.h" - void ModelEdit::launchSimulation() { - if (GetEepromInterface()->getSimulator()) { - RadioData *simuData = new RadioData(); - simuData->generalSettings = generalSettings; - simuData->models[modelId] = model; - if (GetEepromInterface()->getCapability(SimulatorType)) { - xsimulatorDialog *sd = new xsimulatorDialog(this); - sd->loadParams(*simuData, modelId); - sd->exec(); - delete sd; - } - else { - simulatorDialog *sd = new simulatorDialog(this); - sd->loadParams(*simuData, modelId); - sd->exec(); - delete sd; - } - delete simuData; - } - else { - QMessageBox::warning(NULL, - QObject::tr("Warning"), - QObject::tr("Simulator for this firmware is not yet available")); - } + RadioData *simuData = new RadioData(); + simuData->generalSettings = generalSettings; + simuData->models[0] = model; + startSimulation(this, *simuData, 0); + delete simuData; } diff --git a/companion/src/myslider.h b/companion/src/myslider.h index 238e4053f..d2c6801a5 100644 --- a/companion/src/myslider.h +++ b/companion/src/myslider.h @@ -1,9 +1,6 @@ -/* - * File: mySlider.h - * Author: Romolo Manfredini - * - * Created on 11 gennaio 2012, 23.39 - */ +#ifndef MYSLIDER_H +#define MYSLIDER_H + #include #include @@ -31,4 +28,4 @@ protected: } }; - +#endif diff --git a/companion/src/simulator/CMakeLists.txt b/companion/src/simulator/CMakeLists.txt new file mode 100644 index 000000000..cbc0a691e --- /dev/null +++ b/companion/src/simulator/CMakeLists.txt @@ -0,0 +1,121 @@ +set(TH9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/th9x) +add_custom_command( + OUTPUT ${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp + COMMAND ${CMAKE_COMMAND} -E make_directory ${TH9X_CHECKOUT_DIRECTORY} + COMMAND cd ${TH9X_CHECKOUT_DIRECTORY} && svn checkout http://th9x.googlecode.com/svn/trunk/src@285 . + COMMAND ${CMAKE_COMMAND} -E copy ${COMPANION_SRC_DIRECTORY}/firmwares/th9x/th9xsimulator.cpp ${TH9X_CHECKOUT_DIRECTORY} + DEPENDS ${COMPANION_SRC_DIRECTORY}/firmwares/th9x/th9xsimulator.cpp +) + +set(ER9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/er9x) +add_custom_command( + OUTPUT ${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp + COMMAND ${CMAKE_COMMAND} -E make_directory ${ER9X_CHECKOUT_DIRECTORY} + COMMAND cd ${ER9X_CHECKOUT_DIRECTORY} && svn checkout http://er9x.googlecode.com/svn/trunk/src@790 . + COMMAND ${CMAKE_COMMAND} -E copy ${COMPANION_SRC_DIRECTORY}/firmwares/er9x/er9xsimulator.cpp ${ER9X_CHECKOUT_DIRECTORY} + DEPENDS ${COMPANION_SRC_DIRECTORY}/firmwares/er9x/er9xsimulator.cpp +) + +set(ERSKY9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/ersky9x) +add_custom_command( + OUTPUT ${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp + COMMAND ${CMAKE_COMMAND} -E make_directory ${ERSKY9X_CHECKOUT_DIRECTORY} + COMMAND cd ${ERSKY9X_CHECKOUT_DIRECTORY} && svn checkout http://ersky9x.googlecode.com/svn/trunk/src@170 . + COMMAND ${CMAKE_COMMAND} -E copy ${COMPANION_SRC_DIRECTORY}/firmwares/ersky9x/ersky9xsimulator.cpp ${ERSKY9X_CHECKOUT_DIRECTORY} + DEPENDS ${COMPANION_SRC_DIRECTORY}/firmwares/ersky9x/ersky9xsimulator.cpp +) + +set(simulation_SRCS + simulatordialog.cpp +) + +set(simulation_UIS + simulatordialog-9x.ui + simulatordialog-taranis.ui +) + +set(simulation_HDRS + simulatordialog.h + cursorwidget.h + menuwidget.h + xcursorwidget.h + xmenuwidget.h +) + +if(SDL_FOUND) + set(simulation_SRCS + ${simulation_SRCS} + joystick.cpp + joystickdialog.cpp + ) + + set(simulation_HDRS + ${simulation_HDRS} + joystick.h + joystickdialog.h + ) + + set(simulation_UIS + ${simulation_UIS} + joystickdialog.ui + ) +endif() + +include_directories( + # ${CMAKE_BINARY_DIR} + # ${CMAKE_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${PROJECT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/../.. + ${COMPANION_SRC_DIRECTORY} + ${RADIO_SRC_DIRECTORY}/fonts/std +) + +qt4_wrap_ui(simulation_SRCS ${simulation_UIS}) +qt4_wrap_cpp(simulation_SRCS ${simulation_HDRS}) + +add_library(simulation ${simulation_SRCS}) + +set(simu_SRCS + ${COMPANION_SRC_DIRECTORY}/eeprominterface.cpp + ${COMPANION_SRC_DIRECTORY}/firmwares/th9x/th9xeeprom.cpp # TODO not needed + ${COMPANION_SRC_DIRECTORY}/firmwares/th9x/th9xinterface.cpp + ${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp + ${COMPANION_SRC_DIRECTORY}/firmwares/er9x/er9xeeprom.cpp # TODO not needed + ${COMPANION_SRC_DIRECTORY}/firmwares/er9x/er9xinterface.cpp + ${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp + ${COMPANION_SRC_DIRECTORY}/firmwares/gruvin9x/gruvin9xeeprom.cpp # TODO not needed + ${COMPANION_SRC_DIRECTORY}/firmwares/gruvin9x/gruvin9xinterface.cpp + ${COMPANION_SRC_DIRECTORY}/firmwares/opentx/opentxeeprom.cpp # TODO not needed + ${COMPANION_SRC_DIRECTORY}/firmwares/opentx/open9xStockeeprom.cpp # TODO not needed + ${COMPANION_SRC_DIRECTORY}/firmwares/opentx/open9xGruvin9xeeprom.cpp # TODO not needed + ${COMPANION_SRC_DIRECTORY}/firmwares/opentx/open9xSky9xeeprom.cpp # TODO not needed + ${COMPANION_SRC_DIRECTORY}/firmwares/opentx/opentxinterface.cpp + ${COMPANION_SRC_DIRECTORY}/firmwares/opentx/opentxTaranisSimulator.cpp + ${COMPANION_SRC_DIRECTORY}/firmwares/opentx/opentxSky9xsimulator.cpp + ${COMPANION_SRC_DIRECTORY}/firmwares/opentx/opentxGruvin9xsimulator.cpp + ${COMPANION_SRC_DIRECTORY}/firmwares/opentx/opentxM128simulator.cpp + ${COMPANION_SRC_DIRECTORY}/firmwares/opentx/opentxsimulator.cpp + ${COMPANION_SRC_DIRECTORY}/firmwares/ersky9x/ersky9xeeprom.cpp # TODO not needed + ${COMPANION_SRC_DIRECTORY}/firmwares/ersky9x/ersky9xinterface.cpp + ${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp + ${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm + ${COMPANION_SRC_DIRECTORY}/file.cpp # TODO not needed + ${COMPANION_SRC_DIRECTORY}/helpers.cpp # TODO not needed + ${COMPANION_SRC_DIRECTORY}/modeledit/node.cpp + ${COMPANION_SRC_DIRECTORY}/modeledit/edge.cpp # TODO not needed + main.cpp +) + +set(simu_HDRS + ${COMPANION_SRC_DIRECTORY}/modeledit/node.h + ${COMPANION_SRC_DIRECTORY}/helpers.h # TODO not needed + ${COMPANION_SRC_DIRECTORY}/myslider.h # TODO not needed +) + +qt4_wrap_cpp(simu_SRCS ${simu_HDRS} ) +qt4_add_resources(simu_SRCS ${COMPANION_SRC_DIRECTORY}/companion.qrc) # TODO not needed + +add_executable(simu WIN32 ${simu_SRCS}) + +target_link_libraries(simu simulation ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS}) diff --git a/companion/src/cursorwidget.h b/companion/src/simulator/cursorwidget.h similarity index 100% rename from companion/src/cursorwidget.h rename to companion/src/simulator/cursorwidget.h diff --git a/companion/src/joystick.cpp b/companion/src/simulator/joystick.cpp similarity index 100% rename from companion/src/joystick.cpp rename to companion/src/simulator/joystick.cpp diff --git a/companion/src/joystick.h b/companion/src/simulator/joystick.h similarity index 100% rename from companion/src/joystick.h rename to companion/src/simulator/joystick.h diff --git a/companion/src/joystickdialog.cpp b/companion/src/simulator/joystickdialog.cpp similarity index 100% rename from companion/src/joystickdialog.cpp rename to companion/src/simulator/joystickdialog.cpp diff --git a/companion/src/joystickdialog.h b/companion/src/simulator/joystickdialog.h similarity index 100% rename from companion/src/joystickdialog.h rename to companion/src/simulator/joystickdialog.h diff --git a/companion/src/joystickdialog.ui b/companion/src/simulator/joystickdialog.ui similarity index 100% rename from companion/src/joystickdialog.ui rename to companion/src/simulator/joystickdialog.ui diff --git a/companion/src/lcdwidget.h b/companion/src/simulator/lcdwidget.h similarity index 100% rename from companion/src/lcdwidget.h rename to companion/src/simulator/lcdwidget.h diff --git a/companion/src/simulator/main.cpp b/companion/src/simulator/main.cpp new file mode 100644 index 000000000..163542a1c --- /dev/null +++ b/companion/src/simulator/main.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "simulatordialog.h" +#include "eeprominterface.h" + +#if defined WIN32 || !defined __GNUC__ +#include +#define sleep(x) Sleep(x*1000) +#else +#include +#endif + +#ifdef __APPLE__ +#include + +class MyProxyStyle : public QProxyStyle + { + public: + void polish ( QWidget * w ) { + QMenu* mn = dynamic_cast(w); + QPushButton* pb = dynamic_cast(w); + if(!(mn || pb) && !w->testAttribute(Qt::WA_MacNormalSize)) + w->setAttribute(Qt::WA_MacSmallSize); + } + }; +#endif + +int main(int argc, char *argv[]) +{ + Q_INIT_RESOURCE(companion); + QApplication app(argc, argv); + app.setApplicationName("OpenTX Simulator"); + app.setOrganizationName("OpenTX"); + app.setOrganizationDomain("open-tx.org"); + +#ifdef __APPLE__ + app.setStyle(new MyProxyStyle); +#endif + + QString dir; + if (argc) dir = QFileInfo(argv[0]).canonicalPath() + "/lang"; + + /* QTranslator companionTranslator; + companionTranslator.load(":/companion_" + locale); + QTranslator qtTranslator; + qtTranslator.load((QString)"qt_" + locale.left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + app.installTranslator(&companionTranslator); + app.installTranslator(&qtTranslator); +*/ + + QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + + RegisterFirmwares(); + SimulatorDialog *dialog; + + if (argc > 1 && !strcmp(argv[1], "taranis")) { + current_firmware_variant = GetFirmwareVariant("opentx-taranis-en"); + dialog = new SimulatorDialogTaranis(); + } + else { + dialog = new SimulatorDialog9X(); + } + + dialog->show(); + dialog->start("eeprom.bin"); + + int result = app.exec(); + + delete dialog; + + return result; +} diff --git a/companion/src/menuwidget.h b/companion/src/simulator/menuwidget.h similarity index 100% rename from companion/src/menuwidget.h rename to companion/src/simulator/menuwidget.h diff --git a/companion/src/simulator/simulatordialog-9x.ui b/companion/src/simulator/simulatordialog-9x.ui new file mode 100644 index 000000000..dd2e71dbc --- /dev/null +++ b/companion/src/simulator/simulatordialog-9x.ui @@ -0,0 +1,1284 @@ + + + SimulatorDialog9X + + + + 0 + 0 + 653 + 613 + + + + + 0 + 0 + + + + + 739 + 16777215 + + + + Companion Simulator + + + + :/icon.png:/icon.png + + + + 5 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Raised + + + 2 + + + + 5 + + + 6 + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Vertical + + + + + + + + 220 + 220 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + + 0 + + + + + + 8 + + + + false + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + THR + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + RUD + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + ELE + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + AIL + + + true + + + + + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold X + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix X + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold Y + + + true + + + + + + + + + 20 + + + 20 + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Horizontal + + + + + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Vertical + + + + + + + + 220 + 220 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:pressed { + background-color: #4CC417; + border-style: inset; + } + + + TRN + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + GEA + + + true + + + false + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + ID0 + + + true + + + true + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + ID1 + + + true + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + ID2 + + + true + + + true + + + + + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold X + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix X + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold Y + + + true + + + + + + + + + 20 + + + 20 + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Horizontal + + + + + + + + + + + true + + + QFrame::Panel + + + QFrame::Raised + + + 2 + + + + 2 + + + + + BEEP + + + Qt::AlignCenter + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 50 + 50 + + + + P1 + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + 0 % + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 50 + 50 + + + + P2 + + + -1024 + + + 1024 + + + 128 + + + false + + + 64.000000000000000 + + + true + + + + + + + 0 % + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + + 50 + 50 + + + + P3 + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + 0 % + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 570 + 5 + + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + 0 + + + + 9x Simulator + + + + + + QLayout::SetMinimumSize + + + 0 + + + + + + 0 + 0 + + + + + 256 + 29 + + + + background:url(:/images/9xdt.png) + + + + + + + + 0 + 0 + + + + + 41 + 186 + + + + background:url(:/images/9xdl.png) + + + + + + + + 0 + 0 + + + + + 89 + 186 + + + + background:url(:/images/9xmenu.png) + + + + + + + + 0 + 0 + + + + + 256 + 128 + + + + + + + + + 0 + 0 + + + + + 256 + 29 + + + + background:url(:/images/9xdb.png) + + + + + + + + 0 + 0 + + + + + 128 + 186 + + + + true + + + background:url(:/images/9xcurs.png); + + + + + + + + 0 + 0 + + + + + 55 + 186 + + + + background:url(:/images/9xdr.png) + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal + + + + 438 + 6 + + + + + + + + + + + Outputs + + + + + + + + + + + + + + + + + lcdWidget + QWidget +
lcdwidget.h
+ 1 +
+ + cursorWidget + QWidget +
cursorwidget.h
+ 1 +
+ + menuWidget + QWidget +
menuwidget.h
+ 1 +
+ + mySlider + QSlider +
myslider.h
+
+
+ + + + +
diff --git a/companion/src/simulator/simulatordialog-taranis.ui b/companion/src/simulator/simulatordialog-taranis.ui new file mode 100644 index 000000000..ad41fe74a --- /dev/null +++ b/companion/src/simulator/simulatordialog-taranis.ui @@ -0,0 +1,1468 @@ + + + SimulatorDialogTaranis + + + + 0 + 0 + 712 + 688 + + + + + 0 + 0 + + + + + 739 + 16777215 + + + + Companion Simulator + + + + :/icon.png:/icon.png + + + + 5 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + QFrame::Panel + + + QFrame::Raised + + + 2 + + + + 5 + + + 6 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 245 + 245 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix X + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold X + + + true + + + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + SD + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + SC + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + + Qt::Horizontal + + + + 10 + 20 + + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Vertical + + + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + S2 + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + SG + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + false + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + RS + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + SH + + + + + + 1 + + + 0 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + SC + + + Qt::AlignCenter + + + + + + + SD + + + Qt::AlignCenter + + + + + + + SG + + + Qt::AlignCenter + + + + + + + SH + + + Qt::AlignCenter + + + + + + + S2 + + + Qt::AlignCenter + + + + + + + RS + + + Qt::AlignCenter + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Horizontal + + + + + + + 20 + + + 20 + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix Y + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Fix X + + + true + + + + + + + + 8 + + + + QPushButton { + background-color: #EEEEEE; + border-style: outset; + border-width: 1px; + border-radius: 4px; + border-color: black; + padding: 2px; + } + +QPushButton:checked { + background-color: #4CC417; + border-style: inset; + } + + + Hold X + + + true + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + S1 + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + 20 + + + 20 + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + SB + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 245 + 245 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + SA + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Horizontal + + + + + + + + + + 0 + 0 + + + + Right Double Click to Reset + + + -125 + + + 125 + + + Qt::Vertical + + + + + + + Qt::Horizontal + + + QSizePolicy::MinimumExpanding + + + + 5 + 20 + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + SE + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + SF + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + SF + + + SF + + + 1 + + + 1 + + + 0 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 42 + 42 + + + + LS + + + -1024 + + + 1024 + + + 128 + + + 64.000000000000000 + + + true + + + + + + + SA + + + Qt::AlignCenter + + + + + + + SB + + + Qt::AlignCenter + + + + + + + SE + + + Qt::AlignCenter + + + + + + + LS + + + Qt::AlignCenter + + + + + + + S1 + + + Qt::AlignCenter + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 570 + 5 + + + + + + + + true + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + 0 + + + + Taranis Simulator + + + + + + QLayout::SetMinimumSize + + + 0 + + + + + + 0 + 0 + + + + + 120 + 208 + + + + true + + + background:url(:/images/x9l0.png); + + + + + + + + 0 + 0 + + + + + 424 + 38 + + + + background:url(:/images/x9t0.png) + + + + + + + + 0 + 0 + + + + + 120 + 208 + + + + background:url(:/images/x9r0.png) + + + + + + + + 0 + 0 + + + + + 424 + 128 + + + + + + + + + 0 + 0 + + + + + 424 + 42 + + + + background:url(:/images/x9b0.png) + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Horizontal + + + + 438 + 6 + + + + + + + + + + + Outputs + + + + + + + + + + + + + + + + + lcdWidget + QWidget +
lcdwidget.h
+ 1 +
+ + mySlider + QSlider +
myslider.h
+
+ + xcursorWidget + QWidget +
xcursorwidget.h
+ 1 +
+ + xmenuWidget + QWidget +
xmenuwidget.h
+ 1 +
+
+ + + + +
diff --git a/companion/src/simulator/simulatordialog.cpp b/companion/src/simulator/simulatordialog.cpp new file mode 100644 index 000000000..597edfe35 --- /dev/null +++ b/companion/src/simulator/simulatordialog.cpp @@ -0,0 +1,755 @@ +#include "simulatordialog.h" +#include "ui_simulatordialog-9x.h" +#include "ui_simulatordialog-taranis.h" +#include +#include "helpers.h" +#include "simulatorinterface.h" + +#define GBALL_SIZE 20 +#define RESX 1024 + +int SimulatorDialog::screenshotIdx = 0; + +SimulatorDialog::SimulatorDialog(QWidget * parent, unsigned int flags): + QDialog(parent), + flags(flags), + dialP_4(NULL), + timer(NULL), + lightOn(false), + txInterface(NULL), + simulator(NULL), + beepVal(0), + buttonPressed(0), + middleButtonPressed(false) +{ +} + +SimulatorDialog9X::SimulatorDialog9X(QWidget * parent, unsigned int flags): + SimulatorDialog(parent, flags), + ui(new Ui::SimulatorDialog9X), + beepShow(0) +{ + lcdWidth = 128; + lcdDepth = 1; + + initUi(ui); + + QSettings settings; + backLight = settings.value("backLight", 0).toInt(); + if (backLight > 4) backLight = 0; + switch (backLight) { + case 1: + ui->lcd->setBackgroundColor(166,247,159); + break; + case 2: + ui->lcd->setBackgroundColor(247,159,166); + break; + case 3: + ui->lcd->setBackgroundColor(255,195,151); + break; + case 4: + ui->lcd->setBackgroundColor(247,242,159); + break; + default: + ui->lcd->setBackgroundColor(159,165,247); + break; + } + + connect(ui->dialP_1, SIGNAL(valueChanged(int)), this, SLOT(dialChanged())); + connect(ui->dialP_2, SIGNAL(valueChanged(int)), this, SLOT(dialChanged())); + connect(ui->dialP_3, SIGNAL(valueChanged(int)), this, SLOT(dialChanged())); + connect(ui->cursor, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); + connect(ui->menu, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); +} + +SimulatorDialog9X::~SimulatorDialog9X() +{ + delete ui; +} + +SimulatorDialogTaranis::SimulatorDialogTaranis(QWidget * parent, unsigned int flags): + SimulatorDialog(parent, flags), + ui(new Ui::SimulatorDialogTaranis) +{ + lcdWidth = 212; + lcdDepth = 4; + + initUi(ui); + dialP_4 = ui->dialP_4; + + ui->lcd->setBackgroundColor(47, 123, 227); + + connect(ui->cursor, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); + connect(ui->menu, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); +} + +SimulatorDialogTaranis::~SimulatorDialogTaranis() +{ + delete ui; +} + +SimulatorDialog::~SimulatorDialog() +{ + delete timer; +} + +void SimulatorDialog::closeEvent (QCloseEvent *) +{ + simulator->stop(); + timer->stop(); +} + +void SimulatorDialog::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::MidButton) { + middleButtonPressed = true; + } +} + +void SimulatorDialog::mouseReleaseEvent(QMouseEvent *event) +{ + if (event->button() == Qt::MidButton) { + middleButtonPressed = false; + } +} + +void SimulatorDialog9X::dialChanged() +{ + ui->dialP_1value->setText(QString("%1 %").arg((ui->dialP_1->value()*100)/1024)); + ui->dialP_2value->setText(QString("%1 %").arg((ui->dialP_2->value()*100)/1024)); + ui->dialP_3value->setText(QString("%1 %").arg((ui->dialP_3->value()*100)/1024)); +} + +void SimulatorDialog::wheelEvent (QWheelEvent *event) +{ + simulator->wheelEvent(event->delta() > 0 ? 1 : -1); +} + +void SimulatorDialog::keyPressEvent (QKeyEvent *event) +{ + switch (event->key()) { + case Qt::Key_Enter: + case Qt::Key_Return: + buttonPressed = Qt::Key_Enter; + break; + case Qt::Key_Escape: + case Qt::Key_Backspace: + buttonPressed = Qt::Key_Escape; + break; + case Qt::Key_Up: + case Qt::Key_Down: + case Qt::Key_Right: + case Qt::Key_Left: + case Qt::Key_Minus: + case Qt::Key_Plus: + case Qt::Key_PageDown: + case Qt::Key_Menu: + buttonPressed = event->key(); + break; + } +} + +void SimulatorDialog::keyReleaseEvent(QKeyEvent * event) +{ + switch (event->key()) { + case Qt::Key_Enter: + case Qt::Key_Return: + case Qt::Key_Escape: + case Qt::Key_Backspace: + case Qt::Key_Up: + case Qt::Key_Down: + case Qt::Key_Right: + case Qt::Key_Left: + case Qt::Key_Plus: + case Qt::Key_Minus: + case Qt::Key_PageDown: + case Qt::Key_Menu: + buttonPressed = 0; + break; + } +} + +void SimulatorDialog::setupTimer() +{ + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(onTimerEvent())); + timer->start(10); +} + +template +void SimulatorDialog::initUi(T * ui) +{ + ui->setupUi(this); + + lcd = ui->lcd; + leftStick = ui->leftStick; + rightStick = ui->rightStick; + dialP_1 = ui->dialP_1; + dialP_2 = ui->dialP_2; + dialP_3 = ui->dialP_3; + trimHLeft = ui->trimHLeft; + trimVLeft = ui->trimVLeft; + trimHRight = ui->trimHRight; + trimVRight = ui->trimVRight; + tabWidget = ui->tabWidget; + logicalSwitchesLayout = ui->logicalSwitchesLayout; + channelsLayout = ui->channelsLayout; + leftXPerc = ui->leftXPerc; + leftYPerc = ui->leftYPerc; + rightXPerc = ui->rightXPerc; + rightYPerc = ui->rightYPerc; + + setupSticks(); + + resize(0, 0); // to force min height, min width + setFixedSize(width(), height()); + +#ifdef JOYSTICKS + QSettings settings; + bool js_enable = settings.value("js_support",false).toBool(); + int js_ctrl=settings.value("js_ctrl",-1).toInt(); + if (js_enable) { + settings.beginGroup("JsCalibration"); + int count=0; + for (int j=0; j<8;j++){ + int axe=settings.value(QString("stick%1_axe").arg(j),-1).toInt(); + if (axe>=0 && axe<8) { + jsmap[axe]=j; + jscal[axe][0]=settings.value(QString("stick%1_min").arg(j),-32767).toInt(); + jscal[axe][1]=settings.value(QString("stick%1_med").arg(j),0).toInt(); + jscal[axe][2]=settings.value(QString("stick%1_max").arg(j),0).toInt(); + jscal[axe][3]=settings.value(QString("stick%1_inv").arg(j),0).toInt(); + count++; + } + } + settings.endGroup(); + if (count<3) { + QMessageBox::critical(this, tr("Warning"), tr("Joystick enabled but not configured correctly")); + } + if (js_ctrl!=-1) { + joystick = new Joystick(this); + if (joystick) { + if (joystick->open(js_ctrl)) { + int numAxes=std::min(joystick->numAxes,8); + for (int j=0; jsensitivities[j] = 0; + joystick->deadzones[j]=0; + } + nodeRight->setCenteringY(false); //mode 1,3 -> THR on right + ui->holdRightY->setChecked(true); + nodeRight->setCenteringX(false); //mode 1,3 -> THR on right + ui->holdRightX->setChecked(true); + nodeLeft->setCenteringY(false); //mode 1,3 -> THR on right + ui->holdLeftY->setChecked(true); + nodeLeft->setCenteringX(false); //mode 1,3 -> THR on right + ui->holdLeftX->setChecked(true); + connect(joystick, SIGNAL(axisValueChanged(int, int)), this, SLOT(onjoystickAxisValueChanged(int, int))); + } + else { + QMessageBox::critical(this, tr("Warning"), tr("Cannot open joystick, joystick disabled")); + } + } + } + } +#endif + + txInterface = GetEepromInterface(); + + windowName = tr("Simulating Tx (%1)").arg(txInterface->getName()); + setWindowTitle(windowName); + + simulator = txInterface->getSimulator(); + lcd->setData(simulator->getLcd(), lcdWidth, 64, lcdDepth); + + if (flags & SIMULATOR_FLAGS_STICK_MODE_LEFT) { + nodeLeft->setCenteringY(false); + ui->holdLeftY->setChecked(true); + } + else { + nodeRight->setCenteringY(false); + ui->holdRightY->setChecked(true); + } + + setTrims(); + + int outputs = std::min(16, txInterface->getCapability(Outputs)); + for (int i=0; isetText(RawSource(SOURCE_TYPE_CH, i).toString()); + channelsLayout->addWidget(label, line, column == 0 ? 0 : 5, 1, 1); + + QSlider * slider = new QSlider(tabWidget); + slider->setEnabled(false); + slider->setMaximumSize(QSize(16777215, 18)); + slider->setStyleSheet(QString::fromUtf8("QSlider::sub-page:horizontal:disabled {\n" + "border-color: #999;\n" + "}\n" + "\n" + "QSlider::add-page:horizontal:disabled {\n" + "border-color: #999;\n" + "}\n" + "\n" + "QSlider::handle:horizontal:disabled {\n" + "background: #0000CC;\n" + "border: 1px solid #aaa;\n" + "border-radius: 4px;\n" + "}")); + slider->setMinimum(-1024); + slider->setMaximum(1024); + slider->setPageStep(128); + slider->setTracking(false); + slider->setOrientation(Qt::Horizontal); + slider->setInvertedAppearance(false); + slider->setTickPosition(QSlider::TicksBelow); + channelSliders << slider; + channelsLayout->addWidget(slider, line, column == 0 ? 1 : 4, 1, 1); + + QLabel * value = new QLabel(tabWidget); + value->setMinimumSize(QSize(50, 0)); + value->setAlignment(Qt::AlignCenter); + channelValues << value; + channelsLayout->addWidget(value, line, column == 0 ? 2 : 3, 1, 1); + } + + int switches = txInterface->getCapability(LogicalSwitches); + for (int i=0; isetAutoFillBackground(true); + swtch->setFrameShape(QFrame::Panel); + swtch->setFrameShadow(QFrame::Raised); + swtch->setLineWidth(2); + QVBoxLayout * layout = new QVBoxLayout(swtch); + layout->setContentsMargins(2, 2, 2, 2); + QLabel * label = new QLabel(swtch); + label->setText(RawSwitch(SWITCH_TYPE_VIRTUAL, i+1).toString()); + label->setAlignment(Qt::AlignCenter); + logicalSwitchLabels << label; + layout->addWidget(label); + logicalSwitchesLayout->addWidget(swtch, i / (switches/2), i % (switches/2), 1, 1); + } + + if (flags & SIMULATOR_FLAGS_NOTX) { + ui->tabWidget->setCurrentIndex(1); + } + else { + ui->lcd->setFocus(); + } + + setupTimer(); +} + +void SimulatorDialog::onButtonPressed(int value) +{ + if (value == Qt::Key_Print) { + QSettings settings; + bool toclipboard = settings.value("snapshot_to_clipboard", false).toBool(); + QString fileName = ""; + if (!toclipboard) { + fileName = QString("screenshot-%1.png").arg(++screenshotIdx); + } + lcd->makeScreenshot(fileName); + } + else { + buttonPressed = value; + } +} + +void SimulatorDialog9X::setLightOn(bool enable) +{ + QString bg = ""; + if (enable) { + QStringList list; + list << "bl" << "gr" << "rd" << "or" << "yl"; + bg = QString("-") + list[backLight]; + } + ui->top->setStyleSheet(QString("background:url(:/images/9xdt.png%1);").arg(bg)); + ui->bottom->setStyleSheet(QString("background:url(:/images/9xdb%1.png);").arg(bg)); + ui->left->setStyleSheet(QString("background:url(:/images/9xdl%1.png);").arg(bg)); + ui->right->setStyleSheet(QString("background:url(:/images/9xdr%1.png);").arg(bg)); +} + +void SimulatorDialog9X::updateBeepButton() +{ + #define CBEEP_ON "QLabel { background-color: #FF364E }" + #define CBEEP_OFF "QLabel { }" + + if (beepVal) { + beepShow = 20; + } + + ui->label_beep->setStyleSheet(beepShow ? CBEEP_ON : CBEEP_OFF); + + if (beepShow) { + beepShow--; + } +} + +void SimulatorDialog::onTimerEvent() +{ + static unsigned int lcd_counter = 0; + if (!simulator->timer10ms()) { + QMessageBox::critical(this, "Companion", tr("Firmware %1 error: %2").arg(txInterface->getName()).arg(simulator->getError())); + timer->stop(); + return; + } + + getValues(); + + if (!(flags & SIMULATOR_FLAGS_NOTX) && tabWidget->currentIndex()==0) { + bool lightEnable; + if (simulator->lcdChanged(lightEnable)) { + lcd->onLcdChanged(lightEnable); + if (lightOn != lightEnable) { + setLightOn(lightEnable); + lightOn = lightEnable; + } + } + } + + if (!(lcd_counter++ % 5)) { + + setValues(); + + setTrims(); + + centerSticks(); + + updateBeepButton(); + + if (beepVal) { + beepVal = 0; + QApplication::beep(); + } + } +} + +void SimulatorDialog::centerSticks() +{ + if (leftStick->scene()) + nodeLeft->stepToCenter(); + + if (rightStick->scene()) + nodeRight->stepToCenter(); +} + +void SimulatorDialog::start(QByteArray & eeprom) +{ + simulator->start(eeprom, (flags & SIMULATOR_FLAGS_NOTX) ? false : true); +} + +void SimulatorDialog::start(const char * filename) +{ + simulator->start(filename); +} + +void SimulatorDialog::setTrims() +{ + Trims trims; + simulator->getTrims(trims); + + int trimMin = -125, trimMax = +125; + if (trims.extended) { + trimMin = -500; + trimMax = +500; + } + trimHLeft->setRange(trimMin, trimMax); trimHLeft->setValue(trims.values[0]); + trimVLeft->setRange(trimMin, trimMax); trimVLeft->setValue(trims.values[1]); + trimVRight->setRange(trimMin, trimMax); trimVRight->setValue(trims.values[2]); + trimHRight->setRange(trimMin, trimMax); trimHRight->setValue(trims.values[3]); +} + +void SimulatorDialog9X::getValues() +{ + TxInputs inputs = { + { + int(1024*nodeLeft->getX()), // LEFT HORZ + int(-1024*nodeLeft->getY()), // LEFT VERT + int(-1024*nodeRight->getY()), // RGHT VERT + int(1024*nodeRight->getX()) // RGHT HORZ + }, + + { + ui->dialP_1->value(), + ui->dialP_2->value(), + ui->dialP_3->value(), 0 + }, + + { + ui->switchTHR->isChecked(), + ui->switchRUD->isChecked(), + ui->switchELE->isChecked(), + ui->switchID2->isChecked() ? 1 : (ui->switchID1->isChecked() ? 0 : -1), + ui->switchAIL->isChecked(), + ui->switchGEA->isChecked(), + ui->switchTRN->isDown(), + 0, 0, 0 + }, + + { + buttonPressed == Qt::Key_Enter, + buttonPressed == Qt::Key_Escape, + buttonPressed == Qt::Key_Down, + buttonPressed == Qt::Key_Up, + buttonPressed == Qt::Key_Right, + buttonPressed == Qt::Key_Left, + }, + + middleButtonPressed + }; + + simulator->setValues(inputs); +} + +void SimulatorDialogTaranis::getValues() +{ + TxInputs inputs = { + { + int(1024*nodeLeft->getX()), // LEFT HORZ + int(-1024*nodeLeft->getY()), // LEFT VERT + int(-1024*nodeRight->getY()), // RGHT VERT + int(1024*nodeRight->getX()) // RGHT HORZ + }, + + { + -ui->dialP_1->value(), + ui->dialP_2->value(), + -ui->dialP_3->value(), + ui->dialP_4->value() + }, + + { + ui->switchA->value() - 1, + ui->switchB->value() - 1, + ui->switchC->value() - 1, + ui->switchD->value() - 1, + ui->switchE->value() - 1, + ui->switchF->value(), + ui->switchG->value() - 1, + ui->switchH->value(), 0, 0 + }, + + { + buttonPressed == Qt::Key_Menu, + buttonPressed == Qt::Key_Escape, + buttonPressed == Qt::Key_Enter, + buttonPressed == Qt::Key_PageDown, + buttonPressed == Qt::Key_Plus, + buttonPressed == Qt::Key_Minus + }, + + middleButtonPressed + }; + + simulator->setValues(inputs); +} + +inline int chVal(int val) +{ + return qMin(1024, qMax(-1024, val)); +} + +void SimulatorDialog::on_trimHLeft_valueChanged(int value) +{ + simulator->setTrim(0, value); +} + +void SimulatorDialog::on_trimVLeft_valueChanged(int value) +{ + simulator->setTrim(1, value); +} + +void SimulatorDialog::on_trimHRight_valueChanged(int value) +{ + simulator->setTrim(3, value); +} + +void SimulatorDialog::on_trimVRight_valueChanged(int value) +{ + simulator->setTrim(2, value); +} + +void SimulatorDialog::setValues() +{ + TxOutputs outputs; + simulator->getValues(outputs); + Trims trims; + simulator->getTrims(trims); + + for (int i=0; igetCapability(Outputs)); i++) { + channelSliders[i]->setValue(chVal(outputs.chans[i])); + channelValues[i]->setText(QString("%1").arg((qreal)outputs.chans[i]*100/1024, 0, 'f', 1)); + } + + leftXPerc->setText(QString("X %1%").arg((qreal)nodeLeft->getX()*100+trims.values[0]/5, 2, 'f', 0)); + leftYPerc->setText(QString("Y %1%").arg((qreal)nodeLeft->getY()*-100+trims.values[1]/5, 2, 'f', 0)); + + rightXPerc->setText(QString("X %1%").arg((qreal)nodeRight->getX()*100+trims.values[2]/5, 2, 'f', 0)); + rightYPerc->setText(QString("Y %1%").arg((qreal)nodeRight->getY()*-100+trims.values[3]/5, 2, 'f', 0)); + + QString CSWITCH_ON = "QLabel { background-color: #4CC417 }"; + QString CSWITCH_OFF = "QLabel { }"; + + for (int i=0; igetCapability(LogicalSwitches); i++) { + logicalSwitchLabels[i]->setStyleSheet(outputs.vsw[i] ? CSWITCH_ON : CSWITCH_OFF); + } + + if (outputs.beep) { + beepVal = outputs.beep; + } +} + +void SimulatorDialog::setupSticks() +{ + QGraphicsScene *leftScene = new QGraphicsScene(leftStick); + leftScene->setItemIndexMethod(QGraphicsScene::NoIndex); + leftStick->setScene(leftScene); + + // leftStick->scene()->addLine(0,10,20,30); + + QGraphicsScene *rightScene = new QGraphicsScene(rightStick); + rightScene->setItemIndexMethod(QGraphicsScene::NoIndex); + rightStick->setScene(rightScene); + + // rightStick->scene()->addLine(0,10,20,30); + + nodeLeft = new Node(); + nodeLeft->setPos(-GBALL_SIZE/2,-GBALL_SIZE/2); + nodeLeft->setBallSize(GBALL_SIZE); + leftScene->addItem(nodeLeft); + + nodeRight = new Node(); + nodeRight->setPos(-GBALL_SIZE/2,-GBALL_SIZE/2); + nodeRight->setBallSize(GBALL_SIZE); + rightScene->addItem(nodeRight); +} + +void SimulatorDialog::resizeEvent(QResizeEvent *event) +{ + if (leftStick->scene()) { + QRect qr = leftStick->contentsRect(); + qreal w = (qreal)qr.width() - GBALL_SIZE; + qreal h = (qreal)qr.height() - GBALL_SIZE; + qreal cx = (qreal)qr.width()/2; + qreal cy = (qreal)qr.height()/2; + leftStick->scene()->setSceneRect(-cx,-cy,w,h); + + QPointF p = nodeLeft->pos(); + p.setX(qMin(cx, qMax(p.x(), -cx))); + p.setY(qMin(cy, qMax(p.y(), -cy))); + nodeLeft->setPos(p); + } + + if (rightStick->scene()) { + QRect qr = rightStick->contentsRect(); + qreal w = (qreal)qr.width() - GBALL_SIZE; + qreal h = (qreal)qr.height() - GBALL_SIZE; + qreal cx = (qreal)qr.width()/2; + qreal cy = (qreal)qr.height()/2; + rightStick->scene()->setSceneRect(-cx,-cy,w,h); + + QPointF p = nodeRight->pos(); + p.setX(qMin(cx, qMax(p.x(), -cx))); + p.setY(qMin(cy, qMax(p.y(), -cy))); + nodeRight->setPos(p); + } + QDialog::resizeEvent(event); +} + +void SimulatorDialog::on_holdLeftX_clicked(bool checked) +{ + nodeLeft->setCenteringX(!checked); +} + +void SimulatorDialog::on_holdLeftY_clicked(bool checked) +{ + nodeLeft->setCenteringY(!checked); +} + +void SimulatorDialog::on_holdRightX_clicked(bool checked) +{ + nodeRight->setCenteringX(!checked); +} + +void SimulatorDialog::on_holdRightY_clicked(bool checked) +{ + nodeRight->setCenteringY(!checked); +} + +void SimulatorDialog::on_FixLeftX_clicked(bool checked) +{ + nodeLeft->setFixedX(checked); +} + +void SimulatorDialog::on_FixLeftY_clicked(bool checked) +{ + nodeLeft->setFixedY(checked); +} + +void SimulatorDialog::on_FixRightX_clicked(bool checked) +{ + nodeRight->setFixedX(checked); +} + +void SimulatorDialog::on_FixRightY_clicked(bool checked) +{ + nodeRight->setFixedY(checked); +} + +#ifdef JOYSTICKS +void SimulatorDialog::onjoystickAxisValueChanged(int axis, int value) +{ + int stick; + if (axis>=0 && axis<=8) { + stick=jsmap[axis]; + int stickval; + if (value>jscal[axis][1]) { + if ((jscal[axis][2]-jscal[axis][1])==0) + return; + stickval=(1024*(value-jscal[axis][1]))/(jscal[axis][2]-jscal[axis][1]); + } + else { + if ((jscal[axis][1]-jscal[axis][0])==0) + return; + stickval=(1024*(value-jscal[axis][1]))/(jscal[axis][1]-jscal[axis][0]); + } + if (jscal[axis][3]==1) { + stickval*=-1; + } + if (stick==1 || stick==2) { + float currX=nodeRight->getX(); + float currY=nodeRight->getY(); + if (stick==1 ) { + nodeRight->setPos(currX*100-10,-stickval*100/1024-10); + } + if (stick==2) { + nodeRight->setPos(stickval*100/1024-10,currY*100-10); + } + } + else if (stick==3 || stick==4) { + float currX=nodeLeft->getX(); + float currY=nodeLeft->getY(); + if (stick==3) { + nodeLeft->setPos(currX*100-10,-stickval*100/1024-10); + } + if (stick==4) { + nodeLeft->setPos(stickval*100/1024-10,currY*100-10); + } + } + + if (stick==5) { + dialP_1->setValue(stickval); + } + if (stick==6) { + dialP_2->setValue(stickval); + } + if (stick==7) { + dialP_3->setValue(stickval); + } + if (stick==8 && dialP_4) { + dialP_4->setValue(stickval); + } + } +} +#endif diff --git a/companion/src/simulator/simulatordialog.h b/companion/src/simulator/simulatordialog.h new file mode 100644 index 000000000..eb8c6b2e2 --- /dev/null +++ b/companion/src/simulator/simulatordialog.h @@ -0,0 +1,167 @@ +#ifndef SIMULATORDIALOG_H +#define SIMULATORDIALOG_H + +#include +#include "modeledit/node.h" +#include "eeprominterface.h" + +#ifdef JOYSTICKS +#include "joystick.h" +#endif + +#define TMR_OFF 0 +#define TMR_RUNNING 1 +#define TMR_BEEPING 2 +#define TMR_STOPPED 3 + +#define FLASH_DURATION 10 + +namespace Ui { + class SimulatorDialog9X; + class SimulatorDialogTaranis; +} + +// TODO rename + move? +class lcdWidget; +class mySlider; + +#define SIMULATOR_FLAGS_NOTX 1 +#define SIMULATOR_FLAGS_STICK_MODE_LEFT 2 + +class SimulatorDialog : public QDialog +{ + Q_OBJECT + + public: + explicit SimulatorDialog(QWidget * parent = NULL, unsigned int flags=0); + virtual ~SimulatorDialog(); + + void start(const char * filename); + void start(QByteArray & eeprom); + + protected: + template void initUi(T * ui); + virtual void setLightOn(bool enable) { } + virtual void updateBeepButton() { } + + unsigned int flags; + lcdWidget * lcd; + QGraphicsView * leftStick, * rightStick; + QDial * dialP_1, * dialP_2, * dialP_3, * dialP_4; + mySlider * trimHLeft, * trimVLeft, * trimHRight, * trimVRight; + QLabel * leftXPerc, * rightXPerc, * leftYPerc, * rightYPerc; + QTabWidget * tabWidget; + QGridLayout * logicalSwitchesLayout; + QGridLayout * channelsLayout; + QVector logicalSwitchLabels; + QVector channelSliders; + QVector channelValues; + + void init(); + Node *nodeLeft; + Node *nodeRight; + QTimer *timer; + QString windowName; + unsigned int backLight; + bool lightOn; + int switches; +#ifdef JOYSTICKS + Joystick *joystick; + int jscal[8][4]; + int jsmap[8]; +#endif + + EEPROMInterface *txInterface; + SimulatorInterface *simulator; + + void setupSticks(); + void setupTimer(); + void resizeEvent(QResizeEvent *event = 0); + + virtual void getValues() = 0; + void setValues(); + void centerSticks(); + // void timerTick(); + + bool keyState(EnumKeys key); + int getValue(qint8 i); + bool getSwitch(int swtch, bool nc, qint8 level=0); + void setTrims(); + + int beepVal; + + int lcdWidth; + int lcdDepth; + + protected: + virtual void closeEvent(QCloseEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void wheelEvent(QWheelEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + static int screenshotIdx; + int buttonPressed; + bool middleButtonPressed; + + private slots: + void onButtonPressed(int value); + void on_FixRightY_clicked(bool checked); + void on_FixRightX_clicked(bool checked); + void on_FixLeftY_clicked(bool checked); + void on_FixLeftX_clicked(bool checked); + void on_holdRightY_clicked(bool checked); + void on_holdRightX_clicked(bool checked); + void on_holdLeftY_clicked(bool checked); + void on_holdLeftX_clicked(bool checked); + void on_trimHLeft_valueChanged(int); + void on_trimVLeft_valueChanged(int); + void on_trimHRight_valueChanged(int); + void on_trimVRight_valueChanged(int); + void onTimerEvent(); + +#ifdef JOYSTICKS + void onjoystickAxisValueChanged(int axis, int value); +#endif + +}; + +class SimulatorDialog9X: public SimulatorDialog +{ + Q_OBJECT + + public: + explicit SimulatorDialog9X(QWidget * parent = NULL, unsigned int flags=0); + virtual ~SimulatorDialog9X(); + + protected: + virtual void getValues(); + virtual void setLightOn(bool enable); + virtual void updateBeepButton(); + + private slots: + void dialChanged(); + + private: + Ui::SimulatorDialog9X * ui; + int beepShow; + +}; + +class SimulatorDialogTaranis: public SimulatorDialog +{ + Q_OBJECT + + public: + explicit SimulatorDialogTaranis(QWidget * parent = NULL, unsigned int flags=0); + virtual ~SimulatorDialogTaranis(); + + protected: + virtual void getValues(); + + private: + Ui::SimulatorDialogTaranis * ui; + +}; + +#endif // SIMULATORDIALOG_H diff --git a/companion/src/simulatorimport.h b/companion/src/simulator/simulatorimport.h similarity index 100% rename from companion/src/simulatorimport.h rename to companion/src/simulator/simulatorimport.h diff --git a/companion/src/simulatorinterface.h b/companion/src/simulator/simulatorinterface.h similarity index 92% rename from companion/src/simulatorinterface.h rename to companion/src/simulator/simulatorinterface.h index 42798335a..2b2e76187 100644 --- a/companion/src/simulatorinterface.h +++ b/companion/src/simulator/simulatorinterface.h @@ -47,7 +47,9 @@ class SimulatorInterface { public: - virtual void start(RadioData &radioData, bool tests) = 0; + virtual void start(QByteArray & eeprom, bool tests=true) = 0; + + virtual void start(const char * filename, bool tests=true) = 0; virtual void stop() = 0; diff --git a/companion/src/xcursorwidget.h b/companion/src/simulator/xcursorwidget.h similarity index 100% rename from companion/src/xcursorwidget.h rename to companion/src/simulator/xcursorwidget.h diff --git a/companion/src/xmenuwidget.h b/companion/src/simulator/xmenuwidget.h similarity index 100% rename from companion/src/xmenuwidget.h rename to companion/src/simulator/xmenuwidget.h diff --git a/companion/src/simulatordialog.cpp b/companion/src/simulatordialog.cpp deleted file mode 100644 index 8a26c0ecb..000000000 --- a/companion/src/simulatordialog.cpp +++ /dev/null @@ -1,744 +0,0 @@ -#include "simulatordialog.h" -#include "ui_simulatordialog.h" -#include -#include "helpers.h" -#include "simulatorinterface.h" -#ifdef JOYSTICKS -#include "joystick.h" -#endif - -#define GBALL_SIZE 20 -#define RESX 1024 -#define W 128 -#define H 64 - -int simulatorDialog::screenshotIdx = 0; -uint32_t simulatorDialog::switchstatus = 0; - - -simulatorDialog::simulatorDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::simulatorDialog), - timer(NULL), - txInterface(NULL), - simulator(NULL), - g_modelIdx(-1), - buttonPressed(0), - middleButtonPressed(false) -{ - ui->setupUi(this); - ui->lcd->setFocus(); - - beepVal = 0; - beepShow = 0; - - QSettings settings; - backLight = settings.value("backLight",0).toInt(); - bool simuSW=settings.value("simuSW",false).toBool(); - switch (backLight) { - case 1: - ui->lcd->setBackgroundColor(166,247,159); - break; - case 2: - ui->lcd->setBackgroundColor(247,159,166); - break; - case 3: - ui->lcd->setBackgroundColor(255,195,151); - break; - case 4: - ui->lcd->setBackgroundColor(247,242,159); - break; - default: - ui->lcd->setBackgroundColor(159,165,247); - break; - } - lightOn=NULL; - setupSticks(); - resize(0, 0); // to force min height, min width - this->setFixedSize(this->width(),this->height()); - if (simuSW) { - ui->switchAIL->setChecked(switchstatus & 0x1); - switchstatus >>=1; - ui->switchELE->setChecked(switchstatus & 0x1); - switchstatus >>=1; - ui->switchGEA->setChecked(switchstatus & 0x1); - switchstatus >>=1; - ui->switchID0->setChecked(switchstatus & 0x1); - switchstatus >>=1; - ui->switchID1->setChecked(switchstatus & 0x1); - switchstatus >>=1; - ui->switchID2->setChecked(switchstatus & 0x1); - switchstatus >>=1; - ui->switchRUD->setChecked(switchstatus & 0x1); - switchstatus >>=1; - ui->switchTHR->setChecked(switchstatus & 0x1); - } - -#ifdef JOYSTICKS - bool js_enable=settings.value("js_support",false).toBool(); - int js_ctrl=settings.value("js_ctrl",-1).toInt(); - if (js_enable) { - settings.beginGroup("JsCalibration"); - int count=0; - for (int j=0; j<8;j++){ - int axe=settings.value(QString("stick%1_axe").arg(j),-1).toInt(); - if (axe>=0 && axe<8) { - jsmap[axe]=j; - jscal[axe][0]=settings.value(QString("stick%1_min").arg(j),-32767).toInt(); - jscal[axe][1]=settings.value(QString("stick%1_med").arg(j),0).toInt(); - jscal[axe][2]=settings.value(QString("stick%1_max").arg(j),0).toInt(); - jscal[axe][3]=settings.value(QString("stick%1_inv").arg(j),0).toInt(); - count++; - } - } - settings.endGroup(); - if (count<3) { - QMessageBox::critical(this, tr("Warning"), tr("Joystick enabled but not configured correctly")); - } - if (js_ctrl!=-1) { - joystick = new Joystick(this); - if (joystick) { - if (joystick->open(js_ctrl)) { - int numAxes=std::min(joystick->numAxes,8); - for (int j=0; jsensitivities[j] = 0; - joystick->deadzones[j]=0; - } - nodeRight->setCenteringY(false); //mode 1,3 -> THR on right - ui->holdRightY->setChecked(true); - nodeRight->setCenteringX(false); //mode 1,3 -> THR on right - ui->holdRightX->setChecked(true); - nodeLeft->setCenteringY(false); //mode 1,3 -> THR on right - ui->holdLeftY->setChecked(true); - nodeLeft->setCenteringX(false); //mode 1,3 -> THR on right - ui->holdLeftX->setChecked(true); - connect(joystick, SIGNAL(axisValueChanged(int, int)), this, SLOT(onjoystickAxisValueChanged(int, int))); - } - else { - QMessageBox::critical(this, tr("Warning"), tr("Cannot open joystick, joystick disabled")); - } - } - } - } -#endif - connect(ui->dialP_1,SIGNAL(valueChanged(int)),this,SLOT(dialChanged())); - connect(ui->dialP_2,SIGNAL(valueChanged(int)),this,SLOT(dialChanged())); - connect(ui->dialP_3,SIGNAL(valueChanged(int)),this,SLOT(dialChanged())); - - connect(ui->cursor, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); - connect(ui->menu, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); -} - -simulatorDialog::~simulatorDialog() -{ - delete timer; - delete ui; -} - -void simulatorDialog::closeEvent (QCloseEvent *) -{ - simulator->stop(); - timer->stop(); -} - -void simulatorDialog::mousePressEvent(QMouseEvent *event) -{ - if (event->button() == Qt::MidButton) - middleButtonPressed = true; -} - -void simulatorDialog::dialChanged() -{ - ui->dialP_1value->setText(QString("%1 %").arg((ui->dialP_1->value()*100)/1024)); - ui->dialP_2value->setText(QString("%1 %").arg((ui->dialP_2->value()*100)/1024)); - ui->dialP_3value->setText(QString("%1 %").arg((ui->dialP_3->value()*100)/1024)); -} - -void simulatorDialog::mouseReleaseEvent(QMouseEvent *event) -{ - if (event->button() == Qt::MidButton) - middleButtonPressed = false; -} - -void simulatorDialog::wheelEvent (QWheelEvent *event) -{ - simulator->wheelEvent(event->delta() > 0 ? 1 : -1); -} - -void simulatorDialog::keyPressEvent (QKeyEvent *event) -{ - switch (event->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - buttonPressed = Qt::Key_Enter; - break; - case Qt::Key_Escape: - case Qt::Key_Backspace: - buttonPressed = Qt::Key_Escape; - break; - case Qt::Key_Up: - case Qt::Key_Down: - case Qt::Key_Right: - case Qt::Key_Left: - buttonPressed = event->key(); - break; - } -} - -void simulatorDialog::keyReleaseEvent(QKeyEvent * event) -{ - switch (event->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_Escape: - case Qt::Key_Backspace: - case Qt::Key_Up: - case Qt::Key_Down: - case Qt::Key_Right: - case Qt::Key_Left: - buttonPressed = 0; - break; - } -} - -void simulatorDialog::setupTimer() -{ - timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(onTimerEvent())); - timer->start(10); -} - -void simulatorDialog::onButtonPressed(int value) -{ - if (value==Qt::Key_Print) { - QSettings settings; - bool toclipboard=settings.value("snapshot_to_clipboard", false).toBool(); - QString fileName =""; - if (!toclipboard) { - fileName = QString("screenshot-%1.png").arg(++screenshotIdx); - } - ui->lcd->makeScreenshot(fileName); - } else { - buttonPressed = value; - } -} - -void simulatorDialog::onTimerEvent() -{ - static unsigned int lcd_counter = 0; - if (!simulator->timer10ms()) { - QMessageBox::critical(this, "Companion", QString(tr("Firmware %1 error: %2")).arg(txInterface->getName()).arg(simulator->getError())); - timer->stop(); - return; - } - - getValues(); - - if (g_modelIdx >= 0) { - ModelData *model = & g_radioData.models[g_modelIdx]; - setWindowTitle(windowName + (txInterface->getCapability(FlightPhases) ? tr(" - Flight mode: %1(%2)").arg(model->phaseData[simulator->getPhase()].name).arg(simulator->getPhase()) : "")); -/* TODO + QString(" - Timer: (%3, %4) %1:%2") .arg(abs( - -s_timerVal) / 60, 2, 10, QChar('0')).arg(abs(-s_timerVal) % 60, 2, 10, - QChar('0')) .arg(getTimerMode(model->timers[0].mode)) // TODO why timers[0] - .arg(model->timers[0].dir ? "Count Up" : "Count Down")); */ - } - else if (ui->tabWidget->currentIndex() == 0) { - bool lightEnable; - if (simulator->lcdChanged(lightEnable)) { - ui->lcd->onLcdChanged(lightEnable); - if (lightOn!=lightEnable) { - if (lightEnable) { - switch (backLight) { - case 1: - ui->top->setStyleSheet("background:url(:/images/9xdt-gr.png);"); - ui->bottom->setStyleSheet("background:url(:/images/9xdb-gr.png);"); - ui->left->setStyleSheet("background:url(:/images/9xdl-gr.png);"); - ui->right->setStyleSheet("background:url(:/images/9xdr-gr.png);"); - break; - case 2: - ui->top->setStyleSheet("background:url(:/images/9xdt-rd.png);"); - ui->bottom->setStyleSheet("background:url(:/images/9xdb-rd.png);"); - ui->left->setStyleSheet("background:url(:/images/9xdl-rd.png);"); - ui->right->setStyleSheet("background:url(:/images/9xdr-rd.png);"); - break; - case 3: - ui->top->setStyleSheet("background:url(:/images/9xdt-or.png);"); - ui->bottom->setStyleSheet("background:url(:/images/9xdb-or.png);"); - ui->left->setStyleSheet("background:url(:/images/9xdl-or.png);"); - ui->right->setStyleSheet("background:url(:/images/9xdr-or.png);"); - break; - case 4: - ui->top->setStyleSheet("background:url(:/images/9xdt-yl.png);"); - ui->bottom->setStyleSheet("background:url(:/images/9xdb-yl.png);"); - ui->left->setStyleSheet("background:url(:/images/9xdl-yl.png);"); - ui->right->setStyleSheet("background:url(:/images/9xdr-yl.png);"); - break; - default: - ui->top->setStyleSheet("background:url(:/images/9xdt-bl.png);"); - ui->bottom->setStyleSheet("background:url(:/images/9xdb-bl.png);"); - ui->left->setStyleSheet("background:url(:/images/9xdl-bl.png);"); - ui->right->setStyleSheet("background:url(:/images/9xdr-bl.png);"); - break; - } - } else { - ui->top->setStyleSheet("background:url(:/images/9xdt.png);"); - ui->bottom->setStyleSheet("background:url(:/images/9xdb.png);"); - ui->left->setStyleSheet("background:url(:/images/9xdl.png);"); - ui->right->setStyleSheet("background:url(:/images/9xdr.png);"); - } - lightOn=lightEnable; - } - } - } - - if (!(lcd_counter++ % 5)) { - - setValues(); - - setTrims(); - - centerSticks(); - - if (beepVal) { - beepVal = 0; - QApplication::beep(); - } - -#define CBEEP_ON "QLabel { background-color: #FF364E }" -#define CBEEP_OFF "QLabel { }" - - ui->label_beep->setStyleSheet(beepShow ? CBEEP_ON : CBEEP_OFF); - if (beepShow) { - beepShow--; - } - } -} - -void simulatorDialog::centerSticks() -{ - if(ui->leftStick->scene()) nodeLeft->stepToCenter(); - if(ui->rightStick->scene()) nodeRight->stepToCenter(); -} - -void simulatorDialog::loadParams(RadioData &radioData, const int model_idx) -{ - g_modelIdx = model_idx; - - txInterface = GetEepromInterface(); - simulator = txInterface->getSimulator(); - - g_radioData = radioData; - - if (model_idx < 0) { - windowName = QString(tr("Simulating Tx (%1)").arg(txInterface->getName())); - ui->lcd->setData(simulator->getLcd(), W, H); - } - else { - ui->tabWidget->removeTab(0); - g_radioData.generalSettings.currModel = model_idx; - windowName = tr("Simulating ") + g_radioData.models[model_idx].name; - } - - setWindowTitle(windowName); - - if (g_radioData.generalSettings.stickMode & 1) - { - nodeLeft->setCenteringY(false); //mode 1,3 -> THR on left - ui->holdLeftY->setChecked(true); - } - else - { - nodeRight->setCenteringY(false); //mode 1,3 -> THR on right - ui->holdRightY->setChecked(true); - } - - setTrims(); - - beepVal = 0; - beepShow = 0; - switches=txInterface->getCapability(LogicalSwitches); - if ( switches < 13) { - ui->cswitch_13->hide(); - ui->labelCSW_13->hide(); - ui->cswitch_14->hide(); - ui->labelCSW_14->hide(); - ui->cswitch_15->hide(); - ui->labelCSW_15->hide(); - } - if ( switches < 16) { - ui->cswitch_16->hide(); - ui->labelCSW_16->hide(); - ui->cswitch_17->hide(); - ui->labelCSW_17->hide(); - ui->cswitch_18->hide(); - ui->labelCSW_18->hide(); - ui->cswitch_19->hide(); - ui->labelCSW_19->hide(); - ui->cswitch_20->hide(); - ui->labelCSW_20->hide(); - ui->cswitch_21->hide(); - ui->labelCSW_21->hide(); - ui->cswitch_22->hide(); - ui->labelCSW_22->hide(); - ui->cswitch_23->hide(); - ui->labelCSW_23->hide(); - ui->cswitch_24->hide(); - ui->labelCSW_24->hide(); - ui->cswitch_25->hide(); - ui->labelCSW_25->hide(); - ui->cswitch_26->hide(); - ui->labelCSW_26->hide(); - ui->cswitch_27->hide(); - ui->labelCSW_27->hide(); - ui->cswitch_28->hide(); - ui->labelCSW_28->hide(); - ui->cswitch_29->hide(); - ui->labelCSW_29->hide(); - ui->cswitch_30->hide(); - ui->labelCSW_30->hide(); - ui->cswitch_31->hide(); - ui->labelCSW_31->hide(); - ui->cswitch_32->hide(); - ui->labelCSW_32->hide(); - } - - simulator->start(g_radioData, model_idx<0); - - setupTimer(); -} - -void simulatorDialog::setTrims() -{ - Trims trims; - simulator->getTrims(trims); - - int trimMin = -125, trimMax = +125; - if (trims.extended) { - trimMin = -500; - trimMax = +500; - } - ui->trimHLeft->setRange(trimMin, trimMax); ui->trimHLeft->setValue(trims.values[0]); - ui->trimVLeft->setRange(trimMin, trimMax); ui->trimVLeft->setValue(trims.values[1]); - ui->trimVRight->setRange(trimMin, trimMax); ui->trimVRight->setValue(trims.values[2]); - ui->trimHRight->setRange(trimMin, trimMax); ui->trimHRight->setValue(trims.values[3]); -} - -void simulatorDialog::getValues() -{ - TxInputs inputs = {{ int(1024*nodeLeft->getX()), // LEFT HORZ - int(-1024*nodeLeft->getY()), // LEFT VERT - int(-1024*nodeRight->getY()), // RGHT VERT - int(1024*nodeRight->getX()) }, // RGHT HORZ - { ui->dialP_1->value(), - ui->dialP_2->value(), - ui->dialP_3->value(), 0 }, - { ui->switchTHR->isChecked(), - ui->switchRUD->isChecked(), - ui->switchELE->isChecked(), - ui->switchID2->isChecked() ? 1 : (ui->switchID1->isChecked() ? 0 : -1), - ui->switchAIL->isChecked(), - ui->switchGEA->isChecked(), - ui->switchTRN->isDown(), - 0, 0, 0 }, - { buttonPressed == Qt::Key_Enter, - buttonPressed == Qt::Key_Escape, - buttonPressed == Qt::Key_Down, - buttonPressed == Qt::Key_Up, - buttonPressed == Qt::Key_Right, - buttonPressed == Qt::Key_Left, - }, - middleButtonPressed - }; - - simulator->setValues(inputs); - switchstatus=ui->switchTHR->isChecked(); - switchstatus<<=1; - switchstatus+=(ui->switchRUD->isChecked()&0x1); - switchstatus<<=1; - switchstatus+=(ui->switchID2->isChecked()&0x1); - switchstatus<<=1; - switchstatus+=(ui->switchID1->isChecked()&0x1); - switchstatus<<=1; - switchstatus+=(ui->switchID0->isChecked()&0x1); - switchstatus<<=1; - switchstatus+=(ui->switchGEA->isChecked()&0x1); - switchstatus<<=1; - switchstatus+=(ui->switchELE->isChecked()&0x1); - switchstatus<<=1; - switchstatus+=(ui->switchAIL->isChecked()&0x1); -} - -inline int chVal(int val) -{ - return qMin(1024, qMax(-1024, val)); -} - -void simulatorDialog::on_trimHLeft_valueChanged(int value) -{ - simulator->setTrim(0, value); -} - -void simulatorDialog::on_trimVLeft_valueChanged(int value) -{ - simulator->setTrim(1, value); -} - -void simulatorDialog::on_trimHRight_valueChanged(int value) -{ - simulator->setTrim(3, value); -} - -void simulatorDialog::on_trimVRight_valueChanged(int value) -{ - simulator->setTrim(2, value); -} - -void simulatorDialog::setValues() -{ - TxOutputs outputs; - simulator->getValues(outputs); - Trims trims; - simulator->getTrims(trims); - - ui->chnout_1->setValue(chVal(outputs.chans[0])); - ui->chnout_2->setValue(chVal(outputs.chans[1])); - ui->chnout_3->setValue(chVal(outputs.chans[2])); - ui->chnout_4->setValue(chVal(outputs.chans[3])); - ui->chnout_5->setValue(chVal(outputs.chans[4])); - ui->chnout_6->setValue(chVal(outputs.chans[5])); - ui->chnout_7->setValue(chVal(outputs.chans[6])); - ui->chnout_8->setValue(chVal(outputs.chans[7])); - if (txInterface->getCapability(Outputs) > 8) { - ui->chnout_9->setValue(chVal(outputs.chans[8])); - ui->chnout_10->setValue(chVal(outputs.chans[9])); - ui->chnout_11->setValue(chVal(outputs.chans[10])); - ui->chnout_12->setValue(chVal(outputs.chans[11])); - ui->chnout_13->setValue(chVal(outputs.chans[12])); - ui->chnout_14->setValue(chVal(outputs.chans[13])); - ui->chnout_15->setValue(chVal(outputs.chans[14])); - ui->chnout_16->setValue(chVal(outputs.chans[15])); - } - - ui->chnoutV_1->setText(QString("%1").arg((qreal)outputs.chans[0]*100/1024, 0, 'f', 1)); - ui->chnoutV_2->setText(QString("%1").arg((qreal)outputs.chans[1]*100/1024, 0, 'f', 1)); - ui->chnoutV_3->setText(QString("%1").arg((qreal)outputs.chans[2]*100/1024, 0, 'f', 1)); - ui->chnoutV_4->setText(QString("%1").arg((qreal)outputs.chans[3]*100/1024, 0, 'f', 1)); - ui->chnoutV_5->setText(QString("%1").arg((qreal)outputs.chans[4]*100/1024, 0, 'f', 1)); - ui->chnoutV_6->setText(QString("%1").arg((qreal)outputs.chans[5]*100/1024, 0, 'f', 1)); - ui->chnoutV_7->setText(QString("%1").arg((qreal)outputs.chans[6]*100/1024, 0, 'f', 1)); - ui->chnoutV_8->setText(QString("%1").arg((qreal)outputs.chans[7]*100/1024, 0, 'f', 1)); - if (txInterface->getCapability(Outputs) > 8) { - ui->chnoutV_9->setText(QString("%1").arg((qreal)outputs.chans[8]*100/1024, 0, 'f', 1)); - ui->chnoutV_10->setText(QString("%1").arg((qreal)outputs.chans[9]*100/1024, 0, 'f', 1)); - ui->chnoutV_11->setText(QString("%1").arg((qreal)outputs.chans[10]*100/1024, 0, 'f', 1)); - ui->chnoutV_12->setText(QString("%1").arg((qreal)outputs.chans[11]*100/1024, 0, 'f', 1)); - ui->chnoutV_13->setText(QString("%1").arg((qreal)outputs.chans[12]*100/1024, 0, 'f', 1)); - ui->chnoutV_14->setText(QString("%1").arg((qreal)outputs.chans[13]*100/1024, 0, 'f', 1)); - ui->chnoutV_15->setText(QString("%1").arg((qreal)outputs.chans[14]*100/1024, 0, 'f', 1)); - ui->chnoutV_16->setText(QString("%1").arg((qreal)outputs.chans[15]*100/1024, 0, 'f', 1)); - } - - ui->leftXPerc->setText(QString("X %1%").arg((qreal)nodeLeft->getX()*100+trims.values[0]/5, 2, 'f', 0)); - ui->leftYPerc->setText(QString("Y %1%").arg((qreal)nodeLeft->getY()*-100+trims.values[1]/5, 2, 'f', 0)); - - ui->rightXPerc->setText(QString("X %1%").arg((qreal)nodeRight->getX()*100+trims.values[2]/5, 2, 'f', 0)); - ui->rightYPerc->setText(QString("Y %1%").arg((qreal)nodeRight->getY()*-100+trims.values[3]/5, 2, 'f', 0)); - -#define CSWITCH_ON "QLabel { background-color: #4CC417 }" -#define CSWITCH_OFF "QLabel { }" - - ui->labelCSW_1->setStyleSheet(outputs.vsw[0] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_2->setStyleSheet(outputs.vsw[1] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_3->setStyleSheet(outputs.vsw[2] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_4->setStyleSheet(outputs.vsw[3] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_5->setStyleSheet(outputs.vsw[4] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_6->setStyleSheet(outputs.vsw[5] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_7->setStyleSheet(outputs.vsw[6] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_8->setStyleSheet(outputs.vsw[7] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_9->setStyleSheet(outputs.vsw[8] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_10->setStyleSheet(outputs.vsw[9] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_11->setStyleSheet(outputs.vsw[10] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_12->setStyleSheet(outputs.vsw[11] ? CSWITCH_ON : CSWITCH_OFF); - if (switches > 12) { - ui->labelCSW_13->setStyleSheet(outputs.vsw[12] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_14->setStyleSheet(outputs.vsw[13] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_15->setStyleSheet(outputs.vsw[14] ? CSWITCH_ON : CSWITCH_OFF); - } - if (switches > 15) { - ui->labelCSW_16->setStyleSheet(outputs.vsw[15] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_17->setStyleSheet(outputs.vsw[16] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_18->setStyleSheet(outputs.vsw[17] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_19->setStyleSheet(outputs.vsw[18] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_20->setStyleSheet(outputs.vsw[19] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_21->setStyleSheet(outputs.vsw[20] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_22->setStyleSheet(outputs.vsw[21] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_23->setStyleSheet(outputs.vsw[22] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_24->setStyleSheet(outputs.vsw[23] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_25->setStyleSheet(outputs.vsw[24] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_26->setStyleSheet(outputs.vsw[25] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_27->setStyleSheet(outputs.vsw[26] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_28->setStyleSheet(outputs.vsw[27] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_29->setStyleSheet(outputs.vsw[28] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_30->setStyleSheet(outputs.vsw[29] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_31->setStyleSheet(outputs.vsw[30] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_32->setStyleSheet(outputs.vsw[31] ? CSWITCH_ON : CSWITCH_OFF); - } - if (outputs.beep) { - beepVal = outputs.beep; - beepShow=20; - } -} - -void simulatorDialog::setupSticks() -{ - QGraphicsScene *leftScene = new QGraphicsScene(ui->leftStick); - leftScene->setItemIndexMethod(QGraphicsScene::NoIndex); - ui->leftStick->setScene(leftScene); - - // ui->leftStick->scene()->addLine(0,10,20,30); - - QGraphicsScene *rightScene = new QGraphicsScene(ui->rightStick); - rightScene->setItemIndexMethod(QGraphicsScene::NoIndex); - ui->rightStick->setScene(rightScene); - - // ui->rightStick->scene()->addLine(0,10,20,30); - - nodeLeft = new Node(); - nodeLeft->setPos(-GBALL_SIZE/2,-GBALL_SIZE/2); - nodeLeft->setBallSize(GBALL_SIZE); - leftScene->addItem(nodeLeft); - - nodeRight = new Node(); - nodeRight->setPos(-GBALL_SIZE/2,-GBALL_SIZE/2); - nodeRight->setBallSize(GBALL_SIZE); - rightScene->addItem(nodeRight); -} - -void simulatorDialog::resizeEvent(QResizeEvent *event) -{ - - if(ui->leftStick->scene()) - { - QRect qr = ui->leftStick->contentsRect(); - qreal w = (qreal)qr.width() - GBALL_SIZE; - qreal h = (qreal)qr.height() - GBALL_SIZE; - qreal cx = (qreal)qr.width()/2; - qreal cy = (qreal)qr.height()/2; - ui->leftStick->scene()->setSceneRect(-cx,-cy,w,h); - - QPointF p = nodeLeft->pos(); - p.setX(qMin(cx, qMax(p.x(), -cx))); - p.setY(qMin(cy, qMax(p.y(), -cy))); - nodeLeft->setPos(p); - } - - if(ui->rightStick->scene()) - { - QRect qr = ui->rightStick->contentsRect(); - qreal w = (qreal)qr.width() - GBALL_SIZE; - qreal h = (qreal)qr.height() - GBALL_SIZE; - qreal cx = (qreal)qr.width()/2; - qreal cy = (qreal)qr.height()/2; - ui->rightStick->scene()->setSceneRect(-cx,-cy,w,h); - - QPointF p = nodeRight->pos(); - p.setX(qMin(cx, qMax(p.x(), -cx))); - p.setY(qMin(cy, qMax(p.y(), -cy))); - nodeRight->setPos(p); - } - QDialog::resizeEvent(event); -} - -void simulatorDialog::on_holdLeftX_clicked(bool checked) -{ - nodeLeft->setCenteringX(!checked); -} - -void simulatorDialog::on_holdLeftY_clicked(bool checked) -{ - nodeLeft->setCenteringY(!checked); -} - -void simulatorDialog::on_holdRightX_clicked(bool checked) -{ - nodeRight->setCenteringX(!checked); -} - -void simulatorDialog::on_holdRightY_clicked(bool checked) -{ - nodeRight->setCenteringY(!checked); -} - - -void simulatorDialog::on_FixLeftX_clicked(bool checked) -{ - nodeLeft->setFixedX(checked); -} - -void simulatorDialog::on_FixLeftY_clicked(bool checked) -{ - nodeLeft->setFixedY(checked); -} - -void simulatorDialog::on_FixRightX_clicked(bool checked) -{ - nodeRight->setFixedX(checked); -} - -void simulatorDialog::on_FixRightY_clicked(bool checked) -{ - nodeRight->setFixedY(checked); -} - -#ifdef JOYSTICKS -void simulatorDialog::onjoystickAxisValueChanged(int axis, int value) { - int stick; - if (axis>=0 && axis<8) { - stick=jsmap[axis]; - int stickval; - if (value>jscal[axis][1]) { - if ((jscal[axis][2]-jscal[axis][1])==0) - return; - stickval=(1024*(value-jscal[axis][1]))/(jscal[axis][2]-jscal[axis][1]); - } - else { - if ((jscal[axis][1]-jscal[axis][0])==0) - return; - stickval=(1024*(value-jscal[axis][1]))/(jscal[axis][1]-jscal[axis][0]); - } - if (jscal[axis][3]==1) { - stickval*=-1; - } - if (stick==1 || stick==2) { - float currX=nodeRight->getX(); - float currY=nodeRight->getY(); - if (stick==1 ) { - nodeRight->setPos(currX*100-10,-stickval*100/1024-10); - } - if (stick==2) { - nodeRight->setPos(stickval*100/1024-10,currY*100-10); - } - } else if (stick==3 || stick==4) { - float currX=nodeLeft->getX(); - float currY=nodeLeft->getY(); - if (stick==3) { - nodeLeft->setPos(currX*100-10,-stickval*100/1024-10); - } - if (stick==4) { - nodeLeft->setPos(stickval*100/1024-10,currY*100-10); - } - } - - - if (stick==5) { - ui->dialP_1->setValue(stickval); - } - if (stick==6) { - ui->dialP_2->setValue(stickval); - } - if (stick==7) { - ui->dialP_3->setValue(stickval); - } - } -} -#endif diff --git a/companion/src/simulatordialog.h b/companion/src/simulatordialog.h deleted file mode 100644 index 65edcb9e5..000000000 --- a/companion/src/simulatordialog.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef SIMULATORDIALOG_H -#define SIMULATORDIALOG_H - -#include -#include "modeledit/node.h" -#include "eeprominterface.h" -#ifdef JOYSTICKS -#include "joystick.h" -#endif - -#define TMR_OFF 0 -#define TMR_RUNNING 1 -#define TMR_BEEPING 2 -#define TMR_STOPPED 3 - -#define FLASH_DURATION 10 - -namespace Ui { - class simulatorDialog; -} - -class simulatorDialog : public QDialog -{ - Q_OBJECT - -public: - explicit simulatorDialog(QWidget *parent = 0); - ~simulatorDialog(); - - void loadParams(RadioData &radioData, const int model_idx=-1); - -private: - Ui::simulatorDialog *ui; - Node *nodeLeft; - Node *nodeRight; - QTimer *timer; - QString windowName; - int backLight; - bool lightOn; - int switches; -#ifdef JOYSTICKS - Joystick *joystick; - int jscal[8][4]; - int jsmap[8]; -#endif - - - /* quint16 s_timeCumTot; - quint16 s_timeCumAbs; - quint16 s_timeCumSw; - quint16 s_timeCumThr; - quint16 s_timeCum16ThrP; - quint8 s_timerState; - quint8 beepAgain; - quint16 g_LightOffCounter; - qint16 s_timerVal; - quint16 s_time; - quint16 s_cnt; - quint16 s_sum; - quint8 sw_toggled; */ - - EEPROMInterface *txInterface; - SimulatorInterface *simulator; - RadioData g_radioData; - int g_modelIdx; - - void setupSticks(); - void setupTimer(); - void resizeEvent(QResizeEvent *event = 0); - - void getValues(); - void setValues(); - void centerSticks(); - // void timerTick(); - - bool keyState(EnumKeys key); - int getValue(qint8 i); - bool getSwitch(int swtch, bool nc, qint8 level=0); - void setTrims(); - - int beepVal; - int beepShow; - -protected: - virtual void closeEvent(QCloseEvent *); - virtual void mousePressEvent(QMouseEvent *); - virtual void mouseReleaseEvent(QMouseEvent *); - virtual void wheelEvent(QWheelEvent *); - virtual void keyPressEvent(QKeyEvent *); - virtual void keyReleaseEvent(QKeyEvent *); - static int screenshotIdx; - static uint32_t switchstatus; - int buttonPressed; - bool middleButtonPressed; - -private slots: - void onButtonPressed(int value); - void on_FixRightY_clicked(bool checked); - void on_FixRightX_clicked(bool checked); - void on_FixLeftY_clicked(bool checked); - void on_FixLeftX_clicked(bool checked); - void on_holdRightY_clicked(bool checked); - void on_holdRightX_clicked(bool checked); - void on_holdLeftY_clicked(bool checked); - void on_holdLeftX_clicked(bool checked); - void on_trimHLeft_valueChanged(int); - void on_trimVLeft_valueChanged(int); - void on_trimHRight_valueChanged(int); - void on_trimVRight_valueChanged(int); - void onTimerEvent(); - void dialChanged(); -#ifdef JOYSTICKS - void onjoystickAxisValueChanged(int axis, int value); -#endif - -}; - -#endif // SIMULATORDIALOG_H diff --git a/companion/src/simulatordialog.ui b/companion/src/simulatordialog.ui deleted file mode 100644 index 06fc4655e..000000000 --- a/companion/src/simulatordialog.ui +++ /dev/null @@ -1,3716 +0,0 @@ - - - simulatorDialog - - - - 0 - 0 - 653 - 590 - - - - - 0 - 0 - - - - - 739 - 16777215 - - - - Companion Simulator - - - - :/icon.png:/icon.png - - - - 5 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 5 - - - 6 - - - - - - - Right Double Click to Reset - - - -125 - - - 125 - - - Qt::Vertical - - - - - - - - 220 - 220 - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - - - - - 0 - - - - - - 8 - - - - false - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - THR - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - RUD - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - ELE - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - AIL - - - true - - - - - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Hold X - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Fix X - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Fix Y - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Hold Y - - - true - - - - - - - - - 20 - - - 20 - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - - - Right Double Click to Reset - - - -125 - - - 125 - - - Qt::Horizontal - - - - - - - - - - - Right Double Click to Reset - - - -125 - - - 125 - - - Qt::Vertical - - - - - - - - 220 - 220 - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:pressed { - background-color: #4CC417; - border-style: inset; - } - - - TRN - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - GEA - - - true - - - false - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - ID0 - - - true - - - true - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - ID1 - - - true - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - ID2 - - - true - - - true - - - - - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Hold X - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Fix X - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Fix Y - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Hold Y - - - true - - - - - - - - - 20 - - - 20 - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - - - Right Double Click to Reset - - - -125 - - - 125 - - - Qt::Horizontal - - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - BEEP - - - Qt::AlignCenter - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - - 50 - 50 - - - - P1 - - - -1024 - - - 1024 - - - 128 - - - 64.000000000000000 - - - true - - - - - - - 0 % - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - - 50 - 50 - - - - P2 - - - -1024 - - - 1024 - - - 128 - - - false - - - 64.000000000000000 - - - true - - - - - - - 0 % - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - - 50 - 50 - - - - P3 - - - -1024 - - - 1024 - - - 128 - - - 64.000000000000000 - - - true - - - - - - - 0 % - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 570 - 5 - - - - - - - - true - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - 0 - - - - 9x Simulator - - - - - - QLayout::SetMinimumSize - - - 0 - - - - - - 0 - 0 - - - - - 256 - 29 - - - - background:url(:/images/9xdt.png) - - - - - - - - 0 - 0 - - - - - 41 - 186 - - - - background:url(:/images/9xdl.png) - - - - - - - - 0 - 0 - - - - - 89 - 186 - - - - background:url(:/images/9xmenu.png) - - - - - - - - 0 - 0 - - - - - 256 - 128 - - - - - - - - - 0 - 0 - - - - - 256 - 29 - - - - background:url(:/images/9xdb.png) - - - - - - - - 0 - 0 - - - - - 128 - 186 - - - - true - - - background:url(:/images/9xcurs.png); - - - - - - - - 0 - 0 - - - - - 55 - 186 - - - - background:url(:/images/9xdr.png) - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Horizontal - - - - 438 - 6 - - - - - - - - - - - Outputs - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS1 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS2 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS3 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS4 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS5 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS6 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS7 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS8 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS9 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSA - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSB - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSC - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSD - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSE - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSF - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSG - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSH - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSI - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSJ - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSK - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSL - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSM - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSN - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSO - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSP - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSQ - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSR - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSS - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LST - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSU - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSV - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSW - - - Qt::AlignCenter - - - - - - - - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - - - CH1 - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH9 - - - - - - - - 0 - 0 - - - - CH2 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH10 - - - - - - - - 0 - 0 - - - - CH3 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH11 - - - - - - - - 0 - 0 - - - - CH4 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH12 - - - - - - - - 0 - 0 - - - - CH5 - - - - - - - false - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH13 - - - - - - - - 0 - 0 - - - - CH6 - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH14 - - - - - - - - 0 - 0 - - - - CH7 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH15 - - - - - - - - 0 - 0 - - - - CH8 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH16 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - - - - - - - lcdWidget - QWidget -
lcdwidget.h
- 1 -
- - cursorWidget - QWidget -
cursorwidget.h
- 1 -
- - menuWidget - QWidget -
menuwidget.h
- 1 -
- - mySlider - QSlider -
myslider.h
-
-
- - - - -
diff --git a/companion/src/xsimulatordialog.cpp b/companion/src/xsimulatordialog.cpp deleted file mode 100644 index 07524bb04..000000000 --- a/companion/src/xsimulatordialog.cpp +++ /dev/null @@ -1,638 +0,0 @@ -#include "xsimulatordialog.h" -#include "ui_xsimulatordialog.h" -#include -#include "helpers.h" -#include "simulatorinterface.h" -#ifdef JOYSTICKS -#include "joystick.h" -#endif - -#define GBALL_SIZE 20 -#define RESX 1024 -#define W 212 -#define H 64 - -int xsimulatorDialog::screenshotIdx = 0; -uint32_t xsimulatorDialog::xswitchstatus = 0; - -xsimulatorDialog::xsimulatorDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::xsimulatorDialog), - timer(NULL), - lightOn(false), - txInterface(NULL), - simulator(NULL), - g_modelIdx(-1), - beepVal(0), - beepShow(0), - buttonPressed(0) -{ - ui->setupUi(this); - ui->lcd->setFocus(); - - QSettings settings; - ui->lcd->setBackgroundColor(47, 123, 227); - setupSticks(); - resize(0, 0); // to force min height, min width - this->setFixedSize(this->width(), this->height()); - bool simuSW=settings.value("simuSW",false).toBool(); -#ifdef JOYSTICKS - bool js_enable=settings.value("js_support",false).toBool(); - int js_ctrl=settings.value("js_ctrl",-1).toInt(); - if (js_enable) { - settings.beginGroup("JsCalibration"); - int count=0; - for (int j=0; j<8;j++){ - int axe=settings.value(QString("stick%1_axe").arg(j),-1).toInt(); - if (axe>=0 && axe<8) { - jsmap[axe]=j; - jscal[axe][0]=settings.value(QString("stick%1_min").arg(j),-32767).toInt(); - jscal[axe][1]=settings.value(QString("stick%1_med").arg(j),0).toInt(); - jscal[axe][2]=settings.value(QString("stick%1_max").arg(j),0).toInt(); - jscal[axe][3]=settings.value(QString("stick%1_inv").arg(j),0).toInt(); - count++; - } - } - settings.endGroup(); - if (count<3) { - QMessageBox::critical(this, tr("Warning"), tr("Joystick enabled but not configured correctly")); - } - if (js_ctrl!=-1) { - joystick = new Joystick(this); - if (joystick) { - if (joystick->open(js_ctrl)) { - int numAxes=std::min(joystick->numAxes,8); - for (int j=0; jsensitivities[j] = 0; - joystick->deadzones[j]=0; - } - nodeRight->setCenteringY(false); //mode 1,3 -> THR on right - ui->holdRightY->setChecked(true); - nodeRight->setCenteringX(false); //mode 1,3 -> THR on right - ui->holdRightX->setChecked(true); - nodeLeft->setCenteringY(false); //mode 1,3 -> THR on right - ui->holdLeftY->setChecked(true); - nodeLeft->setCenteringX(false); //mode 1,3 -> THR on right - ui->holdLeftX->setChecked(true); - connect(joystick, SIGNAL(axisValueChanged(int, int)), this, SLOT(onjoystickAxisValueChanged(int, int))); - } - else { - QMessageBox::critical(this, tr("Warning"), tr("Cannot open joystick, joystick disabled")); - } - } - } - } -#endif - if (simuSW) { - ui->switchH->setValue(xswitchstatus & 0x3); - xswitchstatus>>=2; - ui->switchG->setValue(xswitchstatus & 0x3); - xswitchstatus>>=2; - ui->switchF->setValue(xswitchstatus & 0x3); - xswitchstatus>>=2; - ui->switchE->setValue(xswitchstatus & 0x3); - xswitchstatus>>=2; - ui->switchD->setValue(xswitchstatus & 0x3); - xswitchstatus>>=2; - ui->switchC->setValue(xswitchstatus & 0x3); - xswitchstatus>>=2; - ui->switchB->setValue(xswitchstatus & 0x3); - xswitchstatus>>=2; - ui->switchA->setValue(xswitchstatus & 0x3); - } - connect(ui->cursor, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); - connect(ui->menu, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); -} - -xsimulatorDialog::~xsimulatorDialog() -{ - delete timer; - delete ui; -} - -void xsimulatorDialog::closeEvent (QCloseEvent *) -{ - simulator->stop(); - timer->stop(); -} - -void xsimulatorDialog::mousePressEvent(QMouseEvent *event) -{ - if (event->button() == Qt::MidButton) - middleButtonPressed = true; -} - -void xsimulatorDialog::mouseReleaseEvent(QMouseEvent *event) -{ - if (event->button() == Qt::MidButton) - middleButtonPressed = false; -} - -void xsimulatorDialog::wheelEvent (QWheelEvent *event) -{ - simulator->wheelEvent(event->delta() > 0 ? 1 : -1); -} - -void xsimulatorDialog::keyPressEvent (QKeyEvent *event) -{ - switch (event->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - buttonPressed = Qt::Key_Enter; - break; - case Qt::Key_Escape: - case Qt::Key_Backspace: - buttonPressed = Qt::Key_Escape; - break; - case Qt::Key_Minus: - case Qt::Key_Plus: - case Qt::Key_PageDown: - case Qt::Key_Menu: - buttonPressed = event->key(); - break; - } -} - -void xsimulatorDialog::keyReleaseEvent(QKeyEvent * event) -{ - switch (event->key()) { - case Qt::Key_Enter: - case Qt::Key_Return: - case Qt::Key_Escape: - case Qt::Key_Backspace: - case Qt::Key_Plus: - case Qt::Key_Minus: - case Qt::Key_PageDown: - case Qt::Key_Menu: - buttonPressed = 0; - break; - } -} - -void xsimulatorDialog::setupTimer() -{ - timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(onTimerEvent())); - timer->start(10); -} - -void xsimulatorDialog::onButtonPressed(int value) -{ - if (value==Qt::Key_Print) { - QSettings settings; - bool toclipboard=settings.value("snapshot_to_clipboard", false).toBool(); - QString fileName =""; - if (!toclipboard) { - fileName = QString("screenshot-%1.png").arg(++screenshotIdx); - } - ui->lcd->makeScreenshot(fileName); - } else { - buttonPressed = value; - } -} - -void xsimulatorDialog::onTimerEvent() -{ - static unsigned int lcd_counter = 0; - - if (!simulator->timer10ms()) { - QMessageBox::critical(this, "companion", tr("Firmware %1 error: %2").arg(txInterface->getName()).arg(simulator->getError())); - timer->stop(); - return; - } - - getValues(); - - if (g_modelIdx >= 0) { - ModelData *model = & g_radioData.models[g_modelIdx]; - setWindowTitle(windowName + (txInterface->getCapability(FlightPhases) ? tr(" - Flight mode: %1(%2)").arg(model->phaseData[simulator->getPhase()].name).arg(simulator->getPhase()) : "")); - } - else if (ui->tabWidget->currentIndex() == 0) { - bool lightEnable; - if (simulator->lcdChanged(lightEnable)) { - ui->lcd->onLcdChanged(lightEnable); - if (lightOn!=lightEnable) { - lightOn=lightEnable; - } - } - } - - if (!(lcd_counter++ % 5)) { - - setValues(); - - setTrims(); - - centerSticks(); - - if (beepVal) { - beepVal = 0; - QApplication::beep(); - } - -#define CBEEP_ON "QLabel { background-color: #FF364E }" -#define CBEEP_OFF "QLabel { }" - - if (beepShow) { - beepShow--; - } - } -} - -void xsimulatorDialog::centerSticks() -{ - if(ui->leftStick->scene()) nodeLeft->stepToCenter(); - if(ui->rightStick->scene()) nodeRight->stepToCenter(); -} - -void xsimulatorDialog::loadParams(RadioData &radioData, const int model_idx) -{ - g_modelIdx = model_idx; - - txInterface = GetEepromInterface(); - simulator = txInterface->getSimulator(); - - g_radioData = radioData; - - if (model_idx < 0) { - windowName = QString(tr("Simulating Tx (%1)").arg(txInterface->getName())); - ui->lcd->setData(simulator->getLcd(), W, H, 4); - } - else { - ui->tabWidget->removeTab(0); - g_radioData.generalSettings.currModel = model_idx; - windowName = tr("Simulating ") + g_radioData.models[model_idx].name; - } - - setWindowTitle(windowName); - - if (g_radioData.generalSettings.stickMode & 1) - { - nodeLeft->setCenteringY(false); //mode 1,3 -> THR on left - ui->holdLeftY->setChecked(true); - } - else - { - nodeRight->setCenteringY(false); //mode 1,3 -> THR on right - ui->holdRightY->setChecked(true); - } - - setTrims(); - - beepVal = 0; - beepShow = 0; - - simulator->start(g_radioData, model_idx<0); - - setupTimer(); -} - -void xsimulatorDialog::setTrims() -{ - Trims trims; - simulator->getTrims(trims); - - int trimMin = -125, trimMax = +125; - if (trims.extended) { - trimMin = -500; - trimMax = +500; - } - ui->trimHLeft->setRange(trimMin, trimMax); ui->trimHLeft->setValue(trims.values[0]); - ui->trimVLeft->setRange(trimMin, trimMax); ui->trimVLeft->setValue(trims.values[1]); - ui->trimVRight->setRange(trimMin, trimMax); ui->trimVRight->setValue(trims.values[2]); - ui->trimHRight->setRange(trimMin, trimMax); ui->trimHRight->setValue(trims.values[3]); -} - -void xsimulatorDialog::getValues() -{ - TxInputs inputs = {{ int(1024*nodeLeft->getX()), // LEFT HORZ - int(-1024*nodeLeft->getY()), // LEFT VERT - int(-1024*nodeRight->getY()), // RGHT VERT - int(1024*nodeRight->getX()) }, // RGHT HORZ - { -ui->dialP_1->value(), - ui->dialP_2->value(), - -ui->dialP_3->value(), - ui->dialP_4->value() }, - { ui->switchA->value() - 1, - ui->switchB->value() - 1, - ui->switchC->value() - 1, - ui->switchD->value() - 1, - ui->switchE->value() - 1, - ui->switchF->value(), - ui->switchG->value() - 1, - ui->switchH->value(), 0, 0 }, - { - buttonPressed == Qt::Key_Menu, - buttonPressed == Qt::Key_Escape, - buttonPressed == Qt::Key_Enter, - buttonPressed == Qt::Key_PageDown, - buttonPressed == Qt::Key_Plus, - buttonPressed == Qt::Key_Minus }, - middleButtonPressed - }; - - simulator->setValues(inputs); - xswitchstatus=ui->switchA->value(); - xswitchstatus<<=2; - xswitchstatus+=ui->switchB->value(); - xswitchstatus<<=2; - xswitchstatus+=ui->switchC->value(); - xswitchstatus<<=2; - xswitchstatus+=ui->switchD->value(); - xswitchstatus<<=2; - xswitchstatus+=ui->switchE->value(); - xswitchstatus<<=2; - xswitchstatus+=ui->switchF->value(); - xswitchstatus<<=2; - xswitchstatus+=ui->switchG->value(); - xswitchstatus<<=2; - xswitchstatus+=ui->switchH->value(); -} - -inline int chVal(int val) -{ - return qMin(1024, qMax(-1024, val)); -} - -void xsimulatorDialog::on_switchH_sliderReleased() -{ - QTimer::singleShot(400, this, SLOT(resetTrn())); -} - -void xsimulatorDialog::on_trimHLeft_valueChanged(int value) -{ - simulator->setTrim(0, value); -} - -void xsimulatorDialog::on_trimVLeft_valueChanged(int value) -{ - simulator->setTrim(1, value); -} - -void xsimulatorDialog::on_trimHRight_valueChanged(int value) -{ - simulator->setTrim(3, value); -} - -void xsimulatorDialog::on_trimVRight_valueChanged(int value) -{ - simulator->setTrim(2, value); -} - -void xsimulatorDialog::setValues() -{ - TxOutputs outputs; - simulator->getValues(outputs); - - Trims trims; - simulator->getTrims(trims); - - ui->chnout_1->setValue(chVal(outputs.chans[0])); - ui->chnout_2->setValue(chVal(outputs.chans[1])); - ui->chnout_3->setValue(chVal(outputs.chans[2])); - ui->chnout_4->setValue(chVal(outputs.chans[3])); - ui->chnout_5->setValue(chVal(outputs.chans[4])); - ui->chnout_6->setValue(chVal(outputs.chans[5])); - ui->chnout_7->setValue(chVal(outputs.chans[6])); - ui->chnout_8->setValue(chVal(outputs.chans[7])); - if (txInterface->getCapability(Outputs) > 8) { - ui->chnout_9->setValue(chVal(outputs.chans[8])); - ui->chnout_10->setValue(chVal(outputs.chans[9])); - ui->chnout_11->setValue(chVal(outputs.chans[10])); - ui->chnout_12->setValue(chVal(outputs.chans[11])); - ui->chnout_13->setValue(chVal(outputs.chans[12])); - ui->chnout_14->setValue(chVal(outputs.chans[13])); - ui->chnout_15->setValue(chVal(outputs.chans[14])); - ui->chnout_16->setValue(chVal(outputs.chans[15])); - } - - ui->chnoutV_1->setText(QString("%1").arg((qreal)outputs.chans[0]*100/1024, 0, 'f', 1)); - ui->chnoutV_2->setText(QString("%1").arg((qreal)outputs.chans[1]*100/1024, 0, 'f', 1)); - ui->chnoutV_3->setText(QString("%1").arg((qreal)outputs.chans[2]*100/1024, 0, 'f', 1)); - ui->chnoutV_4->setText(QString("%1").arg((qreal)outputs.chans[3]*100/1024, 0, 'f', 1)); - ui->chnoutV_5->setText(QString("%1").arg((qreal)outputs.chans[4]*100/1024, 0, 'f', 1)); - ui->chnoutV_6->setText(QString("%1").arg((qreal)outputs.chans[5]*100/1024, 0, 'f', 1)); - ui->chnoutV_7->setText(QString("%1").arg((qreal)outputs.chans[6]*100/1024, 0, 'f', 1)); - ui->chnoutV_8->setText(QString("%1").arg((qreal)outputs.chans[7]*100/1024, 0, 'f', 1)); - if (txInterface->getCapability(Outputs) > 8) { - ui->chnoutV_9->setText(QString("%1").arg((qreal)outputs.chans[8]*100/1024, 0, 'f', 1)); - ui->chnoutV_10->setText(QString("%1").arg((qreal)outputs.chans[9]*100/1024, 0, 'f', 1)); - ui->chnoutV_11->setText(QString("%1").arg((qreal)outputs.chans[10]*100/1024, 0, 'f', 1)); - ui->chnoutV_12->setText(QString("%1").arg((qreal)outputs.chans[11]*100/1024, 0, 'f', 1)); - ui->chnoutV_13->setText(QString("%1").arg((qreal)outputs.chans[12]*100/1024, 0, 'f', 1)); - ui->chnoutV_14->setText(QString("%1").arg((qreal)outputs.chans[13]*100/1024, 0, 'f', 1)); - ui->chnoutV_15->setText(QString("%1").arg((qreal)outputs.chans[14]*100/1024, 0, 'f', 1)); - ui->chnoutV_16->setText(QString("%1").arg((qreal)outputs.chans[15]*100/1024, 0, 'f', 1)); - } - - ui->leftXPerc->setText(QString("X %1%").arg((qreal)nodeLeft->getX()*100+trims.values[0]/5, 2, 'f', 0)); - ui->leftYPerc->setText(QString("Y %1%").arg((qreal)nodeLeft->getY()*-100+trims.values[1]/5, 2, 'f', 0)); - - ui->rightXPerc->setText(QString("X %1%").arg((qreal)nodeRight->getX()*100+trims.values[2]/5, 2, 'f', 0)); - ui->rightYPerc->setText(QString("Y %1%").arg((qreal)nodeRight->getY()*-100+trims.values[3]/5, 2, 'f', 0)); - -#define CSWITCH_ON "QLabel { background-color: #4CC417 }" -#define CSWITCH_OFF "QLabel { }" - - ui->labelCSW_1->setStyleSheet(outputs.vsw[0] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_2->setStyleSheet(outputs.vsw[1] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_3->setStyleSheet(outputs.vsw[2] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_4->setStyleSheet(outputs.vsw[3] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_5->setStyleSheet(outputs.vsw[4] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_6->setStyleSheet(outputs.vsw[5] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_7->setStyleSheet(outputs.vsw[6] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_8->setStyleSheet(outputs.vsw[7] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_9->setStyleSheet(outputs.vsw[8] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_10->setStyleSheet(outputs.vsw[9] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_11->setStyleSheet(outputs.vsw[10] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_12->setStyleSheet(outputs.vsw[11] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_13->setStyleSheet(outputs.vsw[12] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_14->setStyleSheet(outputs.vsw[13] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_15->setStyleSheet(outputs.vsw[14] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_16->setStyleSheet(outputs.vsw[15] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_17->setStyleSheet(outputs.vsw[16] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_18->setStyleSheet(outputs.vsw[17] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_19->setStyleSheet(outputs.vsw[18] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_20->setStyleSheet(outputs.vsw[19] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_21->setStyleSheet(outputs.vsw[20] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_22->setStyleSheet(outputs.vsw[21] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_23->setStyleSheet(outputs.vsw[22] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_24->setStyleSheet(outputs.vsw[23] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_25->setStyleSheet(outputs.vsw[24] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_26->setStyleSheet(outputs.vsw[25] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_27->setStyleSheet(outputs.vsw[26] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_28->setStyleSheet(outputs.vsw[27] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_29->setStyleSheet(outputs.vsw[28] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_30->setStyleSheet(outputs.vsw[29] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_31->setStyleSheet(outputs.vsw[30] ? CSWITCH_ON : CSWITCH_OFF); - ui->labelCSW_32->setStyleSheet(outputs.vsw[31] ? CSWITCH_ON : CSWITCH_OFF); - - if (outputs.beep) { - beepVal = outputs.beep; - beepShow=20; - } -} - -void xsimulatorDialog::setupSticks() -{ - QGraphicsScene *leftScene = new QGraphicsScene(ui->leftStick); - leftScene->setItemIndexMethod(QGraphicsScene::NoIndex); - ui->leftStick->setScene(leftScene); - - // ui->leftStick->scene()->addLine(0,10,20,30); - - QGraphicsScene *rightScene = new QGraphicsScene(ui->rightStick); - rightScene->setItemIndexMethod(QGraphicsScene::NoIndex); - ui->rightStick->setScene(rightScene); - - // ui->rightStick->scene()->addLine(0,10,20,30); - - nodeLeft = new Node(); - nodeLeft->setPos(-GBALL_SIZE/2,-GBALL_SIZE/2); - nodeLeft->setBallSize(GBALL_SIZE); - leftScene->addItem(nodeLeft); - - nodeRight = new Node(); - nodeRight->setPos(-GBALL_SIZE/2,-GBALL_SIZE/2); - nodeRight->setBallSize(GBALL_SIZE); - rightScene->addItem(nodeRight); -} - -void xsimulatorDialog::resizeEvent(QResizeEvent *event) -{ - - if(ui->leftStick->scene()) - { - QRect qr = ui->leftStick->contentsRect(); - qreal w = (qreal)qr.width() - GBALL_SIZE; - qreal h = (qreal)qr.height() - GBALL_SIZE; - qreal cx = (qreal)qr.width()/2; - qreal cy = (qreal)qr.height()/2; - ui->leftStick->scene()->setSceneRect(-cx,-cy,w,h); - - QPointF p = nodeLeft->pos(); - p.setX(qMin(cx, qMax(p.x(), -cx))); - p.setY(qMin(cy, qMax(p.y(), -cy))); - nodeLeft->setPos(p); - } - - if(ui->rightStick->scene()) - { - QRect qr = ui->rightStick->contentsRect(); - qreal w = (qreal)qr.width() - GBALL_SIZE; - qreal h = (qreal)qr.height() - GBALL_SIZE; - qreal cx = (qreal)qr.width()/2; - qreal cy = (qreal)qr.height()/2; - ui->rightStick->scene()->setSceneRect(-cx,-cy,w,h); - - QPointF p = nodeRight->pos(); - p.setX(qMin(cx, qMax(p.x(), -cx))); - p.setY(qMin(cy, qMax(p.y(), -cy))); - nodeRight->setPos(p); - } - QDialog::resizeEvent(event); -} - -void xsimulatorDialog::on_holdLeftX_clicked(bool checked) -{ - nodeLeft->setCenteringX(!checked); -} - -void xsimulatorDialog::on_holdLeftY_clicked(bool checked) -{ - nodeLeft->setCenteringY(!checked); -} - -void xsimulatorDialog::on_holdRightX_clicked(bool checked) -{ - nodeRight->setCenteringX(!checked); -} - -void xsimulatorDialog::on_holdRightY_clicked(bool checked) -{ - nodeRight->setCenteringY(!checked); -} - - -void xsimulatorDialog::on_FixLeftX_clicked(bool checked) -{ - nodeLeft->setFixedX(checked); -} - -void xsimulatorDialog::on_FixLeftY_clicked(bool checked) -{ - nodeLeft->setFixedY(checked); -} - -void xsimulatorDialog::on_FixRightX_clicked(bool checked) -{ - nodeRight->setFixedX(checked); -} - -void xsimulatorDialog::on_FixRightY_clicked(bool checked) -{ - nodeRight->setFixedY(checked); -} - -void xsimulatorDialog::resetTrn() -{ - ui->switchH->setValue(0); -} - - -#ifdef JOYSTICKS -void xsimulatorDialog::onjoystickAxisValueChanged(int axis, int value) { - int stick; - if (axis>=0 && axis<8) { - stick=jsmap[axis]; - int stickval; - if (value>jscal[axis][1]) { - if ((jscal[axis][2]-jscal[axis][1])==0) - return; - stickval=(1024*(value-jscal[axis][1]))/(jscal[axis][2]-jscal[axis][1]); - } - else { - if ((jscal[axis][1]-jscal[axis][0])==0) - return; - stickval=(1024*(value-jscal[axis][1]))/(jscal[axis][1]-jscal[axis][0]); - } - if (jscal[axis][3]==1) { - stickval*=-1; - } - if (stick==1 || stick==2) { - float currX=nodeRight->getX(); - float currY=nodeRight->getY(); - if (stick==1 ) { - nodeRight->setPos(currX*100-10,-stickval*100/1024-10); - } - if (stick==2) { - nodeRight->setPos(stickval*100/1024-10,currY*100-10); - } - } - else if (stick==3 || stick==4) { - float currX=nodeLeft->getX(); - float currY=nodeLeft->getY(); - if (stick==3) { - nodeLeft->setPos(currX*100-10,-stickval*100/1024-10); - } - if (stick==4) { - nodeLeft->setPos(stickval*100/1024-10,currY*100-10); - } - } - - - if (stick==5) { - ui->dialP_1->setValue(stickval); - } - if (stick==6) { - ui->dialP_2->setValue(stickval); - } - if (stick==7) { - ui->dialP_3->setValue(stickval); - } - if (stick==8) { - ui->dialP_4->setValue(stickval); - } - } -} -#endif diff --git a/companion/src/xsimulatordialog.h b/companion/src/xsimulatordialog.h deleted file mode 100644 index a78143fc7..000000000 --- a/companion/src/xsimulatordialog.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef XSIMULATORDIALOG_H -#define XSIMULATORDIALOG_H - -#include -#include "modeledit/node.h" -#include "eeprominterface.h" -#ifdef JOYSTICKS -#include "joystick.h" -#endif - -#define TMR_OFF 0 -#define TMR_RUNNING 1 -#define TMR_BEEPING 2 -#define TMR_STOPPED 3 - -#define FLASH_DURATION 10 -; - -namespace Ui { - class xsimulatorDialog; -} - -class xsimulatorDialog : public QDialog -{ - Q_OBJECT - -public: - explicit xsimulatorDialog(QWidget *parent = 0); - ~xsimulatorDialog(); - - void loadParams(RadioData &radioData, const int model_idx=-1); - -private: - Ui::xsimulatorDialog *ui; - Node *nodeLeft; - Node *nodeRight; - QTimer *timer; - QString windowName; - int backLight; - bool lightOn; -#ifdef JOYSTICKS - Joystick *joystick; - int jscal[8][4]; - int jsmap[8]; -#endif - - EEPROMInterface *txInterface; - SimulatorInterface *simulator; - RadioData g_radioData; - int g_modelIdx; - - void setupSticks(); - void setupTimer(); - void resizeEvent(QResizeEvent *event = 0); - - void getValues(); - void setValues(); - void centerSticks(); - // void timerTick(); - - bool keyState(EnumKeys key); - int getValue(qint8 i); - bool getSwitch(int swtch, bool nc, qint8 level=0); - void setTrims(); - - int beepVal; - int beepShow; - -protected: - virtual void closeEvent(QCloseEvent *); - virtual void mousePressEvent(QMouseEvent *); - virtual void mouseReleaseEvent(QMouseEvent *); - virtual void wheelEvent(QWheelEvent *); - virtual void keyPressEvent(QKeyEvent *); - virtual void keyReleaseEvent(QKeyEvent *); - static int screenshotIdx; - int buttonPressed; - bool middleButtonPressed; - static uint32_t xswitchstatus; - -private slots: - void onButtonPressed(int value); - void on_FixRightY_clicked(bool checked); - void on_FixRightX_clicked(bool checked); - void on_FixLeftY_clicked(bool checked); - void on_FixLeftX_clicked(bool checked); - void on_holdRightY_clicked(bool checked); - void on_holdRightX_clicked(bool checked); - void on_holdLeftY_clicked(bool checked); - void on_holdLeftX_clicked(bool checked); - void on_trimHLeft_valueChanged(int); - void on_trimVLeft_valueChanged(int); - void on_trimHRight_valueChanged(int); - void on_trimVRight_valueChanged(int); - void on_switchH_sliderReleased(); - void onTimerEvent(); - void resetTrn(); -#ifdef JOYSTICKS - void onjoystickAxisValueChanged(int axis, int value); -#endif - -}; - -#endif // SIMULATORDIALOG_H diff --git a/companion/src/xsimulatordialog.ui b/companion/src/xsimulatordialog.ui deleted file mode 100644 index b1b5b4859..000000000 --- a/companion/src/xsimulatordialog.ui +++ /dev/null @@ -1,3907 +0,0 @@ - - - xsimulatorDialog - - - - 0 - 0 - 705 - 665 - - - - - 0 - 0 - - - - - 739 - 16777215 - - - - Companion Simulator - - - - :/icon.png:/icon.png - - - - 5 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 5 - - - 6 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 245 - 245 - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Hold Y - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Fix Y - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Fix X - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Hold X - - - true - - - - - - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - SD - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - SC - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - - Qt::Horizontal - - - - 10 - 20 - - - - - - - - Right Double Click to Reset - - - -125 - - - 125 - - - Qt::Vertical - - - - - - - - - - 0 - 0 - - - - - 42 - 42 - - - - S2 - - - -1024 - - - 1024 - - - 128 - - - 64.000000000000000 - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - SG - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - false - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - - 42 - 42 - - - - RS - - - -1024 - - - 1024 - - - 128 - - - 64.000000000000000 - - - true - - - - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - SH - - - - - - 1 - - - 0 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - SC - - - Qt::AlignCenter - - - - - - - SD - - - Qt::AlignCenter - - - - - - - SG - - - Qt::AlignCenter - - - - - - - SH - - - Qt::AlignCenter - - - - - - - S2 - - - Qt::AlignCenter - - - - - - - RS - - - Qt::AlignCenter - - - - - - - Right Double Click to Reset - - - -125 - - - 125 - - - Qt::Horizontal - - - - - - - 20 - - - 20 - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Hold Y - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Fix Y - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Fix X - - - true - - - - - - - - 8 - - - - QPushButton { - background-color: #EEEEEE; - border-style: outset; - border-width: 1px; - border-radius: 4px; - border-color: black; - padding: 2px; - } - -QPushButton:checked { - background-color: #4CC417; - border-style: inset; - } - - - Hold X - - - true - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 42 - 42 - - - - S1 - - - -1024 - - - 1024 - - - 128 - - - 64.000000000000000 - - - true - - - - - - - 20 - - - 20 - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - TextLabel - - - Qt::AlignCenter - - - - - - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - SB - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 245 - 245 - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - SA - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - Right Double Click to Reset - - - -125 - - - 125 - - - Qt::Horizontal - - - - - - - - - - 0 - 0 - - - - Right Double Click to Reset - - - -125 - - - 125 - - - Qt::Vertical - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 5 - 20 - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - SE - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - SF - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - SF - - - SF - - - 1 - - - 1 - - - 0 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - - 42 - 42 - - - - LS - - - -1024 - - - 1024 - - - 128 - - - 64.000000000000000 - - - true - - - - - - - SA - - - Qt::AlignCenter - - - - - - - SB - - - Qt::AlignCenter - - - - - - - SE - - - Qt::AlignCenter - - - - - - - LS - - - Qt::AlignCenter - - - - - - - S1 - - - Qt::AlignCenter - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 570 - 5 - - - - - - - - true - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - 0 - - - - Taranis Simulator - - - - - - QLayout::SetMinimumSize - - - 0 - - - - - - 0 - 0 - - - - - 120 - 208 - - - - true - - - background:url(:/images/x9l0.png); - - - - - - - - 0 - 0 - - - - - 424 - 38 - - - - background:url(:/images/x9t0.png) - - - - - - - - 0 - 0 - - - - - 120 - 208 - - - - background:url(:/images/x9r0.png) - - - - - - - - 0 - 0 - - - - - 424 - 128 - - - - - - - - - 0 - 0 - - - - - 424 - 42 - - - - background:url(:/images/x9b0.png) - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Horizontal - - - - 438 - 6 - - - - - - - - - - - Outputs - - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - - - CH1 - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH9 - - - - - - - - 0 - 0 - - - - CH2 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH10 - - - - - - - - 0 - 0 - - - - CH3 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH11 - - - - - - - - 0 - 0 - - - - CH4 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH12 - - - - - - - - 0 - 0 - - - - CH5 - - - - - - - false - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH13 - - - - - - - - 0 - 0 - - - - CH6 - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH14 - - - - - - - - 0 - 0 - - - - CH7 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH15 - - - - - - - - 0 - 0 - - - - CH8 - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - -100.1 - - - Qt::AlignCenter - - - - - - - false - - - - 0 - 0 - - - - - 16777215 - 18 - - - - QSlider::sub-page:horizontal:disabled { -border-color: #999; -} - -QSlider::add-page:horizontal:disabled { -border-color: #999; -} - -QSlider::handle:horizontal:disabled { -background: #0000CC; -border: 1px solid #aaa; -border-radius: 4px; -} - - - -1024 - - - 1024 - - - 128 - - - false - - - Qt::Horizontal - - - false - - - QSlider::TicksBelow - - - - - - - - 0 - 0 - - - - CH16 - - - - - - - - - QLayout::SetDefaultConstraint - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSK - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSC - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSD - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS7 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSL - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSB - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS1 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSH - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSG - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSE - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSF - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS8 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS9 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSA - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSM - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSJ - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSI - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS4 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS5 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS2 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS3 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LS6 - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSN - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSO - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSP - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSQ - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSR - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSS - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LST - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSU - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSV - - - Qt::AlignCenter - - - - - - - - - - true - - - QFrame::Panel - - - QFrame::Raised - - - 2 - - - - 2 - - - - - LSW - - - Qt::AlignCenter - - - - - - - - - - - - - - - - - - - mySlider - QSlider -
myslider.h
-
- - xcursorWidget - QWidget -
xcursorwidget.h
- 1 -
- - xmenuWidget - QWidget -
xmenuwidget.h
- 1 -
- - lcdWidget - QWidget -
lcdwidget.h
- 1 -
-
- - - - -