babe.h 3.11 KB
Newer Older
1 2 3 4 5 6
#ifndef BABE_H
#define BABE_H

#include <QObject>
#include <QVariantList>
#include "utils/bae.h"
7
#include "db/collectionDB.h"
Camilo higuita's avatar
Camilo higuita committed
8
//#include "services/local/linking.h"
9 10 11

#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
class Notify;
12
#elif defined (Q_OS_ANDROID)
13
//class NotificationClient;
14 15
#endif

16 17
class CollectionDB;
class Pulpo;
18
class BabeSettings;
19
class ConThread;
20

21 22
using namespace BAE;

23
class Babe : public QObject
24
{
25
    Q_OBJECT
26

27 28 29
public:
    explicit Babe(QObject *parent = nullptr);
    ~Babe();
30

31
    BabeSettings *settings;
Camilo higuita's avatar
Camilo higuita committed
32
//    Linking link;
33

34
    //    Q_INVOKABLE void runPy();
35

36 37 38
    /* DATABASE INTERFACES */
    Q_INVOKABLE QVariantList get(const QString &queryTxt);
    Q_INVOKABLE QVariantList getList(const QStringList &urls);
39

Camilo higuita's avatar
Camilo higuita committed
40 41
//    Q_INVOKABLE void set(const QString &table, const QVariantList &wheres);
//    Q_INVOKABLE void trackPlaylist(const QStringList &urls, const QString &playlist);
42

Camilo higuita's avatar
Camilo higuita committed
43
    /***MOVE ALL THIS TO A INFO MODEL ***/
44 45 46 47 48
    Q_INVOKABLE void trackLyrics(const QString &url);
    Q_INVOKABLE QString artistArt(const QString &artist);
    Q_INVOKABLE QString albumArt(const QString &album, const QString &artist);
    Q_INVOKABLE QString artistWiki(const QString &artist);
    Q_INVOKABLE QString albumWiki(const QString &album, const QString &artist);
Camilo higuita's avatar
Camilo higuita committed
49
    Q_INVOKABLE void loadCover(const QString &url);
Camilo higuita's avatar
Camilo higuita committed
50
/**************************************/
51

Camilo higuita's avatar
Camilo higuita committed
52
    Q_INVOKABLE QVariantList getFolders();
53
    Q_INVOKABLE QStringList getSourceFolders();
54

55 56 57 58 59 60
    /* SETTINGS */
    Q_INVOKABLE void scanDir(const QString &url);
    Q_INVOKABLE void brainz(const bool &on);
    Q_INVOKABLE bool brainzState();
    Q_INVOKABLE void refreshCollection();
    Q_INVOKABLE void getYoutubeTrack(const QString &message);
61

62 63 64
    /* STATIC METHODS */
    Q_INVOKABLE static void savePlaylist(const QStringList &list);
    Q_INVOKABLE static QStringList lastPlaylist();
65

66 67
    Q_INVOKABLE static void savePlaylistPos(const int &pos);
    Q_INVOKABLE static int lastPlaylistPos();
68

69
    Q_INVOKABLE static void showFolder(const QStringList &urls);
70

71 72
    /*COLORS*/
    Q_INVOKABLE static QString babeColor();
73

74
    /*UTILS*/
75
    Q_INVOKABLE void openUrls(const QStringList &urls);
76

77 78
    Q_INVOKABLE static QString moodColor(const int &pos);
    Q_INVOKABLE static QStringList defaultSources();
79

80 81 82
    /*KDE*/
    Q_INVOKABLE void notify(const QString &title, const QString &body);
    Q_INVOKABLE void notifySong(const QString &url);
83

84
public slots:
85

86
private:
Camilo higuita's avatar
Camilo higuita committed
87
//    ConThread *thread;
88
    CollectionDB *db;
89

90
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
91
    Notify *nof;
92
#elif defined (Q_OS_ANDROID)
93
//    NotificationClient *nof;
94
#endif
Camilo higuita's avatar
Camilo higuita committed
95
    void fetchCoverArt(FMH::MODEL &song);
96
    static QVariantList transformData(const FMH::MODEL_LIST &dbList);
97

98
    void fetchTrackLyrics(FMH::MODEL &song);
Camilo higuita's avatar
Camilo higuita committed
99
//    void linkDecoder(QString json);
100 101 102 103 104 105 106 107 108 109

signals:
    void refreshTables(int size);
    void refreshTracks();
    void refreshAlbums();
    void refreshArtists();
    void trackLyricsReady(QString lyrics, QString url);
    void skipTrack();
    void babeIt();
    void message(QString msg);
110
    void openFiles(QVariantList tracks);
Camilo higuita's avatar
Camilo higuita committed
111
    void coverReady(const QString &path);
112 113
};

114

115
#endif // BABE_H