Emit the successful message the right way

The successful message was emitted in a some what older way then the
other messages so it was always emitted, even on error.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2014-12-07 23:32:08 +01:00 committed by Dirk Hohndel
parent a696da9146
commit ac207ee5ff
4 changed files with 4 additions and 10 deletions

View file

@ -556,7 +556,10 @@ void ConfigureDiveComputer::setError(QString err)
void ConfigureDiveComputer::readThreadFinished()
{
setState(DONE);
emit readFinished();
if (readThread->lastError.isEmpty()) {
//No error
emit message(tr("Dive computer details read successfully"));
}
}
void ConfigureDiveComputer::writeThreadFinished()

View file

@ -41,8 +41,6 @@ public:
signals:
void message(QString msg);
void error(QString err);
void readFinished();
void writeFinished();
void stateChanged(states newState);
void deviceDetailsChanged(DeviceDetails *newDetails);

View file

@ -111,7 +111,6 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
config = new ConfigureDiveComputer(this);
connect(config, SIGNAL(error(QString)), this, SLOT(configError(QString)));
connect(config, SIGNAL(message(QString)), this, SLOT(configMessage(QString)));
connect(config, SIGNAL(readFinished()), this, SLOT(deviceReadFinished()));
connect(config, SIGNAL(deviceDetailsChanged(DeviceDetails*)),
this, SLOT(deviceDetailsReceived(DeviceDetails*)));
connect(ui.retrieveDetails, SIGNAL(clicked()), this, SLOT(readSettings()));
@ -616,11 +615,6 @@ void ConfigureDiveComputerDialog::on_cancel_clicked()
this->close();
}
void ConfigureDiveComputerDialog::deviceReadFinished()
{
ui.statusLabel->setText(tr("Dive computer details read successfully."));
}
void ConfigureDiveComputerDialog::on_saveSettingsPushButton_clicked()
{
populateDeviceDetails();

View file

@ -62,7 +62,6 @@ private slots:
void configMessage(QString msg);
void configError(QString err);
void on_cancel_clicked();
void deviceReadFinished();
void on_saveSettingsPushButton_clicked();
void deviceDetailsReceived(DeviceDetails *newDeviceDetails);
void reloadValues();