aboutsummaryrefslogtreecommitdiff
path: root/smartpenmanager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'smartpenmanager.cc')
-rw-r--r--smartpenmanager.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/smartpenmanager.cc b/smartpenmanager.cc
index ad6416b..b64f333 100644
--- a/smartpenmanager.cc
+++ b/smartpenmanager.cc
@@ -38,6 +38,22 @@ SmartpenManager::~SmartpenManager()
udev_unref(_udev);
}
+QStringList SmartpenManager::pensBeingSynchronized() const
+{
+ QStringList pens;
+ pens.reserve(_syncers.size());
+ for (QMap<Smartpen::Address, SmartpenSyncer*>::const_iterator it = _syncers.begin();
+ it != _syncers.end(); ++it) {
+ QString name = it.value()->penName();
+ if (name.isEmpty()) {
+ Smartpen::Address addr = it.value()->penAddress();
+ name = QString("%1-%2").arg(addr.first, addr.second);
+ }
+ pens.append(name);
+ }
+ return pens;
+}
+
void SmartpenManager::handleMonitorActivity()
{
qDebug() << "udev activity";
@@ -55,6 +71,7 @@ void SmartpenManager::handleSyncerFinished()
qDebug() << "Finished synchronization with pen with address:" << addr;
_syncers.remove(addr);
syncer->deleteLater();
+ emit pensBeingSynchronizedChanged();
}
void SmartpenManager::processDevice(udev_device *dev)
@@ -67,6 +84,8 @@ void SmartpenManager::processDevice(udev_device *dev)
SmartpenSyncer *syncer = new SmartpenSyncer(addr, this);
_syncers.insert(addr, syncer);
connect(syncer, SIGNAL(finished()), SLOT(handleSyncerFinished()));
+ connect(syncer, SIGNAL(penNameChanged()), SIGNAL(pensBeingSynchronizedChanged()));
syncer->start();
+ emit pensBeingSynchronizedChanged();
}
}