Group nodes by app name

This commit is contained in:
Joey Yakimowich-Payne 2026-02-06 14:19:14 -07:00
commit 621d67ebab
3 changed files with 712 additions and 144 deletions

View file

@ -43,6 +43,15 @@ struct WarpNodeData {
std::vector<warppipe::PortInfo> outputPorts;
};
/// Data for an app-group node (multiple PipeWire streams collapsed into one visual node).
struct AppGroupData {
std::string groupKey;
std::vector<uint32_t> memberPwIds; ///< PipeWire node IDs in this group.
/// canonical port index → list of actual member PortIds for fan-out.
std::unordered_map<unsigned int, std::vector<warppipe::PortId>> outputPortMap;
std::unordered_map<unsigned int, std::vector<warppipe::PortId>> inputPortMap;
};
class WarpGraphModel : public QtNodes::AbstractGraphModel {
Q_OBJECT
@ -87,6 +96,9 @@ public:
uint32_t findPwNodeIdByName(const std::string &name) const;
bool isGroupNode(QtNodes::NodeId nodeId) const;
const AppGroupData *appGroupData(QtNodes::NodeId nodeId) const;
struct NodeVolumeState {
float volume = 1.0f;
bool mute = false;
@ -181,5 +193,18 @@ private:
std::unordered_map<QtNodes::NodeId, float> m_peakLevels;
std::unordered_map<QtNodes::ConnectionId, ConnectionChannel> m_connectionChannels;
std::unordered_map<QtNodes::NodeId, AppGroupData> m_appGroups;
std::unordered_map<std::string, QtNodes::NodeId> m_groupKeyToQt;
std::unordered_map<uint32_t, QtNodes::NodeId> m_pwToGroupQt;
struct GroupPortRef {
QtNodes::NodeId groupQtId;
QtNodes::PortIndex portIndex;
bool isInput;
};
std::unordered_map<uint32_t, GroupPortRef> m_portToGroupPort;
void rebuildGroupPortMap(QtNodes::NodeId groupQtId);
void recomputeConnectionChannels();
};