File indexing completed on 2024-06-16 07:42:24

0001 /*
0002     SPDX-FileCopyrightText: 2008-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef _K3B_CDDB_H_
0009 #define _K3B_CDDB_H_
0010 
0011 #include <KJob>
0012 
0013 #include <KCDDB/KCDDB>
0014 #include <KCDDB/CDInfo>
0015 
0016 #include "k3b_export.h"
0017 
0018 class QWidget;
0019 
0020 namespace K3b {
0021     namespace Device {
0022         class Toc;
0023     }
0024 
0025     class Medium;
0026 
0027     namespace CDDB {
0028         namespace MultiEntriesDialog {
0029              LIBK3B_EXPORT int selectCddbEntry( const KCDDB::CDInfoList& entries, QWidget* parent = nullptr );
0030         }
0031 
0032 
0033         class LIBK3B_EXPORT CDDBJob : public KJob
0034         {
0035             Q_OBJECT
0036 
0037         public:
0038             explicit CDDBJob( QObject* parent = 0 );
0039             ~CDDBJob() override;
0040 
0041             /**
0042              * The medium specified in queryCddb. MediaCache
0043              * uses it to remember the original medium.
0044              */
0045             K3b::Medium medium() const;
0046 
0047             /**
0048              * Only valid after the job finished successfully.
0049              */
0050             KCDDB::CDInfo cddbResult() const;
0051 
0052             /**
0053              * Query cddb for the medium. The returned job is
0054              * already started.
0055              */
0056             static CDDBJob* queryCddb( const Medium& medium );
0057 
0058             /**
0059              * Query cddb for the toc. The returned job is
0060              * already started.
0061              */
0062             static CDDBJob* queryCddb( const Device::Toc& toc );
0063 
0064         public Q_SLOTS:
0065             void start() override;
0066 
0067         private:
0068             class Private;
0069             Private* const d;
0070 
0071             Q_PRIVATE_SLOT( d, void _k_cddbQueryFinished( KCDDB::Result ) )
0072         };
0073 
0074         LIBK3B_EXPORT KCDDB::TrackOffsetList createTrackOffsetList( const K3b::Device::Toc& toc );
0075     }
0076 }
0077 
0078 #endif