Sayonara Player
LFMLoginThread.h
1 /* LFMLoginThread.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 LFMLOGINTHREAD_H
22 #define LFMLOGINTHREAD_H
23 
24 #include <QObject>
25 #include "Helper/globals.h"
26 
27 
29 {
30  QString token;
31  QString session_key;
32  bool logged_in;
33  bool subscriber;
34  QString error;
35 
37  {
38  logged_in = false;
39  subscriber = false;
40  }
41 };
42 
43 
45  public QObject
46 {
47  Q_OBJECT
48 
49 signals:
50  void sig_token_received(const QString& token);
51  void sig_error(const QString& error);
52  void sig_logged_in(bool success);
53 
54 public:
55  explicit LFMLoginThread(QObject *parent=nullptr);
56  ~LFMLoginThread();
57 
58  void login(const QString& username, const QString& password);
59 
60  LFMLoginStuff getLoginStuff();
61 
62 private slots:
63  void wa_response(const QByteArray& data);
64  void wa_error(const QString& response);
65 
66 private:
67  LFMLoginStuff _login_info;
68 };
69 
70 #endif // LFMLOGINTHREAD_H
Definition: LFMLoginThread.h:44
Definition: LFMLoginThread.h:28