-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.h
53 lines (40 loc) · 997 Bytes
/
init.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef INIT_H
#define INIT_H
#include <QObject>
#include <QDebug>
#include "library.h"
#include "login.h"
#include "playerwindow.h"
class Init : public QObject{
Q_OBJECT
public:
Library *library = new Library();
PlayerWindow *w = nullptr;
Init(){
if(!library->set["init"].toBool())
{
logOut();
}
else{
loggedIn(library->set["token"].toString(),library->set["restoreToken"].toString());
}
}
public slots:
void loggedIn(QString token,QString refresh)
{
w = new PlayerWindow(library,token,refresh);
connect(w,SIGNAL(showLoginWindow()),this,SLOT(logOut()));
}
void logOut()
{
if(w != nullptr)
{
w->player->play(false);
w->deleteLater();
}
Login *login = new Login();
login->show();
connect(login,SIGNAL(loggedIn(QString,QString)),this,SLOT(loggedIn(QString,QString)));
}
};
#endif // INIT_H