5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #include "fwpreferencesdialog.h"
22 #include "ui_fwpreferencesdialog.h"
23 #include "mainwindow.h"
24 #include "eeprominterface.h"
27 #include <QDesktopServices>
30 #define OPENTX_SDCARD_DOWNLOADS "https://downloads.open-tx.org/2.2/sdcard/"
31 #define OPENTX_NIGHT_SDCARD_DOWNLOADS "https://downloads.open-tx.org/2.2/nightlies/sdcard/"
33 FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget
*parent
) :
35 ui(new Ui::FirmwarePreferencesDialog
)
38 setWindowIcon(CompanionIcon("fwpreferences.png"));
42 FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
47 void FirmwarePreferencesDialog::initSettings()
49 ui
->fwTypeLbl
->setText(g
.profile
[g
.id()].fwType());
50 int version
= g
.fwRev
.get(g
.profile
[g
.id()].fwType());
52 ui
->lastRevisionLbl
->setText(index2version(version
));
56 void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
58 MainWindow
* mw
= (MainWindow
*)this->parent();
59 mw
->checkForFirmwareUpdate();
63 void FirmwarePreferencesDialog::on_fw_dnld_clicked()
65 MainWindow
* mw
= (MainWindow
*)this->parent();
66 mw
->dowloadLastFirmwareUpdate();
70 void FirmwarePreferencesDialog::on_sd_dnld_clicked()
72 QString url
= g
.useFirmwareNightlyBuilds() ? OPENTX_NIGHT_SDCARD_DOWNLOADS
: OPENTX_SDCARD_DOWNLOADS
;
73 QString fwType
= g
.profile
[g
.id()].fwType();
74 QStringList list
= fwType
.split("-");
75 QString firmware
= QString("%1-%2").arg(list
[0]).arg(list
[1]);
76 if (!g
.useFirmwareNightlyBuilds()) {
77 url
.append(QString("%1/").arg(firmware
));
79 QDesktopServices::openUrl(url
);