Loading...
Searching...
No Matches
MapperDevice.hpp
1#pragma once
2
3#if __has_include(<QQmlEngine>)
4#include <Device/Protocol/DeviceInterface.hpp>
5#include <Device/Protocol/DeviceSettings.hpp>
6#include <Device/Protocol/ProtocolSettingsWidget.hpp>
7
8#include <Explorer/DefaultProtocolFactory.hpp>
9
10#include <verdigris>
11
12inline QDataStream&
13operator<<(QDataStream& st, const std::vector<ossia::net::node_base*>& p)
14{
15 return st;
16}
17inline QDataStream& operator>>(QDataStream& st, std::vector<ossia::net::node_base*>& p)
18{
19 return st;
20}
21Q_DECLARE_METATYPE(std::vector<ossia::net::node_base*>)
22W_REGISTER_ARGTYPE(std::vector<ossia::net::node_base*>)
23class QCodeEditor;
24namespace Protocols
25{
26class Mapper : public QObject
27{
28};
29
30struct MapperSpecificSettings
31{
32 QString text;
33};
34
35class MapperProtocolFactory final : public Protocols::DefaultProtocolFactory
36{
37 SCORE_CONCRETE("910e2d87-a087-430d-b725-c988fe2bea01")
38
39public:
40 ~MapperProtocolFactory();
41
42private:
43 QString prettyName() const noexcept override;
44 QString category() const noexcept override;
45 QUrl manual() const noexcept override;
46
47 Device::DeviceEnumerators
48 getEnumerators(const score::DocumentContext& ctx) const override;
49
50 Device::DeviceInterface* makeDevice(
51 const Device::DeviceSettings& settings,
52 const Explorer::DeviceDocumentPlugin& plugin,
53 const score::DocumentContext& ctx) override;
54
55 const Device::DeviceSettings& defaultSettings() const noexcept override;
56
57 Device::ProtocolSettingsWidget* makeSettingsWidget() override;
58
59 QVariant makeProtocolSpecificSettings(const VisitorVariant& visitor) const override;
60
61 void serializeProtocolSpecificSettings(
62 const QVariant& data, const VisitorVariant& visitor) const override;
63
64 bool checkCompatibility(
65 const Device::DeviceSettings& a,
66 const Device::DeviceSettings& b) const noexcept override;
67};
68
69class MapperProtocolSettingsWidget : public Device::ProtocolSettingsWidget
70{
71public:
72 MapperProtocolSettingsWidget(QWidget* parent = nullptr);
73
74 Device::DeviceSettings getSettings() const override;
75
76 void setSettings(const Device::DeviceSettings& settings) override;
77
78protected:
79 void setDefaults();
80
81protected:
82 QLineEdit* m_name{};
83 QTextEdit* m_codeEdit{};
84};
85}
86
87Q_DECLARE_METATYPE(Protocols::MapperSpecificSettings)
88W_REGISTER_ARGTYPE(Protocols::MapperSpecificSettings)
89#endif
Definition DefaultProtocolFactory.hpp:10
Manipulation of Devices from Qt.
Definition AddressSettings.cpp:14
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition DeviceSettings.hpp:20
The VisitorVariant struct.
Definition VisitorInterface.hpp:26