| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2010 Ralf Engels <[email protected]> * |
| 3 |
* * |
| 4 |
* This program is free software; you can redistribute it and/or modify it under * |
| 5 |
* the terms of the GNU General Public License as published by the Free Software * |
| 6 |
* Foundation; either version 2 of the License, or (at your option) any later * |
| 7 |
* version. * |
| 8 |
* * |
| 9 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * |
| 10 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * |
| 11 |
* PARTICULAR PURPOSE. See the GNU General Public License for more details. * |
| 12 |
* * |
| 13 |
* You should have received a copy of the GNU General Public License along with * |
| 14 |
* this program. If not, see <http://www.gnu.org/licenses/>. * |
| 15 |
****************************************************************************************/ |
| 16 |
|
| 17 |
#ifndef AMAROK_COLLECTIONIMPORTCAPABILITY_H |
| 18 |
#define AMAROK_COLLECTIONIMPORTCAPABILITY_H |
| 19 |
|
| 20 |
#include "core/amarokcore_export.h" |
| 21 |
#include "core/capabilities/Capability.h" |
| 22 |
|
| 23 |
#include <QIODevice> |
| 24 |
|
| 25 |
namespace Capabilities |
| 26 |
{ |
| 27 |
/** |
| 28 |
* This capability allows the collection to import it's content form a file. |
| 29 |
* Currently this is only used by the SqlCollection and it's scanner |
| 30 |
* |
| 31 |
* @author Ralf Engels <[email protected]> |
| 32 |
*/ |
| 33 |
|
| 34 |
class AMAROKCORE_EXPORT CollectionImportCapability : public Capabilities::Capability |
| 35 |
{ |
| 36 |
Q_OBJECT |
| 37 |
public: |
| 38 |
|
| 39 |
CollectionImportCapability(); |
| 40 |
~CollectionImportCapability() override; |
| 41 |
|
| 42 |
/** Starts importing the given file into the collection. |
| 43 |
@param input is an already opened input device. The importer will take ownership. |
| 44 |
@param listener An object that will listen on import signals. |
| 45 |
Those signals are: |
| 46 |
trackAdded( Meta::TrackPtr ) |
| 47 |
trackDiscarded( QString ) |
| 48 |
trackMatchFound( Meta::TrackPtr, QString ) |
| 49 |
trackMatchMultiple( Meta::TrackList, QString ) |
| 50 |
importError( QString ) |
| 51 |
done( ThreadWeaver::Job* ) |
| 52 |
showMessage( QString ) |
| 53 |
@return A QObject that can be used to connect several status signals from. |
| 54 |
*/ |
| 55 |
virtual void import( QIODevice *input, QObject *listener ) = 0; |
| 56 |
|
| 57 |
/** Get the capabilityInterfaceType of this capability |
| 58 |
@return The capabilityInterfaceType ( always Capabilities::Capability::CollectionImport; ) |
| 59 |
*/ |
| 60 |
static Type capabilityInterfaceType() { return Capabilities::Capability::CollectionImport; } |
| 61 |
}; |
| 62 |
} |
| 63 |
|
| 64 |
#endif |