-
Notifications
You must be signed in to change notification settings - Fork 1
/
license.cpp
58 lines (46 loc) · 957 Bytes
/
license.cpp
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
#include "license.h"
#include <string>
#include <iostream>
#include <QFile>
#include <QDebug>
#include <QTextStream>
#include <QCryptographicHash>
void License::printLicenseHash() const
{
qDebug() << m_licenseHash;
}
uint License::generateLicenseHash(QString addr)
{
return qHash(addr);
}
void License::saveToFile(QString fileName, QString path)
{
QFile file(fileName);
QDir::setCurrent(path);
if ( !file.open(QIODevice::WriteOnly | QIODevice::Text) ) {
qDebug() << "Failed to open file.";
return;
}
QTextStream stream(&file);
stream << m_licenseHash;
}
QDate License::getExpiryDate() const
{
return m_expiryDate;
}
uint License::getLicenseHash() const
{
return m_licenseHash;
}
QString License::getMacAddress() const
{
return m_macAddress;
}
void License::setExpiryDate(QDate expiry)
{
m_expiryDate = expiry;
}
void License::setMacAddress(QString mac)
{
m_macAddress = mac;
}