int SeasidePeopleModel::importContacts(const QString &path) { MODEL_DEBUG() << QDir::currentPath(); QFile vcf(path); if (!vcf.open(QIODevice::ReadOnly)) { qWarning() << Q_FUNC_INFO << "Cannot open " << path; return 0; } // TODO: thread QVersitReader reader(&vcf); reader.startReading(); reader.waitForFinished(); QVersitContactImporter importer; importer.importDocuments(reader.results()); QList<QContact> newContacts = importer.contacts(); foreach (const QContact &contact, newContacts) priv->contactsPendingSave.append(contact); priv->savePendingContacts(); MODEL_DEBUG() << Q_FUNC_INFO << "Imported " << newContacts.size() << " contacts " << " from " << path; return newContacts.size(); }
template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType) { typedef Matrix<float, SizeAtCompileType, SizeAtCompileType> Mat_f; typedef Matrix<double, SizeAtCompileType, SizeAtCompileType> Mat_d; typedef Matrix<std::complex<float>, SizeAtCompileType, SizeAtCompileType> Mat_cf; typedef Matrix<std::complex<double>, SizeAtCompileType, SizeAtCompileType> Mat_cd; typedef Matrix<float, SizeAtCompileType, 1> Vec_f; typedef Matrix<double, SizeAtCompileType, 1> Vec_d; typedef Matrix<std::complex<float>, SizeAtCompileType, 1> Vec_cf; typedef Matrix<std::complex<double>, SizeAtCompileType, 1> Vec_cd; Mat_f mf(size,size); Mat_d md(size,size); Mat_cf mcf(size,size); Mat_cd mcd(size,size); Vec_f vf(size,1); Vec_d vd(size,1); Vec_cf vcf(size,1); Vec_cd vcd(size,1); mf+mf; VERIFY_RAISES_ASSERT(mf+md); VERIFY_RAISES_ASSERT(mf+mcf); VERIFY_RAISES_ASSERT(vf=vd); VERIFY_RAISES_ASSERT(vf+=vd); VERIFY_RAISES_ASSERT(mcd=md); mf*mf; md*mcd; mcd*md; mf*vcf; mcf*vf; mcf *= mf; vcd = md*vcd; vcf = mcf*vf; #if 0 // these are know generating hard build errors in eigen3 VERIFY_RAISES_ASSERT(mf*md); VERIFY_RAISES_ASSERT(mcf*mcd); VERIFY_RAISES_ASSERT(mcf*vcd); VERIFY_RAISES_ASSERT(vcf = mf*vf); vf.eigen2_dot(vf); VERIFY_RAISES_ASSERT(vd.eigen2_dot(vf)); VERIFY_RAISES_ASSERT(vcf.eigen2_dot(vf)); // yeah eventually we should allow this but i'm too lazy to make that change now in Dot.h // especially as that might be rewritten as cwise product .sum() which would make that automatic. #endif }
int SeasideCache::importContacts(const QString &path) { QFile vcf(path); if (!vcf.open(QIODevice::ReadOnly)) { qWarning() << Q_FUNC_INFO << "Cannot open " << path; return 0; } // TODO: thread QVersitReader reader(&vcf); reader.startReading(); reader.waitForFinished(); QVersitContactImporter importer; importer.importDocuments(reader.results()); QList<QContact> newContacts = importer.contacts(); instance->m_contactsToCreate += newContacts; instance->requestUpdate(); return newContacts.count(); }