-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
qefientry.cpp
66 lines (53 loc) · 1.25 KB
/
qefientry.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
59
60
61
62
63
64
65
66
#include "qefientry.h"
#include <QDebug>
#include <QtEndian>
#include <qefi.h>
QString QEFIEntry::name() const
{
return m_name;
}
quint16 QEFIEntry::id() const
{
return m_id;
}
QString QEFIEntry::devicePath() const
{
return m_devicePath;
}
bool QEFIEntry::isActive() const
{
return m_isActive;
}
void QEFIEntry::setActive(bool active)
{
if (m_loadOption != nullptr) {
m_loadOption->setIsVisible(active);
}
m_isActive = active;
}
QEFILoadOption *QEFIEntry::loadOption() const
{
return m_loadOption;
}
QEFIEntry::QEFIEntry(quint16 id, QString name, QString devicePath)
{
m_id = id; m_name = name; m_devicePath = devicePath; m_isActive = true;
}
QEFIEntry::QEFIEntry(quint16 id, QByteArray boot_data)
{
m_id = id;
m_name = qefi_extract_name(boot_data);
m_devicePath = qefi_extract_path(boot_data);
m_isActive = (qFromLittleEndian<quint32>(*((quint32 *)boot_data.data())) & 0x00000001);
}
QEFIEntry::QEFIEntry(quint16 id, QEFILoadOption *loadOption)
{
m_id = id;
if (loadOption && loadOption->isValidated()) {
m_loadOption = loadOption;
m_name = loadOption->name();
m_devicePath = loadOption->path();
m_isActive = loadOption->isVisible();
}
}
QEFIEntry::QEFIEntry() {}