mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
[Companion] New fixes:
* New signal MainWindow::FirmwareChanged * New RadioData conversions introduced
This commit is contained in:
parent
173d5aba06
commit
b84398bcc7
7 changed files with 109 additions and 95 deletions
|
@ -113,6 +113,7 @@ add_subdirectory(thirdparty/qxtcommandoptions)
|
||||||
|
|
||||||
set(common_SRCS
|
set(common_SRCS
|
||||||
eeprominterface.cpp
|
eeprominterface.cpp
|
||||||
|
radiodata.cpp
|
||||||
firmwares/er9x/er9xeeprom.cpp
|
firmwares/er9x/er9xeeprom.cpp
|
||||||
firmwares/er9x/er9xinterface.cpp
|
firmwares/er9x/er9xinterface.cpp
|
||||||
firmwares/ersky9x/ersky9xeeprom.cpp
|
firmwares/ersky9x/ersky9xeeprom.cpp
|
||||||
|
|
|
@ -611,48 +611,38 @@ void MainWindow::openRecentFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadProfile() //TODO Load all variables - Also HW!
|
void MainWindow::loadProfile() // TODO Load all variables - Also HW!
|
||||||
{
|
{
|
||||||
QAction *action = qobject_cast<QAction *>(sender());
|
QAction * action = qobject_cast<QAction *>(sender());
|
||||||
|
if (action) {
|
||||||
if (action) {
|
// Set the new profile number
|
||||||
// Set the new profile number
|
int profnum = action->data().toInt();
|
||||||
int profnum=action->data().toInt();
|
g.id(profnum);
|
||||||
g.id( profnum );
|
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());
|
||||||
|
emit FirmwareChanged();
|
||||||
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());
|
updateMenus();
|
||||||
|
}
|
||||||
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
|
|
||||||
MdiChild *mdiChild = qobject_cast<MdiChild *>(window->widget());
|
|
||||||
mdiChild->eepromInterfaceChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateMenus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::appPrefs()
|
void MainWindow::appPrefs()
|
||||||
{
|
{
|
||||||
AppPreferencesDialog *pd = new AppPreferencesDialog(this);
|
AppPreferencesDialog * dialog = new AppPreferencesDialog(this);
|
||||||
pd->exec();
|
dialog->exec();
|
||||||
updateMenus();
|
updateMenus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::fwPrefs()
|
void MainWindow::fwPrefs()
|
||||||
{
|
{
|
||||||
FirmwarePreferencesDialog *pd = new FirmwarePreferencesDialog(this);
|
FirmwarePreferencesDialog * dialog = new FirmwarePreferencesDialog(this);
|
||||||
pd->exec();
|
dialog->exec();
|
||||||
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
|
emit FirmwareChanged();
|
||||||
MdiChild *mdiChild = qobject_cast<MdiChild *>(window->widget());
|
updateMenus();
|
||||||
mdiChild->eepromInterfaceChanged();
|
|
||||||
}
|
|
||||||
updateMenus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::contributors()
|
void MainWindow::contributors()
|
||||||
{
|
{
|
||||||
ContributorsDialog * dialog = new ContributorsDialog(this);
|
ContributorsDialog * dialog = new ContributorsDialog(this);
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::sdsync()
|
void MainWindow::sdsync()
|
||||||
|
@ -785,16 +775,6 @@ bool MainWindow::readFirmwareFromRadio(const QString &filename)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::writeFirmwareToRadio(const QString &filename)
|
|
||||||
{
|
|
||||||
ProgressDialog progressDialog(this, tr("Write Firmware to Radio"), CompanionIcon("write_flash.png"));
|
|
||||||
bool result = writeFirmware(filename, progressDialog.progress());
|
|
||||||
if (!result) {
|
|
||||||
progressDialog.exec();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MainWindow::readEepromFromRadio(const QString &filename)
|
bool MainWindow::readEepromFromRadio(const QString &filename)
|
||||||
{
|
{
|
||||||
ProgressDialog progressDialog(this, tr("Read Models and Settings from Radio"), CompanionIcon("read_eeprom.png"));
|
ProgressDialog progressDialog(this, tr("Read Models and Settings from Radio"), CompanionIcon("read_eeprom.png"));
|
||||||
|
@ -805,16 +785,6 @@ bool MainWindow::readEepromFromRadio(const QString &filename)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::writeEepromToRadio(const QString &filename)
|
|
||||||
{
|
|
||||||
ProgressDialog progressDialog(this, tr("Write Models and Settings to Radio"), CompanionIcon("write_eeprom.png"));
|
|
||||||
bool result = ::writeEeprom(filename, progressDialog.progress());
|
|
||||||
if (!result) {
|
|
||||||
progressDialog.exec();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::writeBackup()
|
void MainWindow::writeBackup()
|
||||||
{
|
{
|
||||||
FlashEEpromDialog *cd = new FlashEEpromDialog(this);
|
FlashEEpromDialog *cd = new FlashEEpromDialog(this);
|
||||||
|
@ -823,8 +793,8 @@ void MainWindow::writeBackup()
|
||||||
|
|
||||||
void MainWindow::writeFlash(QString fileToFlash)
|
void MainWindow::writeFlash(QString fileToFlash)
|
||||||
{
|
{
|
||||||
FlashFirmwareDialog *cd = new FlashFirmwareDialog(this);
|
FlashFirmwareDialog * cd = new FlashFirmwareDialog(this);
|
||||||
cd->exec();
|
cd->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::readBackup()
|
void MainWindow::readBackup()
|
||||||
|
@ -929,9 +899,9 @@ void MainWindow::updateMenus()
|
||||||
setWindowTitle(tr("OpenTX Companion %1 - Radio: %2 - Profile: %3").arg(VERSION).arg(GetCurrentFirmware()->getName()).arg(g.profile[g.id()].name()));
|
setWindowTitle(tr("OpenTX Companion %1 - Radio: %2 - Profile: %3").arg(VERSION).arg(GetCurrentFirmware()->getName()).arg(g.profile[g.id()].name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MdiChild *MainWindow::createMdiChild()
|
MdiChild * MainWindow::createMdiChild()
|
||||||
{
|
{
|
||||||
MdiChild * child = new MdiChild();
|
MdiChild * child = new MdiChild(this);
|
||||||
mdiArea->addSubWindow(child);
|
mdiArea->addSubWindow(child);
|
||||||
if (!child->parentWidget()->isMaximized() && !child->parentWidget()->isMinimized()) {
|
if (!child->parentWidget()->isMaximized() && !child->parentWidget()->isMinimized()) {
|
||||||
child->parentWidget()->resize(400, 400);
|
child->parentWidget()->resize(400, 400);
|
||||||
|
|
|
@ -52,6 +52,9 @@ class MainWindow : public QMainWindow
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void FirmwareChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString getCompanionUpdateBaseUrl();
|
QString getCompanionUpdateBaseUrl();
|
||||||
|
@ -73,13 +76,9 @@ class MainWindow : public QMainWindow
|
||||||
void setFILanguage() { setLanguage("fi_FI"); };
|
void setFILanguage() { setLanguage("fi_FI"); };
|
||||||
void setFRLanguage() { setLanguage("fr_FR"); };
|
void setFRLanguage() { setLanguage("fr_FR"); };
|
||||||
void setITLanguage() { setLanguage("it_IT"); };
|
void setITLanguage() { setLanguage("it_IT"); };
|
||||||
void setHELanguage() { setLanguage("he_IL"); };
|
|
||||||
void setPLLanguage() { setLanguage("pl_PL"); };
|
void setPLLanguage() { setLanguage("pl_PL"); };
|
||||||
void setESLanguage() { setLanguage("es_ES"); };
|
void setESLanguage() { setLanguage("es_ES"); };
|
||||||
void setPTLanguage() { setLanguage("pt_PT"); };
|
|
||||||
void setRULanguage() { setLanguage("ru_RU"); };
|
|
||||||
void setSELanguage() { setLanguage("sv_SE"); };
|
void setSELanguage() { setLanguage("sv_SE"); };
|
||||||
void setNLLanguage() { setLanguage("nl_NL"); };
|
|
||||||
void setCNLanguage() { setLanguage("zh_CN"); };
|
void setCNLanguage() { setLanguage("zh_CN"); };
|
||||||
|
|
||||||
void setTheme(int index);
|
void setTheme(int index);
|
||||||
|
@ -139,7 +138,7 @@ class MainWindow : public QMainWindow
|
||||||
void fwPrefs();
|
void fwPrefs();
|
||||||
void updateMenus();
|
void updateMenus();
|
||||||
void createProfile();
|
void createProfile();
|
||||||
MdiChild *createMdiChild();
|
MdiChild * createMdiChild();
|
||||||
void setActiveSubWindow(QWidget *window);
|
void setActiveSubWindow(QWidget *window);
|
||||||
QMenu * createRecentFileMenu();
|
QMenu * createRecentFileMenu();
|
||||||
QMenu * createProfilesMenu();
|
QMenu * createProfilesMenu();
|
||||||
|
@ -164,18 +163,13 @@ class MainWindow : public QMainWindow
|
||||||
void updateLanguageActions();
|
void updateLanguageActions();
|
||||||
void updateIconThemeActions();
|
void updateIconThemeActions();
|
||||||
|
|
||||||
QString Theme;
|
|
||||||
QString ISize;
|
|
||||||
QString strippedName(const QString & fullFileName);
|
QString strippedName(const QString & fullFileName);
|
||||||
|
|
||||||
MdiChild *activeMdiChild();
|
MdiChild * activeMdiChild();
|
||||||
QMdiSubWindow *findMdiChild(const QString & fileName);
|
QMdiSubWindow * findMdiChild(const QString & fileName);
|
||||||
int getEpromVersion(QString fileName);
|
|
||||||
|
|
||||||
bool readEepromFromRadio(const QString & filename);
|
bool readEepromFromRadio(const QString & filename);
|
||||||
bool writeEepromToRadio(const QString & filename);
|
|
||||||
bool readFirmwareFromRadio(const QString & filename);
|
bool readFirmwareFromRadio(const QString & filename);
|
||||||
bool writeFirmwareToRadio(const QString & filename);
|
|
||||||
|
|
||||||
QMdiArea *mdiArea;
|
QMdiArea *mdiArea;
|
||||||
QSignalMapper *windowMapper;
|
QSignalMapper *windowMapper;
|
||||||
|
@ -198,7 +192,6 @@ class MainWindow : public QMainWindow
|
||||||
QToolBar *helpToolBar;
|
QToolBar *helpToolBar;
|
||||||
QAction *newAct;
|
QAction *newAct;
|
||||||
QAction *openAct;
|
QAction *openAct;
|
||||||
QAction *recentAct;
|
|
||||||
QAction *saveAct;
|
QAction *saveAct;
|
||||||
QAction *saveAsAct;
|
QAction *saveAsAct;
|
||||||
QAction *exitAct;
|
QAction *exitAct;
|
||||||
|
@ -249,13 +242,9 @@ class MainWindow : public QMainWindow
|
||||||
QAction *finnishLangAct;
|
QAction *finnishLangAct;
|
||||||
QAction *frenchLangAct;
|
QAction *frenchLangAct;
|
||||||
QAction *italianLangAct;
|
QAction *italianLangAct;
|
||||||
// QAction *hebrewLangAct;
|
|
||||||
QAction *polishLangAct;
|
QAction *polishLangAct;
|
||||||
// QAction *portugueseLangAct;
|
|
||||||
QAction *spanishLangAct;
|
QAction *spanishLangAct;
|
||||||
QAction *swedishLangAct;
|
QAction *swedishLangAct;
|
||||||
// QAction *russianLangAct;
|
|
||||||
// QAction *dutchLangAct;
|
|
||||||
QAction *chineseLangAct;
|
QAction *chineseLangAct;
|
||||||
|
|
||||||
QAction *openDocURLAct;
|
QAction *openDocURLAct;
|
||||||
|
|
|
@ -39,15 +39,13 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MdiChild::MdiChild():
|
MdiChild::MdiChild(MainWindow * parent):
|
||||||
QWidget(),
|
QWidget(),
|
||||||
ui(new Ui::MdiChild),
|
ui(new Ui::MdiChild),
|
||||||
firmware(GetCurrentFirmware()),
|
firmware(GetCurrentFirmware()),
|
||||||
isUntitled(true),
|
isUntitled(true),
|
||||||
fileChanged(false)
|
fileChanged(false)
|
||||||
{
|
{
|
||||||
BoardEnum board = GetCurrentFirmware()->getBoard();
|
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowIcon(CompanionIcon("open.png"));
|
setWindowIcon(CompanionIcon("open.png"));
|
||||||
|
|
||||||
|
@ -56,7 +54,9 @@ MdiChild::MdiChild():
|
||||||
ui->simulateButton->setIcon(CompanionIcon("simulate.png"));
|
ui->simulateButton->setIcon(CompanionIcon("simulate.png"));
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
eepromInterfaceChanged();
|
onFirmwareChanged();
|
||||||
|
|
||||||
|
connect(parent, SIGNAL(FirmwareChanged()), this, SLOT(onFirmwareChanged()));
|
||||||
|
|
||||||
connect(ui->modelsList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openModelEditWindow()));
|
connect(ui->modelsList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openModelEditWindow()));
|
||||||
connect(ui->modelsList, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showModelsListContextMenu(const QPoint &)));
|
connect(ui->modelsList, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showModelsListContextMenu(const QPoint &)));
|
||||||
|
@ -70,14 +70,6 @@ MdiChild::MdiChild():
|
||||||
// ui->modelsList->setDragDropOverwriteMode(true);
|
// ui->modelsList->setDragDropOverwriteMode(true);
|
||||||
// ui->modelsList->setDropIndicatorShown(true);
|
// ui->modelsList->setDropIndicatorShown(true);
|
||||||
|
|
||||||
if (IS_HORUS(board)) {
|
|
||||||
ui->modelsList->header()->hide();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ui->modelsList->setIndentation(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!(isMaximized() || isMinimized())) {
|
if (!(isMaximized() || isMinimized())) {
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
@ -94,7 +86,7 @@ void MdiChild::refresh(bool expand)
|
||||||
if (1 || expand) {
|
if (1 || expand) {
|
||||||
ui->modelsList->expandAll();
|
ui->modelsList->expandAll();
|
||||||
}
|
}
|
||||||
ui->simulateButton->setEnabled(GetCurrentFirmware()->getCapability(Simulation));
|
ui->simulateButton->setEnabled(firmware->getCapability(Simulation));
|
||||||
updateTitle();
|
updateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +139,7 @@ void MdiChild::showModelsListContextMenu(const QPoint & pos)
|
||||||
contextMenu.addSeparator();
|
contextMenu.addSeparator();
|
||||||
contextMenu.addAction(CompanionIcon("simulate.png"), tr("&Simulate model"), this, SLOT(modelSimulate()), tr("Alt+S"));
|
contextMenu.addAction(CompanionIcon("simulate.png"), tr("&Simulate model"), this, SLOT(modelSimulate()), tr("Alt+S"));
|
||||||
}
|
}
|
||||||
else if (IS_HORUS(GetCurrentFirmware()->getBoard())) {
|
else if (IS_HORUS(firmware->getBoard())) {
|
||||||
if (modelsListModel->getCategoryIndex(modelIndex) >= 0) {
|
if (modelsListModel->getCategoryIndex(modelIndex) >= 0) {
|
||||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add model"), this, SLOT(modelAdd()));
|
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add model"), this, SLOT(modelAdd()));
|
||||||
}
|
}
|
||||||
|
@ -162,8 +154,19 @@ void MdiChild::showModelsListContextMenu(const QPoint & pos)
|
||||||
contextMenu.exec(globalPos);
|
contextMenu.exec(globalPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MdiChild::eepromInterfaceChanged()
|
void MdiChild::onFirmwareChanged()
|
||||||
{
|
{
|
||||||
|
Firmware * previous = firmware;
|
||||||
|
firmware = GetCurrentFirmware();
|
||||||
|
qDebug() << "onFirmwareChanged" << previous->getName() << "=>" << firmware->getName();
|
||||||
|
|
||||||
|
BoardEnum board = firmware->getBoard();
|
||||||
|
ui->modelsList->header()->setVisible(!IS_HORUS(board));
|
||||||
|
if (IS_HORUS(board))
|
||||||
|
ui->modelsList->resetIndentation();
|
||||||
|
else
|
||||||
|
ui->modelsList->setIndentation(0);
|
||||||
|
radioData.convert(previous, firmware);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +226,7 @@ void MdiChild::doPaste(QByteArray * gmData, int index)
|
||||||
size += sizeof(GeneralSettings);
|
size += sizeof(GeneralSettings);
|
||||||
}
|
}
|
||||||
else if (c == 'M') {
|
else if (c == 'M') {
|
||||||
if (GetCurrentFirmware()->getCapability(Models) == 0 || index < GetCurrentFirmware()->getCapability(Models)) {
|
if (firmware->getCapability(Models) == 0 || index < firmware->getCapability(Models)) {
|
||||||
// Model data
|
// Model data
|
||||||
int ret = QMessageBox::Yes;
|
int ret = QMessageBox::Yes;
|
||||||
if (!radioData.models[index].isEmpty()) {
|
if (!radioData.models[index].isEmpty()) {
|
||||||
|
@ -274,7 +277,7 @@ bool MdiChild::hasSelection() const
|
||||||
|
|
||||||
void MdiChild::updateTitle()
|
void MdiChild::updateTitle()
|
||||||
{
|
{
|
||||||
QString title = userFriendlyCurrentFile() + "[*]" + " (" + GetCurrentFirmware()->getName() + QString(")");
|
QString title = userFriendlyCurrentFile() + "[*]" + " (" + firmware->getName() + QString(")");
|
||||||
int availableEEpromSize = modelsListModel->getAvailableEEpromSize();
|
int availableEEpromSize = modelsListModel->getAvailableEEpromSize();
|
||||||
if (availableEEpromSize >= 0) {
|
if (availableEEpromSize >= 0) {
|
||||||
title += QString(" - %1 ").arg(availableEEpromSize) + tr("free bytes");
|
title += QString(" - %1 ").arg(availableEEpromSize) + tr("free bytes");
|
||||||
|
@ -327,7 +330,7 @@ void MdiChild::checkAndInitModel(int row)
|
||||||
|
|
||||||
void MdiChild::generalEdit()
|
void MdiChild::generalEdit()
|
||||||
{
|
{
|
||||||
GeneralEdit * t = new GeneralEdit(this, radioData, GetCurrentFirmware()/*firmware*/);
|
GeneralEdit * t = new GeneralEdit(this, radioData, firmware);
|
||||||
connect(t, SIGNAL(modified()), this, SLOT(setModified()));
|
connect(t, SIGNAL(modified()), this, SLOT(setModified()));
|
||||||
t->show();
|
t->show();
|
||||||
}
|
}
|
||||||
|
@ -364,7 +367,7 @@ void MdiChild::modelEdit()
|
||||||
ModelData & model = radioData.models[row];
|
ModelData & model = radioData.models[row];
|
||||||
gStopwatch.restart();
|
gStopwatch.restart();
|
||||||
gStopwatch.report("ModelEdit creation");
|
gStopwatch.report("ModelEdit creation");
|
||||||
ModelEdit * t = new ModelEdit(this, radioData, (row), GetCurrentFirmware()/*firmware*/);
|
ModelEdit * t = new ModelEdit(this, radioData, (row), firmware);
|
||||||
gStopwatch.report("ModelEdit created");
|
gStopwatch.report("ModelEdit created");
|
||||||
t->setWindowTitle(tr("Editing model %1: ").arg(row+1) + model.name);
|
t->setWindowTitle(tr("Editing model %1: ").arg(row+1) + model.name);
|
||||||
connect(t, SIGNAL(modified()), this, SLOT(setModified()));
|
connect(t, SIGNAL(modified()), this, SLOT(setModified()));
|
||||||
|
@ -581,10 +584,10 @@ void MdiChild::print(int model, const QString & filename)
|
||||||
PrintDialog * pd = NULL;
|
PrintDialog * pd = NULL;
|
||||||
|
|
||||||
if (model>=0 && !filename.isEmpty()) {
|
if (model>=0 && !filename.isEmpty()) {
|
||||||
pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, radioData.generalSettings, radioData.models[model], filename);
|
pd = new PrintDialog(this, firmware, radioData.generalSettings, radioData.models[model], filename);
|
||||||
}
|
}
|
||||||
else if (getCurrentRow()) {
|
else if (getCurrentRow()) {
|
||||||
pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, radioData.generalSettings, radioData.models[getCurrentRow()]);
|
pd = new PrintDialog(this, firmware, radioData.generalSettings, radioData.models[getCurrentRow()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pd) {
|
if (pd) {
|
||||||
|
|
|
@ -25,18 +25,20 @@
|
||||||
#include "modelslist.h"
|
#include "modelslist.h"
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MdiChild;
|
class MdiChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MdiChild : public QWidget
|
class MdiChild : public QWidget
|
||||||
{
|
{
|
||||||
friend class ModelsListWidget;
|
// friend class ModelsListWidget;
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MdiChild();
|
MdiChild(MainWindow * parent);
|
||||||
~MdiChild();
|
~MdiChild();
|
||||||
|
|
||||||
void newFile();
|
void newFile();
|
||||||
|
@ -49,7 +51,6 @@ class MdiChild : public QWidget
|
||||||
QString userFriendlyCurrentFile() const;
|
QString userFriendlyCurrentFile() const;
|
||||||
QString currentFile() const { return curFile; }
|
QString currentFile() const { return curFile; }
|
||||||
void viableModelSelected(bool viable);
|
void viableModelSelected(bool viable);
|
||||||
void eepromInterfaceChanged();
|
|
||||||
int getCurrentRow() const;
|
int getCurrentRow() const;
|
||||||
void refresh(bool expand=false);
|
void refresh(bool expand=false);
|
||||||
void keyPressEvent(QKeyEvent * event);
|
void keyPressEvent(QKeyEvent * event);
|
||||||
|
@ -65,6 +66,7 @@ class MdiChild : public QWidget
|
||||||
void on_simulateButton_clicked();
|
void on_simulateButton_clicked();
|
||||||
void on_radioSettings_clicked();
|
void on_radioSettings_clicked();
|
||||||
void setDefault();
|
void setDefault();
|
||||||
|
void onFirmwareChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showModelsListContextMenu(const QPoint & pos);
|
void showModelsListContextMenu(const QPoint & pos);
|
||||||
|
|
42
companion/src/radiodata.cpp
Normal file
42
companion/src/radiodata.cpp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) OpenTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* th9x - http://code.google.com/p/th9x
|
||||||
|
* er9x - http://code.google.com/p/er9x
|
||||||
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
|
*
|
||||||
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "radiodata.h"
|
||||||
|
#include "eeprominterface.h"
|
||||||
|
|
||||||
|
// TODO here we will move a lot of functions from eeprominterface.cpp when no merge risk
|
||||||
|
|
||||||
|
void ModelData::convert(Firmware * before, Firmware * after)
|
||||||
|
{
|
||||||
|
// Here we can add explicit conversions when moving from one board to another
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralSettings::convert(Firmware * before, Firmware * after)
|
||||||
|
{
|
||||||
|
// Here we can add explicit conversions when moving from one board to another
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioData::convert(Firmware * before, Firmware * after)
|
||||||
|
{
|
||||||
|
generalSettings.convert(before, after);
|
||||||
|
for (unsigned i=0; i<models.size(); i++) {
|
||||||
|
models[i].convert(before, after);
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,8 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
|
class Firmware;
|
||||||
|
|
||||||
enum Switches {
|
enum Switches {
|
||||||
SWITCH_NONE,
|
SWITCH_NONE,
|
||||||
|
|
||||||
|
@ -1004,7 +1006,9 @@ class ModelData {
|
||||||
ModelData();
|
ModelData();
|
||||||
ModelData(const ModelData & src);
|
ModelData(const ModelData & src);
|
||||||
ModelData & operator = (const ModelData & src);
|
ModelData & operator = (const ModelData & src);
|
||||||
|
|
||||||
|
void convert(Firmware * before, Firmware * after);
|
||||||
|
|
||||||
ExpoData * insertInput(const int idx);
|
ExpoData * insertInput(const int idx);
|
||||||
void removeInput(const int idx);
|
void removeInput(const int idx);
|
||||||
|
|
||||||
|
@ -1144,6 +1148,7 @@ class GeneralSettings {
|
||||||
};
|
};
|
||||||
|
|
||||||
GeneralSettings();
|
GeneralSettings();
|
||||||
|
void convert(Firmware * before, Firmware * after);
|
||||||
|
|
||||||
int getDefaultStick(unsigned int channel) const;
|
int getDefaultStick(unsigned int channel) const;
|
||||||
RawSource getDefaultSource(unsigned int channel) const;
|
RawSource getDefaultSource(unsigned int channel) const;
|
||||||
|
@ -1269,6 +1274,8 @@ class RadioData {
|
||||||
GeneralSettings generalSettings;
|
GeneralSettings generalSettings;
|
||||||
std::vector<CategoryData> categories;
|
std::vector<CategoryData> categories;
|
||||||
std::vector<ModelData> models;
|
std::vector<ModelData> models;
|
||||||
|
|
||||||
|
void convert(Firmware * before, Firmware * after);
|
||||||
|
|
||||||
void setCurrentModel(unsigned int index)
|
void setCurrentModel(unsigned int index)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue