~mixxxdevelopers/mixxx/engine-control-refactor

« back to all changes in this revision

Viewing changes to mixxx/src/musicbrainz/tagfetcher.h

  • Committer: RJ Ryan
  • Date: 2013-06-04 00:41:29 UTC
  • mfrom: (2890.22.101 mixxx)
  • Revision ID: rryan@mixxx.org-20130604004129-8jjxkicsb3givu4a
Merging from lp:mixxx.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 *  Copyright © 2012 John Maguire <john.maguire@gmail.com>                   *
 
3
 *                   David Sansome <me@davidsansome.com>                     *
 
4
 *  This work is free. You can redistribute it and/or modify it under the    *
 
5
 *  terms of the Do What The Fuck You Want To Public License, Version 2,     *
 
6
 *  as published by Sam Hocevar.                                             *
 
7
 *  See http://www.wtfpl.net/ for more details.                              *
 
8
 *****************************************************************************/
 
9
    
 
10
#ifndef TAGFETCHER_H
 
11
#define TAGFETCHER_H
 
12
 
 
13
#include <QFutureWatcher>
 
14
#include <QObject>
 
15
 
 
16
#include "musicbrainz/musicbrainzclient.h"
 
17
#include "musicbrainz/acoustidclient.h"
 
18
#include "trackinfoobject.h"
 
19
 
 
20
 
 
21
class TagFetcher : public QObject {
 
22
  Q_OBJECT
 
23
 
 
24
  // High level interface to Fingerprinter, AcoustidClient and
 
25
  // MusicBrainzClient.
 
26
 
 
27
  public:
 
28
    TagFetcher(QObject* parent = 0);
 
29
 
 
30
    void startFetch(const TrackPointer track);
 
31
 
 
32
  public slots:
 
33
    void cancel();
 
34
 
 
35
  signals:
 
36
    void resultAvailable(const TrackPointer originalTrack,
 
37
                         const QList<TrackPointer>& tracksGuessed);
 
38
    void fetchProgress(QString);
 
39
 
 
40
  private slots:
 
41
    void fingerprintFound(int index);
 
42
    void mbidFound(int index, const QString& mbid);
 
43
    void tagsFetched(int index, const MusicBrainzClient::ResultList& result);
 
44
 
 
45
  private:
 
46
    // has to be static so we can call it with QtConcurrent and have a nice
 
47
    // responsive UI while the fingerprint is calculated
 
48
    static QString getFingerprint(const TrackPointer tio);
 
49
 
 
50
    QFutureWatcher<QString>* m_pFingerprintWatcher;
 
51
    AcoustidClient m_AcoustidClient;
 
52
    MusicBrainzClient m_MusicbrainzClient;
 
53
 
 
54
    // Code can already be run on an arbitrary number of input tracks
 
55
    QList<TrackPointer> m_tracks;
 
56
};
 
57
 
 
58
#endif // TAGFETCHER_H