QQrDecoder::QQrDecoder(QWidget *parent): QMainWindow(parent), decoder(this) { ui.setupUi(this); connect(ui.centralwidget, SIGNAL(imageCaptured(QImage)), this, SLOT(decodeImage(QImage))); connect(&decoder, SIGNAL(tagFound(QString)), this, SLOT(reportTagFound(QString))); //by default all decoders available are enabled //decoder.setDecoder( QZXing::DecoderFormat_DATA_MATRIX); //decoder.setDecoder( QZXing::DecoderFormat_Aztec ); }
void NeardHelper::interfacesAdded(const QDBusObjectPath &path, InterfaceList interfaceList) { foreach (const QString &key, interfaceList.keys()) { if (key == QStringLiteral("org.neard.Tag")) { emit tagFound(path); break; } if (key == QStringLiteral("org.neard.Record")) { emit recordFound(path); break; } } }
// TODO We need a constructor that lets us select an adapter QNearFieldManagerPrivateImpl::QNearFieldManagerPrivateImpl() : QNearFieldManagerPrivate(), m_neardHelper(NeardHelper::instance()) { QDBusPendingReply<ManagedObjectList> reply = m_neardHelper->dbusObjectManager()->GetManagedObjects(); reply.waitForFinished(); if (reply.isError()) { qCWarning(QT_NFC_NEARD) << "Error getting managed objects"; return; } bool found = false; foreach (const QDBusObjectPath &path, reply.value().keys()) { const InterfaceList ifaceList = reply.value().value(path); foreach (const QString &iface, ifaceList.keys()) { if (iface == QStringLiteral("org.neard.Adapter")) { found = true; m_adapterPath = path.path(); qCDebug(QT_NFC_NEARD) << "org.neard.Adapter found for path" << m_adapterPath; break; } } if (found) break; } if (!found) { qCWarning(QT_NFC_NEARD) << "no adapter found, neard daemon running?"; } else { connect(m_neardHelper, SIGNAL(tagFound(QDBusObjectPath)), this, SLOT(handleTagFound(QDBusObjectPath))); connect(m_neardHelper, SIGNAL(tagRemoved(QDBusObjectPath)), this, SLOT(handleTagRemoved(QDBusObjectPath))); } }