Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package qpwgraph for openSUSE:Factory 
checked in at 2022-07-07 12:57:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/qpwgraph (Old)
 and      /work/SRC/openSUSE:Factory/.qpwgraph.new.1523 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "qpwgraph"

Thu Jul  7 12:57:20 2022 rev:8 rq:987272 version:0.3.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/qpwgraph/qpwgraph.changes        2022-06-15 
00:32:13.618520099 +0200
+++ /work/SRC/openSUSE:Factory/.qpwgraph.new.1523/qpwgraph.changes      
2022-07-07 12:57:40.623351213 +0200
@@ -1,0 +2,9 @@
+Wed Jul  6 18:17:35 UTC 2022 - Alexei Sorokin <[email protected]>
+
+- Update to version 0.3.3:
+  * Patchbay/Edit mode introduced: pinning and unpinning
+    connections to and from current patchbay is now implemented.
+  * Original Graph/Connect and Disconnect keyboard shortcuts, [Ins]
+    and [Del], are now added to the existing ones, respectively.
+
+-------------------------------------------------------------------

Old:
----
  qpwgraph-v0.3.2.tar.bz2

New:
----
  qpwgraph-v0.3.3.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ qpwgraph.spec ++++++
--- /var/tmp/diff_new_pack.cQPyrx/_old  2022-07-07 12:57:41.015351797 +0200
+++ /var/tmp/diff_new_pack.cQPyrx/_new  2022-07-07 12:57:41.019351802 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           qpwgraph
-Version:        0.3.2
+Version:        0.3.3
 Release:        0
 Summary:        PipeWire Graph Qt GUI Interface
 License:        GPL-2.0-or-later

++++++ qpwgraph-v0.3.2.tar.bz2 -> qpwgraph-v0.3.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/CMakeLists.txt 
new/qpwgraph-v0.3.3/CMakeLists.txt
--- old/qpwgraph-v0.3.2/CMakeLists.txt  2022-06-13 09:11:54.000000000 +0200
+++ new/qpwgraph-v0.3.3/CMakeLists.txt  2022-07-06 19:31:36.000000000 +0200
@@ -1,7 +1,7 @@
 cmake_minimum_required (VERSION 3.15)
 
 project(qpwgraph
-  VERSION 0.3.1
+  VERSION 0.3.3
   DESCRIPTION "A PipeWire Graph Qt GUI Interface"
   HOMEPAGE_URL "https://gitlab.freedesktop.org/rncbc/qpwgraph";
   LANGUAGES C CXX)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/ChangeLog 
new/qpwgraph-v0.3.3/ChangeLog
--- old/qpwgraph-v0.3.2/ChangeLog       2022-06-13 09:11:54.000000000 +0200
+++ new/qpwgraph-v0.3.3/ChangeLog       2022-07-06 19:31:36.000000000 +0200
@@ -2,7 +2,15 @@
 --------------------------------------------
 
 
-0.3.3  2022-06-13  A tenth beta release.
+0.3.3  2022-07-06  An eleventh beta release.
+
+- Patchbay/Edit mode introduced: pinning and unpinning connections
+  to and from current patchbay is now implemented. (EXPERIMENTAL)
+- Original Graph/Connect and Disconnect keyboard shortcuts, [Ins]
+  and [Del], are now added to the existing ones, respectively.
+
+
+0.3.2  2022-06-13  A tenth beta release.
 
 - Fixed initial nodes layout positioning, now back to the former
   spiraled away from the center.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/qpwgraph-v0.3.2/src/appdata/org.rncbc.qpwgraph.metainfo.xml 
new/qpwgraph-v0.3.3/src/appdata/org.rncbc.qpwgraph.metainfo.xml
--- old/qpwgraph-v0.3.2/src/appdata/org.rncbc.qpwgraph.metainfo.xml     
2022-06-13 09:11:54.000000000 +0200
+++ new/qpwgraph-v0.3.3/src/appdata/org.rncbc.qpwgraph.metainfo.xml     
2022-07-06 19:31:36.000000000 +0200
@@ -37,7 +37,7 @@
  <developer_name>rncbc aka. Rui Nuno Capela</developer_name>
  <update_contact>[email protected]</update_contact>
  <releases>
-  <release version="0.3.2" date="2022-06-13" urgency="low" />
+  <release version="0.3.3" date="2022-07-06" urgency="low" />
  </releases>
  <content_rating type="oars-1.0"/>
 </component>
Binary files old/qpwgraph-v0.3.2/src/images/itemEdit.png and 
new/qpwgraph-v0.3.3/src/images/itemEdit.png differ
Binary files old/qpwgraph-v0.3.2/src/images/itemPin.png and 
new/qpwgraph-v0.3.3/src/images/itemPin.png differ
Binary files old/qpwgraph-v0.3.2/src/images/itemUnpin.png and 
new/qpwgraph-v0.3.3/src/images/itemUnpin.png differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/src/qpwgraph.qrc 
new/qpwgraph-v0.3.3/src/qpwgraph.qrc
--- old/qpwgraph-v0.3.2/src/qpwgraph.qrc        2022-06-13 09:11:54.000000000 
+0200
+++ new/qpwgraph-v0.3.3/src/qpwgraph.qrc        2022-07-06 19:31:36.000000000 
+0200
@@ -9,6 +9,9 @@
                <file>images/itemPatchbay.png</file>
                <file>images/itemActivate.png</file>
                <file>images/itemExclusive.png</file>
+               <file>images/itemEdit.png</file>
+               <file>images/itemPin.png</file>
+               <file>images/itemUnpin.png</file>
                <file>images/fileNew.png</file>
                <file>images/fileOpen.png</file>
                <file>images/fileSave.png</file>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/src/qpwgraph_canvas.cpp 
new/qpwgraph-v0.3.3/src/qpwgraph_canvas.cpp
--- old/qpwgraph-v0.3.2/src/qpwgraph_canvas.cpp 2022-06-13 09:11:54.000000000 
+0200
+++ new/qpwgraph-v0.3.3/src/qpwgraph_canvas.cpp 2022-07-06 19:31:36.000000000 
+0200
@@ -65,7 +65,8 @@
        : QGraphicsView(parent), m_state(DragNone), m_item(nullptr),
                m_connect(nullptr), m_rubberband(nullptr),
                m_zoom(1.0), m_zoomrange(false),
-               m_commands(nullptr), m_settings(nullptr), m_patchbay(nullptr),
+               m_commands(nullptr), m_settings(nullptr),
+               m_patchbay(nullptr), m_patchbay_edit(false),
                m_selected_nodes(0), m_edit_item(nullptr),
                m_editor(nullptr), m_edited(0)
 {
@@ -143,6 +144,98 @@
 }
 
 
+// Patchbay edit methods.
+void qpwgraph_canvas::setPatchbayEdit ( bool on )
+{
+       if (m_patchbay == nullptr)
+               return;
+
+       if ((!on && !m_patchbay_edit) ||
+               ( on &&  m_patchbay_edit))
+               return;
+
+       foreach (QGraphicsItem *item, m_scene->items()) {
+               if (item->type() == qpwgraph_connect::Type) {
+                       qpwgraph_connect *connect = 
static_cast<qpwgraph_connect *> (item);
+                       if (connect)
+                               connect->setDimmed(on && 
!m_patchbay->findConnect(connect));
+               }
+       }
+
+       m_patchbay_edit = on;
+}
+
+
+bool qpwgraph_canvas::isPatchbayEdit (void) const
+{
+       return (m_patchbay && m_patchbay_edit);
+}
+
+
+bool qpwgraph_canvas::canPatchbayPin (void) const
+{
+       if (m_patchbay == nullptr || !m_patchbay_edit)
+               return false;
+
+       foreach (QGraphicsItem *item, m_scene->selectedItems()) {
+               if (item->type() == qpwgraph_connect::Type) {
+                       qpwgraph_connect *connect = 
static_cast<qpwgraph_connect *> (item);
+                       if (connect && !m_patchbay->findConnect(connect))
+                               return true;
+               }
+       }
+
+       return false;
+}
+
+
+bool qpwgraph_canvas::canPatchbayUnpin (void) const
+{
+       if (m_patchbay == nullptr || !m_patchbay_edit)
+               return false;
+
+       foreach (QGraphicsItem *item, m_scene->selectedItems()) {
+               if (item->type() == qpwgraph_connect::Type) {
+                       qpwgraph_connect *connect = 
static_cast<qpwgraph_connect *> (item);
+                       if (connect && m_patchbay->findConnect(connect))
+                               return true;
+               }
+       }
+
+       return false;
+}
+
+
+void qpwgraph_canvas::patchbayPin (void)
+{
+       if (m_patchbay == nullptr || !m_patchbay_edit)
+               return;
+
+       foreach (QGraphicsItem *item, m_scene->selectedItems()) {
+               if (item->type() == qpwgraph_connect::Type) {
+                       qpwgraph_connect *connect = 
static_cast<qpwgraph_connect *> (item);
+                       if (connect && m_patchbay->connect(connect, true))
+                               connect->setDimmed(false);
+               }
+       }
+}
+
+
+void qpwgraph_canvas::patchbayUnpin (void)
+{
+       if (m_patchbay == nullptr || !m_patchbay_edit)
+               return;
+
+       foreach (QGraphicsItem *item, m_scene->selectedItems()) {
+               if (item->type() == qpwgraph_connect::Type) {
+                       qpwgraph_connect *connect = 
static_cast<qpwgraph_connect *> (item);
+                       if (connect && m_patchbay->connect(connect, false))
+                               connect->setDimmed(true);
+               }
+       }
+}
+
+
 // Canvas methods.
 void qpwgraph_canvas::addItem ( qpwgraph_item *item )
 {
@@ -165,6 +258,14 @@
                if (port)
                        restorePort(port);
        }
+       else
+       if (item->type() == qpwgraph_connect::Type) {
+               qpwgraph_connect *connect = static_cast<qpwgraph_connect *> 
(item);
+               if (connect) {
+                       connect->setDimmed(m_patchbay_edit &&
+                               m_patchbay && 
!m_patchbay->findConnect(connect));
+               }
+       }
 }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/src/qpwgraph_canvas.h 
new/qpwgraph-v0.3.3/src/qpwgraph_canvas.h
--- old/qpwgraph-v0.3.2/src/qpwgraph_canvas.h   2022-06-13 09:11:54.000000000 
+0200
+++ new/qpwgraph-v0.3.3/src/qpwgraph_canvas.h   2022-07-06 19:31:36.000000000 
+0200
@@ -70,6 +70,16 @@
 
        qpwgraph_patchbay *patchbay() const;
 
+       // Patchbay edit methods.
+       void setPatchbayEdit(bool on);
+       bool isPatchbayEdit() const;
+
+       bool canPatchbayPin() const;
+       bool canPatchbayUnpin() const;
+
+       void patchbayPin();
+       void patchbayUnpin();
+
        // Canvas methods.
        void addItem(qpwgraph_item *item);
        void removeItem(qpwgraph_item *item);
@@ -235,6 +245,7 @@
        QSettings  *m_settings;
 
        qpwgraph_patchbay *m_patchbay;
+       bool m_patchbay_edit;
 
        QList<QGraphicsItem *> m_selected;
        int m_selected_nodes;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/src/qpwgraph_connect.cpp 
new/qpwgraph-v0.3.3/src/qpwgraph_connect.cpp
--- old/qpwgraph-v0.3.2/src/qpwgraph_connect.cpp        2022-06-13 
09:11:54.000000000 +0200
+++ new/qpwgraph-v0.3.3/src/qpwgraph_connect.cpp        2022-07-06 
19:31:36.000000000 +0200
@@ -42,7 +42,7 @@
 
 // Constructor.
 qpwgraph_connect::qpwgraph_connect (void)
-       : qpwgraph_item(nullptr), m_port1(nullptr), m_port2(nullptr)
+       : qpwgraph_item(nullptr), m_port1(nullptr), m_port2(nullptr), 
m_dimmed(false)
 {
        QGraphicsPathItem::setZValue(-1.0);
 
@@ -202,11 +202,12 @@
                color = qpwgraph_item::foreground().lighter();
        else
                color = qpwgraph_item::foreground();
+       color.setAlpha(m_dimmed ? 160 : 255);
 
        const QPalette pal;
        const bool is_darkest = (pal.base().color().value() < 24);
        QColor shadow_color = (is_darkest ? Qt::white : Qt::black);
-       shadow_color.setAlpha(80);
+       shadow_color.setAlpha(m_dimmed ? 40 : 80);
 
        const QPainterPath& path
                = QGraphicsPathItem::path();
@@ -293,4 +294,18 @@
 }
 
 
+       // Dim/transparency option.
+void qpwgraph_connect::setDimmed ( bool dimmed )
+{
+       m_dimmed = dimmed;
+
+       update();
+}
+
+int qpwgraph_connect::isDimmed (void) const
+{
+       return m_dimmed;
+}
+
+
 // end of qpwgraph_connect.cpp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/src/qpwgraph_connect.h 
new/qpwgraph-v0.3.3/src/qpwgraph_connect.h
--- old/qpwgraph-v0.3.2/src/qpwgraph_connect.h  2022-06-13 09:11:54.000000000 
+0200
+++ new/qpwgraph-v0.3.3/src/qpwgraph_connect.h  2022-07-06 19:31:36.000000000 
+0200
@@ -70,6 +70,10 @@
        // Special port-type color business.
        void updatePortTypeColors();
 
+       // Dim/transparency option.
+       void setDimmed(bool dimmed);
+       int isDimmed() const;
+
 protected:
 
        void paint(QPainter *painter,
@@ -84,6 +88,8 @@
        // Instance variables.
        qpwgraph_port *m_port1;
        qpwgraph_port *m_port2;
+
+       bool m_dimmed;
 };
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/src/qpwgraph_form.cpp 
new/qpwgraph-v0.3.3/src/qpwgraph_form.cpp
--- old/qpwgraph-v0.3.2/src/qpwgraph_form.cpp   2022-06-13 09:11:54.000000000 
+0200
+++ new/qpwgraph-v0.3.3/src/qpwgraph_form.cpp   2022-07-06 19:31:36.000000000 
+0200
@@ -229,6 +229,17 @@
        // shortcuts firmly attached...
        addAction(m_ui.viewMenubarAction);
 
+       // HACK: Make old Ins/Del standard shortcuts
+       // for connect/disconnect available again...
+       QList<QKeySequence> shortcuts;
+       shortcuts.append(m_ui.graphConnectAction->shortcut());
+       shortcuts.append(QKeySequence("Ins"));
+       m_ui.graphConnectAction->setShortcuts(shortcuts);
+       shortcuts.clear();
+       shortcuts.append(m_ui.graphDisconnectAction->shortcut());
+       shortcuts.append(QKeySequence("Del"));
+       m_ui.graphDisconnectAction->setShortcuts(shortcuts);
+
        QObject::connect(m_ui.graphConnectAction,
                SIGNAL(triggered(bool)),
                m_ui.graphCanvas, SLOT(connectItems()));
@@ -260,6 +271,16 @@
                SIGNAL(toggled(bool)),
                SLOT(patchbayExclusive(bool)));
 
+       QObject::connect(m_ui.patchbayEditAction,
+               SIGNAL(toggled(bool)),
+               SLOT(patchbayEdit(bool)));
+       QObject::connect(m_ui.patchbayPinAction,
+               SIGNAL(triggered(bool)),
+               SLOT(patchbayPin()));
+       QObject::connect(m_ui.patchbayUnpinAction,
+               SIGNAL(triggered(bool)),
+               SLOT(patchbayUnpin()));
+
        QObject::connect(m_ui.patchbayScanAction,
                SIGNAL(triggered(bool)),
                SLOT(patchbayScan()));
@@ -603,6 +624,30 @@
 }
 
 
+void qpwgraph_form::patchbayEdit ( bool on )
+{
+       m_ui.graphCanvas->setPatchbayEdit(on);
+
+       stabilize();
+}
+
+
+void qpwgraph_form::patchbayPin (void)
+{
+       m_ui.graphCanvas->patchbayPin();
+
+       stabilize();
+}
+
+
+void qpwgraph_form::patchbayUnpin (void)
+{
+       m_ui.graphCanvas->patchbayUnpin();
+
+       stabilize();
+}
+
+
 void qpwgraph_form::patchbayScan (void)
 {
        qpwgraph_patchbay *patchbay = m_ui.graphCanvas->patchbay();
@@ -1011,6 +1056,9 @@
        m_ui.patchbayScanAction->setEnabled(is_activated);
        m_ui.patchbaySaveAction->setEnabled(is_dirty);
 
+       m_ui.patchbayPinAction->setEnabled(canvas->canPatchbayPin());
+       m_ui.patchbayUnpinAction->setEnabled(canvas->canPatchbayUnpin());
+
        m_ui.graphConnectAction->setEnabled(canvas->canConnect());
        m_ui.graphDisconnectAction->setEnabled(canvas->canDisconnect());
 
@@ -1208,6 +1256,11 @@
        stabilize();
 
        QMenu menu(this);
+       if (m_ui.graphCanvas->isPatchbayEdit()) {
+               menu.addAction(m_ui.patchbayPinAction);
+               menu.addAction(m_ui.patchbayUnpinAction);
+               menu.addSeparator();
+       }
        menu.addAction(m_ui.graphConnectAction);
        menu.addAction(m_ui.graphDisconnectAction);
        menu.addSeparator();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/src/qpwgraph_form.h 
new/qpwgraph-v0.3.3/src/qpwgraph_form.h
--- old/qpwgraph-v0.3.2/src/qpwgraph_form.h     2022-06-13 09:11:54.000000000 
+0200
+++ new/qpwgraph-v0.3.3/src/qpwgraph_form.h     2022-07-06 19:31:36.000000000 
+0200
@@ -103,6 +103,10 @@
        void patchbayActivated(bool on);
        void patchbayExclusive(bool on);
 
+       void patchbayEdit(bool on);
+       void patchbayPin();
+       void patchbayUnpin();
+
        void patchbayScan();
 
        // Main menu slots.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/src/qpwgraph_form.ui 
new/qpwgraph-v0.3.3/src/qpwgraph_form.ui
--- old/qpwgraph-v0.3.2/src/qpwgraph_form.ui    2022-06-13 09:11:54.000000000 
+0200
+++ new/qpwgraph-v0.3.3/src/qpwgraph_form.ui    2022-07-06 19:31:36.000000000 
+0200
@@ -82,6 +82,10 @@
     <addaction name="patchbayActivatedAction"/>
     <addaction name="patchbayExclusiveAction"/>
     <addaction name="separator"/>
+    <addaction name="patchbayEditAction"/>
+    <addaction name="patchbayPinAction"/>
+    <addaction name="patchbayUnpinAction"/>
+    <addaction name="separator"/>
     <addaction name="patchbayScanAction"/>
    </widget>
    <widget class="QMenu" name="editMenu">
@@ -228,6 +232,10 @@
    <addaction name="separator"/>
    <addaction name="patchbayActivatedAction"/>
    <addaction name="patchbayExclusiveAction"/>
+   <addaction name="separator"/>
+   <addaction name="patchbayEditAction"/>
+   <addaction name="patchbayPinAction"/>
+   <addaction name="patchbayUnpinAction"/>
   </widget>
   <action name="graphConnectAction">
    <property name="icon">
@@ -387,6 +395,69 @@
    </property>
    <property name="shortcut">
     <string/>
+   </property>
+  </action>
+  <action name="patchbayEditAction">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="icon">
+    <iconset resource="qpwgraph.qrc">:/images/itemEdit.png</iconset>
+   </property>
+   <property name="text">
+    <string>&amp;Edit</string>
+   </property>
+   <property name="iconText">
+    <string>Edit</string>
+   </property>
+   <property name="toolTip">
+    <string>Edit patchbay</string>
+   </property>
+   <property name="statusTip">
+    <string>Edit current patchbay</string>
+   </property>
+   <property name="shortcut">
+    <string/>
+   </property>
+  </action>
+  <action name="patchbayPinAction">
+   <property name="icon">
+    <iconset resource="qpwgraph.qrc">:/images/itemPin.png</iconset>
+   </property>
+   <property name="text">
+    <string>&amp;Pin</string>
+   </property>
+   <property name="iconText">
+    <string>Pin</string>
+   </property>
+   <property name="toolTip">
+    <string>Pin connection</string>
+   </property>
+   <property name="statusTip">
+    <string>Pin connection to current patchbay</string>
+   </property>
+   <property name="shortcut">
+    <string/>
+   </property>
+  </action>
+  <action name="patchbayUnpinAction">
+   <property name="icon">
+    <iconset resource="qpwgraph.qrc">:/images/itemUnpin.png</iconset>
+   </property>
+   <property name="text">
+    <string>&amp;Unpin</string>
+   </property>
+   <property name="iconText">
+    <string>Unpin</string>
+   </property>
+   <property name="toolTip">
+    <string>Unpin connection</string>
+   </property>
+   <property name="statusTip">
+    <string>Unpin connection from current patchbay</string>
+   </property>
+   <property name="shortcut">
+    <string/>
    </property>
   </action>
   <action name="patchbayScanAction">
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/src/qpwgraph_patchbay.cpp 
new/qpwgraph-v0.3.3/src/qpwgraph_patchbay.cpp
--- old/qpwgraph-v0.3.2/src/qpwgraph_patchbay.cpp       2022-06-13 
09:11:54.000000000 +0200
+++ new/qpwgraph-v0.3.3/src/qpwgraph_patchbay.cpp       2022-07-06 
19:31:36.000000000 +0200
@@ -180,7 +180,7 @@
        doc.appendChild(eroot);
 
        QDomElement eitems = doc.createElement("items");
-#if 0//d--irect snapshot!
+#if 0//--direct snapshot!
        QGraphicsScene *scene = m_canvas->scene();
        if (scene) foreach (QGraphicsItem *item, scene->items()) {
                if (item->type() == qpwgraph_connect::Type) {
@@ -347,10 +347,13 @@
 
 
 // Update rules on demand.
-void qpwgraph_patchbay::connectPorts ( qpwgraph_port *port1, qpwgraph_port 
*port2, bool connect )
+bool qpwgraph_patchbay::connectPorts (
+       qpwgraph_port *port1, qpwgraph_port *port2, bool is_connect )
 {
        if (port1 == nullptr || port2 == nullptr)
-               return;
+               return false;
+
+       bool ret = false;
 
        qpwgraph_node *node1 = port1->portNode();
        qpwgraph_node *node2 = port2->portNode();
@@ -364,15 +367,58 @@
                        port2->portName());
                Items::ConstIterator iter = m_items.constFind(item);
                const Items::ConstIterator& iter_end = m_items.constEnd();
-               if (iter == iter_end && connect)
+               if (iter == iter_end && is_connect) {
                        m_items.insert(item, new Item(item));
+                       ret = true;
+               }
                else
-               if (iter != iter_end && !connect) {
+               if (iter != iter_end && !is_connect) {
                        delete iter.value();
                        m_items.erase(iter);
+                       ret = true;
+               }
+       }
+
+       if (ret) ++m_dirty;
+
+       return ret;
+}
+
+
+bool qpwgraph_patchbay::connect ( qpwgraph_connect *connect, bool is_connect )
+{
+       return connectPorts(connect->port1(), connect->port2(), is_connect);
+}
+
+
+// Find a connection rule.
+qpwgraph_patchbay::Item *qpwgraph_patchbay::findConnectPorts (
+       qpwgraph_port *port1, qpwgraph_port *port2 ) const
+{
+       Item *ret = nullptr;
+
+       if (port1 && port2) {
+               qpwgraph_node *node1 = port1->portNode();
+               qpwgraph_node *node2 = port2->portNode();
+               if (node1 && node2) {
+                       const Item item(
+                               node1->nodeType(),
+                               port1->portType(),
+                               node1->nodeName(),
+                               port1->portName(),
+                               node2->nodeName(),
+                               port2->portName());
+                       ret = m_items.value(item, nullptr);
                }
-               ++m_dirty;
        }
+
+       return ret;
+}
+
+qpwgraph_patchbay::Item *qpwgraph_patchbay::findConnect (
+       qpwgraph_connect *connect ) const
+{
+       return findConnectPorts(connect->port1(), connect->port2());
 }
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/qpwgraph-v0.3.2/src/qpwgraph_patchbay.h 
new/qpwgraph-v0.3.3/src/qpwgraph_patchbay.h
--- old/qpwgraph-v0.3.2/src/qpwgraph_patchbay.h 2022-06-13 09:11:54.000000000 
+0200
+++ new/qpwgraph-v0.3.3/src/qpwgraph_patchbay.h 2022-07-06 19:31:36.000000000 
+0200
@@ -72,7 +72,8 @@
        bool scan();
 
        // Update rules on demand.
-       void connectPorts(qpwgraph_port *port1, qpwgraph_port *port2, bool 
connect);
+       bool connectPorts(qpwgraph_port *port1, qpwgraph_port *port2, bool 
is_connect);
+       bool connect(qpwgraph_connect *connect, bool is_connect);
 
        // Patchbay rule item.
        struct Item
@@ -105,6 +106,10 @@
 
        typedef QHash<Item, Item *> Items;
 
+       // Find a connection rule.
+       Item *findConnectPorts(qpwgraph_port *port1, qpwgraph_port *port2) 
const;
+       Item *findConnect(qpwgraph_connect *connect) const;
+
        // Dirty status flag.
        bool isDirty() const
                { return (m_dirty > 0); }

Reply via email to