Sayonara Player
LFMLoginThread.h
1 /* LFMLoginThread.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef LFMLOGINTHREAD_H
24 #define LFMLOGINTHREAD_H
25 
26 #include <QObject>
27 #include "Helper/globals.h"
28 #include "Helper/Settings/SayonaraClass.h"
29 
30 
32 
33  QString token;
34  QString session_key;
35  bool logged_in;
36  bool subscriber;
37  QString error;
38 
39  LFMLoginStuff();
40 };
41 
42 class LFMLoginThread : public QObject, SayonaraClass
43 {
44 
45  Q_OBJECT
46 
47 signals:
48  void sig_token_received(const QString& token);
49  void sig_error(const QString& error);
50  void sig_logged_in(bool success);
51 
52 public:
53  LFMLoginThread(QObject *parent=nullptr);
54  ~LFMLoginThread();
55 
56  void login(const QString& username, const QString& password);
57  void get_token();
58  bool request_authorization();
59 
60  LFMLoginStuff getLoginStuff();
61 
62 private slots:
63  void wa_response(const QByteArray& data);
64  void wa_error(const QString& response);
65  void wa_response_token(const QByteArray& data);
66  void wa_error_token(const QString& error);
67 
68 
69 private:
70 
71  LFMLoginStuff _login_info;
72 
73 };
74 
75 
76 
77 #endif // LFMLOGINTHREAD_H
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:31
Definition: LFMLoginThread.h:42
Definition: LFMLoginThread.h:31