# HG changeset patch # User Chris Cannam # Date 1375204530 -3600 # Node ID fcee7e040ab49c70b5a90a6c34d91335de981d62 # Parent 3cc81dbc31bb75ed19be1d77a6a059741b71be37# Parent a1bb2989013dc380e3baf6b6e9704520f62b3bc0 Merge diff -r 3cc81dbc31bb -r fcee7e040ab4 data/fileio/FileSource.cpp --- a/data/fileio/FileSource.cpp Fri Jul 19 13:47:11 2013 +0100 +++ b/data/fileio/FileSource.cpp Tue Jul 30 18:15:30 2013 +0100 @@ -72,6 +72,7 @@ FileSource::FileSource(QString fileOrUrl, ProgressReporter *reporter, QString preferredContentType) : + m_rawFileOrUrl(fileOrUrl), m_url(fileOrUrl, QUrl::StrictMode), m_localFile(0), m_reply(0), @@ -112,6 +113,9 @@ 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.toLatin1()); +#ifdef DEBUG_FILE_SOURCE + std::cerr << "FileSource::FileSource: URL is now \"" << m_url.toString() << "\"" << std::endl; +#endif init(); } @@ -290,15 +294,20 @@ #endif bool literal = false; m_localFilename = m_url.toLocalFile(); + if (m_localFilename == "") { // QUrl may have mishandled the scheme (e.g. in a DOS path) - m_localFilename = m_url.toString(); + m_localFilename = m_rawFileOrUrl; +#ifdef DEBUG_FILE_SOURCE + std::cerr << "FileSource::init: Trying literal local filename \"" + << m_localFilename << "\"" << std::endl; +#endif literal = true; } m_localFilename = QFileInfo(m_localFilename).absoluteFilePath(); #ifdef DEBUG_FILE_SOURCE - std::cerr << "FileSource::init: URL translates to local filename \"" + std::cerr << "FileSource::init: URL translates to absolute filename \"" << m_localFilename << "\" (with literal=" << literal << ")" << std::endl; #endif @@ -314,7 +323,7 @@ #endif // Again, QUrl may have been mistreating us -- // e.g. dropping a part that looks like query data - m_localFilename = m_url.toString(); + m_localFilename = m_rawFileOrUrl; literal = true; if (!QFileInfo(m_localFilename).exists()) { m_lastStatus = 404; diff -r 3cc81dbc31bb -r fcee7e040ab4 data/fileio/FileSource.h --- a/data/fileio/FileSource.h Fri Jul 19 13:47:11 2013 +0100 +++ b/data/fileio/FileSource.h Tue Jul 30 18:15:30 2013 +0100 @@ -218,6 +218,7 @@ protected: FileSource &operator=(const FileSource &); // not provided + QString m_rawFileOrUrl; QUrl m_url; QFile *m_localFile; QNetworkReply *m_reply; diff -r 3cc81dbc31bb -r fcee7e040ab4 data/model/Labeller.h --- a/data/model/Labeller.h Fri Jul 19 13:47:11 2013 +0100 +++ b/data/model/Labeller.h Tue Jul 30 18:15:30 2013 +0100 @@ -134,6 +134,12 @@ void setSampleRate(float rate) { m_rate = rate; } + void resetCounters() { + m_counter = 1; + m_counter2 = 1; + m_cycle = 4; + } + void incrementCounter() { m_counter++; if (m_type == ValueFromCyclicalCounter ||