This file is indexed.

/usr/include/libtomahawk/resolvers/ExternalResolver.h is in libtomahawk-dev 0.8.4+dfsg1-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 *
 *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
 *   Copyright 2013,      Teo Mrnjavac <teo@kde.org>
 *
 *   Tomahawk is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Tomahawk is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef EXTERNALRESOLVER_H
#define EXTERNALRESOLVER_H

#include "Source.h"
#include "DllMacro.h"
#include "Resolver.h"
#include "ScriptCommandQueue.h"
#include "ScriptCommand_AllArtists.h"
#include "ScriptCommand_AllAlbums.h"
#include "ScriptCommand_AllTracks.h"
#include "ScriptCommand_LookupUrl.h"
#include "Typedefs.h"

#include <boost/function.hpp>

#include <QObject>

class QWidget;

namespace Tomahawk
{

/**
 * Generic resolver object, used to manage a resolver that Tomahawk knows about
 *
 * You *must* start() a resolver after creating an ExternalResolver in order to use it,
 * otherwise it will not do anything.
 */
class DLLEXPORT ExternalResolver : public Resolver
{
Q_OBJECT

    friend class ::ScriptCommandQueue;
    friend class ::ScriptCommand_AllArtists;
    friend class ::ScriptCommand_AllAlbums;
    friend class ::ScriptCommand_AllTracks;
    friend class ::ScriptCommand_LookupUrl;

public:
    enum ErrorState {
        NoError,
        FileNotFound,
        FailedToLoad
    };

    enum Capability
    {
        NullCapability = 0x0,
        Browsable = 0x1,        // can be represented in one or more collection tree views
        PlaylistSync = 0x2,     // can sync playlists
        AccountFactory = 0x4,   // can configure multiple accounts at the same time
        UrlLookup = 0x8         // can be queried for information on an Url
    };
    Q_DECLARE_FLAGS( Capabilities, Capability )
    Q_FLAGS( Capabilities )

    enum UrlType
    {
        Any =       0x00,
        Playlist =  0x01,
        Track =     0x02,
        Album =     0x04,
        Artist =    0x08
    };
    Q_DECLARE_FLAGS( UrlTypes, UrlType )
    Q_FLAGS( UrlTypes )

    ExternalResolver( const QString& filePath )
        : m_commandQueue( new ScriptCommandQueue( this ) )
    { m_filePath = filePath; }

    QString filePath() const { return m_filePath; }
    virtual QPixmap icon() const { return QPixmap(); }
    virtual void setIcon( const QPixmap& ) {}

    virtual void saveConfig() = 0;

    virtual void reload() {} // Reloads from file (especially useful to check if file now exists)
    virtual ErrorState error() const;
    virtual bool running() const = 0;
    virtual Capabilities capabilities() const = 0;
    virtual QMap< QString, Tomahawk::collection_ptr > collections() { return m_collections; }

    // UrlLookup, sync call
    virtual bool canParseUrl( const QString& url, UrlType type ) = 0;

    virtual void enqueue( const QSharedPointer< ScriptCommand >& req )
    { m_commandQueue->enqueue( req ); }

public slots:
    virtual void start() = 0;
    virtual void stop() = 0;

signals:
    void changed(); // if config widget was added/removed, name changed, etc
    void collectionAdded( const Tomahawk::collection_ptr& collection );
    void collectionRemoved( const Tomahawk::collection_ptr& collection );

    void artistsFound( const QList< Tomahawk::artist_ptr >& );
    void albumsFound( const QList< Tomahawk::album_ptr >& );
    void tracksFound( const QList< Tomahawk::query_ptr >& );
    void informationFound( const QString&, const QSharedPointer<QObject>& );

protected:
    void setFilePath( const QString& path ) { m_filePath = path; }
    QMap< QString, Tomahawk::collection_ptr > m_collections;
    ScriptCommandQueue* m_commandQueue;

    // Should only be called by ScriptCommands
    // ScriptCollection
    virtual void artists( const Tomahawk::collection_ptr& collection ) = 0;
    virtual void albums( const Tomahawk::collection_ptr& collection, const Tomahawk::artist_ptr& artist ) = 0;
    virtual void tracks( const Tomahawk::collection_ptr& collection, const Tomahawk::album_ptr& album ) = 0;
    // UrlLookup
    virtual void lookupUrl( const QString& url ) = 0;

private:
    QString m_filePath;
};

Q_DECLARE_OPERATORS_FOR_FLAGS( ExternalResolver::Capabilities )

} //ns

#endif // EXTERNALESOLVER_H