KCDDB

asynccddbplookup.h
1/*
2 SPDX-FileCopyrightText: 2002 Rik Hemsley (rikkus) <rik@kde.org>
3 SPDX-FileCopyrightText: 2002 Benjamin Meyer <ben-devel@meyerhome.net>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KCDDB_ASYNC_CDDBP_LOOKUP_H
9#define KCDDB_ASYNC_CDDBP_LOOKUP_H
10
11#include "cddbplookup.h"
12
13namespace KCDDB
14{
15 class AsyncCDDBPLookup : public CDDBPLookup
16 {
18
19 public:
20
21 enum State
22 {
23 Idle,
24 WaitingForConnection,
25 WaitingForGreeting,
26 WaitingForHandshake,
27 WaitingForProtoResponse,
28 WaitingForQueryResponse,
29 WaitingForMoreMatches,
30 WaitingForCDInfoResponse,
31 WaitingForCDInfoData,
32 WaitingForQuitResponse
33 };
34
35 AsyncCDDBPLookup();
36
37 virtual ~AsyncCDDBPLookup();
38
39 Result lookup( const QString &, uint, const TrackOffsetList & ) override;
40
42
43 void finished( KCDDB::Result );
44 void quit( Result );
45
46 protected Q_SLOTS:
47
48 void slotGotError(QAbstractSocket::SocketError error);
49 void slotConnectionSuccess();
50 void slotReadyRead();
51
52 protected:
53
54 void doHandshake();
55 void doProto();
56 void doQuery();
57 void doQuit();
58
59 bool parseQueryResponse( const QString & );
60 void requestCDInfoForMatch();
61 bool parseCDInfoResponse( const QString & );
62 void parseCDInfoData();
63
64 void read();
65
66 QString readLine();
67
68 QString stateToString() const;
69
70 private:
71
72 State state_;
73 Result result_;
74 QStringList cdInfoBuffer_;
75 };
76}
77
78#endif // KCDDB_ASYNC_CDDBP_LOOKUP_H
79// vim:tabstop=2:shiftwidth=2:expandtab:cinoptions=(s,U1,m1
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:11:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.