Connect the refresh database signal with the manager slot.

This commit is contained in:
codestation
2013-08-25 02:27:50 -04:30
parent 1415c72aec
commit 3530e28b43
3 changed files with 6 additions and 2 deletions

View File

@@ -58,6 +58,7 @@ void ClientManager::refreshDatabase()
db.destroy();
int count = db.create();
qDebug("Added %i entries to the database", count);
emit databaseUpdated(tr("Added %1 entries to the database").arg(count));
}
void ClientManager::stop()

View File

@@ -27,6 +27,7 @@ signals:
void deviceConnected(QString);
void deviceDisconnected();
void receivedPin(int);
void databaseUpdated(QString);
void stopped();
private slots:

View File

@@ -49,6 +49,7 @@ void MainWidget::checkSettings()
return;
}
}
first_run = false;
manager.start();
}
@@ -94,6 +95,7 @@ void MainWidget::connectSignals()
connect(&dialog, SIGNAL(finished(int)), this, SLOT(dialogResult(int)));
connect(&manager, SIGNAL(stopped()), qApp, SLOT(quit()));
connect(&manager, SIGNAL(receivedPin(int)), this, SLOT(showPin(int)));
connect(&manager, SIGNAL(databaseUpdated(QString)), this, SLOT(receiveMessage(QString)));
connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(receiveMessage(QString)));
connect(&manager, SIGNAL(deviceConnected(QString)), this, SLOT(setTrayTooltip(QString)));
connect(&manager, SIGNAL(deviceDisconnected()), this, SLOT(deviceDisconnect()));
@@ -111,7 +113,7 @@ void MainWidget::createTrayIcon()
quit = new QAction(tr("&Quit"), this);
connect(options, SIGNAL(triggered()), &dialog, SLOT(open()));
//connect(reload, SIGNAL(triggered()), &CmaWorker, SLOT(allowRefresh()), Qt::DirectConnection);
connect(reload, SIGNAL(triggered()), &manager, SLOT(refreshDatabase()));
connect(quit, SIGNAL(triggered()), this, SLOT(stopServer()));
QMenu *trayIconMenu = new QMenu(this);
@@ -125,7 +127,7 @@ void MainWidget::createTrayIcon()
trayIcon->setIcon(QIcon(":/main/resources/psv_icon.png"));
trayIcon->show();
// try to avoid the iconTray Qt bug
//Sleeper::sleep(1);
Sleeper::sleep(1);
}
void MainWidget::receiveMessage(QString message)