[Simulator] New main UI window, debug console, separate outputs window, more. (#4385)

* [package] Add QtSvg support DLLs for Windows.

* [Simulator] Add images/css resources for new version; Create SimulatorIcon and SimulatorStyle classes; Build with SVG support, remove unused bitmaps.

* [Simulator] Improve and simplify VirtualJoystickWidget resize event (sticks maintain X/Y position) & improve values layout w/out trims.

* [Simulator] Refactor Trainer simulator to use VirtualJoystickWidget, gains lock/hold buttons and X/Y position readout.

* [Simulator] More compact layout for Telemetry simulator, reduces min. width and adds scrolling columns to allow smaller window sizes.

* [Simulator] Add new SimulatorMainWindow and RadioOutputsWidget UI classes.

* [storage] Add non-persistent sessionId() to AppData for tracking currently active radio profile ID.

* [Simulator] Major UI updates:
    * Use a MainWindow interface with dockable/floatable windows, proper toolbar & menu;
    * Persistent size/layout state of all windows/docks/etc between uses, per radio profile;
    * Completely separate radio Outputs window with configurable layout (also persistent between uses);
    * Translations now enabled in standalone Simulator, follows main Companion setting (they need a lot of updates);
    * New custom icons throughout, toolbar icon sizes adhere to user preference in Companion.

* [Simulator] Debug Output console updates:
    * New filter feature with optional full RegEx support, can work in inclusive or exclusive modes (full help text is included in UI);
    * Up to 50 user-defined filters are saved to permanent settings, also a few predefined filters are provided;
    * Saves/restores the last filter used and if it was en/disabled;
    * Added word wrap and clear screen features;
    * Configurable scroll-back buffer size;
    * Increased efficiency & performance of the buffering/printing process.

* [Simulator][OSX] Visual UI tweaks for OS X.

* [Simulator] Fix some debug console settings not being restored properly.

* [Simulator] Add ability to hide/show menu bar; Persist view state of menu bar and radio title bar; Reduce font size on OS X; Other small visual tweaks and improvements.

* [build] Add QtSvg to Linux build scripts (a guess for Dockerfile).

* [build] Fix for Qt 5.3.

* Add OpenTx headers to new files.

* [Companion][storage] Update GeneralSettings() initializer to use current sessionId for profile data retrieval, removes workaround for standalone Simulator being started with arbitrary profile; AppData: always update sessionId when global id() changes.

* [X10] Fixes for new simulator
This commit is contained in:
Max Paperno
2017-02-04 11:59:42 +01:00
committed by Bertrand Songis
parent b493973d7d
commit 2f9d9c1a99
62 changed files with 6357 additions and 3095 deletions
+9 -16
View File
@@ -25,24 +25,20 @@
#include "radio/src/telemetry/frsky.h"
TelemetrySimulator::TelemetrySimulator(QWidget * parent, SimulatorInterface * simulator):
QDialog(parent),
QWidget(parent),
ui(new Ui::TelemetrySimulator),
simulator(simulator)
{
ui->setupUi(this);
QPoint dialogCenter = mapToGlobal(rect().center());
QPoint parentWindowCenter = parent->window()->mapToGlobal(
parent->window()->rect().center());
move(parentWindowCenter - dialogCenter);
timer = new QTimer(this);
timer->setInterval(10);
connect(timer, SIGNAL(timeout()), this, SLOT(onTimerEvent()));
logTimer = new QTimer(this);
connect(logTimer, SIGNAL(timeout()), this, SLOT(onLogTimerEvent()));
connect(ui->Simulate, SIGNAL(clicked(bool)), this, SLOT(onSimulateToggled(bool)));
connect(ui->Simulate, SIGNAL(toggled(bool)), this, SLOT(onSimulateToggled(bool)));
connect(ui->loadLogFile, SIGNAL(released()), this, SLOT(onLoadLogFile()));
connect(ui->play, SIGNAL(released()), this, SLOT(onPlay()));
connect(ui->rewind, SIGNAL(clicked()), this, SLOT(onRewind()));
@@ -76,7 +72,7 @@ TelemetrySimulator::~TelemetrySimulator()
void TelemetrySimulator::onSimulateToggled(bool isChecked)
{
if (isChecked) {
timer->start(10);
timer->start();
}
else {
timer->stop();
@@ -197,9 +193,6 @@ void TelemetrySimulator::showEvent(QShowEvent *event)
ui->rxbt_ratio->setValue(simulator->getSensorRatio(BATT_ID) / 10.0);
ui->A1_ratio->setValue(simulator->getSensorRatio(ADC1_ID) / 10.0);
ui->A2_ratio->setValue(simulator->getSensorRatio(ADC2_ID) / 10.0);
ui->Simulate->setChecked(true);
onSimulateToggled(true); // not sure why this doesn't fire automatically
}
void setSportPacketCrc(uint8_t * packet)
@@ -216,7 +209,7 @@ void setSportPacketCrc(uint8_t * packet)
//TRACE("crc set: %x", packet[FRSKY_SPORT_PACKET_SIZE-1]);
}
uint8_t getBit(uint8_t position, uint8_t value)
uint8_t getBit(uint8_t position, uint8_t value)
{
return (value & (uint8_t)(1 << position)) ? 1 : 0;
}
@@ -224,7 +217,7 @@ uint8_t getBit(uint8_t position, uint8_t value)
bool generateSportPacket(uint8_t * packet, uint8_t dataId, uint8_t prim, uint16_t appId, uint32_t data)
{
if (dataId > 0x1B ) return false;
// generate Data ID field
uint8_t bit5 = getBit(0, dataId) ^ getBit(1, dataId) ^ getBit(2, dataId);
uint8_t bit6 = getBit(2, dataId) ^ getBit(3, dataId) ^ getBit(4, dataId);
@@ -483,7 +476,7 @@ uint32_t TelemetrySimulator::FlvssEmulator::setAllCells_GetNextPair(double cellV
// encode the double values into telemetry format
encodeAllCells();
// return the value for the current pair
// return the value for the current pair
uint32_t cellData = 0;
if (nextCellNum >= numCells) {
nextCellNum = 0;
@@ -644,7 +637,7 @@ TelemetrySimulator::LogPlaybackController::LogPlaybackController(Ui::TelemetrySi
colToFuncMap.insert("AccX(g)", ACCX);
colToFuncMap.insert("AccY(g)", ACCY);
colToFuncMap.insert("AccZ(g)", ACCZ);
// ACCX Y and Z
}
@@ -839,7 +832,7 @@ double TelemetrySimulator::LogPlaybackController::convertDegMin(QString input)
QString TelemetrySimulator::LogPlaybackController::convertGPS(QString input)
{
// input format is DDmm.mmmmH DDDmm.mmmmH (longitude latitude - degrees (2 places) minutes (2 places) decimal minutes (4 places))
// input format is DDmm.mmmmH DDDmm.mmmmH (longitude latitude - degrees (2 places) minutes (2 places) decimal minutes (4 places))
QStringList lonLat = input.simplified().split(' ');
if (lonLat.count() < 2) {
return ""; // invalid format