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(); db.destroy();
int count = db.create(); int count = db.create();
qDebug("Added %i entries to the database", count); qDebug("Added %i entries to the database", count);
emit databaseUpdated(tr("Added %1 entries to the database").arg(count));
} }
void ClientManager::stop() void ClientManager::stop()

View File

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

View File

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