metadataloader.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef METADATALOADER_H
  2. #define METADATALOADER_H
  3. #include <QObject>
  4. #include <QTimer>
  5. #include "metadatavalue.h"
  6. #include <QMediaPlayer>
  7. #include "abstractmetadataloader.h"
  8. namespace Mobility {
  9. /** Metadataloader using multimediakit from Qt Mobility 1.1.1
  10. Known issues: Does not read id3 tags from mp3s on windows due to backend limitations.
  11. Tested on Linux and Symbian.
  12. */
  13. class MetaDataLoader : public Abstract::MetaDataLoader {
  14. Q_OBJECT
  15. public:
  16. explicit MetaDataLoader(QObject* parent = 0);
  17. static MetaDataLoader* instance();
  18. const QStringList& supportedExtensions();
  19. /** non-blocking interface results in a fetched()
  20. at some future time if successful.
  21. failed() is called if not.
  22. @param fileName absolute file path
  23. */
  24. virtual void get(QUrl url);
  25. void get(QList<QUrl> fns);
  26. MetaDataLoader* clone(QObject *parent);
  27. bool isRunning() const;
  28. signals:
  29. public slots:
  30. void checkForWork();
  31. void cancel();
  32. void timeOutSlot();
  33. private slots:
  34. void fetch();
  35. void failed();
  36. private:
  37. QTimer m_timer;
  38. QTimer m_timeOut;
  39. bool m_isRunning;
  40. bool m_fetched;
  41. bool m_cancelled;
  42. QMediaPlayer* m_player;
  43. QList<QUrl> m_queue;
  44. MetaDataValue m_current;
  45. };
  46. }
  47. #endif // METADATALOADER_H