File indexing completed on 2024-05-19 04:49:26

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Ralf Engels <ralf-engels@gmx.de>                                  *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef AMAROK_COLLECTIONIMPORTCAPABILITY_H
0018 #define AMAROK_COLLECTIONIMPORTCAPABILITY_H
0019 
0020 #include "core/amarokcore_export.h"
0021 #include "core/capabilities/Capability.h"
0022 
0023 #include <QIODevice>
0024 
0025 namespace Capabilities
0026 {
0027     /**
0028      * This capability allows the collection to import it's content form a file.
0029      * Currently this is only used by the SqlCollection and it's scanner
0030      *
0031      * @author Ralf Engels <ralf-engels@gmx.de>
0032      */
0033 
0034     class AMAROKCORE_EXPORT CollectionImportCapability : public Capabilities::Capability
0035     {
0036         Q_OBJECT
0037         public:
0038 
0039             CollectionImportCapability();
0040             ~CollectionImportCapability() override;
0041 
0042             /** Starts importing the given file into the collection.
0043                 @param input is an already opened input device. The importer will take ownership.
0044                 @param listener An object that will listen on import signals.
0045                 Those signals are:
0046                   trackAdded( Meta::TrackPtr )
0047                   trackDiscarded( QString )
0048                   trackMatchFound( Meta::TrackPtr, QString )
0049                   trackMatchMultiple( Meta::TrackList, QString )
0050                   importError( QString )
0051                   done( ThreadWeaver::Job* )
0052                   showMessage( QString )
0053                 @return A QObject that can be used to connect several status signals from.
0054                 */
0055             virtual void import( QIODevice *input, QObject *listener ) = 0;
0056 
0057             /** Get the capabilityInterfaceType of this capability
0058                 @return The capabilityInterfaceType ( always Capabilities::Capability::CollectionImport; )
0059              */
0060             static Type capabilityInterfaceType() { return Capabilities::Capability::CollectionImport; }
0061     };
0062 }
0063 
0064 #endif