mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-20 13:33:13 -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
|
@ -18,18 +18,36 @@
|
|||
#ifndef CHIAKI_SETTINGS_H
|
||||
#define CHIAKI_SETTINGS_H
|
||||
|
||||
#include "host.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
class Settings
|
||||
class Settings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QSettings settings;
|
||||
|
||||
QMap<HostMAC, RegisteredHost> registered_hosts;
|
||||
|
||||
void LoadRegisteredHosts();
|
||||
void SaveRegisteredHosts();
|
||||
|
||||
public:
|
||||
Settings();
|
||||
explicit Settings(QObject *parent = nullptr);
|
||||
|
||||
bool GetDiscoveryEnabled() { return settings.value("settings/auto_discovery", true).toBool(); }
|
||||
void SetDiscoveryEnabled(bool enabled) { settings.setValue("settings/auto_discovery", enabled); }
|
||||
|
||||
QList<RegisteredHost> GetRegisteredHosts() const { return registered_hosts.values(); }
|
||||
void AddRegisteredHost(const RegisteredHost &host);
|
||||
void RemoveRegisteredHost(const HostMAC &mac);
|
||||
bool GetRegisteredHostRegistered(const HostMAC &mac) const { return registered_hosts.contains(mac); }
|
||||
RegisteredHost GetRegisteredHost(const HostMAC &mac) const { return registered_hosts[mac]; }
|
||||
|
||||
signals:
|
||||
void RegisteredHostsUpdated();
|
||||
};
|
||||
|
||||
#endif // CHIAKI_SETTINGS_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue