# HG changeset patch # User Chris Cannam # Date 1266848310 0 # Node ID c8ef23d3888cedb961a99ecc93bc72633fece4b4 # Parent 06fcbfe2a6ede32e96b98a39f0ac58e71062be62 * Update for new Dataquay::Uri in preference to QUrl diff -r 06fcbfe2a6ed -r c8ef23d3888c common/Objects.cpp --- a/common/Objects.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/common/Objects.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -11,12 +11,6 @@ #include // to ensure correct qHash(const QString &) is found -unsigned int -qHash(const QUrl &u) -{ - return qHash(u.toString()); -} - namespace ClassicalData { QMap Form::m_map; diff -r 06fcbfe2a6ed -r c8ef23d3888c common/Objects.h --- a/common/Objects.h Fri Feb 19 17:42:15 2010 +0000 +++ b/common/Objects.h Mon Feb 22 14:18:30 2010 +0000 @@ -8,13 +8,12 @@ #include #include #include -#include #include #include #include #include -extern unsigned int qHash(const QUrl &u); +#include namespace ClassicalData { @@ -101,15 +100,15 @@ { Q_OBJECT - Q_PROPERTY(QUrl uri READ uri WRITE setUri STORED true) + Q_PROPERTY(Dataquay::Uri uri READ uri WRITE setUri STORED true) Q_PROPERTY(QString siteName READ siteName WRITE setSiteName STORED true) Q_PROPERTY(QObject *topic READ topic WRITE setTopic STORED true) public: Document(QObject *parent = 0) : QObject(parent), m_topic(0) { } - QUrl uri() const { return m_uri; } - void setUri(QUrl uri) { m_uri = uri; } + Dataquay::Uri uri() const { return m_uri; } + void setUri(Dataquay::Uri uri) { m_uri = uri; } QString siteName() const { return m_siteName; } void setSiteName(QString n) { m_siteName = n; } @@ -118,7 +117,7 @@ void setTopic(QObject *t) { m_topic = t; } private: - QUrl m_uri; + Dataquay::Uri m_uri; QString m_siteName; QObject *m_topic; }; @@ -278,7 +277,7 @@ Q_PROPERTY(QString gender READ gender WRITE setGender STORED true) Q_PROPERTY(QSet nationality READ nationality WRITE setNationality STORED true) - Q_PROPERTY(QSet geonameURIs READ geonameURIs WRITE setGeonameURIs STORED true) + Q_PROPERTY(QSet geonameURIs READ geonameURIs WRITE setGeonameURIs STORED true) Q_PROPERTY(QString period READ period WRITE setPeriod STORED true) Q_PROPERTY(ClassicalData::Birth *birth READ birth WRITE setBirth STORED true) Q_PROPERTY(ClassicalData::Death *death READ death WRITE setDeath STORED true) @@ -297,9 +296,9 @@ void setNationality(QSet n) { m_nationality = n; } void addNationality(QString n) { m_nationality.insert(n); } - QSet geonameURIs() const { return m_geonameURIs; } - void setGeonameURIs(QSet n) { m_geonameURIs = n; } - void addGeonameURI(QUrl n) { m_geonameURIs.insert(n); } + QSet geonameURIs() const { return m_geonameURIs; } + void setGeonameURIs(QSet n) { m_geonameURIs = n; } + void addGeonameURI(Dataquay::Uri n) { m_geonameURIs.insert(n); } QString period() const { return m_period; } void setPeriod(QString n) { m_period = n; } @@ -390,7 +389,7 @@ private: QString m_gender; QSet m_nationality; - QSet m_geonameURIs; + QSet m_geonameURIs; QString m_period; Birth *m_birth; Death *m_death; @@ -445,7 +444,7 @@ Q_DECLARE_METATYPE(ClassicalData::Movement*); Q_DECLARE_METATYPE(ClassicalData::Document*); Q_DECLARE_METATYPE(QSet); -Q_DECLARE_METATYPE(QSet); +Q_DECLARE_METATYPE(QSet); Q_DECLARE_METATYPE(QSet); Q_DECLARE_METATYPE(QSet); Q_DECLARE_METATYPE(QSet); diff -r 06fcbfe2a6ed -r c8ef23d3888c common/TypeRegistrar.cpp --- a/common/TypeRegistrar.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/common/TypeRegistrar.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -42,8 +42,8 @@ ("QSet"); qRegisterMetaType > ("QSet"); - qRegisterMetaType > - ("QSet"); + qRegisterMetaType > + ("QSet"); ObjectBuilder::getInstance()->registerClass ("ClassicalData::HistoricalEvent*"); @@ -69,8 +69,8 @@ ("QString", "QSet", ContainerBuilder::SetKind); ContainerBuilder::getInstance()->registerContainer - > - ("QUrl", "QSet", ContainerBuilder::SetKind); + > + ("Dataquay::Uri", "QSet", ContainerBuilder::SetKind); ContainerBuilder::getInstance()->registerContainer > diff -r 06fcbfe2a6ed -r c8ef23d3888c common/common.pro --- a/common/common.pro Fri Feb 19 17:42:15 2010 +0000 +++ b/common/common.pro Mon Feb 22 14:18:30 2010 +0000 @@ -1,6 +1,7 @@ TEMPLATE = lib TARGET = CONFIG += release staticlib +#CONFIG += debug staticlib DEPENDPATH += . INCLUDEPATH += . ../../turbot @@ -18,6 +19,11 @@ LIBS += -xprofile=tcov } + release { + QMAKE_CXXFLAGS_RELEASE += -xpg -g + LIBS += -xpg + } + } linux* { diff -r 06fcbfe2a6ed -r c8ef23d3888c import/Import.cpp --- a/import/Import.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/import/Import.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -309,7 +309,7 @@ other->addNationality(s); } - foreach (QUrl s, c->geonameURIs()) { + foreach (Uri s, c->geonameURIs()) { other->addGeonameURI(s); } @@ -390,13 +390,13 @@ i++; } convSet.insert(conv); - c->setProperty("uri", s->expand(":composer/" + conv)); + c->setProperty("uri", QVariant::fromValue(s->expand(":composer/" + conv))); } void assignUri(Store *s, Work *w, Composer *c) { - QString pfx = c->property("uri").toUrl().toString(); + QString pfx = c->property("uri").value().toString(); DEBUG << "pfx = " << pfx << endl; if (!pfx.contains("composer/")) pfx = ":work/"; else { @@ -438,17 +438,17 @@ void addDbpediaResource(Store *store, QObject *o, QString s) { - QUrl u = o->property("uri").toUrl(); - if (u == QUrl()) return; + Uri u = o->property("uri").value(); + if (u == Uri()) return; if (s.startsWith("http://en.wikipedia.org/wiki/")) { store->add(Triple(u, "mo:wikipedia", - QUrl(s))); + Uri(s))); s.replace("http://en.wikipedia.org/wiki/", "http://dbpedia.org/resource/"); store->add(Triple(u, "owl:sameAs", - QUrl(s))); + Uri(s))); } } @@ -605,7 +605,7 @@ } } - QString u = w->property("uri").toUrl().toString(); + QString u = w->property("uri").value().toString(); if (u == "" || !storedUris.contains(u)) { toStore.push_back(w); if (u != "") storedUris.insert(u); diff -r 06fcbfe2a6ed -r c8ef23d3888c import/ImportClassicalArchives.cpp --- a/import/ImportClassicalArchives.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/import/ImportClassicalArchives.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -127,17 +127,17 @@ return nationalities; } -QSet +QSet locationToGeonameURIs(QString location) { - QSet uris; + QSet uris; QStringList locations = location.split('/'); foreach (location, locations) { int cols = 4; for (size_t i = 0; i < (sizeof(locmap)/sizeof(locmap[0])) / cols; ++i) { if (location == locmap[i*cols]) { - uris.insert(QUrl(QString("http://sws.geonames.org/") - + locmap[i*cols+3] + "/")); + uris.insert(Uri(QString("http://sws.geonames.org/") + + locmap[i*cols+3] + "/")); } } } @@ -298,7 +298,7 @@ if (matcher.cap(1) != "") { QString url = matcher.cap(1); Document *d = new Document; - d->setUri(QUrl("http://www.classicalarchives.com" + url)); + d->setUri(Uri("http://www.classicalarchives.com" + url)); d->setTopic(composer); d->setSiteName("Classical Archives"); composer->addPage(d); diff -r 06fcbfe2a6ed -r c8ef23d3888c import/ImportClassicalComposersOrg.cpp --- a/import/ImportClassicalComposersOrg.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/import/ImportClassicalComposersOrg.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -318,7 +318,7 @@ if (page != "") { Document *d = new Document; - d->setUri(QUrl("http://www.classical-composers.org" + page)); + d->setUri(Uri("http://www.classical-composers.org" + page)); d->setTopic(composer); d->setSiteName("Classical Composers Database"); composer->addPage(d); diff -r 06fcbfe2a6ed -r c8ef23d3888c import/ImportClassicalDotNet.cpp --- a/import/ImportClassicalDotNet.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/import/ImportClassicalDotNet.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -134,7 +134,7 @@ QString url = matcher.cap(1); url.replace(QRegExp("^\\.\\./"), "/music/"); Document *d = new Document; - d->setUri(QUrl("http://www.classical.net" + url)); + d->setUri(Uri("http://www.classical.net" + url)); d->setTopic(composer); d->setSiteName("Classical Net"); composer->addPage(d); diff -r 06fcbfe2a6ed -r c8ef23d3888c import/ImportHoboken.cpp --- a/import/ImportHoboken.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/import/ImportHoboken.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -149,7 +149,7 @@ if (httpre.indexIn(line) >= 0) { QString url = httpre.cap(1).trimmed(); Document *d = new Document; - d->setUri(url); + d->setUri(Uri(url)); d->setTopic(w); if (url.contains("wikipedia")) d->setSiteName("Wikipedia"); else if (url.contains("klassika.info")) { diff -r 06fcbfe2a6ed -r c8ef23d3888c import/ImportWikipediaComposers.cpp --- a/import/ImportWikipediaComposers.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/import/ImportWikipediaComposers.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -58,7 +58,7 @@ url.setPath("/wiki/" + QUrl::toPercentEncoding(pagename)); Document *d = new Document; - d->setUri(url); + d->setUri(Uri(url)); d->setSiteName("Wikipedia"); d->setTopic(composer); composer->addPage(d); diff -r 06fcbfe2a6ed -r c8ef23d3888c import/ImportWikipediaWorks.cpp --- a/import/ImportWikipediaWorks.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/import/ImportWikipediaWorks.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -138,7 +138,7 @@ url.setHost("en.wikipedia.org"); url.setPath("/wiki/" + QUrl::toPercentEncoding(linkText)); Document *d = new Document; - d->setUri(url); + d->setUri(Uri(url)); d->setSiteName("Wikipedia"); d->setTopic(w); w->addPage(d); diff -r 06fcbfe2a6ed -r c8ef23d3888c import/ImportWikipediaWorksK.cpp --- a/import/ImportWikipediaWorksK.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/import/ImportWikipediaWorksK.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -139,7 +139,7 @@ url.setHost("en.wikipedia.org"); url.setPath("/wiki/" + QUrl::toPercentEncoding(linkText)); Document *d = new Document; - d->setUri(url); + d->setUri(Uri(url)); d->setSiteName("Wikipedia"); d->setTopic(w); w->addPage(d); diff -r 06fcbfe2a6ed -r c8ef23d3888c import/ImportWikipediaWorksList.cpp --- a/import/ImportWikipediaWorksList.cpp Fri Feb 19 17:42:15 2010 +0000 +++ b/import/ImportWikipediaWorksList.cpp Mon Feb 22 14:18:30 2010 +0000 @@ -192,7 +192,7 @@ url.setHost("en.wikipedia.org"); url.setPath("/wiki/" + QUrl::toPercentEncoding(linkText)); Document *d = new Document; - d->setUri(url); + d->setUri(Uri(url)); d->setSiteName("Wikipedia"); d->setTopic(w); w->addPage(d); diff -r 06fcbfe2a6ed -r c8ef23d3888c import/import.pro --- a/import/import.pro Fri Feb 19 17:42:15 2010 +0000 +++ b/import/import.pro Mon Feb 22 14:18:30 2010 +0000 @@ -22,6 +22,10 @@ LIBS += -xprofile=tcov } + release { + QMAKE_CXXFLAGS_RELEASE += -xpg -g + LIBS += -xpg + } } linux* { diff -r 06fcbfe2a6ed -r c8ef23d3888c testapp/testapp.pro --- a/testapp/testapp.pro Fri Feb 19 17:42:15 2010 +0000 +++ b/testapp/testapp.pro Mon Feb 22 14:18:30 2010 +0000 @@ -1,6 +1,7 @@ TEMPLATE = app TARGET = testapp -CONFIG += debug +#CONFIG += debug +CONFIG += release OBJECTS_DIR = o MOC_DIR = m @@ -23,6 +24,10 @@ LIBS += -xprofile=tcov } + release { + QMAKE_CXXFLAGS_RELEASE += -xpg -g + LIBS += -xpg + } } linux* {