WindowDevice.hpp
1 #pragma once
2 #include <Gfx/GfxDevice.hpp>
3 
4 namespace Gfx
5 {
6 
8 {
9  int width{};
10  int height{};
11  double rate{};
12  bool viewportSize{};
13  bool vsync{};
14 };
15 
17 {
18  SCORE_CONCRETE("5a181207-7d40-4ad8-814e-879fcdf8cc31")
19  QString prettyName() const noexcept override;
20  QString category() const noexcept override;
21  QUrl manual() const noexcept override;
22 
23  Device::DeviceInterface* makeDevice(
24  const Device::DeviceSettings& settings,
25  const Explorer::DeviceDocumentPlugin& plugin,
26  const score::DocumentContext& ctx) override;
27  const Device::DeviceSettings& defaultSettings() const noexcept override;
28  Device::AddressDialog* makeAddAddressDialog(
29  const Device::DeviceInterface& dev, const score::DocumentContext& ctx,
30  QWidget* parent) override;
31  Device::AddressDialog* makeEditAddressDialog(
33  const score::DocumentContext& ctx, QWidget*) override;
34 
35  Device::ProtocolSettingsWidget* makeSettingsWidget() override;
36 
37  QVariant makeProtocolSpecificSettings(const VisitorVariant& visitor) const override;
38 
39  void serializeProtocolSpecificSettings(
40  const QVariant& data, const VisitorVariant& visitor) const override;
41 
42  bool checkCompatibility(
43  const Device::DeviceSettings& a,
44  const Device::DeviceSettings& b) const noexcept override;
45 };
46 
47 class WindowDevice final : public GfxOutputDevice
48 {
49  W_OBJECT(WindowDevice)
50 public:
51  using GfxOutputDevice::GfxOutputDevice;
52  ~WindowDevice();
53 
54 private:
55  void addAddress(const Device::FullAddressSettings& settings) override;
56  void setupContextMenu(QMenu&) const override;
57  ossia::net::device_base* getDevice() const override { return m_dev.get(); }
58  bool reconnect() override;
59 
60  gfx_protocol_base* m_protocol{};
61  mutable std::unique_ptr<ossia::net::device_base> m_dev;
62 };
63 
65 {
66 public:
67  WindowSettingsWidget(QWidget* parent = nullptr);
68 
69  Device::DeviceSettings getSettings() const override;
70 
71  void setSettings(const Device::DeviceSettings& settings) override;
72 
73 private:
74  QLineEdit* m_deviceNameEdit{};
75  QSpinBox* m_width{};
76  QSpinBox* m_height{};
77  QSpinBox* m_rate{};
78  QCheckBox* m_viewportSize{};
79 };
80 
81 }
Definition: ProtocolSettingsWidget.hpp:41
Definition: DeviceInterface.hpp:66
Definition: ProtocolFactoryInterface.hpp:47
Definition: ProtocolSettingsWidget.hpp:22
Definition: GfxDevice.hpp:35
Definition: WindowDevice.hpp:48
Definition: WindowDevice.hpp:17
Definition: WindowDevice.hpp:65
Definition: GfxParameter.hpp:41
Binds the rendering pipeline to ossia processes.
Definition: CameraDevice.cpp:28
Definition: AddressSettings.hpp:49
Definition: DeviceSettings.hpp:20
Definition: AddressSettings.hpp:62
Definition: WindowDevice.hpp:8
The VisitorVariant struct.
Definition: VisitorInterface.hpp:26
Definition: DocumentContext.hpp:18