PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 6ms RepoModel.GetById 34ms app.codeStats 0ms

/src/libtomahawk/database/DatabaseCollection.h

http://github.com/tomahawk-player/tomahawk
C Header | 84 lines | 45 code | 19 blank | 20 comment | 0 complexity | 5cbd445391d3500d411867e190d38cae MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
 4 *   Copyright 2010-2011, Leo Franchi            <lfranchi@kde.org>
 5 *   Copyright 2013,      Teo Mrnjavac <teo@kde.org>
 6 *
 7 *   Tomahawk is free software: you can redistribute it and/or modify
 8 *   it under the terms of the GNU General Public License as published by
 9 *   the Free Software Foundation, either version 3 of the License, or
10 *   (at your option) any later version.
11 *
12 *   Tomahawk is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef DATABASECOLLECTION_H
22#define DATABASECOLLECTION_H
23
24#include "collection/Collection.h"
25#include "DllMacro.h"
26#include "Source.h"
27#include "Typedefs.h"
28
29#include <QDir>
30
31
32namespace Tomahawk
33{
34
35class DLLEXPORT DatabaseCollection : public Tomahawk::Collection
36{
37Q_OBJECT
38
39public:
40    explicit DatabaseCollection( const Tomahawk::source_ptr& source, QObject* parent = nullptr );
41    virtual ~DatabaseCollection()
42    {
43        qDebug() << Q_FUNC_INFO;
44    }
45
46    BackendType backendType() const override { return DatabaseCollectionType; }
47
48    bool isOnline() const override;
49    bool isLocal() const override { return source()->isLocal(); }
50
51    using Collection::source;
52
53    void loadPlaylists() override;
54    void loadAutoPlaylists() override;
55    void loadStations() override;
56
57    QList< Tomahawk::playlist_ptr > playlists() override;
58    QList< Tomahawk::dynplaylist_ptr > autoPlaylists() override;
59    QList< Tomahawk::dynplaylist_ptr > stations() override;
60
61    Tomahawk::ArtistsRequest* requestArtists() override;
62    Tomahawk::AlbumsRequest*  requestAlbums( const Tomahawk::artist_ptr& artist ) override;
63    Tomahawk::TracksRequest*  requestTracks( const Tomahawk::album_ptr& album ) override;
64
65    int trackCount() const override;
66    QPixmap icon( const QSize& size ) const override;
67
68    // Resolver interface
69    unsigned int weight() const override;
70    unsigned int timeout() const override;
71    void resolve( const Tomahawk::query_ptr& query ) override;
72
73public slots:
74    virtual void addTracks( const QList<QVariant>& newitems );
75    virtual void removeTracks( const QDir& dir );
76
77private slots:
78    void stationCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
79    void autoPlaylistCreated( const Tomahawk::source_ptr& source, const QVariantList& data );
80};
81
82}
83
84#endif // DATABASECOLLECTION_H