Sayonara Player
LFMLoginThread.h
1 /* LoginThread.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef LoginThread_H
22 #define LoginThread_H
23 
24 #include <QObject>
25 #include "Utils/globals.h"
26 
27 namespace LastFM
28 {
29  struct LoginStuff
30  {
31  QString token;
32  QString session_key;
33  bool logged_in;
34  bool subscriber;
35  QString error;
36 
37  LoginStuff()
38  {
39  logged_in = false;
40  subscriber = false;
41  }
42  };
43 
44 
45  class LoginThread :
46  public QObject
47  {
48  Q_OBJECT
49 
50  signals:
51  void sig_token_received(const QString& token);
52  void sig_error(const QString& error);
53  void sig_logged_in(bool success);
54 
55  public:
56  explicit LoginThread(QObject *parent=nullptr);
57  ~LoginThread();
58 
59  void login(const QString& username, const QString& password);
60 
61  LoginStuff getLoginStuff();
62 
63  private slots:
64  void wa_response(const QByteArray& data);
65  void wa_error(const QString& response);
66 
67  private:
68  LoginStuff _login_info;
69  };
70 }
71 
72 #endif // LoginThread_H
Definition: LFMLoginThread.h:45
Definition: LFMLoginThread.h:29
Definition: ArtistMatch.h:28