1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

Add an object saving completion message, so that the user knows when saving is finished.

This commit is contained in:
elafargue 2011-06-04 14:32:15 +02:00
parent 2387958422
commit 864dbb0ab5
4 changed files with 14 additions and 2 deletions

View File

@ -172,6 +172,7 @@ void UAVObjectUtilManager::objectPersistenceOperationFailed()
obj->disconnect(this);
queue.dequeue(); // We can now remove the object, it failed anyway.
saveState = IDLE;
emit saveCompleted(obj->getField("ObjectID")->getValue().toInt(), false);
saveNextObject();
}
}
@ -199,6 +200,7 @@ void UAVObjectUtilManager::objectPersistenceUpdated(UAVObject * obj)
obj->disconnect(this);
queue.dequeue(); // We can now remove the object, it's done.
saveState = IDLE;
emit saveCompleted(obj->getField("ObjectID")->getValue().toInt(), true);
saveNextObject();
}
}

View File

@ -67,6 +67,8 @@ public:
UAVObjectManager* getObjectManager();
void saveObjectToSD(UAVObject *obj);
signals:
void saveCompleted(int objectID, bool status);
private:
QMutex *mutex;

View File

@ -84,6 +84,7 @@ void ImportSummaryDialog::doTheSaving()
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVObjectUtilManager *utilManager = pm->getObject<UAVObjectUtilManager>();
connect(utilManager, SIGNAL(saveCompleted(int,bool)), this, SLOT(updateSaveCompletion()));
for(int i=0; i < ui->importSummaryList->rowCount(); i++) {
QString uavObjectName = ui->importSummaryList->item(i,1)->text();
@ -91,12 +92,17 @@ void ImportSummaryDialog::doTheSaving()
if (box->isChecked()) {
UAVObject* obj = objManager->getObject(uavObjectName);
utilManager->saveObjectToSD(obj);
ui->progressBar->setValue(i);
this->repaint();
}
}
}
void ImportSummaryDialog::updateSaveCompletion()
{
ui->progressBar->setValue(ui->progressBar->value()+1);
}
void ImportSummaryDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);

View File

@ -57,8 +57,10 @@ protected:
private:
Ui::ImportSummaryDialog *ui;
private slots:
public slots:
void updateSaveCompletion();
private slots:
void doTheSaving();
};