Loading...
Searching...
No Matches
PortAddressComboBox.hpp
1#pragma once
2#include <State/Address.hpp>
3
4#include <Device/Protocol/DeviceInterface.hpp>
5
6#include <Process/Dataflow/PortType.hpp>
7
8#include <score/document/DocumentContext.hpp>
9
10#include <QComboBox>
11#include <QPointer>
12
13#include <score_lib_process_export.h>
14
15#include <verdigris>
16
17namespace Device
18{
19class DeviceList;
20}
21namespace Process
22{
23class Port;
24
30SCORE_LIB_PROCESS_EXPORT
31Device::NodeKind nodeKindOf(PortType type, bool inlet) noexcept;
32
42SCORE_LIB_PROCESS_EXPORT
43std::vector<State::Address>
44listPortAddresses(Device::DeviceInterface& device, PortType type, bool inlet);
45
46SCORE_LIB_PROCESS_EXPORT
47std::vector<State::Address>
48listPortAddresses(Device::DeviceList& devices, PortType type, bool inlet);
49
58class SCORE_LIB_PROCESS_EXPORT PortAddressComboBox final : public QComboBox
59{
60 W_OBJECT(PortAddressComboBox)
61public:
63 Device::DeviceList& devices, PortType type, bool inlet, QWidget* parent);
64 ~PortAddressComboBox() override;
65
66 void setAddress(const State::AddressAccessor& addr);
67 const State::AddressAccessor& address() const noexcept { return m_address; }
68
70 void reload();
71
72 void addressChanged(const State::AddressAccessor& arg_1)
73 E_SIGNAL(SCORE_LIB_PROCESS_EXPORT, addressChanged, arg_1)
74
75private:
76 void dragEnterEvent(QDragEnterEvent* event) override;
77 void dropEvent(QDropEvent* event) override;
78
79 void watch(Device::DeviceInterface& dev);
80 void scheduleReload();
81 void showAddress();
82 void commitText();
83 void commit(State::AddressAccessor addr);
84
85 QPointer<Device::DeviceList> m_devices;
86 State::AddressAccessor m_address;
87 PortType m_type{};
88 bool m_inlet{};
89 bool m_reloadPending{};
90};
91
96SCORE_LIB_PROCESS_EXPORT
97QComboBox* makePortAddressCombo(
98 const Process::Port& port, const score::DocumentContext& ctx, QWidget* parent);
99}
Definition DeviceInterface.hpp:107
The DeviceList class.
Definition DeviceList.hpp:26
Address picker for the audio / midi / texture / geometry ports.
Definition PortAddressComboBox.hpp:59
Definition Port.hpp:106
Manipulation of Devices from Qt.
Definition AddressSettings.cpp:14
NodeKind
The kinds of nodes a device can carry.
Definition DeviceInterface.hpp:52
Base classes and tools to implement processes and layers.
Definition JSONVisitor.hpp:1115
std::vector< State::Address > listPortAddresses(Device::DeviceInterface &dev, PortType type, bool inlet)
The addresses of a device that a port of that type can bind to.
Definition PortAddressComboBox.cpp:124
QComboBox * makePortAddressCombo(const Process::Port &port, const score::DocumentContext &ctx, QWidget *parent)
A PortAddressComboBox bound to a port: follows the port's address and submits a ChangePortAddress com...
Definition PortAddressComboBox.cpp:315
Device::NodeKind nodeKindOf(PortType type, bool inlet) noexcept
The kind of device node a port of that type binds to.
Definition PortAddressComboBox.cpp:34
Definition Address.hpp:136
Definition DocumentContext.hpp:18