diff options
author | Javier <dev.git@javispedro.com> | 2015-06-14 17:17:12 +0200 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2015-06-14 17:17:12 +0200 |
commit | e3c4aa5dffecc8f62958c44035b2e58de0228eb4 (patch) | |
tree | 8fb5f24098e094fe1f103092c6fed07a116cb91a /smartpenmanager.cc | |
parent | aa2999041d405215d5a7e8c494e276ebbfc089fc (diff) | |
download | scribiu-e3c4aa5dffecc8f62958c44035b2e58de0228eb4.tar.gz scribiu-e3c4aa5dffecc8f62958c44035b2e58de0228eb4.zip |
better synchronization status reporting
Diffstat (limited to 'smartpenmanager.cc')
-rw-r--r-- | smartpenmanager.cc | 19 |
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(); } } |