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 | |
struct | AddressSettingsCommon |
struct | AddressSettings |
struct | FullAddressSettings |
struct | FullAddressAccessorSettings |
class | NodeBasedItemModel |
class | DeviceExplorerNode |
struct | DeviceCapas |
class | DeviceInterface |
class | OwningDeviceInterface |
struct | DeviceSettings |
struct | UDPPortDeviceResource |
struct | TCPPortDeviceResource |
struct | HardwarePortDeviceResource |
class | DeviceEnumerator |
class | ProtocolFactory |
class | ProtocolFactoryList |
class | ProtocolSettingsWidget |
class | AddressDialog |
class | AddressAccessorEditWidget |
class | DeviceCompleter |
The DeviceCompleter class. More... | |
class | DeviceModelProvider |
class | DeviceModelProviderList |
class | DeviceList |
The DeviceList class. More... | |
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 | 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. More... | |
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) |
void | parametersList (const Node &treeNode, State::MessageList &ml) |
parametersList Recursive list of parameters in this node More... | |
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) |
ossia::net::node_base * | getNodeFromPath (const QStringList &path, ossia::net::device_base &dev) |
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.
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 |