From 59f7df9176cf93323335b07cc25bb447ca33a584 Mon Sep 17 00:00:00 2001 From: Claudiu Pop Date: Tue, 6 Feb 2018 12:22:09 +0200 Subject: [PATCH] Don't show the update firmware button until the firmware is downloaded if the firmware is not downloaded when the user presses the update button the application would show an error and the user would need to replug the m1k. This change is preventing this to happen Signed-off-by: Claudiu Pop --- SMU.cpp | 1 + SMU.h | 1 + qml/DeviceManagerPane.qml | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/SMU.cpp b/SMU.cpp index 7bd0b0e..973b7a4 100644 --- a/SMU.cpp +++ b/SMU.cpp @@ -167,6 +167,7 @@ void SessionItem::handleDownloadedFirmware() { FileIO f; f.writeRawByFilename(getTmpPathForFirmware() + "/firmware.bin", m_firmware_fd->downloadedData()); + emit firmwareDownloaded(); disconnect(m_firmware_fd, SIGNAL(downloaded()), this, SLOT(handleDownloadedFirmware())); } diff --git a/SMU.h b/SMU.h index b9ba840..7892db6 100644 --- a/SMU.h +++ b/SMU.h @@ -63,6 +63,7 @@ signals: void finished(unsigned status); void attached(smu::Device* device); void detached(smu::Device* device); + void firmwareDownloaded(); protected slots: void onFinished(); diff --git a/qml/DeviceManagerPane.qml b/qml/DeviceManagerPane.qml index ff978ef..6f98577 100644 --- a/qml/DeviceManagerPane.qml +++ b/qml/DeviceManagerPane.qml @@ -11,6 +11,7 @@ ColumnLayout { property bool updateNeeded: false property bool justUpdated: false + property bool firmwareDownloaded: false function addProgModeDeviceToList() { devicesModel.insert(devicesModel.count, @@ -348,6 +349,9 @@ ColumnLayout { onDevicesChanged: { deviceManagerListFill(); } + onFirmwareDownloaded:{ + firmwareDownloaded = true; + } } } Rectangle { @@ -360,7 +364,7 @@ ColumnLayout { width: 145 radius: 4 color: 'grey' - visible: updateNeeded === true + visible: updateNeeded === true && firmwareDownloaded === true Rectangle { anchors.horizontalCenter: parent.horizontalCenter