forked from obsproject/obs-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreaming-helpers.hpp
More file actions
80 lines (66 loc) · 1.91 KB
/
streaming-helpers.hpp
File metadata and controls
80 lines (66 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#pragma once
#include "url-push-button.hpp"
#include "obs.hpp"
#include <QComboBox>
#include <QLineEdit>
#include <QLabel>
#include <json11.hpp>
extern json11::Json get_services_json();
extern json11::Json get_service_from_json(const json11::Json &root,
const char *name);
extern OBSDataArrayAutoRelease
backup_servers_to_data_array(const QJsonArray &array);
extern std::vector<std::string> get_backup_servers(obs_data_t *settings);
extern int find_server_index(const std::string &server,
const std::vector<std::string> &backupServers,
QComboBox *serversComboBox);
enum class ListOpt : int {
ShowAll = 1,
Custom,
};
class StreamSettingsUI : public QObject {
Q_OBJECT
QLabel *ui_streamKeyLabel;
QComboBox *ui_service;
QComboBox *ui_server;
QLineEdit *ui_customServer;
UrlPushButton *ui_moreInfoButton;
UrlPushButton *ui_streamKeyButton;
json11::Json servicesRoot;
bool servicesLoaded = false;
QString lastService;
public:
inline void Setup(QLabel *streamKeyLabel, QComboBox *service,
QComboBox *server, QLineEdit *customServer,
UrlPushButton *moreInfoButton,
UrlPushButton *streamKeyButton)
{
ui_streamKeyLabel = streamKeyLabel;
ui_service = service;
ui_server = server;
ui_customServer = customServer;
ui_moreInfoButton = moreInfoButton;
ui_streamKeyButton = streamKeyButton;
}
inline bool IsCustomService() const
{
return ui_service->currentData().toInt() ==
(int)ListOpt::Custom;
}
inline void ClearLastService() { lastService.clear(); }
inline json11::Json GetServicesJson()
{
if (!servicesLoaded && servicesRoot.is_null()) {
servicesRoot = get_services_json();
servicesLoaded = true;
}
return servicesRoot;
}
inline const QString &LastService() const { return lastService; }
bool IsServiceOutputHasNetworkFeatures();
public slots:
void UpdateMoreInfoLink();
void UpdateKeyLink();
void LoadServices(bool showAll);
void UpdateServerList();
};