Send more info on cleanup progress.

This commit is contained in:
Martin Rotter 2015-06-07 19:13:57 +02:00
parent a5e658f0e7
commit ec70130ab5
4 changed files with 11 additions and 6 deletions

View file

@ -35,7 +35,7 @@ void FormDatabaseCleanup::setCleaner(DatabaseCleaner *cleaner) {
connect(m_ui->m_btnBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(startPurging())); connect(m_ui->m_btnBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(startPurging()));
connect(this, SIGNAL(purgeRequested(CleanerOrders)), m_cleaner, SLOT(purgeDatabaseData(CleanerOrders))); connect(this, SIGNAL(purgeRequested(CleanerOrders)), m_cleaner, SLOT(purgeDatabaseData(CleanerOrders)));
connect(m_cleaner, SIGNAL(purgeStarted()), this, SLOT(onPurgeStarted())); connect(m_cleaner, SIGNAL(purgeStarted()), this, SLOT(onPurgeStarted()));
connect(m_cleaner, SIGNAL(purgeProgress(int)), this, SLOT(onPurgeProgress(int))); connect(m_cleaner, SIGNAL(purgeProgress(int,QString)), this, SLOT(onPurgeProgress(int,QString)));
connect(m_cleaner, SIGNAL(purgeFinished(bool)), this, SLOT(onPurgeFinished(bool))); connect(m_cleaner, SIGNAL(purgeFinished(bool)), this, SLOT(onPurgeFinished(bool)));
} }
@ -79,8 +79,9 @@ void FormDatabaseCleanup::onPurgeStarted() {
m_ui->m_lblResult->setStatus(WidgetWithStatus::Information, tr("Database cleanup is running."), tr("Database cleanup is running.")); m_ui->m_lblResult->setStatus(WidgetWithStatus::Information, tr("Database cleanup is running."), tr("Database cleanup is running."));
} }
void FormDatabaseCleanup::onPurgeProgress(int progress) { void FormDatabaseCleanup::onPurgeProgress(int progress, const QString &description) {
m_ui->m_progressBar->setValue(progress); m_ui->m_progressBar->setValue(progress);
m_ui->m_lblResult->setStatus(WidgetWithStatus::Information, description, description);
} }
void FormDatabaseCleanup::onPurgeFinished(bool finished) { void FormDatabaseCleanup::onPurgeFinished(bool finished) {

View file

@ -30,7 +30,7 @@ class FormDatabaseCleanup : public QDialog {
void startPurging(); void startPurging();
void onPurgeStarted(); void onPurgeStarted();
void onPurgeProgress(int progress); void onPurgeProgress(int progress, const QString &description);
void onPurgeFinished(bool finished); void onPurgeFinished(bool finished);
signals: signals:

View file

@ -39,9 +39,13 @@ void DatabaseCleaner::purgeDatabaseData(const CleanerOrders &which_data) {
emit purgeStarted(); emit purgeStarted();
if (which_data.m_shrinkDatabase) { if (which_data.m_shrinkDatabase) {
result &= qApp->database()->vacuumDatabase();
progress += 25; progress += 25;
emit purgeProgress(progress); emit purgeProgress(progress, tr("Shrinking database file..."));
result &= qApp->database()->vacuumDatabase();
progress += 25;
emit purgeProgress(progress, tr("Database file shrinked..."));
} }
emit purgeFinished(result); emit purgeFinished(result);

View file

@ -37,7 +37,7 @@ class DatabaseCleaner : public QObject {
signals: signals:
void purgeStarted(); void purgeStarted();
void purgeProgress(int progress); void purgeProgress(int progress, const QString &description);
void purgeFinished(bool result); void purgeFinished(bool result);
public slots: public slots: