Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
Loading...
Searching...
No Matches
controllablesession.h
Go to the documentation of this file.
1#ifndef JELLYFIN_MODEL_CONTROLLABLESESSION_H
2#define JELLYFIN_MODEL_CONTROLLABLESESSION_H
3
4#include <QObject>
5#include <QScopedPointer>
6#include <QSharedPointer>
7
9
10namespace Jellyfin {
11
12class ApiClient;
13
14namespace DTO {
16} // NS DTO
17
18namespace Model {
19
20class PlaybackManager;
21
22class DeviceTypeClass { Q_GADGET
23public:
30 Q_ENUM(Value)
31};
32
34 Q_GADGET
35public:
36 enum Value {
37 None = 0x0,
38 Audio = 0x1,
39 Video = 0x2,
40 Photo = 0x4
41 };
42 Q_DECLARE_FLAGS(MediaTypes, Value)
43};
44
45Q_DECLARE_OPERATORS_FOR_FLAGS(MediaTypeClass::MediaTypes)
46
49
56class ControllableSession : public QObject {
57 Q_OBJECT
58public:
59 explicit ControllableSession(QObject *parent = nullptr);
63 virtual QString id() const = 0;
67 virtual QString name() const = 0;
71 virtual QString appName() const = 0;
72 virtual DeviceType deviceType() const = 0;
73
77 virtual QString userName() const = 0;
83};
84
89 Q_OBJECT
90public:
91 LocalSession(ApiClient &apiClient, QObject *parent = nullptr);
92 QString id() const override;
93 QString name() const override;
94 QString appName() const override;
95 DeviceType deviceType() const override;
96 QString userName() const override;
97 PlaybackManager *createPlaybackManager() const override;
98private:
99 ApiClient &m_apiClient;
100};
101
106 Q_OBJECT
107public:
108 ControllableJellyfinSession(QSharedPointer<DTO::SessionInfo> info, ApiClient &apiClient, QObject *parent = nullptr);
109 QString id() const override;
110 QString name() const override;
111 QString appName() const override;
112 DeviceType deviceType() const override;
113 QString userName() const override;
114 PlaybackManager *createPlaybackManager() const override;
115private:
116 QSharedPointer<DTO::SessionInfo> m_data;
117 ApiClient &m_apiClient;
118};
119
123class RemoteSessionScanner : public QObject {
124 Q_OBJECT
125public:
126 explicit RemoteSessionScanner(QObject *parent = nullptr);
130 virtual void startScanning() = 0;
134 virtual void stopScanning() = 0;
135signals:
144 void sessionLost(const QString &sessionId);
149};
150
151
157 Q_OBJECT
158 Q_DECLARE_PRIVATE(RemoteJellyfinSessionScanner);
159public:
160 explicit RemoteJellyfinSessionScanner(ApiClient *client, QObject *parent);
162
163 void startScanning() override;
164 void stopScanning() override;
165private:
166 QScopedPointer<RemoteJellyfinSessionScannerPrivate> d_ptr;
167};
168
169} // NS Model
170} // NS Jellyfin
171
172#endif // JELLYFIN_MODEL_CONTROLLABLESESSION_H
An Api client for Jellyfin. Handles requests and authentication.
Definition apiclient.h:90
A session on the Jellyfin server that can be controlled.
Definition controllablesession.h:105
QString userName() const override
user The username of who started this session
Definition controllablesession.cpp:105
QString id() const override
An unique id for this session.
Definition controllablesession.cpp:54
PlaybackManager * createPlaybackManager() const override
Creates a playbackManager for this device. This PlaybackManager has no QObject parent and must be cle...
Definition controllablesession.cpp:109
ControllableJellyfinSession(QSharedPointer< DTO::SessionInfo > info, ApiClient &apiClient, QObject *parent=nullptr)
Definition controllablesession.cpp:49
DeviceType deviceType() const override
Definition controllablesession.cpp:66
QString name() const override
An human-readable name for this session.
Definition controllablesession.cpp:62
QString appName() const override
The app for this session.
Definition controllablesession.cpp:58
Abstract class for describing a playback session that can be controlled.
Definition controllablesession.h:56
virtual DeviceType deviceType() const =0
virtual QString name() const =0
An human-readable name for this session.
virtual QString userName() const =0
user The username of who started this session
virtual QString id() const =0
An unique id for this session.
virtual QString appName() const =0
The app for this session.
virtual PlaybackManager * createPlaybackManager() const =0
Creates a playbackManager for this device. This PlaybackManager has no QObject parent and must be cle...
Definition controllablesession.h:22
Value
Definition controllablesession.h:24
@ Phone
Definition controllablesession.h:28
@ Tv
Definition controllablesession.h:26
@ Computer
Definition controllablesession.h:27
@ Unknown
Definition controllablesession.h:25
Dummy session representing this device.
Definition controllablesession.h:88
QString userName() const override
user The username of who started this session
Definition controllablesession.cpp:38
QString appName() const override
The app for this session.
Definition controllablesession.cpp:25
QString name() const override
An human-readable name for this session.
Definition controllablesession.cpp:29
DeviceType deviceType() const override
Definition controllablesession.cpp:34
PlaybackManager * createPlaybackManager() const override
Creates a playbackManager for this device. This PlaybackManager has no QObject parent and must be cle...
Definition controllablesession.cpp:42
QString id() const override
An unique id for this session.
Definition controllablesession.cpp:21
LocalSession(ApiClient &apiClient, QObject *parent=nullptr)
Definition controllablesession.cpp:18
Definition controllablesession.h:33
Value
Definition controllablesession.h:36
@ Photo
Definition controllablesession.h:40
@ None
Definition controllablesession.h:37
@ Video
Definition controllablesession.h:39
@ Audio
Definition controllablesession.h:38
Base class for a playback manager.
Definition playbackmanager.h:59
Definition controllablesession.cpp:117
Lists controllable Jellyfin sessions from the Jellyfin server.
Definition controllablesession.h:156
void stopScanning() override
Definition controllablesession.cpp:163
RemoteJellyfinSessionScanner(ApiClient *client, QObject *parent)
Definition controllablesession.cpp:128
virtual ~RemoteJellyfinSessionScanner()
Definition controllablesession.cpp:133
void startScanning() override
Definition controllablesession.cpp:135
Definition controllablesession.h:123
void sessionFound(Jellyfin::Model::ControllableSession *session)
RemoteSessionScanner(QObject *parent=nullptr)
Definition controllablesession.cpp:113
void sessionLost(const QString &sessionId)
MediaTypeClass::MediaTypes MediaTypes
Definition controllablesession.h:48
Jellyfin::DTO::ClientCapabilities ClientCapabilities
Definition clientcapabilities.h:158