@@ -24,6 +24,38 @@
2424#include "verticaljournal.h"
2525
2626#include <QAbstractItemModel>
27+#include <QUrlQuery>
28+
29+static QUrl oauthCleanedUrl(QUrl u)
30+{
31+ QUrlQuery q(u);
32+ q.removeQueryItem("oauth_nonce");
33+ q.removeQueryItem("oauth_timestamp");
34+ q.removeQueryItem("oauth_consumer_key");
35+ q.removeQueryItem("oauth_signature_method");
36+ q.removeQueryItem("oauth_version");
37+ q.removeQueryItem("oauth_signature");
38+ u.setQuery(q);
39+ return u;
40+}
41+
42+class AudioComparer : public QObject
43+{
44+ Q_OBJECT
45+public:
46+ Q_INVOKABLE bool compare(const QUrl &url1, const QUrl &url2)
47+ {
48+ return oauthCleanedUrl(url1) == oauthCleanedUrl(url2);
49+ }
50+};
51+
52+static QObject *audio_comparer_singleton_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
53+{
54+ Q_UNUSED(engine)
55+ Q_UNUSED(scriptEngine)
56+
57+ return new AudioComparer();
58+}
2759
2860void DashPlugin::registerTypes(const char *uri)
2961{
@@ -34,4 +66,7 @@ void DashPlugin::registerTypes(const char *uri)
3466 qmlRegisterType<OrganicGrid>(uri, 0, 1, "OrganicGrid");
3567 qmlRegisterType<VerticalJournal>(uri, 0, 1, "VerticalJournal");
3668 qmlRegisterType<CroppedImageSizer>(uri, 0, 1, "CroppedImageSizer");
69+ qmlRegisterSingletonType<AudioComparer>(uri, 0, 1, "AudioUrlComparer", audio_comparer_singleton_provider);
3770}
71+
72+#include "plugin.moc"