[Companion] MdiChild now use a QTreeWidget instead of a QListWidget (… (#4096)

* [Companion] MdiChild now use a QTreeWidget instead of a QListWidget (for Horus compatibility)

* [Companion] Horus models.txt parsing / writing implemented

* Fix for QT53 (#4109)
This commit is contained in:
Bertrand Songis
2016-12-08 21:26:08 +01:00
committed by GitHub
parent dd77670007
commit ec56d2dbdb
15 changed files with 443 additions and 385 deletions
+9 -24
View File
@@ -33,8 +33,6 @@
#include "wizarddialog.h"
#include "flashfirmwaredialog.h"
#include "storage_eeprom.h"
#include "storage_sdcard.h"
#include <QFileInfo>
#if defined WIN32 || !defined __GNUC__
#include <windows.h>
@@ -45,19 +43,19 @@
MdiChild::MdiChild():
QWidget(),
ui(new Ui::mdiChild),
ui(new Ui::MdiChild),
firmware(GetCurrentFirmware()),
isUntitled(true),
fileChanged(false)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("open.png"));
ui->SimulateTxButton->setIcon(CompanionIcon("simulate.png"));
ui->simulateButton->setIcon(CompanionIcon("simulate.png"));
setAttribute(Qt::WA_DeleteOnClose);
eepromInterfaceChanged();
if (!(this->isMaximized() || this->isMinimized())) {
if (!(isMaximized() || isMinimized())) {
adjustSize();
}
}
@@ -67,27 +65,14 @@ MdiChild::~MdiChild()
delete ui;
}
void MdiChild::qSleep(int ms)
{
if (ms<0)
return;
#if defined WIN32 || !defined __GNUC__
Sleep(uint(ms));
#else
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
nanosleep(&ts, NULL);
#endif
}
void MdiChild::eepromInterfaceChanged()
{
ui->modelsList->refreshList();
if (GetCurrentFirmware()->getBoard() == BOARD_HORUS && !HORUS_READY_FOR_RELEASE()) {
ui->SimulateTxButton->setEnabled(false);
}
ui->simulateButton->setEnabled(false);
}
else {
ui->SimulateTxButton->setEnabled(GetCurrentFirmware()->getCapability(Simulation));
ui->simulateButton->setEnabled(GetCurrentFirmware()->getCapability(Simulation));
}
updateTitle();
}
@@ -133,7 +118,7 @@ void MdiChild::setModified()
documentWasModified();
}
void MdiChild::on_SimulateTxButton_clicked()
void MdiChild::on_simulateButton_clicked()
{
startSimulation(this, radioData, -1);
}
@@ -158,7 +143,7 @@ void MdiChild::modelEdit()
{
int row = getCurrentRow();
if (row == 0){
if (row == 0) {
generalEdit();
}
else {