1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 00:35:18 +03:00

Projectkk2glider/companion archive support (#4017)

* Files moved to thirdparty directory
* Miniz library added
* Unused simulators removed: er9x, th9x, ersky9x
* Example of opening archive file .eepe2 (File->Open)
* File reorganization, bunch of files moved to storage directory
* Added StorageSdcard class to handle storage for radios that use SD card to store radio settings and models
This commit is contained in:
Damjan Adamic 2016-11-16 13:05:57 +01:00 committed by Bertrand Songis
parent fb27acf286
commit 60524f77f0
61 changed files with 5614 additions and 1104 deletions

View file

@ -69,6 +69,7 @@
#include "process_sync.h"
#include "radiointerface.h"
#include "progressdialog.h"
#include "storage_sdcard.h"
#define OPENTX_COMPANION_DOWNLOADS "http://downloads-22.open-tx.org/companion"
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
@ -576,22 +577,29 @@ void MainWindow::openDocURL()
void MainWindow::openFile()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Models and Settings file"), g.eepromDir(), tr(EEPROM_FILES_FILTER));
if (!fileName.isEmpty()) {
g.eepromDir(QFileInfo(fileName).dir().absolutePath());
QString fileFilter;
if (GetCurrentFirmware()->getBoard() == BOARD_HORUS) {
fileFilter = tr(OTX_FILES_FILTER);
}
else {
fileFilter = tr(EEPROM_FILES_FILTER);
}
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Models and Settings file"), g.eepromDir(), fileFilter);
if (!fileName.isEmpty()) {
g.eepromDir(QFileInfo(fileName).dir().absolutePath());
QMdiSubWindow *existing = findMdiChild(fileName);
if (existing) {
mdiArea->setActiveSubWindow(existing);
return;
}
MdiChild *child = createMdiChild();
if (child->loadFile(fileName)) {
statusBar()->showMessage(tr("File loaded"), 2000);
child->show();
}
QMdiSubWindow *existing = findMdiChild(fileName);
if (existing) {
mdiArea->setActiveSubWindow(existing);
return;
}
MdiChild *child = createMdiChild();
if (child->loadFile(fileName)) {
statusBar()->showMessage(tr("File loaded"), 2000);
child->show();
}
}
}
void MainWindow::save()
@ -764,6 +772,46 @@ void MainWindow::loadBackup()
void MainWindow::readEeprom()
{
if(GetCurrentFirmware()->getBoard()== BOARD_HORUS) {
// just an example
QString path = findMassstoragePath("RADIO");
if (path.isEmpty()) {
qDebug() << "Horus card not found";
return;
}
QString realPath = path.remove(path.size()- 5, 5);
qDebug() << "Reading files from" << realPath;
StorageSdcard storage;
storage.read(realPath);
// display models.txt
QString modelList = QString(storage.modelList);
qDebug() << "Models: size" << modelList.size() << "contents" << modelList;
// info about radio.bin
qDebug() << "Radio settings:" << storage.radio.size();
// info about all models
QList<QString> models = storage.getModelsFileNames();
qDebug() << "We have" << models.size() << "models:";
foreach(QString filename, models) {
QList<ModelFile>::const_iterator i = storage.getModelIterator(filename);
if (i != storage.models.end()) {
qDebug() << "\tModel:" << i->filename << "size" << i->data.size();
}
}
for (QList<ModelFile>::iterator i = storage.models.begin(); i != storage.models.end(); ++i) {
}
// for test immediately save to current dir
storage.write("./");
}
else {
QString tempFile;
EEPROMInterface *eepromInterface = GetEepromInterface();
@ -782,6 +830,7 @@ void MainWindow::readEeprom()
child->show();
qunlink(tempFile);
}
}
}
bool MainWindow::readFirmwareFromRadio(const QString &filename)
@ -922,7 +971,7 @@ void MainWindow::updateMenus()
bool hasMdiChild = (activeMdiChild() != 0);
bool hasSelection = (activeMdiChild() && activeMdiChild()->hasSelection());
if(GetCurrentFirmware()->getBoard() == BOARD_HORUS) {
if(false /*GetCurrentFirmware()->getBoard() == BOARD_HORUS*/) {
newAct->setEnabled(false);
openAct->setEnabled(false);
saveAct->setEnabled(false);