From 3530e28b43a9ce0d13affe5a8f35043c69e1d7cd Mon Sep 17 00:00:00 2001 From: codestation Date: Sun, 25 Aug 2013 02:27:50 -0430 Subject: [PATCH] Connect the refresh database signal with the manager slot. --- clientmanager.cpp | 1 + clientmanager.h | 1 + mainwidget.cpp | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/clientmanager.cpp b/clientmanager.cpp index d2a99b4..3930a06 100644 --- a/clientmanager.cpp +++ b/clientmanager.cpp @@ -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() diff --git a/clientmanager.h b/clientmanager.h index 5ca2069..a718599 100644 --- a/clientmanager.h +++ b/clientmanager.h @@ -27,6 +27,7 @@ signals: void deviceConnected(QString); void deviceDisconnected(); void receivedPin(int); + void databaseUpdated(QString); void stopped(); private slots: diff --git a/mainwidget.cpp b/mainwidget.cpp index 57b1e47..b083339 100644 --- a/mainwidget.cpp +++ b/mainwidget.cpp @@ -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)