File indexing completed on 2024-05-05 04:51:47

0001 /*
0002     SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef _K3B_MUSICBRAINZ_JOB_H_
0007 #define _K3B_MUSICBRAINZ_JOB_H_
0008 
0009 #include "k3bjob.h"
0010 
0011 
0012 namespace K3b {
0013     class AudioTrack;
0014 }
0015 class QWidget;
0016 
0017 
0018 /**
0019  * This job tries to determine AudioTrack's title and artist using
0020  * Musicbrainz.
0021  */
0022 namespace K3b {
0023     class MusicBrainzJob : public Job
0024     {
0025         Q_OBJECT
0026 
0027     public:
0028         /**
0029          * \param parent since we do not use this job with a normal progressdialog we need a widget
0030          *        as parent
0031          */
0032         explicit MusicBrainzJob( QWidget* parent = 0 );
0033         ~MusicBrainzJob() override;
0034 
0035         bool hasBeenCanceled() const override;
0036 
0037     Q_SIGNALS:
0038         /**
0039          * Emitted for each track. This is signal can be used
0040          * to display further information.
0041          *
0042          * \param track The track for which metadata was searched.
0043          * \param success True if metadata was found
0044          */
0045         void trackFinished( K3b::AudioTrack* track, bool success );
0046 
0047     public Q_SLOTS:
0048         void start() override;
0049         void cancel() override;
0050 
0051         void setTracks( const QList<K3b::AudioTrack*>& tracks );
0052 
0053     private Q_SLOTS:
0054         void slotTrmPercent( int p );
0055         void slotMbJobFinished( bool success );
0056 
0057     private:
0058         class Private;
0059         Private* const d;
0060     };
0061 }
0062 
0063 #endif