aboutsummaryrefslogtreecommitdiff
path: root/smartpenmanager.cc
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-06-14 20:18:59 +0200
committerJavier <dev.git@javispedro.com>2015-06-14 20:18:59 +0200
commitfb55ea21c891a75f2e7e06d336faa9b5b8b105a3 (patch)
tree4c8d677ea98027576f44b8acfbc60b34675fe215 /smartpenmanager.cc
parent3a17eeddaf005a5e9fe48f1207978d0a0da0ae9d (diff)
downloadscribiu-fb55ea21c891a75f2e7e06d336faa9b5b8b105a3.tar.gz
scribiu-fb55ea21c891a75f2e7e06d336faa9b5b8b105a3.zip
improve sync locking and status messages
Diffstat (limited to 'smartpenmanager.cc')
-rw-r--r--smartpenmanager.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/smartpenmanager.cc b/smartpenmanager.cc
index 1750589..0ac56e2 100644
--- a/smartpenmanager.cc
+++ b/smartpenmanager.cc
@@ -65,7 +65,7 @@ QStringList SmartpenManager::pensBeingSynchronized() const
QString name = it.value()->penName();
if (name.isEmpty()) {
Smartpen::Address addr = it.value()->penAddress();
- name = QString("%1-%2").arg(addr.first, addr.second);
+ name = QString("%1-%2").arg(addr.first).arg(addr.second);
}
pens.append(name);
}
@@ -89,10 +89,20 @@ void SmartpenManager::handleSyncerFinished()
{
SmartpenSyncer *syncer = static_cast<SmartpenSyncer*>(sender());
Smartpen::Address addr = syncer->penAddress();
+
qDebug() << "Finished synchronization with pen with address:" << addr;
+
_syncers.remove(addr);
- syncer->deleteLater();
emit pensBeingSynchronizedChanged();
+
+ if (syncer->hasErrors()) {
+ qWarning() << "Synchronization with address" << addr << "failed";
+ emit syncFailed(syncer->penName());
+ } else {
+ emit syncComplete(syncer->penName());
+ }
+
+ syncer->deleteLater();
}
void SmartpenManager::processDevice(udev_device *dev)