Attempt to fix the progress bar issue on Companion Read Firmware function (DFU mode)
This commit is contained in:
@@ -54,7 +54,7 @@ DownloadDialog::DownloadDialog(QWidget *parent, QString src, QString tgt):
|
||||
reply = qnam.get(QNetworkRequest(QUrl(src)));
|
||||
connect(reply, SIGNAL(finished()), this, SLOT(httpFinished()));
|
||||
connect(reply, SIGNAL(readyRead()), this, SLOT(httpReadyRead()));
|
||||
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateDataReadProgress(qint64,qint64)));
|
||||
connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateDataReadProgress(qint64, qint64)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ void FlashFirmwareDialog::updateUI()
|
||||
}
|
||||
|
||||
QImage image;
|
||||
switch(imageSource) {
|
||||
switch (imageSource) {
|
||||
case FIRMWARE:
|
||||
ui->useFirmwareSplash->setChecked(true);
|
||||
image = firmware.getSplash();
|
||||
|
||||
@@ -134,15 +134,18 @@ void FlashProcess::onKillTimerElapsed()
|
||||
#endif
|
||||
}
|
||||
|
||||
void FlashProcess::analyseStandardOutput(const QString &text)
|
||||
void FlashProcess::analyseStandardOutput(const QString & text)
|
||||
{
|
||||
|
||||
// qDebug() << text;
|
||||
|
||||
currStdoutLine.append(text);
|
||||
if (currStdoutLine.contains("size = ")) {
|
||||
int pos = currStdoutLine.lastIndexOf("size = ");
|
||||
QString temp = currStdoutLine.mid(pos+7);
|
||||
pos = temp.lastIndexOf("\n");
|
||||
int size = temp.left(pos).toInt();
|
||||
progress->setMaximum(size/2048);
|
||||
progress->setMaximum(size / 2048);
|
||||
}
|
||||
if (currStdoutLine.contains("\n")) {
|
||||
int nlPos = currStdoutLine.lastIndexOf("\n");
|
||||
@@ -168,7 +171,15 @@ void FlashProcess::analyseStandardOutput(const QString &text)
|
||||
int end = text.indexOf("%");
|
||||
if (start > 0) {
|
||||
start += 9;
|
||||
int value = text.mid(start, end-start).toInt();
|
||||
int value = text.mid(start, end - start).toInt();
|
||||
progress->setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
if (text.contains("Upload\t[")) {
|
||||
int end = text.indexOf("%");
|
||||
if (end > 0) {
|
||||
int value = text.mid(end - 3, 3).toInt();
|
||||
progress->setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +253,6 @@ void resetAvrdudeFuses(bool eepromProtect, ProgressWidget * progress)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool readFirmware(const QString & filename, ProgressWidget * progress)
|
||||
{
|
||||
bool result = false;
|
||||
@@ -274,7 +273,7 @@ bool readFirmware(const QString & filename, ProgressWidget * progress)
|
||||
}
|
||||
}
|
||||
|
||||
if (result == false) {
|
||||
if (!result) {
|
||||
qDebug() << "readFirmware: reading" << filename << "with" << getRadioInterfaceCmd() << getReadFirmwareArgs(filename);
|
||||
FlashProcess flashProcess(getRadioInterfaceCmd(), getReadFirmwareArgs(filename), progress);
|
||||
result = flashProcess.run();
|
||||
|
||||
Reference in New Issue
Block a user