20#ifndef SERVER_DISCOVERY_MODEL_H
21#define SERVER_DISCOVERY_MODEL_H
25#include <QAbstractListModel>
27#include <QJsonDocument>
29#include <QJsonParseError>
31#include <QHostAddress>
62 int rowCount(
const QModelIndex &parent = QModelIndex())
const override {
63 if (parent.isValid())
return 0;
64 return static_cast<int>(m_discoveredServers.size());
67 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
74 void on_datagramsAvailable();
76 const QByteArray MAGIC_PACKET =
"who is JellyfinServer?";
77 const quint16 BROADCAST_PORT = 7359;
79 std::vector<ServerDiscovery> m_discoveredServers;
Discovers nearby Jellyfin servers and puts them in this list.
Definition serverdiscoverymodel.h:44
Roles
Definition serverdiscoverymodel.h:47
@ ROLE_ID
Definition serverdiscoverymodel.h:50
@ ROLE_NAME
Definition serverdiscoverymodel.h:48
@ ROLE_ADDRESS
Definition serverdiscoverymodel.h:49
void refresh()
Refreshes the model and searches for new servers.
Definition serverdiscoverymodel.cpp:44
ServerDiscoveryModel(QObject *parent=nullptr)
Definition serverdiscoverymodel.cpp:22
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition serverdiscoverymodel.cpp:28
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition serverdiscoverymodel.h:62
QHash< int, QByteArray > roleNames() const override
Definition serverdiscoverymodel.h:54
Definition serverdiscoverymodel.h:35
QString address
Definition serverdiscoverymodel.h:37
QString id
Definition serverdiscoverymodel.h:38
QString name
Definition serverdiscoverymodel.h:36