changeset 768:81fac6dadb75 qt5

'Merge'
author Chris Cannam
date Mon, 25 Mar 2013 12:19:10 +0000
parents 33ac6d05a1a6 (diff) 2444ef08b7eb (current diff)
children 8c5b0eec6fe9
files
diffstat 5 files changed, 387 insertions(+), 488 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/FileSource.cpp	Mon Mar 25 12:15:36 2013 +0000
+++ b/data/fileio/FileSource.cpp	Mon Mar 25 12:19:10 2013 +0000
@@ -20,12 +20,11 @@
 #include "base/ProgressReporter.h"
 #include "system/System.h"
 
-#include <QHttp>
-#include <QFtp>
+#include <QNetworkAccessManager>
+#include <QNetworkReply>
 #include <QFileInfo>
 #include <QDir>
 #include <QCoreApplication>
-#include <QHttpResponseHeader>
 
 #include <iostream>
 #include <cstdlib>
@@ -68,12 +67,13 @@
 }
 #endif
 
+static QNetworkAccessManager nm;
+
 FileSource::FileSource(QString fileOrUrl, ProgressReporter *reporter,
                        QString preferredContentType) :
     m_url(fileOrUrl, QUrl::StrictMode),
-    m_ftp(0),
-    m_http(0),
     m_localFile(0),
+    m_reply(0),
     m_preferredContentType(preferredContentType),
     m_ok(false),
     m_lastStatus(0),
@@ -98,7 +98,7 @@
 #endif
 
     if (!canHandleScheme(m_url)) {
-        SVDEBUG << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString() << "\"" << endl;
+        std::cerr << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString() << "\"" << std::endl;
         m_errorString = tr("Unsupported scheme in URL");
         return;
     }
@@ -110,7 +110,7 @@
 #ifdef DEBUG_FILE_SOURCE
         std::cerr << "FileSource::FileSource: Failed to open local file with URL \"" << m_url.toString() << "\"; trying again assuming filename was encoded" << std::endl;
 #endif
-        m_url = QUrl::fromEncoded(fileOrUrl.toAscii());
+        m_url = QUrl::fromEncoded(fileOrUrl.toLatin1());
         init();
     }
 
@@ -138,7 +138,7 @@
             // already done all the work and no request will be sent
             deleteCacheFile();
 
-            m_url.setEncodedUrl(fileOrUrl.toAscii());
+            m_url = QUrl::fromEncoded(fileOrUrl.toLatin1());
 
             m_ok = false;
             m_done = false;
@@ -153,15 +153,14 @@
     }
 
 #ifdef DEBUG_FILE_SOURCE
-    SVDEBUG << "FileSource::FileSource(string) exiting" << endl;
+    std::cerr << "FileSource::FileSource(string) exiting" << std::endl;
 #endif
 }
 
 FileSource::FileSource(QUrl url, ProgressReporter *reporter) :
     m_url(url),
-    m_ftp(0),
-    m_http(0),
     m_localFile(0),
+    m_reply(0),
     m_ok(false),
     m_lastStatus(0),
     m_resource(false),
@@ -172,12 +171,12 @@
     m_refCounted(false)
 {
 #ifdef DEBUG_FILE_SOURCE
-    SVDEBUG << "FileSource::FileSource(" << url.toString() << ") [as url]" << endl;
+    std::cerr << "FileSource::FileSource(" << url.toString() << ") [as url]" << std::endl;
     incCount(m_url.toString());
 #endif
 
     if (!canHandleScheme(m_url)) {
-        SVDEBUG << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString() << "\"" << endl;
+        std::cerr << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString() << "\"" << std::endl;
         m_errorString = tr("Unsupported scheme in URL");
         return;
     }
@@ -185,16 +184,15 @@
     init();
 
 #ifdef DEBUG_FILE_SOURCE
-    SVDEBUG << "FileSource::FileSource(url) exiting" << endl;
+    std::cerr << "FileSource::FileSource(url) exiting" << std::endl;
 #endif
 }
 
 FileSource::FileSource(const FileSource &rf) :
     QObject(),
     m_url(rf.m_url),
-    m_ftp(0),
-    m_http(0),
     m_localFile(0),
+    m_reply(0),
     m_ok(rf.m_ok),
     m_lastStatus(rf.m_lastStatus),
     m_resource(rf.m_resource),
@@ -205,12 +203,12 @@
     m_refCounted(false)
 {
 #ifdef DEBUG_FILE_SOURCE
-    SVDEBUG << "FileSource::FileSource(" << m_url.toString() << ") [copy ctor]" << endl;
+    std::cerr << "FileSource::FileSource(" << m_url.toString() << ") [copy ctor]" << std::endl;
     incCount(m_url.toString());
 #endif
 
     if (!canHandleScheme(m_url)) {
-        SVDEBUG << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString() << "\"" << endl;
+        std::cerr << "FileSource::FileSource: ERROR: Unsupported scheme in URL \"" << m_url.toString() << "\"" << std::endl;
         m_errorString = tr("Unsupported scheme in URL");
         return;
     }
@@ -220,8 +218,8 @@
     } else {
         QMutexLocker locker(&m_mapMutex);
 #ifdef DEBUG_FILE_SOURCE
-        SVDEBUG << "FileSource::FileSource(copy ctor): ref count is "
-                  << m_refCountMap[m_url] << endl;
+        std::cerr << "FileSource::FileSource(copy ctor): ref count is "
+                  << m_refCountMap[m_url] << std::endl;
 #endif
         if (m_refCountMap[m_url] > 0) {
             m_refCountMap[m_url]++;
@@ -239,11 +237,11 @@
     m_done = true;
 
 #ifdef DEBUG_FILE_SOURCE
-    SVDEBUG << "FileSource::FileSource(" << m_url.toString() << ") [copy ctor]: note: local filename is \"" << m_localFilename << "\"" << endl;
+    std::cerr << "FileSource::FileSource(" << m_url.toString() << ") [copy ctor]: note: local filename is \"" << m_localFilename << "\"" << std::endl;
 #endif
 
 #ifdef DEBUG_FILE_SOURCE
-    SVDEBUG << "FileSource::FileSource(copy ctor) exiting" << endl;
+    std::cerr << "FileSource::FileSource(copy ctor) exiting" << std::endl;
 #endif
 }
 
@@ -380,13 +378,11 @@
                   << m_url.toString() << "\", retrieving" << std::endl;
 #endif
 
-        if (scheme == "http") {
-            initHttp();
+        if (scheme == "http" || scheme == "https" || scheme == "ftp") {
+            initRemote();
 #ifdef DEBUG_FILE_SOURCE
-            std::cerr << "FileSource: initHttp succeeded" << std::endl;
+            std::cerr << "FileSource: initRemote returned" << std::endl;
 #endif
-        } else if (scheme == "ftp") {
-            initFtp();
         } else {
             m_remote = false;
             m_ok = false;
@@ -430,110 +426,35 @@
 }
 
 void
-FileSource::initHttp()
+FileSource::initRemote()
 {
     m_ok = true;
-    int port = m_url.port();
-    m_http = new QHttp(m_url.host(), port < 0 ? 80 : port);
-    connect(m_http, SIGNAL(done(bool)), this, SLOT(done(bool)));
-    connect(m_http, SIGNAL(dataReadProgress(int, int)),
-            this, SLOT(dataReadProgress(int, int)));
-    connect(m_http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
-            this, SLOT(httpResponseHeaderReceived(const QHttpResponseHeader &)));
 
-    // I don't quite understand this.  url.path() returns a path
-    // without percent encoding; for example, spaces appear as
-    // literal spaces.  This generally won't work if sent to the
-    // server directly.  You can retrieve a correctly encoded URL
-    // from QUrl using url.toEncoded(), but that gives you the
-    // whole URL; there doesn't seem to be any way to retrieve
-    // only an encoded path.  Furthermore there doesn't seem to be
-    // any way to convert a retrieved path into an encoded path
-    // without explicitly specifying that you don't want the path
-    // separators ("/") to be encoded.  (Besides being painful to
-    // manage, I don't see how this can work correctly in any case
-    // where a percent-encoded "/" is supposed to appear within a
-    // path element?)  There also seems to be no way to retrieve
-    // the path plus query string, i.e. everything that I need to
-    // send to the HTTP server.  And no way for QHttp to take a
-    // QUrl argument.  I'm obviously missing something.
-
-    // So, two ways to do this: query the bits from the URL,
-    // encode them individually, and glue them back together
-    // again...
-/*
-    QString path = QUrl::toPercentEncoding(m_url.path(), "/");
-    QList<QPair<QString, QString> > query = m_url.queryItems();
-    if (!query.empty()) {
-        QStringList q2;
-        for (QList<QPair<QString, QString> >::iterator i = query.begin();
-             i != query.end(); ++i) {
-            q2.push_back(QString("%1=%3")
-                         .arg(QString(QUrl::toPercentEncoding(i->first)))
-                         .arg(QString(QUrl::toPercentEncoding(i->second))));
-        }
-        path = QString("%1%2%3")
-            .arg(path).arg("?")
-            .arg(q2.join("&"));
-    }
-*/
-
-    // ...or, much simpler but relying on knowledge about the
-    // scheme://host/path/path/query etc format of the URL, we can
-    // get the whole URL ready-encoded and then split it on "/" as
-    // appropriate...
-        
-    QString path = "/" + QString(m_url.toEncoded()).section('/', 3);
-
-#ifdef DEBUG_FILE_SOURCE
-    SVDEBUG << "FileSource: path is \""
-              << path << "\"" << endl;
-#endif
-        
-    if (m_preferredContentType == "") {
-        m_http->get(path, m_localFile);
-    } else {
+    QNetworkRequest req;
+    req.setUrl(m_url);
+    
+    if (m_preferredContentType != "") {
 #ifdef DEBUG_FILE_SOURCE
         std::cerr << "FileSource: indicating preferred content type of \""
                   << m_preferredContentType << "\"" << std::endl;
 #endif
-        QHttpRequestHeader header("GET", path);
-        header.setValue("Host", m_url.host());
-        header.setValue("Accept", QString("%1, */*").arg(m_preferredContentType));
-        m_http->request(header, 0, m_localFile);
+        req.setRawHeader
+            ("Accept",
+             QString("%1, */*").arg(m_preferredContentType).toLatin1());
     }
-}
 
-void
-FileSource::initFtp()
-{
-    m_ok = true;
-    m_ftp = new QFtp;
-    connect(m_ftp, SIGNAL(done(bool)), this, SLOT(done(bool)));
-    connect(m_ftp, SIGNAL(commandFinished(int, bool)),
-            this, SLOT(ftpCommandFinished(int, bool)));
-    connect(m_ftp, SIGNAL(dataTransferProgress(qint64, qint64)),
-            this, SLOT(dataTransferProgress(qint64, qint64)));
-    m_ftp->connectToHost(m_url.host(), m_url.port(21));
-    
-    QString username = m_url.userName();
-    if (username == "") {
-        username = "anonymous";
-    }
-    
-    QString password = m_url.password();
-    if (password == "") {
-        password = QString("%1@%2").arg(getenv("USER")).arg(getenv("HOST"));
-    }
-    
-    m_ftp->login(username, password);
-    
-    QString dirpath = m_url.path().section('/', 0, -2);
-    QString filename = m_url.path().section('/', -1);
-    
-    if (dirpath == "") dirpath = "/";
-    m_ftp->cd(dirpath);
-    m_ftp->get(filename, m_localFile);
+    m_reply = nm.get(req);
+
+    connect(m_reply, SIGNAL(readyRead()),
+            this, SLOT(readyRead()));
+    connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)),
+            this, SLOT(replyFailed(QNetworkReply::NetworkError)));
+    connect(m_reply, SIGNAL(finished()),
+            this, SLOT(replyFinished()));
+    connect(m_reply, SIGNAL(metaDataChanged()),
+            this, SLOT(metaDataChanged()));
+    connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)),
+            this, SLOT(downloadProgress(qint64, qint64)));
 }
 
 void
@@ -544,17 +465,11 @@
         m_localFile = 0;
     }
     m_done = true;
-    if (m_http) {
-        QHttp *h = m_http;
-        m_http = 0;
-        h->abort();
-        h->deleteLater();
-    }
-    if (m_ftp) {
-        QFtp *f = m_ftp;
-        m_ftp = 0;
-        f->abort();
-        f->deleteLater();
+    if (m_reply) {
+        QNetworkReply *r = m_reply;
+        m_reply = 0;
+        r->abort();
+        r->deleteLater();
     }
     if (m_localFile) {
         delete m_localFile; // does not actually delete the file
@@ -576,8 +491,8 @@
 {
     // Note that a "scheme" with length 1 is probably a DOS drive letter
     QString scheme = url.scheme().toLower();
-    return (scheme == "http" || scheme == "ftp" ||
-            scheme == "file" || scheme == "qrc" ||
+    return (scheme == "http" || scheme == "https" ||
+            scheme == "ftp" || scheme == "file" || scheme == "qrc" ||
             scheme == "" || scheme.length() == 1);
 }
 
@@ -589,8 +504,8 @@
     if (!m_ok) available = false;
     else available = (m_lastStatus / 100 == 2);
 #ifdef DEBUG_FILE_SOURCE
-    SVDEBUG << "FileSource::isAvailable: " << (available ? "yes" : "no")
-              << endl;
+    std::cerr << "FileSource::isAvailable: " << (available ? "yes" : "no")
+              << std::endl;
 #endif
     return available;
 }
@@ -608,7 +523,7 @@
 FileSource::waitForData()
 {
     while (m_ok && !m_done) {
-//        SVDEBUG << "FileSource::waitForData: calling QApplication::processEvents" << endl;
+//        std::cerr << "FileSource::waitForData: calling QApplication::processEvents" << std::endl;
         QCoreApplication::processEvents();
         usleep(10000);
     }
@@ -685,23 +600,32 @@
 }
 
 void
-FileSource::dataReadProgress(int done, int total)
+FileSource::readyRead()
 {
-    dataTransferProgress(done, total);
+    m_localFile->write(m_reply->readAll());
 }
 
 void
-FileSource::httpResponseHeaderReceived(const QHttpResponseHeader &resp)
+FileSource::metaDataChanged()
 {
 #ifdef DEBUG_FILE_SOURCE
-    SVDEBUG << "FileSource::httpResponseHeaderReceived" << endl;
+    std::cerr << "FileSource::metaDataChanged" << std::endl;
 #endif
 
-    if (resp.statusCode() / 100 == 3) {
-        QString location = resp.value("Location");
+    if (!m_reply) {
+        std::cerr << "WARNING: FileSource::metaDataChanged() called without a reply object being known to us" << std::endl;
+        return;
+    }
+
+    int status =
+        m_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
+
+    if (status / 100 == 3) {
+        QString location = m_reply->header
+            (QNetworkRequest::LocationHeader).toString();
 #ifdef DEBUG_FILE_SOURCE
-        SVDEBUG << "FileSource::responseHeaderReceived: redirect to \""
-                  << location << "\" received" << endl;
+        std::cerr << "FileSource::metaDataChanged: redirect to \""
+                  << location << "\" received" << std::endl;
 #endif
         if (location != "") {
             QUrl newUrl(location);
@@ -723,58 +647,29 @@
         }
     }
 
-    m_lastStatus = resp.statusCode();
+    m_lastStatus = status;
     if (m_lastStatus / 100 >= 4) {
         m_errorString = QString("%1 %2")
-            .arg(resp.statusCode()).arg(resp.reasonPhrase());
+            .arg(status)
+            .arg(m_reply->attribute
+                 (QNetworkRequest::HttpReasonPhraseAttribute).toString());
 #ifdef DEBUG_FILE_SOURCE
-        SVDEBUG << "FileSource::responseHeaderReceived: "
-                  << m_errorString << endl;
+        std::cerr << "FileSource::metaDataChanged: "
+                  << m_errorString << std::endl;
 #endif
     } else {
 #ifdef DEBUG_FILE_SOURCE
-        SVDEBUG << "FileSource::responseHeaderReceived: "
-                  << m_lastStatus << endl;
+        std::cerr << "FileSource::metaDataChanged: "
+                  << m_lastStatus << std::endl;
 #endif
-        if (resp.hasContentType()) m_contentType = resp.contentType();
+        m_contentType =
+            m_reply->header(QNetworkRequest::ContentTypeHeader).toString();
     }
     emit statusAvailable();
 }
 
 void
-FileSource::ftpCommandFinished(int id, bool error)
-{
-#ifdef DEBUG_FILE_SOURCE
-    std::cerr << "FileSource::ftpCommandFinished(" << id << ", " << error << ")" << std::endl;
-#endif
-
-    if (!m_ftp) return;
-
-    QFtp::Command command = m_ftp->currentCommand();
-
-    if (!error) {
-#ifdef DEBUG_FILE_SOURCE
-        SVDEBUG << "FileSource::ftpCommandFinished: success for command "
-                  << command << endl;
-#endif
-        return;
-    }
-
-    if (command == QFtp::ConnectToHost) {
-        m_errorString = tr("Failed to connect to FTP server");
-    } else if (command == QFtp::Login) {
-        m_errorString = tr("Login failed");
-    } else if (command == QFtp::Cd) {
-        m_errorString = tr("Failed to change to correct directory");
-    } else if (command == QFtp::Get) {
-        m_errorString = tr("FTP download aborted");
-    }
-
-    m_lastStatus = 400; // for done()
-}
-
-void
-FileSource::dataTransferProgress(qint64 done, qint64 total)
+FileSource::downloadProgress(qint64 done, qint64 total)
 {
     int percent = int((double(done) / double(total)) * 100.0 - 0.1);
     emit progress(percent);
@@ -791,27 +686,17 @@
 }
 
 void
-FileSource::done(bool error)
+FileSource::replyFinished()
 {
     emit progress(100);
 
 #ifdef DEBUG_FILE_SOURCE
-    std::cerr << "FileSource::done(" << error << ")" << std::endl;
+    std::cerr << "FileSource::replyFinished()" << std::endl;
 #endif
 
     if (m_done) return;
 
-    if (error) {
-        if (m_http) {
-            m_errorString = m_http->errorString();
-        } else if (m_ftp) {
-            m_errorString = m_ftp->errorString();
-        }
-    }
-
-    if (m_lastStatus / 100 >= 4) {
-        error = true;
-    }
+    bool error = (m_lastStatus / 100 >= 4);
 
     cleanup();
 
@@ -840,10 +725,21 @@
 }
 
 void
+FileSource::replyFailed(QNetworkReply::NetworkError)
+{
+    emit progress(100);
+    m_errorString = m_reply->errorString();
+    m_ok = false;
+    m_done = true;
+    cleanup();
+    emit ready();
+}
+
+void
 FileSource::deleteCacheFile()
 {
 #ifdef DEBUG_FILE_SOURCE
-    SVDEBUG << "FileSource::deleteCacheFile(\"" << m_localFilename << "\")" << endl;
+    std::cerr << "FileSource::deleteCacheFile(\"" << m_localFilename << "\")" << std::endl;
 #endif
 
     cleanup();
@@ -884,7 +780,7 @@
 #endif
     } else {
 #ifdef DEBUG_FILE_SOURCE
-        SVDEBUG << "FileSource::deleteCacheFile: Deleted cache file \"" << m_localFilename << "\"" << endl;
+        std::cerr << "FileSource::deleteCacheFile: Deleted cache file \"" << m_localFilename << "\"" << std::endl;
 #endif
         m_localFilename = "";
     }
@@ -901,7 +797,7 @@
         QMutexLocker locker(&m_mapMutex);
 
 #ifdef DEBUG_FILE_SOURCE
-        SVDEBUG << "FileSource::createCacheFile: refcount is " << m_refCountMap[m_url] << endl;
+        std::cerr << "FileSource::createCacheFile: refcount is " << m_refCountMap[m_url] << std::endl;
 #endif
 
         if (m_refCountMap[m_url] > 0) {
--- a/data/fileio/FileSource.h	Mon Mar 25 12:15:36 2013 +0000
+++ b/data/fileio/FileSource.h	Mon Mar 25 12:19:10 2013 +0000
@@ -20,15 +20,13 @@
 #include <QMutex>
 #include <QString>
 #include <QTimer>
+#include <QNetworkReply>
 
 #include <map>
 
 #include "base/Debug.h"
 
-class QFtp;
-class QHttp;
 class QFile;
-class QHttpResponseHeader;
 class ProgressReporter;
 
 /**
@@ -210,20 +208,19 @@
     void ready();
 
 protected slots:
-    void dataReadProgress(int done, int total);
-    void httpResponseHeaderReceived(const QHttpResponseHeader &resp);
-    void ftpCommandFinished(int, bool);
-    void dataTransferProgress(qint64 done, qint64 total);
-    void done(bool error);
+    void metaDataChanged();
+    void readyRead();
+    void replyFailed(QNetworkReply::NetworkError);
+    void replyFinished();
+    void downloadProgress(qint64 done, qint64 total);
     void cancelled();
 
 protected:
     FileSource &operator=(const FileSource &); // not provided
 
     QUrl m_url;
-    QFtp *m_ftp;
-    QHttp *m_http;
     QFile *m_localFile;
+    QNetworkReply *m_reply;
     QString m_localFilename;
     QString m_errorString;
     QString m_contentType;
@@ -244,8 +241,7 @@
     bool m_refCounted;
 
     void init();
-    void initHttp();
-    void initFtp();
+    void initRemote();
 
     void cleanup();
 
--- a/data/fileio/test/AudioFileReaderTest.h	Mon Mar 25 12:15:36 2013 +0000
+++ b/data/fileio/test/AudioFileReaderTest.h	Mon Mar 25 12:19:10 2013 +0000
@@ -78,7 +78,7 @@
         if (bits.length() > 2) nominalDepth = bits[2].toInt();
 
 	if (!reader) {
-	    QSKIP("Unsupported file, skipping", SkipSingle);
+	    QSKIP("Unsupported file, skipping");
 	}
 
         QCOMPARE((int)reader->getChannelCount(), nominalChannels);
--- a/data/model/ModelDataTableModel.cpp	Mon Mar 25 12:15:36 2013 +0000
+++ b/data/model/ModelDataTableModel.cpp	Mon Mar 25 12:19:10 2013 +0000
@@ -129,7 +129,7 @@
 QModelIndex
 ModelDataTableModel::index(int row, int column, const QModelIndex &parent) const
 {
-    return createIndex(row, column, 0);
+    return createIndex(row, column, (void *)0);
 }
 
 QModelIndex
@@ -159,7 +159,7 @@
 {
     if (!m_model) return createIndex(0, 0);
     int row = m_model->getRowForFrame(frame);
-    return createIndex(getSorted(row), 0, 0);
+    return createIndex(getSorted(row), 0, (void *)0);
 }
 
 size_t 
@@ -206,7 +206,7 @@
     int current = getCurrentRow();
     if (current != prevCurrent) {
 //         std::cerr << "Current row changed from " << prevCurrent << " to " << current << " for underlying row " << m_currentRow << std::endl;
-         emit currentChanged(createIndex(current, 0, 0));
+        emit currentChanged(createIndex(current, 0, (void *)0));
     }
     emit layoutChanged();
 }
--- a/svcore.pro	Mon Mar 25 12:15:36 2013 +0000
+++ b/svcore.pro	Mon Mar 25 12:19:10 2013 +0000
@@ -1,270 +1,277 @@
-
-TEMPLATE = lib
-
-include(config.pri)
-
-CONFIG += staticlib qt thread warn_on stl rtti exceptions
-QT += network xml
-QT -= gui
-
-TARGET = svcore
-
-DEPENDPATH += . data plugin plugin/api/alsa
-INCLUDEPATH += . data plugin plugin/api/alsa
-OBJECTS_DIR = o
-MOC_DIR = o
-
-# Doesn't work with this library, which contains C99 as well as C++
-PRECOMPILED_HEADER =
-
-# Set up suitable platform defines for RtMidi
-linux*:   DEFINES += __LINUX_ALSASEQ__
-macx*:    DEFINES += __MACOSX_CORE__
-win*:     DEFINES += __WINDOWS_MM__
-solaris*: DEFINES += __RTMIDI_DUMMY_ONLY__
-
-HEADERS += base/AudioLevel.h \
-           base/AudioPlaySource.h \
-           base/Clipboard.h \
-           base/Command.h \
-           base/Debug.h \
-           base/Exceptions.h \
-           base/LogRange.h \
-           base/Pitch.h \
-           base/Playable.h \
-           base/PlayParameterRepository.h \
-           base/PlayParameters.h \
-           base/Preferences.h \
-           base/Profiler.h \
-           base/ProgressPrinter.h \
-           base/ProgressReporter.h \
-           base/PropertyContainer.h \
-           base/RangeMapper.h \
-           base/RealTime.h \
-           base/RecentFiles.h \
-           base/Resampler.h \
-           base/ResizeableBitset.h \
-           base/ResourceFinder.h \
-           base/RingBuffer.h \
-           base/Scavenger.h \
-           base/Selection.h \
-           base/Serialiser.h \
-           base/StorageAdviser.h \
-           base/StringBits.h \
-           base/TempDirectory.h \
-           base/TempWriteFile.h \
-           base/TextMatcher.h \
-           base/Thread.h \
-           base/UnitDatabase.h \
-           base/ViewManagerBase.h \
-           base/Window.h \
-           base/XmlExportable.h \
-           base/ZoomConstraint.h
-SOURCES += base/AudioLevel.cpp \
-           base/Clipboard.cpp \
-           base/Command.cpp \
-           base/Debug.cpp \
-           base/Exceptions.cpp \
-           base/LogRange.cpp \
-           base/Pitch.cpp \
-           base/PlayParameterRepository.cpp \
-           base/PlayParameters.cpp \
-           base/Preferences.cpp \
-           base/Profiler.cpp \
-           base/ProgressPrinter.cpp \
-           base/ProgressReporter.cpp \
-           base/PropertyContainer.cpp \
-           base/RangeMapper.cpp \
-           base/RealTime.cpp \
-           base/RecentFiles.cpp \
-           base/Resampler.cpp \
-           base/ResourceFinder.cpp \
-           base/Selection.cpp \
-           base/Serialiser.cpp \
-           base/StorageAdviser.cpp \
-           base/StringBits.cpp \
-           base/TempDirectory.cpp \
-           base/TempWriteFile.cpp \
-           base/TextMatcher.cpp \
-           base/Thread.cpp \
-           base/UnitDatabase.cpp \
-           base/ViewManagerBase.cpp \
-           base/XmlExportable.cpp
-
-HEADERS += data/fft/FFTapi.h \
-           data/fft/FFTCacheReader.h \
-           data/fft/FFTCacheStorageType.h \
-           data/fft/FFTCacheWriter.h \
-           data/fft/FFTDataServer.h \
-           data/fft/FFTFileCacheReader.h \
-           data/fft/FFTFileCacheWriter.h \
-           data/fft/FFTMemoryCache.h \
-           data/fileio/AudioFileReader.h \
-           data/fileio/AudioFileReaderFactory.h \
-           data/fileio/BZipFileDevice.h \
-           data/fileio/CachedFile.h \
-           data/fileio/CodedAudioFileReader.h \
-           data/fileio/CSVFileReader.h \
-           data/fileio/CSVFileWriter.h \
-           data/fileio/CSVFormat.h \
-           data/fileio/DataFileReader.h \
-           data/fileio/DataFileReaderFactory.h \
-           data/fileio/FileFinder.h \
-           data/fileio/FileReadThread.h \
-           data/fileio/FileSource.h \
-           data/fileio/MatchFileReader.h \
-           data/fileio/MatrixFile.h \
-           data/fileio/MIDIFileReader.h \
-           data/fileio/MIDIFileWriter.h \
-           data/fileio/MP3FileReader.h \
-           data/fileio/OggVorbisFileReader.h \
-           data/fileio/PlaylistFileReader.h \
-           data/fileio/QuickTimeFileReader.h \
-           data/fileio/CoreAudioFileReader.h \
-           data/fileio/ResamplingWavFileReader.h \
-           data/fileio/WavFileReader.h \
-           data/fileio/WavFileWriter.h \
-           data/midi/MIDIEvent.h \
-           data/midi/MIDIInput.h \
-           data/midi/rtmidi/RtError.h \
-           data/midi/rtmidi/RtMidi.h \
-           data/model/AggregateWaveModel.h \
-           data/model/AlignmentModel.h \
-           data/model/Dense3DModelPeakCache.h \
-           data/model/DenseThreeDimensionalModel.h \
-           data/model/DenseTimeValueModel.h \
-           data/model/EditableDenseThreeDimensionalModel.h \
-           data/model/FFTModel.h \
-           data/model/ImageModel.h \
-           data/model/IntervalModel.h \
-           data/model/Labeller.h \
-           data/model/Model.h \
-           data/model/ModelDataTableModel.h \
-           data/model/NoteModel.h \
-           data/model/PathModel.h \
-           data/model/PowerOfSqrtTwoZoomConstraint.h \
-           data/model/PowerOfTwoZoomConstraint.h \
-           data/model/RangeSummarisableTimeValueModel.h \
-           data/model/RegionModel.h \
-           data/model/SparseModel.h \
-           data/model/SparseOneDimensionalModel.h \
-           data/model/SparseTimeValueModel.h \
-           data/model/SparseValueModel.h \
-           data/model/TabularModel.h \
-           data/model/TextModel.h \
-           data/model/WaveFileModel.h \
-           data/model/WritableWaveFileModel.h \
-           data/osc/OSCMessage.h \
-           data/osc/OSCQueue.h 
-SOURCES += data/fft/FFTapi.cpp \
-           data/fft/FFTDataServer.cpp \
-           data/fft/FFTFileCacheReader.cpp \
-           data/fft/FFTFileCacheWriter.cpp \
-           data/fft/FFTMemoryCache.cpp \
-           data/fileio/AudioFileReader.cpp \
-           data/fileio/AudioFileReaderFactory.cpp \
-           data/fileio/BZipFileDevice.cpp \
-           data/fileio/CachedFile.cpp \
-           data/fileio/CodedAudioFileReader.cpp \
-           data/fileio/CSVFileReader.cpp \
-           data/fileio/CSVFileWriter.cpp \
-           data/fileio/CSVFormat.cpp \
-           data/fileio/DataFileReaderFactory.cpp \
-           data/fileio/FileReadThread.cpp \
-           data/fileio/FileSource.cpp \
-           data/fileio/MatchFileReader.cpp \
-           data/fileio/MatrixFile.cpp \
-           data/fileio/MIDIFileReader.cpp \
-           data/fileio/MIDIFileWriter.cpp \
-           data/fileio/MP3FileReader.cpp \
-           data/fileio/OggVorbisFileReader.cpp \
-           data/fileio/PlaylistFileReader.cpp \
-           data/fileio/QuickTimeFileReader.cpp \
-           data/fileio/CoreAudioFileReader.cpp \
-           data/fileio/ResamplingWavFileReader.cpp \
-           data/fileio/WavFileReader.cpp \
-           data/fileio/WavFileWriter.cpp \
-           data/midi/MIDIInput.cpp \
-           data/midi/rtmidi/RtMidi.cpp \
-           data/model/AggregateWaveModel.cpp \
-           data/model/AlignmentModel.cpp \
-           data/model/Dense3DModelPeakCache.cpp \
-           data/model/DenseTimeValueModel.cpp \
-           data/model/EditableDenseThreeDimensionalModel.cpp \
-           data/model/FFTModel.cpp \
-           data/model/Model.cpp \
-           data/model/ModelDataTableModel.cpp \
-           data/model/PowerOfSqrtTwoZoomConstraint.cpp \
-           data/model/PowerOfTwoZoomConstraint.cpp \
-           data/model/RangeSummarisableTimeValueModel.cpp \
-           data/model/WaveFileModel.cpp \
-           data/model/WritableWaveFileModel.cpp \
-           data/osc/OSCMessage.cpp \
-           data/osc/OSCQueue.cpp 
-
-HEADERS += plugin/DSSIPluginFactory.h \
-           plugin/DSSIPluginInstance.h \
-           plugin/FeatureExtractionPluginFactory.h \
-           plugin/LADSPAPluginFactory.h \
-           plugin/LADSPAPluginInstance.h \
-           plugin/PluginIdentifier.h \
-           plugin/PluginXml.h \
-           plugin/RealTimePluginFactory.h \
-           plugin/RealTimePluginInstance.h \
-           plugin/api/dssi.h \
-           plugin/api/ladspa.h \
-           plugin/plugins/SamplePlayer.h \
-           plugin/api/alsa/asoundef.h \
-           plugin/api/alsa/asoundlib.h \
-           plugin/api/alsa/seq.h \
-           plugin/api/alsa/seq_event.h \
-           plugin/api/alsa/seq_midi_event.h \
-           plugin/api/alsa/sound/asequencer.h
-SOURCES += plugin/DSSIPluginFactory.cpp \
-           plugin/DSSIPluginInstance.cpp \
-           plugin/FeatureExtractionPluginFactory.cpp \
-           plugin/LADSPAPluginFactory.cpp \
-           plugin/LADSPAPluginInstance.cpp \
-           plugin/PluginIdentifier.cpp \
-           plugin/PluginXml.cpp \
-           plugin/RealTimePluginFactory.cpp \
-           plugin/RealTimePluginInstance.cpp \
-           plugin/api/dssi_alsa_compat.c \
-           plugin/plugins/SamplePlayer.cpp
-
-HEADERS += rdf/PluginRDFIndexer.h \
-           rdf/PluginRDFDescription.h \
-           rdf/RDFExporter.h \
-           rdf/RDFFeatureWriter.h \
-           rdf/RDFImporter.h \
-           rdf/RDFTransformFactory.h
-SOURCES += rdf/PluginRDFIndexer.cpp \
-           rdf/PluginRDFDescription.cpp \
-           rdf/RDFExporter.cpp \
-           rdf/RDFFeatureWriter.cpp \
-           rdf/RDFImporter.cpp \
-           rdf/RDFTransformFactory.cpp
-
-HEADERS += system/Init.h \
-           system/System.h
-SOURCES += system/Init.cpp \
-           system/System.cpp
-
-HEADERS += transform/CSVFeatureWriter.h \
-           transform/FeatureExtractionModelTransformer.h \
-           transform/FeatureWriter.h \
-           transform/FileFeatureWriter.h \
-           transform/RealTimeEffectModelTransformer.h \
-           transform/Transform.h \
-           transform/TransformDescription.h \
-           transform/TransformFactory.h \
-           transform/ModelTransformer.h \
-           transform/ModelTransformerFactory.h
-SOURCES += transform/CSVFeatureWriter.cpp \
-           transform/FeatureExtractionModelTransformer.cpp \
-           transform/FileFeatureWriter.cpp \
-           transform/RealTimeEffectModelTransformer.cpp \
-           transform/Transform.cpp \
-           transform/TransformFactory.cpp \
-           transform/ModelTransformer.cpp \
-           transform/ModelTransformerFactory.cpp
+
+TEMPLATE = lib
+
+include(config.pri)
+
+CONFIG += staticlib qt thread warn_on stl rtti exceptions
+QT += network xml
+QT -= gui
+
+TARGET = svcore
+
+DEPENDPATH += . data plugin plugin/api/alsa
+INCLUDEPATH += . data plugin plugin/api/alsa
+OBJECTS_DIR = o
+MOC_DIR = o
+
+win32-g++ {
+    INCLUDEPATH += ../sv-dependency-builds/win32-mingw/include
+}
+win32-msvc* {
+    INCLUDEPATH += ../sv-dependency-builds/win32-msvc/include
+}
+
+# Doesn't work with this library, which contains C99 as well as C++
+PRECOMPILED_HEADER =
+
+# Set up suitable platform defines for RtMidi
+linux*:   DEFINES += __LINUX_ALSASEQ__
+macx*:    DEFINES += __MACOSX_CORE__
+win*:     DEFINES += __WINDOWS_MM__
+solaris*: DEFINES += __RTMIDI_DUMMY_ONLY__
+
+HEADERS += base/AudioLevel.h \
+           base/AudioPlaySource.h \
+           base/Clipboard.h \
+           base/Command.h \
+           base/Debug.h \
+           base/Exceptions.h \
+           base/LogRange.h \
+           base/Pitch.h \
+           base/Playable.h \
+           base/PlayParameterRepository.h \
+           base/PlayParameters.h \
+           base/Preferences.h \
+           base/Profiler.h \
+           base/ProgressPrinter.h \
+           base/ProgressReporter.h \
+           base/PropertyContainer.h \
+           base/RangeMapper.h \
+           base/RealTime.h \
+           base/RecentFiles.h \
+           base/Resampler.h \
+           base/ResizeableBitset.h \
+           base/ResourceFinder.h \
+           base/RingBuffer.h \
+           base/Scavenger.h \
+           base/Selection.h \
+           base/Serialiser.h \
+           base/StorageAdviser.h \
+           base/StringBits.h \
+           base/TempDirectory.h \
+           base/TempWriteFile.h \
+           base/TextMatcher.h \
+           base/Thread.h \
+           base/UnitDatabase.h \
+           base/ViewManagerBase.h \
+           base/Window.h \
+           base/XmlExportable.h \
+           base/ZoomConstraint.h
+SOURCES += base/AudioLevel.cpp \
+           base/Clipboard.cpp \
+           base/Command.cpp \
+           base/Debug.cpp \
+           base/Exceptions.cpp \
+           base/LogRange.cpp \
+           base/Pitch.cpp \
+           base/PlayParameterRepository.cpp \
+           base/PlayParameters.cpp \
+           base/Preferences.cpp \
+           base/Profiler.cpp \
+           base/ProgressPrinter.cpp \
+           base/ProgressReporter.cpp \
+           base/PropertyContainer.cpp \
+           base/RangeMapper.cpp \
+           base/RealTime.cpp \
+           base/RecentFiles.cpp \
+           base/Resampler.cpp \
+           base/ResourceFinder.cpp \
+           base/Selection.cpp \
+           base/Serialiser.cpp \
+           base/StorageAdviser.cpp \
+           base/StringBits.cpp \
+           base/TempDirectory.cpp \
+           base/TempWriteFile.cpp \
+           base/TextMatcher.cpp \
+           base/Thread.cpp \
+           base/UnitDatabase.cpp \
+           base/ViewManagerBase.cpp \
+           base/XmlExportable.cpp
+
+HEADERS += data/fft/FFTapi.h \
+           data/fft/FFTCacheReader.h \
+           data/fft/FFTCacheStorageType.h \
+           data/fft/FFTCacheWriter.h \
+           data/fft/FFTDataServer.h \
+           data/fft/FFTFileCacheReader.h \
+           data/fft/FFTFileCacheWriter.h \
+           data/fft/FFTMemoryCache.h \
+           data/fileio/AudioFileReader.h \
+           data/fileio/AudioFileReaderFactory.h \
+           data/fileio/BZipFileDevice.h \
+           data/fileio/CachedFile.h \
+           data/fileio/CodedAudioFileReader.h \
+           data/fileio/CSVFileReader.h \
+           data/fileio/CSVFileWriter.h \
+           data/fileio/CSVFormat.h \
+           data/fileio/DataFileReader.h \
+           data/fileio/DataFileReaderFactory.h \
+           data/fileio/FileFinder.h \
+           data/fileio/FileReadThread.h \
+           data/fileio/FileSource.h \
+           data/fileio/MatchFileReader.h \
+           data/fileio/MatrixFile.h \
+           data/fileio/MIDIFileReader.h \
+           data/fileio/MIDIFileWriter.h \
+           data/fileio/MP3FileReader.h \
+           data/fileio/OggVorbisFileReader.h \
+           data/fileio/PlaylistFileReader.h \
+           data/fileio/QuickTimeFileReader.h \
+           data/fileio/CoreAudioFileReader.h \
+           data/fileio/ResamplingWavFileReader.h \
+           data/fileio/WavFileReader.h \
+           data/fileio/WavFileWriter.h \
+           data/midi/MIDIEvent.h \
+           data/midi/MIDIInput.h \
+           data/midi/rtmidi/RtError.h \
+           data/midi/rtmidi/RtMidi.h \
+           data/model/AggregateWaveModel.h \
+           data/model/AlignmentModel.h \
+           data/model/Dense3DModelPeakCache.h \
+           data/model/DenseThreeDimensionalModel.h \
+           data/model/DenseTimeValueModel.h \
+           data/model/EditableDenseThreeDimensionalModel.h \
+           data/model/FFTModel.h \
+           data/model/ImageModel.h \
+           data/model/IntervalModel.h \
+           data/model/Labeller.h \
+           data/model/Model.h \
+           data/model/ModelDataTableModel.h \
+           data/model/NoteModel.h \
+           data/model/PathModel.h \
+           data/model/PowerOfSqrtTwoZoomConstraint.h \
+           data/model/PowerOfTwoZoomConstraint.h \
+           data/model/RangeSummarisableTimeValueModel.h \
+           data/model/RegionModel.h \
+           data/model/SparseModel.h \
+           data/model/SparseOneDimensionalModel.h \
+           data/model/SparseTimeValueModel.h \
+           data/model/SparseValueModel.h \
+           data/model/TabularModel.h \
+           data/model/TextModel.h \
+           data/model/WaveFileModel.h \
+           data/model/WritableWaveFileModel.h \
+           data/osc/OSCMessage.h \
+           data/osc/OSCQueue.h 
+SOURCES += data/fft/FFTapi.cpp \
+           data/fft/FFTDataServer.cpp \
+           data/fft/FFTFileCacheReader.cpp \
+           data/fft/FFTFileCacheWriter.cpp \
+           data/fft/FFTMemoryCache.cpp \
+           data/fileio/AudioFileReader.cpp \
+           data/fileio/AudioFileReaderFactory.cpp \
+           data/fileio/BZipFileDevice.cpp \
+           data/fileio/CachedFile.cpp \
+           data/fileio/CodedAudioFileReader.cpp \
+           data/fileio/CSVFileReader.cpp \
+           data/fileio/CSVFileWriter.cpp \
+           data/fileio/CSVFormat.cpp \
+           data/fileio/DataFileReaderFactory.cpp \
+           data/fileio/FileReadThread.cpp \
+           data/fileio/FileSource.cpp \
+           data/fileio/MatchFileReader.cpp \
+           data/fileio/MatrixFile.cpp \
+           data/fileio/MIDIFileReader.cpp \
+           data/fileio/MIDIFileWriter.cpp \
+           data/fileio/MP3FileReader.cpp \
+           data/fileio/OggVorbisFileReader.cpp \
+           data/fileio/PlaylistFileReader.cpp \
+           data/fileio/QuickTimeFileReader.cpp \
+           data/fileio/CoreAudioFileReader.cpp \
+           data/fileio/ResamplingWavFileReader.cpp \
+           data/fileio/WavFileReader.cpp \
+           data/fileio/WavFileWriter.cpp \
+           data/midi/MIDIInput.cpp \
+           data/midi/rtmidi/RtMidi.cpp \
+           data/model/AggregateWaveModel.cpp \
+           data/model/AlignmentModel.cpp \
+           data/model/Dense3DModelPeakCache.cpp \
+           data/model/DenseTimeValueModel.cpp \
+           data/model/EditableDenseThreeDimensionalModel.cpp \
+           data/model/FFTModel.cpp \
+           data/model/Model.cpp \
+           data/model/ModelDataTableModel.cpp \
+           data/model/PowerOfSqrtTwoZoomConstraint.cpp \
+           data/model/PowerOfTwoZoomConstraint.cpp \
+           data/model/RangeSummarisableTimeValueModel.cpp \
+           data/model/WaveFileModel.cpp \
+           data/model/WritableWaveFileModel.cpp \
+           data/osc/OSCMessage.cpp \
+           data/osc/OSCQueue.cpp 
+
+HEADERS += plugin/DSSIPluginFactory.h \
+           plugin/DSSIPluginInstance.h \
+           plugin/FeatureExtractionPluginFactory.h \
+           plugin/LADSPAPluginFactory.h \
+           plugin/LADSPAPluginInstance.h \
+           plugin/PluginIdentifier.h \
+           plugin/PluginXml.h \
+           plugin/RealTimePluginFactory.h \
+           plugin/RealTimePluginInstance.h \
+           plugin/api/dssi.h \
+           plugin/api/ladspa.h \
+           plugin/plugins/SamplePlayer.h \
+           plugin/api/alsa/asoundef.h \
+           plugin/api/alsa/asoundlib.h \
+           plugin/api/alsa/seq.h \
+           plugin/api/alsa/seq_event.h \
+           plugin/api/alsa/seq_midi_event.h \
+           plugin/api/alsa/sound/asequencer.h
+SOURCES += plugin/DSSIPluginFactory.cpp \
+           plugin/DSSIPluginInstance.cpp \
+           plugin/FeatureExtractionPluginFactory.cpp \
+           plugin/LADSPAPluginFactory.cpp \
+           plugin/LADSPAPluginInstance.cpp \
+           plugin/PluginIdentifier.cpp \
+           plugin/PluginXml.cpp \
+           plugin/RealTimePluginFactory.cpp \
+           plugin/RealTimePluginInstance.cpp \
+           plugin/api/dssi_alsa_compat.c \
+           plugin/plugins/SamplePlayer.cpp
+
+HEADERS += rdf/PluginRDFIndexer.h \
+           rdf/PluginRDFDescription.h \
+           rdf/RDFExporter.h \
+           rdf/RDFFeatureWriter.h \
+           rdf/RDFImporter.h \
+           rdf/RDFTransformFactory.h
+SOURCES += rdf/PluginRDFIndexer.cpp \
+           rdf/PluginRDFDescription.cpp \
+           rdf/RDFExporter.cpp \
+           rdf/RDFFeatureWriter.cpp \
+           rdf/RDFImporter.cpp \
+           rdf/RDFTransformFactory.cpp
+
+HEADERS += system/Init.h \
+           system/System.h
+SOURCES += system/Init.cpp \
+           system/System.cpp
+
+HEADERS += transform/CSVFeatureWriter.h \
+           transform/FeatureExtractionModelTransformer.h \
+           transform/FeatureWriter.h \
+           transform/FileFeatureWriter.h \
+           transform/RealTimeEffectModelTransformer.h \
+           transform/Transform.h \
+           transform/TransformDescription.h \
+           transform/TransformFactory.h \
+           transform/ModelTransformer.h \
+           transform/ModelTransformerFactory.h
+SOURCES += transform/CSVFeatureWriter.cpp \
+           transform/FeatureExtractionModelTransformer.cpp \
+           transform/FileFeatureWriter.cpp \
+           transform/RealTimeEffectModelTransformer.cpp \
+           transform/Transform.cpp \
+           transform/TransformFactory.cpp \
+           transform/ModelTransformer.cpp \
+           transform/ModelTransformerFactory.cpp