1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-13 19:40:20 +03:00

Move to Qt5 and Qt5Multimedia

This commit is contained in:
Bertrand Songis 2015-08-09 22:32:17 +02:00
parent d7a9710a9c
commit aec2170e7e
98 changed files with 355 additions and 438 deletions

View file

@ -5,13 +5,14 @@ before_install:
- sudo add-apt-repository ppa:george-edison55/precise-backports --yes - 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:terry.guo/gcc-arm-embedded --yes
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test --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 - 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 - - 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 - rsync -av firmware.diydrones.com::Tools/Travis/*.deb ExtraPackages
install: 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" - sudo dpkg -i ExtraPackages/*.deb || echo "FAILED INSTALL OF EXTRA DEBS"
- export CXX="g++-5" CC="gcc-5" - export CXX="g++-5" CC="gcc-5"

View file

@ -9,6 +9,10 @@ set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_SUFFI
message(STATUS "OpenTX ${VERSION}") message(STATUS "OpenTX ${VERSION}")
cmake_minimum_required(VERSION 2.8) 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(CMAKE_CXX_STANDARD 11)
set(RADIO_DIRECTORY ${PROJECT_SOURCE_DIR}/radio) set(RADIO_DIRECTORY ${PROJECT_SOURCE_DIR}/radio)

View file

@ -93,7 +93,7 @@ ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework")
/opt/local/lib /opt/local/lib
/opt/csw/lib /opt/csw/lib
/opt/lib /opt/lib
C:/Programs/SDL/lib C:/Programs/SDL/lib/x86
) )
# Non-OS X framework versions expect you to also dynamically link to # Non-OS X framework versions expect you to also dynamically link to
# SDLmain. This is mainly for Windows and OS X. Other platforms # SDLmain. This is mainly for Windows and OS X. Other platforms
@ -109,7 +109,6 @@ ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework")
/opt/local/lib /opt/local/lib
/opt/csw/lib /opt/csw/lib
/opt/lib /opt/lib
C:/Programs/SDL/lib
) )
ENDIF(${SDL_INCLUDE_DIR} MATCHES ".framework") ENDIF(${SDL_INCLUDE_DIR} MATCHES ".framework")

View file

@ -38,20 +38,11 @@ else()
message("SDL not found! Joysticks support will be disabled. Simulator audio will not work.") message("SDL not found! Joysticks support will be disabled. Simulator audio will not work.")
endif() endif()
find_package(Qt4 4.8.1 REQUIRED) find_package(Qt5Widgets REQUIRED)
set(QT_USE_QTNETWORK True) find_package(Qt5Xml REQUIRED)
set(QT_USE_QTXML True) find_package(Qt5LinguistTools REQUIRED)
include(${QT_USE_FILE}) find_package(Qt5PrintSupport REQUIRED)
find_package(Qt5Multimedia REQUIRED)
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()
message(STATUS "Looking for QT lupdate ") message(STATUS "Looking for QT lupdate ")
find_package(Lupdate) find_package(Lupdate)
@ -114,9 +105,10 @@ set(common_SRCS
appdata.cpp appdata.cpp
) )
qt4_wrap_cpp(common_SRCS) qt5_wrap_cpp(common_SRCS)
add_library(common ${common_SRCS}) add_library(common ${common_SRCS})
qt5_use_modules(common Core Xml Widgets)
set(companion_SRCS set(companion_SRCS
hexinterface.cpp hexinterface.cpp
@ -211,7 +203,7 @@ set(companion_UIS
radionotfound.ui radionotfound.ui
) )
set(companion_RCS set(companion_RESOURCES
companion.qrc companion.qrc
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
) )
@ -239,23 +231,23 @@ foreach(language ${LANGUAGES})
set(companion_TS ${companion_TS} translations/companion_${language}.ts) set(companion_TS ${companion_TS} translations/companion_${language}.ts)
endforeach(language) endforeach(language)
set(companion_SRCS ${companion_SRCS}) qt5_wrap_ui(companion_SRCS ${companion_UIS})
qt4_wrap_ui(companion_SRCS ${companion_UIS}) qt5_wrap_cpp(companion_SRCS ${companion_MOC_HDRS})
qt4_wrap_cpp(companion_SRCS ${companion_MOC_HDRS}) qt5_add_translation(companion_QM ${companion_TS})
qt4_add_translation(companion_QM ${companion_TS}) qt5_add_resources(companion_RCC ${companion_RESOURCES})
qt4_add_resources(companion_SRCS ${companion_RCS})
add_definitions(-DQT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}") add_definitions(-DQT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}")
if(APPLE) 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 # OS X compiler no longer automatically includes /Library/Frameworks in search path
set(CMAKE_EXE_LINKER_FLAGS -F/Library/Frameworks) set(CMAKE_EXE_LINKER_FLAGS -F/Library/Frameworks)
else() else()
add_executable(${COMPANION_NAME} WIN32 ${companion_SRCS} ${companion_QM}) add_executable(${COMPANION_NAME} WIN32 ${companion_SRCS} ${companion_RCC} ${companion_QM})
endif() 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 ############### ############# Standalone simu ###############
@ -269,21 +261,20 @@ set(simu_MOC_HDRS
modeledit/node.h modeledit/node.h
) )
set(simu_SRCS ${simu_SRCS}) qt5_wrap_cpp(simu_SRCS ${simu_MOC_HDRS} )
qt4_wrap_cpp(simu_SRCS ${simu_MOC_HDRS})
qt4_add_resources(simu_SRCS companion.qrc) # TODO not needed
if(WIN32) if(WIN32)
set(simu_SRCS ${simu_SRCS} icon.rc) set(simu_SRCS ${simu_SRCS} icon.rc)
endif() endif()
if(APPLE) if(APPLE)
add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${simu_SRCS}) add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${simu_SRCS} ${companion_RCC})
else() else()
add_executable(${SIMULATOR_NAME} WIN32 ${simu_SRCS}) add_executable(${SIMULATOR_NAME} WIN32 ${simu_SRCS} ${companion_RCC})
endif() 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 #################### ############# 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) install(FILES ../targets/linux/45-companion-taranis.rules DESTINATION /lib/udev/rules.d RENAME 45-companion${C9X_NAME_SUFFIX}-taranis.rules)
# Linux specific code # Linux specific code
set(OperatingSystem "Linux") set(OperatingSystem "Linux")
else(${CMAKE_SYSTEM_NAME} MATCHES "Linux") else()
install(TARGETS ${COMPANION_NAME} DESTINATION ${QT_BINARY_DIR}) get_target_property(QtCore_LOCATION Qt5::Core LOCATION)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") 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}/$<CONFIG>)
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}/$<CONFIG>)
endif()
if(WIN32) if(WIN32)
if(MSVC) if(MSVC)

View file

@ -605,6 +605,10 @@ void AppData::warningId (const int x) { store(x, _warningId,
// Constructor // Constructor
AppData::AppData() AppData::AppData()
{
}
void AppData::init()
{ {
//Initialize the profiles //Initialize the profiles
for (int i=0; i<MAX_PROFILES; i++) for (int i=0; i<MAX_PROFILES; i++)

View file

@ -384,6 +384,7 @@ class AppData: protected CompStoreObj
// Constructor // Constructor
AppData(); AppData();
void init();
}; };
extern AppData g; extern AppData g;

View file

@ -109,14 +109,9 @@ void AppPreferencesDialog::initSettings()
ui->snapshotPath->setDisabled(true); ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true); ui->snapshotPathButton->setDisabled(true);
} }
#if defined(ALLOW_NIGHTLY_BUILDS)
ui->useCompanionNightlyBuilds->setChecked(g.useCompanionNightlyBuilds()); ui->useCompanionNightlyBuilds->setChecked(g.useCompanionNightlyBuilds());
ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds());
#else
ui->useCompanionNightlyBuilds->hide();
ui->useFirmwareNightlyBuilds->hide();
#endif
ui->autoCheckCompanion->setChecked(g.autoCheckApp()); ui->autoCheckCompanion->setChecked(g.autoCheckApp());
ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds());
ui->autoCheckFirmware->setChecked(g.autoCheckFw()); ui->autoCheckFirmware->setChecked(g.autoCheckFw());
ui->showSplash->setChecked(g.showSplash()); ui->showSplash->setChecked(g.showSplash());
ui->historySize->setValue(g.historySize()); ui->historySize->setValue(g.historySize());

View file

@ -1,8 +1,7 @@
#ifndef BURNCONFIGDIALOG_H_ #ifndef BURNCONFIGDIALOG_H_
#define BURNCONFIGDIALOG_H_ #define BURNCONFIGDIALOG_H_
#include <QDialog> #include <QtWidgets>
#include <QtGui>
#define MEM_TYPE_EEPROM 1 #define MEM_TYPE_EEPROM 1
#define MEM_TYPE_FLASH 2 #define MEM_TYPE_FLASH 2

View file

@ -82,12 +82,15 @@ class MyProxyStyle : public QProxyStyle
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
Q_INIT_RESOURCE(companion); Q_INIT_RESOURCE(companion);
QApplication app(argc, argv); QApplication app(argc, argv);
app.setApplicationName("OpenTX Companion"); app.setApplicationName("OpenTX Companion");
app.setOrganizationName("OpenTX"); app.setOrganizationName("OpenTX");
app.setOrganizationDomain("open-tx.org"); app.setOrganizationDomain("open-tx.org");
app.setAttribute(Qt::AA_DontShowIconsInMenus, false); app.setAttribute(Qt::AA_DontShowIconsInMenus, false);
g.init();
QStringList strl = QApplication::arguments(); QStringList strl = QApplication::arguments();
if (strl.contains("--version")) { if (strl.contains("--version")) {
printf("%s\n", VERSION); printf("%s\n", VERSION);
@ -106,7 +109,7 @@ int main(int argc, char *argv[])
app.installTranslator(&companionTranslator); app.installTranslator(&companionTranslator);
app.installTranslator(&qtTranslator); app.installTranslator(&qtTranslator);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); // QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
#if defined(JOYSTICKS) || defined(SIMU_AUDIO) #if defined(JOYSTICKS) || defined(SIMU_AUDIO)
uint32_t sdlFlags = 0; uint32_t sdlFlags = 0;

View file

@ -1,4 +1,4 @@
<RCC> <!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/"> <qresource prefix="/">
<file>images/customize.png</file> <file>images/customize.png</file>
<file>icon.png</file> <file>icon.png</file>

View file

@ -1,8 +1,7 @@
#ifndef _COMPAREDIALOG_H #ifndef _COMPAREDIALOG_H
#define _COMPAREDIALOG_H #define _COMPAREDIALOG_H
#include <QDialog> #include <QtWidgets>
#include <QLabel>
#include "multimodelprinter.h" #include "multimodelprinter.h"
namespace Ui { namespace Ui {

View file

@ -27,7 +27,7 @@ bool convertEEprom(const QString &sourceEEprom, const QString &destinationEEprom
QSharedPointer<RadioData> radioData = QSharedPointer<RadioData>(new RadioData()); QSharedPointer<RadioData> radioData = QSharedPointer<RadioData>(new RadioData());
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size)); std::bitset<NUM_ERRORS> 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)) { || !currentFirmware->saveEEPROM((uint8_t *)eeprom.data(), *radioData, variant, version)) {
return false; return false;
} }

View file

@ -1,8 +1,7 @@
#ifndef CUSTOMIZESPLASHDIALOG_H #ifndef CUSTOMIZESPLASHDIALOG_H
#define CUSTOMIZESPLASHDIALOG_H #define CUSTOMIZESPLASHDIALOG_H
#include <QtGui> #include <QtWidgets>
#include <QDialog>
#include "firmwareinterface.h" #include "firmwareinterface.h"
namespace Ui namespace Ui

View file

@ -1,7 +1,5 @@
#include "downloaddialog.h" #include "downloaddialog.h"
#include "ui_downloaddialog.h" #include "ui_downloaddialog.h"
#include <QMessageBox>
#include <QtGui>
#include <QTime> #include <QTime>
#include "helpers.h" #include "helpers.h"

View file

@ -1,13 +1,12 @@
#ifndef DOWNLOADDIALOG_H #ifndef DOWNLOADDIALOG_H
#define DOWNLOADDIALOG_H #define DOWNLOADDIALOG_H
#include <QDialog> #include <QtWidgets>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply> #include <QNetworkReply>
#include <QNetworkRequest> #include <QNetworkRequest>
#include <QFile> #include <QFile>
namespace Ui { namespace Ui {
class downloadDialog; class downloadDialog;
} }

View file

@ -1,6 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <list> #include <list>
#include <float.h> #include <float.h>
#include <QtWidgets>
#include "eeprominterface.h" #include "eeprominterface.h"
#include "firmwares/er9x/er9xinterface.h" #include "firmwares/er9x/er9xinterface.h"
#include "firmwares/th9x/th9xinterface.h" #include "firmwares/th9x/th9xinterface.h"
@ -1169,9 +1170,9 @@ GeneralSettings::GeneralSettings()
byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16); byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
if (ok) if (ok)
imperial=byte8u; imperial=byte8u;
QString chars=t_CountrySet.mid(4,2); QString chars = t_CountrySet.mid(4, 2);
ttsLanguage[0]=chars[0].toAscii(); ttsLanguage[0] = chars[0].toLatin1();
ttsLanguage[1]=chars[1].toAscii(); ttsLanguage[1] = chars[1].toLatin1();
} }
} }
} }
@ -1685,7 +1686,7 @@ unsigned long LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->load(radioData, eeprom, size)); std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->load(radioData, eeprom, size));
if (result.test(NO_ERROR)) { if (result.test(ALL_OK)) {
return result.to_ulong(); return result.to_ulong();
} }
else { else {
@ -1705,7 +1706,7 @@ unsigned long LoadBackup(RadioData & radioData, uint8_t * eeprom, int size, int
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->loadBackup(radioData, eeprom, size, index)); std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->loadBackup(radioData, eeprom, size, index));
if (result.test(NO_ERROR)) { if (result.test(ALL_OK)) {
return result.to_ulong(); return result.to_ulong();
} }
else { else {
@ -1726,7 +1727,7 @@ unsigned long LoadEepromXml(RadioData & radioData, QDomDocument & doc)
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->loadxml(radioData, doc)); std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->loadxml(radioData, doc));
if (result.test(NO_ERROR)) { if (result.test(ALL_OK)) {
return result.to_ulong(); return result.to_ulong();
} }
else { else {

View file

@ -21,7 +21,7 @@
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QList> #include <QList>
#include <QtXml> #include <QtXml> // This should be removed from here, and remove Xml dependency from all libs which don't need it.
#include <QComboBox> #include <QComboBox>
#include <iostream> #include <iostream>
#include <bitset> #include <bitset>
@ -1507,8 +1507,7 @@ void registerOpenTxFirmwares();
void unregisterOpenTxFirmwares(); void unregisterOpenTxFirmwares();
enum EepromLoadErrors { enum EepromLoadErrors {
NO_ERROR, ALL_OK,
UNKNOWN_ERROR, UNKNOWN_ERROR,
UNSUPPORTED_NEWER_VERSION, UNSUPPORTED_NEWER_VERSION,
WRONG_SIZE, WRONG_SIZE,

View file

@ -114,7 +114,7 @@ unsigned long Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
} }
} }
std::cout << "ok\n"; std::cout << "ok\n";
errors.set(NO_ERROR); errors.set(ALL_OK);
return errors.to_ulong(); return errors.to_ulong();
} }
@ -186,7 +186,7 @@ unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i
} }
std::cout << "ok\n"; std::cout << "ok\n";
errors.set(NO_ERROR); errors.set(ALL_OK);
return errors.to_ulong(); return errors.to_ulong();
} }
@ -261,7 +261,7 @@ QDomElement Er9xInterface::getGeneralDataXML(QDomDocument * qdoc, Er9xGeneral *
{ {
QDomElement gd = qdoc->createElement("GENERAL_DATA"); QDomElement gd = qdoc->createElement("GENERAL_DATA");
appendNumberElement(qdoc, &gd, "Version", tgen->myVers, true); // have to write value here 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)); appendCDATAElement(qdoc, &gd, "Data", (const char *)tgen,sizeof(Er9xGeneral));
return gd; return gd;
} }
@ -271,7 +271,7 @@ QDomElement Er9xInterface::getModelDataXML(QDomDocument * qdoc, Er9xModelData *
QDomElement md = qdoc->createElement("MODEL_DATA"); QDomElement md = qdoc->createElement("MODEL_DATA");
md.setAttribute("number", modelNum); md.setAttribute("number", modelNum);
appendNumberElement(qdoc, &md, "Version", mdver, true); // have to write value here 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)); appendCDATAElement(qdoc, &md, "Data", (const char *)tmod,sizeof(Er9xModelData));
return md; return md;
} }
@ -289,7 +289,7 @@ bool Er9xInterface::loadGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen)
while (!n.isNull()) { while (!n.isNull()) {
if (n.isCDATASection()) { if (n.isCDATASection()) {
QString ds = n.toCDATASection().data(); QString ds = n.toCDATASection().data();
QByteArray ba = QByteArray::fromBase64(ds.toAscii()); QByteArray ba = QByteArray::fromBase64(ds.toLatin1());
const char * data = ba.data(); const char * data = ba.data();
memcpy(tgen, data, sizeof(Er9xGeneral)); memcpy(tgen, data, sizeof(Er9xGeneral));
break; break;
@ -326,7 +326,7 @@ bool Er9xInterface::loadModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod,
while (!n.isNull()) { while (!n.isNull()) {
if (n.isCDATASection()) { if (n.isCDATASection()) {
QString ds = n.toCDATASection().data(); QString ds = n.toCDATASection().data();
QByteArray ba = QByteArray::fromBase64(ds.toAscii()); QByteArray ba = QByteArray::fromBase64(ds.toLatin1());
const char * data = ba.data(); const char * data = ba.data();
memcpy(tmod, data, sizeof(Er9xModelData)); memcpy(tmod, data, sizeof(Er9xModelData));
break; break;

View file

@ -152,7 +152,7 @@ unsigned long Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
} }
} }
std::cout << "ok\n"; std::cout << "ok\n";
errors.set(NO_ERROR); errors.set(ALL_OK);
return errors.to_ulong(); return errors.to_ulong();
} }
@ -230,7 +230,7 @@ unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom
} }
std::cout << "ok\n"; std::cout << "ok\n";
errors.set(NO_ERROR); errors.set(ALL_OK);
return errors.to_ulong(); return errors.to_ulong();
} }
@ -305,7 +305,7 @@ QDomElement Ersky9xInterface::getGeneralDataXML(QDomDocument * qdoc, Ersky9xGene
{ {
QDomElement gd = qdoc->createElement("GENERAL_DATA"); QDomElement gd = qdoc->createElement("GENERAL_DATA");
appendNumberElement(qdoc, &gd, "Version", tgen->myVers, true); // have to write value here 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)); appendCDATAElement(qdoc, &gd, "Data", (const char *)tgen,sizeof(Ersky9xGeneral));
return gd; return gd;
} }
@ -315,7 +315,7 @@ QDomElement Ersky9xInterface::getModelDataXML(QDomDocument * qdoc, Ersky9xModelD
QDomElement md = qdoc->createElement("MODEL_DATA"); QDomElement md = qdoc->createElement("MODEL_DATA");
md.setAttribute("number", modelNum); md.setAttribute("number", modelNum);
appendNumberElement(qdoc, &md, "Version", mdver, true); // have to write value here 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)); appendCDATAElement(qdoc, &md, "Data", (const char *)tmod,sizeof(Ersky9xModelData_v11));
return md; return md;
} }
@ -333,7 +333,7 @@ bool Ersky9xInterface::loadGeneralDataXML(QDomDocument * qdoc, Ersky9xGeneral *
while (!n.isNull()) { while (!n.isNull()) {
if (n.isCDATASection()) { if (n.isCDATASection()) {
QString ds = n.toCDATASection().data(); QString ds = n.toCDATASection().data();
QByteArray ba = QByteArray::fromBase64(ds.toAscii()); QByteArray ba = QByteArray::fromBase64(ds.toLatin1());
const char * data = ba.data(); const char * data = ba.data();
memcpy(tgen, data, std::min((unsigned int)ba.size(), (unsigned int)sizeof(Ersky9xGeneral))); memcpy(tgen, data, std::min((unsigned int)ba.size(), (unsigned int)sizeof(Ersky9xGeneral)));
break; break;
@ -373,7 +373,7 @@ bool Ersky9xInterface::loadModelDataXML(QDomDocument * qdoc, ModelData *model, i
while (!n.isNull()) { while (!n.isNull()) {
if (n.isCDATASection()) { if (n.isCDATASection()) {
QString ds = n.toCDATASection().data(); QString ds = n.toCDATASection().data();
QByteArray ba = QByteArray::fromBase64(ds.toAscii()); QByteArray ba = QByteArray::fromBase64(ds.toLatin1());
const char * data = ba.data(); const char * data = ba.data();
memcpy(&ersky9xModel, data, std::min(ba.size(), (int)sizeof(ersky9xModel))); memcpy(&ersky9xModel, data, std::min(ba.size(), (int)sizeof(ersky9xModel)));
break; break;

View file

@ -207,7 +207,7 @@ unsigned long Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eepro
} }
std::cout << "ok\n"; std::cout << "ok\n";
errors.set(NO_ERROR); errors.set(ALL_OK);
return errors.to_ulong(); return errors.to_ulong();
} }

View file

@ -392,8 +392,8 @@ template <int N>
class SwitchField: public ConversionField< SignedField<N> > { class SwitchField: public ConversionField< SignedField<N> > {
public: public:
SwitchField(RawSwitch & sw, BoardEnum board, unsigned int version, unsigned long flags=0): SwitchField(RawSwitch & sw, BoardEnum board, unsigned int version, unsigned long flags=0):
ConversionField< SignedField<N> >(_switch, SwitchesConversionTable::getInstance(board, version, flags), QObject::tr("Switch").toAscii(), ConversionField< SignedField<N> >(_switch, SwitchesConversionTable::getInstance(board, version, flags), QObject::tr("Switch").toLatin1(),
QObject::tr("Switch ").toAscii()+ sw.toString()+ QObject::tr(" cannot be exported on this board!").toAscii()), QObject::tr("Switch ").toLatin1()+ sw.toString()+ QObject::tr(" cannot be exported on this board!").toLatin1()),
sw(sw), sw(sw),
_switch(0) _switch(0)
{ {

View file

@ -393,7 +393,7 @@ unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *e
} }
} }
std::cout << " ok\n"; std::cout << " ok\n";
errors.set(NO_ERROR); errors.set(ALL_OK);
return errors.to_ulong(); return errors.to_ulong();
} }
@ -973,7 +973,7 @@ EepromLoadErrors OpenTxEepromInterface::checkVersion(unsigned int version)
return NOT_OPENTX; return NOT_OPENTX;
} }
return NO_ERROR; return ALL_OK;
} }
bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int variant) 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"; std::cout << " ok\n";
errors.set(NO_ERROR); errors.set(ALL_OK);
return errors.to_ulong(); return errors.to_ulong();
} }

View file

@ -107,67 +107,59 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# 9X with ATmega64 # 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_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_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 # 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_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_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 # 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_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_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 # 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_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_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 # Gruvin9x
target_include_directories(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/gruvin9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) 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_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 # Mega2560
target_include_directories(opentx-mega2560${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/mega2560 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) 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_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 # Sky9x
target_include_directories(opentx-sky9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) 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_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 # 9XR-PRO
target_include_directories(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) 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_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 # AR9X
target_include_directories(opentx-ar9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x) 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_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 # Taranis standard
target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/taranis) 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_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 # Taranis Plus
target_include_directories(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/taranis) 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_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 # Taranis X9E
target_include_directories(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/taranis) 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_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 # 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_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_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 add_custom_target(opentx-simulators
DEPENDS ${OPENTX_LIBRARIES} DEPENDS ${OPENTX_LIBRARIES}
@ -175,18 +167,18 @@ add_custom_target(opentx-simulators
if(APPLE) if(APPLE)
set(SIMULATOR_BUNDLES) set(SIMULATOR_BUNDLES)
foreach(_file ${OPENTX_LIBRARIES}) foreach(library ${OPENTX_LIBRARIES})
set(SIMULATOR_BUNDLE "${_file}-bundle") set(SIMULATOR_BUNDLE "${library}-bundle")
add_custom_target(${SIMULATOR_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/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${_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${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${_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${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${_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${library}.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 @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL lib${library}.dylib
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMAND pwd COMMAND pwd
COMMAND cp lib${_file}.dylib companion.app/Contents/Resources/ COMMAND cp lib${library}.dylib companion.app/Contents/Resources/
DEPENDS ${_file} DEPENDS ${library}
) )
list(APPEND SIMULATOR_BUNDLES ${SIMULATOR_BUNDLE}) list(APPEND SIMULATOR_BUNDLES ${SIMULATOR_BUNDLE})
endforeach() endforeach()

View file

@ -491,7 +491,7 @@ OpenTxSimulator::OpenTxSimulator()
void OpenTxSimulator::setSdPath(const QString &sdPath) void OpenTxSimulator::setSdPath(const QString &sdPath)
{ {
#if defined(SDCARD) #if defined(SDCARD)
strncpy(simuSdDirectory, sdPath.toAscii().constData(), sizeof(simuSdDirectory)-1); strncpy(simuSdDirectory, sdPath.toLatin1().constData(), sizeof(simuSdDirectory)-1);
simuSdDirectory[sizeof(simuSdDirectory)-1] = '\0'; simuSdDirectory[sizeof(simuSdDirectory)-1] = '\0';
#endif #endif
} }

View file

@ -123,7 +123,7 @@ unsigned long Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, i
} }
std::cout << "ok\n"; std::cout << "ok\n";
errors.set(NO_ERROR); errors.set(ALL_OK);
return errors.to_ulong(); return errors.to_ulong();
} }

View file

@ -126,7 +126,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
if (xmlOK) { if (xmlOK) {
RadioData * radioData = new RadioData(); RadioData * radioData = new RadioData();
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEepromXml(*radioData, doc)); std::bitset<NUM_ERRORS> 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)); QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings File %1").arg(filename));
} }
else { else {
@ -162,7 +162,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
RadioData * radioData = new RadioData(); RadioData * radioData = new RadioData();
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(*radioData, (const uint8_t *)eeprom.data(), eeprom_size)); std::bitset<NUM_ERRORS> 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)); QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings file %1").arg(filename));
} }
else { else {

View file

@ -1,7 +1,7 @@
#ifndef FLASHEEPROMDIALOG_H_ #ifndef FLASHEEPROMDIALOG_H_
#define FLASHEEPROMDIALOG_H_ #define FLASHEEPROMDIALOG_H_
#include <QDialog> #include <QtWidgets>
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE" #define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
#define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE" #define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE"

View file

@ -203,7 +203,6 @@ void FlashFirmwareDialog::on_useLibrarySplash_clicked()
void FlashFirmwareDialog::on_burnButton_clicked() void FlashFirmwareDialog::on_burnButton_clicked()
{ {
g.flashDir(QFileInfo(fwName).dir().absolutePath()); g.flashDir(QFileInfo(fwName).dir().absolutePath());
g.profile[g.id()].fwName(fwName);
g.checkHardwareCompatibility(ui->checkHardwareCompatibility->isChecked()); g.checkHardwareCompatibility(ui->checkHardwareCompatibility->isChecked());
g.backupOnFlash(ui->backupEEprom->isChecked()); g.backupOnFlash(ui->backupEEprom->isChecked());

View file

@ -1,8 +1,7 @@
#ifndef FLASH_FIRMWARE_DIALOG_H #ifndef FLASH_FIRMWARE_DIALOG_H
#define FLASH_FIRMWARE_DIALOG_H #define FLASH_FIRMWARE_DIALOG_H
#include <QtGui> #include <QtWidgets>
#include <QDialog>
#include "eeprominterface.h" #include "eeprominterface.h"
#include "firmwareinterface.h" #include "firmwareinterface.h"
#include "xmlinterface.h" #include "xmlinterface.h"

View file

@ -24,7 +24,8 @@ foreach(name ${generaledit_NAMES})
set(generaledit_UIS ${generaledit_UIS} ${name}.ui) set(generaledit_UIS ${generaledit_UIS} ${name}.ui)
endforeach() endforeach()
qt4_wrap_ui(generaledit_SRCS ${generaledit_UIS}) qt5_wrap_ui(generaledit_SRCS ${generaledit_UIS})
qt4_wrap_cpp(generaledit_SRCS ${generaledit_HDRS}) qt5_wrap_cpp(generaledit_SRCS ${generaledit_HDRS})
add_library(generaledit ${generaledit_SRCS}) add_library(generaledit ${generaledit_SRCS})
qt5_use_modules(generaledit Widgets Xml Multimedia)

View file

@ -14,7 +14,7 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
this->setLayout(layout); this->setLayout(layout);
tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
tableWidget->setColumnCount(3); tableWidget->setColumnCount(3);
tableWidget->setShowGrid(false); tableWidget->setShowGrid(false);
tableWidget->setSelectionMode(QAbstractItemView::NoSelection); tableWidget->setSelectionMode(QAbstractItemView::NoSelection);

View file

@ -1,6 +1,3 @@
#include <QDateTime>
#include <QtGui>
#include <QScrollArea>
#include "generaledit.h" #include "generaledit.h"
#include "ui_generaledit.h" #include "ui_generaledit.h"
#include "helpers.h" #include "helpers.h"
@ -146,13 +143,13 @@ void GeneralEdit::on_calretrieve_PB_clicked()
int16_t offset; int16_t offset;
bool ok; bool ok;
for (int i=0; i<NUM_STICKS; i++) { for (int i=0; i<NUM_STICKS; i++) {
qba = controlNames.mid(3*i,3).toAscii(); qba = controlNames.mid(3*i,3).toLatin1();
strcpy(generalSettings.stickName[i], qba.data()); strcpy(generalSettings.stickName[i], qba.data());
} }
for (int i=0; i<(GetCurrentFirmware()->getCapability(Switches)); i++) { for (int i=0; i<(GetCurrentFirmware()->getCapability(Switches)); i++) {
Byte=hwtypes.mid(i,1); Byte=hwtypes.mid(i,1);
byte16=(int16_t)Byte.toInt(&ok,16); 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) if (ok)
generalSettings.switchConfig[i]=byte16; generalSettings.switchConfig[i]=byte16;
strcpy(generalSettings.switchName[i], qba.data()); 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++) { for (int i=0; i<(GetCurrentFirmware()->getCapability(Pots)); i++) {
Byte=hwtypes.mid(i+offset,1); Byte=hwtypes.mid(i+offset,1);
byte16=(int16_t)Byte.toInt(&ok,16); 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) if (ok)
generalSettings.potConfig[i]=byte16; generalSettings.potConfig[i]=byte16;
strcpy(generalSettings.potName[i], qba.data()); 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++) { for (int i=0; i<(GetCurrentFirmware()->getCapability(Sliders)); i++) {
Byte=hwtypes.mid(i+offset,1); Byte=hwtypes.mid(i+offset,1);
byte16=(int16_t)Byte.toInt(&ok,16); 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) if (ok)
generalSettings.sliderConfig[i]=byte16; generalSettings.sliderConfig[i]=byte16;
strcpy(generalSettings.sliderName[i], qba.data()); strcpy(generalSettings.sliderName[i], qba.data());
@ -225,8 +222,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
if (ok) if (ok)
generalSettings.imperial=byte8u; generalSettings.imperial=byte8u;
chars=CountrySet.mid(4,2); chars=CountrySet.mid(4,2);
generalSettings.ttsLanguage[0]=chars[0].toAscii(); generalSettings.ttsLanguage[0]=chars[0].toLatin1();
generalSettings.ttsLanguage[1]=chars[1].toAscii(); generalSettings.ttsLanguage[1]=chars[1].toLatin1();
} }
} }
else { else {

View file

@ -1,7 +1,7 @@
#ifndef GENERALEDIT_H #ifndef GENERALEDIT_H
#define GENERALEDIT_H #define GENERALEDIT_H
#include <QDialog> #include <QtWidgets>
#include "eeprominterface.h" #include "eeprominterface.h"
#include "genericpanel.h" #include "genericpanel.h"

View file

@ -1,6 +1,5 @@
#include "generalsetup.h" #include "generalsetup.h"
#include "ui_generalsetup.h" #include "ui_generalsetup.h"
#include <QMessageBox>
GeneralSetupPanel::GeneralSetupPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware): GeneralSetupPanel::GeneralSetupPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
GeneralPanel(parent, generalSettings, firmware), GeneralPanel(parent, generalSettings, firmware),
@ -316,7 +315,7 @@ void GeneralSetupPanel::on_voiceLang_CB_currentIndexChanged(int index)
if (!lock) { if (!lock) {
QString code = ui->voiceLang_CB->itemData(index).toString(); QString code = ui->voiceLang_CB->itemData(index).toString();
for (int i=0; i<2; i++) { 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'; generalSettings.ttsLanguage[2] = '\0';
emit modified(); emit modified();

View file

@ -86,7 +86,7 @@ void getFileComboBoxValue(QComboBox * b, char * dest, int length)
{ {
memset(dest, 0, length+1); memset(dest, 0, length+1);
if (b->currentText() != "----") { if (b->currentText() != "----") {
strncpy(dest, b->currentText().toAscii(), length); strncpy(dest, b->currentText().toLatin1(), length);
} }
} }

View file

@ -1,7 +1,8 @@
#ifndef HELPERS_H #ifndef HELPERS_H
#define HELPERS_H #define HELPERS_H
#include <QtGui> #include <QCheckBox>
#include <QSpinBox>
#include <QTableWidget> #include <QTableWidget>
#include <QGridLayout> #include <QGridLayout>
#include <QDebug> #include <QDebug>

View file

@ -499,12 +499,12 @@ void LogsDialog::on_fileOpen_BT_clicked()
} }
} }
ui->logTable->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); ui->logTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
QVarLengthArray<int> sizes; QVarLengthArray<int> sizes;
for (int i = 0; i < ui->logTable->columnCount(); i++) { for (int i = 0; i < ui->logTable->columnCount(); i++) {
sizes.append(ui->logTable->columnWidth(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++) { for (int i = 0; i < ui->logTable->columnCount(); i++) {
ui->logTable->setColumnWidth(i, sizes.at(i)); ui->logTable->setColumnWidth(i, sizes.at(i));
} }

View file

@ -42,8 +42,7 @@
#ifndef MAINWINDOW_H #ifndef MAINWINDOW_H
#define MAINWINDOW_H #define MAINWINDOW_H
#include <QtGui> #include <QtWidgets>
#include <QMainWindow>
#include <QDateTime> #include <QDateTime>
#include "downloaddialog.h" #include "downloaddialog.h"
#include "eeprominterface.h" #include "eeprominterface.h"

View file

@ -270,7 +270,7 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
bool xmlOK = doc.setContent(&file); bool xmlOK = doc.setContent(&file);
if(xmlOK) { if(xmlOK) {
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEepromXml(radioData, doc)); std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEepromXml(radioData, doc));
if (errors.test(NO_ERROR)) { if (errors.test(ALL_OK)) {
ui->modelsList->refreshList(); ui->modelsList->refreshList();
if(resetCurrentFile) setCurrentFile(fileName); if(resetCurrentFile) setCurrentFile(fileName);
return true; return true;
@ -301,7 +301,7 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
file.close(); file.close();
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(radioData, (uint8_t *)eeprom.data(), eeprom_size)); std::bitset<NUM_ERRORS> 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()); ShowEepromErrors(this, tr("Error"), tr("Invalid EEPROM File %1").arg(fileName), errors.to_ulong());
return false; return false;
} }
@ -339,9 +339,9 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
} }
std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadEeprom(radioData, eeprom, eeprom_size)); std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadEeprom(radioData, eeprom, eeprom_size));
if (!errorsEeprom.test(NO_ERROR)) { if (!errorsEeprom.test(ALL_OK)) {
std::bitset<NUM_ERRORS> errorsBackup((unsigned long long)LoadBackup(radioData, eeprom, eeprom_size, 0)); std::bitset<NUM_ERRORS> 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()); ShowEepromErrors(this, tr("Error"), tr("Invalid binary EEPROM File %1").arg(fileName), (errorsEeprom | errorsBackup).to_ulong());
return false; return false;
} }
@ -617,7 +617,7 @@ bool MdiChild::loadBackup()
} }
std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index)); std::bitset<NUM_ERRORS> 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()); ShowEepromErrors(this, tr("Error"), tr("Invalid binary backup File %1").arg(fileName), (errorsEeprom).to_ulong());
return false; return false;
} }

View file

@ -54,7 +54,8 @@ foreach(name ${modeledit_NAMES})
set(modeledit_UIS ${modeledit_UIS} ${name}.ui) set(modeledit_UIS ${modeledit_UIS} ${name}.ui)
endforeach() endforeach()
qt4_wrap_ui(modeledit_SRCS ${modeledit_UIS}) qt5_wrap_ui(modeledit_SRCS ${modeledit_UIS})
qt4_wrap_cpp(modeledit_SRCS ${modeledit_HDRS}) qt5_wrap_cpp(modeledit_SRCS ${modeledit_HDRS})
add_library(modeledit ${modeledit_SRCS}) add_library(modeledit ${modeledit_SRCS})
qt5_use_modules(modeledit Widgets Xml Multimedia)

View file

@ -1,11 +1,5 @@
#include "channels.h" #include "channels.h"
#include "helpers.h" #include "helpers.h"
#include <QLabel>
#include <QLineEdit>
#include <QSpinBox>
#include <QComboBox>
#include <QCheckBox>
#include <QDoubleSpinBox>
LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt): LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt):
firmware(firmware), firmware(firmware),
@ -200,7 +194,7 @@ void Channels::nameEdited()
if (!lock) { if (!lock) {
QLineEdit *le = qobject_cast<QLineEdit*>(sender()); QLineEdit *le = qobject_cast<QLineEdit*>(sender());
int index = le->property("index").toInt(); int index = le->property("index").toInt();
strcpy(model->limitData[index].name, le->text().toAscii()); strcpy(model->limitData[index].name, le->text().toLatin1());
emit modified(); emit modified();
} }
} }

View file

@ -3,7 +3,6 @@
#include "helpers.h" #include "helpers.h"
#include "modeledit.h" #include "modeledit.h"
#include <QSpinBox>
class GVarGroup; class GVarGroup;

View file

@ -3,11 +3,6 @@
#include "node.h" #include "node.h"
#include "edge.h" #include "edge.h"
#include "helpers.h" #include "helpers.h"
#include <QSpinBox>
#include <QCheckBox>
#include <QPushButton>
#include <QMessageBox>
#include <QAction>
#define GFX_MARGIN 16 #define GFX_MARGIN 16
@ -491,7 +486,7 @@ void Curves::on_curveSmooth_currentIndexChanged(int index)
void Curves::on_curveName_editingFinished() void Curves::on_curveName_editingFinished()
{ {
memset(model->curves[currentCurve].name, 0, sizeof(model->curves[currentCurve].name)); 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(); emit modified();
} }

View file

@ -3,7 +3,6 @@
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include <QSpinBox>
enum CopyAction { enum CopyAction {
CURVE_COPY, CURVE_COPY,

View file

@ -43,13 +43,9 @@ void RepeatComboBox::update()
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware): CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GeneralSettings & generalSettings, Firmware * firmware):
GenericPanel(parent, model, generalSettings, firmware), GenericPanel(parent, model, generalSettings, firmware),
functions(model ? model->customFn : generalSettings.customFn) functions(model ? model->customFn : generalSettings.customFn),
#if defined(PHONON) mediaPlayerCurrent(-1),
, mediaPlayer(NULL)
phononCurrent(-1),
clickObject(NULL),
clickOutput(NULL)
#endif
{ {
Stopwatch s1("CustomFunctionsPanel - populate"); Stopwatch s1("CustomFunctionsPanel - populate");
lock = true; lock = true;
@ -178,14 +174,12 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
paramLayout->addWidget(fswtchBLcolor[i]); paramLayout->addWidget(fswtchBLcolor[i]);
connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited())); connect(fswtchBLcolor[i], SIGNAL(sliderReleased()), this, SLOT(customFunctionEdited()));
#ifdef PHONON
playBT[i] = new QPushButton(this); playBT[i] = new QPushButton(this);
playBT[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); playBT[i]->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
playBT[i]->setProperty("index", i); playBT[i]->setProperty("index", i);
playBT[i]->setIcon(playIcon); playBT[i]->setIcon(playIcon);
paramLayout->addWidget(playBT[i]); paramLayout->addWidget(playBT[i]);
connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic())); connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
#endif
QHBoxLayout * repeatLayout = new QHBoxLayout(); QHBoxLayout * repeatLayout = new QHBoxLayout();
tableLayout->addLayout(i, 4, repeatLayout); tableLayout->addLayout(i, 4, repeatLayout);
@ -220,35 +214,42 @@ CustomFunctionsPanel::~CustomFunctionsPanel()
{ {
} }
#ifdef PHONON void CustomFunctionsPanel::onMediaPlayerStateChanged(QMediaPlayer::State state)
void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::State oldState)
{ {
if (!lock) { if (!lock) {
lock = true; lock = true;
if ((newState==Phonon::ErrorState || newState==Phonon::StoppedState || newState==Phonon::PausedState) && oldState==Phonon::PlayingState) { if (state==QMediaPlayer::StoppedState || state==QMediaPlayer::PausedState) {
clickObject->stop(); mediaPlayer->stop();
clickObject->clearQueue(); if (mediaPlayerCurrent >= 0) {
clickObject->clear(); playBT[mediaPlayerCurrent]->setIcon(CompanionIcon("play.png"));
if (phononCurrent >= 0) { mediaPlayerCurrent = -1;
playBT[phononCurrent]->setIcon(CompanionIcon("play.png"));
phononCurrent = -1;
} }
} }
lock = false; 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() void CustomFunctionsPanel::playMusic()
{ {
if (!clickObject) { if (!mediaPlayer) {
clickObject = new Phonon::MediaObject(this); mediaPlayer = new QMediaPlayer(this);
clickOutput = new Phonon::AudioOutput(Phonon::NoCategory, this); connect(mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(onMediaPlayerStateChanged(QMediaPlayer::State)));
Phonon::createPath(clickObject, clickOutput); connect(mediaPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(onMediaPlayerError(QMediaPlayer::Error)));
connect(clickObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(mediaPlayer_state(Phonon::State, Phonon::State)));
} }
QPushButton * button = qobject_cast<QPushButton*>(sender()); int index = sender()->property("index").toInt();
int index = button->property("index").toInt();
QString path = g.profile[g.id()].sdPath(); QString path = g.profile[g.id()].sdPath();
QDir qd(path); QDir qd(path);
QString track; QString track;
@ -272,29 +273,22 @@ void CustomFunctionsPanel::playMusic()
return; return;
} }
if (phononCurrent == index) { if (mediaPlayerCurrent == index) {
clickObject->stop(); mediaPlayer->stop();
clickObject->clear();
playBT[index]->setIcon(CompanionIcon("play.png")); playBT[index]->setIcon(CompanionIcon("play.png"));
phononCurrent = -1; mediaPlayerCurrent = -1;
} }
else { else {
if (phononCurrent >= 0) { if (mediaPlayerCurrent >= 0) {
playBT[phononCurrent]->setIcon(CompanionIcon("play.png")); playBT[mediaPlayerCurrent]->setIcon(CompanionIcon("play.png"));
} }
phononCurrent = index; mediaPlayerCurrent = index;
clickObject->clear(); mediaPlayer->setMedia(QUrl::fromLocalFile(track));
#ifdef __APPLE__ mediaPlayer->play();
clickObject->setCurrentSource(QUrl("file://"+track));
#else
clickObject->setCurrentSource(QUrl(track));
#endif
clickObject->play();
playBT[index]->setIcon(CompanionIcon("stop.png")); playBT[index]->setIcon(CompanionIcon("stop.png"));
} }
} }
} }
#endif
#define CUSTOM_FUNCTION_NUMERIC_PARAM (1<<0) #define CUSTOM_FUNCTION_NUMERIC_PARAM (1<<0)
#define CUSTOM_FUNCTION_SOURCE_PARAM (1<<1) #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); fswtchRepeat[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_REPEAT);
fswtchGVmode[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_MODE); fswtchGVmode[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_MODE);
fswtchBLcolor[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_BL_COLOR); fswtchBLcolor[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_BL_COLOR);
#ifdef PHONON
playBT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_PLAY); playBT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_PLAY);
#endif
} }
void CustomFunctionsPanel::update() void CustomFunctionsPanel::update()

View file

@ -3,24 +3,14 @@
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include <QLabel> #include <QtMultimedia>
#include <QCheckBox>
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QPushButton>
#include <QTimeEdit>
#ifdef PHONON
#include <phonon/audiooutput.h>
#include <phonon/mediaobject.h>
#include <phonon/mediasource.h>
#endif
class RepeatComboBox: public QComboBox class RepeatComboBox: public QComboBox
{ {
Q_OBJECT Q_OBJECT
public: public:
RepeatComboBox(QWidget *parent, int & repeatParam); RepeatComboBox(QWidget * parent, int & repeatParam);
void update(); void update();
signals: signals:
@ -52,10 +42,9 @@ class CustomFunctionsPanel : public GenericPanel
void fsw_customContextMenuRequested(QPoint pos); void fsw_customContextMenuRequested(QPoint pos);
void refreshCustomFunction(int index, bool modified=false); void refreshCustomFunction(int index, bool modified=false);
void onChildModified(); void onChildModified();
#ifdef PHONON
void playMusic(); void playMusic();
void mediaPlayer_state(Phonon::State newState, Phonon::State oldState); void onMediaPlayerStateChanged(QMediaPlayer::State state);
#endif void onMediaPlayerError(QMediaPlayer::Error error);
void fswDelete(); void fswDelete();
void fswCopy(); void fswCopy();
void fswPaste(); void fswPaste();
@ -68,7 +57,7 @@ class CustomFunctionsPanel : public GenericPanel
QSet<QString> tracksSet; QSet<QString> tracksSet;
QSet<QString> scriptsSet; QSet<QString> scriptsSet;
int phononCurrent; int mediaPlayerCurrent;
QComboBox * fswtchSwtch[C9X_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchSwtch[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchFunc[C9X_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchFunc[C9X_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchParamGV[C9X_MAX_CUSTOM_FUNCTIONS]; QCheckBox * fswtchParamGV[C9X_MAX_CUSTOM_FUNCTIONS];
@ -81,10 +70,7 @@ class CustomFunctionsPanel : public GenericPanel
RepeatComboBox * fswtchRepeat[C9X_MAX_CUSTOM_FUNCTIONS]; RepeatComboBox * fswtchRepeat[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchGVmode[C9X_MAX_CUSTOM_FUNCTIONS]; QComboBox * fswtchGVmode[C9X_MAX_CUSTOM_FUNCTIONS];
QSlider * fswtchBLcolor[C9X_MAX_CUSTOM_FUNCTIONS]; QSlider * fswtchBLcolor[C9X_MAX_CUSTOM_FUNCTIONS];
#ifdef PHONON QMediaPlayer * mediaPlayer;
Phonon::MediaObject *clickObject;
Phonon::AudioOutput *clickOutput;
#endif
int selectedFunction; int selectedFunction;

View file

@ -154,7 +154,7 @@ void ExpoDialog::valuesChanged()
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt()); ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
ed->mode = ui->sideCB->currentIndex() + 1; 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)) { if (firmware->getCapability(VirtualInputs)) {
inputName = ui->inputName->text(); inputName = ui->inputName->text();
} }

View file

@ -1,7 +1,7 @@
#ifndef EXPODIALOG_H #ifndef EXPODIALOG_H
#define EXPODIALOG_H #define EXPODIALOG_H
#include <QDialog> #include <QtWidgets>
#include "eeprominterface.h" #include "eeprominterface.h"
#include "modelprinter.h" #include "modelprinter.h"

View file

@ -1,9 +1,6 @@
#include "flightmodes.h" #include "flightmodes.h"
#include "ui_flightmode.h" #include "ui_flightmode.h"
// #include "firmwares/opentx/opentxeeprom.h" // TODO shouldn't be there
#include "helpers.h" #include "helpers.h"
#include <QComboBox>
#include <QGridLayout>
FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings, Firmware * firmware): FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware), ModelPanel(parent, model, generalSettings, firmware),
@ -244,7 +241,7 @@ void FlightModePanel::update()
void FlightModePanel::phaseName_editingFinished() void FlightModePanel::phaseName_editingFinished()
{ {
QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender()); QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender());
strcpy(phase.name, lineEdit->text().toAscii()); strcpy(phase.name, lineEdit->text().toLatin1());
emit modified(); emit modified();
emit nameModified(); emit nameModified();
} }
@ -312,7 +309,7 @@ void FlightModePanel::GVName_editingFinished()
QLineEdit *lineedit = qobject_cast<QLineEdit*>(sender()); QLineEdit *lineedit = qobject_cast<QLineEdit*>(sender());
int gvar = lineedit->property("index").toInt(); int gvar = lineedit->property("index").toInt();
memset(&model->gvars_names[gvar], 0, sizeof(model->gvars_names[gvar])); 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(); emit modified();
} }
} }

View file

@ -3,12 +3,6 @@
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include <QVector>
#include <QLabel>
#include <QTabWidget>
#include <QSpinBox>
#include <QComboBox>
#include <QCheckBox>
namespace Ui { namespace Ui {
class FlightMode; class FlightMode;

View file

@ -1,5 +1,4 @@
#include "inputs.h" #include "inputs.h"
#include <QMessageBox>
#include "expodialog.h" #include "expodialog.h"
#include "helpers.h" #include "helpers.h"
@ -199,7 +198,7 @@ void InputsPanel::gm_openExpo(int index)
if (g->exec()) { if (g->exec()) {
model->expoData[index] = mixd; model->expoData[index] = mixd;
if (firmware->getCapability(VirtualInputs)) if (firmware->getCapability(VirtualInputs))
strncpy(model->inputNames[mixd.chn], inputName.toAscii().data(), 4); strncpy(model->inputNames[mixd.chn], inputName.toLatin1().data(), 4);
emit modified(); emit modified();
update(); update();
} }
@ -288,8 +287,6 @@ void InputsPanel::mimeExpoDropped(int index, const QMimeData *data, Qt::DropActi
pasteExpoMimeData(data, idx); pasteExpoMimeData(data, idx);
} }
#include <iostream>
#include <QtGui/qwidget.h>
void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx) void InputsPanel::pasteExpoMimeData(const QMimeData * mimeData, int destIdx)
{ {
if (mimeData->hasFormat("application/x-companion-expo")) { if (mimeData->hasFormat("application/x-companion-expo")) {
@ -328,8 +325,9 @@ void InputsPanel::exposPaste()
const QClipboard *clipboard = QApplication::clipboard(); const QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData(); const QMimeData *mimeData = clipboard->mimeData();
QListWidgetItem *item = ExposlistWidget->currentItem(); QListWidgetItem *item = ExposlistWidget->currentItem();
if (item) if (item) {
pasteExpoMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0)); pasteExpoMimeData(mimeData, item->data(Qt::UserRole).toByteArray().at(0));
}
} }
void InputsPanel::exposDuplicate() void InputsPanel::exposDuplicate()

View file

@ -1,10 +1,4 @@
#include "logicalswitches.h" #include "logicalswitches.h"
#include <QLabel>
#include <QLineEdit>
#include <QSpinBox>
#include <QComboBox>
#include <QCheckBox>
#include <QDoubleSpinBox>
#include "helpers.h" #include "helpers.h"
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware): LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):

View file

@ -3,9 +3,6 @@
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QTimeEdit>
class LogicalSwitchesPanel : public ModelPanel class LogicalSwitchesPanel : public ModelPanel
{ {

View file

@ -159,8 +159,7 @@ void MixerDialog::valuesChanged()
md->delayUp = round(ui->delayUpSB->value()*scale); md->delayUp = round(ui->delayUpSB->value()*scale);
md->speedDown = round(ui->slowDownSB->value()*scale); md->speedDown = round(ui->slowDownSB->value()*scale);
md->speedUp = round(ui->slowUpSB->value()*scale); md->speedUp = round(ui->slowUpSB->value()*scale);
strcpy(md->name, ui->mixerName->text().toLatin1());
strcpy(md->name, ui->mixerName->text().toAscii());
md->flightModes = 0; md->flightModes = 0;
for (int i=8; i>=0 ; i--) { for (int i=8; i>=0 ; i--) {

View file

@ -1,7 +1,7 @@
#ifndef MIXERDIALOG_H #ifndef MIXERDIALOG_H
#define MIXERDIALOG_H #define MIXERDIALOG_H
#include <QDialog> #include <QtWidgets>
#include "eeprominterface.h" #include "eeprominterface.h"
class GVarGroup; class GVarGroup;

View file

@ -1,8 +1,7 @@
#ifndef MIXERSLIST_H #ifndef MIXERSLIST_H
#define MIXERSLIST_H #define MIXERSLIST_H
#include <QtGui> #include <QtWidgets>
#define MIX_ROW_HEIGHT_INCREASE 8 //how much space is added above mixer row (for new channel), if 0 space adding is disabled #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 const int GroupHeaderRole = (Qt::UserRole+2); //defines new user role for list items. If value is > 0, then space is added before that item

View file

@ -1,7 +1,5 @@
#include "mixes.h" #include "mixes.h"
#include "helpers.h" #include "helpers.h"
// #include <QMessageBox>
// #include "expodialog.h"
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware): MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware):
ModelPanel(parent, model, generalSettings, firmware), ModelPanel(parent, model, generalSettings, firmware),

View file

@ -13,7 +13,6 @@
#include "customfunctions.h" #include "customfunctions.h"
#include "telemetry.h" #include "telemetry.h"
#include "appdata.h" #include "appdata.h"
#include <QScrollArea>
ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmware * firmware) : ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmware * firmware) :
QDialog(parent), QDialog(parent),

View file

@ -1,7 +1,7 @@
#ifndef MODELEDIT_H #ifndef MODELEDIT_H
#define MODELEDIT_H #define MODELEDIT_H
#include <QDialog> #include <QtWidgets>
#include "genericpanel.h" #include "genericpanel.h"
class RadioData; class RadioData;

View file

@ -42,7 +42,7 @@
#ifndef NODE_H #ifndef NODE_H
#define NODE_H #define NODE_H
#include <QtGui> #include <QtWidgets>
#define DEFAULT_BALL_SIZE 10 #define DEFAULT_BALL_SIZE 10
#define BALL_HEIGHT 2 #define BALL_HEIGHT 2

View file

@ -115,7 +115,7 @@ void TimerPanel::on_minuteBeep_toggled(bool checked)
void TimerPanel::on_name_editingFinished() void TimerPanel::on_name_editingFinished()
{ {
int length = ui->name->maxLength(); int length = ui->name->maxLength();
strncpy(timer.name, ui->name->text().toAscii(), length); strncpy(timer.name, ui->name->text().toLatin1(), length);
emit modified(); emit modified();
} }
@ -728,14 +728,14 @@ void SetupPanel::on_throttleSource_currentIndexChanged(int index)
void SetupPanel::on_name_editingFinished() void SetupPanel::on_name_editingFinished()
{ {
int length = ui->name->maxLength(); int length = ui->name->maxLength();
strncpy(model->name, ui->name->text().toAscii(), length); strncpy(model->name, ui->name->text().toLatin1(), length);
emit modified(); emit modified();
} }
void SetupPanel::on_image_currentIndexChanged(int index) void SetupPanel::on_image_currentIndexChanged(int index)
{ {
if (!lock) { 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(); QString path = g.profile[g.id()].sdPath();
path.append("/BMP/"); path.append("/BMP/");
QDir qd(path); QDir qd(path);

View file

@ -3,12 +3,6 @@
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include <QVector>
#include <QCheckBox>
#include <QSlider>
#include <QSpinBox>
#include <QComboBox>
#include <QLabel>
namespace Ui { namespace Ui {
class Setup; class Setup;

View file

@ -648,7 +648,7 @@ void TelemetrySensorPanel::updateSourcesComboBox(AutoComboBox * cb, bool negativ
void TelemetrySensorPanel::on_name_editingFinished() void TelemetrySensorPanel::on_name_editingFinished()
{ {
if (!lock) { if (!lock) {
strcpy(sensor.label, ui->name->text().toAscii()); strcpy(sensor.label, ui->name->text().toLatin1());
emit dataModified(); emit dataModified();
emit modified(); emit modified();
} }

View file

@ -3,9 +3,6 @@
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include <QGroupBox>
#include <QComboBox>
#include <QDoubleSpinBox>
class AutoComboBox; class AutoComboBox;

View file

@ -1,6 +1,4 @@
#include "templates.h" #include "templates.h"
#include <QListWidget>
#include <QMessageBox>
#define CHANNEL_ORDER(x) generalSettings.getDefaultStick(x) #define CHANNEL_ORDER(x) generalSettings.getDefaultStick(x)
#define CC(x) (CHANNEL_ORDER(x)) //need to invert this to work with dest #define CC(x) (CHANNEL_ORDER(x)) //need to invert this to work with dest

View file

@ -1,7 +1,7 @@
#ifndef TEMPLATES_H #ifndef TEMPLATES_H
#define TEMPLATES_H #define TEMPLATES_H
#include <QWidget> #include <QtWidgets>
#include "eeprominterface.h" #include "eeprominterface.h"
class Templates : public QWidget class Templates : public QWidget

View file

@ -269,7 +269,7 @@ QString ModelPrinter::printInputName(int idx)
else { else {
result = RawSource(SOURCE_TYPE_STICK, idx).toString(&model); result = RawSource(SOURCE_TYPE_STICK, idx).toString(&model);
} }
return Qt::escape(result); return result.toHtmlEscaped();
} }
QString ModelPrinter::printInputLine(int idx) QString ModelPrinter::printInputLine(int idx)
@ -288,29 +288,29 @@ QString ModelPrinter::printInputLine(const ExpoData & input)
} }
if (firmware->getCapability(VirtualInputs)) { 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)); str += " " + tr("Weight").toHtmlEscaped() + QString("(%1)").arg(getGVarString(input.weight,true).toHtmlEscaped());
if (input.curve.value) str += " " + Qt::escape(input.curve.toString()); if (input.curve.value) str += " " + input.curve.toString().toHtmlEscaped();
QString flightModesStr = printFlightModes(input.flightModes); 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) 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 (firmware->getCapability(VirtualInputs)) {
if (input.carryTrim>0) str += " " + Qt::escape(tr("NoTrim")); if (input.carryTrim>0) str += " " + tr("NoTrim").toHtmlEscaped();
else if (input.carryTrim<0) str += " " + Qt::escape(RawSource(SOURCE_TYPE_TRIM, (-(input.carryTrim)-1)).toString(&model)); else if (input.carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(input.carryTrim)-1)).toString(&model).toHtmlEscaped();
} }
if (input.offset) 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]) if (firmware->getCapability(HasExpoNames) && input.name[0])
str += Qt::escape(QString(" [%1]").arg(input.name)); str += QString(" [%1]").arg(input.name).toHtmlEscaped();
return str; return str;
} }
@ -326,7 +326,7 @@ QString ModelPrinter::printMixerName(int curDest)
name.append(" "); name.append(" ");
str += name.left(8); str += name.left(8);
} }
return Qt::escape(str); return str.toHtmlEscaped();
} }
QString ModelPrinter::printMixerLine(int idx, bool showMultiplex, int highlightedSource) QString ModelPrinter::printMixerLine(int idx, bool showMultiplex, int highlightedSource)
@ -349,43 +349,43 @@ QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, in
str += "&nbsp;&nbsp;"; str += "&nbsp;&nbsp;";
} }
// highlight source if needed // 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) ) { if ( (mix.srcRaw.type == SOURCE_TYPE_CH) && (mix.srcRaw.index+1 == (int)highlightedSource) ) {
source = "<b>" + source + "</b>"; source = "<b>" + source + "</b>";
} }
str += "&nbsp;" + source; str += "&nbsp;" + 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); QString flightModesStr = printFlightModes(mix.flightModes);
if (!flightModesStr.isEmpty()) if (!flightModesStr.isEmpty())
str += " " + Qt::escape(flightModesStr); str += " " + flightModesStr.toHtmlEscaped();
if (mix.swtch.type != SWITCH_TYPE_NONE) 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) if (mix.carryTrim > 0)
str += " " + Qt::escape(tr("NoTrim")); str += " " + tr("NoTrim").toHtmlEscaped();
else if (mix.carryTrim < 0) else if (mix.carryTrim < 0)
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(mix.carryTrim)-1)).toString(&model); str += " " + RawSource(SOURCE_TYPE_TRIM, (-(mix.carryTrim)-1)).toString(&model);
if (firmware->getCapability(HasNoExpo) && mix.noExpo) if (firmware->getCapability(HasNoExpo) && mix.noExpo)
str += " " + Qt::escape(tr("No DR/Expo")); str += " " + tr("No DR/Expo").toHtmlEscaped();
if (mix.sOffset) 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) if (mix.curve.value)
str += " " + Qt::escape(mix.curve.toString()); str += " " + mix.curve.toString().toHtmlEscaped();
int scale = firmware->getCapability(SlowScale); int scale = firmware->getCapability(SlowScale);
if (scale == 0) if (scale == 0)
scale = 1; scale = 1;
if (mix.delayDown || mix.delayUp) 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) 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) 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]) if (firmware->getCapability(HasMixerNames) && mix.name[0])
str += Qt::escape(QString(" [%1]").arg(mix.name)); str += QString(" [%1]").arg(mix.name).toHtmlEscaped();
return str; return str;
} }

View file

@ -42,8 +42,8 @@
#ifndef MODELSLIST_H #ifndef MODELSLIST_H
#define MODELSLIST_H #define MODELSLIST_H
#include <QtWidgets>
#include "eeprominterface.h" #include "eeprominterface.h"
#include <QListWidget>
struct CurrentSelection struct CurrentSelection
{ {

View file

@ -1,7 +1,7 @@
#ifndef _PRINTDIALOG_H #ifndef _PRINTDIALOG_H
#define _PRINTDIALOG_H #define _PRINTDIALOG_H
#include <QDialog> #include <QtWidgets>
#include "eeprominterface.h" #include "eeprominterface.h"
#include "multimodelprinter.h" #include "multimodelprinter.h"

View file

@ -1,6 +1,7 @@
#ifndef SYNCPROCESS_H_ #ifndef SYNCPROCESS_H_
#define SYNCPROCESS_H_ #define SYNCPROCESS_H_
#include <QObject>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>

View file

@ -6,6 +6,7 @@ set(qcustomplot_HDRS
qcustomplot.h qcustomplot.h
) )
qt4_wrap_cpp(qcustomplot_SRCS ${qcustomplot_HDRS}) qt5_wrap_cpp(qcustomplot_SRCS ${qcustomplot_HDRS})
add_library(qcustomplot ${qcustomplot_SRCS}) add_library(qcustomplot ${qcustomplot_SRCS})
qt5_use_modules(qcustomplot Widgets PrintSupport)

View file

@ -45,14 +45,8 @@
#include <QMargins> #include <QMargins>
#include <qmath.h> #include <qmath.h>
#include <limits> #include <limits>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #include <QtNumeric>
# include <qnumeric.h> #include <QtPrintSupport>
# include <QPrinter>
# include <QPrintEngine>
#else
# include <QtNumeric>
# include <QtPrintSupport>
#endif
class QCPPainter; class QCPPainter;
class QCustomPlot; class QCustomPlot;

View file

@ -6,6 +6,8 @@ set(qxtcommandoptions_HDRS
qxtcommandoptions.h qxtcommandoptions.h
) )
qt4_wrap_cpp(qxtcommandoptions_SRCS ${qxtcommandoptions_HDRS}) qt5_wrap_cpp(qxtcommandoptions_SRCS ${qxtcommandoptions_HDRS})
add_library(qxtcommandoptions ${qxtcommandoptions_SRCS}) add_library(qxtcommandoptions ${qxtcommandoptions_SRCS})
qt5_use_modules(qxtcommandoptions Widgets)

View file

@ -16,6 +16,7 @@ set(shared_HDRS
hexspinbox.h hexspinbox.h
) )
qt4_wrap_cpp(shared_SRCS ${shared_HDRS}) qt5_wrap_cpp(shared_SRCS ${shared_HDRS})
add_library(shared ${shared_SRCS}) add_library(shared ${shared_SRCS})
qt5_use_modules(shared Widgets)

View file

@ -44,7 +44,7 @@ class AutoLineEdit: public QLineEdit
void onEdited() void onEdited()
{ {
if (field && !lock) { if (field && !lock) {
strcpy(field, text().toAscii()); strcpy(field, text().toLatin1());
if (panel) { if (panel) {
emit panel->modified(); emit panel->modified();
} }

View file

@ -53,7 +53,8 @@ include_directories(
${RADIO_SRC_DIRECTORY}/fonts/std ${RADIO_SRC_DIRECTORY}/fonts/std
) )
qt4_wrap_ui(simulation_SRCS ${simulation_UIS}) qt5_wrap_ui(simulation_SRCS ${simulation_UIS})
qt4_wrap_cpp(simulation_SRCS ${simulation_HDRS}) qt5_wrap_cpp(simulation_SRCS ${simulation_HDRS})
add_library(simulation ${simulation_SRCS}) add_library(simulation ${simulation_SRCS})
qt5_use_modules(simulation Widgets Xml)

View file

@ -19,6 +19,7 @@
#include <QWidget> #include <QWidget>
#include <QtGui> #include <QtGui>
#include <QStyleOption>
class ButtonsWidget : public QWidget class ButtonsWidget : public QWidget
{ {

View file

@ -1,5 +1,3 @@
#include <QtGui>
#include <stdint.h>
#include "debugoutput.h" #include "debugoutput.h"
#include "ui_debugoutput.h" #include "ui_debugoutput.h"
@ -18,7 +16,6 @@ DebugOutput::DebugOutput(QWidget * parent):
QFont newFont("Courier", 9); QFont newFont("Courier", 9);
ui->Output->setFont(newFont); ui->Output->setFont(newFont);
#endif #endif
} }
DebugOutput::~DebugOutput() DebugOutput::~DebugOutput()

View file

@ -1,8 +1,7 @@
#ifndef debugoutput_h #ifndef debugoutput_h
#define debugoutput_h #define debugoutput_h
#include <QtWidgets>
#include <QDialog>
#include "simulatorinterface.h" #include "simulatorinterface.h"
namespace Ui { namespace Ui {

View file

@ -27,29 +27,31 @@ Joystick::~Joystick()
bool Joystick::open(int stick) bool Joystick::open(int stick)
{ {
if ( isOpen() ) if (isOpen())
close(); close();
joystick = SDL_JoystickOpen(stick); joystick = SDL_JoystickOpen(stick);
if ( joystick ) { if (joystick) {
numAxes = SDL_JoystickNumAxes(joystick); numAxes = SDL_JoystickNumAxes(joystick);
numButtons = SDL_JoystickNumButtons(joystick); numButtons = SDL_JoystickNumButtons(joystick);
numHats = SDL_JoystickNumHats(joystick); numHats = SDL_JoystickNumHats(joystick);
numTrackballs = SDL_JoystickNumBalls(joystick); numTrackballs = SDL_JoystickNumBalls(joystick);
joystickTimer.start(eventTimeout); joystickTimer.start(eventTimeout);
return TRUE; return true;
} else { }
else {
fprintf(stderr, "ERROR: couldn't open SDL joystick #%d", stick); fprintf(stderr, "ERROR: couldn't open SDL joystick #%d", stick);
return FALSE; return false;
} }
} }
void Joystick::close() void Joystick::close()
{ {
joystickTimer.stop(); joystickTimer.stop();
if ( joystick ) if (joystick) {
SDL_JoystickClose(joystick); SDL_JoystickClose(joystick);
joystick = NULL; joystick = NULL;
}
numAxes = numButtons = numHats = numTrackballs = 0; numAxes = numButtons = numHats = numTrackballs = 0;
} }
@ -70,16 +72,20 @@ void Joystick::processEvents()
emit axisValueChanged(i, moved); emit axisValueChanged(i, moved);
axes[i] = moved; axes[i] = moved;
axisRepeatTimers[i].restart(); axisRepeatTimers[i].restart();
} else if (autoRepeat && moved != 0) { }
else if (autoRepeat && moved != 0) {
if ( axisRepeatTimers[i].elapsed() >= autoRepeatDelay ) { if ( axisRepeatTimers[i].elapsed() >= autoRepeatDelay ) {
emit axisValueChanged(i, moved); emit axisValueChanged(i, moved);
axes[i] = moved; axes[i] = moved;
} }
} else }
else
axisRepeatTimers[i].restart(); axisRepeatTimers[i].restart();
} else }
else {
emit axisValueChanged(i, 0); emit axisValueChanged(i, 0);
} }
}
for (i = 0; i < numButtons; i++) { for (i = 0; i < numButtons; i++) {
Uint8 changed = SDL_JoystickGetButton(joystick, i); Uint8 changed = SDL_JoystickGetButton(joystick, i);
if ( (changed != buttons[i]) ) { if ( (changed != buttons[i]) ) {

View file

@ -31,7 +31,7 @@ class Joystick : public QObject
Joystick(QObject *parent = 0, Joystick(QObject *parent = 0,
int joystickEventTimeout = SDL_JOYSTICK_DEFAULT_EVENT_TIMEOUT, int joystickEventTimeout = SDL_JOYSTICK_DEFAULT_EVENT_TIMEOUT,
bool doAutoRepeat = TRUE, bool doAutoRepeat = true,
int autoRepeatDelay = SDL_JOYSTICK_DEFAULT_AUTOREPEAT_DELAY); int autoRepeatDelay = SDL_JOYSTICK_DEFAULT_AUTOREPEAT_DELAY);
~Joystick(); ~Joystick();
bool open(int); bool open(int);

View file

@ -1,7 +1,6 @@
#include "joystickdialog.h" #include "joystickdialog.h"
#include "ui_joystickdialog.h" #include "ui_joystickdialog.h"
#include "appdata.h" #include "appdata.h"
#include <QtGui>
joystickDialog::joystickDialog(QWidget *parent, int stick) : joystickDialog::joystickDialog(QWidget *parent, int stick) :
QDialog(parent), QDialog(parent),

View file

@ -1,8 +1,8 @@
#ifndef JOYSTICKDIALOG_H #ifndef JOYSTICKDIALOG_H
#define JOYSTICKDIALOG_H #define JOYSTICKDIALOG_H
#include <QtWidgets>
#include "joystick.h" #include "joystick.h"
#include <QDialog>
namespace Ui { namespace Ui {
class joystickDialog; class joystickDialog;

View file

@ -1,7 +1,6 @@
#ifndef SIMULATORDIALOG_H #ifndef SIMULATORDIALOG_H
#define SIMULATORDIALOG_H #define SIMULATORDIALOG_H
#include <QDialog>
#include "modeledit/node.h" #include "modeledit/node.h"
#include "telemetrysimu.h" #include "telemetrysimu.h"
#include "trainersimu.h" #include "trainersimu.h"

View file

@ -3,6 +3,7 @@
#include <QSlider> #include <QSlider>
#include <QtGui> #include <QtGui>
#include <QFrame>
class SliderWidget : public QSlider class SliderWidget : public QSlider
{ {

View file

@ -518,7 +518,7 @@ uint32_t TelemetrySimulator::GPSEmulator::getNextPacketData(uint32_t packetType)
switch (packetType) { switch (packetType) {
case GPS_LONG_LATI_FIRST_ID: case GPS_LONG_LATI_FIRST_ID:
sendLat = !sendLat; sendLat = !sendLat;
return sendLat ? encodeLatLon(lat, TRUE) : encodeLatLon(lon, FALSE); return sendLat ? encodeLatLon(lat, true) : encodeLatLon(lon, false);
break; break;
case GPS_TIME_DATE_FIRST_ID: case GPS_TIME_DATE_FIRST_ID:
sendDate = !sendDate; sendDate = !sendDate;

View file

@ -91,11 +91,14 @@ void showMessage(const QString & message, enum QMessageBox::Icon icon = QMessage
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
Q_INIT_RESOURCE(companion); Q_INIT_RESOURCE(companion);
QApplication app(argc, argv); QApplication app(argc, argv);
app.setApplicationName("OpenTX Simulator"); app.setApplicationName("OpenTX Simulator");
app.setOrganizationName("OpenTX"); app.setOrganizationName("OpenTX");
app.setOrganizationDomain("open-tx.org"); app.setOrganizationDomain("open-tx.org");
g.init();
#ifdef __APPLE__ #ifdef __APPLE__
app.setStyle(new MyProxyStyle); app.setStyle(new MyProxyStyle);
#endif #endif
@ -108,7 +111,7 @@ int main(int argc, char *argv[])
app.installTranslator(&qtTranslator); app.installTranslator(&qtTranslator);
*/ */
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); // QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
#if defined(JOYSTICKS) || defined(SIMU_AUDIO) #if defined(JOYSTICKS) || defined(SIMU_AUDIO)
uint32_t sdlFlags = 0; uint32_t sdlFlags = 0;
@ -131,7 +134,7 @@ int main(int argc, char *argv[])
registerSimulators(); registerSimulators();
registerOpenTxFirmwares(); registerOpenTxFirmwares();
eedir = QDir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)); eedir = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/data/OpenTX/Simulator");
if (!eedir.exists("OpenTX")) { if (!eedir.exists("OpenTX")) {
eedir.mkdir("OpenTX"); eedir.mkdir("OpenTX");
} }
@ -203,7 +206,7 @@ int main(int argc, char *argv[])
if (options.positional().isEmpty()) { if (options.positional().isEmpty()) {
eepromFileName = QString("eeprom-%1.bin").arg(radioId); eepromFileName = QString("eeprom-%1.bin").arg(radioId);
eepromFileName = eedir.filePath(eepromFileName.toAscii()); eepromFileName = eedir.filePath(eepromFileName.toLatin1());
} }
else { else {
eepromFileName = options.positional()[0]; eepromFileName = options.positional()[0];
@ -230,7 +233,7 @@ int main(int argc, char *argv[])
} }
dialog->show(); dialog->show();
dialog->start(eepromFileName.toAscii().constData()); dialog->start(eepromFileName.toLatin1().constData());
int result = app.exec(); int result = app.exec();

View file

@ -16,9 +16,7 @@
#ifndef SPLASHLABEL_H #ifndef SPLASHLABEL_H
#define SPLASHLABEL_H #define SPLASHLABEL_H
#include <QLabel> #include <QtWidgets>
#include <QWidget>
#include <QtGui>
class splashLabel : public QLabel class splashLabel : public QLabel
{ {
@ -77,5 +75,6 @@ signals:
private: private:
int index; int index;
}; };
#endif /* SPLASHLABEL_H */ #endif /* SPLASHLABEL_H */

View file

@ -1,7 +1,6 @@
#include "splashlibrarydialog.h" #include "splashlibrarydialog.h"
#include "ui_splashlibrarydialog.h" #include "ui_splashlibrarydialog.h"
#include "appdata.h" #include "appdata.h"
#include <QtGui>
#include "helpers.h" #include "helpers.h"
#include "firmwareinterface.h" #include "firmwareinterface.h"
#include "helpers.h" #include "helpers.h"

View file

@ -1,8 +1,7 @@
#ifndef SPLASHLIBRARY_H #ifndef SPLASHLIBRARY_H
#define SPLASHLIBRARY_H #define SPLASHLIBRARY_H
#include <QtGui> #include <QtWidgets>
#include <QDialog>
namespace Ui { namespace Ui {
class SplashLibraryDialog; class SplashLibraryDialog;

View file

@ -12,7 +12,6 @@
* *
*/ */
#include <QtGui>
#include "wizarddialog.h" #include "wizarddialog.h"
#include "wizarddata.h" #include "wizarddata.h"
#include "helpers.h" #include "helpers.h"
@ -296,8 +295,8 @@ bool ModelSelectionPage::validatePage()
QString newName(nameLineEdit->text()); QString newName(nameLineEdit->text());
newName = (newName.normalized(QString::NormalizationForm_D)); newName = (newName.normalized(QString::NormalizationForm_D));
newName = newName.replace(QRegExp("[^ A-Za-z0-9_.-,\\s]"), ""); newName = newName.replace(QRegExp("[^ A-Za-z0-9_.-,\\s]"), "");
strncpy( wizDlg->mix.name, newName.toAscii(), WIZ_MODEL_NAME_LENGTH); strncpy( wizDlg->mix.name, newName.toLatin1(), WIZ_MODEL_NAME_LENGTH);
wizDlg->mix.name[WIZ_MODEL_NAME_LENGTH]=0; wizDlg->mix.name[WIZ_MODEL_NAME_LENGTH] = 0;
if (multirotorRB->isChecked()) if (multirotorRB->isChecked())
wizDlg->mix.vehicle = MULTICOPTER; wizDlg->mix.vehicle = MULTICOPTER;

View file

@ -14,16 +14,9 @@
#ifndef WIZARDDIALOG_H #ifndef WIZARDDIALOG_H
#define WIZARDDIALOG_H #define WIZARDDIALOG_H
#include <QWizard>
#include "wizarddata.h"
QT_BEGIN_NAMESPACE #include <QtWidgets>
class QCheckBox; #include "wizarddata.h"
class QLabel;
class QLineEdit;
class QRadioButton;
class QComboBox;
QT_END_NAMESPACE
class WizardDialog : public QWizard class WizardDialog : public QWizard
{ {

View file

@ -109,24 +109,25 @@ Section "OpenTX Companion" SecDummy
!else !else
File "@SYSDIR@\system32\pthreadVC2.dll" File "@SYSDIR@\system32\pthreadVC2.dll"
!endif !endif
File "C:\Programs\SDL\lib\SDL.dll"
File "@SYSDIR@\msvcp100.dll" File "@SYSDIR@\msvcp100.dll"
File "@SYSDIR@\msvcr100.dll" File "@SYSDIR@\msvcr100.dll"
File "@QT_BINARY_DIR@\QtCore4.dll" File "@QT_DLL_DIR@\Qt5Core.dll"
File "@QT_BINARY_DIR@\QtGui4.dll" File "@QT_DLL_DIR@\Qt5Gui.dll"
File "@QT_BINARY_DIR@\QtNetwork4.dll" File "@QT_DLL_DIR@\Qt5Widgets.dll"
File "@QT_BINARY_DIR@\Phonon4.dll" File "@QT_DLL_DIR@\Qt5PrintSupport.dll"
File "@QT_BINARY_DIR@\QtXml4.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.exe"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\avrdude.conf" 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\libusb0.dll"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\dfu-util.exe" File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\dfu-util.exe"
File "@CMAKE_CURRENT_SOURCE_DIR@\..\targets\windows\libusb-1.0.dll" 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" CreateDirectory "$INSTDIR\lang"
SetOutPath "$INSTDIR\lang" SetOutPath "$INSTDIR\lang"
File "src\*.qm" File "src\*.qm"

View file

@ -18,6 +18,7 @@
#define WINBUILD_H #define WINBUILD_H
#define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) ) #define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )
#undef FORCEINLINE
#define FORCEINLINE inline #define FORCEINLINE inline
#define NOINLINE #define NOINLINE

View file

@ -887,6 +887,7 @@ set(CMAKE_EXE_LINKER_FLAGS "")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>") set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>")
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>") set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET>")
if(NOT MSVC)
if(ARCH STREQUAL ARM) if(ARCH STREQUAL ARM)
cmake_force_c_compiler(arm-none-eabi-gcc GNU) cmake_force_c_compiler(arm-none-eabi-gcc GNU)
cmake_force_cxx_compiler(arm-none-eabi-g++ GNU) cmake_force_cxx_compiler(arm-none-eabi-g++ GNU)
@ -958,3 +959,4 @@ if(CPU_FAMILY STREQUAL STM32)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
endif() endif()
endif()

View file

@ -11,76 +11,77 @@ cd -
mkdir build || true mkdir build || true
cd build cd build
COMMON_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/opt/qt55"
# Companion # Companion
rm -rf * rm -rf *
cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=TARANIS ${SRCDIR} cmake ${COMMON_OPTIONS} ${SRCDIR}
make -j2 make -j2
# OpenTX on 9X stock with FrSky telemetry # OpenTX on 9X stock with FrSky telemetry
rm -rf * 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 firmware
make -j2 simu make -j2 simu
make -j2 gtests ; ./gtests make -j2 gtests ; ./gtests
# OpenTX on 9X stock with Mavlink telemetry # OpenTX on 9X stock with Mavlink telemetry
rm -rf * 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 make -j2 firmware
# OpenTX on Mega2560 # OpenTX on Mega2560
rm -rf * 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 firmware
make -j2 simu make -j2 simu
make -j2 gtests ; ./gtests make -j2 gtests ; ./gtests
# OpenTX on Mega2560 with Mavlink telemetry # OpenTX on Mega2560 with Mavlink telemetry
rm -rf * 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 firmware
make -j2 simu make -j2 simu
make -j2 gtests ; ./gtests make -j2 gtests ; ./gtests
# OpenTX on gruvin9x board # OpenTX on gruvin9x board
rm -rf * 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 firmware
make -j2 simu make -j2 simu
make -j2 gtests ; ./gtests make -j2 gtests ; ./gtests
# OpenTX on Sky9x # OpenTX on Sky9x
rm -rf * 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 firmware
make -j2 simu make -j2 simu
make -j2 gtests ; ./gtests make -j2 gtests ; ./gtests
# OpenTX on Taranis # OpenTX on Taranis
rm -rf * 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 firmware
make -j2 simu make -j2 simu
make -j2 gtests ; ./gtests make -j2 gtests ; ./gtests
# OpenTX on Taranis X9E # OpenTX on Taranis X9E
rm -rf * 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 firmware
make -j2 simu make -j2 simu
make -j2 gtests ; ./gtests make -j2 gtests ; ./gtests
# OpenTX on Taranis Plus # OpenTX on Taranis Plus
rm -rf * 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 firmware
make -j2 simu make -j2 simu
make -j2 gtests ; ./gtests make -j2 gtests ; ./gtests
# OpenTX on Horus # OpenTX on Horus
rm -rf * 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 firmware
make -j2 simu make -j2 simu
#make -j2 gtests ; ./gtests #make -j2 gtests ; ./gtests

View file

@ -1,5 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from __future__ import print_function
import sys import sys
import clang.cindex import clang.cindex
@ -7,21 +9,21 @@ structs = []
def build_struct(cursor): def build_struct(cursor):
structs.append(cursor.spelling) structs.append(cursor.spelling)
print "template <class A, class B>\nvoid copy%s(A * dest, B * src)\n{" % cursor.spelling print("template <class A, class B>\nvoid copy%s(A * dest, B * src)\n{" % cursor.spelling)
for c in cursor.get_children(): for c in cursor.get_children():
if c.kind == clang.cindex.CursorKind.FIELD_DECL: if c.kind == clang.cindex.CursorKind.FIELD_DECL:
if c.type.get_array_size() > 0: if c.type.get_array_size() > 0:
if c.type.get_array_element_type().spelling in structs: if c.type.get_array_element_type().spelling in structs:
print " for (int i=0; i<%d; i++) {" % c.type.get_array_size() 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(" copy%s(&dest->%s[i], &src->%s[i]);" % (c.type.get_array_element_type().spelling, c.spelling, c.spelling))
print " }" print(" }")
else: 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: 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: else:
print " dest->%s = src->%s;" % (c.spelling, c.spelling) print(" dest->%s = src->%s;" % (c.spelling, c.spelling))
print "}\n" print("}\n")
def build(cursor): def build(cursor):
result = [] result = []

View file

@ -3,7 +3,10 @@
from __future__ import division, print_function from __future__ import division, print_function
import sys 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]) image = QtGui.QImage(sys.argv[1])
width, height = image.size().width(), image.size().height() width, height = image.size().width(), image.size().height()