KCDDB

client.h
1 /*
2  SPDX-FileCopyrightText: 2002 Rik Hemsley (rikkus) <[email protected]>
3  SPDX-FileCopyrightText: 2002-2005 Benjamin C. Meyer <ben at meyerhome dot net>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KCDDB_CLIENT_H
9 #define KCDDB_CLIENT_H
10 
11 #include "cdinfo.h"
12 #include "kcddb.h"
13 #include "kcddbconfig.h"
14 #include <QObject>
15 
16 namespace KCDDB
17 {
18  class Lookup;
19  class Submit;
20 
21  /**
22  * Class used to obtain CDDB information about a CD
23  *
24  * Example:
25  * <code>KCDDB::Client *cddb = new KCDDB::Client();
26  * cddb->lookup(discSignature);
27  * CDInfo info = cddb->lookupResponse().first();</code>
28  */
29  class KCDDB_EXPORT Client : public QObject
30  {
31  Q_OBJECT
32 
33  public:
34 
35  /**
36  * Uses settings read from config.
37  */
38  Client();
39 
40  virtual ~Client();
41 
42  Config & config() const;
43 
44  /**
45  * @return a list of CDDB entries that match the disc signature
46  */
47  CDInfoList lookupResponse() const;
48 
49  /**
50  * Searches the database for entries matching the offset list.
51  * Use lookupResponse() to get the results
52  *
53  * @param trackOffsetList A List of the start offsets of the tracks,
54  * and the offset of the lead-out track at the end of the list
55  *
56  * @return if the results of the lookup: Success, NoRecordFound, etc
57  */
58  Result lookup(const TrackOffsetList &trackOffsetList);
59  /**
60  * @returns the results of trying to submit
61  */
62  Result submit(const CDInfo &cdInfo, const TrackOffsetList &trackOffsetList);
63 
64  /**
65  * Stores the CD-information in the local cache
66  */
67  void store(const CDInfo &cdInfo, const TrackOffsetList &trackOffsetList);
68 
69  void setBlockingMode( bool );
70  bool blockingMode() const;
71 
72  Q_SIGNALS:
73  /**
74  * emitted when not blocking and lookup() finished.
75  */
76  void finished( KCDDB::Result result );
77 
78  protected Q_SLOTS:
79  /**
80  * Called when the lookup is finished with the result
81  */
82  void slotFinished( KCDDB::Result result );
83  /**
84  * Called when the submit is finished with the result
85  */
86  void slotSubmitFinished( KCDDB::Result result );
87 
88  private:
89  Result runPendingLookups();
90 
91  class Private;
92  Private * const d;
93  };
94 }
95 
96 #endif // KCDDB_CLIENT_H
97 // vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1
Information about a CD.
Definition: cdinfo.h:104
Class used to obtain CDDB information about a CD.
Definition: client.h:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Nov 26 2021 23:22:53 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.