summaryrefslogtreecommitdiffstats
path: root/indexerwidget.h
blob: 9fab07aae007707795310690236b59b513524111 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef INDEXERWIDGET_H
#define INDEXERWIDGET_H

#include <QWidget>
#include <QThread>
#include <QMutex>

#include "taglib/fileref.h"

class QTextEdit;
class BeetReader;
struct BeetObject;

class IndexerWidget : public QWidget {
    Q_OBJECT
    public:
        explicit IndexerWidget(QWidget *parent = 0);

    public slots:
        void startIndexing();
        void stopIndexing();
        void addToLog(QString msg);

    private:
        QTextEdit *mLog;
        BeetReader *mReader;

};

class BeetReader : public QThread {
    Q_OBJECT
    public:
        explicit BeetReader();
        virtual void run();
        void cancel();

    signals:
        void message(const QString &msg);
        void processed(BeetObject &obj);

    private:
        QString toQString(TagLib::String string);
        QMutex mCancelMx;
        bool mCanceled;
};

struct BeetObject {
    QString artist;
    QString album;
    quint16 year;
    QString genre;
    quint16 pos;
    QString title;
    QString fullpath;
};

#endif // INDEXERWIDGET_H