mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-20 21:43:12 -07:00
Display Registered Hosts in SettingsDialog
This commit is contained in:
parent
d435a9d368
commit
c993ca611e
12 changed files with 192 additions and 16 deletions
|
@ -32,12 +32,23 @@ class HostMAC
|
|||
|
||||
public:
|
||||
HostMAC() { memset(mac, 0, sizeof(mac)); }
|
||||
HostMAC(const HostMAC &o) { memcpy(mac, o.GetMAC(), sizeof(mac)); }
|
||||
explicit HostMAC(const uint8_t mac[6]) { memcpy(this->mac, mac, sizeof(this->mac)); }
|
||||
const uint8_t *GetMAC() const { return mac; }
|
||||
QString ToString() const { return QByteArray((const char *)mac, sizeof(mac)).toHex(); }
|
||||
uint64_t GetValue() const
|
||||
{
|
||||
return ((uint64_t)mac[0] << 0x28)
|
||||
| ((uint64_t)mac[1] << 0x20)
|
||||
| ((uint64_t)mac[2] << 0x18)
|
||||
| ((uint64_t)mac[3] << 0x10)
|
||||
| ((uint64_t)mac[4] << 0x8)
|
||||
| mac[5];
|
||||
}
|
||||
};
|
||||
|
||||
static bool operator==(const HostMAC &a, const HostMAC &b) { return memcmp(a.GetMAC(), b.GetMAC(), 6) == 0; }
|
||||
static bool operator==(const HostMAC &a, const HostMAC &b) { return memcmp(a.GetMAC(), b.GetMAC(), 6) == 0; }
|
||||
static bool operator<(const HostMAC &a, const HostMAC &b) { return a.GetValue() < b.GetValue(); }
|
||||
|
||||
class RegisteredHost
|
||||
{
|
||||
|
@ -54,14 +65,18 @@ class RegisteredHost
|
|||
|
||||
public:
|
||||
RegisteredHost();
|
||||
RegisteredHost(const RegisteredHost &o);
|
||||
|
||||
RegisteredHost(const ChiakiRegisteredHost &chiaki_host);
|
||||
|
||||
const HostMAC &GetPS4MAC() const { return ps4_mac; }
|
||||
const QString &GetPS4Nickname() const { return ps4_nickname; }
|
||||
|
||||
void SaveToSettings(QSettings *settings);
|
||||
void SaveToSettings(QSettings *settings) const;
|
||||
static RegisteredHost LoadFromSettings(QSettings *settings);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(RegisteredHost)
|
||||
Q_DECLARE_METATYPE(HostMAC)
|
||||
|
||||
#endif //CHIAKI_HOST_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue