mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-14 18:57:07 -07:00
Finish Discovery Service
This commit is contained in:
parent
fe83c6790a
commit
70b2b3f009
9 changed files with 157 additions and 18 deletions
|
@ -19,20 +19,42 @@
|
|||
#define CHIAKI_DISCOVERYMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
|
||||
#include <chiaki/discoveryservice.h>
|
||||
|
||||
struct DiscoveryHost
|
||||
{
|
||||
ChiakiDiscoveryHostState state;
|
||||
uint16_t host_request_port;
|
||||
#define STRING_MEMBER(name) QString name;
|
||||
CHIAKI_DISCOVERY_HOST_STRING_FOREACH(STRING_MEMBER)
|
||||
#undef STRING_MEMBER
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(DiscoveryHost)
|
||||
|
||||
class DiscoveryManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class DiscoveryManagerPrivate;
|
||||
|
||||
private:
|
||||
ChiakiDiscoveryService service;
|
||||
QList<DiscoveryHost> hosts;
|
||||
|
||||
private slots:
|
||||
void DiscoveryServiceHosts(QList<DiscoveryHost> hosts);
|
||||
|
||||
public:
|
||||
explicit DiscoveryManager(QObject *parent = nullptr);
|
||||
~DiscoveryManager();
|
||||
|
||||
const QList<DiscoveryHost> GetHosts() const { return hosts; }
|
||||
|
||||
signals:
|
||||
void HostsUpdated();
|
||||
};
|
||||
|
||||
#endif //CHIAKI_DISCOVERYMANAGER_H
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "discoverymanager.h"
|
||||
|
||||
class DynamicGridWidget;
|
||||
class ServerItemWidget;
|
||||
|
||||
|
@ -31,6 +33,8 @@ class MainWindow : public QMainWindow
|
|||
DynamicGridWidget *grid_widget;
|
||||
QList<ServerItemWidget *> server_item_widgets;
|
||||
|
||||
DiscoveryManager discovery_manager;
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
|
||||
|
@ -40,6 +44,8 @@ class MainWindow : public QMainWindow
|
|||
|
||||
void RunDiscovery();
|
||||
void ShowSettings();
|
||||
|
||||
void DiscoveryHostsUpdated();
|
||||
};
|
||||
|
||||
#endif //CHIAKI_MAINWINDOW_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue