Manipulation of Devices from Qt. More...
Detailed Description
Manipulation of Devices from Qt.
These functions allow to display the information in Device::Node's friendly in QAbstractItemModel derivatives.
This namespace contains tools to work with the score node tree.
The problem is as follows : We want to display the nodes defined in the OSSIA API (ossia::net::node_base) in a QTreeView.
QTreeView's model must inherit from QAbstractItemModel. The Qt documentation explains how to build such a model. The idea is that the model requires a data structure that it will control entirely : one cannot change the data structure from the outside, edition has to go through the QAbstractItemModel class to notify the view of changes of the model.
The QAbstractItemModel is implemented in Explorer::DeviceExplorerModel.
But since we do not control the network messages that change the OSSIA nodes automatically, we have to create another set of classes that will mirror them and be used solely for displaying and editing by the QAbstractItemModel.
This is the role of the class Device::Node.
- The class Device::DeviceInterface wraps an ossia::net::device_base.
- When a node of the device changes, the Device::DeviceInterface is notified and sends a signal.
- The class Explorer::DeviceDocumentPlugin with Explorer::NodeUpdateProxy does the conversion from Device::DeviceInterface's signals to actions on the Explorer::DeviceExplorerModel, which applies the changes to the device tree to the Device::Node hierarchy.
Likewise, when loading a scenario, first the Device::Node hierarchy is deserialized, then the relevant ossia data structures are recreated.
This library also contains the relevant data-only structures used for serialization: Device::AddressSettings, etc., and interfaces for the UIs of the protocols.
Classes | |
| class | AddressDialog |
| struct | AddressSettings |
| struct | AddressSettingsCommon |
| struct | DeviceCapas |
| class | DeviceCompleter |
| The DeviceCompleter class. More... | |
| class | DeviceEnumerator |
| class | DeviceExplorerNode |
| class | DeviceInterface |
| class | DeviceList |
| The DeviceList class. More... | |
| class | DeviceModelProvider |
| class | DeviceModelProviderList |
| struct | DeviceSettings |
| struct | DroppedAddress |
| What a drop of device explorer nodes (a FreeNodeList) resolves to. More... | |
| struct | FullAddressAccessorSettings |
| struct | FullAddressSettings |
| struct | HardwarePortDeviceResource |
| class | NodeBasedItemModel |
| class | OwningDeviceInterface |
| class | ProtocolFactory |
| class | ProtocolFactoryList |
| class | ProtocolSettingsWidget |
| struct | TCPPortDeviceResource |
| struct | UDPPortDeviceResource |
Typedefs | |
| using | RepetitionFilter = bool |
| using | Node = TreeNode< DeviceExplorerNode > |
| using | NodePath = TreePath |
| using | FreeNode = std::pair< State::Address, Device::Node > |
| using | NodeList = std::vector< Device::Node * > |
| using | FreeNodeList = std::vector< FreeNode > |
| using | small_node_vec = ossia::small_vector< const Device::Node *, 16 > |
| using | DeviceResource = ossia::variant< UDPPortDeviceResource, TCPPortDeviceResource, HardwarePortDeviceResource > |
| using | DeviceResources = ossia::small_vector< DeviceResource, 2 > |
| using | DeviceResourceMap = ossia::flat_map< QString, DeviceResources > |
| using | DeviceEnumerators = std::vector< std::pair< QString, Device::DeviceEnumerator * > > |
Enumerations | |
| enum class | NodeKind : uint16_t { None = 0 , Value = 1 << 0 , AudioIn = 1 << 1 , AudioOut = 1 << 2 , MidiIn = 1 << 3 , MidiOut = 1 << 4 , TextureIn = 1 << 5 , TextureOut = 1 << 6 , GeometryIn = 1 << 7 , GeometryOut = 1 << 8 } |
| The kinds of nodes a device can carry. More... | |
| enum | DeviceLogging : int8_t { LogNothing , LogUnfolded , LogEverything } |
Functions | |
| template<> | |
| FullAddressSettings | FullAddressSettings::make< FullAddressSettings::as_parent > (const Device::AddressSettings &other, const State::Address &addr) noexcept |
| template<> | |
| FullAddressSettings | FullAddressSettings::make< FullAddressSettings::as_child > (const Device::AddressSettings &other, const State::Address &addr) noexcept |
| bool | operator== (const AddressSettingsCommon &lhs, const AddressSettingsCommon &rhs) noexcept |
| bool | operator!= (const Device::AddressSettingsCommon &lhs, const Device::AddressSettingsCommon &rhs) noexcept |
| bool | operator== (const Device::AddressSettings &lhs, const Device::AddressSettings &rhs) noexcept |
| bool | operator!= (const Device::AddressSettings &lhs, const Device::AddressSettings &rhs) noexcept |
| bool | operator== (const Device::FullAddressSettings &lhs, const Device::FullAddressSettings &rhs) noexcept |
| bool | operator!= (const Device::FullAddressSettings &lhs, const Device::FullAddressSettings &rhs) noexcept |
| const QMap< ossia::bounding_mode, QString > & | ClipModeStringMap () |
| const QMap< ossia::bounding_mode, QString > & | ClipModePrettyStringMap () |
| const ossia::enum_map< ossia::access_mode, QString, 3 > & | AccessModeText () |
| To save / reload in JSON. | |
| const ossia::enum_map< ossia::access_mode, QString, 3 > & | AccessModePrettyText () |
| To show to the user. | |
| bool | hasInput (const std::optional< ossia::access_mode > &t) |
| bool | hasOutput (const std::optional< ossia::access_mode > &t) |
| Device::FullAddressAccessorSettings | makeFullAddressAccessorSettings (const State::AddressAccessor &addr, const Device::NodeBasedItemModel &deviceexplorer, ossia::value min, ossia::value max, ossia::value val) |
| Device::FullAddressAccessorSettings | makeFullAddressAccessorSettings (const Device::Node &mess) |
| QVariant | nameColumnData (const Device::Node &node, int role) |
| QVariant | deviceNameColumnData (const Device::Node &node, bool connected, int role) |
| QVariant | valueColumnData (const Device::Node &node, int role) |
| QVariant | GetColumnData (const Device::Node &node, int role) |
| QVariant | SetColumnData (const Device::Node &node, int role) |
| QVariant | minColumnData (const Device::Node &node, int role) |
| QVariant | maxColumnData (const Device::Node &node, int role) |
| bool | loadDeviceFromXML (const QString &filePath, Device::Node &node) |
| loadDeviceFromJamomaJSON Will load a device in a Jamoma-format XML file into the node. | |
| bool | loadDeviceFromScoreJSON (const rapidjson::Document &json, Node &node) |
| bool | loadDeviceFromScoreJSON (const QString &filePath, Device::Node &node) |
| bool | loadDeviceFromTouchOSC (const QString &filePath, Device::Node &node) |
| bool | operator< (const Device::Node &lhs, const Device::Node &rhs) |
| Device::Node * | getNodeFromString (Device::Node &n, const QStringList &parts) |
| Device::Node & | getNodeFromAddress (Device::Node &n, const State::Address &addr) |
| void | address_rec (QStringList &path, const Node *n, const Device::Node *&root) |
| State::AddressAccessor | address (const Node &treeNode) |
| std::optional< DroppedAddress > | addressOfDroppedNodes (const Device::FreeNodeList &nodes, const State::AddressAccessor ¤t) |
| void | parametersList (const Node &treeNode, State::MessageList &ml) |
| parametersList Recursive list of parameters in this node | |
| State::Message | message (const Node &node) |
| void | merge (Device::Node &base, const State::Message &message) |
| Device::Node | merge (Device::Node base, const State::MessageList &other) |
| void | dumpTree (const Device::Node &node, QString rec) |
| dumpTree An utility to print trees of Device::Nodes | |
| QString | deviceName (const Node &treeNode) |
| auto | findChildNode_it (const Device::Node &node, const QString &name) |
| const Device::Node * | findChildNode (const Device::Node &node, const QString &name) |
| template<typename Node_T , typename It > | |
| Node_T * | try_getNodeFromString_impl (Node_T &n, It begin, It end) |
| template<typename Node_T > | |
| Node_T * | try_getNodeFromString (Node_T &n, const QStringList &parts) |
| template<typename Node_T > | |
| Node_T * | try_getNodeFromAddress (Node_T &root, const State::Address &addr) |
| ossia::net::node_base * | findNodeFromPath (const QStringList &path, ossia::net::device_base &dev) |
| ossia::net::node_base * | findNodeFromPath (const Device::Node &path, ossia::net::device_base &dev) |
| Device::Node | ToDeviceExplorer (const ossia::net::node_base &ossia_node) |
| ossia::net::node_base * | createNodeFromPath (const QStringList &path, ossia::net::device_base &dev) |
| bool | is_parent (const State::Address &parent, const State::Address &child) |
| void | releaseDevice (ossia::net::network_context &ctx, std::unique_ptr< ossia::net::device_base > dd) |
| void | releaseDevice (ossia::net::network_context &ctx, std::shared_ptr< ossia::net::device_base > shared_dd) |
| constexpr NodeKind | operator| (NodeKind a, NodeKind b) noexcept |
| constexpr NodeKind & | operator|= (NodeKind &a, NodeKind b) noexcept |
| constexpr bool | carries (NodeKind set, NodeKind wanted) noexcept |
Whether every kind in wanted is in set. | |
| ossia::net::node_base * | getNodeFromPath (const QStringList &path, ossia::net::device_base &dev) |
| bool | hasEditableValue (ossia::parameter_type t) noexcept |
| Whether a parameter of that kind carries a value the explorer can show and edit. | |
| bool | operator== (const DeviceSettings &lhs, const DeviceSettings &rhs) noexcept |
| DeviceLogging | get_cur_logging (bool b) |
Variables | |
| const QMap< ossia::bounding_mode, QString > | clipmodemap |
| const QMap< ossia::bounding_mode, QString > | clipmodeprettymap |
Typedef Documentation
◆ Node
| typedef TreeNode< DeviceExplorerNode > Device::Node |
A data-only tree of nodes.
By opposition to ossia::net::node_base, these nodes contain pure data, no callbacks or complicated data structures. They can be serialized very easily and are used as the data model of Explorer::DeviceExplorerModel, as well as for serialization of devices.
Enumeration Type Documentation
◆ NodeKind
|
strong |
The kinds of nodes a device can carry.
"In" is what the device produces and score reads (usable by an inlet), "Out" what the device consumes (usable by an outlet). A device declares them in its capabilities so that the widgets listing e.g. the texture addresses only walk the devices worth walking: an OSC device will never hold a texture, and a libav device holds both video and audio.
Function Documentation
◆ loadDeviceFromXML()
| SCORE_LIB_DEVICE_EXPORT bool Device::loadDeviceFromXML | ( | const QString & | filePath, |
| Device::Node & | node | ||
| ) |
loadDeviceFromJamomaJSON Will load a device in a Jamoma-format XML file into the node.
The node has to be the device node.
◆ parametersList()
| void Device::parametersList | ( | const Node & | treeNode, |
| State::MessageList & | ml | ||
| ) |
parametersList Recursive list of parameters in this node
Note : this one takes an output reference as an optimization because of its use in DeviceExplorerModel::indexesToMime
Variable Documentation
◆ clipmodemap
| const QMap<ossia::bounding_mode, QString> Device::clipmodemap |
◆ clipmodeprettymap
| const QMap<ossia::bounding_mode, QString> Device::clipmodeprettymap |