1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2018-2019 The ManaPlus Developers |
4 |
|
|
* Copyright (C) 2019-2021 Andrei Karas |
5 |
|
|
* |
6 |
|
|
* This file is part of The ManaPlus Client. |
7 |
|
|
* |
8 |
|
|
* This program is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
11 |
|
|
* any later version. |
12 |
|
|
* |
13 |
|
|
* This program is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU General Public License |
19 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 |
|
|
*/ |
21 |
|
|
|
22 |
|
|
#ifndef PINCODEMANAGER_H |
23 |
|
|
#define PINCODEMANAGER_H |
24 |
|
|
|
25 |
|
|
#include "enums/simpletypes/beingid.h" |
26 |
|
|
|
27 |
|
|
#include "enums/gui/pincodestate.h" |
28 |
|
|
|
29 |
|
|
#include <string> |
30 |
|
|
|
31 |
|
|
#include "localconsts.h" |
32 |
|
|
|
33 |
|
|
class PincodeDialog; |
34 |
|
|
class Window; |
35 |
|
|
|
36 |
|
|
class PincodeManager final |
37 |
|
|
{ |
38 |
|
|
public: |
39 |
|
|
PincodeManager(); |
40 |
|
|
|
41 |
|
|
A_DELETE_COPY(PincodeManager) |
42 |
|
|
|
43 |
|
|
~PincodeManager(); |
44 |
|
|
|
45 |
|
|
void init(); |
46 |
|
|
|
47 |
|
|
void updateState(); |
48 |
|
|
|
49 |
|
|
void pinOk(); |
50 |
|
|
|
51 |
|
|
void wrongPin(); |
52 |
|
|
|
53 |
|
|
void lockedPin(); |
54 |
|
|
|
55 |
|
|
void setSeed(const uint32_t seed) |
56 |
|
|
{ mSeed = seed; } |
57 |
|
|
|
58 |
|
|
void setAccountId(const BeingId id) |
59 |
|
|
{ mAccountId = id; } |
60 |
|
|
|
61 |
|
|
void setState(const PincodeStateT state) |
62 |
|
|
{ mState = state; } |
63 |
|
|
|
64 |
|
|
void setPincodeLockFlag(const bool flag) |
65 |
|
|
{ mLockFlag = flag; } |
66 |
|
|
|
67 |
|
|
void changePincode(const std::string &pincode); |
68 |
|
|
|
69 |
|
|
void clearDialog(const PincodeDialog *const PincodeDialog); |
70 |
|
|
|
71 |
|
|
void setNewPincode(const std::string &pincode); |
72 |
|
|
|
73 |
|
|
void sendPincode(const std::string &pincode); |
74 |
|
|
|
75 |
|
|
void closeDialogs(); |
76 |
|
|
|
77 |
|
|
bool isBlocked(); |
78 |
|
|
|
79 |
|
|
bool processPincodeStatus(const uint16_t state); |
80 |
|
|
|
81 |
|
|
protected: |
82 |
|
|
std::string mOldPincode; |
83 |
|
|
std::string mNewPincode; |
84 |
|
|
uint32_t mSeed; |
85 |
|
|
BeingId mAccountId; |
86 |
|
|
Window *mDialog; |
87 |
|
|
PincodeStateT mState; |
88 |
|
|
bool mLockFlag; |
89 |
|
|
}; |
90 |
|
|
|
91 |
|
|
extern PincodeManager pincodeManager; |
92 |
|
|
|
93 |
|
|
#endif // PINCODEMANAGER_H |