changeset 1525:284a38c43721

Debug bits
author Chris Cannam
date Fri, 04 Oct 2019 13:37:39 +0100
parents 4fab699536f9
children 0f1601d870db
files widgets/PropertyBox.cpp widgets/PropertyStack.cpp
diffstat 2 files changed, 51 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/PropertyBox.cpp	Wed Sep 25 14:11:42 2019 +0100
+++ b/widgets/PropertyBox.cpp	Fri Oct 04 13:37:39 2019 +0100
@@ -61,7 +61,7 @@
     m_playButton(nullptr)
 {
 #ifdef DEBUG_PROPERTY_BOX
-    cerr << "PropertyBox[" << this << "(\"" <<
+    SVDEBUG << "PropertyBox[" << this << "(\"" <<
         container->getPropertyContainerName() << "\" at " << container << ")]::PropertyBox" << endl;
 #endif
 
@@ -109,14 +109,14 @@
             this, SLOT(unitDatabaseChanged()));
 
 #ifdef DEBUG_PROPERTY_BOX
-    cerr << "PropertyBox[" << this << "]::PropertyBox returning" << endl;
+    SVDEBUG << "PropertyBox[" << this << "]::PropertyBox returning" << endl;
 #endif
 }
 
 PropertyBox::~PropertyBox()
 {
 #ifdef DEBUG_PROPERTY_BOX
-    cerr << "PropertyBox[" << this << "]::~PropertyBox" << endl;
+    SVDEBUG << "PropertyBox[" << this << "]::~PropertyBox" << endl;
 #endif
 }
 
@@ -124,7 +124,7 @@
 PropertyBox::populateViewPlayFrame()
 {
 #ifdef DEBUG_PROPERTY_BOX
-    cerr << "PropertyBox[" << this << ":" << m_container << "]::populateViewPlayFrame" << endl;
+    SVDEBUG << "PropertyBox[" << this << ":" << m_container << "]::populateViewPlayFrame" << endl;
 #endif
 
     if (m_viewPlayFrame) {
@@ -248,12 +248,12 @@
     QString iconName = m_container->getPropertyIconName(name);
 
 #ifdef DEBUG_PROPERTY_BOX
-    cerr << "PropertyBox[" << this
+    SVDEBUG << "PropertyBox[" << this
               << "(\"" << m_container->getPropertyContainerName()
               << "\")]";
-    cerr << "::updatePropertyEditor(\"" << name << "\", "
+    SVDEBUG << "::updatePropertyEditor(\"" << name << "\", "
          << rangeChanged << "):";
-    cerr << " type " << type << ", value " << value
+    SVDEBUG << " type " << type << ", value " << value
          << ", have " << have << ", group \"" << groupName << "\"" << endl;
 #endif
 
@@ -287,7 +287,7 @@
     QGridLayout *groupLayout = m_groupLayouts[groupName];
 
 #ifdef DEBUG_PROPERTY_BOX
-    cerr << "groupName becomes \"" << groupName << "\", groupLabel = \""
+    SVDEBUG << "groupName becomes \"" << groupName << "\", groupLabel = \""
          << groupLabel << "\", groupLayout = " << groupLayout << endl;
 #endif
     
@@ -303,7 +303,7 @@
 
         if (!(button = qobject_cast<QAbstractButton *>(existing))) {
 #ifdef DEBUG_PROPERTY_BOX 
-            cerr << "PropertyBox: creating new checkbox" << endl;
+            SVDEBUG << "PropertyBox: creating new checkbox" << endl;
 #endif
             if (iconName != "") {
 #ifdef Q_OS_MAC
@@ -360,7 +360,7 @@
             }
         } else {
 #ifdef DEBUG_PROPERTY_BOX 
-            cerr << "PropertyBox: creating new dial" << endl;
+            SVDEBUG << "PropertyBox: creating new dial" << endl;
 #endif
             dial = new AudioDial();
             dial->setObjectName(name);
@@ -408,7 +408,7 @@
         if (!(cb = qobject_cast<ColourComboBox *>(existing))) {
 
 #ifdef DEBUG_PROPERTY_BOX 
-            cerr << "PropertyBox: creating new colour combobox" << endl;
+            SVDEBUG << "PropertyBox: creating new colour combobox" << endl;
 #endif
             cb = new ColourComboBox(true);
             cb->setObjectName(name);
@@ -447,7 +447,7 @@
 
         if (!(cb = qobject_cast<ColourMapComboBox *>(existing))) {
 #ifdef DEBUG_PROPERTY_BOX 
-            cerr << "PropertyBox: creating new colourmap combobox" << endl;
+            SVDEBUG << "PropertyBox: creating new colourmap combobox" << endl;
 #endif
             cb = new ColourMapComboBox(false);
             cb->setObjectName(name);
@@ -487,7 +487,7 @@
 
         if (!(cb = qobject_cast<NotifyingComboBox *>(existing))) {
 #ifdef DEBUG_PROPERTY_BOX 
-            cerr << "PropertyBox: creating new combobox" << endl;
+            SVDEBUG << "PropertyBox: creating new combobox" << endl;
 #endif
             cb = new NotifyingComboBox();
             cb->setObjectName(name);
@@ -607,13 +607,13 @@
 PropertyBox::unitDatabaseChanged()
 {
 #ifdef DEBUG_PROPERTY_BOX
-    cerr << "PropertyBox[" << this << "]: unitDatabaseChanged" << endl;
+    SVDEBUG << "PropertyBox[" << this << "]: unitDatabaseChanged" << endl;
 #endif
     blockSignals(true);
 
-//    cerr << "my container is " << m_container << endl;
-//    cerr << "my container's name is... " << endl;
-//    cerr << m_container->objectName() << endl;
+//    SVDEBUG << "my container is " << m_container << endl;
+//    SVDEBUG << "my container's name is... " << endl;
+//    SVDEBUG << m_container->objectName() << endl;
 
     PropertyContainer::PropertyList properties = m_container->getProperties();
     for (size_t i = 0; i < properties.size(); ++i) {
--- a/widgets/PropertyStack.cpp	Wed Sep 25 14:11:42 2019 +0100
+++ b/widgets/PropertyStack.cpp	Fri Oct 04 13:37:39 2019 +0100
@@ -85,15 +85,29 @@
     blockSignals(true);
 
 #ifdef DEBUG_PROPERTY_STACK
-    cerr << "PropertyStack[" << this << "]::repopulate" << endl;
+    SVDEBUG << "PropertyStack[" << this << "]::repopulate" << endl;
 #endif
     
+#ifdef DEBUG_PROPERTY_STACK
+    SVDEBUG << "PropertyStack[" << this << "]::repopulate: removing tabs" << endl;
+#endif
     while (count() > 0) {
         removeTab(0);
     }
+
+#ifdef DEBUG_PROPERTY_STACK
+    SVDEBUG << "PropertyStack[" << this << "]::repopulate: deleting boxes" << endl;
+#endif
     for (size_t i = 0; i < m_boxes.size(); ++i) {
+#ifdef DEBUG_PROPERTY_STACK
+        SVDEBUG << "(" << i << " of " << m_boxes.size() << ": " << m_boxes[i]->getContainer()->getPropertyContainerName() << ")" << endl;
+#endif
         delete m_boxes[i];
     }
+
+#ifdef DEBUG_PROPERTY_STACK
+    SVDEBUG << "PropertyStack[" << this << "]::repopulate: done, clearing m_boxes" << endl;
+#endif
     m_boxes.clear();
     
     for (int i = 0; i < m_client->getPropertyContainerCount(); ++i) {
@@ -102,9 +116,9 @@
         QString name = container->getPropertyContainerName();
         
 #ifdef DEBUG_PROPERTY_STACK
-        cerr << "PropertyStack[" << this << "]::repopulate: client " << m_client
-             << " returns container " << container << " (name " << name
-             << ") at position " << i << endl;
+        SVDEBUG << "PropertyStack[" << this << "]::repopulate: client " << m_client
+                << " returns container " << container << " (name " << name
+                << ") at position " << i << endl;
 #endif
 
         PropertyBox *box = new PropertyBox(container);
@@ -183,16 +197,30 @@
 }
 
 void
-PropertyStack::propertyContainerAdded(PropertyContainer *)
+PropertyStack::propertyContainerAdded(PropertyContainer *
+#ifdef DEBUG_PROPERTY_STACK
+                                      c
+#endif
+    )
 {
     if (sender() != m_client) return;
+#ifdef DEBUG_PROPERTY_STACK
+    SVDEBUG << "PropertyStack::propertyContainerAdded(" << (c ? c->getPropertyContainerName() : "(none)") << ")" << endl;
+#endif
     repopulate();
 }
 
 void
-PropertyStack::propertyContainerRemoved(PropertyContainer *)
+PropertyStack::propertyContainerRemoved(PropertyContainer *
+#ifdef DEBUG_PROPERTY_STACK
+                                      c
+#endif
+    )
 {
     if (sender() != m_client) return;
+#ifdef DEBUG_PROPERTY_STACK
+    SVDEBUG << "PropertyStack::propertyContainerAdded(" << (c ? c->getPropertyContainerName() : "(none)") << ")" << endl;
+#endif
     repopulate();
 }