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"
27 const char * const OPENTX_SDCARD_DOWNLOAD_URL
[] = {
28 "https://downloads.open-tx.org/2.2/release/sdcard/",
29 "https://downloads.open-tx.org/2.2/rc/sdcard/",
30 "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
= qobject_cast
<MainWindow
*>(this->parent());
59 mw
->checkForFirmwareUpdate();
63 void FirmwarePreferencesDialog::on_fw_dnld_clicked()
65 MainWindow
* mw
= qobject_cast
<MainWindow
*>(this->parent());
66 mw
->dowloadLastFirmwareUpdate();
70 void FirmwarePreferencesDialog::on_sd_dnld_clicked()
72 QString url
= OPENTX_SDCARD_DOWNLOAD_URL
[g
.boundedOpenTxBranch()];
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
.boundedOpenTxBranch() != BRANCH_NIGHTLY_UNSTABLE
) {
77 url
.append(QString("%1/").arg(firmware
));
79 QDesktopServices::openUrl(url
);