-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlicense.h
More file actions
57 lines (46 loc) · 1.3 KB
/
license.h
File metadata and controls
57 lines (46 loc) · 1.3 KB
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
#ifndef LICENSE_H
#define LICENSE_H
#include <QDir>
#include <QDate>
#include <QString>
#include <QByteArray>
class License
{
public:
// Constructors
License() :
m_macAddress(""), m_expiryDate(QDate::currentDate()), m_licenseHash(000)
{
saveToFile(QString("test.txt"));
}
License(QString mac):
m_macAddress(mac), m_expiryDate(QDate::currentDate())
{
m_licenseHash = generateLicenseHash(m_macAddress);
saveToFile(QString("test.txt"));
}
License(QString mac, QDate expiry) :
m_macAddress(mac), m_expiryDate(expiry)
{
m_licenseHash = generateLicenseHash(m_macAddress);
saveToFile(QString("test.txt"));
}
// Print the generated license hash
void printLicenseHash() const;
// Generate the Hash from a MAC addr
uint generateLicenseHash(QString addr);
// Write the generated license hash and expiry date to a file
void saveToFile(QString fileName, QString path=QDir::homePath());
// Getter methods
uint getLicenseHash() const;
QDate getExpiryDate() const;
QString getMacAddress() const;
// Setter methods
void setExpiryDate(QDate date);
void setMacAddress(QString mac);
private:
uint m_licenseHash;
QDate m_expiryDate;
QString m_macAddress;
};
#endif // LICENSE_H