mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
Another code reduction. Settings are now stored in "OpenTX/Companion",
instead of "companion/companion"
This commit is contained in:
parent
0d394ca7c6
commit
439cabe83c
35 changed files with 465 additions and 650 deletions
|
@ -83,7 +83,7 @@ burnConfigDialog::~burnConfigDialog()
|
|||
|
||||
void burnConfigDialog::getSettings()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
avrLoc = settings.value("avrdude_location", QFileInfo("avrdude.exe").absoluteFilePath()).toString();
|
||||
sambaLoc = settings.value("samba_location", QFileInfo("sam-ba.exe").absoluteFilePath()).toString();
|
||||
|
@ -137,7 +137,7 @@ void burnConfigDialog::getSettings()
|
|||
|
||||
void burnConfigDialog::putSettings()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.setValue("avrdude_location", avrLoc);
|
||||
settings.setValue("programmer", avrProgrammer);
|
||||
settings.setValue("mcu", avrMCU);
|
||||
|
@ -279,10 +279,9 @@ void burnConfigDialog::listProgrammers()
|
|||
QStringList arguments;
|
||||
arguments << "-c?";
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, ui->avrdude_location->text(), arguments, "List available programmers", AVR_DIALOG_KEEP_OPEN, TRUE);
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"list.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("list.png"));
|
||||
ad->show();
|
||||
delete ad;
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_pushButton_3_clicked()
|
||||
|
@ -298,10 +297,9 @@ void burnConfigDialog::on_pushButton_4_clicked()
|
|||
arguments << "-?";
|
||||
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, ui->avrdude_location->text(), arguments, "Show help", AVR_DIALOG_KEEP_OPEN,TRUE);
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"configure.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("configure.png"));
|
||||
ad->show();
|
||||
delete ad;
|
||||
}
|
||||
|
||||
|
||||
|
@ -317,10 +315,9 @@ void burnConfigDialog::readFuses()
|
|||
arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << str;
|
||||
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, arguments, "Read Fuses",AVR_DIALOG_KEEP_OPEN,TRUE);
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"fuses.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("fuses.png"));
|
||||
ad->show();
|
||||
delete ad;
|
||||
}
|
||||
|
||||
void burnConfigDialog::restFuses(bool eeProtect)
|
||||
|
@ -344,7 +341,8 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
|||
QString erStr = eeProtect ? "hfuse:w:0x11:m" : "hfuse:w:0x19:m";
|
||||
str << "-U" << "lfuse:w:0xD7:m" << "-U" << erStr << "-U" << "efuse:w:0xFC:m";
|
||||
//use hfuse = 0x81 to prevent eeprom being erased with every flashing
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile;
|
||||
QString lfuses;
|
||||
|
@ -352,10 +350,9 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
|||
QStringList argread;
|
||||
argread << "-c" << avrProgrammer << "-p" << avrMCU << args <<"-U" << "lfuse:r:"+tempFile+":r" ;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, argread, "Reset Fuses",AVR_DIALOG_CLOSE_IF_SUCCESSFUL,FALSE);
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"fuses.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("fuses.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
QFile file(tempFile);
|
||||
if (file.exists() && file.size()==1) {
|
||||
file.open(QIODevice::ReadOnly);
|
||||
|
@ -363,12 +360,14 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
|||
file.read(bin_flash, 1);
|
||||
if (bin_flash[0]==0x0E) {
|
||||
lfuses="lfuse:w:0x0E:m";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lfuses="lfuse:w:0x3F:m";
|
||||
}
|
||||
file.close();
|
||||
unlink(tempFile.toAscii());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lfuses="lfuse:w:0x3F:m";
|
||||
}
|
||||
|
||||
|
@ -379,14 +378,14 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
|||
QStringList arguments;
|
||||
if (avrMCU=="m2560") {
|
||||
arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << "-u" << str;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
arguments << "-c" << avrProgrammer << "-p" << avrMCU << args << "-B" << "100" << "-u" << str;
|
||||
}
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, arguments, "Reset Fuses",AVR_DIALOG_KEEP_OPEN,TRUE);
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"fuses.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("fuses.png"));
|
||||
ad->show();
|
||||
delete ad;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -398,24 +397,29 @@ void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
|
|||
if (IS_TARANIS(eepromInterface->getBoard())) {
|
||||
ui->label_dfu2->show();
|
||||
ui->dfuArgs->show();
|
||||
} else if (eepromInterface->getBoard()==BOARD_SKY9X) {
|
||||
}
|
||||
else if (eepromInterface->getBoard()==BOARD_SKY9X) {
|
||||
ui->label_sb2->show();
|
||||
ui->arm_mcu->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->label_av3->show();
|
||||
ui->avrdude_mcu->show();
|
||||
QMessageBox::warning(this, tr("Companion"),
|
||||
tr("<b><u>WARNING!</u></b><br>Normally CPU type is automatically selected according to the chosen firmware.<br>If you change the CPU type the resulting eeprom could be inconsistent."),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (IS_TARANIS(eepromInterface->getBoard())) {
|
||||
ui->label_dfu2->hide();
|
||||
ui->dfuArgs->hide();
|
||||
} else if (eepromInterface->getBoard()==BOARD_SKY9X) {
|
||||
}
|
||||
else if (eepromInterface->getBoard()==BOARD_SKY9X) {
|
||||
ui->label_sb2->hide();
|
||||
ui->arm_mcu->hide();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->label_av3->hide();
|
||||
ui->avrdude_mcu->hide();
|
||||
}
|
||||
|
|
|
@ -16,9 +16,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
hexType(Type)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QIcon LibraryIcon;
|
||||
populate_icon(&LibraryIcon,"library.png");
|
||||
ui->libraryButton->setIcon(LibraryIcon);
|
||||
ui->libraryButton->setIcon(CompanionIcon("library.png"));
|
||||
ui->SplashFrame->hide();
|
||||
ui->FramFWInfo->hide();
|
||||
ui->EEbackupCB->hide();
|
||||
|
@ -29,11 +27,12 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
ui->patchcalib_CB->hide();
|
||||
ui->patchhw_CB->hide();
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
this->setWindowTitle(tr("Write firmware to TX"));
|
||||
setWindowTitle(tr("Write firmware to TX"));
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
ui->EEbackupCB->hide();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->FlashLoadButton->setText(tr("Browse for file"));
|
||||
ui->profile_label->hide();
|
||||
ui->patchcalib_CB->hide();
|
||||
|
@ -54,11 +53,12 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
ui->BurnFlashButton->setDisabled(true);
|
||||
ui->EEbackupCB->hide();
|
||||
if (DocName.isEmpty()) {
|
||||
this->setWindowTitle(tr("Write Models and Settings to TX"));
|
||||
} else {
|
||||
this->setWindowTitle(tr("Write Models and Settings in %1 to TX").arg(DocName));
|
||||
setWindowTitle(tr("Write Models and Settings to TX"));
|
||||
}
|
||||
QSettings settings("companion", "companion");
|
||||
else {
|
||||
setWindowTitle(tr("Write Models and Settings in %1 to TX").arg(DocName));
|
||||
}
|
||||
QSettings settings;
|
||||
int profileid=settings.value("profileId", 1).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profileid);
|
||||
|
@ -72,10 +72,11 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
ui->FWFileName->setText(*hexfileName);
|
||||
if (Type==2) {
|
||||
checkFw(*hexfileName);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
burnraw=false;
|
||||
if (checkeEprom(*hexfileName)) {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int profileid=settings.value("profileId", 1).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profileid);
|
||||
|
@ -100,12 +101,14 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
if (!((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6))) {
|
||||
ui->patchhw_CB->setDisabled(true);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->profile_label->hide();
|
||||
}
|
||||
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
ui->EEpromCB->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->EEpromCB->setChecked(false);
|
||||
}
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
|
@ -116,7 +119,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
hexfileName->clear();
|
||||
}
|
||||
else if (Type==2) {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString FileName;
|
||||
FileName = settings.value("lastFw").toString();
|
||||
QFile file(FileName);
|
||||
|
@ -127,14 +130,15 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
|
|||
resize(0, 0);
|
||||
}
|
||||
|
||||
burnDialog::~burnDialog() {
|
||||
burnDialog::~burnDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void burnDialog::on_FlashLoadButton_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
ui->ImageLoadButton->setDisabled(true);
|
||||
ui->libraryButton->setDisabled(true);
|
||||
ui->InvertColorButton->setDisabled(true);
|
||||
|
@ -153,7 +157,8 @@ void burnDialog::on_FlashLoadButton_clicked()
|
|||
if (hexType==2) {
|
||||
fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER);
|
||||
checkFw(fileName);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QString fileName = QFileDialog::getOpenFileName(this,tr("Choose file to load Models and Settings from"), settings.value("lastDir").toString(), tr(EXTERNAL_EEPROM_FILES_FILTER));
|
||||
if (checkeEprom(fileName)) {
|
||||
if (burnraw==false) {
|
||||
|
@ -163,10 +168,12 @@ void burnDialog::on_FlashLoadButton_clicked()
|
|||
ui->patchhw_CB->show();
|
||||
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
ui->EEpromCB->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->EEpromCB->setChecked(false);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
ui->profile_label->hide();
|
||||
ui->patchcalib_CB->setChecked(false);
|
||||
|
@ -184,10 +191,11 @@ void burnDialog::checkFw(QString fileName)
|
|||
if (fileName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
ui->EEbackupCB->show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->EEbackupCB->setChecked(false);
|
||||
*backup=false;
|
||||
}
|
||||
|
@ -226,23 +234,27 @@ void burnDialog::checkFw(QString fileName)
|
|||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(flash.getSplashFormat())));
|
||||
ui->PatchFWCB->setEnabled(true);
|
||||
ui->PatchFWCB->setChecked(PatchFwCB);
|
||||
} else {
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
ui->PreferredImageCB->setDisabled(true);
|
||||
}
|
||||
} else {
|
||||
else {
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
ui->PreferredImageCB->setDisabled(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
else {
|
||||
ui->PatchFWCB->setDisabled(true);
|
||||
ui->PatchFWCB->setChecked(false);
|
||||
ui->PreferredImageCB->setDisabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->FwImage->hide();
|
||||
ui->ImageFileName->setText("");
|
||||
ui->SplashFrame->hide();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("%1 is not a known firmware").arg(fileName));
|
||||
ui->BurnFlashButton->setText(tr("Burn anyway !"));
|
||||
ui->BurnFlashButton->setEnabled(true);
|
||||
|
@ -270,7 +282,8 @@ bool burnDialog::checkeEprom(QString fileName)
|
|||
}
|
||||
QTextStream inputStream(&file);
|
||||
XmlInterface(inputStream).load(radioData);
|
||||
} else if (fileType==FILE_TYPE_HEX || fileType==FILE_TYPE_EEPE) { //read HEX file
|
||||
}
|
||||
else if (fileType==FILE_TYPE_HEX || fileType==FILE_TYPE_EEPE) { //read HEX file
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
|
||||
QMessageBox::critical(this, tr("Error"),tr("Error opening file %1:\n%2.").arg(fileName).arg(file.errorString()));
|
||||
return false;
|
||||
|
@ -313,7 +326,8 @@ bool burnDialog::checkeEprom(QString fileName)
|
|||
ui->FWFileName->setText(fileName);
|
||||
return true;
|
||||
}
|
||||
} else if (fileType==FILE_TYPE_BIN) { //read binary
|
||||
}
|
||||
else if (fileType==FILE_TYPE_BIN) { //read binary
|
||||
int eeprom_size = file.size();
|
||||
if (!file.open(QFile::ReadOnly)) { //reading binary file - TODO HEX support
|
||||
QMessageBox::critical(this, tr("Error"),tr("Error opening file %1:\n%2.").arg(fileName).arg(file.errorString()));
|
||||
|
@ -346,7 +360,7 @@ void burnDialog::on_ImageLoadButton_clicked()
|
|||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
|
@ -368,17 +382,16 @@ void burnDialog::on_ImageLoadButton_clicked()
|
|||
int gray;
|
||||
int width = image.width();
|
||||
int height = image.height();
|
||||
for (int i = 0; i < width; ++i)
|
||||
{
|
||||
for (int j = 0; j < height; ++j)
|
||||
{
|
||||
for (int i = 0; i < width; ++i) {
|
||||
for (int j = 0; j < height; ++j) {
|
||||
col = image.pixel(i, j);
|
||||
gray = qGray(col);
|
||||
image.setPixel(i, j, qRgb(gray, gray, gray));
|
||||
}
|
||||
}
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height())));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono)));
|
||||
}
|
||||
ui->PatchFWCB->setEnabled(true);
|
||||
|
@ -429,7 +442,7 @@ void burnDialog::on_BurnFlashButton_clicked()
|
|||
if (hexType==2) {
|
||||
QString fileName=ui->FWFileName->text();
|
||||
if (!fileName.isEmpty()) {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.setValue("lastFlashDir", QFileInfo(fileName).dir().absolutePath());
|
||||
settings.setValue("lastFw", fileName);
|
||||
if (ui->PatchFWCB->isChecked()) {
|
||||
|
@ -466,7 +479,7 @@ void burnDialog::on_BurnFlashButton_clicked()
|
|||
}
|
||||
}
|
||||
if (hexType==1) {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int profileid=settings.value("profileId", 1).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profileid);
|
||||
|
@ -643,7 +656,7 @@ void burnDialog::on_PreferredImageCB_toggled(bool checked)
|
|||
{
|
||||
QString tmpFileName;
|
||||
if (checked) {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString ImageStr = settings.value("SplashImage", "").toString();
|
||||
if (!ImageStr.isEmpty()) {
|
||||
QImage Image = qstring2image(ImageStr);
|
||||
|
|
|
@ -66,7 +66,7 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu
|
|||
}
|
||||
}
|
||||
str.append("<tr><td class=\"mycss\"> </td></tr>");
|
||||
str.append("<tr><td colspan=3 class=\"mycss\">"+tr("Honors go to Rafal Tomczak (RadioClone) and Thomas Husterer (th9x) \nof course. Also to Erez Raviv (er9x) and it's fantastic eePe, from which\ncompanion9x was forked out.")+"</td></tr>");
|
||||
str.append("<tr><td colspan=3 class=\"mycss\">"+tr("Honors go to Rafal Tomczak (RadioClone) and Thomas Husterer (th9x) \nof course. Also to Erez Raviv (er9x) and it's fantastic eePe, from which\nOpenTX Companion was forked out.")+"</td></tr>");
|
||||
str.append("<tr><td colspan=3 class=\"mycss\">"+tr("Thank you all !!!")+"</td></tr>");
|
||||
str.append("</table>");
|
||||
str.append("</body></html>");
|
||||
|
|
|
@ -8,23 +8,23 @@
|
|||
#include "flashinterface.h"
|
||||
|
||||
customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::customizeSplashDialog) {
|
||||
QDialog(parent),
|
||||
ui(new Ui::customizeSplashDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QIcon LibraryIcon;
|
||||
populate_icon(&LibraryIcon,"library.png");
|
||||
ui->libraryButton->setIcon(LibraryIcon);
|
||||
ui->libraryButton->setIcon(CompanionIcon("library.png"));
|
||||
ui->HowToLabel->clear();
|
||||
ui->HowToLabel->append("<center>" + tr("Select an original firmware file") + "</center>");
|
||||
}
|
||||
|
||||
customizeSplashDialog::~customizeSplashDialog() {
|
||||
customizeSplashDialog::~customizeSplashDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_FlashLoadButton_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER);
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->ImageLoadButton->setDisabled(true);
|
||||
|
@ -70,7 +70,7 @@ void customizeSplashDialog::on_ImageLoadButton_clicked() {
|
|||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
|
@ -147,7 +147,7 @@ void customizeSplashDialog::on_libraryButton_clicked() {
|
|||
void customizeSplashDialog::on_SaveFlashButton_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
ui->HowToLabel->clear();
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastFlashDir").toString(), FLASH_FILES_FILTER, 0, QFileDialog::DontConfirmOverwrite);
|
||||
if (fileName.isEmpty()) {
|
||||
|
@ -180,7 +180,7 @@ void customizeSplashDialog::on_InvertColorButton_clicked()
|
|||
void customizeSplashDialog::on_SaveImageButton_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Write to file"), settings.value("lastImagesDir").toString(), tr("PNG images (*.png);;"), 0, QFileDialog::DontConfirmOverwrite);
|
||||
if (!fileName.isEmpty()) {
|
||||
|
|
|
@ -438,7 +438,7 @@ GeneralSettings::GeneralSettings()
|
|||
calibSpanNeg[i] = 0x180;
|
||||
calibSpanPos[i] = 0x180;
|
||||
}
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
templateSetup = settings.value("default_channel_order", 0).toInt();
|
||||
stickMode = settings.value("default_mode", 1).toInt();
|
||||
int profile_id = settings.value("ActiveProfile", 0).toInt();
|
||||
|
@ -659,7 +659,7 @@ ModelData ModelData::removeGlobalVars()
|
|||
QList<EEPROMInterface *> eepromInterfaces;
|
||||
void RegisterEepromInterfaces()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int rev4a = settings.value("rev4asupport",0).toInt();
|
||||
eepromInterfaces.push_back(new Open9xInterface(BOARD_STOCK));
|
||||
eepromInterfaces.push_back(new Open9xInterface(BOARD_M128));
|
||||
|
|
|
@ -44,7 +44,7 @@ const char * Er9xInterface::getName()
|
|||
|
||||
const int Er9xInterface::getEEpromSize()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString avrMCU = settings.value("mcu", QString("m64")).toString();
|
||||
if (avrMCU==QString("m128")) {
|
||||
return 2*EESIZE_STOCK;
|
||||
|
|
|
@ -47,7 +47,7 @@ const char * Gruvin9xInterface::getName()
|
|||
const int Gruvin9xInterface::getEEpromSize()
|
||||
{
|
||||
if (board == BOARD_STOCK) {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString avrMCU = settings.value("mcu", QString("m64")).toString();
|
||||
if (avrMCU==QString("m128")) {
|
||||
return EESIZE_STOCK*2;
|
||||
|
|
|
@ -593,7 +593,7 @@ enum Functions {
|
|||
#endif
|
||||
FUNC_BACKLIGHT,
|
||||
#if defined(DEBUG)
|
||||
FUNC_TEST, // should remain the last before MAX as not added in companion9x
|
||||
FUNC_TEST, // should remain the last before MAX as not added in companion
|
||||
#endif
|
||||
FUNC_MAX
|
||||
};
|
||||
|
|
|
@ -135,7 +135,7 @@ using namespace Open9xSky9x;
|
|||
Open9xSky9xSimulator::Open9xSky9xSimulator(Open9xInterface * open9xInterface):
|
||||
open9xInterface(open9xInterface)
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString path=settings.value("sdPath", ".").toString()+"/";
|
||||
int i=0;
|
||||
for (i=0; i< std::min(path.length(),1022); i++) {
|
||||
|
|
|
@ -145,7 +145,7 @@ OpentxTaranisSimulator::OpentxTaranisSimulator(Open9xInterface * open9xInterface
|
|||
open9xInterface(open9xInterface)
|
||||
{
|
||||
taranisSimulatorBoard = GetEepromInterface()->getBoard();
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString path=settings.value("sdPath", ".").toString()+"/";
|
||||
int i=0;
|
||||
for (i=0; i< std::min(path.length(),1022); i++) {
|
||||
|
|
|
@ -42,14 +42,10 @@ size_t SizeOfArray( T(&)[ N ] )
|
|||
return N;
|
||||
}
|
||||
|
||||
QStringList o9xservers;
|
||||
|
||||
Open9xInterface::Open9xInterface(BoardEnum board):
|
||||
EEPROMInterface(board),
|
||||
efile(new EFile())
|
||||
{
|
||||
o9xservers.clear();
|
||||
o9xservers << "93.51.182.154" << "open9x.9xforums.com";
|
||||
}
|
||||
|
||||
Open9xInterface::~Open9xInterface()
|
||||
|
@ -309,7 +305,7 @@ bool Open9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size)
|
|||
std::cout << " wrong size (" << size << ")\n";
|
||||
return false;
|
||||
} else {
|
||||
QMessageBox::warning(NULL,"companion", QObject::tr("Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"));
|
||||
QMessageBox::warning(NULL, "companion", QObject::tr("Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"));
|
||||
size=2048;
|
||||
}
|
||||
} else {
|
||||
|
@ -944,14 +940,9 @@ bool Open9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esiz
|
|||
|
||||
QString geturl( int board)
|
||||
{
|
||||
QString url="http://";
|
||||
QSettings settings("companion", "companion");
|
||||
int server = settings.value("fwserver", 0).toInt();
|
||||
if (server >= o9xservers.count()) {
|
||||
server = 0;
|
||||
settings.setValue("fwserver",server);
|
||||
}
|
||||
url.append(o9xservers.at(server));
|
||||
QSettings settings;
|
||||
QString url = settings.value("compilation-server", OPENTX_FIRMWARE_DOWNLOADS).toString();
|
||||
|
||||
switch(board) {
|
||||
case BOARD_STOCK:
|
||||
case BOARD_M128:
|
||||
|
@ -972,27 +963,21 @@ QString geturl( int board)
|
|||
|
||||
QString getstamp( int board)
|
||||
{
|
||||
QString url="http://";
|
||||
QSettings settings("companion", "companion");
|
||||
int server = settings.value("fwserver",0).toInt();
|
||||
if (server >=o9xservers.count()) {
|
||||
server=0;
|
||||
settings.setValue("fwserver",server);
|
||||
}
|
||||
url.append(o9xservers.at(server));
|
||||
url.append("/binaries/stamp-opentx-");
|
||||
QSettings settings;
|
||||
QString url = settings.value("compilation-server", OPENTX_FIRMWARE_DOWNLOADS).toString();
|
||||
url.append("/stamp-opentx-");
|
||||
switch(board) {
|
||||
case BOARD_STOCK:
|
||||
url.append("stock.txt");
|
||||
url.append("9x.txt");
|
||||
break;
|
||||
case BOARD_M128:
|
||||
url.append("stock128.txt");
|
||||
url.append("9x128.txt");
|
||||
break;
|
||||
case BOARD_GRUVIN9X:
|
||||
url.append("v4.txt");
|
||||
url.append("gruvin9x.txt");
|
||||
break;
|
||||
case BOARD_SKY9X:
|
||||
url.append("arm.txt");
|
||||
url.append("sky9x.txt");
|
||||
break;
|
||||
case BOARD_TARANIS:
|
||||
case BOARD_TARANIS_REV4a:
|
||||
|
@ -1007,15 +992,9 @@ QString getstamp( int board)
|
|||
|
||||
QString getrnurl( int board)
|
||||
{
|
||||
QString url="http://";
|
||||
QSettings settings("companion", "companion");
|
||||
int server = settings.value("fwserver",0).toInt();
|
||||
if (server >=o9xservers.count()) {
|
||||
server=0;
|
||||
settings.setValue("fwserver",server);
|
||||
}
|
||||
url.append(o9xservers.at(server));
|
||||
url.append("/docs/releasenotes-");
|
||||
QSettings settings;
|
||||
QString url = settings.value("compilation-server", OPENTX_FIRMWARE_DOWNLOADS).toString();
|
||||
url.append("/releasenotes-");
|
||||
switch(board) {
|
||||
case BOARD_STOCK:
|
||||
case BOARD_M128:
|
||||
|
@ -1043,7 +1022,7 @@ void RegisterOpen9xFirmwares()
|
|||
Option extr_options[] = { { "frsky", QObject::tr("Support for frsky telemetry mod"), FRSKY_VARIANT }, { "jeti", QObject::tr("Support for jeti telemetry mod"), 0 }, { "ardupilot", QObject::tr("Support for receiving ardupilot data"), 0 }, { "nmea", QObject::tr("Support for receiving NMEA data"), 0 }, { "mavlink", QObject::tr("Support for MAVLINK devices"), MAVLINK_VARIANT }, { NULL } };
|
||||
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE at field") }, { "faimode", QObject::tr("FAI MODE always enabled") }, { NULL } };
|
||||
/* 9x board */
|
||||
open9x = new Open9xFirmware("opentx-stock", QObject::tr("openTx for 9X board"), new Open9xInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK), getrnurl(BOARD_STOCK), false);
|
||||
open9x = new Open9xFirmware("opentx-9x", QObject::tr("openTx for 9X board"), new Open9xInterface(BOARD_STOCK), geturl(BOARD_STOCK), getstamp(BOARD_STOCK), getrnurl(BOARD_STOCK), false);
|
||||
open9x->addOptions(ext_options);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
|
@ -1079,7 +1058,7 @@ void RegisterOpen9xFirmwares()
|
|||
firmwares.push_back(open9x);
|
||||
|
||||
/* 9x board with M128 chip */
|
||||
open9x = new Open9xFirmware("opentx-stock128", QObject::tr("openTx for M128 / 9X board"), new Open9xInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
|
||||
open9x = new Open9xFirmware("opentx-9x128", QObject::tr("openTx for M128 / 9X board"), new Open9xInterface(BOARD_M128), geturl(BOARD_M128), getstamp(BOARD_M128),getrnurl(BOARD_M128), false);
|
||||
open9x->addOptions(ext_options);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
|
@ -1175,7 +1154,7 @@ void RegisterOpen9xFirmwares()
|
|||
firmwares.push_back(open9x);
|
||||
|
||||
/* Gruvin9x board */
|
||||
open9x = new Open9xFirmware("opentx-v4", QObject::tr("openTx for Gruvin9x board / 9X"), new Open9xInterface(BOARD_GRUVIN9X), geturl(BOARD_GRUVIN9X), getstamp(BOARD_GRUVIN9X),getrnurl(BOARD_GRUVIN9X), false);
|
||||
open9x = new Open9xFirmware("opentx-gruvin9x", QObject::tr("openTx for Gruvin9x board / 9X"), new Open9xInterface(BOARD_GRUVIN9X), geturl(BOARD_GRUVIN9X), getstamp(BOARD_GRUVIN9X),getrnurl(BOARD_GRUVIN9X), false);
|
||||
open9x->setVariantBase(FRSKY_VARIANT);
|
||||
open9x->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
|
||||
open9x->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
|
||||
|
@ -1239,7 +1218,7 @@ void RegisterOpen9xFirmwares()
|
|||
open9x->addOptions(fai_options);
|
||||
firmwares.push_back(open9x);
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int rev4a = settings.value("rev4asupport",0).toInt();
|
||||
if (rev4a) {
|
||||
open9x = new Open9xFirmware("opentx-taranisrev4a", QObject::tr("openTx for FrSky Taranis Rev4a"), new Open9xInterface(BOARD_TARANIS_REV4a), geturl(BOARD_TARANIS_REV4a), getstamp(BOARD_TARANIS_REV4a),getrnurl(BOARD_TARANIS), true);
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include "eeprominterface.h"
|
||||
|
||||
#define OPENTX_COMPANION_DOWNLOADS "http://downloads.open-tx.org/companion"
|
||||
#define OPENTX_FIRMWARE_DOWNLOADS "http://downloads.open-tx.org/firmware"
|
||||
|
||||
class EFile;
|
||||
|
||||
class Open9xInterface : public EEPROMInterface
|
||||
|
@ -91,6 +94,7 @@ class Open9xFirmware: public FirmwareInfo {
|
|||
addLanguage("se");
|
||||
addLanguage("cz");
|
||||
addLanguage("es");
|
||||
addLanguage("pl");
|
||||
addLanguage("pt");
|
||||
|
||||
addTTSLanguage("en");
|
||||
|
@ -100,6 +104,7 @@ class Open9xFirmware: public FirmwareInfo {
|
|||
addTTSLanguage("se");
|
||||
addTTSLanguage("cz");
|
||||
addTTSLanguage("sk");
|
||||
addTTSLanguage("pl");
|
||||
addTTSLanguage("pt");
|
||||
addTTSLanguage("es");
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ const char * Th9xInterface::getName()
|
|||
|
||||
const int Th9xInterface::getEEpromSize()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString avrMCU = settings.value("mcu", QString("m64")).toString();
|
||||
if (avrMCU==QString("m128")) {
|
||||
return 2*EESIZE_STOCK;
|
||||
|
|
|
@ -20,7 +20,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
|||
ui->setupUi(this);
|
||||
this->setWindowIcon(QIcon(":/icon.png"));
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString();
|
||||
ui->tabWidget->setCurrentIndex(settings.value("generalEditTab", 0).toInt());
|
||||
int profile_id=settings.value("profileId", 0).toInt();
|
||||
|
@ -946,7 +946,7 @@ void GeneralEdit::on_PPM4_editingFinished()
|
|||
void GeneralEdit::on_tabWidget_currentChanged(int index)
|
||||
{
|
||||
// TODO why er9x here
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.setValue("generalEditTab",index);//ui->tabWidget->currentIndex());
|
||||
}
|
||||
|
||||
|
@ -1195,7 +1195,7 @@ void GeneralEdit::on_swGEAChkB_stateChanged(int )
|
|||
|
||||
void GeneralEdit::on_calretrieve_PB_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profile_id);
|
||||
|
@ -1312,7 +1312,7 @@ void GeneralEdit::on_calretrieve_PB_clicked()
|
|||
|
||||
void GeneralEdit::on_calstore_PB_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profile_id);
|
||||
|
|
|
@ -1485,19 +1485,10 @@ QString getCenterBeep(ModelData * g_model)
|
|||
return strl.join(", ");
|
||||
}
|
||||
|
||||
void populate_icon(QIcon *Icon, QString baseimage)
|
||||
{
|
||||
static QString usedtheme=getTheme();
|
||||
Icon->addFile(":/themes/"+usedtheme+"/16/"+baseimage,QSize(16,16));
|
||||
Icon->addFile(":/themes/"+usedtheme+"/24/"+baseimage,QSize(24,24));
|
||||
Icon->addFile(":/themes/"+usedtheme+"/32/"+baseimage,QSize(32,32));
|
||||
Icon->addFile(":/themes/"+usedtheme+"/48/"+baseimage,QSize(48,48));
|
||||
}
|
||||
|
||||
QString getTheme()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
int theme_set=settings.value("theme", 1).toInt();
|
||||
QSettings settings;
|
||||
int theme_set = settings.value("theme", 1).toInt();
|
||||
QString Theme;
|
||||
switch(theme_set) {
|
||||
case 0:
|
||||
|
@ -1509,3 +1500,13 @@ QString getTheme()
|
|||
}
|
||||
return Theme;
|
||||
}
|
||||
|
||||
CompanionIcon::CompanionIcon(QString baseimage)
|
||||
{
|
||||
static QString theme = getTheme();
|
||||
addFile(":/themes/"+theme+"/16/"+baseimage, QSize(16,16));
|
||||
addFile(":/themes/"+theme+"/24/"+baseimage, QSize(24,24));
|
||||
addFile(":/themes/"+theme+"/32/"+baseimage, QSize(32,32));
|
||||
addFile(":/themes/"+theme+"/48/"+baseimage, QSize(48,48));
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,14 @@ void populateVoiceLangCB(QComboBox *b, QString language);
|
|||
void populateTTraceCB(QComboBox *b, int value);
|
||||
void populateRotEncCB(QComboBox *b, int value, int renumber);
|
||||
void populateBacklightCB(QComboBox *b, const uint8_t value);
|
||||
void populate_icon(QIcon *Icon, QString baseimage);
|
||||
|
||||
QString getTheme();
|
||||
|
||||
class CompanionIcon: public QIcon {
|
||||
public:
|
||||
CompanionIcon(QString baseimage);
|
||||
};
|
||||
|
||||
class GVarGroup : public QObject {
|
||||
|
||||
Q_OBJECT
|
||||
|
|
|
@ -130,7 +130,7 @@ void joystickDialog::on_okButton_clicked() {
|
|||
return;
|
||||
}
|
||||
joystick->close();
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.beginGroup("JsCalibration");
|
||||
for (int i=0; i<8;i++) {
|
||||
settings.remove(QString("stick%1_axe").arg(i));
|
||||
|
|
|
@ -58,7 +58,7 @@ class lcdWidget : public QWidget {
|
|||
QPixmap buffer(2*lcdWidth, 2*lcdHeight);
|
||||
QPainter p(&buffer);
|
||||
doPaint(p);
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
bool toclipboard=settings.value("snapshot_to_clipboard", false).toBool();
|
||||
QApplication::clipboard()->setPixmap( buffer );
|
||||
if (!toclipboard) {
|
||||
|
|
|
@ -38,7 +38,7 @@ logsDialog::logsDialog(QWidget *parent) :
|
|||
ui->customPlot->legend->setSelectedFont(legendFont);
|
||||
ui->customPlot->legend->setSelectable(QCPLegend::spItems); // legend box shall not be selectable, only legend items
|
||||
ui->customPlot->legend->setVisible(false);
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString Path=settings.value("gePath", "").toString();
|
||||
if (Path.isEmpty() || !QFile(Path).exists()) {
|
||||
ui->mapsButton->hide();
|
||||
|
@ -202,7 +202,7 @@ void logsDialog::on_mapsButton_clicked() {
|
|||
,F_F,F_F,F_F,F_F,I_F,I_F,I_F,I_F\
|
||||
,I_F,I_F,I_F,I_F,I_F,I_F,I_F,I_F,I_F,I_F,I_F,I_F};
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString gePath=settings.value("gePath", "").toString();
|
||||
if (gePath.isEmpty() || !QFile(gePath).exists()) {
|
||||
ui->FieldsTW->setDisabled(false);
|
||||
|
@ -578,7 +578,7 @@ void logsDialog::moveLegend()
|
|||
|
||||
void logsDialog::on_fileOpen_BT_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this,tr("Select your log file"), settings.value("lastLogDir").toString());
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastLogDir", fileName);
|
||||
|
|
|
@ -76,14 +76,18 @@ class MyProxyStyle : public QProxyStyle
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setOrganizationName("OpenTX");
|
||||
QCoreApplication::setOrganizationDomain("open-tx.org");
|
||||
QCoreApplication::setApplicationName("Companion");
|
||||
|
||||
// Start by borrowing any left over settings from companion9x
|
||||
QSettings c9x_settings("companion9x", "companion9x");
|
||||
QSettings com_settings("companion", "companion");
|
||||
if (!com_settings.contains("pos")) {
|
||||
QSettings settings;
|
||||
|
||||
if (!settings.contains("pos")) {
|
||||
QStringList keys = c9x_settings.allKeys();
|
||||
for( QStringList::iterator i = keys.begin(); i != keys.end(); i++ )
|
||||
{
|
||||
com_settings.setValue( *i, c9x_settings.value( *i ) );
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++) {
|
||||
settings.setValue(*i, c9x_settings.value(*i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,10 +97,10 @@ int main(int argc, char *argv[])
|
|||
#ifdef __APPLE__
|
||||
app.setStyle(new MyProxyStyle);
|
||||
#endif
|
||||
QString dir;
|
||||
if(argc) dir = QFileInfo(argv[0]).canonicalPath() + "/lang";
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QString dir;
|
||||
if (argc) dir = QFileInfo(argv[0]).canonicalPath() + "/lang";
|
||||
|
||||
QString locale = settings.value("locale",QLocale::system().name()).toString();
|
||||
bool showSplash = settings.value("show_splash", true).toBool();
|
||||
|
||||
|
@ -104,8 +108,6 @@ int main(int argc, char *argv[])
|
|||
companionTranslator.load(":/companion_" + locale);
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load((QString)"qt_" + locale.left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
// qDebug() << locale;
|
||||
// qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
app.installTranslator(&companionTranslator);
|
||||
app.installTranslator(&qtTranslator);
|
||||
|
||||
|
@ -114,28 +116,29 @@ int main(int argc, char *argv[])
|
|||
QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString();
|
||||
firmware_id.replace("open9x", "opentx");
|
||||
firmware_id.replace("x9da", "taranis");
|
||||
QPixmap pixmap;
|
||||
if (firmware_id.contains("taranis"))
|
||||
pixmap = QPixmap(":/images/splasht.png");
|
||||
else
|
||||
pixmap = QPixmap(":/images/splash.png");
|
||||
|
||||
QPixmap pixmap = QPixmap(firmware_id.contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png");
|
||||
QSplashScreen *splash = new QSplashScreen(pixmap);
|
||||
|
||||
RegisterFirmwares();
|
||||
|
||||
settings.setValue("firmware", firmware_id);
|
||||
current_firmware_variant = GetFirmwareVariant(firmware_id);
|
||||
// qDebug() << current_firmware_variant;
|
||||
|
||||
MainWindow mainWin;
|
||||
|
||||
MainWindow *mainWin = new MainWindow();
|
||||
if (showSplash) {
|
||||
splash->show();
|
||||
QTimer::singleShot(1000*SPLASH_TIME, splash, SLOT(close()));
|
||||
QTimer::singleShot(1000*SPLASH_TIME, &mainWin, SLOT(show()));
|
||||
QTimer::singleShot(1000*SPLASH_TIME, mainWin, SLOT(show()));
|
||||
}
|
||||
else {
|
||||
mainWin.show();
|
||||
mainWin->show();
|
||||
}
|
||||
return app.exec();
|
||||
|
||||
int result = app.exec();
|
||||
|
||||
delete splash;
|
||||
delete mainWin;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -63,27 +63,25 @@
|
|||
#include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include
|
||||
|
||||
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define C9X_STAMP "http://companion9x.googlecode.com/svn/trunk/companion9x-macosx.stamp"
|
||||
#define C9X_INSTALLER "/Companion9xMacUpdate.%1.pkg.zip"
|
||||
#define C9X_URL "http://companion9x.googlecode.com/files/Companion9xMacUpdate.%1.pkg.zip"
|
||||
#define C9X_STAMP OPENTX_COMPANION_DOWNLOADS "/companion-macosx.stamp"
|
||||
#define C9X_INSTALLER "/CompanionMacUpdate.%1.pkg.zip"
|
||||
#else
|
||||
#define C9X_STAMP "http://companion9x.googlecode.com/svn/trunk/companion9x.stamp"
|
||||
#define C9X_INSTALLER "/companion9xInstall_v%1.exe"
|
||||
#define C9X_URL "http://companion9x.googlecode.com/files/companion9xInstall_v%1.exe"
|
||||
#define C9X_STAMP OPENTX_COMPANION_DOWNLOADS "/companion-windows.stamp"
|
||||
#define C9X_INSTALLER "/companionInstall_%1.exe"
|
||||
#endif
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
#include <windows.h>
|
||||
#define sleep(x) Sleep(x*1000)
|
||||
#include <windows.h>
|
||||
#define sleep(x) Sleep(x*1000)
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include "mountlist.h"
|
||||
#include <unistd.h>
|
||||
#include "mountlist.h"
|
||||
#endif
|
||||
|
||||
|
||||
MainWindow::MainWindow():
|
||||
downloadDialog_forWait(NULL)
|
||||
downloadDialog_forWait(NULL)
|
||||
{
|
||||
mdiArea = new QMdiArea;
|
||||
mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
|
@ -96,7 +94,7 @@ downloadDialog_forWait(NULL)
|
|||
this, SLOT(setActiveSubWindow(QWidget*)));
|
||||
|
||||
MaxRecentFiles=MAX_RECENT;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int icon_size=settings.value("icon_size", 1).toInt();
|
||||
switch (icon_size) {
|
||||
case 0:
|
||||
|
@ -138,8 +136,9 @@ downloadDialog_forWait(NULL)
|
|||
// give time to the splash to disappear and main window to open before starting updates
|
||||
int updateDelay = 1000;
|
||||
bool showSplash = settings.value("show_splash", true).toBool();
|
||||
if (showSplash)
|
||||
if (showSplash) {
|
||||
updateDelay += (SPLASH_TIME*1000);
|
||||
}
|
||||
QTimer::singleShot(updateDelay, this, SLOT(doAutoUpdates()));
|
||||
QTimer::singleShot(updateDelay, this, SLOT(displayWarnings()));
|
||||
|
||||
|
@ -189,7 +188,7 @@ downloadDialog_forWait(NULL)
|
|||
|
||||
void MainWindow::displayWarnings()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int warnId=settings.value("warningId", 0 ).toInt();
|
||||
if (warnId<WARNING_ID && warnId!=0) {
|
||||
int res=0;
|
||||
|
@ -223,7 +222,7 @@ void MainWindow::checkForUpdates(bool ignoreSettings, QString & fwId)
|
|||
showcheckForUpdatesResult = ignoreSettings;
|
||||
check1done = true;
|
||||
check2done = true;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
fwToUpdate = fwId;
|
||||
QString stamp = GetFirmware(fwToUpdate)->stamp;
|
||||
|
||||
|
@ -289,7 +288,7 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
|
|||
"Would you like to download it?").arg(version) ,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
|
||||
if (ret == QMessageBox::Yes) {
|
||||
#if defined __APPLE__
|
||||
|
@ -299,14 +298,14 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
|
|||
#endif
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastUpdatesDir", QFileInfo(fileName).dir().absolutePath());
|
||||
downloadDialog * dd = new downloadDialog(this, QString(C9X_URL).arg(version), fileName);
|
||||
downloadDialog * dd = new downloadDialog(this, QString(OPENTX_COMPANION_DOWNLOADS C9X_INSTALLER).arg(version), fileName);
|
||||
installer_fileName = fileName;
|
||||
connect(dd, SIGNAL(accepted()), this, SLOT(updateDownloaded()));
|
||||
dd->show();
|
||||
}
|
||||
}
|
||||
#else
|
||||
QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available please check the repository"));
|
||||
QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available please check the OpenTX website!"));
|
||||
#endif
|
||||
} else {
|
||||
if (showcheckForUpdatesResult && check1done && check2done)
|
||||
|
@ -331,7 +330,7 @@ void MainWindow::updateDownloaded()
|
|||
void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmwareId)
|
||||
{
|
||||
QString url, ext, cpuid;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
url = firmware->getUrl(firmwareId);
|
||||
cpuid=settings.value("cpuid","").toString();
|
||||
ext = url.mid(url.lastIndexOf("."));
|
||||
|
@ -354,7 +353,7 @@ void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmw
|
|||
void MainWindow::reply1Accepted()
|
||||
{
|
||||
QString errormsg;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
bool autoflash=settings.value("burnFirmware", true).toBool();
|
||||
bool addversion=settings.value("rename_firmware_files", false).toBool();
|
||||
settings.beginGroup("FwRevisions");
|
||||
|
@ -478,7 +477,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
|
|||
// TODO delete downloadDialog_forWait?
|
||||
}
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
cpuid=settings.value("cpuid","").toString();
|
||||
QByteArray qba = reply->readAll();
|
||||
int i = qba.indexOf("SVN_VERS");
|
||||
|
@ -630,13 +629,14 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
|
|||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.setValue("mainWindowGeometry", saveGeometry());
|
||||
settings.setValue("mainWindowState", saveState());
|
||||
mdiArea->closeAllSubWindows();
|
||||
if (mdiArea->currentSubWindow()) {
|
||||
event->ignore();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ void MainWindow::newFile()
|
|||
|
||||
void MainWindow::openFile()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastDir").toString(),tr(EEPROM_FILES_FILTER));
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("lastDir", QFileInfo(fileName).dir().absolutePath());
|
||||
|
@ -683,7 +683,7 @@ void MainWindow::saveAs()
|
|||
|
||||
void MainWindow::openRecentFile()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
if (action) {
|
||||
QString fileName=action->data().toString();
|
||||
|
@ -705,14 +705,14 @@ void MainWindow::openRecentFile()
|
|||
|
||||
void MainWindow::loadProfile()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
int chord,defmod, burnfw;
|
||||
bool renfw;
|
||||
|
||||
if (action) {
|
||||
int profnum=action->data().toInt();
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.setValue("ActiveProfile",profnum);
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(profnum);
|
||||
|
@ -757,8 +757,8 @@ void MainWindow::unloadProfile()
|
|||
{
|
||||
ActiveProfile=0;
|
||||
ActiveProfileName="";
|
||||
QSettings settings("companion", "companion");
|
||||
settings.setValue("ActiveProfile",0);
|
||||
QSettings settings;
|
||||
settings.setValue("ActiveProfile", 0);
|
||||
FirmwareInfo *firmware = GetCurrentFirmware();
|
||||
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
|
||||
}
|
||||
|
@ -770,7 +770,8 @@ void MainWindow::preferences()
|
|||
FirmwareInfo *firmware = GetCurrentFirmware();
|
||||
if (ActiveProfile) {
|
||||
setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
|
||||
}
|
||||
|
||||
|
@ -1080,21 +1081,17 @@ void MainWindow::burnFrom()
|
|||
QStringList str;
|
||||
str << path << tempFile;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
res = ad->exec();
|
||||
sleep(1);
|
||||
}
|
||||
} else {
|
||||
QStringList str = GetReceiveEEpromCommand(tempFile);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
res = ad->exec();
|
||||
}
|
||||
if(QFileInfo(tempFile).exists() && res) {
|
||||
if (QFileInfo(tempFile).exists() && res) {
|
||||
MdiChild *child = createMdiChild();
|
||||
child->newFile();
|
||||
child->loadFile(tempFile, false);
|
||||
|
@ -1104,7 +1101,7 @@ void MainWindow::burnFrom()
|
|||
|
||||
void MainWindow::burnExtenalToEEPROM()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName;
|
||||
bool backup = false;
|
||||
burnDialog *cd = new burnDialog(this, 1, &fileName, &backup);
|
||||
|
@ -1141,18 +1138,14 @@ void MainWindow::burnExtenalToEEPROM()
|
|||
QStringList str;
|
||||
str << path << backupFile;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
sleep(1);
|
||||
}
|
||||
} else {
|
||||
QStringList str = GetReceiveEEpromCommand(backupFile);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx"));
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
sleep(1);
|
||||
}
|
||||
|
@ -1162,9 +1155,7 @@ void MainWindow::burnExtenalToEEPROM()
|
|||
QString tempFlash = tempDir + "/flash.bin";
|
||||
QStringList str = GetReceiveFlashCommand(tempFlash);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx");
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_flash.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_flash.png"));
|
||||
ad->exec();
|
||||
sleep(1);
|
||||
QString restoreFile = tempDir + "/compat.bin";
|
||||
|
@ -1177,7 +1168,8 @@ void MainWindow::burnExtenalToEEPROM()
|
|||
int rev = getEpromVersion(restoreFile);
|
||||
if ((rev / 100) != (oldrev / 100)) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("The transmitter firmware belongs to another product family, check file and preferences!"));
|
||||
} else if (rev < oldrev) {
|
||||
}
|
||||
else if (rev < oldrev) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("The transmitter firmware is outdated, please upgrade!"));
|
||||
}
|
||||
fileName = restoreFile;
|
||||
|
@ -1197,19 +1189,18 @@ void MainWindow::burnExtenalToEEPROM()
|
|||
QStringList str;
|
||||
str << path << backupFile;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str = ((MainWindow *)this->parent())->GetReceiveEEpromCommand(backupFile);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx"));
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
@ -1219,23 +1210,23 @@ void MainWindow::burnExtenalToEEPROM()
|
|||
if (path.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str;
|
||||
str << fileName << path;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write Models and Settings To Tx")); //, AVR_DIALOG_KEEP_OPEN);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str = GetSendEEpromCommand(fileName);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Write Models and Settings To Tx", AVR_DIALOG_SHOW_DONE);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"write_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("write_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1327,7 +1318,8 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
|
|||
} else {
|
||||
version = fwBuild.toInt(); // TODO changer le nom de la variable
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
version = ((Open9xFirmware *)firmware)->getEepromVersion(revision);
|
||||
}
|
||||
}
|
||||
|
@ -1344,11 +1336,8 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
|
|||
long result = file.read((char*)eeprom, eeprom_size);
|
||||
file.close();
|
||||
|
||||
RadioData radioData;
|
||||
if (!LoadEeprom(radioData, eeprom, eeprom_size))
|
||||
return false;
|
||||
|
||||
if (!firmware->saveEEPROM(eeprom, radioData, variant, version))
|
||||
QSharedPointer<RadioData> radioData = QSharedPointer<RadioData>(new RadioData());
|
||||
if (!LoadEeprom(*radioData, eeprom, eeprom_size) || !firmware->saveEEPROM(eeprom, *radioData, variant, version))
|
||||
return false;
|
||||
|
||||
QFile file2(restoreFile);
|
||||
|
@ -1366,7 +1355,7 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
|
|||
|
||||
void MainWindow::burnToFlash(QString fileToFlash)
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName;
|
||||
bool backup = settings.value("backupOnFlash", false).toBool();
|
||||
if(!fileToFlash.isEmpty())
|
||||
|
@ -1399,18 +1388,17 @@ void MainWindow::burnToFlash(QString fileToFlash)
|
|||
}
|
||||
QStringList str = GetReceiveEEpromCommand(backupFile);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
int res = ad->exec();
|
||||
delete ad;
|
||||
if (QFileInfo(backupFile).exists() && res) {
|
||||
sleep(1);
|
||||
QStringList str = GetSendFlashCommand(fileName);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL);
|
||||
QIcon iconw;
|
||||
populate_icon(&iconw,"write_eeprom.png");
|
||||
CompanionIcon iconw("write_eeprom.png");
|
||||
ad->setWindowIcon(iconw);
|
||||
int res = ad->exec();
|
||||
delete ad;
|
||||
if (res) {
|
||||
QString restoreFile = tempDir + "/restore.bin";
|
||||
if (!convertEEPROM(backupFile, restoreFile, fileName)) {
|
||||
|
@ -1421,17 +1409,21 @@ void MainWindow::burnToFlash(QString fileToFlash)
|
|||
QStringList str = GetSendEEpromCommand(restoreFile);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Restore Models and Settings To Tx"), AVR_DIALOG_CLOSE_IF_SUCCESSFUL);
|
||||
ad->setWindowIcon(iconw);
|
||||
res=ad->exec();
|
||||
res = ad->exec();
|
||||
delete ad;
|
||||
if (!res) {
|
||||
QMessageBox::warning(this, tr("Restore failed"), tr("Could not restore Models and Settings to TX. The models and settings data file can be found at: %1").arg(backupFile));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Firmware write failed"), tr("Could not write firmware to to transmitter. The models and settings data file can be found at: %1").arg(backupFile));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Backup failed"), tr("Cannot backup existing Models and Settings from TX. Firmware write process aborted"));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
bool backupEnable=settings.value("backupEnable", true).toBool();
|
||||
QString backupPath=settings.value("backupPath", "").toString();
|
||||
if (!QDir(backupPath).exists()) {
|
||||
|
@ -1445,26 +1437,24 @@ void MainWindow::burnToFlash(QString fileToFlash)
|
|||
QString backupFile=backupPath+"/backup-"+QDateTime().currentDateTime().toString("yyyy-MM-dd-hhmmss")+".bin";
|
||||
QStringList str = GetReceiveEEpromCommand(backupFile);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Backup Models and Settings From Tx"));
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
QStringList str = GetSendFlashCommand(fileName);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Write Firmware To Tx"), AVR_DIALOG_SHOW_DONE);
|
||||
QIcon iconw;
|
||||
populate_icon(&iconw,"write_flash.png");
|
||||
ad->setWindowIcon(iconw);
|
||||
ad->setWindowIcon(CompanionIcon("write_flash.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::burnExtenalFromEEPROM()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save transmitter Models and Settings to File"), settings.value("lastDir").toString(), tr(EXTERNAL_EEPROM_FILES_FILTER));
|
||||
if (!fileName.isEmpty()) {
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
|
@ -1473,30 +1463,30 @@ void MainWindow::burnExtenalFromEEPROM()
|
|||
if (path.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify that the eeprom disk is connected."));
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str;
|
||||
str << path << fileName;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Read Models and Settings From Tx")); //, AVR_DIALOG_KEEP_OPEN);
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
settings.setValue("lastDir", QFileInfo(fileName).dir().absolutePath());
|
||||
QStringList str = GetReceiveEEpromCommand(fileName);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, tr("Read Models and Settings From Tx"));
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::burnFromFlash()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getSaveFileName(this,tr("Read Tx Firmware to File"), settings.value("lastFlashDir").toString(),tr(FLASH_FILES_FILTER));
|
||||
if (!fileName.isEmpty()) {
|
||||
QFile file(fileName);
|
||||
|
@ -1506,12 +1496,10 @@ void MainWindow::burnFromFlash()
|
|||
settings.setValue("lastFlashDir",QFileInfo(fileName).dir().absolutePath());
|
||||
QStringList str = GetReceiveFlashCommand(fileName);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, GetAvrdudeLocation(), str, "Read Firmware From Tx");
|
||||
QIcon icon;
|
||||
populate_icon(&icon,"read_flash.png");
|
||||
ad->setWindowIcon(icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_flash.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::burnConfig()
|
||||
|
@ -1547,7 +1535,7 @@ void MainWindow::logFile()
|
|||
void MainWindow::about()
|
||||
{
|
||||
QString aboutStr = "<center><img src=\":/images/companion-title.png\"></center><br>";
|
||||
aboutStr.append("OpenTX Home Page: <a href='http://opentx.github.io'>http://open-tx.org</a><br><br>");
|
||||
aboutStr.append("OpenTX Home Page: <a href='http://opentx.github.io'>http://www.open-tx.org</a><br><br>");
|
||||
aboutStr.append(tr("The Companion project was originally forked from eePe")+QString(" <a href='http://code.google.com/p/eepe'>http://code.google.com/p/eepe</a><br/><br/>"));
|
||||
aboutStr.append(tr("If you've found this program useful, please support by"));
|
||||
aboutStr.append(" <a href='" DONATE_STR "'>");
|
||||
|
@ -1584,7 +1572,7 @@ void MainWindow::updateMenus()
|
|||
updateRecentFileActions();
|
||||
updateProfilesActions();
|
||||
bool notfound=true;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.beginGroup("Profiles");
|
||||
for (int i=0; i<MAX_PROFILES; i++) {
|
||||
QString profile=QString("profile%1").arg(i+1);
|
||||
|
@ -1648,191 +1636,134 @@ MdiChild *MainWindow::createMdiChild()
|
|||
|
||||
void MainWindow::createActions()
|
||||
{
|
||||
QIcon newActIcon;
|
||||
populate_icon(&newActIcon,"new.png");
|
||||
|
||||
newAct = new QAction(newActIcon, tr("&New"), this);
|
||||
newAct = new QAction(CompanionIcon("new.png"), tr("&New"), this);
|
||||
newAct->setShortcuts(QKeySequence::New);
|
||||
newAct->setStatusTip(tr("Create a new file"));
|
||||
connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));
|
||||
|
||||
QIcon openActIcon;
|
||||
populate_icon(&openActIcon,"open.png");
|
||||
openAct = new QAction(openActIcon, tr("&Open..."), this);
|
||||
openAct = new QAction(CompanionIcon("open.png"), tr("&Open..."), this);
|
||||
openAct->setShortcuts(QKeySequence::Open);
|
||||
openAct->setStatusTip(tr("Open an existing file"));
|
||||
connect(openAct, SIGNAL(triggered()), this, SLOT(openFile()));
|
||||
|
||||
loadbackupAct = new QAction(openActIcon, tr("&loadBackup..."), this);
|
||||
loadbackupAct = new QAction(CompanionIcon("open.png"), tr("&loadBackup..."), this);
|
||||
loadbackupAct->setStatusTip(tr("Load backup from file"));
|
||||
connect(loadbackupAct, SIGNAL(triggered()), this, SLOT(loadBackup()));
|
||||
|
||||
QIcon saveActIcon;
|
||||
populate_icon(&saveActIcon,"save.png");
|
||||
saveAct = new QAction(saveActIcon, tr("&Save"), this);
|
||||
saveAct = new QAction(CompanionIcon("save.png"), tr("&Save"), this);
|
||||
saveAct->setShortcuts(QKeySequence::Save);
|
||||
saveAct->setStatusTip(tr("Save the document to disk"));
|
||||
connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
|
||||
|
||||
QIcon saveAsActIcon;
|
||||
populate_icon(&saveAsActIcon,"saveas.png");
|
||||
saveAsAct = new QAction(saveAsActIcon, tr("Save &As..."), this);
|
||||
saveAsAct = new QAction(CompanionIcon("saveas.png"), tr("Save &As..."), this);
|
||||
saveAsAct->setShortcuts(QKeySequence::SaveAs);
|
||||
saveAsAct->setStatusTip(tr("Save the document under a new name"));
|
||||
connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));
|
||||
|
||||
QIcon logsActIcon;
|
||||
populate_icon(&logsActIcon,"logs.png");
|
||||
logsAct = new QAction(logsActIcon, tr("Lo&gs"), this);
|
||||
logsAct = new QAction(CompanionIcon("logs.png"), tr("Lo&gs"), this);
|
||||
logsAct->setShortcut(tr("Ctrl+G"));
|
||||
logsAct->setStatusTip(tr("Open log file"));
|
||||
connect(logsAct, SIGNAL(triggered()), this, SLOT(logFile()));
|
||||
|
||||
QIcon preferencesActIcon;
|
||||
populate_icon(&preferencesActIcon,"preferences.png");
|
||||
preferencesAct = new QAction(preferencesActIcon, tr("&Preferences..."), this);
|
||||
preferencesAct = new QAction(CompanionIcon("preferences.png"), tr("&Preferences..."), this);
|
||||
preferencesAct->setStatusTip(tr("Edit general preferences"));
|
||||
connect(preferencesAct, SIGNAL(triggered()), this, SLOT(preferences()));
|
||||
|
||||
QIcon checkForUpdatesActIcon;
|
||||
populate_icon(&checkForUpdatesActIcon,"update.png");
|
||||
checkForUpdatesAct = new QAction(checkForUpdatesActIcon, tr("&Check for updates..."), this);
|
||||
checkForUpdatesAct = new QAction(CompanionIcon("update.png"), tr("&Check for updates..."), this);
|
||||
checkForUpdatesAct->setStatusTip(tr("Check for new version of Companion"));
|
||||
connect(checkForUpdatesAct, SIGNAL(triggered()), this, SLOT(doUpdates()));
|
||||
|
||||
QIcon contributorsActIcon;
|
||||
populate_icon(&contributorsActIcon,"contributors.png");
|
||||
contributorsAct = new QAction(contributorsActIcon, tr("Contributors &List..."), this);
|
||||
contributorsAct = new QAction(CompanionIcon("contributors.png"), tr("Contributors &List..."), this);
|
||||
contributorsAct->setStatusTip(tr("Show Companion contributors list"));
|
||||
connect(contributorsAct, SIGNAL(triggered()), this, SLOT(contributors()));
|
||||
|
||||
QIcon changelogActIcon;
|
||||
populate_icon(&changelogActIcon,"changelog.png");
|
||||
changelogAct = new QAction(changelogActIcon, tr("ChangeLog..."), this);
|
||||
changelogAct = new QAction(CompanionIcon("changelog.png"), tr("ChangeLog..."), this);
|
||||
changelogAct->setStatusTip(tr("Show Companion changelog"));
|
||||
connect(changelogAct, SIGNAL(triggered()), this, SLOT(changelog()));
|
||||
|
||||
QIcon fwchangelogActIcon;
|
||||
populate_icon(&fwchangelogActIcon,"changelog.png");
|
||||
fwchangelogAct = new QAction(fwchangelogActIcon, tr("Firmware ChangeLog..."), this);
|
||||
fwchangelogAct = new QAction(CompanionIcon("changelog.png"), tr("Firmware ChangeLog..."), this);
|
||||
fwchangelogAct->setStatusTip(tr("Show firmware changelog"));
|
||||
connect(fwchangelogAct, SIGNAL(triggered()), this, SLOT(fwchangelog()));
|
||||
|
||||
QIcon compareActIcon;
|
||||
populate_icon(&compareActIcon,"compare.png");
|
||||
compareAct = new QAction(compareActIcon, tr("Compare..."), this);
|
||||
compareAct = new QAction(CompanionIcon("customize.png"), tr("Compare..."), this);
|
||||
compareAct->setStatusTip(tr("Compare models"));
|
||||
compareAct->setEnabled(false);
|
||||
connect(compareAct, SIGNAL(triggered()), this, SLOT(compare()));
|
||||
|
||||
QIcon customizeSplashActIcon;
|
||||
populate_icon(&customizeSplashActIcon,"customize.png");
|
||||
customizeSplashAct = new QAction(customizeSplashActIcon, tr("Customize your &TX..."), this);
|
||||
customizeSplashAct = new QAction(CompanionIcon("customize.png"), tr("Customize your &TX..."), this);
|
||||
customizeSplashAct->setStatusTip(tr("Customize the splash screen of your TX"));
|
||||
connect(customizeSplashAct, SIGNAL(triggered()), this, SLOT(customizeSplash()));
|
||||
|
||||
|
||||
//! [0]
|
||||
QIcon exitActIcon;
|
||||
populate_icon(&exitActIcon,"exit.png");
|
||||
exitAct = new QAction(exitActIcon, tr("E&xit"), this);
|
||||
exitAct = new QAction(CompanionIcon("exit.png"), tr("E&xit"), this);
|
||||
exitAct->setShortcuts(QKeySequence::Quit);
|
||||
exitAct->setStatusTip(tr("Exit the application"));
|
||||
connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
|
||||
//! [0]
|
||||
|
||||
QIcon cutActIcon;
|
||||
populate_icon(&cutActIcon,"cut.png");
|
||||
cutAct = new QAction(cutActIcon, tr("Cu&t"), this);
|
||||
cutAct = new QAction(CompanionIcon("cut.png"), tr("Cu&t"), this);
|
||||
cutAct->setShortcuts(QKeySequence::Cut);
|
||||
cutAct->setStatusTip(tr("Cut the current selection's contents to the "
|
||||
"clipboard"));
|
||||
connect(cutAct, SIGNAL(triggered()), this, SLOT(cut()));
|
||||
|
||||
QIcon copyActIcon;
|
||||
populate_icon(©ActIcon,"copy.png");
|
||||
copyAct = new QAction(copyActIcon, tr("&Copy"), this);
|
||||
copyAct = new QAction(CompanionIcon("copy.png"), tr("&Copy"), this);
|
||||
copyAct->setShortcuts(QKeySequence::Copy);
|
||||
copyAct->setStatusTip(tr("Copy the current selection's contents to the "
|
||||
"clipboard"));
|
||||
connect(copyAct, SIGNAL(triggered()), this, SLOT(copy()));
|
||||
|
||||
QIcon pasteActIcon;
|
||||
populate_icon(&pasteActIcon,"paste.png");
|
||||
pasteAct = new QAction(pasteActIcon, tr("&Paste"), this);
|
||||
pasteAct = new QAction(CompanionIcon("paste.png"), tr("&Paste"), this);
|
||||
pasteAct->setShortcuts(QKeySequence::Paste);
|
||||
pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current "
|
||||
"selection"));
|
||||
connect(pasteAct, SIGNAL(triggered()), this, SLOT(paste()));
|
||||
|
||||
QIcon burnToActIcon;
|
||||
populate_icon(&burnToActIcon,"write_eeprom.png");
|
||||
burnToAct = new QAction(burnToActIcon, tr("&Write Models and Settings To Tx"), this);
|
||||
burnToAct = new QAction(CompanionIcon("write_eeprom.png"), tr("&Write Models and Settings To Tx"), this);
|
||||
burnToAct->setShortcut(tr("Ctrl+Alt+W"));
|
||||
burnToAct->setStatusTip(tr("Write Models and Settings to transmitter"));
|
||||
connect(burnToAct,SIGNAL(triggered()),this,SLOT(burnTo()));
|
||||
|
||||
QIcon burnFromActIcon;
|
||||
populate_icon(&burnFromActIcon,"read_eeprom.png");
|
||||
burnFromAct = new QAction(burnFromActIcon, tr("&Read Models and Settings From Tx"), this);
|
||||
burnFromAct = new QAction(CompanionIcon("read_eeprom.png"), tr("&Read Models and Settings From Tx"), this);
|
||||
burnFromAct->setShortcut(tr("Ctrl+Alt+R"));
|
||||
burnFromAct->setStatusTip(tr("Read Models and Settings from transmitter"));
|
||||
connect(burnFromAct,SIGNAL(triggered()),this,SLOT(burnFrom()));
|
||||
|
||||
QIcon burnToFlashActIcon;
|
||||
populate_icon(&burnToFlashActIcon,"write_flash.png");
|
||||
burnToFlashAct = new QAction(burnToFlashActIcon, tr("Write Firmware"), this);
|
||||
burnToFlashAct = new QAction(CompanionIcon("write_flash.png"), tr("Write Firmware"), this);
|
||||
burnToFlashAct->setStatusTip(tr("Write firmware to transmitter"));
|
||||
connect(burnToFlashAct,SIGNAL(triggered()),this,SLOT(burnToFlash()));
|
||||
|
||||
QIcon burnExtenalToEEPROMActIcon;
|
||||
populate_icon(&burnExtenalToEEPROMActIcon,"write_eeprom_file.png");
|
||||
burnExtenalToEEPROMAct = new QAction(burnExtenalToEEPROMActIcon, tr("Write Models and Settings from file to Tx"), this);
|
||||
burnExtenalToEEPROMAct = new QAction(CompanionIcon("write_eeprom_file.png"), tr("Write Models and Settings from file to Tx"), this);
|
||||
burnExtenalToEEPROMAct->setStatusTip(tr("Write Models and Settings from file to transmitter"));
|
||||
connect(burnExtenalToEEPROMAct,SIGNAL(triggered()),this,SLOT(burnExtenalToEEPROM()));
|
||||
|
||||
QIcon burnExtenalFromEEPROMActIcon;
|
||||
populate_icon(&burnExtenalFromEEPROMActIcon,"read_eeprom_file.png");
|
||||
burnExtenalFromEEPROMAct = new QAction(burnExtenalFromEEPROMActIcon, tr("Save transmitter Models and Settings to file"), this);
|
||||
burnExtenalFromEEPROMAct = new QAction(CompanionIcon("read_eeprom_file.png"), tr("Save transmitter Models and Settings to file"), this);
|
||||
burnExtenalFromEEPROMAct->setStatusTip(tr("Save the Models and Settings from the transmitter to a file"));
|
||||
connect(burnExtenalFromEEPROMAct,SIGNAL(triggered()),this,SLOT(burnExtenalFromEEPROM()));
|
||||
|
||||
QIcon burnFromFlashActIcon;
|
||||
populate_icon(&burnFromFlashActIcon,"read_flash.png");
|
||||
burnFromFlashAct = new QAction(burnFromFlashActIcon, tr("Read Firmware"), this);
|
||||
burnFromFlashAct = new QAction(CompanionIcon("read_flash.png"), tr("Read Firmware"), this);
|
||||
burnFromFlashAct->setStatusTip(tr("Read firmware from transmitter"));
|
||||
connect(burnFromFlashAct,SIGNAL(triggered()),this,SLOT(burnFromFlash()));
|
||||
|
||||
QIcon burnConfigActIcon;
|
||||
populate_icon(&burnConfigActIcon,"configure.png");
|
||||
burnConfigAct = new QAction(burnConfigActIcon, tr("&Configure..."), this);
|
||||
burnConfigAct = new QAction(CompanionIcon("configure.png"), tr("&Configure..."), this);
|
||||
burnConfigAct->setStatusTip(tr("Configure software for reading from and writing to the transmitter"));
|
||||
connect(burnConfigAct,SIGNAL(triggered()),this,SLOT(burnConfig()));
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (!IS_ARM(eepromInterface->getBoard())) {
|
||||
QIcon burnListActIcon;
|
||||
populate_icon(&burnListActIcon,"list.png");
|
||||
burnListAct = new QAction(burnListActIcon, tr("&List programmers"), this);
|
||||
burnListAct = new QAction(CompanionIcon("list.png"), tr("&List programmers"), this);
|
||||
burnListAct->setStatusTip(tr("List available programmers"));
|
||||
connect(burnListAct,SIGNAL(triggered()),this,SLOT(burnList()));
|
||||
|
||||
QIcon burnFusesActIcon;
|
||||
populate_icon(&burnFusesActIcon,"fuses.png");
|
||||
burnFusesAct = new QAction(burnFusesActIcon, tr("&Fuses..."), this);
|
||||
burnFusesAct = new QAction(CompanionIcon("fuses.png"), tr("&Fuses..."), this);
|
||||
burnFusesAct->setStatusTip(tr("Show fuses dialog"));
|
||||
connect(burnFusesAct,SIGNAL(triggered()),this,SLOT(burnFuses()));
|
||||
}
|
||||
QIcon simulateActIcon;
|
||||
populate_icon(&simulateActIcon,"simulate.png");
|
||||
simulateAct = new QAction(simulateActIcon, tr("&Simulate"), this);
|
||||
|
||||
simulateAct = new QAction(CompanionIcon("simulate.png"), tr("&Simulate"), this);
|
||||
simulateAct->setShortcut(tr("Alt+S"));
|
||||
simulateAct->setStatusTip(tr("Simulate selected model."));
|
||||
simulateAct->setEnabled(false);
|
||||
connect(simulateAct,SIGNAL(triggered()),this,SLOT(simulate()));
|
||||
|
||||
QIcon printActIcon;
|
||||
populate_icon(&printActIcon,"print.png");
|
||||
printAct = new QAction(printActIcon, tr("&Print"), this);
|
||||
printAct = new QAction(CompanionIcon("print.png"), tr("&Print"), this);
|
||||
printAct->setShortcut(tr("Ctrl+P"));
|
||||
printAct->setStatusTip(tr("Print current model."));
|
||||
printAct->setEnabled(false);
|
||||
|
@ -1872,15 +1803,11 @@ void MainWindow::createActions()
|
|||
separatorAct = new QAction(this);
|
||||
separatorAct->setSeparator(true);
|
||||
|
||||
QIcon aboutActIcon;
|
||||
populate_icon(&aboutActIcon,"information.png");
|
||||
aboutAct = new QAction(aboutActIcon, tr("&About"), this);
|
||||
aboutAct = new QAction(CompanionIcon("information.png"), tr("&About"), this);
|
||||
aboutAct->setStatusTip(tr("Show the application's About box"));
|
||||
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
|
||||
|
||||
QIcon switchLayoutDirectionActIcon;
|
||||
populate_icon(&switchLayoutDirectionActIcon,"switch_dir.png");
|
||||
switchLayoutDirectionAct = new QAction(switchLayoutDirectionActIcon, tr("Switch layout direction"), this);
|
||||
switchLayoutDirectionAct = new QAction(CompanionIcon("switch_dir.png"), tr("Switch layout direction"), this);
|
||||
switchLayoutDirectionAct->setStatusTip(tr("Switch layout Left/Right"));
|
||||
connect(switchLayoutDirectionAct, SIGNAL(triggered()), this, SLOT(switchLayoutDirection()));
|
||||
for (int i = 0; i < MaxRecentFiles; ++i) {
|
||||
|
@ -1910,10 +1837,8 @@ void MainWindow::createMenus()
|
|||
fileMenu->addAction(saveAct);
|
||||
fileMenu->addAction(saveAsAct);
|
||||
fileMenu->addMenu(recentFileMenu);
|
||||
QIcon recentFileMenuIcon;
|
||||
populate_icon(&recentFileMenuIcon,"recentdocument.png");
|
||||
recentFileMenu->setIcon(recentFileMenuIcon);
|
||||
for ( int i = 0; i < MaxRecentFiles; ++i)
|
||||
recentFileMenu->setIcon(CompanionIcon("recentdocument.png"));
|
||||
for (int i=0; i<MaxRecentFiles; ++i)
|
||||
recentFileMenu->addAction(recentFileActs[i]);
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(logsAct);
|
||||
|
@ -1925,10 +1850,8 @@ void MainWindow::createMenus()
|
|||
fileMenu->addAction(preferencesAct);
|
||||
fileMenu->addMenu(profilesMenu);
|
||||
|
||||
QIcon profilesMenuIcon;
|
||||
populate_icon(&profilesMenuIcon,"profiles.png");
|
||||
profilesMenu->setIcon(profilesMenuIcon);
|
||||
for ( int i = 0; i < MAX_PROFILES; ++i)
|
||||
profilesMenu->setIcon(CompanionIcon("profiles.png"));
|
||||
for (int i=0; i<MAX_PROFILES; ++i)
|
||||
profilesMenu->addAction(profileActs[i]);
|
||||
fileMenu->addAction(switchLayoutDirectionAct);
|
||||
fileMenu->addAction(exitAct);
|
||||
|
@ -1992,7 +1915,7 @@ QMenu *MainWindow::createProfilesMenu()
|
|||
|
||||
void MainWindow::createToolBars()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int icon_size=settings.value("icon_size",2 ).toInt();
|
||||
QSize size;
|
||||
switch(icon_size) {
|
||||
|
@ -2017,9 +1940,7 @@ void MainWindow::createToolBars()
|
|||
QToolButton * recentToolButton = new QToolButton;
|
||||
recentToolButton->setPopupMode(QToolButton::InstantPopup);
|
||||
recentToolButton->setMenu(createRecentFileMenu());
|
||||
QIcon recentToolButtonIcon;
|
||||
populate_icon(&recentToolButtonIcon,"recentdocument.png");
|
||||
recentToolButton->setIcon(recentToolButtonIcon);
|
||||
recentToolButton->setIcon(CompanionIcon("recentdocument.png"));
|
||||
recentToolButton->setToolTip(tr("Recent Files"));
|
||||
fileToolBar->addWidget(recentToolButton);
|
||||
fileToolBar->addAction(saveAct);
|
||||
|
@ -2029,9 +1950,7 @@ void MainWindow::createToolBars()
|
|||
profileButton = new QToolButton;
|
||||
profileButton->setPopupMode(QToolButton::InstantPopup);
|
||||
profileButton->setMenu(createProfilesMenu());
|
||||
QIcon profileButtonIcon;
|
||||
populate_icon(&profileButtonIcon,"profiles.png");
|
||||
profileButton->setIcon(profileButtonIcon);
|
||||
profileButton->setIcon(CompanionIcon("profiles.png"));
|
||||
profileButton->setToolTip(tr("Firmware Profiles"));
|
||||
fileToolBar->addWidget(profileButton);
|
||||
bool notfound=true;
|
||||
|
@ -2088,7 +2007,7 @@ void MainWindow::createStatusBar()
|
|||
|
||||
void MainWindow::readSettings()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
restoreState(settings.value("mainWindowState").toByteArray());
|
||||
checkCompanion9x = settings.value("startup_check_companion", true).toBool();
|
||||
checkFW = settings.value("startup_check_fw", true).toBool();
|
||||
|
@ -2141,7 +2060,7 @@ void MainWindow::setActiveSubWindow(QWidget *window)
|
|||
void MainWindow::updateRecentFileActions()
|
||||
{
|
||||
int i,j, numRecentFiles;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QStringList files = settings.value("recentFileList").toStringList();
|
||||
|
||||
numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
|
||||
|
@ -2161,7 +2080,7 @@ void MainWindow::updateRecentFileActions()
|
|||
void MainWindow::updateProfilesActions()
|
||||
{
|
||||
int i;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.beginGroup("Profiles");
|
||||
for (i=0; i<MAX_PROFILES; i++) {
|
||||
QString profile=QString("profile%1").arg(i+1);
|
||||
|
@ -2278,7 +2197,7 @@ void MainWindow::dropEvent(QDropEvent *event)
|
|||
QString fileName = urls.first().toLocalFile();
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.setValue("lastDir", QFileInfo(fileName).dir().absolutePath());
|
||||
|
||||
QMdiSubWindow *existing = findMdiChild(fileName);
|
||||
|
|
|
@ -68,11 +68,8 @@ MdiChild::MdiChild():
|
|||
isUntitled(true),
|
||||
fileChanged(false)
|
||||
{
|
||||
QIcon SimulateIcon;
|
||||
populate_icon(&SimulateIcon,"simulate.png");
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->SimulateTxButton->setIcon(SimulateIcon);
|
||||
ui->SimulateTxButton->setIcon(CompanionIcon("simulate.png"));
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
eepromInterfaceChanged();
|
||||
|
@ -182,7 +179,7 @@ void MdiChild::OpenEditWindow(bool wizard=false)
|
|||
}
|
||||
if (isNew && !wizard) {
|
||||
int ret;
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
bool wizardEnable=settings.value("wizardEnable", true).toBool();
|
||||
if (wizardEnable) {
|
||||
ret = QMessageBox::question(this, tr("Companion"), tr("Do you want to use model wizard? "), QMessageBox::Yes | QMessageBox::No);
|
||||
|
@ -349,7 +346,7 @@ bool MdiChild::save()
|
|||
|
||||
bool MdiChild::saveAs(bool isNew)
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName;
|
||||
if (GetEepromInterface()->getBoard() == BOARD_SKY9X) {
|
||||
curFile.replace(".eepe", ".bin");
|
||||
|
@ -493,7 +490,7 @@ void MdiChild::setCurrentFile(const QString &fileName)
|
|||
fileChanged = false;
|
||||
setWindowModified(false);
|
||||
updateTitle();
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int MaxRecentFiles =settings.value("history_size",10).toInt();
|
||||
QStringList files = settings.value("recentFileList").toStringList();
|
||||
files.removeAll(fileName);
|
||||
|
@ -511,7 +508,7 @@ QString MdiChild::strippedName(const QString &fullFileName)
|
|||
|
||||
void MdiChild::burnTo() // write to Tx
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
bool backupEnable=settings.value("backupEnable", true).toBool();
|
||||
QString backupPath=settings.value("backupPath", "").toString();
|
||||
if (!backupPath.isEmpty()) {
|
||||
|
@ -556,19 +553,17 @@ void MdiChild::burnTo() // write to Tx
|
|||
QStringList str;
|
||||
str << path << backupFile;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Backup EEPROM From Tx")); //, AVR_DIALOG_KEEP_OPEN);
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
sleep(1);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str = ((MainWindow *)this->parent())->GetReceiveEEpromCommand(backupFile);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup EEPROM From Tx"));
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
@ -576,10 +571,9 @@ void MdiChild::burnTo() // write to Tx
|
|||
QString tempFlash=tempDir + "/flash.bin";
|
||||
QStringList str = ((MainWindow *)this->parent())->GetReceiveFlashCommand(tempFlash);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, "Read Flash From Tx");
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"read_flash.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_flash.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
QString restoreFile = tempDir + "/compat.bin";
|
||||
if (!((MainWindow *)this->parent())->convertEEPROM(tempFile, restoreFile, tempFlash)) {
|
||||
|
@ -587,7 +581,8 @@ void MdiChild::burnTo() // write to Tx
|
|||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret==QMessageBox::No)
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
int rev=((MainWindow *)this->parent())->getEpromVersion(restoreFile);
|
||||
if ((rev/100)!=(oldrev/100)) {
|
||||
QMessageBox::warning(this,tr("Warning"), tr("Firmware in radio is of a different family of eeprom written, check file and preferences!"));
|
||||
|
@ -600,7 +595,8 @@ void MdiChild::burnTo() // write to Tx
|
|||
QByteArray ba = tempFlash.toLatin1();
|
||||
char *name = ba.data();
|
||||
unlink(name);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (backupEnable) {
|
||||
QString backupFile=backupPath+"/backup-"+QDateTime().currentDateTime().toString("yyyy-MM-dd-hhmmss")+".bin";
|
||||
if (IS_TARANIS(eepromInterface->getBoard())) {
|
||||
|
@ -608,16 +604,17 @@ void MdiChild::burnTo() // write to Tx
|
|||
if (path.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QFile::copy(path,backupFile);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str = ((MainWindow *)this->parent())->GetReceiveEEpromCommand(backupFile);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, tr("Backup EEPROM From Tx"));
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->exec();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
@ -627,23 +624,23 @@ void MdiChild::burnTo() // write to Tx
|
|||
if (path.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Taranis radio not found"), tr("Impossible to identify the radio on your system, please verify the eeprom disk is connected."));
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str;
|
||||
str << tempFile << path;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this,"", str, tr("Write EEPROM To Tx"), AVR_DIALOG_SHOW_DONE); //, AVR_DIALOG_KEEP_OPEN);
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"read_eeprom.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("read_eeprom.png"));
|
||||
ad->show();
|
||||
delete ad;
|
||||
sleep(1);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
QStringList str = ((MainWindow *)this->parent())->GetSendEEpromCommand(tempFile);
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, ((MainWindow *)this->parent())->GetAvrdudeLocation(), str, "Write EEPROM To Tx", AVR_DIALOG_SHOW_DONE);
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"write_eeprom.png");
|
||||
ad->setWindowIcon(Icon);
|
||||
ad->setWindowIcon(CompanionIcon("write_eeprom.png"));
|
||||
ad->show();
|
||||
delete ad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -693,7 +690,7 @@ void MdiChild::setEEpromAvail(int eavail)
|
|||
|
||||
bool MdiChild::loadBackup()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), settings.value("lastDir").toString(),tr(EEPROM_FILES_FILTER));
|
||||
if (fileName.isEmpty())
|
||||
return false;
|
||||
|
|
|
@ -84,8 +84,6 @@ Curves::Curves(QWidget * parent, ModelData & model):
|
|||
QGraphicsScene *scene = new QGraphicsScene(ui->curvePreview);
|
||||
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||
ui->curvePreview->setScene(scene);
|
||||
QIcon ClearIcon;
|
||||
populate_icon(&ClearIcon,"clear.png");
|
||||
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(NumCurves); i++) {
|
||||
visibleCurves[i] = false;
|
||||
|
@ -94,7 +92,7 @@ Curves::Curves(QWidget * parent, ModelData & model):
|
|||
QPushButton * reset = new QPushButton(this);
|
||||
reset->setProperty("index", i);
|
||||
reset->setMinimumSize(QSize(0, 0));
|
||||
reset->setIcon(ClearIcon);
|
||||
reset->setIcon(CompanionIcon("clear.png"));
|
||||
reset->setIconSize(QSize(14, 14));
|
||||
connect(reset, SIGNAL(clicked()), this, SLOT(resetCurve()));
|
||||
ui->curvesLayout->addWidget(reset, i, 0, 1, 1);
|
||||
|
@ -600,9 +598,9 @@ void ModelEdit::on_ca_apply_PB_clicked()
|
|||
|
||||
void ModelEdit::clearCurves(bool ask)
|
||||
{
|
||||
if(ask) {
|
||||
int res = QMessageBox::question(this,tr("Clear Curves?"),tr("Really clear all the curves?"),QMessageBox::Yes | QMessageBox::No);
|
||||
if(res!=QMessageBox::Yes) return;
|
||||
if (ask) {
|
||||
int res = QMessageBox::question(this, tr("Clear Curves?"), tr("Really clear all the curves?"), QMessageBox::Yes | QMessageBox::No);
|
||||
if (res!=QMessageBox::Yes) return;
|
||||
}
|
||||
curvesLock=true;
|
||||
for (int j=0; j<16; j++) {
|
||||
|
|
|
@ -36,7 +36,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
|||
}
|
||||
}
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString path = settings.value("sdPath", ".").toString();
|
||||
path.append("/SOUNDS/");
|
||||
QString lang = generalSettings.ttsLanguage;
|
||||
|
@ -123,11 +123,9 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
|||
connect(fswtchParamArmT[i], SIGNAL(editTextChanged ( const QString)), this, SLOT(customFunctionEdited()));
|
||||
|
||||
#ifdef PHONON
|
||||
QIcon PlayIcon;
|
||||
populate_icon(&PlayIcon,"play.png");
|
||||
playBT[i] = new QPushButton(this);
|
||||
playBT[i]->setObjectName(QString("play_%1").arg(i));
|
||||
playBT[i]->setIcon(PlayIcon);
|
||||
playBT[i]->setIcon(CompanionIcon("play.png"));
|
||||
paramLayout->addWidget(playBT[i]);
|
||||
connect(playBT[i], SIGNAL(pressed()), this, SLOT(playMusic()));
|
||||
#endif
|
||||
|
@ -162,8 +160,6 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
|
|||
{
|
||||
if (phononLock)
|
||||
return;
|
||||
QIcon PlayIcon;
|
||||
populate_icon(&PlayIcon,"play.png");
|
||||
|
||||
phononLock=true;
|
||||
if ((newState==Phonon::StoppedState || newState==Phonon::PausedState) && oldState==Phonon::PlayingState) {
|
||||
|
@ -172,7 +168,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
|
|||
clickObject->clear();
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
|
||||
playBT[i]->setObjectName(QString("play_%1").arg(i));
|
||||
playBT[i]->setIcon(PlayIcon);
|
||||
playBT[i]->setIcon(CompanionIcon("play.png"));
|
||||
}
|
||||
}
|
||||
if (newState==Phonon::ErrorState) {
|
||||
|
@ -181,7 +177,7 @@ void CustomFunctionsPanel::mediaPlayer_state(Phonon::State newState, Phonon::Sta
|
|||
clickObject->clear();
|
||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
|
||||
playBT[i]->setObjectName(QString("play_%1").arg(i));
|
||||
playBT[i]->setIcon(PlayIcon);
|
||||
playBT[i]->setIcon(CompanionIcon("play.png"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,19 +190,15 @@ void CustomFunctionsPanel::playMusic()
|
|||
QPushButton *playButton = qobject_cast<QPushButton*>(sender());
|
||||
int index=playButton->objectName().mid(5,2).toInt();
|
||||
QString function=playButton->objectName().left(4);
|
||||
QSettings settings("companion", "companion");
|
||||
QIcon PlayIcon;
|
||||
populate_icon(&PlayIcon,"play.png");
|
||||
QIcon StopIcon;
|
||||
populate_icon(&StopIcon,"stop.png");
|
||||
|
||||
QString path=settings.value("sdPath", ".").toString();
|
||||
QSettings settings;
|
||||
QString path = settings.value("sdPath", ".").toString();
|
||||
QDir qd(path);
|
||||
QString track;
|
||||
if (qd.exists()) {
|
||||
if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
|
||||
track=path+QString("/%1.wav").arg(int(fswtchParam[index]->value()),4,10,(const QChar)'0');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
path.append("/SOUNDS/");
|
||||
QString lang = generalSettings.ttsLanguage;
|
||||
if (lang.isEmpty())
|
||||
|
@ -227,12 +219,12 @@ void CustomFunctionsPanel::playMusic()
|
|||
clickObject->setCurrentSource(Phonon::MediaSource(track));
|
||||
clickObject->play();
|
||||
playBT[index]->setObjectName(QString("stop_%1").arg(index));
|
||||
playBT[index]->setIcon(StopIcon);
|
||||
playBT[index]->setIcon(CompanionIcon("stop.png"));
|
||||
} else {
|
||||
clickObject->stop();
|
||||
clickObject->clear();
|
||||
playBT[index]->setObjectName(QString("play_%1").arg(index));
|
||||
playBT[index]->setIcon(PlayIcon);
|
||||
playBT[index]->setIcon(CompanionIcon("play.png"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -467,14 +459,6 @@ void CustomFunctionsPanel::fsw_customContextMenuRequested(QPoint pos)
|
|||
{
|
||||
QLabel *label = (QLabel *)sender();
|
||||
selectedFunction = label->property("index").toInt();
|
||||
QIcon ClearIcon;
|
||||
populate_icon(&ClearIcon,"clear.png");
|
||||
QIcon CopyIcon;
|
||||
populate_icon(&CopyIcon,"copy.png");
|
||||
QIcon CutIcon;
|
||||
populate_icon(&CutIcon,"cut.png");
|
||||
QIcon PasteIcon;
|
||||
populate_icon(&PasteIcon,"paste.png");
|
||||
|
||||
QPoint globalPos = label->mapToGlobal(pos);
|
||||
|
||||
|
@ -483,10 +467,10 @@ void CustomFunctionsPanel::fsw_customContextMenuRequested(QPoint pos)
|
|||
bool hasData = mimeData->hasFormat("application/x-companion-fsw");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(fswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(fswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(fswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(fswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(fswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(fswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(fswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(fswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
|
|
@ -382,14 +382,6 @@ void CustomSwitchesPanel::csw_customContextMenuRequested(QPoint pos)
|
|||
{
|
||||
QLabel *label = (QLabel *)sender();
|
||||
selectedSwitch = label->property("index").toInt();
|
||||
QIcon ClearIcon;
|
||||
populate_icon(&ClearIcon,"clear.png");
|
||||
QIcon CopyIcon;
|
||||
populate_icon(&CopyIcon,"copy.png");
|
||||
QIcon CutIcon;
|
||||
populate_icon(&CutIcon,"cut.png");
|
||||
QIcon PasteIcon;
|
||||
populate_icon(&PasteIcon,"paste.png");
|
||||
|
||||
QPoint globalPos = label->mapToGlobal(pos);
|
||||
|
||||
|
@ -398,10 +390,10 @@ void CustomSwitchesPanel::csw_customContextMenuRequested(QPoint pos)
|
|||
bool hasData = mimeData->hasFormat("application/x-companion-csw");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(cswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(cswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(cswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(cswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(cswDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(cswCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(cswCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(cswPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
|
|
@ -8,28 +8,21 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g
|
|||
generalSettings(generalSettings),
|
||||
expoInserted(false)
|
||||
{
|
||||
QString Theme=getTheme();
|
||||
|
||||
QGridLayout * exposLayout = new QGridLayout(this);
|
||||
|
||||
ExposlistWidget = new MixersList(this, true);
|
||||
QPushButton * qbUp = new QPushButton(this);
|
||||
QPushButton * qbDown = new QPushButton(this);
|
||||
QPushButton * qbClear = new QPushButton(this);
|
||||
QIcon qbUpIcon;
|
||||
populate_icon(&qbUpIcon,"moveup.png");
|
||||
|
||||
qbUp->setText(tr("Move Up"));
|
||||
qbUp->setIcon(qbUpIcon);
|
||||
qbUp->setIcon(CompanionIcon("moveup.png"));
|
||||
qbUp->setShortcut(QKeySequence(tr("Ctrl+Up")));
|
||||
QIcon qbDownIcon;
|
||||
populate_icon(&qbDownIcon,"movedown.png");
|
||||
qbDown->setText(tr("Move Down"));
|
||||
qbDown->setIcon(qbDownIcon);
|
||||
qbDown->setIcon(CompanionIcon("movedown.png"));
|
||||
qbDown->setShortcut(QKeySequence(tr("Ctrl+Down")));
|
||||
QIcon qbClearIcon;
|
||||
populate_icon(&qbClearIcon,"clear.png");
|
||||
qbClear->setText(tr("Clear Expo Settings"));
|
||||
qbClear->setIcon(qbClearIcon);
|
||||
qbClear->setIcon(CompanionIcon("clear.png"));
|
||||
|
||||
exposLayout->addWidget(ExposlistWidget,1,1,1,3);
|
||||
exposLayout->addWidget(qbUp,2,1);
|
||||
|
@ -348,24 +341,6 @@ void InputsPanel::expoAdd()
|
|||
|
||||
void InputsPanel::expolistWidget_customContextMenuRequested(QPoint pos)
|
||||
{
|
||||
QIcon AddIcon;
|
||||
populate_icon(&AddIcon,"add.png");
|
||||
QIcon EditIcon;
|
||||
populate_icon(&EditIcon,"edit.png");
|
||||
QIcon ClearIcon;
|
||||
populate_icon(&ClearIcon,"clear.png");
|
||||
QIcon CopyIcon;
|
||||
populate_icon(&CopyIcon,"copy.png");
|
||||
QIcon CutIcon;
|
||||
populate_icon(&CutIcon,"cut.png");
|
||||
QIcon PasteIcon;
|
||||
populate_icon(&PasteIcon,"paste.png");
|
||||
QIcon DuplicateIcon;
|
||||
populate_icon(&DuplicateIcon,"duplicate.png");
|
||||
QIcon MoveUpIcon;
|
||||
populate_icon(&MoveUpIcon,"moveup.png");
|
||||
QIcon MoveDownIcon;
|
||||
populate_icon(&MoveDownIcon,"movedown.png");
|
||||
QPoint globalPos = ExposlistWidget->mapToGlobal(pos);
|
||||
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
|
@ -373,17 +348,17 @@ void InputsPanel::expolistWidget_customContextMenuRequested(QPoint pos)
|
|||
bool hasData = mimeData->hasFormat("application/x-companion-expo");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(AddIcon, tr("&Add"),this,SLOT(expoAdd()),tr("Ctrl+A"));
|
||||
contextMenu.addAction(EditIcon, tr("&Edit"),this,SLOT(expoOpen()),tr("Enter"));
|
||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"),this,SLOT(expoAdd()),tr("Ctrl+A"));
|
||||
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"),this,SLOT(expoOpen()),tr("Enter"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(exposDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(exposCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(exposCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(exposPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(DuplicateIcon, tr("Du&plicate"),this,SLOT(exposDuplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(exposDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(exposCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(exposCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(exposPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"),this,SLOT(exposDuplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(MoveUpIcon, tr("Move Up"),this,SLOT(moveExpoUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(MoveDownIcon, tr("Move Down"),this,SLOT(moveExpoDown()),tr("Ctrl+Down"));
|
||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"),this,SLOT(moveExpoUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"),this,SLOT(moveExpoDown()),tr("Ctrl+Down"));
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
|
|
@ -14,20 +14,14 @@ MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
|||
QPushButton * qbUp = new QPushButton(this);
|
||||
QPushButton * qbDown = new QPushButton(this);
|
||||
QPushButton * qbClear = new QPushButton(this);
|
||||
QIcon qbUpIcon;
|
||||
populate_icon(&qbUpIcon,"moveup.png");
|
||||
qbUp->setText(tr("Move Up"));
|
||||
qbUp->setIcon(qbUpIcon);
|
||||
qbUp->setIcon(CompanionIcon("moveup.png"));
|
||||
qbUp->setShortcut(QKeySequence(tr("Ctrl+Up")));
|
||||
QIcon qbDownIcon;
|
||||
populate_icon(&qbDownIcon,"movedown.png");
|
||||
qbDown->setText(tr("Move Down"));
|
||||
qbDown->setIcon(qbDownIcon);
|
||||
qbDown->setIcon(CompanionIcon("movedown.png"));
|
||||
qbDown->setShortcut(QKeySequence(tr("Ctrl+Down")));
|
||||
QIcon qbClearIcon;
|
||||
populate_icon(&qbClearIcon,"clear.png");
|
||||
qbClear->setText(tr("Clear Mixes"));
|
||||
qbClear->setIcon(qbClearIcon);
|
||||
qbClear->setIcon(CompanionIcon("clear.png"));
|
||||
|
||||
mixesLayout->addWidget(MixerlistWidget,1,1,1,3);
|
||||
mixesLayout->addWidget(qbUp,2,1);
|
||||
|
@ -411,24 +405,6 @@ void MixesPanel::mixerAdd()
|
|||
|
||||
void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
|
||||
{
|
||||
QIcon AddIcon;
|
||||
populate_icon(&AddIcon,"add.png");
|
||||
QIcon EditIcon;
|
||||
populate_icon(&EditIcon,"edit.png");
|
||||
QIcon ClearIcon;
|
||||
populate_icon(&ClearIcon,"clear.png");
|
||||
QIcon CopyIcon;
|
||||
populate_icon(&CopyIcon,"copy.png");
|
||||
QIcon CutIcon;
|
||||
populate_icon(&CutIcon,"cut.png");
|
||||
QIcon PasteIcon;
|
||||
populate_icon(&PasteIcon,"paste.png");
|
||||
QIcon DuplicateIcon;
|
||||
populate_icon(&DuplicateIcon,"duplicate.png");
|
||||
QIcon MoveUpIcon;
|
||||
populate_icon(&MoveUpIcon,"moveup.png");
|
||||
QIcon MoveDownIcon;
|
||||
populate_icon(&MoveDownIcon,"movedown.png");
|
||||
QPoint globalPos = MixerlistWidget->mapToGlobal(pos);
|
||||
|
||||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
|
@ -436,17 +412,17 @@ void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
|
|||
bool hasData = mimeData->hasFormat("application/x-companion-mix");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(AddIcon, tr("&Add"),this,SLOT(mixerAdd()),tr("Ctrl+A"));
|
||||
contextMenu.addAction(EditIcon, tr("&Edit"),this,SLOT(mixerOpen()),tr("Enter"));
|
||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"),this,SLOT(mixerAdd()),tr("Ctrl+A"));
|
||||
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"),this,SLOT(mixerOpen()),tr("Enter"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(mixersDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(mixersCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(mixersCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(mixersPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(DuplicateIcon, tr("Du&plicate"),this,SLOT(mixersDuplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(mixersDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(mixersCopy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(mixersCut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(mixersPaste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"),this,SLOT(mixersDuplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(MoveUpIcon, tr("Move Up"),this,SLOT(moveMixUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(MoveDownIcon, tr("Move Down"),this,SLOT(moveMixDown()),tr("Ctrl+Down"));
|
||||
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"),this,SLOT(moveMixUp()),tr("Ctrl+Up"));
|
||||
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"),this,SLOT(moveMixDown()),tr("Ctrl+Down"));
|
||||
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
|
|
@ -21,11 +21,9 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
|
|||
generalSettings(radioData.generalSettings)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
restoreGeometry(settings.value("modelEditGeometry").toByteArray());
|
||||
QIcon SimulateIcon;
|
||||
populate_icon(&SimulateIcon,"simulate.png");
|
||||
ui->pushButton->setIcon(SimulateIcon);
|
||||
ui->pushButton->setIcon(CompanionIcon("simulate.png"));
|
||||
addTab(new Setup(this, model), tr("Setup"));
|
||||
addTab(new HeliPanel(this, model), tr("Heli"));
|
||||
addTab(new FlightModes(this, model, radioData.generalSettings), tr("Flight Modes"));
|
||||
|
@ -47,7 +45,7 @@ ModelEdit::~ModelEdit()
|
|||
|
||||
void ModelEdit::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.setValue("modelEditGeometry", saveGeometry());
|
||||
}
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ Setup::Setup(QWidget *parent, ModelData & model):
|
|||
if (GetEepromInterface()->getCapability(ModelImage)) {
|
||||
QStringList items;
|
||||
items.append("");
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString path = settings.value("sdPath", ".").toString();
|
||||
path.append("/BMP/");
|
||||
QDir qd(path);
|
||||
|
@ -497,7 +497,7 @@ void Setup::on_image_currentIndexChanged(int index)
|
|||
{
|
||||
if (!lock) {
|
||||
strncpy(model.bitmap, ui->image->currentText().toAscii(), GetEepromInterface()->getCapability(VoicesMaxLength));
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString path=settings.value("sdPath", ".").toString();
|
||||
path.append("/BMP/");
|
||||
QDir qd(path);
|
||||
|
|
|
@ -342,7 +342,7 @@ TelemetryPanel::~TelemetryPanel()
|
|||
|
||||
void TelemetryPanel::setup()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString();
|
||||
|
||||
lock=true;
|
||||
|
|
|
@ -83,47 +83,23 @@ void ModelsListWidget::ShowContextMenu(const QPoint& pos)
|
|||
const QClipboard *clipboard = QApplication::clipboard();
|
||||
const QMimeData *mimeData = clipboard->mimeData();
|
||||
bool hasData = mimeData->hasFormat("application/x-companion");
|
||||
QIcon AddIcon;
|
||||
populate_icon(&AddIcon,"add.png");
|
||||
QIcon EditIcon;
|
||||
populate_icon(&EditIcon,"edit.png");
|
||||
QIcon OpenIcon;
|
||||
populate_icon(&OpenIcon,"open.png");
|
||||
QIcon WizardIcon;
|
||||
populate_icon(&WizardIcon,"wizard.png");
|
||||
QIcon ClearIcon;
|
||||
populate_icon(&ClearIcon,"clear.png");
|
||||
QIcon CopyIcon;
|
||||
populate_icon(&CopyIcon,"copy.png");
|
||||
QIcon CutIcon;
|
||||
populate_icon(&CutIcon,"cut.png");
|
||||
QIcon PasteIcon;
|
||||
populate_icon(&PasteIcon,"paste.png");
|
||||
QIcon DuplicateIcon;
|
||||
populate_icon(&DuplicateIcon,"duplicate.png");
|
||||
QIcon CurrentModelIcon;
|
||||
populate_icon(&CurrentModelIcon,"currentmodel.png");
|
||||
QIcon PrintIcon;
|
||||
populate_icon(&PrintIcon,"print.png");
|
||||
QIcon SimulateIcon;
|
||||
populate_icon(&SimulateIcon,"simulate.png");
|
||||
|
||||
QMenu contextMenu;
|
||||
contextMenu.addAction(EditIcon, tr("&Edit"),this,SLOT(OpenEditWindow()));
|
||||
contextMenu.addAction(OpenIcon, tr("&Restore from backup"),this,SLOT(LoadBackup()));
|
||||
contextMenu.addAction(WizardIcon, tr("&Model Wizard"),this,SLOT(OpenWizard()));
|
||||
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"),this,SLOT(OpenEditWindow()));
|
||||
contextMenu.addAction(CompanionIcon("open.png"), tr("&Restore from backup"),this,SLOT(LoadBackup()));
|
||||
contextMenu.addAction(CompanionIcon("wizard.png"), tr("&Model Wizard"),this,SLOT(OpenWizard()));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(ClearIcon, tr("&Delete"),this,SLOT(confirmDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CopyIcon, tr("&Copy"),this,SLOT(copy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CutIcon, tr("&Cut"),this,SLOT(cut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(PasteIcon, tr("&Paste"),this,SLOT(paste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(DuplicateIcon, tr("D&uplicate"),this,SLOT(duplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"),this,SLOT(confirmDelete()),tr("Delete"));
|
||||
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"),this,SLOT(copy()),tr("Ctrl+C"));
|
||||
contextMenu.addAction(CompanionIcon("cut.png"), tr("&Cut"),this,SLOT(cut()),tr("Ctrl+X"));
|
||||
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"),this,SLOT(paste()),tr("Ctrl+V"))->setEnabled(hasData);
|
||||
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("D&uplicate"),this,SLOT(duplicate()),tr("Ctrl+U"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CurrentModelIcon, tr("&Use as default"),this,SLOT(setdefault()));
|
||||
contextMenu.addAction(CompanionIcon("currentmodel.png"), tr("&Use as default"),this,SLOT(setdefault()));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(PrintIcon, tr("P&rint model"),this, SLOT(print()),tr("Alt+R"));
|
||||
contextMenu.addAction(CompanionIcon("print.png"), tr("P&rint model"),this, SLOT(print()),tr("Alt+R"));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(SimulateIcon, tr("&Simulate model"),this, SLOT(simulate()),tr("Alt+S"));
|
||||
contextMenu.addAction(CompanionIcon("simulate.png"), tr("&Simulate model"),this, SLOT(simulate()),tr("Alt+S"));
|
||||
contextMenu.exec(globalPos);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,15 +17,9 @@ preferencesDialog::preferencesDialog(QWidget *parent) :
|
|||
updateLock(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QIcon Icon;
|
||||
populate_icon(&Icon,"preferences.png");
|
||||
this->setWindowIcon(Icon);
|
||||
QIcon LibraryIcon;
|
||||
populate_icon(&LibraryIcon,"library.png");
|
||||
ui->splashLibraryButton->setIcon(LibraryIcon);
|
||||
QIcon ClearIcon;
|
||||
populate_icon(&ClearIcon,"clear.png");
|
||||
ui->clearImageButton->setIcon(ClearIcon);
|
||||
setWindowIcon(CompanionIcon("preferences.png"));
|
||||
ui->splashLibraryButton->setIcon(CompanionIcon("library.png"));
|
||||
ui->clearImageButton->setIcon(CompanionIcon("clear.png"));
|
||||
|
||||
QCheckBox * OptionCheckBox[]= {
|
||||
ui->optionCheckBox_1, ui->optionCheckBox_2, ui->optionCheckBox_3, ui->optionCheckBox_4, ui->optionCheckBox_5, ui->optionCheckBox_6, ui->optionCheckBox_7,
|
||||
|
@ -233,7 +227,7 @@ void preferencesDialog::firmwareChanged()
|
|||
ui->CPU_ID_LE->hide();
|
||||
ui->CPU_ID_LABEL->hide();
|
||||
}
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.beginGroup("FwRevisions");
|
||||
int fwrev = settings.value(variant.id, -1).toInt();
|
||||
settings.endGroup();
|
||||
|
@ -259,7 +253,7 @@ void preferencesDialog::firmwareChanged()
|
|||
|
||||
void preferencesDialog::writeValues()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
if (ui->locale_QB->currentIndex() > 0)
|
||||
settings.setValue("locale", ui->locale_QB->itemData(ui->locale_QB->currentIndex()));
|
||||
else
|
||||
|
@ -392,7 +386,7 @@ void preferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware)
|
|||
|
||||
void preferencesDialog::initSettings()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
int i = ui->locale_QB->findData(settings.value("locale"));
|
||||
if (i < 0) i = 0;
|
||||
ui->locale_QB->setCurrentIndex(i);
|
||||
|
@ -533,7 +527,7 @@ void preferencesDialog::on_fw_dnld_clicked()
|
|||
writeValues();
|
||||
if (!variant.firmware->getUrl(variant.id).isNull()) {
|
||||
if (ui->burnFirmware->isChecked()) {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
current_firmware_variant = getFirmwareVariant();
|
||||
settings.setValue("firmware", current_firmware_variant.id);
|
||||
}
|
||||
|
@ -554,7 +548,7 @@ void preferencesDialog::on_voice_dnld_clicked()
|
|||
void preferencesDialog::on_libraryPathButton_clicked()
|
||||
{
|
||||
ui->ProfSave_PB->setEnabled(true);
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your library folder"), settings.value("libraryPath").toString());
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("libraryPath", fileName);
|
||||
|
@ -564,7 +558,7 @@ void preferencesDialog::on_libraryPathButton_clicked()
|
|||
|
||||
void preferencesDialog::on_snapshotPathButton_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your snapshot folder"), settings.value("snapshotPath").toString());
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("snapshotpath", fileName);
|
||||
|
@ -575,7 +569,7 @@ void preferencesDialog::on_snapshotPathButton_clicked()
|
|||
|
||||
void preferencesDialog::on_snapshotClipboardCKB_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
if (ui->snapshotClipboardCKB->isChecked()) {
|
||||
ui->snapshotPath->setDisabled(true);
|
||||
ui->snapshotPathButton->setDisabled(true);
|
||||
|
@ -591,7 +585,7 @@ void preferencesDialog::on_snapshotClipboardCKB_clicked()
|
|||
|
||||
void preferencesDialog::on_backupPathButton_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), settings.value("backupPath").toString());
|
||||
if (!fileName.isEmpty()) {
|
||||
settings.setValue("backupPath", fileName);
|
||||
|
@ -602,7 +596,7 @@ void preferencesDialog::on_backupPathButton_clicked()
|
|||
|
||||
void preferencesDialog::on_ge_pathButton_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->ge_lineedit->setText(fileName);
|
||||
|
@ -628,7 +622,7 @@ void preferencesDialog::on_splashLibraryButton_clicked()
|
|||
|
||||
void preferencesDialog::on_sdPathButton_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select the folder replicating your SD structure"), settings.value("sdPath").toString());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->sdPath->setText(fileName);
|
||||
|
@ -638,7 +632,7 @@ void preferencesDialog::on_sdPathButton_clicked()
|
|||
|
||||
void preferencesDialog::on_ProfSlot_SB_valueChanged()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
|
||||
settings.beginGroup(profile);
|
||||
|
@ -667,7 +661,7 @@ void preferencesDialog::on_ProfSlot_SB_valueChanged()
|
|||
|
||||
void preferencesDialog::on_ProfSave_PB_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
settings.beginGroup("Profiles");
|
||||
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
|
||||
QString name=ui->ProfName_LE->text();
|
||||
|
@ -706,7 +700,7 @@ void preferencesDialog::on_ProfSave_PB_clicked()
|
|||
|
||||
void preferencesDialog::on_export_PB_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
|
||||
QString name=ui->ProfName_LE->text();
|
||||
if (!name.isEmpty()) {
|
||||
|
@ -727,7 +721,7 @@ void preferencesDialog::on_export_PB_clicked()
|
|||
|
||||
void preferencesDialog::on_import_PB_clicked()
|
||||
{
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString profile=QString("profile%1").arg(ui->ProfSlot_SB->value());
|
||||
QString name=ui->ProfName_LE->text();
|
||||
if (!name.isEmpty()) {
|
||||
|
@ -760,7 +754,7 @@ void preferencesDialog::on_SplashSelect_clicked()
|
|||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), settings.value("lastImagesDir").toString(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
|
@ -837,7 +831,7 @@ void preferencesDialog::on_joystickChkB_clicked() {
|
|||
}
|
||||
|
||||
void preferencesDialog::on_joystickcalButton_clicked() {
|
||||
//QSettings settings("companion", "companion");
|
||||
//QSettings settings;
|
||||
//settings.setValue("joystick-name",ui->joystickCB->currentText());
|
||||
joystickDialog * jd=new joystickDialog(this, ui->joystickCB->currentIndex());
|
||||
jd->exec();
|
||||
|
@ -849,7 +843,7 @@ void preferencesDialog::on_checkFWUpdates_clicked()
|
|||
{
|
||||
FirmwareVariant variant = getFirmwareVariant();
|
||||
if (ui->burnFirmware->isChecked()) {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
current_firmware_variant = variant;
|
||||
settings.setValue("firmware", variant.id);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ simulatorDialog::simulatorDialog(QWidget *parent) :
|
|||
beepVal = 0;
|
||||
beepShow = 0;
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
backLight = settings.value("backLight",0).toInt();
|
||||
bool simuSW=settings.value("simuSW",false).toBool();
|
||||
switch (backLight) {
|
||||
|
@ -211,7 +211,7 @@ void simulatorDialog::setupTimer()
|
|||
void simulatorDialog::onButtonPressed(int value)
|
||||
{
|
||||
if (value==Qt::Key_Print) {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
bool toclipboard=settings.value("snapshot_to_clipboard", false).toBool();
|
||||
QString fileName ="";
|
||||
if (!toclipboard) {
|
||||
|
|
|
@ -9,12 +9,8 @@
|
|||
splashLibrary::splashLibrary(QWidget *parent, QString * fileName) : QDialog(parent), ui(new Ui::splashLibrary) {
|
||||
splashFileName = fileName;
|
||||
ui->setupUi(this);
|
||||
QIcon NextIcon;
|
||||
populate_icon(&NextIcon,"arrow-right.png");
|
||||
QIcon PrevIcon;
|
||||
populate_icon(&PrevIcon,"arrow-left.png");
|
||||
ui->nextPage->setIcon(NextIcon);
|
||||
ui->prevPage->setIcon(PrevIcon);
|
||||
ui->nextPage->setIcon(CompanionIcon("arrow-right.png"));
|
||||
ui->prevPage->setIcon(CompanionIcon("arrow-left.png"));
|
||||
page = 0;
|
||||
getFileList();
|
||||
if (imageList.size() > 20) {
|
||||
|
@ -65,7 +61,7 @@ void splashLibrary::setupPage(int page) {
|
|||
}
|
||||
|
||||
void splashLibrary::getFileList() {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
imageList.clear();
|
||||
if (settings.value("embedded_splashes", 0).toInt() == 0) {
|
||||
QDir myRes(":/images/library");
|
||||
|
|
|
@ -30,7 +30,7 @@ xsimulatorDialog::xsimulatorDialog(QWidget *parent) :
|
|||
ui->setupUi(this);
|
||||
ui->lcd->setFocus();
|
||||
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
ui->lcd->setBackgroundColor(47, 123, 227);
|
||||
setupSticks();
|
||||
resize(0, 0); // to force min height, min width
|
||||
|
@ -179,7 +179,7 @@ void xsimulatorDialog::setupTimer()
|
|||
void xsimulatorDialog::onButtonPressed(int value)
|
||||
{
|
||||
if (value==Qt::Key_Print) {
|
||||
QSettings settings("companion", "companion");
|
||||
QSettings settings;
|
||||
bool toclipboard=settings.value("snapshot_to_clipboard", false).toBool();
|
||||
QString fileName ="";
|
||||
if (!toclipboard) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue