diff options
author | Anton Lundin <glance@acc.umu.se> | 2015-01-20 22:40:52 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-01-21 17:03:24 +1200 |
commit | 724170f4b6840aaf65b07bbdb0975f350bdf171a (patch) | |
tree | 28b66b6292caa8b33066ac99c5f3d480c5107a10 | |
parent | 1d67bae745e491cfe28806dc99f0db005649083d (diff) | |
download | subsurface-724170f4b6840aaf65b07bbdb0975f350bdf171a.tar.gz |
Connect the progress events to the progress bar
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | configuredivecomputer.cpp | 10 | ||||
-rw-r--r-- | configuredivecomputer.h | 2 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerdialog.cpp | 4 |
3 files changed, 16 insertions, 0 deletions
diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp index 4f7e873fe..ec69c776a 100644 --- a/configuredivecomputer.cpp +++ b/configuredivecomputer.cpp @@ -30,6 +30,7 @@ void ConfigureDiveComputer::readSettings(device_data_t *data) connect(readThread, SIGNAL(error(QString)), this, SLOT(setError(QString))); connect(readThread, SIGNAL(devicedetails(DeviceDetails *)), this, SIGNAL(deviceDetailsChanged(DeviceDetails *))); + connect(readThread, SIGNAL(progress(int)), this, SLOT(progressEvent(int))); readThread->start(); } @@ -45,6 +46,7 @@ void ConfigureDiveComputer::saveDeviceDetails(DeviceDetails *details, device_dat connect(writeThread, SIGNAL(finished()), this, SLOT(writeThreadFinished()), Qt::QueuedConnection); connect(writeThread, SIGNAL(error(QString)), this, SLOT(setError(QString))); + connect(writeThread, SIGNAL(progress(int)), this, SLOT(progressEvent(int))); writeThread->setDeviceDetails(details); writeThread->start(); @@ -504,6 +506,8 @@ void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t connect(firmwareThread, SIGNAL(finished()), this, SLOT(firmwareThreadFinished()), Qt::QueuedConnection); connect(firmwareThread, SIGNAL(error(QString)), this, SLOT(setError(QString))); + connect(firmwareThread, SIGNAL(progress(int)), this, SLOT(progressEvent(int))); + firmwareThread->start(); } @@ -518,10 +522,16 @@ void ConfigureDiveComputer::resetSettings(device_data_t *data) connect(resetThread, SIGNAL(finished()), this, SLOT(resetThreadFinished()), Qt::QueuedConnection); connect(resetThread, SIGNAL(error(QString)), this, SLOT(setError(QString))); + connect(resetThread, SIGNAL(progress(int)), this, SLOT(progressEvent(int))); resetThread->start(); } +void ConfigureDiveComputer::progressEvent(int percent) +{ + emit progress(percent); +} + void ConfigureDiveComputer::setState(ConfigureDiveComputer::states newState) { currentState = newState; diff --git a/configuredivecomputer.h b/configuredivecomputer.h index 6cc9b8fa5..1a137cf8c 100644 --- a/configuredivecomputer.h +++ b/configuredivecomputer.h @@ -38,6 +38,7 @@ public: void startFirmwareUpdate(QString fileName, device_data_t *data); void resetSettings(device_data_t *data); signals: + void progress(int percent); void message(QString msg); void error(QString err); void stateChanged(states newState); @@ -51,6 +52,7 @@ private: void setState(states newState); private slots: + void progressEvent(int percent); void readThreadFinished(); void writeThreadFinished(); void resetThreadFinished(); diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp index ab9f032f9..182bf76cb 100644 --- a/qt-ui/configuredivecomputerdialog.cpp +++ b/qt-ui/configuredivecomputerdialog.cpp @@ -114,6 +114,7 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDia deviceDetails = new DeviceDetails(this); config = new ConfigureDiveComputer(); + connect(config, SIGNAL(progress(int)), ui.progressBar, SLOT(setValue(int))); connect(config, SIGNAL(error(QString)), this, SLOT(configError(QString))); connect(config, SIGNAL(message(QString)), this, SLOT(configMessage(QString))); connect(config, SIGNAL(deviceDetailsChanged(DeviceDetails *)), @@ -676,6 +677,7 @@ void ConfigureDiveComputerDialog::readSettings() ui.progressBar->setTextVisible(true); getDeviceData(); + ui.progressBar->reset(); config->readSettings(&device_data); } @@ -686,6 +688,7 @@ void ConfigureDiveComputerDialog::resetSettings() ui.progressBar->setTextVisible(true); getDeviceData(); + ui.progressBar->reset(); config->resetSettings(&device_data); } @@ -1069,6 +1072,7 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked() ui.progressBar->setTextVisible(true); getDeviceData(); + ui.progressBar->reset(); config->startFirmwareUpdate(firmwarePath, &device_data); } } |