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 FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget
* parent
) :
29 ui(new Ui::FirmwarePreferencesDialog
)
32 setWindowIcon(CompanionIcon("fwpreferences.png"));
34 MainWindow
* mw
= qobject_cast
<MainWindow
*>(this->parent());
36 connect(mw
, &MainWindow::firmwareDownloadCompleted
, this, &FirmwarePreferencesDialog::initSettings
);
39 FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
44 void FirmwarePreferencesDialog::initSettings()
46 ui
->fwTypeLbl
->setText(g
.currentProfile().fwType());
47 int version
= g
.fwRev
.get(g
.currentProfile().fwType());
49 ui
->lastRevisionLbl
->setText(index2version(version
));
51 ui
->lastRevisionLbl
->setText(tr("Unknown"));
54 void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
56 MainWindow
* mw
= qobject_cast
<MainWindow
*>(this->parent());
58 mw
->checkForFirmwareUpdate();
61 void FirmwarePreferencesDialog::on_fw_dnld_clicked()
63 MainWindow
* mw
= qobject_cast
<MainWindow
*>(this->parent());
65 mw
->dowloadLastFirmwareUpdate();
68 void FirmwarePreferencesDialog::on_sd_dnld_clicked()
70 QString url
= g
.openTxCurrentDownloadBranchUrl() % QStringLiteral("sdcard/");
71 QString fwType
= g
.profile
[g
.id()].fwType();
72 QStringList list
= fwType
.split("-");
73 QString firmware
= QString("%1-%2").arg(list
[0]).arg(list
[1]);
74 if (g
.boundedOpenTxBranch() != AppData::BRANCH_NIGHTLY_UNSTABLE
) {
75 url
.append(QString("%1/").arg(firmware
));
77 QDesktopServices::openUrl(url
);