Add delete

This commit is contained in:
Joey Yakimowich-Payne 2026-01-28 11:19:34 -07:00
commit 05d6c06603
6 changed files with 429 additions and 6 deletions

View file

@ -498,6 +498,16 @@ bool PipeWireGraphModel::deleteNode(QtNodes::NodeId const nodeId)
return false;
}
const Potato::NodeInfo info = m_nodes.at(nodeId);
if (info.type != Potato::NodeType::Virtual) {
return false;
}
const Potato::NodeInfo liveNode = m_controller ? m_controller->nodeById(info.id) : Potato::NodeInfo{};
if (liveNode.isValid()) {
m_controller->destroyVirtualNode(info.id);
}
std::vector<QtNodes::ConnectionId> toRemove;
for (const auto &conn : m_connections) {
if (conn.outNodeId == nodeId || conn.inNodeId == nodeId) {
@ -517,9 +527,16 @@ bool PipeWireGraphModel::deleteNode(QtNodes::NodeId const nodeId)
return true;
}
QJsonObject PipeWireGraphModel::saveNode(QtNodes::NodeId const) const
QJsonObject PipeWireGraphModel::saveNode(QtNodes::NodeId const nodeId) const
{
return QJsonObject();
QJsonObject obj;
obj["id"] = static_cast<qint64>(nodeId);
const QPointF pos = nodeData(nodeId, QtNodes::NodeRole::Position).toPointF();
QJsonObject posJson;
posJson["x"] = pos.x();
posJson["y"] = pos.y();
obj["position"] = posJson;
return obj;
}
void PipeWireGraphModel::loadNode(QJsonObject const &)