Device: allow status updates from all methods

turned statusCallback into a member of Device (instead of a parameter to
download() and preview(). This allows all methods to access it, directly
and provide better feedback during open/close/erase.
This commit is contained in:
Rainer Clasen
2012-02-11 15:07:31 +01:00
parent e2fb9c6026
commit 43dfc3eb85
9 changed files with 32 additions and 38 deletions

View File

@@ -266,11 +266,10 @@ DownloadRideDialog::downloadClicked()
QList<DeviceDownloadFile> files;
DevicesPtr devtype = Devices::getType(deviceCombo->currentText());
DevicePtr device = devtype->newDevice( dev );
DevicePtr device = devtype->newDevice( dev,
boost::bind(&DownloadRideDialog::updateStatus, this, _1) );
if( ! device->preview(
boost::bind(&DownloadRideDialog::updateStatus, this, _1),
err ) ){
if( ! device->preview( err ) ){
QMessageBox::information(this, tr("Preview failed"), err);
updateAction( actionIdle );
@@ -287,7 +286,6 @@ DownloadRideDialog::downloadClicked()
if (!device->download( home, files,
boost::bind(&DownloadRideDialog::isCancelled, this),
boost::bind(&DownloadRideDialog::updateStatus, this, _1),
boost::bind(&DownloadRideDialog::updateProgress, this, _1),
err))
{
@@ -398,7 +396,8 @@ DownloadRideDialog::eraseClicked()
}
assert(dev);
DevicesPtr devtype = Devices::getType(deviceCombo->currentText());
DevicePtr device = devtype->newDevice( dev );
DevicePtr device = devtype->newDevice( dev,
boost::bind(&DownloadRideDialog::updateStatus, this, _1) );
QString err;
if( device->cleanup( err) )