Companion new error detected on flash (when no device found)
This commit is contained in:
@@ -25,9 +25,9 @@
|
|||||||
|
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt):
|
DownloadDialog::DownloadDialog(QWidget *parent, QString src, QString tgt):
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::downloadDialog),
|
ui(new Ui::DownloadDialog),
|
||||||
reply(nullptr),
|
reply(nullptr),
|
||||||
file(nullptr),
|
file(nullptr),
|
||||||
aborted(false)
|
aborted(false)
|
||||||
@@ -58,13 +58,13 @@ downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadDialog::~downloadDialog()
|
DownloadDialog::~DownloadDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
delete file;
|
delete file;
|
||||||
}
|
}
|
||||||
|
|
||||||
void downloadDialog::reject()
|
void DownloadDialog::reject()
|
||||||
{
|
{
|
||||||
if (reply && reply->isRunning()) {
|
if (reply && reply->isRunning()) {
|
||||||
aborted = true;
|
aborted = true;
|
||||||
@@ -75,7 +75,7 @@ void downloadDialog::reject()
|
|||||||
QDialog::reject();
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void downloadDialog::httpFinished()
|
void DownloadDialog::httpFinished()
|
||||||
{
|
{
|
||||||
file->flush();
|
file->flush();
|
||||||
file->close();
|
file->close();
|
||||||
@@ -98,20 +98,20 @@ void downloadDialog::httpFinished()
|
|||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void downloadDialog::httpReadyRead()
|
void DownloadDialog::httpReadyRead()
|
||||||
{
|
{
|
||||||
if (file) {
|
if (file) {
|
||||||
file->write(reply->readAll());
|
file->write(reply->readAll());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void downloadDialog::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
|
void DownloadDialog::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
|
||||||
{
|
{
|
||||||
ui->progressBar->setMaximum(totalBytes);
|
ui->progressBar->setMaximum(totalBytes);
|
||||||
ui->progressBar->setValue(bytesRead);
|
ui->progressBar->setValue(bytesRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void downloadDialog::fileError()
|
void DownloadDialog::fileError()
|
||||||
{
|
{
|
||||||
delete file;
|
delete file;
|
||||||
file = NULL;
|
file = NULL;
|
||||||
@@ -119,7 +119,7 @@ void downloadDialog::fileError()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void downloadDialog::closeEvent( QCloseEvent * event)
|
void DownloadDialog::closeEvent( QCloseEvent * event)
|
||||||
{
|
{
|
||||||
// Delay closing 2 seconds to avoid unpleasant flashing download dialogs
|
// Delay closing 2 seconds to avoid unpleasant flashing download dialogs
|
||||||
QTime closeTime= QTime::currentTime().addSecs(2);
|
QTime closeTime= QTime::currentTime().addSecs(2);
|
||||||
|
|||||||
@@ -28,31 +28,37 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class downloadDialog;
|
class DownloadDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class downloadDialog : public QDialog
|
class DownloadDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit downloadDialog(QWidget *parent = 0, QString src = "", QString tgt = "");
|
explicit DownloadDialog(QWidget *parent = 0, QString src = "", QString tgt = "");
|
||||||
~downloadDialog();
|
|
||||||
|
~DownloadDialog();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
virtual void reject() override;
|
virtual void reject() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void fileError();
|
void fileError();
|
||||||
|
|
||||||
void httpFinished();
|
void httpFinished();
|
||||||
|
|
||||||
void httpReadyRead();
|
void httpReadyRead();
|
||||||
|
|
||||||
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
|
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if 0
|
#if 0
|
||||||
void closeEvent( QCloseEvent * event);
|
void closeEvent(QCloseEvent * event);
|
||||||
#endif
|
#endif
|
||||||
Ui::downloadDialog *ui;
|
Ui::DownloadDialog *ui;
|
||||||
|
|
||||||
QNetworkAccessManager qnam;
|
QNetworkAccessManager qnam;
|
||||||
QNetworkReply *reply;
|
QNetworkReply *reply;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>downloadDialog</class>
|
<class>DownloadDialog</class>
|
||||||
<widget class="QDialog" name="downloadDialog">
|
<widget class="QDialog" name="DownloadDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>downloadDialog</receiver>
|
<receiver>DownloadDialog</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>downloadDialog</receiver>
|
<receiver>DownloadDialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
|
|||||||
@@ -36,10 +36,10 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FlashFirmwareDialog::FlashFirmwareDialog(QWidget *parent):
|
FlashFirmwareDialog::FlashFirmwareDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FlashFirmwareDialog),
|
ui(new Ui::FlashFirmwareDialog),
|
||||||
fwName(g.profile[g.id()].fwName())
|
fwName(g.profile[g.id()].fwName())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ MainWindow::~MainWindow()
|
|||||||
{
|
{
|
||||||
if (windowsListActions) {
|
if (windowsListActions) {
|
||||||
delete windowsListActions;
|
delete windowsListActions;
|
||||||
windowsListActions = NULL;
|
windowsListActions = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ void MainWindow::checkForUpdates()
|
|||||||
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
||||||
QNetworkReply * repl = networkManager->get(request);
|
QNetworkReply * repl = networkManager->get(request);
|
||||||
if (downloadDialog_forWait)
|
if (downloadDialog_forWait)
|
||||||
connect(downloadDialog_forWait, &downloadDialog::rejected, repl, &QNetworkReply::abort);
|
connect(downloadDialog_forWait, &DownloadDialog::rejected, repl, &QNetworkReply::abort);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onUpdatesError(const QString &err)
|
void MainWindow::onUpdatesError(const QString &err)
|
||||||
@@ -305,7 +305,7 @@ void MainWindow::onUpdatesError(const QString &err)
|
|||||||
void MainWindow::openUpdatesWaitDialog()
|
void MainWindow::openUpdatesWaitDialog()
|
||||||
{
|
{
|
||||||
if (!downloadDialog_forWait) {
|
if (!downloadDialog_forWait) {
|
||||||
downloadDialog_forWait = new downloadDialog(NULL, tr("Checking for updates"));
|
downloadDialog_forWait = new DownloadDialog(nullptr, tr("Checking for updates"));
|
||||||
downloadDialog_forWait->show();
|
downloadDialog_forWait->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,7 +315,7 @@ void MainWindow::closeUpdatesWaitDialog()
|
|||||||
if (downloadDialog_forWait) {
|
if (downloadDialog_forWait) {
|
||||||
downloadDialog_forWait->close();
|
downloadDialog_forWait->close();
|
||||||
delete downloadDialog_forWait;
|
delete downloadDialog_forWait;
|
||||||
downloadDialog_forWait = NULL;
|
downloadDialog_forWait = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
|||||||
|
|
||||||
if (currentVersion == 0) {
|
if (currentVersion == 0) {
|
||||||
QString rn = getCurrentFirmware()->getReleaseNotesUrl();
|
QString rn = getCurrentFirmware()->getReleaseNotesUrl();
|
||||||
QAbstractButton *rnButton = NULL;
|
QAbstractButton *rnButton = nullptr;
|
||||||
msgBox.setText(tr("Firmware %1 does not seem to have ever been downloaded.\nVersion %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.")
|
msgBox.setText(tr("Firmware %1 does not seem to have ever been downloaded.\nVersion %2 is available.\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.")
|
||||||
.arg(Firmware::getCurrentVariant()->getId()).arg(fullVersionString));
|
.arg(Firmware::getCurrentVariant()->getId()).arg(fullVersionString));
|
||||||
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
||||||
@@ -508,7 +508,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
|||||||
}
|
}
|
||||||
else if (version > currentVersion) {
|
else if (version > currentVersion) {
|
||||||
QString rn = getCurrentFirmware()->getReleaseNotesUrl();
|
QString rn = getCurrentFirmware()->getReleaseNotesUrl();
|
||||||
QAbstractButton *rnButton = NULL;
|
QAbstractButton *rnButton = nullptr;
|
||||||
msgBox.setText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.")
|
msgBox.setText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now?\n\nWe recommend you view the release notes using the button below to learn about any changes that may be important to you.")
|
||||||
.arg(Firmware::getCurrentVariant()->getId()).arg(currentVersionString).arg(fullVersionString));
|
.arg(Firmware::getCurrentVariant()->getId()).arg(currentVersionString).arg(fullVersionString));
|
||||||
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
|
||||||
@@ -574,7 +574,7 @@ void MainWindow::startFirmwareDownload()
|
|||||||
if (!filename.isEmpty()) {
|
if (!filename.isEmpty()) {
|
||||||
g.profile[g.id()].fwName(filename);
|
g.profile[g.id()].fwName(filename);
|
||||||
g.flashDir(QFileInfo(filename).dir().absolutePath());
|
g.flashDir(QFileInfo(filename).dir().absolutePath());
|
||||||
downloadDialog * dd = new downloadDialog(this, url, filename);
|
DownloadDialog * dd = new DownloadDialog(this, url, filename);
|
||||||
connect(dd, SIGNAL(accepted()), this, SLOT(firmwareDownloadAccepted()));
|
connect(dd, SIGNAL(accepted()), this, SLOT(firmwareDownloadAccepted()));
|
||||||
dd->exec();
|
dd->exec();
|
||||||
}
|
}
|
||||||
@@ -1576,7 +1576,7 @@ void MainWindow::updateWindowActionTitle(const QMdiSubWindow * win, QAction * ac
|
|||||||
|
|
||||||
void MainWindow::onSubwindowTitleChanged()
|
void MainWindow::onSubwindowTitleChanged()
|
||||||
{
|
{
|
||||||
QMdiSubWindow * win = NULL;
|
QMdiSubWindow * win = nullptr;
|
||||||
if ((win = qobject_cast<QMdiSubWindow *>(sender()->parent())))
|
if ((win = qobject_cast<QMdiSubWindow *>(sender()->parent())))
|
||||||
updateWindowActionTitle(win);
|
updateWindowActionTitle(win);
|
||||||
}
|
}
|
||||||
@@ -1591,7 +1591,7 @@ void MainWindow::onChangeWindowAction(QAction * act)
|
|||||||
if (!act->isChecked())
|
if (!act->isChecked())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QMdiSubWindow * win = NULL;
|
QMdiSubWindow * win = nullptr;
|
||||||
if (act->property("window_ptr").canConvert<QMdiSubWindow *>())
|
if (act->property("window_ptr").canConvert<QMdiSubWindow *>())
|
||||||
win = act->property("window_ptr").value<QMdiSubWindow *>();
|
win = act->property("window_ptr").value<QMdiSubWindow *>();
|
||||||
if (win)
|
if (win)
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ class QAction;
|
|||||||
class QMenu;
|
class QMenu;
|
||||||
class QMdiArea;
|
class QMdiArea;
|
||||||
class QMdiSubWindow;
|
class QMdiSubWindow;
|
||||||
class QSignalMapper;
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
@@ -164,10 +163,9 @@ class MainWindow : public QMainWindow
|
|||||||
bool checkProfileRadioExists(int profId);
|
bool checkProfileRadioExists(int profId);
|
||||||
|
|
||||||
QMdiArea *mdiArea;
|
QMdiArea *mdiArea;
|
||||||
QSignalMapper *windowMapper;
|
|
||||||
|
|
||||||
QString installer_fileName;
|
QString installer_fileName;
|
||||||
downloadDialog * downloadDialog_forWait;
|
DownloadDialog * downloadDialog_forWait;
|
||||||
unsigned int checkForUpdatesState;
|
unsigned int checkForUpdatesState;
|
||||||
QString firmwareVersionString;
|
QString firmwareVersionString;
|
||||||
|
|
||||||
|
|||||||
@@ -36,18 +36,18 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FlashProcess::FlashProcess(const QString &cmd, const QStringList &args, ProgressWidget *progress):
|
FlashProcess::FlashProcess(const QString & cmd, const QStringList & args, ProgressWidget * progress):
|
||||||
progress(progress),
|
progress(progress),
|
||||||
cmd(cmd),
|
cmd(cmd),
|
||||||
args(args),
|
args(args),
|
||||||
process(new QProcess(this)),
|
process(new QProcess(this)),
|
||||||
hasErrors(false),
|
hasErrors(false),
|
||||||
lfuse(0),
|
lfuse(0),
|
||||||
hfuse(0),
|
hfuse(0),
|
||||||
efuse(0),
|
efuse(0),
|
||||||
flashPhase(READING)
|
flashPhase(READING)
|
||||||
#if !__GNUC__
|
#if !__GNUC__
|
||||||
, killTimer(NULL)
|
, killTimer(nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
connect(process, SIGNAL(started()),this, SLOT(onStarted()));
|
connect(process, SIGNAL(started()),this, SLOT(onStarted()));
|
||||||
@@ -66,7 +66,7 @@ FlashProcess::~FlashProcess()
|
|||||||
bool FlashProcess::run()
|
bool FlashProcess::run()
|
||||||
{
|
{
|
||||||
if (!QFile::exists(cmd)) {
|
if (!QFile::exists(cmd)) {
|
||||||
QMessageBox::critical(NULL, CPN_STR_APP_NAME, tr("Executable %1 not found").arg(cmd));
|
QMessageBox::critical(nullptr, CPN_STR_APP_NAME, tr("Executable %1 not found").arg(cmd));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ void FlashProcess::analyseStandardOutput(const QString &text)
|
|||||||
if (text.contains("Complete ")) {
|
if (text.contains("Complete ")) {
|
||||||
#if !__GNUC__
|
#if !__GNUC__
|
||||||
delete killTimer;
|
delete killTimer;
|
||||||
killTimer = NULL;
|
killTimer = nullptr;
|
||||||
#endif
|
#endif
|
||||||
int start = text.indexOf("Complete ");
|
int start = text.indexOf("Complete ");
|
||||||
int end = text.indexOf("%");
|
int end = text.indexOf("%");
|
||||||
@@ -187,6 +187,10 @@ void FlashProcess::analyseStandardOutput(const QString &text)
|
|||||||
if (text.contains("-E-")) {
|
if (text.contains("-E-")) {
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (text.contains("Cannot open device")) {
|
||||||
|
hasErrors = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlashProcess::analyseStandardError(const QString &text)
|
void FlashProcess::analyseStandardError(const QString &text)
|
||||||
@@ -274,15 +278,15 @@ void FlashProcess::errorWizard()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fwexist==false) {
|
if (fwexist==false) {
|
||||||
QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr));
|
QMessageBox::warning(nullptr, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Firmware *firmware = getCurrentFirmware();
|
Firmware *firmware = getCurrentFirmware();
|
||||||
QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->getName()));
|
QMessageBox::warning(nullptr, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (output.contains("No DFU capable USB device found")){
|
else if (output.contains("No DFU capable USB device found")){
|
||||||
QMessageBox::warning(NULL, "Companion - Tip of the day", tr("Your radio does not seem connected to USB or the driver is not initialized!!!."));
|
QMessageBox::warning(nullptr, "Companion - Tip of the day", tr("Your radio does not seem connected to USB or the driver is not initialized!!!."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3294,7 +3294,7 @@ Si vide, la ligne est toujours active.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../flashfirmwaredialog.cpp" line="329"/>
|
<location filename="../flashfirmwaredialog.cpp" line="329"/>
|
||||||
<source>Flashing done</source>
|
<source>Flashing done</source>
|
||||||
<translation>Programmation Terminé</translation>
|
<translation>Programmation terminée</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
|||||||
Reference in New Issue
Block a user