Skip to content

Commit

Permalink
Companion 2.5 (#555)
Browse files Browse the repository at this point in the history
* Introduce yaml in Companion

* EdgeTX Companion
Replace some OpenTX refs
Data conversion to v220
Update Timers ui to cater for mode field split

* Fix some simulators crashing when started from Companion

* Disable firmware and app update checking and downloads from companion

* Some more rebranding

* Disable manual download actions and another rebrand

* Fix cmake warning

* Fix mode ON conversion gtests and enable switch in model edit

* Stop update message when updates turned off

* OpenTX #8580 Fixes missing negative sign for telemetry sources

* OpenTX #8604 fix curves tooltip colors

* OpenTX #8616 Fix release notes url references

* OpenTX #8548 Align file sync folder references

* OpenTX #8548 Link field once

* OpenTX #8550 Confirmation prompt before write models and settings to radio

* OpenTX #8550 Translate strings

* Title and splash images

* Change DEB package maintainer

* Start NV14

* NV14 continued

* NV14 sim

* Timer countdownStart data conversion and ui fixes

* Fix screen width

* Merge OpenTX PR 8675

* NV14 sim add computer keys and mouse to activate some functions

* Only allow supported protocols for each module on conversion

* Clear mismatched modules on conversion

* Replace colorlcd theme and layout blobs with detailed data structs in companion

* NV14 has 2 topbar zones

* Fix layout init

* Fix layout init again

* Reset to eepromimportexport.h to main branch

* Import/export does not like enum fields

* Model edit add custom screens tab for color and bw telemetry

* Free memory
  • Loading branch information
Neil Horne committed Sep 8, 2021
1 parent 5ce08bb commit a981268
Show file tree
Hide file tree
Showing 70 changed files with 2,658 additions and 741 deletions.
12 changes: 6 additions & 6 deletions companion/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endif()
# This the name that the user will see in the generated DMG and what the application
# will be called under /Applications. We include the version string to make installing
# different versions for different eeproms easier, i.e. without manually renaming
set(COMPANION_OSX_APP_BUNDLE_NAME "OpenTX Companion ${VERSION_MAJOR}.${VERSION_MINOR}")
set(COMPANION_OSX_APP_BUNDLE_NAME "EdgeTX Companion ${VERSION_MAJOR}.${VERSION_MINOR}")

# On OS X we copy dfu-util to the application bundle. This the path from which we copy
# the binary (default homebrew path)
Expand Down Expand Up @@ -494,7 +494,7 @@ if(WIN32)
endif()

set(CPACK_PACKAGE_NAME "companion${C9X_NAME_SUFFIX}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the OpenTX open source firmware")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the EdgeTX open source firmware")
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)

# The file stripping is deliberately disabled, with the stripped file we get
Expand All @@ -515,8 +515,8 @@ IF(APPLE)
# Use a non standard Info.plist that adds Retina support flags
set_target_properties(${COMPANION_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/companion/targets/mac/MacOSXBundleInfo.plist.in)
set_target_properties(${SIMULATOR_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/companion/targets/mac/MacOSXBundleInfo.plist.in)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.opentx.companion")

set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.edgetx.companion")

INSTALL(TARGETS ${COMPANION_NAME}
BUNDLE DESTINATION . COMPONENT Runtime
Expand Down Expand Up @@ -584,7 +584,7 @@ if(DPKG_PROGRAM)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bertrand Songis <bsongis-nosp@m-gmail.com>")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Raphael Coeffic")
set(CPACK_DEBIAN_PACKAGE_VERSION ${VERSION})
set(CPACK_DEBIAN_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_DEBIAN_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
Expand All @@ -596,7 +596,7 @@ elseif(APPLE)
# set(CPACK_GENERATOR "TGZ") # for quick testing
set(CPACK_BINARY_DRAGNDROP ON)
set(CPACK_DMG_BACKGROUND_IMAGE ${COMPANION_SRC_DIRECTORY}/images/splash_dmg.png)
set(CPACK_DMG_VOLUME_NAME "OpenTX Companion")
set(CPACK_DMG_VOLUME_NAME "EdgeTX Companion")
set(CPACK_DMG_DS_STORE ${PROJECT_SOURCE_DIR}/companion/targets/mac/DS_Store)
set(CPACK_PACKAGE_FILE_NAME "opentx-${CPACK_PACKAGE_NAME_LOWERCASE}-${VERSION}")
else(DPKG_PROGRAM)
Expand Down
19 changes: 19 additions & 0 deletions companion/src/companion.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@
<file>images/simulator/TX16S/left_tele.png</file>
<file>images/simulator/TX16S/right_ent.png</file>
<file>images/simulator/TX16S/right_mdl.png</file>
<file>images/simulator/NV14/left.png</file>
<file>images/simulator/NV14/right.png</file>
<file>images/simulator/NV14/top.png</file>
<file>images/simulator/NV14/bottom.png</file>
<file>images/wizard/ailerons.png</file>
<file>images/wizard/airbrakes.png</file>
<file>images/wizard/elevons.png</file>
Expand Down Expand Up @@ -1224,4 +1228,19 @@
<file>themes/yerico/48/write_eeprom.png</file>
<file>themes/yerico/48/sdsync.png</file>
</qresource>
<qresource prefix="/layouts/">
<file alias="mask_layout1p2.png">../../radio/src/gui/colorlcd/layouts/mask_layout1+2.png</file>
<file alias="mask_layout1p3.png">../../radio/src/gui/colorlcd/layouts/mask_layout1+3.png</file>
<file alias="mask_layout1x1.png">../../radio/src/gui/colorlcd/layouts/mask_layout1x1.png</file>
<file alias="mask_layout1x2.png">../../radio/src/gui/colorlcd/layouts/mask_layout1x2.png</file>
<file alias="mask_layout1x3.png">../../radio/src/gui/colorlcd/layouts/mask_layout1x3.png</file>
<file alias="mask_layout1x4.png">../../radio/src/gui/colorlcd/layouts/mask_layout1x4.png</file>
<file alias="mask_layout2p1.png">../../radio/src/gui/colorlcd/layouts/mask_layout2+1.png</file>
<file alias="mask_layout2p3.png">../../radio/src/gui/colorlcd/layouts/mask_layout2+3.png</file>
<file alias="mask_layout2x1.png">../../radio/src/gui/colorlcd/layouts/mask_layout2x1.png</file>
<file alias="mask_layout2x2.png">../../radio/src/gui/colorlcd/layouts/mask_layout2x2.png</file>
<file alias="mask_layout2x3.png">../../radio/src/gui/colorlcd/layouts/mask_layout2x3.png</file>
<file alias="mask_layout2x4.png">../../radio/src/gui/colorlcd/layouts/mask_layout2x4.png</file>
<file alias="mask_layout4p2.png">../../radio/src/gui/colorlcd/layouts/mask_layout4+2.png</file>
</qresource>
</RCC>
7 changes: 5 additions & 2 deletions companion/src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#define CPN_MAX_GYRO_ANALOGS 2
#define CPN_MAX_ANALOGS (CPN_MAX_STICKS + CPN_MAX_POTS + CPN_MAX_MOUSE_ANALOGS + CPN_MAX_GYRO_ANALOGS)

#define CPN_STR_APP_NAME QCoreApplication::translate("Companion", "OpenTX Companion")
#define CPN_STR_APP_NAME QCoreApplication::translate("Companion", "EdgeTX Companion")
#define CPN_STR_TTL_INFO QCoreApplication::translate("Companion", "Information") // shared Title Case words, eg. for a window title or section heading
#define CPN_STR_TTL_WARNING QCoreApplication::translate("Companion", "Warning")
#define CPN_STR_TTL_ERROR QCoreApplication::translate("Companion", "Error")
Expand All @@ -59,7 +59,8 @@
#define DFU_FILES_FILTER "DFU " % CPN_STR_FILES % " (*.dfu);;"
#define EEPE_FILES_FILTER "EEPE " % CPN_STR_FILES % " (*.eepe);;"
#define OTX_FILES_FILTER "OpenTX " % CPN_STR_FILES % " (*.otx);;"
#define EEPROM_FILES_FILTER CPN_STR_RAD_MOD_SETTINGS % " " % CPN_STR_FILES % " (*.otx *.eepe *.bin *.hex);;" % OTX_FILES_FILTER % EEPE_FILES_FILTER % BIN_FILES_FILTER % HEX_FILES_FILTER
#define YML_FILES_FILTER "YAML " % CPN_STR_FILES % " (*.yml);;"
#define EEPROM_FILES_FILTER CPN_STR_RAD_MOD_SETTINGS % " " % CPN_STR_FILES % " (*.otx *.yml *.eepe *.bin *.hex);;" % OTX_FILES_FILTER % YML_FILES_FILTER % EEPE_FILES_FILTER % BIN_FILES_FILTER % HEX_FILES_FILTER
#define FLASH_FILES_FILTER "FLASH " % CPN_STR_FILES % " (*.bin *.hex *.dfu);;" % BIN_FILES_FILTER % HEX_FILES_FILTER % DFU_FILES_FILTER
#define EXTERNAL_EEPROM_FILES_FILTER "EEPROM " % CPN_STR_FILES % " (*.bin *.hex);;" % BIN_FILES_FILTER % HEX_FILES_FILTER
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
Expand All @@ -78,4 +79,6 @@
#define CPN_STR_SW_INDICATOR_NEUT QCoreApplication::translate("RawSwitch", "-") // Switch neutral (middle) position indicator.
#define CPN_STR_SW_INDICATOR_REV QCoreApplication::translate("RawSwitch", "!") // Switch reversed logic (NOT) indicator.

#define OPENTX_HOME_PAGE_URL "http://www.edge-tx.org"

#endif // _CONSTANTS_H_
9 changes: 0 additions & 9 deletions companion/src/datamodels/compounditemmodels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ RawSwitchItemModel::RawSwitchItemModel(const GeneralSettings * const generalSett
addItems(SWITCH_TYPE_SWITCH, -board->getCapability(Board::SwitchPositions));

// Ascending switch direction (including zero)
addItems(SWITCH_TYPE_TIMER_MODE, 5);
addItems(SWITCH_TYPE_NONE, 1);
addItems(SWITCH_TYPE_SWITCH, board->getCapability(Board::SwitchPositions));
addItems(SWITCH_TYPE_MULTIPOS_POT, board->getCapability(Board::MultiposPots) * board->getCapability(Board::MultiposPotsPositions));
Expand Down Expand Up @@ -214,14 +213,6 @@ void RawSwitchItemModel::addItems(const RawSwitchType & type, int count)
context &= ~RawSwitch::GlobalFunctionsContext;
break;

case SWITCH_TYPE_TIMER_MODE:
context = RawSwitch::TimersContext;
break;

case SWITCH_TYPE_NONE:
context &= ~RawSwitch::TimersContext;
break;

case SWITCH_TYPE_ON:
case SWITCH_TYPE_ONE:
context = RawSwitch::SpecialFunctionsContext | RawSwitch::GlobalFunctionsContext;
Expand Down
90 changes: 51 additions & 39 deletions companion/src/dialogs/filesyncdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,31 +123,28 @@ static QWidget * folderSelectorWidget(QLineEdit * le, QWidget * parent)

void FileSyncDialog::setupUi()
{
const QString srcArw = CPN_STR_SW_INDICATOR_UP % " ";
const QString dstArw = CPN_STR_SW_INDICATOR_DN % " ";
m_folderNameA = tr("Folder A");
m_folderNameB = tr("Folder B");
int row = 0;

CompanionIcon playIcon("play.png");
playIcon.addImage("stop.png", QIcon::Normal, QIcon::On);

QLabel * lblSrc = new QLabel(tr("Source Folder:"), this);
AutoLineEdit * leSrc = new AutoLineEdit(this, true);
leSrc->setField(m_syncOptions.folderA);
leSrc->setText(QDir::toNativeSeparators(m_syncOptions.folderA));
QWidget * wdgSrc = folderSelectorWidget(leSrc, this);

QLabel * lblDst = new QLabel(tr("Destination Folder:"), this);
AutoLineEdit * leDst = new AutoLineEdit(this, true);
leDst->setField(m_syncOptions.folderB);
leDst->setText(QDir::toNativeSeparators(m_syncOptions.folderB));
QWidget * wdgDst = folderSelectorWidget(leDst, this);

AutoComboBox * syncDir = new AutoComboBox(this);
syncDir->addItem(tr("%1%2 Both directions, to destination folder first").arg(dstArw, srcArw), SyncProcess::SYNC_A2B_B2A);
syncDir->addItem(tr("%1%2 Both directions, to source folder first").arg(srcArw, dstArw), SyncProcess::SYNC_B2A_A2B);
syncDir->addItem(tr(" %1 Only from source folder to destination folder").arg(dstArw), SyncProcess::SYNC_A2B);
syncDir->addItem(tr(" %1 Only from destination folder to source folder").arg(srcArw), SyncProcess::SYNC_B2A);
syncDir->setCurrentIndex(-1); // we set the default option later
QLabel * lblFolderA = new QLabel(m_folderNameA % ":", this);
AutoLineEdit * leFolderA = new AutoLineEdit(this, true);
leFolderA->setField(m_syncOptions.folderA);
leFolderA->setText(QDir::toNativeSeparators(m_syncOptions.folderA));
QWidget * wdgFolderA = folderSelectorWidget(leFolderA, this);

QLabel * lblFolderB = new QLabel(m_folderNameB % ":", this);
AutoLineEdit * leFolderB = new AutoLineEdit(this, true);
leFolderB->setField(m_syncOptions.folderB);
leFolderB->setText(QDir::toNativeSeparators(m_syncOptions.folderB));
QWidget * wdgFolderB = folderSelectorWidget(leFolderB, this);

ui_syncDir = new AutoComboBox(this);
setSyncDirList();
ui_syncDir->setField(m_syncOptions.direction);

AutoComboBox * copyMode = new AutoComboBox(this);
copyMode->setToolTip(tr("How to handle overwriting files which already exist in the destination folder."));
Expand Down Expand Up @@ -274,12 +271,12 @@ void FileSyncDialog::setupUi()
ui_optionsPanel = new QGroupBox(tr("Options"), this);
QGridLayout * optsLay = new QGridLayout(ui_optionsPanel);
row = 0;
optsLay->addWidget(lblSrc, row, 0);
optsLay->addWidget(wdgSrc, row++, 1);
optsLay->addWidget(lblDst, row, 0);
optsLay->addWidget(wdgDst, row++, 1);
optsLay->addWidget(lblFolderA, row, 0);
optsLay->addWidget(wdgFolderA, row++, 1);
optsLay->addWidget(lblFolderB, row, 0);
optsLay->addWidget(wdgFolderB, row++, 1);
optsLay->addWidget(new QLabel(tr("Sync. Direction:"), this), row, 0);
optsLay->addWidget(syncDir, row++, 1);
optsLay->addWidget(ui_syncDir, row++, 1);
optsLay->addWidget(new QLabel(tr("Existing Files:"), this), row, 0);
optsLay->addWidget(copyMode, row++, 1);
optsLay->addWidget(new QLabel(tr("Max. File Size:"), this), row, 0);
Expand All @@ -299,13 +296,13 @@ void FileSyncDialog::setupUi()

// Connect all signal handlers

// source path
connect(leSrc, &AutoLineEdit::textChanged, this, &FileSyncDialog::validate);
// destination path
connect(leDst, &AutoLineEdit::textChanged, this, &FileSyncDialog::validate);
// folder A path
connect(leFolderA, &AutoLineEdit::textChanged, this, &FileSyncDialog::validate);
// folder B path
connect(leFolderB, &AutoLineEdit::textChanged, this, &FileSyncDialog::validate);

// function to dis/enable the OVERWR_ALWAYS option depending on sync direction
connect(syncDir, &AutoComboBox::currentDataChanged, [=](int dir) {
connect(ui_syncDir, &AutoComboBox::currentDataChanged, [=](int dir) {
int idx = copyMode->findData(SyncProcess::OVERWR_ALWAYS);
int flg = (dir == SyncProcess::SYNC_A2B || dir == SyncProcess::SYNC_B2A) ? 33 : 0;
if (!flg && idx == copyMode->currentIndex())
Expand Down Expand Up @@ -342,7 +339,7 @@ void FileSyncDialog::setupUi()
});

// we set these after connections are made because we want the signal processors to run
syncDir->setField(m_syncOptions.direction);
ui_syncDir->setField(m_syncOptions.direction);
maxSize->setValue(m_syncOptions.maxFileSize / 1024);

// connect Reset action to all fields
Expand All @@ -354,14 +351,16 @@ void FileSyncDialog::setupUi()
connect(this, &FileSyncDialog::optionsWereReset, a, &AutoBitsetCheckBox::updateValue);
connect(this, &FileSyncDialog::optionsWereReset, [=]() { maxSize->setValue(m_syncOptions.maxFileSize / 1024); });

// React to name changes for source and destination path labels
// React to name changes for folder path labels
connect(this, &FileSyncDialog::folderNameAChanged, [=](const QString &text) {
lblSrc->setText(text % ":");
wdgSrc->setProperty("fileDialogTitle", text);
lblFolderA->setText(text % ":");
wdgFolderA->setProperty("fileDialogTitle", text);
setSyncDirList();
});
connect(this, &FileSyncDialog::folderNameBChanged, [=](const QString &text) {
lblDst->setText(text % ":");
wdgDst->setProperty("fileDialogTitle", text);
lblFolderB->setText(text % ":");
wdgFolderB->setProperty("fileDialogTitle", text);
setSyncDirList();
});

// button actions
Expand Down Expand Up @@ -487,11 +486,11 @@ bool FileSyncDialog::validate()
{
QString msg;
if (m_syncOptions.folderA.isEmpty() || !QFileInfo(m_syncOptions.folderA).exists())
msg = tr("Source folder not found.");
msg = tr("%1 not found.").arg(m_folderNameA);
else if (m_syncOptions.folderB.isEmpty() || !QFileInfo(m_syncOptions.folderB).exists())
msg = tr("Destination folder not found.");
msg = tr("%1 not found.").arg(m_folderNameB);
else if (QFileInfo(m_syncOptions.folderA).canonicalFilePath() == QFileInfo(m_syncOptions.folderB).canonicalFilePath())
msg = tr("Source and destination folders are the same.");
msg = tr("Folders are the same.");

setStatusText(msg, QtCriticalMsg);
ui_btnStartStop->setEnabled(msg.isEmpty());
Expand All @@ -502,3 +501,16 @@ void FileSyncDialog::adjustSizeDelayed()
{
QTimer::singleShot(0, [=]() { adjustSize(); });
}

void FileSyncDialog::setSyncDirList()
{
const QString upArw = CPN_STR_SW_INDICATOR_UP % " ";
const QString downArw = CPN_STR_SW_INDICATOR_DN % " ";

ui_syncDir->clear();
ui_syncDir->addItem(tr("%1%2 Both directions, to %3 first").arg(downArw, upArw, m_folderNameB), SyncProcess::SYNC_A2B_B2A);
ui_syncDir->addItem(tr("%1%2 Both directions, to %3 first").arg(upArw, downArw, m_folderNameA), SyncProcess::SYNC_B2A_A2B);
ui_syncDir->addItem(tr(" %1 Only from %2 to %3").arg(downArw, m_folderNameA, m_folderNameB), SyncProcess::SYNC_A2B);
ui_syncDir->addItem(tr(" %1 Only from %2 to %3").arg(upArw, m_folderNameB, m_folderNameA), SyncProcess::SYNC_B2A);
ui_syncDir->updateValue();
}
8 changes: 4 additions & 4 deletions companion/src/dialogs/filesyncdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* GNU General Public License for more details.
*/

#ifndef FILESYNCDIALOG_H
#define FILESYNCDIALOG_H
#pragma once

#include "process_sync.h"

Expand All @@ -30,6 +29,7 @@
#include <QToolButton>

class ProgressWidget;
class AutoComboBox;

class FileSyncDialog : public QDialog
{
Expand Down Expand Up @@ -76,6 +76,7 @@ class FileSyncDialog : public QDialog
void updateRunningState();
void onStatusUpdate(const SyncProcess::SyncStatus & stat);
void adjustSizeDelayed();
void setSyncDirList();

private:
SyncProcess::SyncOptions m_syncOptions;
Expand All @@ -91,6 +92,5 @@ class FileSyncDialog : public QDialog
QToolButton * ui_btnStartStop;
QToolButton * ui_btnClose;
QLabel * ui_statusLabel;
AutoComboBox * ui_syncDir;
};

#endif // FILESYNCDIALOG_H
1 change: 1 addition & 0 deletions companion/src/firmwares/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ string(REPLACE ".cpp" ".h" firmwares_HDRS "${firmwares_SRCS}")
list(APPEND firmwares_HDRS
eepromimportexport.h
moduledata.h
customisation_data.h
)

set(firmwares_QT
Expand Down
Loading

0 comments on commit a981268

Please sign in to comment.