-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefine.h
62 lines (51 loc) · 1.37 KB
/
define.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
54
55
56
57
58
59
60
61
62
#ifndef DEFINE_H
#define DEFINE_H
//contiene definizioni generali utilizzate da più oggetti
//controlla che l'oggetto sia stato creato prima di cancellarlo
template <class T>
inline void safeDelete(T object){
if (object != nullptr)
delete object;
}
//flag per il passaggio dati da mainprogram a settings
enum CurrentUserFlags {
AUTOMATIC_FLAG = 1,
NOTIFICATION_FLAG = 2,
PRIVATE_FLAG = 4,
};
typedef enum CurrentUserFlags CurrentUserFlags;
//struttura comune per gli utenti
#include <string>
struct User {
std::string ip;
std::string name;
int16_t age;
std::string picture;
bool operator==(const User& a) const {
/*IMPORTANT, the age and the picture are not compared! It has no sense to compare based on them!*/
return (!ip.compare(a.ip) && (!name.compare(a.name)));
}
};
enum UDP_Discover_Status {
UDS_STOP = 0,
UDS_HIDDEN = 1,
UDS_ACTIVE = 2,
};
typedef enum UDP_Discover_Status UDP_Discover_Status;
enum FileTransfer_Status {
FT_COMPLETE = 100,
FT_ERROR = 101,
};
typedef enum FileTransfer_Status FileTransfer_Status;
enum FileTransfer_Type {
FT_DIRECTORY = 0,
FT_FILE = 1,
};
typedef enum FileTransfer_Type FileTransfer_Type;
struct transferStatus {
uint8_t progress;
uint32_t secondsLeft;
double speed;
};
const std::string iconString = ":/images/icons/Icons/";
#endif // DEFINE_H