defuze.me  Client
library.hpp
00001 /**************************************************************************
00002 ** defuze.me Epitech Innovative Project
00003 **
00004 ** Copyright 2010-2011
00005 **   Athena Calmettes - Jocelyn De La Rosa - Francois Gaillard
00006 **   Adrien Jarthon - Alexandre Moore - Luc Peres - Arnaud Sellier
00007 **
00008 ** All rights reserved.
00009 **************************************************************************/
00010 
00011 #ifndef LIBRARY_HPP
00012 #define LIBRARY_HPP
00013 
00014 #include "staticplugin.hpp"
00015 #include "parameterizable.hpp"
00016 #include "librarywidget.hpp"
00017 #include "librarymodel.hpp"
00018 #include "playqueue.hpp"
00019 #include "source.hpp"
00020 #include "locker.hpp"
00021 #include <QUrl>
00022 #include <QtConcurrentMap>
00023 
00024 namespace Library
00025 {
00026 
00031 class LibraryPlugin : public Params::Parameterizable, public StaticPlugin, public Locker
00032 {
00033     Q_OBJECT
00034 public:
00035     LibraryPlugin();
00036     ~LibraryPlugin();
00037     void                    init();
00038     void                    aboutToQuit();
00039     LibraryModel            *getModel() const;
00040     LibraryWidget           *getWidget() const;
00041     void                    addSource(const QUrl &url, bool recursive = true);
00042     void                    updateSources();
00043     void                    addTrackToQueue(int id);
00044     static void             updateSource(quintptr &sourceAddr);
00045     static QStringList      allowedExtension;
00046 
00047 public slots:
00048     void                    updateStarted();
00049     void                    updateFinished();
00050     void                    updateProgress(int progressValue);
00051     void                    updateProgressMax(int maximum);
00052 
00053 private:
00054     void                    loadSources();
00055     void                    defineParams();
00056     QList<Source*>          sources;
00057     QList<quintptr>         sourcesAddr;
00058     LibraryModel            *model;
00059     LibraryWidget           *widget;
00060     QFutureWatcher<void>    *watcher;
00061 };
00062 
00063 }
00064 
00065 #endif // LIBRARY_HPP