From aec2170e7e6ee726badcca487e65a97acf735439 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Sun, 9 Aug 2015 22:32:17 +0200 Subject: [PATCH] Move to Qt5 and Qt5Multimedia --- .travis.yml | 5 +- CMakeLists.txt | 4 + cmake/FindSdl.cmake | 41 +++++----- companion/src/CMakeLists.txt | 63 +++++++-------- companion/src/appdata.cpp | 4 + companion/src/appdata.h | 1 + companion/src/apppreferencesdialog.cpp | 7 +- companion/src/burnconfigdialog.h | 3 +- companion/src/companion.cpp | 5 +- companion/src/companion.qrc | 2 +- companion/src/comparedialog.h | 3 +- companion/src/converteeprom.cpp | 2 +- companion/src/customizesplashdialog.h | 3 +- companion/src/downloaddialog.cpp | 2 - companion/src/downloaddialog.h | 3 +- companion/src/eeprominterface.cpp | 13 ++-- companion/src/eeprominterface.h | 5 +- .../src/firmwares/er9x/er9xinterface.cpp | 12 +-- .../firmwares/ersky9x/ersky9xinterface.cpp | 12 +-- .../firmwares/gruvin9x/gruvin9xinterface.cpp | 2 +- .../src/firmwares/opentx/opentxeeprom.cpp | 4 +- .../src/firmwares/opentx/opentxinterface.cpp | 6 +- .../firmwares/opentx/simulator/CMakeLists.txt | 36 ++++----- .../opentx/simulator/opentxsimulator.cpp | 2 +- .../src/firmwares/th9x/th9xinterface.cpp | 2 +- companion/src/flasheepromdialog.cpp | 4 +- companion/src/flasheepromdialog.h | 2 +- companion/src/flashfirmwaredialog.cpp | 1 - companion/src/flashfirmwaredialog.h | 3 +- companion/src/generaledit/CMakeLists.txt | 7 +- companion/src/generaledit/calibration.cpp | 2 +- companion/src/generaledit/generaledit.cpp | 15 ++-- companion/src/generaledit/generaledit.h | 2 +- companion/src/generaledit/generalsetup.cpp | 3 +- companion/src/helpers.cpp | 2 +- companion/src/helpers.h | 3 +- companion/src/logsdialog.cpp | 4 +- companion/src/mainwindow.h | 3 +- companion/src/mdichild.cpp | 10 +-- companion/src/modeledit/CMakeLists.txt | 7 +- companion/src/modeledit/channels.cpp | 8 +- companion/src/modeledit/channels.h | 1 - companion/src/modeledit/curves.cpp | 7 +- companion/src/modeledit/curves.h | 1 - companion/src/modeledit/customfunctions.cpp | 76 +++++++++---------- companion/src/modeledit/customfunctions.h | 28 ++----- companion/src/modeledit/expodialog.cpp | 2 +- companion/src/modeledit/expodialog.h | 2 +- companion/src/modeledit/flightmodes.cpp | 7 +- companion/src/modeledit/flightmodes.h | 6 -- companion/src/modeledit/inputs.cpp | 16 ++-- companion/src/modeledit/logicalswitches.cpp | 6 -- companion/src/modeledit/logicalswitches.h | 3 - companion/src/modeledit/mixerdialog.cpp | 3 +- companion/src/modeledit/mixerdialog.h | 2 +- companion/src/modeledit/mixerslist.h | 3 +- companion/src/modeledit/mixes.cpp | 2 - companion/src/modeledit/modeledit.cpp | 1 - companion/src/modeledit/modeledit.h | 2 +- companion/src/modeledit/node.h | 2 +- companion/src/modeledit/setup.cpp | 6 +- companion/src/modeledit/setup.h | 6 -- companion/src/modeledit/telemetry.cpp | 2 +- companion/src/modeledit/telemetry.h | 3 - companion/src/modeledit/templates.cpp | 2 - companion/src/modeledit/templates.h | 2 +- companion/src/modelprinter.cpp | 46 +++++------ companion/src/modelslist.h | 2 +- companion/src/printdialog.h | 2 +- companion/src/process_sync.h | 1 + companion/src/qcustomplot/CMakeLists.txt | 3 +- companion/src/qcustomplot/qcustomplot.h | 10 +-- .../src/qxtcommandoptions/CMakeLists.txt | 4 +- companion/src/shared/CMakeLists.txt | 5 +- companion/src/shared/autolineedit.h | 2 +- companion/src/simulation/CMakeLists.txt | 5 +- companion/src/simulation/buttonswidget.h | 1 + companion/src/simulation/debugoutput.cpp | 3 - companion/src/simulation/debugoutput.h | 3 +- companion/src/simulation/joystick.cpp | 26 ++++--- companion/src/simulation/joystick.h | 2 +- companion/src/simulation/joystickdialog.cpp | 1 - companion/src/simulation/joystickdialog.h | 2 +- companion/src/simulation/simulatordialog.h | 1 - companion/src/simulation/sliderwidget.h | 1 + companion/src/simulation/telemetrysimu.cpp | 2 +- companion/src/simulator.cpp | 11 ++- companion/src/splashlabel.h | 7 +- companion/src/splashlibrarydialog.cpp | 1 - companion/src/splashlibrarydialog.h | 3 +- companion/src/wizarddialog.cpp | 5 +- companion/src/wizarddialog.h | 11 +-- companion/targets/windows/companion-vs.nsi.in | 73 +++++++++--------- companion/targets/windows/winbuild.h | 1 + radio/src/CMakeLists.txt | 2 + radio/util/commit-tests.sh | 25 +++--- radio/util/generate_datacopy.py | 18 +++-- radio/util/img2lbm.py | 5 +- 98 files changed, 355 insertions(+), 438 deletions(-) diff --git a/.travis.yml b/.travis.yml index ab5e33d1fc..c8d72a9142 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,14 @@ before_install: - sudo add-apt-repository ppa:george-edison55/precise-backports --yes - sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded --yes - sudo add-apt-repository ppa:ubuntu-toolchain-r/test --yes + - sudo add-apt-repository ppa:beineri/opt-qt551 --yes - sudo add-apt-repository 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main' --yes - wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - - - sudo apt-get update + - sudo apt-get update -qq - rsync -av firmware.diydrones.com::Tools/Travis/*.deb ExtraPackages install: - - sudo apt-get install -y xvfb lcov cmake cmake-data bc curl gcc-arm-none-eabi libqtcore4 libqt4-dev qt4-qmake g++-5 libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libphonon-dev phonon libqtwebkit-dev python-qt4 python-qt4-dev libfox-1.6-dev libgtest-dev python-clang-3.8 libclang-3.8-dev + - sudo apt-get install -y xvfb lcov cmake cmake-data bc curl gcc-arm-none-eabi qt-latest g++-5 libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libfox-1.6-dev libgtest-dev python-clang-3.8 libclang-3.8-dev python-qt4 - sudo dpkg -i ExtraPackages/*.deb || echo "FAILED INSTALL OF EXTRA DEBS" - export CXX="g++-5" CC="gcc-5" diff --git a/CMakeLists.txt b/CMakeLists.txt index a66dca88d7..b80be1c873 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,10 @@ set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_SUFFI message(STATUS "OpenTX ${VERSION}") cmake_minimum_required(VERSION 2.8) +cmake_policy(SET CMP0020 NEW) +cmake_policy(SET CMP0023 OLD) +cmake_policy(SET CMP0043 NEW) + set(CMAKE_CXX_STANDARD 11) set(RADIO_DIRECTORY ${PROJECT_SOURCE_DIR}/radio) diff --git a/cmake/FindSdl.cmake b/cmake/FindSdl.cmake index 37e5824e96..c60b01f8f3 100644 --- a/cmake/FindSdl.cmake +++ b/cmake/FindSdl.cmake @@ -4,25 +4,25 @@ # SDL_FOUND, if false, do not try to link to SDL # SDL_INCLUDE_DIR, where to find SDL.h # -# Don't forget to include SDLmain.h and SDLmain.m your project for the +# Don't forget to include SDLmain.h and SDLmain.m your project for the # OS X framework based version. (Other versions link to -lSDLmain which -# this module will try to find on your behalf.) Also for OS X, this +# this module will try to find on your behalf.) Also for OS X, this # module will automatically add the -framework Cocoa on your behalf. # $SDLDIR is an environment variable that would # correspond to the ./configure --prefix=$SDLDIR # used in building SDL. # l.e.galup 9-20-02 # -# Modified by Eric Wing. -# Added new modifications to recognize OS X frameworks and -# additional Unix paths (FreeBSD, etc). +# Modified by Eric Wing. +# Added new modifications to recognize OS X frameworks and +# additional Unix paths (FreeBSD, etc). # Also corrected the header search path to follow "proper" SDL guidelines. # Added a search for SDLmain which is needed by some platforms. # Added a search for threads which is needed by some platforms. # Added needed compile switches for MinGW. # # On OSX, this will prefer the Framework version (if found) over others. -# People will have to manually change the cache values of +# People will have to manually change the cache values of # SDL_LIBRARY to override this selection. # # Note that the header path has changed from SDL/SDL.h to just SDL.h @@ -46,14 +46,14 @@ FIND_PATH(SDL_INCLUDE_DIR SDL.h /opt/local/include/SDL # DarwinPorts /opt/local/include /opt/csw/include/SDL # Blastwave - /opt/csw/include + /opt/csw/include /opt/include/SDL /opt/include C:/Programs/SDL/include ) -# I'm not sure if I should do a special casing for Apple. It is +# I'm not sure if I should do a special casing for Apple. It is # unlikely that other Unix systems will find the framework path. -# But if they do ([Next|Open|GNU]Step?), +# But if they do ([Next|Open|GNU]Step?), # do they want the -framework option also? IF(${SDL_INCLUDE_DIR} MATCHES ".framework") # The Cocoa framework must be linked into SDL because SDL is Cocoa based. @@ -83,7 +83,7 @@ IF(${SDL_INCLUDE_DIR} MATCHES ".framework") ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework") # SDL-1.1 is the name used by FreeBSD ports... # don't confuse it for the version number. - FIND_LIBRARY(SDL_LIBRARY_TEMP + FIND_LIBRARY(SDL_LIBRARY_TEMP NAMES SDL SDL-1.1 PATHS $ENV{SDLDIR}/lib @@ -93,13 +93,13 @@ ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework") /opt/local/lib /opt/csw/lib /opt/lib - C:/Programs/SDL/lib + C:/Programs/SDL/lib/x86 ) - # Non-OS X framework versions expect you to also dynamically link to - # SDLmain. This is mainly for Windows and OS X. Other platforms + # Non-OS X framework versions expect you to also dynamically link to + # SDLmain. This is mainly for Windows and OS X. Other platforms # seem to provide SDLmain for compatibility even though they don't # necessarily need it. - FIND_LIBRARY(SDLMAIN_LIBRARY + FIND_LIBRARY(SDLMAIN_LIBRARY NAMES SDLmain SDLmain-1.1 PATHS $ENV{SDLDIR}/lib @@ -109,13 +109,12 @@ ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework") /opt/local/lib /opt/csw/lib /opt/lib - C:/Programs/SDL/lib ) ENDIF(${SDL_INCLUDE_DIR} MATCHES ".framework") # SDL may require threads on your system. -# The Apple build may not need an explicit flag because one of the -# frameworks may already provide it. +# The Apple build may not need an explicit flag because one of the +# frameworks may already provide it. # But for non-OSX systems, I will use the CMake Threads package. IF(NOT APPLE) FIND_PACKAGE(Threads) @@ -136,14 +135,14 @@ IF(SDL_LIBRARY_TEMP) ENDIF(SDLMAIN_LIBRARY) # For OS X, SDL uses Cocoa as a backend so it must link to Cocoa. - # CMake doesn't display the -framework Cocoa string in the UI even - # though it actually is there. I think it has something to do + # CMake doesn't display the -framework Cocoa string in the UI even + # though it actually is there. I think it has something to do # with the CACHE STRING. Maybe somebody else knows how to fix this. # The problem is mainly cosmetic, and not a functional issue. IF(APPLE) SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa") ENDIF(APPLE) - + # For threads, as mentioned Apple doesn't need this. # In fact, there seems to be a problem if Find the threads package # and try using this line, so I'm just skipping it entirely for OS X. @@ -162,4 +161,4 @@ IF(SDL_LIBRARY_TEMP) SET(SDL_FOUND "YES") ENDIF(SDL_LIBRARY_TEMP) -MARK_AS_ADVANCED(SDL_LIBRARY_TEMP) \ No newline at end of file +MARK_AS_ADVANCED(SDL_LIBRARY_TEMP) diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 84f5e14d0b..d2af7b21fb 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -38,20 +38,11 @@ else() message("SDL not found! Joysticks support will be disabled. Simulator audio will not work.") endif() -find_package(Qt4 4.8.1 REQUIRED) -set(QT_USE_QTNETWORK True) -set(QT_USE_QTXML True) -include(${QT_USE_FILE}) - -message(STATUS "Looking for PHONON ") -find_package(Phonon) -if(PHONON_FOUND) - include_directories(${PHONO_INCLUDE_DIR}) - message("PHONON Include Path: " ${PHONON_INCLUDE_DIR}) - add_definitions(-DPHONON) -else() - message("PHONON not found!") -endif() +find_package(Qt5Widgets REQUIRED) +find_package(Qt5Xml REQUIRED) +find_package(Qt5LinguistTools REQUIRED) +find_package(Qt5PrintSupport REQUIRED) +find_package(Qt5Multimedia REQUIRED) message(STATUS "Looking for QT lupdate ") find_package(Lupdate) @@ -114,9 +105,10 @@ set(common_SRCS appdata.cpp ) -qt4_wrap_cpp(common_SRCS) +qt5_wrap_cpp(common_SRCS) add_library(common ${common_SRCS}) +qt5_use_modules(common Core Xml Widgets) set(companion_SRCS hexinterface.cpp @@ -211,7 +203,7 @@ set(companion_UIS radionotfound.ui ) -set(companion_RCS +set(companion_RESOURCES companion.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc ) @@ -239,23 +231,23 @@ foreach(language ${LANGUAGES}) set(companion_TS ${companion_TS} translations/companion_${language}.ts) endforeach(language) -set(companion_SRCS ${companion_SRCS}) -qt4_wrap_ui(companion_SRCS ${companion_UIS}) -qt4_wrap_cpp(companion_SRCS ${companion_MOC_HDRS}) -qt4_add_translation(companion_QM ${companion_TS}) -qt4_add_resources(companion_SRCS ${companion_RCS}) +qt5_wrap_ui(companion_SRCS ${companion_UIS}) +qt5_wrap_cpp(companion_SRCS ${companion_MOC_HDRS}) +qt5_add_translation(companion_QM ${companion_TS}) +qt5_add_resources(companion_RCC ${companion_RESOURCES}) add_definitions(-DQT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}") if(APPLE) - add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_QM}) + add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_RCC} ${companion_QM}) # OS X compiler no longer automatically includes /Library/Frameworks in search path set(CMAKE_EXE_LINKER_FLAGS -F/Library/Frameworks) else() - add_executable(${COMPANION_NAME} WIN32 ${companion_SRCS} ${companion_QM}) + add_executable(${COMPANION_NAME} WIN32 ${companion_SRCS} ${companion_RCC} ${companion_QM}) endif() -target_link_libraries(${COMPANION_NAME} generaledit modeledit simulation common qcustomplot shared ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS}) +qt5_use_modules(${COMPANION_NAME} Core Widgets Network) +target_link_libraries(${COMPANION_NAME} PRIVATE generaledit modeledit simulation common qcustomplot shared ${PTHREAD_LIBRARY} ${SDL_LIBRARY}) ############# Standalone simu ############### @@ -269,21 +261,20 @@ set(simu_MOC_HDRS modeledit/node.h ) -set(simu_SRCS ${simu_SRCS}) -qt4_wrap_cpp(simu_SRCS ${simu_MOC_HDRS}) -qt4_add_resources(simu_SRCS companion.qrc) # TODO not needed +qt5_wrap_cpp(simu_SRCS ${simu_MOC_HDRS} ) if(WIN32) set(simu_SRCS ${simu_SRCS} icon.rc) endif() if(APPLE) - add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${simu_SRCS}) + add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${simu_SRCS} ${companion_RCC}) else() - add_executable(${SIMULATOR_NAME} WIN32 ${simu_SRCS}) + add_executable(${SIMULATOR_NAME} WIN32 ${simu_SRCS} ${companion_RCC}) endif() -target_link_libraries(${SIMULATOR_NAME} simulation common qxtcommandoptions ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ${OPENTX_SIMULATOR_LIBS}) +# TODO not the same link command than companion? +target_link_libraries(${SIMULATOR_NAME} PRIVATE simulation common qxtcommandoptions ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${OPENTX_SIMULATOR_LIBS}) ############# Packaging #################### @@ -304,9 +295,13 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") install(FILES ../targets/linux/45-companion-taranis.rules DESTINATION /lib/udev/rules.d RENAME 45-companion${C9X_NAME_SUFFIX}-taranis.rules) # Linux specific code set(OperatingSystem "Linux") -else(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - install(TARGETS ${COMPANION_NAME} DESTINATION ${QT_BINARY_DIR}) -endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +else() + get_target_property(QtCore_LOCATION Qt5::Core LOCATION) + get_filename_component(QT_DLL_DIR ${QtCore_LOCATION} PATH) + get_filename_component(SDL_DIR ${SDL_LIBRARY} PATH) + install(FILES ${QT_DLL_DIR}/icudt54.dll ${QT_DLL_DIR}/icuin54.dll ${QT_DLL_DIR}/icuuc54.dll ${QT_DLL_DIR}/Qt5Core.dll ${QT_DLL_DIR}/Qt5Gui.dll ${QT_DLL_DIR}/Qt5Widgets.dll ${QT_DLL_DIR}/Qt5Xml.dll ${QT_DLL_DIR}/Qt5Network.dll ${QT_DLL_DIR}/Qt5PrintSupport.dll ${QT_DLL_DIR}/Qt5Multimedia.dll ${SDL_DIR}/SDL.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$) + install(FILES ${QT_DLL_DIR}/icudt54.dll ${QT_DLL_DIR}/icuin54.dll ${QT_DLL_DIR}/icuuc54.dll ${QT_DLL_DIR}/Qt5Cored.dll ${QT_DLL_DIR}/Qt5Guid.dll ${QT_DLL_DIR}/Qt5Widgetsd.dll ${QT_DLL_DIR}/Qt5Xmld.dll ${QT_DLL_DIR}/Qt5Networkd.dll ${QT_DLL_DIR}/Qt5PrintSupportd.dll ${QT_DLL_DIR}/Qt5Multimediad.dll ${SDL_DIR}/SDL.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$) +endif() if(WIN32) if(MSVC) @@ -388,7 +383,7 @@ set(CPACK_PACKAGE_NAME "companion${C9X_NAME_SUFFIX}") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the OpenTx open source firmware") string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE) -# The file stripping is deliberately disabled, with the stripped file we get +# The file stripping is deliberately disabled, with the stripped file we get # very poor trace-backs from the users when they report Companion crash set(CPACK_STRIP_FILES FALSE) diff --git a/companion/src/appdata.cpp b/companion/src/appdata.cpp index f26ec50eae..0a3539c602 100644 --- a/companion/src/appdata.cpp +++ b/companion/src/appdata.cpp @@ -605,6 +605,10 @@ void AppData::warningId (const int x) { store(x, _warningId, // Constructor AppData::AppData() +{ +} + +void AppData::init() { //Initialize the profiles for (int i=0; isnapshotPath->setDisabled(true); ui->snapshotPathButton->setDisabled(true); } -#if defined(ALLOW_NIGHTLY_BUILDS) ui->useCompanionNightlyBuilds->setChecked(g.useCompanionNightlyBuilds()); - ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds()); -#else - ui->useCompanionNightlyBuilds->hide(); - ui->useFirmwareNightlyBuilds->hide(); -#endif ui->autoCheckCompanion->setChecked(g.autoCheckApp()); + ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds()); ui->autoCheckFirmware->setChecked(g.autoCheckFw()); ui->showSplash->setChecked(g.showSplash()); ui->historySize->setValue(g.historySize()); diff --git a/companion/src/burnconfigdialog.h b/companion/src/burnconfigdialog.h index 569763fa8e..9a4d393a45 100644 --- a/companion/src/burnconfigdialog.h +++ b/companion/src/burnconfigdialog.h @@ -1,8 +1,7 @@ #ifndef BURNCONFIGDIALOG_H_ #define BURNCONFIGDIALOG_H_ -#include -#include +#include #define MEM_TYPE_EEPROM 1 #define MEM_TYPE_FLASH 2 diff --git a/companion/src/companion.cpp b/companion/src/companion.cpp index 0d62fdf3aa..d0c6ad45dd 100644 --- a/companion/src/companion.cpp +++ b/companion/src/companion.cpp @@ -82,12 +82,15 @@ class MyProxyStyle : public QProxyStyle int main(int argc, char *argv[]) { Q_INIT_RESOURCE(companion); + QApplication app(argc, argv); app.setApplicationName("OpenTX Companion"); app.setOrganizationName("OpenTX"); app.setOrganizationDomain("open-tx.org"); app.setAttribute(Qt::AA_DontShowIconsInMenus, false); + g.init(); + QStringList strl = QApplication::arguments(); if (strl.contains("--version")) { printf("%s\n", VERSION); @@ -106,7 +109,7 @@ int main(int argc, char *argv[]) app.installTranslator(&companionTranslator); app.installTranslator(&qtTranslator); - QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + // QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); #if defined(JOYSTICKS) || defined(SIMU_AUDIO) uint32_t sdlFlags = 0; diff --git a/companion/src/companion.qrc b/companion/src/companion.qrc index ced3841eca..05d9cb5762 100644 --- a/companion/src/companion.qrc +++ b/companion/src/companion.qrc @@ -1,4 +1,4 @@ - + images/customize.png icon.png diff --git a/companion/src/comparedialog.h b/companion/src/comparedialog.h index 9805b8baad..efdec3f1d7 100644 --- a/companion/src/comparedialog.h +++ b/companion/src/comparedialog.h @@ -1,8 +1,7 @@ #ifndef _COMPAREDIALOG_H #define _COMPAREDIALOG_H -#include -#include +#include #include "multimodelprinter.h" namespace Ui { diff --git a/companion/src/converteeprom.cpp b/companion/src/converteeprom.cpp index 3af874584e..1d49947870 100644 --- a/companion/src/converteeprom.cpp +++ b/companion/src/converteeprom.cpp @@ -27,7 +27,7 @@ bool convertEEprom(const QString &sourceEEprom, const QString &destinationEEprom QSharedPointer radioData = QSharedPointer(new RadioData()); std::bitset errors((unsigned long long)LoadEeprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size)); - if (!errors.test(NO_ERROR) + if (!errors.test(ALL_OK) || !currentFirmware->saveEEPROM((uint8_t *)eeprom.data(), *radioData, variant, version)) { return false; } diff --git a/companion/src/customizesplashdialog.h b/companion/src/customizesplashdialog.h index e15ded4199..ce9f351b0b 100644 --- a/companion/src/customizesplashdialog.h +++ b/companion/src/customizesplashdialog.h @@ -1,8 +1,7 @@ #ifndef CUSTOMIZESPLASHDIALOG_H #define CUSTOMIZESPLASHDIALOG_H -#include -#include +#include #include "firmwareinterface.h" namespace Ui diff --git a/companion/src/downloaddialog.cpp b/companion/src/downloaddialog.cpp index c0f9cba2b7..ce4d4f2aa7 100644 --- a/companion/src/downloaddialog.cpp +++ b/companion/src/downloaddialog.cpp @@ -1,7 +1,5 @@ #include "downloaddialog.h" #include "ui_downloaddialog.h" -#include -#include #include #include "helpers.h" diff --git a/companion/src/downloaddialog.h b/companion/src/downloaddialog.h index 057e08223a..f045bde182 100644 --- a/companion/src/downloaddialog.h +++ b/companion/src/downloaddialog.h @@ -1,13 +1,12 @@ #ifndef DOWNLOADDIALOG_H #define DOWNLOADDIALOG_H -#include +#include #include #include #include #include - namespace Ui { class downloadDialog; } diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index 3f95054d99..5a4043bd98 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "eeprominterface.h" #include "firmwares/er9x/er9xinterface.h" #include "firmwares/th9x/th9xinterface.h" @@ -1169,9 +1170,9 @@ GeneralSettings::GeneralSettings() byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16); if (ok) imperial=byte8u; - QString chars=t_CountrySet.mid(4,2); - ttsLanguage[0]=chars[0].toAscii(); - ttsLanguage[1]=chars[1].toAscii(); + QString chars = t_CountrySet.mid(4, 2); + ttsLanguage[0] = chars[0].toLatin1(); + ttsLanguage[1] = chars[1].toLatin1(); } } } @@ -1685,7 +1686,7 @@ unsigned long LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { std::bitset result((unsigned long long)eepromInterface->load(radioData, eeprom, size)); - if (result.test(NO_ERROR)) { + if (result.test(ALL_OK)) { return result.to_ulong(); } else { @@ -1705,7 +1706,7 @@ unsigned long LoadBackup(RadioData & radioData, uint8_t * eeprom, int size, int foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { std::bitset result((unsigned long long)eepromInterface->loadBackup(radioData, eeprom, size, index)); - if (result.test(NO_ERROR)) { + if (result.test(ALL_OK)) { return result.to_ulong(); } else { @@ -1726,7 +1727,7 @@ unsigned long LoadEepromXml(RadioData & radioData, QDomDocument & doc) foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { std::bitset result((unsigned long long)eepromInterface->loadxml(radioData, doc)); - if (result.test(NO_ERROR)) { + if (result.test(ALL_OK)) { return result.to_ulong(); } else { diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index e92e671f39..56cb9be38b 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include // This should be removed from here, and remove Xml dependency from all libs which don't need it. #include #include #include @@ -1507,8 +1507,7 @@ void registerOpenTxFirmwares(); void unregisterOpenTxFirmwares(); enum EepromLoadErrors { - NO_ERROR, - + ALL_OK, UNKNOWN_ERROR, UNSUPPORTED_NEWER_VERSION, WRONG_SIZE, diff --git a/companion/src/firmwares/er9x/er9xinterface.cpp b/companion/src/firmwares/er9x/er9xinterface.cpp index f7859f1f08..5f2fc5fc92 100644 --- a/companion/src/firmwares/er9x/er9xinterface.cpp +++ b/companion/src/firmwares/er9x/er9xinterface.cpp @@ -114,7 +114,7 @@ unsigned long Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) } } std::cout << "ok\n"; - errors.set(NO_ERROR); + errors.set(ALL_OK); return errors.to_ulong(); } @@ -186,7 +186,7 @@ unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i } std::cout << "ok\n"; - errors.set(NO_ERROR); + errors.set(ALL_OK); return errors.to_ulong(); } @@ -261,7 +261,7 @@ QDomElement Er9xInterface::getGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * { QDomElement gd = qdoc->createElement("GENERAL_DATA"); appendNumberElement(qdoc, &gd, "Version", tgen->myVers, true); // have to write value here - appendTextElement(qdoc, &gd, "Owner", QString::fromAscii(tgen->ownerName,sizeof(tgen->ownerName)).trimmed()); + appendTextElement(qdoc, &gd, "Owner", QString::fromLatin1(tgen->ownerName,sizeof(tgen->ownerName)).trimmed()); appendCDATAElement(qdoc, &gd, "Data", (const char *)tgen,sizeof(Er9xGeneral)); return gd; } @@ -271,7 +271,7 @@ QDomElement Er9xInterface::getModelDataXML(QDomDocument * qdoc, Er9xModelData * QDomElement md = qdoc->createElement("MODEL_DATA"); md.setAttribute("number", modelNum); appendNumberElement(qdoc, &md, "Version", mdver, true); // have to write value here - appendTextElement(qdoc, &md, "Name", QString::fromAscii(tmod->name,sizeof(tmod->name)).trimmed()); + appendTextElement(qdoc, &md, "Name", QString::fromLatin1(tmod->name,sizeof(tmod->name)).trimmed()); appendCDATAElement(qdoc, &md, "Data", (const char *)tmod,sizeof(Er9xModelData)); return md; } @@ -289,7 +289,7 @@ bool Er9xInterface::loadGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen) while (!n.isNull()) { if (n.isCDATASection()) { QString ds = n.toCDATASection().data(); - QByteArray ba = QByteArray::fromBase64(ds.toAscii()); + QByteArray ba = QByteArray::fromBase64(ds.toLatin1()); const char * data = ba.data(); memcpy(tgen, data, sizeof(Er9xGeneral)); break; @@ -326,7 +326,7 @@ bool Er9xInterface::loadModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, while (!n.isNull()) { if (n.isCDATASection()) { QString ds = n.toCDATASection().data(); - QByteArray ba = QByteArray::fromBase64(ds.toAscii()); + QByteArray ba = QByteArray::fromBase64(ds.toLatin1()); const char * data = ba.data(); memcpy(tmod, data, sizeof(Er9xModelData)); break; diff --git a/companion/src/firmwares/ersky9x/ersky9xinterface.cpp b/companion/src/firmwares/ersky9x/ersky9xinterface.cpp index 8b4721e45d..0e0c703b20 100644 --- a/companion/src/firmwares/ersky9x/ersky9xinterface.cpp +++ b/companion/src/firmwares/ersky9x/ersky9xinterface.cpp @@ -152,7 +152,7 @@ unsigned long Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) } } std::cout << "ok\n"; - errors.set(NO_ERROR); + errors.set(ALL_OK); return errors.to_ulong(); } @@ -230,7 +230,7 @@ unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom } std::cout << "ok\n"; - errors.set(NO_ERROR); + errors.set(ALL_OK); return errors.to_ulong(); } @@ -305,7 +305,7 @@ QDomElement Ersky9xInterface::getGeneralDataXML(QDomDocument * qdoc, Ersky9xGene { QDomElement gd = qdoc->createElement("GENERAL_DATA"); appendNumberElement(qdoc, &gd, "Version", tgen->myVers, true); // have to write value here - appendTextElement(qdoc, &gd, "Owner", QString::fromAscii(tgen->ownerName,sizeof(tgen->ownerName)).trimmed()); + appendTextElement(qdoc, &gd, "Owner", QString::fromLatin1(tgen->ownerName,sizeof(tgen->ownerName)).trimmed()); appendCDATAElement(qdoc, &gd, "Data", (const char *)tgen,sizeof(Ersky9xGeneral)); return gd; } @@ -315,7 +315,7 @@ QDomElement Ersky9xInterface::getModelDataXML(QDomDocument * qdoc, Ersky9xModelD QDomElement md = qdoc->createElement("MODEL_DATA"); md.setAttribute("number", modelNum); appendNumberElement(qdoc, &md, "Version", mdver, true); // have to write value here - appendTextElement(qdoc, &md, "Name", QString::fromAscii(tmod->name,sizeof(tmod->name)).trimmed()); + appendTextElement(qdoc, &md, "Name", QString::fromLatin1(tmod->name,sizeof(tmod->name)).trimmed()); appendCDATAElement(qdoc, &md, "Data", (const char *)tmod,sizeof(Ersky9xModelData_v11)); return md; } @@ -333,7 +333,7 @@ bool Ersky9xInterface::loadGeneralDataXML(QDomDocument * qdoc, Ersky9xGeneral * while (!n.isNull()) { if (n.isCDATASection()) { QString ds = n.toCDATASection().data(); - QByteArray ba = QByteArray::fromBase64(ds.toAscii()); + QByteArray ba = QByteArray::fromBase64(ds.toLatin1()); const char * data = ba.data(); memcpy(tgen, data, std::min((unsigned int)ba.size(), (unsigned int)sizeof(Ersky9xGeneral))); break; @@ -373,7 +373,7 @@ bool Ersky9xInterface::loadModelDataXML(QDomDocument * qdoc, ModelData *model, i while (!n.isNull()) { if (n.isCDATASection()) { QString ds = n.toCDATASection().data(); - QByteArray ba = QByteArray::fromBase64(ds.toAscii()); + QByteArray ba = QByteArray::fromBase64(ds.toLatin1()); const char * data = ba.data(); memcpy(&ersky9xModel, data, std::min(ba.size(), (int)sizeof(ersky9xModel))); break; diff --git a/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp b/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp index 007b492eb8..51a63d0c87 100644 --- a/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp +++ b/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp @@ -207,7 +207,7 @@ unsigned long Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eepro } std::cout << "ok\n"; - errors.set(NO_ERROR); + errors.set(ALL_OK); return errors.to_ulong(); } diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 02fe14c1d2..ccee45e665 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -392,8 +392,8 @@ template class SwitchField: public ConversionField< SignedField > { public: SwitchField(RawSwitch & sw, BoardEnum board, unsigned int version, unsigned long flags=0): - ConversionField< SignedField >(_switch, SwitchesConversionTable::getInstance(board, version, flags), QObject::tr("Switch").toAscii(), - QObject::tr("Switch ").toAscii()+ sw.toString()+ QObject::tr(" cannot be exported on this board!").toAscii()), + ConversionField< SignedField >(_switch, SwitchesConversionTable::getInstance(board, version, flags), QObject::tr("Switch").toLatin1(), + QObject::tr("Switch ").toLatin1()+ sw.toString()+ QObject::tr(" cannot be exported on this board!").toLatin1()), sw(sw), _switch(0) { diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 0ecdc3bbb1..f583dab63c 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -393,7 +393,7 @@ unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *e } } std::cout << " ok\n"; - errors.set(NO_ERROR); + errors.set(ALL_OK); return errors.to_ulong(); } @@ -973,7 +973,7 @@ EepromLoadErrors OpenTxEepromInterface::checkVersion(unsigned int version) return NOT_OPENTX; } - return NO_ERROR; + return ALL_OK; } bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int variant) @@ -1081,7 +1081,7 @@ unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *e } std::cout << " ok\n"; - errors.set(NO_ERROR); + errors.set(ALL_OK); return errors.to_ulong(); } diff --git a/companion/src/firmwares/opentx/simulator/CMakeLists.txt b/companion/src/firmwares/opentx/simulator/CMakeLists.txt index 9bf8b70c5c..6c1ac8a790 100644 --- a/companion/src/firmwares/opentx/simulator/CMakeLists.txt +++ b/companion/src/firmwares/opentx/simulator/CMakeLists.txt @@ -107,67 +107,59 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") # 9X with ATmega64 target_include_directories(opentx-9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) target_compile_definitions(opentx-9x${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM64 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # 9XR with ATmega64 target_include_directories(opentx-9xr${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) target_compile_definitions(opentx-9xr${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM64 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-9xr${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # 9X with ATmega128 target_include_directories(opentx-9x128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) target_compile_definitions(opentx-9x128${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM128 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-9x128${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # 9XR with ATmega128 target_include_directories(opentx-9xr128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) target_compile_definitions(opentx-9xr128${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM128 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-9xr128${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # Gruvin9x target_include_directories(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/gruvin9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) target_compile_definitions(opentx-gruvin9x${SUFFIX}-simulator PRIVATE PCBGRUVIN9X CPUM2560 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # Mega2560 target_include_directories(opentx-mega2560${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/mega2560 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) target_compile_definitions(opentx-mega2560${SUFFIX}-simulator PRIVATE PCBMEGA2560 CPUM2560 EEPROM EEPROM_RLC SDCARD ROTARY_ENCODERS=2 ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-mega2560${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # Sky9x target_include_directories(opentx-sky9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) target_compile_definitions(opentx-sky9x${SUFFIX}-simulator PRIVATE PCBSKY9X CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-sky9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # 9XR-PRO target_include_directories(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) target_compile_definitions(opentx-9xrpro${SUFFIX}-simulator PRIVATE PCBSKY9X REVX CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # AR9X target_include_directories(opentx-ar9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) target_compile_definitions(opentx-ar9x${SUFFIX}-simulator PRIVATE PCBSKY9X AR9X CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-ar9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # Taranis standard target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/taranis) target_compile_definitions(opentx-taranis${SUFFIX}-simulator PRIVATE PCBTARANIS CPUARM CPUSTM32 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-taranis${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # Taranis Plus target_include_directories(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/taranis) target_compile_definitions(opentx-taranisplus${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS CPUARM CPUSTM32 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # Taranis X9E target_include_directories(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/taranis) target_compile_definitions(opentx-taranisx9e${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS REV9E CPUARM CPUSTM32 STM32F40_41xxx EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) # Horus target_include_directories(opentx-horus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/horus PRIVATE ${RADIO_SRC_DIRECTORY}/gui/horus PRIVATE ${RADIO_SRC_DIRECTORY}/fonts/horus PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/horus) target_compile_definitions(opentx-horus${SUFFIX}-simulator PRIVATE PCBHORUS CPUARM CPUSTM32 STM32F40_41xxx COLORLCD VOICE SDCARD ${COMMON_DEFINITIONS}) -target_link_libraries(opentx-horus${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) + +foreach(library ${OPENTX_LIBRARIES}) + qt5_use_modules(${library} Core) + target_link_libraries(${library} PRIVATE ${COMMON_LIBRARIES}) +endforeach() add_custom_target(opentx-simulators DEPENDS ${OPENTX_LIBRARIES} @@ -175,18 +167,18 @@ add_custom_target(opentx-simulators if(APPLE) set(SIMULATOR_BUNDLES) - foreach(_file ${OPENTX_LIBRARIES}) - set(SIMULATOR_BUNDLE "${_file}-bundle") + foreach(library ${OPENTX_LIBRARIES}) + set(SIMULATOR_BUNDLE "${library}-bundle") add_custom_target(${SIMULATOR_BUNDLE} - COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore lib${_file}.dylib - COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork lib${_file}.dylib - COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtXml.framework/Versions/4/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml lib${_file}.dylib - COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui lib${_file}.dylib - COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL lib${_file}.dylib + COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore lib${library}.dylib + COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork lib${library}.dylib + COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtXml.framework/Versions/4/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml lib${library}.dylib + COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui lib${library}.dylib + COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL lib${library}.dylib WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMAND pwd - COMMAND cp lib${_file}.dylib companion.app/Contents/Resources/ - DEPENDS ${_file} + COMMAND cp lib${library}.dylib companion.app/Contents/Resources/ + DEPENDS ${library} ) list(APPEND SIMULATOR_BUNDLES ${SIMULATOR_BUNDLE}) endforeach() diff --git a/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp b/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp index 3780ed828e..32d58e51a7 100644 --- a/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp +++ b/companion/src/firmwares/opentx/simulator/opentxsimulator.cpp @@ -491,7 +491,7 @@ OpenTxSimulator::OpenTxSimulator() void OpenTxSimulator::setSdPath(const QString &sdPath) { #if defined(SDCARD) - strncpy(simuSdDirectory, sdPath.toAscii().constData(), sizeof(simuSdDirectory)-1); + strncpy(simuSdDirectory, sdPath.toLatin1().constData(), sizeof(simuSdDirectory)-1); simuSdDirectory[sizeof(simuSdDirectory)-1] = '\0'; #endif } diff --git a/companion/src/firmwares/th9x/th9xinterface.cpp b/companion/src/firmwares/th9x/th9xinterface.cpp index ca8781d3bc..acb8691204 100644 --- a/companion/src/firmwares/th9x/th9xinterface.cpp +++ b/companion/src/firmwares/th9x/th9xinterface.cpp @@ -123,7 +123,7 @@ unsigned long Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i } std::cout << "ok\n"; - errors.set(NO_ERROR); + errors.set(ALL_OK); return errors.to_ulong(); } diff --git a/companion/src/flasheepromdialog.cpp b/companion/src/flasheepromdialog.cpp index ee175841f9..545575ef46 100644 --- a/companion/src/flasheepromdialog.cpp +++ b/companion/src/flasheepromdialog.cpp @@ -126,7 +126,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename) if (xmlOK) { RadioData * radioData = new RadioData(); std::bitset errors((unsigned long long)LoadEepromXml(*radioData, doc)); - if (!errors.test(NO_ERROR)) { + if (!errors.test(ALL_OK)) { QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings File %1").arg(filename)); } else { @@ -162,7 +162,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename) RadioData * radioData = new RadioData(); std::bitset errors((unsigned long long)LoadEeprom(*radioData, (const uint8_t *)eeprom.data(), eeprom_size)); - if (eeprom_size == 0 || !errors.test(NO_ERROR)) { + if (eeprom_size == 0 || !errors.test(ALL_OK)) { QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings file %1").arg(filename)); } else { diff --git a/companion/src/flasheepromdialog.h b/companion/src/flasheepromdialog.h index 94bedc3ad2..fdfe61ccd6 100644 --- a/companion/src/flasheepromdialog.h +++ b/companion/src/flasheepromdialog.h @@ -1,7 +1,7 @@ #ifndef FLASHEEPROMDIALOG_H_ #define FLASHEEPROMDIALOG_H_ -#include +#include #define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE" #define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE" diff --git a/companion/src/flashfirmwaredialog.cpp b/companion/src/flashfirmwaredialog.cpp index c8460180ef..8e5106f58a 100644 --- a/companion/src/flashfirmwaredialog.cpp +++ b/companion/src/flashfirmwaredialog.cpp @@ -203,7 +203,6 @@ void FlashFirmwareDialog::on_useLibrarySplash_clicked() void FlashFirmwareDialog::on_burnButton_clicked() { g.flashDir(QFileInfo(fwName).dir().absolutePath()); - g.profile[g.id()].fwName(fwName); g.checkHardwareCompatibility(ui->checkHardwareCompatibility->isChecked()); g.backupOnFlash(ui->backupEEprom->isChecked()); diff --git a/companion/src/flashfirmwaredialog.h b/companion/src/flashfirmwaredialog.h index bf14b7d348..78a70f397a 100644 --- a/companion/src/flashfirmwaredialog.h +++ b/companion/src/flashfirmwaredialog.h @@ -1,8 +1,7 @@ #ifndef FLASH_FIRMWARE_DIALOG_H #define FLASH_FIRMWARE_DIALOG_H -#include -#include +#include #include "eeprominterface.h" #include "firmwareinterface.h" #include "xmlinterface.h" diff --git a/companion/src/generaledit/CMakeLists.txt b/companion/src/generaledit/CMakeLists.txt index 471705b4ab..9650d82e64 100644 --- a/companion/src/generaledit/CMakeLists.txt +++ b/companion/src/generaledit/CMakeLists.txt @@ -24,7 +24,8 @@ foreach(name ${generaledit_NAMES}) set(generaledit_UIS ${generaledit_UIS} ${name}.ui) endforeach() -qt4_wrap_ui(generaledit_SRCS ${generaledit_UIS}) -qt4_wrap_cpp(generaledit_SRCS ${generaledit_HDRS}) +qt5_wrap_ui(generaledit_SRCS ${generaledit_UIS}) +qt5_wrap_cpp(generaledit_SRCS ${generaledit_HDRS}) -add_library(generaledit ${generaledit_SRCS}) \ No newline at end of file +add_library(generaledit ${generaledit_SRCS}) +qt5_use_modules(generaledit Widgets Xml Multimedia) \ No newline at end of file diff --git a/companion/src/generaledit/calibration.cpp b/companion/src/generaledit/calibration.cpp index 85366b6336..cae2971931 100644 --- a/companion/src/generaledit/calibration.cpp +++ b/companion/src/generaledit/calibration.cpp @@ -14,7 +14,7 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe layout->setContentsMargins(0, 0, 0, 0); this->setLayout(layout); - tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); + tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); tableWidget->setColumnCount(3); tableWidget->setShowGrid(false); tableWidget->setSelectionMode(QAbstractItemView::NoSelection); diff --git a/companion/src/generaledit/generaledit.cpp b/companion/src/generaledit/generaledit.cpp index e11a134d78..717685fe72 100644 --- a/companion/src/generaledit/generaledit.cpp +++ b/companion/src/generaledit/generaledit.cpp @@ -1,6 +1,3 @@ -#include -#include -#include #include "generaledit.h" #include "ui_generaledit.h" #include "helpers.h" @@ -146,13 +143,13 @@ void GeneralEdit::on_calretrieve_PB_clicked() int16_t offset; bool ok; for (int i=0; igetCapability(Switches)); i++) { Byte=hwtypes.mid(i,1); byte16=(int16_t)Byte.toInt(&ok,16); - qba=controlNames.mid(3*(i+NUM_STICKS),3).toAscii(); + qba=controlNames.mid(3*(i+NUM_STICKS),3).toLatin1(); if (ok) generalSettings.switchConfig[i]=byte16; strcpy(generalSettings.switchName[i], qba.data()); @@ -161,7 +158,7 @@ void GeneralEdit::on_calretrieve_PB_clicked() for (int i=0; i<(GetCurrentFirmware()->getCapability(Pots)); i++) { Byte=hwtypes.mid(i+offset,1); byte16=(int16_t)Byte.toInt(&ok,16); - qba=controlNames.mid(3*(i+NUM_STICKS+offset),3).toAscii(); + qba=controlNames.mid(3*(i+NUM_STICKS+offset),3).toLatin1(); if (ok) generalSettings.potConfig[i]=byte16; strcpy(generalSettings.potName[i], qba.data()); @@ -170,7 +167,7 @@ void GeneralEdit::on_calretrieve_PB_clicked() for (int i=0; i<(GetCurrentFirmware()->getCapability(Sliders)); i++) { Byte=hwtypes.mid(i+offset,1); byte16=(int16_t)Byte.toInt(&ok,16); - qba=controlNames.mid(3*(i+NUM_STICKS+offset),3).toAscii(); + qba=controlNames.mid(3*(i+NUM_STICKS+offset),3).toLatin1(); if (ok) generalSettings.sliderConfig[i]=byte16; strcpy(generalSettings.sliderName[i], qba.data()); @@ -225,8 +222,8 @@ void GeneralEdit::on_calretrieve_PB_clicked() if (ok) generalSettings.imperial=byte8u; chars=CountrySet.mid(4,2); - generalSettings.ttsLanguage[0]=chars[0].toAscii(); - generalSettings.ttsLanguage[1]=chars[1].toAscii(); + generalSettings.ttsLanguage[0]=chars[0].toLatin1(); + generalSettings.ttsLanguage[1]=chars[1].toLatin1(); } } else { diff --git a/companion/src/generaledit/generaledit.h b/companion/src/generaledit/generaledit.h index 663a37eb79..09a96d5066 100644 --- a/companion/src/generaledit/generaledit.h +++ b/companion/src/generaledit/generaledit.h @@ -1,7 +1,7 @@ #ifndef GENERALEDIT_H #define GENERALEDIT_H -#include +#include #include "eeprominterface.h" #include "genericpanel.h" diff --git a/companion/src/generaledit/generalsetup.cpp b/companion/src/generaledit/generalsetup.cpp index d0ea0cd49e..909860e69d 100644 --- a/companion/src/generaledit/generalsetup.cpp +++ b/companion/src/generaledit/generalsetup.cpp @@ -1,6 +1,5 @@ #include "generalsetup.h" #include "ui_generalsetup.h" -#include GeneralSetupPanel::GeneralSetupPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware): GeneralPanel(parent, generalSettings, firmware), @@ -316,7 +315,7 @@ void GeneralSetupPanel::on_voiceLang_CB_currentIndexChanged(int index) if (!lock) { QString code = ui->voiceLang_CB->itemData(index).toString(); for (int i=0; i<2; i++) { - generalSettings.ttsLanguage[i] = code.at(i).toAscii(); + generalSettings.ttsLanguage[i] = code.at(i).toLatin1(); } generalSettings.ttsLanguage[2] = '\0'; emit modified(); diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index d56cbd7a84..04096e4e2c 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -86,7 +86,7 @@ void getFileComboBoxValue(QComboBox * b, char * dest, int length) { memset(dest, 0, length+1); if (b->currentText() != "----") { - strncpy(dest, b->currentText().toAscii(), length); + strncpy(dest, b->currentText().toLatin1(), length); } } diff --git a/companion/src/helpers.h b/companion/src/helpers.h index 682b493694..26fd1368e6 100644 --- a/companion/src/helpers.h +++ b/companion/src/helpers.h @@ -1,7 +1,8 @@ #ifndef HELPERS_H #define HELPERS_H -#include +#include +#include #include #include #include diff --git a/companion/src/logsdialog.cpp b/companion/src/logsdialog.cpp index d38210e9d3..9abdbdfc76 100644 --- a/companion/src/logsdialog.cpp +++ b/companion/src/logsdialog.cpp @@ -499,12 +499,12 @@ void LogsDialog::on_fileOpen_BT_clicked() } } - ui->logTable->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); + ui->logTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); QVarLengthArray sizes; for (int i = 0; i < ui->logTable->columnCount(); i++) { sizes.append(ui->logTable->columnWidth(i)); } - ui->logTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive); + ui->logTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); for (int i = 0; i < ui->logTable->columnCount(); i++) { ui->logTable->setColumnWidth(i, sizes.at(i)); } diff --git a/companion/src/mainwindow.h b/companion/src/mainwindow.h index b4158c7fec..bd156756d3 100644 --- a/companion/src/mainwindow.h +++ b/companion/src/mainwindow.h @@ -42,8 +42,7 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include -#include +#include #include #include "downloaddialog.h" #include "eeprominterface.h" diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index db5c397224..ee1dc8e104 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -270,7 +270,7 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile) bool xmlOK = doc.setContent(&file); if(xmlOK) { std::bitset errors((unsigned long long)LoadEepromXml(radioData, doc)); - if (errors.test(NO_ERROR)) { + if (errors.test(ALL_OK)) { ui->modelsList->refreshList(); if(resetCurrentFile) setCurrentFile(fileName); return true; @@ -301,7 +301,7 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile) file.close(); std::bitset errors((unsigned long long)LoadEeprom(radioData, (uint8_t *)eeprom.data(), eeprom_size)); - if (!errors.test(NO_ERROR)) { + if (!errors.test(ALL_OK)) { ShowEepromErrors(this, tr("Error"), tr("Invalid EEPROM File %1").arg(fileName), errors.to_ulong()); return false; } @@ -339,9 +339,9 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile) } std::bitset errorsEeprom((unsigned long long)LoadEeprom(radioData, eeprom, eeprom_size)); - if (!errorsEeprom.test(NO_ERROR)) { + if (!errorsEeprom.test(ALL_OK)) { std::bitset errorsBackup((unsigned long long)LoadBackup(radioData, eeprom, eeprom_size, 0)); - if (!errorsBackup.test(NO_ERROR)) { + if (!errorsBackup.test(ALL_OK)) { ShowEepromErrors(this, tr("Error"), tr("Invalid binary EEPROM File %1").arg(fileName), (errorsEeprom | errorsBackup).to_ulong()); return false; } @@ -617,7 +617,7 @@ bool MdiChild::loadBackup() } std::bitset errorsEeprom((unsigned long long)LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index)); - if (!errorsEeprom.test(NO_ERROR)) { + if (!errorsEeprom.test(ALL_OK)) { ShowEepromErrors(this, tr("Error"), tr("Invalid binary backup File %1").arg(fileName), (errorsEeprom).to_ulong()); return false; } diff --git a/companion/src/modeledit/CMakeLists.txt b/companion/src/modeledit/CMakeLists.txt index 3f64a2c8a9..055aed20df 100644 --- a/companion/src/modeledit/CMakeLists.txt +++ b/companion/src/modeledit/CMakeLists.txt @@ -54,7 +54,8 @@ foreach(name ${modeledit_NAMES}) set(modeledit_UIS ${modeledit_UIS} ${name}.ui) endforeach() -qt4_wrap_ui(modeledit_SRCS ${modeledit_UIS}) -qt4_wrap_cpp(modeledit_SRCS ${modeledit_HDRS}) +qt5_wrap_ui(modeledit_SRCS ${modeledit_UIS}) +qt5_wrap_cpp(modeledit_SRCS ${modeledit_HDRS}) -add_library(modeledit ${modeledit_SRCS}) \ No newline at end of file +add_library(modeledit ${modeledit_SRCS}) +qt5_use_modules(modeledit Widgets Xml Multimedia) diff --git a/companion/src/modeledit/channels.cpp b/companion/src/modeledit/channels.cpp index f713fd4150..d7c6005024 100644 --- a/companion/src/modeledit/channels.cpp +++ b/companion/src/modeledit/channels.cpp @@ -1,11 +1,5 @@ #include "channels.h" #include "helpers.h" -#include -#include -#include -#include -#include -#include LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt): firmware(firmware), @@ -200,7 +194,7 @@ void Channels::nameEdited() if (!lock) { QLineEdit *le = qobject_cast(sender()); int index = le->property("index").toInt(); - strcpy(model->limitData[index].name, le->text().toAscii()); + strcpy(model->limitData[index].name, le->text().toLatin1()); emit modified(); } } diff --git a/companion/src/modeledit/channels.h b/companion/src/modeledit/channels.h index ef5a6a0989..b594d2c568 100644 --- a/companion/src/modeledit/channels.h +++ b/companion/src/modeledit/channels.h @@ -3,7 +3,6 @@ #include "helpers.h" #include "modeledit.h" -#include class GVarGroup; diff --git a/companion/src/modeledit/curves.cpp b/companion/src/modeledit/curves.cpp index 13a1642398..4d838df626 100644 --- a/companion/src/modeledit/curves.cpp +++ b/companion/src/modeledit/curves.cpp @@ -3,11 +3,6 @@ #include "node.h" #include "edge.h" #include "helpers.h" -#include -#include -#include -#include -#include #define GFX_MARGIN 16 @@ -491,7 +486,7 @@ void Curves::on_curveSmooth_currentIndexChanged(int index) void Curves::on_curveName_editingFinished() { memset(model->curves[currentCurve].name, 0, sizeof(model->curves[currentCurve].name)); - strcpy(model->curves[currentCurve].name, ui->curveName->text().toAscii()); + strcpy(model->curves[currentCurve].name, ui->curveName->text().toLatin1()); emit modified(); } diff --git a/companion/src/modeledit/curves.h b/companion/src/modeledit/curves.h index 760558397b..3d2a6f33b5 100644 --- a/companion/src/modeledit/curves.h +++ b/companion/src/modeledit/curves.h @@ -3,7 +3,6 @@ #include "modeledit.h" #include "eeprominterface.h" -#include enum CopyAction { CURVE_COPY, diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 762bb8bbe6..aa9c8073f3 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -43,13 +43,9 @@ void RepeatComboBox::update() CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware): GenericPanel(parent, model, generalSettings, firmware), - functions(model ? model->customFn : generalSettings.customFn) -#if defined(PHONON) - , - phononCurrent(-1), - clickObject(NULL), - clickOutput(NULL) -#endif + functions(model ? model->customFn : generalSettings.customFn), + mediaPlayerCurrent(-1), + mediaPlayer(NULL) { Stopwatch s1("CustomFunctionsPanel - populate"); lock = true; @@ -178,14 +174,12 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, paramLayout->addWidget(fswtchBLcolor[i]); connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited())); -#ifdef PHONON playBT[i] = new QPushButton(this); playBT[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); playBT[i]->setProperty("index", i); playBT[i]->setIcon(playIcon); paramLayout->addWidget(playBT[i]); connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic())); -#endif QHBoxLayout * repeatLayout = new QHBoxLayout(); tableLayout->addLayout(i, 4, repeatLayout); @@ -220,35 +214,42 @@ CustomFunctionsPanel::~CustomFunctionsPanel() { } -#ifdef PHONON -void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::State oldState) +void CustomFunctionsPanel::onMediaPlayerStateChanged(QMediaPlayer::State state) { if (!lock) { lock = true; - if ((newState==Phonon::ErrorState || newState==Phonon::StoppedState || newState==Phonon::PausedState) && oldState==Phonon::PlayingState) { - clickObject->stop(); - clickObject->clearQueue(); - clickObject->clear(); - if (phononCurrent >= 0) { - playBT[phononCurrent]->setIcon(CompanionIcon("play.png")); - phononCurrent = -1; + if (state==QMediaPlayer::StoppedState || state==QMediaPlayer::PausedState) { + mediaPlayer->stop(); + if (mediaPlayerCurrent >= 0) { + playBT[mediaPlayerCurrent]->setIcon(CompanionIcon("play.png")); + mediaPlayerCurrent = -1; } } lock = false; } } +void CustomFunctionsPanel::onMediaPlayerError(QMediaPlayer::Error error) +{ + if (!lock) { + lock = true; + if (mediaPlayerCurrent >= 0) { + playBT[mediaPlayerCurrent]->setIcon(CompanionIcon("play.png")); + mediaPlayerCurrent = -1; + } + lock = false; + } +} + void CustomFunctionsPanel::playMusic() { - if (!clickObject) { - clickObject = new Phonon::MediaObject(this); - clickOutput = new Phonon::AudioOutput(Phonon::NoCategory, this); - Phonon::createPath(clickObject, clickOutput); - connect(clickObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(mediaPlayer_state(Phonon::State, Phonon::State))); + if (!mediaPlayer) { + mediaPlayer = new QMediaPlayer(this); + connect(mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(onMediaPlayerStateChanged(QMediaPlayer::State))); + connect(mediaPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(onMediaPlayerError(QMediaPlayer::Error))); } - QPushButton * button = qobject_cast(sender()); - int index = button->property("index").toInt(); + int index = sender()->property("index").toInt(); QString path = g.profile[g.id()].sdPath(); QDir qd(path); QString track; @@ -272,29 +273,22 @@ void CustomFunctionsPanel::playMusic() return; } - if (phononCurrent == index) { - clickObject->stop(); - clickObject->clear(); + if (mediaPlayerCurrent == index) { + mediaPlayer->stop(); playBT[index]->setIcon(CompanionIcon("play.png")); - phononCurrent = -1; + mediaPlayerCurrent = -1; } else { - if (phononCurrent >= 0) { - playBT[phononCurrent]->setIcon(CompanionIcon("play.png")); + if (mediaPlayerCurrent >= 0) { + playBT[mediaPlayerCurrent]->setIcon(CompanionIcon("play.png")); } - phononCurrent = index; - clickObject->clear(); -#ifdef __APPLE__ - clickObject->setCurrentSource(QUrl("file://"+track)); -#else - clickObject->setCurrentSource(QUrl(track)); -#endif - clickObject->play(); + mediaPlayerCurrent = index; + mediaPlayer->setMedia(QUrl::fromLocalFile(track)); + mediaPlayer->play(); playBT[index]->setIcon(CompanionIcon("stop.png")); } } } -#endif #define CUSTOM_FUNCTION_NUMERIC_PARAM (1<<0) #define CUSTOM_FUNCTION_SOURCE_PARAM (1<<1) @@ -526,9 +520,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) fswtchRepeat[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_REPEAT); fswtchGVmode[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_MODE); fswtchBLcolor[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_BL_COLOR); -#ifdef PHONON playBT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_PLAY); -#endif } void CustomFunctionsPanel::update() diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index 57a5498303..94d330f226 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -3,24 +3,14 @@ #include "modeledit.h" #include "eeprominterface.h" -#include -#include -#include -#include -#include -#include -#ifdef PHONON -#include -#include -#include -#endif +#include class RepeatComboBox: public QComboBox { Q_OBJECT public: - RepeatComboBox(QWidget *parent, int & repeatParam); + RepeatComboBox(QWidget * parent, int & repeatParam); void update(); signals: @@ -35,7 +25,7 @@ class RepeatComboBox: public QComboBox class CustomFunctionsPanel : public GenericPanel { - Q_OBJECT + Q_OBJECT public: CustomFunctionsPanel(QWidget *parent, ModelData * mode, GeneralSettings & generalSettings, Firmware * firmware); @@ -52,10 +42,9 @@ class CustomFunctionsPanel : public GenericPanel void fsw_customContextMenuRequested(QPoint pos); void refreshCustomFunction(int index, bool modified=false); void onChildModified(); -#ifdef PHONON void playMusic(); - void mediaPlayer_state(Phonon::State newState, Phonon::State oldState); -#endif + void onMediaPlayerStateChanged(QMediaPlayer::State state); + void onMediaPlayerError(QMediaPlayer::Error error); void fswDelete(); void fswCopy(); void fswPaste(); @@ -68,7 +57,7 @@ class CustomFunctionsPanel : public GenericPanel QSet tracksSet; QSet scriptsSet; - int phononCurrent; + int mediaPlayerCurrent; QComboBox * fswtchSwtch[C9X_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchFunc[C9X_MAX_CUSTOM_FUNCTIONS]; QCheckBox * fswtchParamGV[C9X_MAX_CUSTOM_FUNCTIONS]; @@ -81,10 +70,7 @@ class CustomFunctionsPanel : public GenericPanel RepeatComboBox * fswtchRepeat[C9X_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchGVmode[C9X_MAX_CUSTOM_FUNCTIONS]; QSlider * fswtchBLcolor[C9X_MAX_CUSTOM_FUNCTIONS]; -#ifdef PHONON - Phonon::MediaObject *clickObject; - Phonon::AudioOutput *clickOutput; -#endif + QMediaPlayer * mediaPlayer; int selectedFunction; diff --git a/companion/src/modeledit/expodialog.cpp b/companion/src/modeledit/expodialog.cpp index 2e8c2d2cce..b56f913077 100644 --- a/companion/src/modeledit/expodialog.cpp +++ b/companion/src/modeledit/expodialog.cpp @@ -154,7 +154,7 @@ void ExpoDialog::valuesChanged() ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt()); ed->mode = ui->sideCB->currentIndex() + 1; - strcpy(ed->name, ui->lineName->text().toAscii().data()); + strcpy(ed->name, ui->lineName->text().toLatin1().data()); if (firmware->getCapability(VirtualInputs)) { inputName = ui->inputName->text(); } diff --git a/companion/src/modeledit/expodialog.h b/companion/src/modeledit/expodialog.h index 9aff8f35d8..c0c917aa89 100644 --- a/companion/src/modeledit/expodialog.h +++ b/companion/src/modeledit/expodialog.h @@ -1,7 +1,7 @@ #ifndef EXPODIALOG_H #define EXPODIALOG_H -#include +#include #include "eeprominterface.h" #include "modelprinter.h" diff --git a/companion/src/modeledit/flightmodes.cpp b/companion/src/modeledit/flightmodes.cpp index 21782ae9b7..3ee7b39e29 100644 --- a/companion/src/modeledit/flightmodes.cpp +++ b/companion/src/modeledit/flightmodes.cpp @@ -1,9 +1,6 @@ #include "flightmodes.h" #include "ui_flightmode.h" -// #include "firmwares/opentx/opentxeeprom.h" // TODO shouldn't be there #include "helpers.h" -#include -#include FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings, Firmware * firmware): ModelPanel(parent, model, generalSettings, firmware), @@ -244,7 +241,7 @@ void FlightModePanel::update() void FlightModePanel::phaseName_editingFinished() { QLineEdit *lineEdit = qobject_cast(sender()); - strcpy(phase.name, lineEdit->text().toAscii()); + strcpy(phase.name, lineEdit->text().toLatin1()); emit modified(); emit nameModified(); } @@ -312,7 +309,7 @@ void FlightModePanel::GVName_editingFinished() QLineEdit *lineedit = qobject_cast(sender()); int gvar = lineedit->property("index").toInt(); memset(&model->gvars_names[gvar], 0, sizeof(model->gvars_names[gvar])); - strcpy(model->gvars_names[gvar], lineedit->text().toAscii()); + strcpy(model->gvars_names[gvar], lineedit->text().toLatin1()); emit modified(); } } diff --git a/companion/src/modeledit/flightmodes.h b/companion/src/modeledit/flightmodes.h index 4de522034e..00ed132a9b 100644 --- a/companion/src/modeledit/flightmodes.h +++ b/companion/src/modeledit/flightmodes.h @@ -3,12 +3,6 @@ #include "modeledit.h" #include "eeprominterface.h" -#include -#include -#include -#include -#include -#include namespace Ui { class FlightMode; diff --git a/companion/src/modeledit/inputs.cpp b/companion/src/modeledit/inputs.cpp index a5bced74ab..004472c525 100644 --- a/companion/src/modeledit/inputs.cpp +++ b/companion/src/modeledit/inputs.cpp @@ -1,5 +1,4 @@ #include "inputs.h" -#include #include "expodialog.h" #include "helpers.h" @@ -199,7 +198,7 @@ void InputsPanel::gm_openExpo(int index) if (g->exec()) { model->expoData[index] = mixd; if (firmware->getCapability(VirtualInputs)) - strncpy(model->inputNames[mixd.chn], inputName.toAscii().data(), 4); + strncpy(model->inputNames[mixd.chn], inputName.toLatin1().data(), 4); emit modified(); update(); } @@ -288,8 +287,6 @@ void InputsPanel::mimeExpoDropped(int index, const QMimeData *data, Qt::DropActi pasteExpoMimeData(data, idx); } -#include -#include void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx) { if (mimeData->hasFormat("application/x-companion-expo")) { @@ -325,11 +322,12 @@ void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx) void InputsPanel::exposPaste() { - const QClipboard *clipboard = QApplication::clipboard(); - const QMimeData *mimeData = clipboard->mimeData(); - QListWidgetItem *item = ExposlistWidget->currentItem(); - if (item) - pasteExpoMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0)); + const QClipboard *clipboard = QApplication::clipboard(); + const QMimeData *mimeData = clipboard->mimeData(); + QListWidgetItem *item = ExposlistWidget->currentItem(); + if (item) { + pasteExpoMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0)); + } } void InputsPanel::exposDuplicate() diff --git a/companion/src/modeledit/logicalswitches.cpp b/companion/src/modeledit/logicalswitches.cpp index e52cc4ed70..ca08d0b940 100644 --- a/companion/src/modeledit/logicalswitches.cpp +++ b/companion/src/modeledit/logicalswitches.cpp @@ -1,10 +1,4 @@ #include "logicalswitches.h" -#include -#include -#include -#include -#include -#include #include "helpers.h" LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware): diff --git a/companion/src/modeledit/logicalswitches.h b/companion/src/modeledit/logicalswitches.h index 80df06a74a..7384126e30 100644 --- a/companion/src/modeledit/logicalswitches.h +++ b/companion/src/modeledit/logicalswitches.h @@ -3,9 +3,6 @@ #include "modeledit.h" #include "eeprominterface.h" -#include -#include -#include class LogicalSwitchesPanel : public ModelPanel { diff --git a/companion/src/modeledit/mixerdialog.cpp b/companion/src/modeledit/mixerdialog.cpp index 85e602f112..c8ca6a1281 100644 --- a/companion/src/modeledit/mixerdialog.cpp +++ b/companion/src/modeledit/mixerdialog.cpp @@ -159,8 +159,7 @@ void MixerDialog::valuesChanged() md->delayUp = round(ui->delayUpSB->value()*scale); md->speedDown = round(ui->slowDownSB->value()*scale); md->speedUp = round(ui->slowUpSB->value()*scale); - - strcpy(md->name, ui->mixerName->text().toAscii()); + strcpy(md->name, ui->mixerName->text().toLatin1()); md->flightModes = 0; for (int i=8; i>=0 ; i--) { diff --git a/companion/src/modeledit/mixerdialog.h b/companion/src/modeledit/mixerdialog.h index 3e579afe07..57e1650e30 100644 --- a/companion/src/modeledit/mixerdialog.h +++ b/companion/src/modeledit/mixerdialog.h @@ -1,7 +1,7 @@ #ifndef MIXERDIALOG_H #define MIXERDIALOG_H -#include +#include #include "eeprominterface.h" class GVarGroup; diff --git a/companion/src/modeledit/mixerslist.h b/companion/src/modeledit/mixerslist.h index a0cc9f0c72..07854c2bd2 100644 --- a/companion/src/modeledit/mixerslist.h +++ b/companion/src/modeledit/mixerslist.h @@ -1,8 +1,7 @@ #ifndef MIXERSLIST_H #define MIXERSLIST_H -#include - +#include #define MIX_ROW_HEIGHT_INCREASE 8 //how much space is added above mixer row (for new channel), if 0 space adding is disabled const int GroupHeaderRole = (Qt::UserRole+2); //defines new user role for list items. If value is > 0, then space is added before that item diff --git a/companion/src/modeledit/mixes.cpp b/companion/src/modeledit/mixes.cpp index 33f325243c..d7c3a3313b 100644 --- a/companion/src/modeledit/mixes.cpp +++ b/companion/src/modeledit/mixes.cpp @@ -1,7 +1,5 @@ #include "mixes.h" #include "helpers.h" -// #include -// #include "expodialog.h" MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware): ModelPanel(parent, model, generalSettings, firmware), diff --git a/companion/src/modeledit/modeledit.cpp b/companion/src/modeledit/modeledit.cpp index be5226042d..c2d5cf720d 100644 --- a/companion/src/modeledit/modeledit.cpp +++ b/companion/src/modeledit/modeledit.cpp @@ -13,7 +13,6 @@ #include "customfunctions.h" #include "telemetry.h" #include "appdata.h" -#include ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmware * firmware) : QDialog(parent), diff --git a/companion/src/modeledit/modeledit.h b/companion/src/modeledit/modeledit.h index 396d149cd8..80b8d9029d 100644 --- a/companion/src/modeledit/modeledit.h +++ b/companion/src/modeledit/modeledit.h @@ -1,7 +1,7 @@ #ifndef MODELEDIT_H #define MODELEDIT_H -#include +#include #include "genericpanel.h" class RadioData; diff --git a/companion/src/modeledit/node.h b/companion/src/modeledit/node.h index 8d80e14c22..da102aa02e 100644 --- a/companion/src/modeledit/node.h +++ b/companion/src/modeledit/node.h @@ -42,7 +42,7 @@ #ifndef NODE_H #define NODE_H -#include +#include #define DEFAULT_BALL_SIZE 10 #define BALL_HEIGHT 2 diff --git a/companion/src/modeledit/setup.cpp b/companion/src/modeledit/setup.cpp index a15c750db7..bf3ffff4e4 100644 --- a/companion/src/modeledit/setup.cpp +++ b/companion/src/modeledit/setup.cpp @@ -115,7 +115,7 @@ void TimerPanel::on_minuteBeep_toggled(bool checked) void TimerPanel::on_name_editingFinished() { int length = ui->name->maxLength(); - strncpy(timer.name, ui->name->text().toAscii(), length); + strncpy(timer.name, ui->name->text().toLatin1(), length); emit modified(); } @@ -728,14 +728,14 @@ void SetupPanel::on_throttleSource_currentIndexChanged(int index) void SetupPanel::on_name_editingFinished() { int length = ui->name->maxLength(); - strncpy(model->name, ui->name->text().toAscii(), length); + strncpy(model->name, ui->name->text().toLatin1(), length); emit modified(); } void SetupPanel::on_image_currentIndexChanged(int index) { if (!lock) { - strncpy(model->bitmap, ui->image->currentText().toAscii(), 10); + strncpy(model->bitmap, ui->image->currentText().toLatin1(), 10); QString path = g.profile[g.id()].sdPath(); path.append("/BMP/"); QDir qd(path); diff --git a/companion/src/modeledit/setup.h b/companion/src/modeledit/setup.h index 0e4c9d7f8b..4c0261d893 100644 --- a/companion/src/modeledit/setup.h +++ b/companion/src/modeledit/setup.h @@ -3,12 +3,6 @@ #include "modeledit.h" #include "eeprominterface.h" -#include -#include -#include -#include -#include -#include namespace Ui { class Setup; diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index 20ca272425..85738526f3 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -648,7 +648,7 @@ void TelemetrySensorPanel::updateSourcesComboBox(AutoComboBox * cb, bool negativ void TelemetrySensorPanel::on_name_editingFinished() { if (!lock) { - strcpy(sensor.label, ui->name->text().toAscii()); + strcpy(sensor.label, ui->name->text().toLatin1()); emit dataModified(); emit modified(); } diff --git a/companion/src/modeledit/telemetry.h b/companion/src/modeledit/telemetry.h index f0c5705b44..5d985e4bfa 100644 --- a/companion/src/modeledit/telemetry.h +++ b/companion/src/modeledit/telemetry.h @@ -3,9 +3,6 @@ #include "modeledit.h" #include "eeprominterface.h" -#include -#include -#include class AutoComboBox; diff --git a/companion/src/modeledit/templates.cpp b/companion/src/modeledit/templates.cpp index 30b383ff65..2b9cc5b865 100644 --- a/companion/src/modeledit/templates.cpp +++ b/companion/src/modeledit/templates.cpp @@ -1,6 +1,4 @@ #include "templates.h" -#include -#include #define CHANNEL_ORDER(x) generalSettings.getDefaultStick(x) #define CC(x) (CHANNEL_ORDER(x)) //need to invert this to work with dest diff --git a/companion/src/modeledit/templates.h b/companion/src/modeledit/templates.h index 2f485f41ec..d5e8954bfc 100644 --- a/companion/src/modeledit/templates.h +++ b/companion/src/modeledit/templates.h @@ -1,7 +1,7 @@ #ifndef TEMPLATES_H #define TEMPLATES_H -#include +#include #include "eeprominterface.h" class Templates : public QWidget diff --git a/companion/src/modelprinter.cpp b/companion/src/modelprinter.cpp index 2e8fd8a889..f3650d1842 100644 --- a/companion/src/modelprinter.cpp +++ b/companion/src/modelprinter.cpp @@ -269,7 +269,7 @@ QString ModelPrinter::printInputName(int idx) else { result = RawSource(SOURCE_TYPE_STICK, idx).toString(&model); } - return Qt::escape(result); + return result.toHtmlEscaped(); } QString ModelPrinter::printInputLine(int idx) @@ -288,29 +288,29 @@ QString ModelPrinter::printInputLine(const ExpoData & input) } if (firmware->getCapability(VirtualInputs)) { - str += Qt::escape(input.srcRaw.toString(&model)); + str += input.srcRaw.toString(&model).toHtmlEscaped(); } - str += " " + Qt::escape(tr("Weight")) + QString("(%1)").arg(getGVarString(input.weight,true)); - if (input.curve.value) str += " " + Qt::escape(input.curve.toString()); + str += " " + tr("Weight").toHtmlEscaped() + QString("(%1)").arg(getGVarString(input.weight,true).toHtmlEscaped()); + if (input.curve.value) str += " " + input.curve.toString().toHtmlEscaped(); QString flightModesStr = printFlightModes(input.flightModes); - if (!flightModesStr.isEmpty()) str += " " + Qt::escape(flightModesStr); + if (!flightModesStr.isEmpty()) str += " " + flightModesStr.toHtmlEscaped(); if (input.swtch.type != SWITCH_TYPE_NONE) - str += " " + Qt::escape(tr("Switch")) + QString("(%1)").arg(input.swtch.toString()); + str += " " + tr("Switch").toHtmlEscaped() + QString("(%1)").arg(input.swtch.toString().toHtmlEscaped()); if (firmware->getCapability(VirtualInputs)) { - if (input.carryTrim>0) str += " " + Qt::escape(tr("NoTrim")); - else if (input.carryTrim<0) str += " " + Qt::escape(RawSource(SOURCE_TYPE_TRIM, (-(input.carryTrim)-1)).toString(&model)); + if (input.carryTrim>0) str += " " + tr("NoTrim").toHtmlEscaped(); + else if (input.carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(input.carryTrim)-1)).toString(&model).toHtmlEscaped(); } if (input.offset) - str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(input.offset))); + str += " " + tr("Offset(%1)").arg(getGVarString(input.offset)).toHtmlEscaped(); if (firmware->getCapability(HasExpoNames) && input.name[0]) - str += Qt::escape(QString(" [%1]").arg(input.name)); + str += QString(" [%1]").arg(input.name).toHtmlEscaped(); return str; } @@ -326,7 +326,7 @@ QString ModelPrinter::printMixerName(int curDest) name.append(" "); str += name.left(8); } - return Qt::escape(str); + return str.toHtmlEscaped(); } QString ModelPrinter::printMixerLine(int idx, bool showMultiplex, int highlightedSource) @@ -349,43 +349,43 @@ QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, in str += "  "; } // highlight source if needed - QString source = Qt::escape(mix.srcRaw.toString(&model)); + QString source = mix.srcRaw.toString(&model).toHtmlEscaped(); if ( (mix.srcRaw.type == SOURCE_TYPE_CH) && (mix.srcRaw.index+1 == (int)highlightedSource) ) { source = "" + source + ""; } str += " " + source; - str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(mix.weight, true))); + str += " " + tr("Weight(%1)").arg(getGVarString(mix.weight, true)).toHtmlEscaped(); QString flightModesStr = printFlightModes(mix.flightModes); if (!flightModesStr.isEmpty()) - str += " " + Qt::escape(flightModesStr); + str += " " + flightModesStr.toHtmlEscaped(); if (mix.swtch.type != SWITCH_TYPE_NONE) - str += " " + Qt::escape(tr("Switch(%1)").arg(mix.swtch.toString())); + str += " " + tr("Switch(%1)").arg(mix.swtch.toString()).toHtmlEscaped(); if (mix.carryTrim > 0) - str += " " + Qt::escape(tr("NoTrim")); + str += " " + tr("NoTrim").toHtmlEscaped(); else if (mix.carryTrim < 0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(mix.carryTrim)-1)).toString(&model); if (firmware->getCapability(HasNoExpo) && mix.noExpo) - str += " " + Qt::escape(tr("No DR/Expo")); + str += " " + tr("No DR/Expo").toHtmlEscaped(); if (mix.sOffset) - str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(mix.sOffset))); + str += " " + tr("Offset(%1)").arg(getGVarString(mix.sOffset)).toHtmlEscaped(); if (mix.curve.value) - str += " " + Qt::escape(mix.curve.toString()); + str += " " + mix.curve.toString().toHtmlEscaped(); int scale = firmware->getCapability(SlowScale); if (scale == 0) scale = 1; if (mix.delayDown || mix.delayUp) - str += " " + Qt::escape(tr("Delay(u%1:d%2)").arg((double)mix.delayUp/scale).arg((double)mix.delayDown/scale)); + str += " " + tr("Delay(u%1:d%2)").arg((double)mix.delayUp/scale).arg((double)mix.delayDown/scale).toHtmlEscaped(); if (mix.speedDown || mix.speedUp) - str += " " + Qt::escape(tr("Slow(u%1:d%2)").arg((double)mix.speedUp/scale).arg((double)mix.speedDown/scale)); + str += " " + tr("Slow(u%1:d%2)").arg((double)mix.speedUp/scale).arg((double)mix.speedDown/scale).toHtmlEscaped(); if (mix.mixWarn) - str += " " + Qt::escape(tr("Warn(%1)").arg(mix.mixWarn)); + str += " " + tr("Warn(%1)").arg(mix.mixWarn).toHtmlEscaped(); if (firmware->getCapability(HasMixerNames) && mix.name[0]) - str += Qt::escape(QString(" [%1]").arg(mix.name)); + str += QString(" [%1]").arg(mix.name).toHtmlEscaped(); return str; } diff --git a/companion/src/modelslist.h b/companion/src/modelslist.h index b21d4914ba..8014a1ae4e 100644 --- a/companion/src/modelslist.h +++ b/companion/src/modelslist.h @@ -42,8 +42,8 @@ #ifndef MODELSLIST_H #define MODELSLIST_H +#include #include "eeprominterface.h" -#include struct CurrentSelection { diff --git a/companion/src/printdialog.h b/companion/src/printdialog.h index a9dd4f35ba..bd64bde7c8 100644 --- a/companion/src/printdialog.h +++ b/companion/src/printdialog.h @@ -1,7 +1,7 @@ #ifndef _PRINTDIALOG_H #define _PRINTDIALOG_H -#include +#include #include "eeprominterface.h" #include "multimodelprinter.h" diff --git a/companion/src/process_sync.h b/companion/src/process_sync.h index 0835d933da..11d64fc6ac 100644 --- a/companion/src/process_sync.h +++ b/companion/src/process_sync.h @@ -1,6 +1,7 @@ #ifndef SYNCPROCESS_H_ #define SYNCPROCESS_H_ +#include #include #include diff --git a/companion/src/qcustomplot/CMakeLists.txt b/companion/src/qcustomplot/CMakeLists.txt index 26e7001bc6..d225139172 100644 --- a/companion/src/qcustomplot/CMakeLists.txt +++ b/companion/src/qcustomplot/CMakeLists.txt @@ -6,6 +6,7 @@ set(qcustomplot_HDRS qcustomplot.h ) -qt4_wrap_cpp(qcustomplot_SRCS ${qcustomplot_HDRS}) +qt5_wrap_cpp(qcustomplot_SRCS ${qcustomplot_HDRS}) add_library(qcustomplot ${qcustomplot_SRCS}) +qt5_use_modules(qcustomplot Widgets PrintSupport) diff --git a/companion/src/qcustomplot/qcustomplot.h b/companion/src/qcustomplot/qcustomplot.h index b339237439..b9a026e27d 100644 --- a/companion/src/qcustomplot/qcustomplot.h +++ b/companion/src/qcustomplot/qcustomplot.h @@ -45,14 +45,8 @@ #include #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -# include -# include -# include -#else -# include -# include -#endif +#include +#include class QCPPainter; class QCustomPlot; diff --git a/companion/src/qxtcommandoptions/CMakeLists.txt b/companion/src/qxtcommandoptions/CMakeLists.txt index fd8acfe154..d68a55908e 100644 --- a/companion/src/qxtcommandoptions/CMakeLists.txt +++ b/companion/src/qxtcommandoptions/CMakeLists.txt @@ -6,6 +6,8 @@ set(qxtcommandoptions_HDRS qxtcommandoptions.h ) -qt4_wrap_cpp(qxtcommandoptions_SRCS ${qxtcommandoptions_HDRS}) +qt5_wrap_cpp(qxtcommandoptions_SRCS ${qxtcommandoptions_HDRS}) add_library(qxtcommandoptions ${qxtcommandoptions_SRCS}) +qt5_use_modules(qxtcommandoptions Widgets) + diff --git a/companion/src/shared/CMakeLists.txt b/companion/src/shared/CMakeLists.txt index 3d283d315f..944126e1a6 100644 --- a/companion/src/shared/CMakeLists.txt +++ b/companion/src/shared/CMakeLists.txt @@ -16,6 +16,7 @@ set(shared_HDRS hexspinbox.h ) -qt4_wrap_cpp(shared_SRCS ${shared_HDRS}) +qt5_wrap_cpp(shared_SRCS ${shared_HDRS}) -add_library(shared ${shared_SRCS}) \ No newline at end of file +add_library(shared ${shared_SRCS}) +qt5_use_modules(shared Widgets) \ No newline at end of file diff --git a/companion/src/shared/autolineedit.h b/companion/src/shared/autolineedit.h index 154dd55e60..f72fce054f 100644 --- a/companion/src/shared/autolineedit.h +++ b/companion/src/shared/autolineedit.h @@ -44,7 +44,7 @@ class AutoLineEdit: public QLineEdit void onEdited() { if (field && !lock) { - strcpy(field, text().toAscii()); + strcpy(field, text().toLatin1()); if (panel) { emit panel->modified(); } diff --git a/companion/src/simulation/CMakeLists.txt b/companion/src/simulation/CMakeLists.txt index c2de4c69f3..fb91a5bdfe 100644 --- a/companion/src/simulation/CMakeLists.txt +++ b/companion/src/simulation/CMakeLists.txt @@ -53,7 +53,8 @@ include_directories( ${RADIO_SRC_DIRECTORY}/fonts/std ) -qt4_wrap_ui(simulation_SRCS ${simulation_UIS}) -qt4_wrap_cpp(simulation_SRCS ${simulation_HDRS}) +qt5_wrap_ui(simulation_SRCS ${simulation_UIS}) +qt5_wrap_cpp(simulation_SRCS ${simulation_HDRS}) add_library(simulation ${simulation_SRCS}) +qt5_use_modules(simulation Widgets Xml) diff --git a/companion/src/simulation/buttonswidget.h b/companion/src/simulation/buttonswidget.h index 56f417b267..5a820d0758 100644 --- a/companion/src/simulation/buttonswidget.h +++ b/companion/src/simulation/buttonswidget.h @@ -19,6 +19,7 @@ #include #include +#include class ButtonsWidget : public QWidget { diff --git a/companion/src/simulation/debugoutput.cpp b/companion/src/simulation/debugoutput.cpp index 03aa757d61..7e9f5f835c 100644 --- a/companion/src/simulation/debugoutput.cpp +++ b/companion/src/simulation/debugoutput.cpp @@ -1,5 +1,3 @@ -#include -#include #include "debugoutput.h" #include "ui_debugoutput.h" @@ -18,7 +16,6 @@ DebugOutput::DebugOutput(QWidget * parent): QFont newFont("Courier", 9); ui->Output->setFont(newFont); #endif - } DebugOutput::~DebugOutput() diff --git a/companion/src/simulation/debugoutput.h b/companion/src/simulation/debugoutput.h index bd91e6a3ec..6de0f68679 100644 --- a/companion/src/simulation/debugoutput.h +++ b/companion/src/simulation/debugoutput.h @@ -1,8 +1,7 @@ #ifndef debugoutput_h #define debugoutput_h - -#include +#include #include "simulatorinterface.h" namespace Ui { diff --git a/companion/src/simulation/joystick.cpp b/companion/src/simulation/joystick.cpp index a752630a98..f6543640d4 100644 --- a/companion/src/simulation/joystick.cpp +++ b/companion/src/simulation/joystick.cpp @@ -27,29 +27,31 @@ Joystick::~Joystick() bool Joystick::open(int stick) { - if ( isOpen() ) + if (isOpen()) close(); joystick = SDL_JoystickOpen(stick); - if ( joystick ) { + if (joystick) { numAxes = SDL_JoystickNumAxes(joystick); numButtons = SDL_JoystickNumButtons(joystick); numHats = SDL_JoystickNumHats(joystick); numTrackballs = SDL_JoystickNumBalls(joystick); joystickTimer.start(eventTimeout); - return TRUE; - } else { + return true; + } + else { fprintf(stderr, "ERROR: couldn't open SDL joystick #%d", stick); - return FALSE; + return false; } } void Joystick::close() { joystickTimer.stop(); - if ( joystick ) + if (joystick) { SDL_JoystickClose(joystick); - joystick = NULL; + joystick = NULL; + } numAxes = numButtons = numHats = numTrackballs = 0; } @@ -70,15 +72,19 @@ void Joystick::processEvents() emit axisValueChanged(i, moved); axes[i] = moved; axisRepeatTimers[i].restart(); - } else if (autoRepeat && moved != 0) { + } + else if (autoRepeat && moved != 0) { if ( axisRepeatTimers[i].elapsed() >= autoRepeatDelay ) { emit axisValueChanged(i, moved); axes[i] = moved; } - } else + } + else axisRepeatTimers[i].restart(); - } else + } + else { emit axisValueChanged(i, 0); + } } for (i = 0; i < numButtons; i++) { Uint8 changed = SDL_JoystickGetButton(joystick, i); diff --git a/companion/src/simulation/joystick.h b/companion/src/simulation/joystick.h index cecc9af0c5..8c4bc7d829 100644 --- a/companion/src/simulation/joystick.h +++ b/companion/src/simulation/joystick.h @@ -31,7 +31,7 @@ class Joystick : public QObject Joystick(QObject *parent = 0, int joystickEventTimeout = SDL_JOYSTICK_DEFAULT_EVENT_TIMEOUT, - bool doAutoRepeat = TRUE, + bool doAutoRepeat = true, int autoRepeatDelay = SDL_JOYSTICK_DEFAULT_AUTOREPEAT_DELAY); ~Joystick(); bool open(int); diff --git a/companion/src/simulation/joystickdialog.cpp b/companion/src/simulation/joystickdialog.cpp index 205ebe3cde..08287df9f0 100644 --- a/companion/src/simulation/joystickdialog.cpp +++ b/companion/src/simulation/joystickdialog.cpp @@ -1,7 +1,6 @@ #include "joystickdialog.h" #include "ui_joystickdialog.h" #include "appdata.h" -#include joystickDialog::joystickDialog(QWidget *parent, int stick) : QDialog(parent), diff --git a/companion/src/simulation/joystickdialog.h b/companion/src/simulation/joystickdialog.h index 9338ca6695..6f38d5d48b 100644 --- a/companion/src/simulation/joystickdialog.h +++ b/companion/src/simulation/joystickdialog.h @@ -1,8 +1,8 @@ #ifndef JOYSTICKDIALOG_H #define JOYSTICKDIALOG_H +#include #include "joystick.h" -#include namespace Ui { class joystickDialog; diff --git a/companion/src/simulation/simulatordialog.h b/companion/src/simulation/simulatordialog.h index ef3b92b536..2f7eb97899 100644 --- a/companion/src/simulation/simulatordialog.h +++ b/companion/src/simulation/simulatordialog.h @@ -1,7 +1,6 @@ #ifndef SIMULATORDIALOG_H #define SIMULATORDIALOG_H -#include #include "modeledit/node.h" #include "telemetrysimu.h" #include "trainersimu.h" diff --git a/companion/src/simulation/sliderwidget.h b/companion/src/simulation/sliderwidget.h index 90f094cb6e..15b947e033 100644 --- a/companion/src/simulation/sliderwidget.h +++ b/companion/src/simulation/sliderwidget.h @@ -3,6 +3,7 @@ #include #include +#include class SliderWidget : public QSlider { diff --git a/companion/src/simulation/telemetrysimu.cpp b/companion/src/simulation/telemetrysimu.cpp index 3ea0698e39..2c9806ffaf 100644 --- a/companion/src/simulation/telemetrysimu.cpp +++ b/companion/src/simulation/telemetrysimu.cpp @@ -518,7 +518,7 @@ uint32_t TelemetrySimulator::GPSEmulator::getNextPacketData(uint32_t packetType) switch (packetType) { case GPS_LONG_LATI_FIRST_ID: sendLat = !sendLat; - return sendLat ? encodeLatLon(lat, TRUE) : encodeLatLon(lon, FALSE); + return sendLat ? encodeLatLon(lat, true) : encodeLatLon(lon, false); break; case GPS_TIME_DATE_FIRST_ID: sendDate = !sendDate; diff --git a/companion/src/simulator.cpp b/companion/src/simulator.cpp index a0593ffd5b..14a7412eb3 100644 --- a/companion/src/simulator.cpp +++ b/companion/src/simulator.cpp @@ -91,11 +91,14 @@ void showMessage(const QString & message, enum QMessageBox::Icon icon = QMessage 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"); + g.init(); + #ifdef __APPLE__ app.setStyle(new MyProxyStyle); #endif @@ -108,7 +111,7 @@ int main(int argc, char *argv[]) app.installTranslator(&qtTranslator); */ - QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + // QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); #if defined(JOYSTICKS) || defined(SIMU_AUDIO) uint32_t sdlFlags = 0; @@ -131,7 +134,7 @@ int main(int argc, char *argv[]) registerSimulators(); registerOpenTxFirmwares(); - eedir = QDir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)); + eedir = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/data/OpenTX/Simulator"); if (!eedir.exists("OpenTX")) { eedir.mkdir("OpenTX"); } @@ -203,7 +206,7 @@ int main(int argc, char *argv[]) if (options.positional().isEmpty()) { eepromFileName = QString("eeprom-%1.bin").arg(radioId); - eepromFileName = eedir.filePath(eepromFileName.toAscii()); + eepromFileName = eedir.filePath(eepromFileName.toLatin1()); } else { eepromFileName = options.positional()[0]; @@ -230,7 +233,7 @@ int main(int argc, char *argv[]) } dialog->show(); - dialog->start(eepromFileName.toAscii().constData()); + dialog->start(eepromFileName.toLatin1().constData()); int result = app.exec(); diff --git a/companion/src/splashlabel.h b/companion/src/splashlabel.h index d82b23e4f9..32ff650198 100644 --- a/companion/src/splashlabel.h +++ b/companion/src/splashlabel.h @@ -16,9 +16,7 @@ #ifndef SPLASHLABEL_H #define SPLASHLABEL_H -#include -#include -#include +#include class splashLabel : public QLabel { @@ -28,7 +26,7 @@ class splashLabel : public QLabel public: explicit splashLabel(QDialog * parent = 0) : - QLabel(parent) + QLabel(parent) { } @@ -77,5 +75,6 @@ signals: private: int index; }; + #endif /* SPLASHLABEL_H */ diff --git a/companion/src/splashlibrarydialog.cpp b/companion/src/splashlibrarydialog.cpp index 0e737d2610..f9aafaa258 100644 --- a/companion/src/splashlibrarydialog.cpp +++ b/companion/src/splashlibrarydialog.cpp @@ -1,7 +1,6 @@ #include "splashlibrarydialog.h" #include "ui_splashlibrarydialog.h" #include "appdata.h" -#include #include "helpers.h" #include "firmwareinterface.h" #include "helpers.h" diff --git a/companion/src/splashlibrarydialog.h b/companion/src/splashlibrarydialog.h index b703e6a23c..6bd822e35a 100644 --- a/companion/src/splashlibrarydialog.h +++ b/companion/src/splashlibrarydialog.h @@ -1,8 +1,7 @@ #ifndef SPLASHLIBRARY_H #define SPLASHLIBRARY_H -#include -#include +#include namespace Ui { class SplashLibraryDialog; diff --git a/companion/src/wizarddialog.cpp b/companion/src/wizarddialog.cpp index 179efa974e..ecede5dd72 100644 --- a/companion/src/wizarddialog.cpp +++ b/companion/src/wizarddialog.cpp @@ -12,7 +12,6 @@ * */ -#include #include "wizarddialog.h" #include "wizarddata.h" #include "helpers.h" @@ -296,8 +295,8 @@ bool ModelSelectionPage::validatePage() QString newName(nameLineEdit->text()); newName = (newName.normalized(QString::NormalizationForm_D)); newName = newName.replace(QRegExp("[^ A-Za-z0-9_.-,\\s]"), ""); - strncpy( wizDlg->mix.name, newName.toAscii(), WIZ_MODEL_NAME_LENGTH); - wizDlg->mix.name[WIZ_MODEL_NAME_LENGTH]=0; + strncpy( wizDlg->mix.name, newName.toLatin1(), WIZ_MODEL_NAME_LENGTH); + wizDlg->mix.name[WIZ_MODEL_NAME_LENGTH] = 0; if (multirotorRB->isChecked()) wizDlg->mix.vehicle = MULTICOPTER; diff --git a/companion/src/wizarddialog.h b/companion/src/wizarddialog.h index f96f170baa..dff5c99db1 100644 --- a/companion/src/wizarddialog.h +++ b/companion/src/wizarddialog.h @@ -14,16 +14,9 @@ #ifndef WIZARDDIALOG_H #define WIZARDDIALOG_H -#include -#include "wizarddata.h" -QT_BEGIN_NAMESPACE -class QCheckBox; -class QLabel; -class QLineEdit; -class QRadioButton; -class QComboBox; -QT_END_NAMESPACE +#include +#include "wizarddata.h" class WizardDialog : public QWizard { diff --git a/companion/targets/windows/companion-vs.nsi.in b/companion/targets/windows/companion-vs.nsi.in index 78e54e0430..184d6edd0b 100644 --- a/companion/targets/windows/companion-vs.nsi.in +++ b/companion/targets/windows/companion-vs.nsi.in @@ -17,10 +17,10 @@ ;Default installation folder InstallDir "$PROGRAMFILES\OpenTX\Companion @VERSION_FAMILY@" - + ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\OpenTX\Companion @VERSION_FAMILY@" "" - + ;Compressor options SetCompressor /FINAL /SOLID lzma SetCompressorDictSize 64 @@ -63,16 +63,16 @@ !insertmacro MUI_PAGE_LICENSE "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\license.txt" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY - + ;Start Menu Folder Page Configuration - !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" - !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\OpenTX\Companion @VERSION_FAMILY@" + !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" + !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\OpenTX\Companion @VERSION_FAMILY@" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" - + !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder - + !insertmacro MUI_PAGE_INSTFILES - + # These indented statements modify settings for MUI_PAGE_FINISH !define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_FINISHPAGE_RUN @@ -82,13 +82,13 @@ # !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED # !define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme.txt !insertmacro MUI_PAGE_FINISH - + !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ;-------------------------------- ;Languages - + !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "French" @@ -98,7 +98,7 @@ Section "OpenTX Companion" SecDummy SetOutPath "$INSTDIR" - + File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\license.txt" File "..\Release\companion.exe" File "..\Release\simulator.exe" @@ -109,42 +109,43 @@ Section "OpenTX Companion" SecDummy !else File "@SYSDIR@\system32\pthreadVC2.dll" !endif - File "C:\Programs\SDL\lib\SDL.dll" File "@SYSDIR@\msvcp100.dll" File "@SYSDIR@\msvcr100.dll" - File "@QT_BINARY_DIR@\QtCore4.dll" - File "@QT_BINARY_DIR@\QtGui4.dll" - File "@QT_BINARY_DIR@\QtNetwork4.dll" - File "@QT_BINARY_DIR@\Phonon4.dll" - File "@QT_BINARY_DIR@\QtXml4.dll" + File "@QT_DLL_DIR@\Qt5Core.dll" + File "@QT_DLL_DIR@\Qt5Gui.dll" + File "@QT_DLL_DIR@\Qt5Widgets.dll" + File "@QT_DLL_DIR@\Qt5PrintSupport.dll" + File "@QT_DLL_DIR@\Qt5Network.dll" + File "@QT_DLL_DIR@\Qt5Multimedia.dll" + File "@QT_DLL_DIR@\Qt5Xml.dll" + File "@QT_DLL_DIR@\icudt54.dll" + File "@QT_DLL_DIR@\icuin54.dll" + File "@QT_DLL_DIR@\icuuc54.dll" + File "@SDL_DIR@\SDL.dll" File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\avrdude.exe" File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\avrdude.conf" File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\libusb0.dll" File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\dfu-util.exe" File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\libusb-1.0.dll" - - CreateDirectory "$INSTDIR\phonon_backend" - SetOutPath "$INSTDIR\phonon_backend" - File "@QT_BINARY_DIR@\..\plugins\phonon_backend\Phonon_ds94.dll" CreateDirectory "$INSTDIR\lang" SetOutPath "$INSTDIR\lang" File "src\*.qm" - + SetOutPath "$INSTDIR" ;Store installation folder WriteRegStr HKCU "Software\OpenTX\Companion @VERSION_FAMILY@" "" $INSTDIR - + ;Associate with extentions ,bin and .hex ${registerExtension} "$INSTDIR\companion.exe" ".bin" "BIN_File" ${registerExtension} "$INSTDIR\companion.exe" ".hex" "HEX_File" ${registerExtension} "$INSTDIR\companion.exe" ".companion" "EEPE_File" ${registerExtension} "$INSTDIR\companion.exe" ".eepm" "EEPM_File" - + ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" - + ;Registry information for add/remove programs WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX Companion @VERSION_FAMILY@" "DisplayName" "OpenTX Companion @VERSION_FAMILY@" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX Companion @VERSION_FAMILY@" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" @@ -152,15 +153,15 @@ Section "OpenTX Companion" SecDummy WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX Companion @VERSION_FAMILY@" "Publisher" "OpenTX" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX Companion @VERSION_FAMILY@" "URLInfoAbout" "http://www.open-tx.org" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX Companion @VERSION_FAMILY@" "QuietUninstallString" "$\"$INSTDIR\Uninstall.exe$\" /S" - + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application - + ;Create shortcuts CreateDirectory "$SMPROGRAMS\$StartMenuFolder" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Companion @VERSION_FAMILY@.lnk" "$INSTDIR\companion.exe" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Firmware Simulator @VERSION_FAMILY@.lnk" "$INSTDIR\simulator.exe" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall Companion @VERSION_FAMILY@.lnk" "$INSTDIR\Uninstall.exe" - + !insertmacro MUI_STARTMENU_WRITE_END SectionEnd @@ -176,14 +177,14 @@ SectionEnd !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy) !insertmacro MUI_FUNCTION_DESCRIPTION_END - + ;-------------------------------- ;Uninstaller Section Section "Uninstall" - ;ADD YOUR OWN FILES HERE... - + ;ADD YOUR OWN FILES HERE... + Delete "$INSTDIR\license.txt" Delete "$INSTDIR\companion.exe" Delete "$INSTDIR\simulator.exe" @@ -203,26 +204,26 @@ Section "Uninstall" Delete "$INSTDIR\dfu-util.exe" Delete "$INSTDIR\libusb-1.0.dll" Delete "$INSTDIR\Uninstall.exe" - + Delete "$INSTDIR\lang\*.*" Delete "$INSTDIR\phonon_backend\*.*" RMDir "$INSTDIR\lang" RMDir "$INSTDIR\phonon_backend" RMDir "$INSTDIR" - + ${unregisterExtension} ".bin" "BIN File" ${unregisterExtension} ".hex" "HEX File" ${unregisterExtension} ".eepm" "EEPE File" ${unregisterExtension} ".companion" "EEPM File" - + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder - + Delete "$SMPROGRAMS\$StartMenuFolder\Companion @VERSION_FAMILY@.lnk" Delete "$SMPROGRAMS\$StartMenuFolder\Firmware Simulator @VERSION_FAMILY@.lnk" Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall Companion @VERSION_FAMILY@.lnk" RMDir "$SMPROGRAMS\$StartMenuFolder" - + DeleteRegKey /ifempty HKCU "Software\OpenTX Companion @VERSION_FAMILY@" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTX Companion @VERSION_FAMILY@" diff --git a/companion/targets/windows/winbuild.h b/companion/targets/windows/winbuild.h index d00370ed90..64bdc89bb2 100644 --- a/companion/targets/windows/winbuild.h +++ b/companion/targets/windows/winbuild.h @@ -18,6 +18,7 @@ #define WINBUILD_H #define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) ) +#undef FORCEINLINE #define FORCEINLINE inline #define NOINLINE diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index 669ecd6723..e16079bae5 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -887,6 +887,7 @@ set(CMAKE_EXE_LINKER_FLAGS "") set(CMAKE_C_LINK_EXECUTABLE " -o ") set(CMAKE_CXX_LINK_EXECUTABLE " -o ") +if(NOT MSVC) if(ARCH STREQUAL ARM) cmake_force_c_compiler(arm-none-eabi-gcc GNU) cmake_force_cxx_compiler(arm-none-eabi-g++ GNU) @@ -958,3 +959,4 @@ if(CPU_FAMILY STREQUAL STM32) WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) endif() +endif() diff --git a/radio/util/commit-tests.sh b/radio/util/commit-tests.sh index d427c0911d..cf35991516 100755 --- a/radio/util/commit-tests.sh +++ b/radio/util/commit-tests.sh @@ -11,76 +11,77 @@ cd - mkdir build || true cd build +COMMON_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/opt/qt55" + # Companion rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=TARANIS ${SRCDIR} +cmake ${COMMON_OPTIONS} ${SRCDIR} make -j2 # OpenTX on 9X stock with FrSky telemetry rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=9X -DHELI=YES -DEXT=FRSKY ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=9X -DHELI=YES -DEXT=FRSKY ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests # OpenTX on 9X stock with Mavlink telemetry rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=9X -DHELI=YES -DEXT=MAVLINK ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=9X -DHELI=YES -DEXT=MAVLINK ${SRCDIR} make -j2 firmware # OpenTX on Mega2560 rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=MEGA2560 -DHELI=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=MEGA2560 -DHELI=YES ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests # OpenTX on Mega2560 with Mavlink telemetry rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=MEGA2560 -DEXT=MAVLINK -DHELI=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=MEGA2560 -DEXT=MAVLINK -DHELI=YES ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests # OpenTX on gruvin9x board rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=GRUVIN9X -DHELI=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=GRUVIN9X -DHELI=YES ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests # OpenTX on Sky9x rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=SKY9X -DHELI=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=SKY9X -DHELI=YES ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests # OpenTX on Taranis rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=TARANIS -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=TARANIS -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests # OpenTX on Taranis X9E rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=TARANIS -DPCBREV=REV9E -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=TARANIS -DPCBREV=REV9E -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests # OpenTX on Taranis Plus rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=TARANIS -DPCBREV=REVPLUS -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=TARANIS -DPCBREV=REVPLUS -DHELI=YES -DLUA=YES -DWARNINGS_AS_ERRORS=YES ${SRCDIR} make -j2 firmware make -j2 simu make -j2 gtests ; ./gtests # OpenTX on Horus rm -rf * -cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=HORUS -DHELI=NO -DUSB=SERIAL -DCLI=YES -DDEBUG=YES ${SRCDIR} +cmake ${COMMON_OPTIONS} -DPCB=HORUS -DHELI=NO -DUSB=SERIAL -DCLI=YES -DDEBUG=YES ${SRCDIR} make -j2 firmware make -j2 simu #make -j2 gtests ; ./gtests - diff --git a/radio/util/generate_datacopy.py b/radio/util/generate_datacopy.py index f0e395e674..3fd09c08dc 100644 --- a/radio/util/generate_datacopy.py +++ b/radio/util/generate_datacopy.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +from __future__ import print_function + import sys import clang.cindex @@ -7,21 +9,21 @@ structs = [] def build_struct(cursor): structs.append(cursor.spelling) - print "template \nvoid copy%s(A * dest, B * src)\n{" % cursor.spelling + print("template \nvoid copy%s(A * dest, B * src)\n{" % cursor.spelling) for c in cursor.get_children(): if c.kind == clang.cindex.CursorKind.FIELD_DECL: if c.type.get_array_size() > 0: if c.type.get_array_element_type().spelling in structs: - print " for (int i=0; i<%d; i++) {" % c.type.get_array_size() - print " copy%s(&dest->%s[i], &src->%s[i]);" % (c.type.get_array_element_type().spelling, c.spelling, c.spelling) - print " }" + print(" for (int i=0; i<%d; i++) {" % c.type.get_array_size()) + print(" copy%s(&dest->%s[i], &src->%s[i]);" % (c.type.get_array_element_type().spelling, c.spelling, c.spelling)) + print(" }") else: - print " memcpy(&dest->%s, &src->%s, sizeof(dest->%s));" % (c.spelling, c.spelling, c.spelling) + print(" memcpy(&dest->%s, &src->%s, sizeof(dest->%s));" % (c.spelling, c.spelling, c.spelling)) elif c.type.get_declaration().spelling in structs: - print " copy%s(&dest->%s, &src->%s);" % (c.type.get_declaration().spelling, c.spelling, c.spelling) + print(" copy%s(&dest->%s, &src->%s);" % (c.type.get_declaration().spelling, c.spelling, c.spelling)) else: - print " dest->%s = src->%s;" % (c.spelling, c.spelling) - print "}\n" + print(" dest->%s = src->%s;" % (c.spelling, c.spelling)) + print("}\n") def build(cursor): result = [] diff --git a/radio/util/img2lbm.py b/radio/util/img2lbm.py index a5e0b24efc..b911b9a86e 100755 --- a/radio/util/img2lbm.py +++ b/radio/util/img2lbm.py @@ -3,7 +3,10 @@ from __future__ import division, print_function import sys -from PyQt4 import Qt, QtGui +try: + from PyQt5 import Qt, QtGui +except: + from PyQt4 import Qt, QtGui image = QtGui.QImage(sys.argv[1]) width, height = image.size().width(), image.size().height()