Commit 331af70e authored by Bart van der Velden's avatar Bart van der Velden

Intermediate check-in (#65)

parent dc6c85f5
......@@ -29,7 +29,7 @@ namespace mc
class Directory;
class Track;
//! An album track as read from a file system
//! An album as assembled from read tracks that have the same album name and album artist
/*! This class is used to collect all album data that was extracted from the tracks that
* form the album
*/
......
......@@ -21,6 +21,19 @@ using namespace std;
using namespace mc::collection;
Directory::Directory(const QString& path)
: m_path(path)
{
}
//! Add a track to the directory
void Directory::AddTrack(Track* track)
{
m_tracks.append(track);
}
//! Give access to the tracks in this directory
const QList<Track*> Directory::Tracks() const
{
return m_tracks;
}
......@@ -18,7 +18,8 @@
#ifndef MUSICCOLLECTION_COLLECTION_DIRECTORY_H_INCLUDED
#define MUSICCOLLECTION_COLLECTION_DIRECTORY_H_INCLUDED
#include "QString"
#include <QString>
#include <QList>
namespace mc
{
......@@ -34,8 +35,14 @@ namespace mc
//! Construct a directory
Directory(const QString& path);
//! Add a track to the directory
void AddTrack(Track* track);
//! Give access to the tracks in this directory
const QList<Track*> Tracks() const;
private:
QString m_path;
QList<Track*> m_tracks;
private:
//! The default constructor is not implemented
Directory();
......
......@@ -32,6 +32,8 @@
#include <mpegfile.h>
#include <oggfile.h>
#include <vorbisfile.h>
#include <flacfile.h>
#include <oggflacfile.h>
using namespace std;
using namespace mc::collection;
......@@ -51,7 +53,9 @@ File* FileTypeResolver::createFile(
QString fn = QFile::decodeName(fileName);
QMimeType mimeType = mimeDatabase.mimeTypeForFile(fn);
QString mtn = mimeType.name();
if (mimeType.name() == QString("audio/mpeg"))
if ((mimeType.name() == QString("audio/mpeg")) ||
(mimeType.name() == QString("audio/x-mpegurl")))
{
result = new MPEG::File(fileName, readAudioProperties, audioPropertiesStyle);
}
......@@ -61,6 +65,14 @@ File* FileTypeResolver::createFile(
{
result = new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle);
}
else if ((mimeType.name() == QString("audio/x-flac+ogg")))
{
result = new Ogg::FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
}
else if ((mimeType.name() == QString("audio/x-flac")))
{
result = new FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
}
return result;
}
......@@ -16,13 +16,15 @@
*****************************************************************************/
#include "Track.h"
#include "Directory.h"
#include <QDir>
using namespace std;
using namespace mc::collection;
Track::Track(const QString& path, const Directory* dir)
: m_path(path)
: m_path(path),
m_directory(dir)
{
m_relativePath = QDir::current().relativeFilePath(path);
......
......@@ -48,6 +48,8 @@ namespace mc
private:
QString m_path;
QString m_relativePath;
const Directory* m_directory;
private:
//! The default constructor is not implemented
Track();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment