[Simulator] LCD screenshot file name now includes radio type; Remove unnecessary class dependence in SimulatedUIWidget initializer; Show exit status debug; Cosmetics.

This commit is contained in:
Max Paperno
2017-02-08 00:02:34 -05:00
parent 62bcfb52c0
commit c4acbf6054
9 changed files with 81 additions and 67 deletions
+11 -7
View File
@@ -24,10 +24,10 @@
#include "radiouiaction.h" #include "radiouiaction.h"
#include "simulatorinterface.h" #include "simulatorinterface.h"
SimulatedUIWidget::SimulatedUIWidget(SimulatorInterface * simulator, SimulatorDialog * simuDialog, QWidget * parent) : SimulatedUIWidget::SimulatedUIWidget(SimulatorInterface * simulator, QWidget * parent) :
QWidget(parent), QWidget(parent),
m_simulator(simulator), m_simulator(simulator),
m_simuDialog(simuDialog), m_parent(parent),
m_lcd(NULL), m_lcd(NULL),
m_scrollUpAction(NULL), m_scrollUpAction(NULL),
m_scrollDnAction(NULL), m_scrollDnAction(NULL),
@@ -63,12 +63,12 @@ RadioUiAction * SimulatedUIWidget::addRadioUiAction(RadioUiAction * act)
RadioUiAction * SimulatedUIWidget::addRadioUiAction(int index, int key, const QString & text, const QString & descript) RadioUiAction * SimulatedUIWidget::addRadioUiAction(int index, int key, const QString & text, const QString & descript)
{ {
return addRadioUiAction(new RadioUiAction(index, key, m_simuDialog, text, descript)); return addRadioUiAction(new RadioUiAction(index, key, m_parent, text, descript));
} }
RadioUiAction * SimulatedUIWidget::addRadioUiAction(int index, QList<int> keys, const QString & text, const QString & descript) RadioUiAction * SimulatedUIWidget::addRadioUiAction(int index, QList<int> keys, const QString & text, const QString & descript)
{ {
return addRadioUiAction(new RadioUiAction(index, keys, m_simuDialog, text, descript)); return addRadioUiAction(new RadioUiAction(index, keys, m_parent, text, descript));
} }
QPolygon SimulatedUIWidget::polyArc(int ctrX, int ctrY, int radius, int startAngle, int endAngle, int step) QPolygon SimulatedUIWidget::polyArc(int ctrX, int ctrY, int radius, int startAngle, int endAngle, int step)
@@ -116,18 +116,22 @@ void SimulatedUIWidget::updateUi()
void SimulatedUIWidget::captureScreenshot() void SimulatedUIWidget::captureScreenshot()
{ {
QString fileName = ""; QString fileName;
if (!g.snapToClpbrd()) { if (!g.snapToClpbrd()) {
QString path = g.snapshotDir(); QString path = g.snapshotDir();
if (path.isEmpty()) if (path.isEmpty())
path = "./"; path = "./";
QDir dir(path); QDir dir(path);
if (!dir.exists() || !dir.isReadable()) { if (!dir.exists() || !dir.isReadable()) {
// m_simulator->traceCallback("SIMULATOR ERROR - Cannot open screenshot folder, check your settings.\n"); // m_simulator->traceCallback("SIMULATOR ERROR - Cannot open screenshot folder, check your settings.\n");
qDebug() << "SIMULATOR ERROR - Cannot open screenshot folder, check your settings."; qDebug() << "SIMULATOR ERROR - Cannot open screenshot folder, check your settings.";
return; return;
} }
fileName += QString("%1/screenshot_%2.png").arg(dir.absolutePath(), QDateTime::currentDateTime().toString("yy-MM-dd_HH-mm-ss")); QStringList fwid = getCurrentFirmware()->getId().split("-", QString::SkipEmptyParts);
QString flavor = fwid.at(qMin(1, fwid.size()));
QString fnpfx = tr("screenshot", "Simulator LCD screenshot file name prefix");
fileName = "%1/%2_%3_%4.png";
fileName = fileName.arg(dir.absolutePath(), fnpfx, flavor, QDateTime::currentDateTime().toString("yy-MM-dd_HH-mm-ss"));
} }
m_lcd->makeScreenshot(fileName); m_lcd->makeScreenshot(fileName);
} }
+11 -17
View File
@@ -45,7 +45,7 @@ class SimulatedUIWidget : public QWidget
protected: protected:
explicit SimulatedUIWidget(SimulatorInterface * simulator, SimulatorDialog * simuDialog = NULL, QWidget * parent = NULL); explicit SimulatedUIWidget(SimulatorInterface * simulator, QWidget * parent = NULL);
public: public:
@@ -72,12 +72,13 @@ class SimulatedUIWidget : public QWidget
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event);
protected: protected:
void setLcd(LcdWidget * lcd); void setLcd(LcdWidget * lcd);
void connectScrollActions(); void connectScrollActions();
virtual void setLightOn(bool enable) { } virtual void setLightOn(bool enable) { }
SimulatorInterface * m_simulator; SimulatorInterface * m_simulator;
SimulatorDialog * m_simuDialog; QWidget * m_parent;
LcdWidget * m_lcd; LcdWidget * m_lcd;
QVector<QColor> m_backlightColors; QVector<QColor> m_backlightColors;
QVector<keymapHelp_t> m_keymapHelp; QVector<keymapHelp_t> m_keymapHelp;
@@ -92,6 +93,9 @@ class SimulatedUIWidget : public QWidget
int m_beepShow; int m_beepShow;
int m_beepVal; int m_beepVal;
signals:
void customStyleRequest(const QString & style);
}; };
@@ -109,14 +113,12 @@ class SimulatedUIWidget9X: public SimulatedUIWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SimulatedUIWidget9X(SimulatorInterface * simulator, SimulatorDialog * simuDialog = NULL, QWidget * parent = NULL); explicit SimulatedUIWidget9X(SimulatorInterface * simulator, QWidget * parent = NULL);
virtual ~SimulatedUIWidget9X(); virtual ~SimulatedUIWidget9X();
protected: protected:
void setLightOn(bool enable); void setLightOn(bool enable);
protected slots:
private: private:
Ui::SimulatedUIWidget9X * ui; Ui::SimulatedUIWidget9X * ui;
@@ -127,11 +129,9 @@ class SimulatedUIWidgetX7: public SimulatedUIWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SimulatedUIWidgetX7(SimulatorInterface * simulator, SimulatorDialog * simuDialog = NULL, QWidget * parent = NULL); explicit SimulatedUIWidgetX7(SimulatorInterface * simulator, QWidget * parent = NULL);
virtual ~SimulatedUIWidgetX7(); virtual ~SimulatedUIWidgetX7();
protected:
private: private:
Ui::SimulatedUIWidgetX7 * ui; Ui::SimulatedUIWidgetX7 * ui;
}; };
@@ -141,11 +141,9 @@ class SimulatedUIWidgetX9: public SimulatedUIWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SimulatedUIWidgetX9(SimulatorInterface * simulator, SimulatorDialog * simuDialog = NULL, QWidget * parent = NULL); explicit SimulatedUIWidgetX9(SimulatorInterface * simulator, QWidget * parent = NULL);
virtual ~SimulatedUIWidgetX9(); virtual ~SimulatedUIWidgetX9();
protected:
private: private:
Ui::SimulatedUIWidgetX9 * ui; Ui::SimulatedUIWidgetX9 * ui;
}; };
@@ -155,11 +153,9 @@ class SimulatedUIWidgetX9E: public SimulatedUIWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SimulatedUIWidgetX9E(SimulatorInterface * simulator, SimulatorDialog * simuDialog = NULL, QWidget * parent = NULL); explicit SimulatedUIWidgetX9E(SimulatorInterface * simulator, QWidget * parent = NULL);
virtual ~SimulatedUIWidgetX9E(); virtual ~SimulatedUIWidgetX9E();
protected:
private: private:
Ui::SimulatedUIWidgetX9E * ui; Ui::SimulatedUIWidgetX9E * ui;
}; };
@@ -169,11 +165,9 @@ class SimulatedUIWidgetX12: public SimulatedUIWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SimulatedUIWidgetX12(SimulatorInterface * simulator, SimulatorDialog * simuDialog = NULL, QWidget * parent = NULL); explicit SimulatedUIWidgetX12(SimulatorInterface * simulator, QWidget * parent = NULL);
virtual ~SimulatedUIWidgetX12(); virtual ~SimulatedUIWidgetX12();
protected:
private: private:
Ui::SimulatedUIWidgetX12 * ui; Ui::SimulatedUIWidgetX12 * ui;
}; };
@@ -21,8 +21,8 @@
#include "simulateduiwidget.h" #include "simulateduiwidget.h"
#include "ui_simulateduiwidget9X.h" #include "ui_simulateduiwidget9X.h"
SimulatedUIWidget9X::SimulatedUIWidget9X(SimulatorInterface * simulator, SimulatorDialog * simuDialog, QWidget * parent): SimulatedUIWidget9X::SimulatedUIWidget9X(SimulatorInterface * simulator, QWidget * parent):
SimulatedUIWidget(simulator, simuDialog, parent), SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidget9X) ui(new Ui::SimulatedUIWidget9X)
{ {
RadioUiAction * act; RadioUiAction * act;
@@ -21,8 +21,8 @@
#include "simulateduiwidget.h" #include "simulateduiwidget.h"
#include "ui_simulateduiwidgetX12.h" #include "ui_simulateduiwidgetX12.h"
SimulatedUIWidgetX12::SimulatedUIWidgetX12(SimulatorInterface *simulator, SimulatorDialog * simuDialog, QWidget * parent): SimulatedUIWidgetX12::SimulatedUIWidgetX12(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, simuDialog, parent), SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetX12) ui(new Ui::SimulatedUIWidgetX12)
{ {
RadioUiAction * act; RadioUiAction * act;
@@ -1,8 +1,8 @@
#include "simulateduiwidget.h" #include "simulateduiwidget.h"
#include "ui_simulateduiwidgetX7.h" #include "ui_simulateduiwidgetX7.h"
SimulatedUIWidgetX7::SimulatedUIWidgetX7(SimulatorInterface *simulator, SimulatorDialog * simuDialog, QWidget * parent): SimulatedUIWidgetX7::SimulatedUIWidgetX7(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, simuDialog, parent), SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetX7) ui(new Ui::SimulatedUIWidgetX7)
{ {
RadioUiAction * act; RadioUiAction * act;
@@ -43,11 +43,19 @@ SimulatedUIWidgetX7::SimulatedUIWidgetX7(SimulatorInterface *simulator, Simulato
setLcd(ui->lcd); setLcd(ui->lcd);
// try to match the gradient on the white radio images. QString css = "#radioUiWidget {"
m_simuDialog->setUiAreaStyle("background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:1, " \ "background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:0, y2:1,"
"stop:0 rgba(255, 255, 255, 255), " \ "stop:0 rgba(255, 255, 255, 255),"
"stop:0.757062 rgba(241, 238, 238, 255), " \ "stop:0.757062 rgba(241, 238, 238, 255),"
"stop:1 rgba(247, 245, 245, 255));"); "stop:1 rgba(247, 245, 245, 255));"
"}";
QTimer * tim = new QTimer(this);
tim->setSingleShot(true);
connect(tim, &QTimer::timeout, [this, css]() {
emit customStyleRequest(css);
});
tim->start(100);
} }
SimulatedUIWidgetX7::~SimulatedUIWidgetX7() SimulatedUIWidgetX7::~SimulatedUIWidgetX7()
@@ -21,8 +21,8 @@
#include "simulateduiwidget.h" #include "simulateduiwidget.h"
#include "ui_simulateduiwidgetX9.h" #include "ui_simulateduiwidgetX9.h"
SimulatedUIWidgetX9::SimulatedUIWidgetX9(SimulatorInterface *simulator, SimulatorDialog * simuDialog, QWidget * parent): SimulatedUIWidgetX9::SimulatedUIWidgetX9(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, simuDialog, parent), SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetX9) ui(new Ui::SimulatedUIWidgetX9)
{ {
RadioUiAction * act; RadioUiAction * act;
@@ -30,9 +30,6 @@ SimulatedUIWidgetX9::SimulatedUIWidgetX9(SimulatorInterface *simulator, Simulato
ui->setupUi(this); ui->setupUi(this);
//getCurrentFirmware()->getCapability(Capability(RotaryEncoders)); // not working for X9E ?
bool rotaryOnly = IS_TARANIS_X9E(m_board);
// add actions in order of appearance on the help menu // add actions in order of appearance on the help menu
act = addRadioUiAction(0, QList<int>() << Qt::Key_PageUp, tr("PG-UP"), tr("[ MENU ]")); act = addRadioUiAction(0, QList<int>() << Qt::Key_PageUp, tr("PG-UP"), tr("[ MENU ]"));
@@ -47,16 +44,8 @@ SimulatedUIWidgetX9::SimulatedUIWidgetX9(SimulatorInterface *simulator, Simulato
polygon.setPoints(6, 24, 154, 32, 144, 46, 146, 57, 156, 46, 167, 29, 166); polygon.setPoints(6, 24, 154, 32, 144, 46, 146, 57, 156, 46, 167, 29, 166);
ui->leftbuttons->addArea(polygon, "Taranis/x9l3.png", act); ui->leftbuttons->addArea(polygon, "Taranis/x9l3.png", act);
if (rotaryOnly) { m_scrollUpAction = addRadioUiAction(4, QList<int>() << Qt::Key_Plus << Qt::Key_Equal << Qt::Key_Up, tr("+/UP"), tr("[ + ]"));
m_keymapHelp.append(keymapHelp_t(tr("WHEEL/PAD SCRL"), tr("Rotary Selector"))); m_scrollDnAction = addRadioUiAction(5, QList<int>() << Qt::Key_Minus << Qt::Key_Down, tr("-/DN"), tr("[ - ]"));
m_scrollUpAction = addRadioUiAction(-1, QList<int>() << Qt::Key_Minus << Qt::Key_Equal << Qt::Key_Up, tr("-/UP"), tr("Rotary UP"));
m_scrollDnAction = addRadioUiAction(-1, QList<int>() << Qt::Key_Plus << Qt::Key_Down, tr("+/DN"), tr("Rotary DOWN"));
connectScrollActions();
}
else {
m_scrollUpAction = addRadioUiAction(4, QList<int>() << Qt::Key_Plus << Qt::Key_Equal << Qt::Key_Up, tr("+/UP"), tr("[ + ]"));
m_scrollDnAction = addRadioUiAction(5, QList<int>() << Qt::Key_Minus << Qt::Key_Down, tr("-/DN"), tr("[ - ]"));
}
polygon.setPoints(6, 64, 60, 71, 50, 90, 50, 100, 60, 90, 73, 72, 73); polygon.setPoints(6, 64, 60, 71, 50, 90, 50, 100, 60, 90, 73, 72, 73);
ui->rightbuttons->addArea(polygon, "Taranis/x9r1.png", m_scrollUpAction); ui->rightbuttons->addArea(polygon, "Taranis/x9r1.png", m_scrollUpAction);
@@ -64,14 +53,13 @@ SimulatedUIWidgetX9::SimulatedUIWidgetX9(SimulatorInterface *simulator, Simulato
polygon.setPoints(6, 63, 109, 73, 100, 88, 100, 98, 109, 88, 119, 72, 119); polygon.setPoints(6, 63, 109, 73, 100, 88, 100, 98, 109, 88, 119, 72, 119);
ui->rightbuttons->addArea(polygon, "Taranis/x9r2.png", m_scrollDnAction); ui->rightbuttons->addArea(polygon, "Taranis/x9r2.png", m_scrollDnAction);
act = addRadioUiAction(2, QList<int>() << Qt::Key_Enter << Qt::Key_Return, tr("ENTER/MOUSE-MID"), (rotaryOnly ? tr("Selector Press") : tr("[ ENT ]"))); act = addRadioUiAction(2, QList<int>() << Qt::Key_Enter << Qt::Key_Return, tr("ENTER/MOUSE-MID"), tr("[ ENT ]"));
polygon.setPoints(6, 63, 155, 72, 146, 90, 146, 98, 155, 88, 166, 72, 166); polygon.setPoints(6, 63, 155, 72, 146, 90, 146, 98, 155, 88, 166, 72, 166);
ui->rightbuttons->addArea(polygon, "Taranis/x9r3.png", act); ui->rightbuttons->addArea(polygon, "Taranis/x9r3.png", act);
ui->leftbuttons->addArea(90, 177, 118, 197, "Taranis/x9l4.png", m_screenshotAction); ui->leftbuttons->addArea(90, 177, 118, 197, "Taranis/x9l4.png", m_screenshotAction);
if (!rotaryOnly) m_keymapHelp.append(keymapHelp_t(tr("WHEEL/PAD SCRL"), tr("[ + ]/[ - ]")));
m_keymapHelp.append(keymapHelp_t(tr("WHEEL/PAD SCRL"), tr("[ + ]/[ - ]")));
m_backlightColors << QColor(47, 123, 227); // Taranis Blue m_backlightColors << QColor(47, 123, 227); // Taranis Blue
m_backlightColors << QColor(166,247,159); m_backlightColors << QColor(166,247,159);
@@ -21,8 +21,8 @@
#include "simulateduiwidget.h" #include "simulateduiwidget.h"
#include "ui_simulateduiwidgetX9E.h" #include "ui_simulateduiwidgetX9E.h"
SimulatedUIWidgetX9E::SimulatedUIWidgetX9E(SimulatorInterface *simulator, SimulatorDialog * simuDialog, QWidget * parent): SimulatedUIWidgetX9E::SimulatedUIWidgetX9E(SimulatorInterface *simulator, QWidget * parent):
SimulatedUIWidget(simulator, simuDialog, parent), SimulatedUIWidget(simulator, parent),
ui(new Ui::SimulatedUIWidgetX9E) ui(new Ui::SimulatedUIWidgetX9E)
{ {
RadioUiAction * act; RadioUiAction * act;
@@ -66,10 +66,19 @@ SimulatedUIWidgetX9E::SimulatedUIWidgetX9E(SimulatorInterface *simulator, Simula
setLcd(ui->lcd); setLcd(ui->lcd);
m_simuDialog->setUiAreaStyle("background-color: qlineargradient(spread:pad, x1:1, y1:0.9, x2:0, y2:0, " QString css = "#radioUiWidget {"
"stop:0 rgba(255, 255, 255, 255), " "background-color: qlineargradient(spread:pad, x1:1, y1:0.9, x2:0, y2:0,"
"stop:0.35 rgba(250, 250, 250, 255), stop:0.5 rgba(242, 241, 241, 255), " "stop:0 rgba(255, 255, 255, 255),"
"stop:0.61 rgba(241, 241, 241, 255), stop:1.0 rgba(251, 251, 251, 255));"); "stop:0.35 rgba(250, 250, 250, 255), stop:0.5 rgba(242, 241, 241, 255),"
"stop:0.61 rgba(241, 241, 241, 255), stop:1.0 rgba(251, 251, 251, 255));"
"}";
QTimer * tim = new QTimer(this);
tim->setSingleShot(true);
connect(tim, &QTimer::timeout, [this, css]() {
emit customStyleRequest(css);
});
tim->start(100);
} }
SimulatedUIWidgetX9E::~SimulatedUIWidgetX9E() SimulatedUIWidgetX9E::~SimulatedUIWidgetX9E()
+18 -8
View File
@@ -103,6 +103,8 @@ SimulatorDialog::SimulatorDialog(QWidget * parent, SimulatorInterface *simulator
radioUiWidget->setFocusPolicy(Qt::WheelFocus); radioUiWidget->setFocusPolicy(Qt::WheelFocus);
radioUiWidget->setFocus(); radioUiWidget->setFocus();
connect(radioUiWidget, &SimulatedUIWidget::customStyleRequest, this, &SimulatorDialog::setUiAreaStyle);
vJoyLeft = new VirtualJoystickWidget(this, 'L'); vJoyLeft = new VirtualJoystickWidget(this, 'L');
ui->leftStickLayout->addWidget(vJoyLeft); ui->leftStickLayout->addWidget(vJoyLeft);
@@ -184,6 +186,7 @@ bool SimulatorDialog::setStartupData(const QByteArray & dataSource, bool fromFil
RadioData simuData; RadioData simuData;
quint16 ret = 1; quint16 ret = 1;
QString error; QString error;
QString fileName(dataSource);
// If <dataSource> is blank but we have a data path, use that for individual radio/model files. // If <dataSource> is blank but we have a data path, use that for individual radio/model files.
if (dataSource.isEmpty() && !radioDataPath.isEmpty()) { if (dataSource.isEmpty() && !radioDataPath.isEmpty()) {
@@ -192,19 +195,20 @@ bool SimulatorDialog::setStartupData(const QByteArray & dataSource, bool fromFil
// to avoid hard-coding paths like "RADIO" here. E.g. did it fail due to no data at all, or corrupt data, or...? // to avoid hard-coding paths like "RADIO" here. E.g. did it fail due to no data at all, or corrupt data, or...?
if (QDir(QString(radioDataPath).append("/RADIO")).exists()) { if (QDir(QString(radioDataPath).append("/RADIO")).exists()) {
SdcardFormat sdcard(radioDataPath); SdcardFormat sdcard(radioDataPath);
if (!(ret = sdcard.load(simuData))) if (!(ret = sdcard.load(simuData))) {
error = sdcard.error(); error = sdcard.error();
}
} }
} }
// Supposedly we're being given a file name to use, try that out. // Supposedly we're being given a file name to use, try that out.
else if (fromFile && !dataSource.isEmpty()) { else if (fromFile && !fileName.isEmpty()) {
Storage store = Storage(QString(dataSource)); Storage store = Storage(fileName);
ret = store.load(simuData); ret = store.load(simuData);
if (!ret && QFile(QString(dataSource)).exists()) { if (!ret && QFile(fileName).exists()) {
error = store.error(); error = store.error();
} }
else { else {
if (QString(dataSource).endsWith(".otx", Qt::CaseInsensitive)) { if (fileName.endsWith(".otx", Qt::CaseInsensitive)) {
// no radios can work with .otx files directly, so we load contents into either // no radios can work with .otx files directly, so we load contents into either
// a temporary folder (Horus) or local data array (other radios) which we'll save back to .otx upon exit // a temporary folder (Horus) or local data array (other radios) which we'll save back to .otx upon exit
if ((ret = setRadioData(&simuData))) { if ((ret = setRadioData(&simuData))) {
@@ -254,8 +258,9 @@ bool SimulatorDialog::setRadioData(RadioData * radioData)
if (ret) { if (ret) {
if (radioDataPath.isEmpty()) { if (radioDataPath.isEmpty()) {
startupData.fill(0, getEEpromSize(m_board)); startupData.fill(0, getEEpromSize(m_board));
if (firmware->getEEpromInterface()->save((uint8_t *)startupData.data(), *radioData, 0, firmware->getCapability(SimulatorVariant)) <= 0) if (firmware->getEEpromInterface()->save((uint8_t *)startupData.data(), *radioData, 0, firmware->getCapability(SimulatorVariant)) <= 0) {
ret = false; ret = false;
}
} }
else { else {
ret = saveRadioData(radioData, radioDataPath); ret = saveRadioData(radioData, radioDataPath);
@@ -271,7 +276,9 @@ bool SimulatorDialog::setRadioData(RadioData * radioData)
bool SimulatorDialog::setOptions(SimulatorOptions & options, bool withSave) bool SimulatorDialog::setOptions(SimulatorOptions & options, bool withSave)
{ {
bool ret = false; bool ret = false;
setSdPath(options.sdPath); setSdPath(options.sdPath);
if (options.startupDataType == SimulatorOptions::START_WITH_FOLDER && !options.dataFolder.isEmpty()) { if (options.startupDataType == SimulatorOptions::START_WITH_FOLDER && !options.dataFolder.isEmpty()) {
setDataPath(options.dataFolder); setDataPath(options.dataFolder);
ret = setStartupData(); ret = setStartupData();
@@ -299,6 +306,7 @@ bool SimulatorDialog::saveRadioData(RadioData * radioData, const QString & path,
QString dir = path; QString dir = path;
if (dir.isEmpty()) if (dir.isEmpty())
dir = radioDataPath; dir = radioDataPath;
if (radioData && !dir.isEmpty()) { if (radioData && !dir.isEmpty()) {
SdcardFormat sdcard(dir); SdcardFormat sdcard(dir);
bool ret = sdcard.write(*radioData); bool ret = sdcard.write(*radioData);
@@ -306,6 +314,7 @@ bool SimulatorDialog::saveRadioData(RadioData * radioData, const QString & path,
*error = sdcard.error(); *error = sdcard.error();
return ret; return ret;
} }
return false; return false;
} }
@@ -359,8 +368,9 @@ bool SimulatorDialog::saveTempData()
} }
else { else {
SdcardFormat sdcard(radioDataPath); SdcardFormat sdcard(radioDataPath);
if (!(ret = sdcard.load(radioData))) if (!(ret = sdcard.load(radioData))) {
error = sdcard.error(); error = sdcard.error();
}
} }
if (ret) { if (ret) {
Storage store(file); Storage store(file);
@@ -400,7 +410,7 @@ void SimulatorDialog::saveState()
void SimulatorDialog::setUiAreaStyle(const QString & style) void SimulatorDialog::setUiAreaStyle(const QString & style)
{ {
ui->radioUiWidget->setStyleSheet(style); setStyleSheet(style);
} }
void SimulatorDialog::captureScreenshot(bool) void SimulatorDialog::captureScreenshot(bool)
+1
View File
@@ -270,6 +270,7 @@ int main(int argc, char *argv[])
int finish(int exitCode) int finish(int exitCode)
{ {
qDebug() << "SIMULATOR EXIT" << exitCode;
unregisterSimulators(); unregisterSimulators();
unregisterOpenTxFirmwares(); unregisterOpenTxFirmwares();