comparison widgets/PropertyBox.cpp @ 1525:284a38c43721

Debug bits
author Chris Cannam
date Fri, 04 Oct 2019 13:37:39 +0100
parents 76b388d4d19c
children 2108af725460
comparison
equal deleted inserted replaced
1524:4fab699536f9 1525:284a38c43721
59 m_container(container), 59 m_container(container),
60 m_showButton(nullptr), 60 m_showButton(nullptr),
61 m_playButton(nullptr) 61 m_playButton(nullptr)
62 { 62 {
63 #ifdef DEBUG_PROPERTY_BOX 63 #ifdef DEBUG_PROPERTY_BOX
64 cerr << "PropertyBox[" << this << "(\"" << 64 SVDEBUG << "PropertyBox[" << this << "(\"" <<
65 container->getPropertyContainerName() << "\" at " << container << ")]::PropertyBox" << endl; 65 container->getPropertyContainerName() << "\" at " << container << ")]::PropertyBox" << endl;
66 #endif 66 #endif
67 67
68 m_mainBox = new QVBoxLayout; 68 m_mainBox = new QVBoxLayout;
69 setLayout(m_mainBox); 69 setLayout(m_mainBox);
107 107
108 connect(UnitDatabase::getInstance(), SIGNAL(unitDatabaseChanged()), 108 connect(UnitDatabase::getInstance(), SIGNAL(unitDatabaseChanged()),
109 this, SLOT(unitDatabaseChanged())); 109 this, SLOT(unitDatabaseChanged()));
110 110
111 #ifdef DEBUG_PROPERTY_BOX 111 #ifdef DEBUG_PROPERTY_BOX
112 cerr << "PropertyBox[" << this << "]::PropertyBox returning" << endl; 112 SVDEBUG << "PropertyBox[" << this << "]::PropertyBox returning" << endl;
113 #endif 113 #endif
114 } 114 }
115 115
116 PropertyBox::~PropertyBox() 116 PropertyBox::~PropertyBox()
117 { 117 {
118 #ifdef DEBUG_PROPERTY_BOX 118 #ifdef DEBUG_PROPERTY_BOX
119 cerr << "PropertyBox[" << this << "]::~PropertyBox" << endl; 119 SVDEBUG << "PropertyBox[" << this << "]::~PropertyBox" << endl;
120 #endif 120 #endif
121 } 121 }
122 122
123 void 123 void
124 PropertyBox::populateViewPlayFrame() 124 PropertyBox::populateViewPlayFrame()
125 { 125 {
126 #ifdef DEBUG_PROPERTY_BOX 126 #ifdef DEBUG_PROPERTY_BOX
127 cerr << "PropertyBox[" << this << ":" << m_container << "]::populateViewPlayFrame" << endl; 127 SVDEBUG << "PropertyBox[" << this << ":" << m_container << "]::populateViewPlayFrame" << endl;
128 #endif 128 #endif
129 129
130 if (m_viewPlayFrame) { 130 if (m_viewPlayFrame) {
131 delete m_viewPlayFrame; 131 delete m_viewPlayFrame;
132 m_viewPlayFrame = nullptr; 132 m_viewPlayFrame = nullptr;
246 QString groupName = m_container->getPropertyGroupName(name); 246 QString groupName = m_container->getPropertyGroupName(name);
247 QString propertyLabel = m_container->getPropertyLabel(name); 247 QString propertyLabel = m_container->getPropertyLabel(name);
248 QString iconName = m_container->getPropertyIconName(name); 248 QString iconName = m_container->getPropertyIconName(name);
249 249
250 #ifdef DEBUG_PROPERTY_BOX 250 #ifdef DEBUG_PROPERTY_BOX
251 cerr << "PropertyBox[" << this 251 SVDEBUG << "PropertyBox[" << this
252 << "(\"" << m_container->getPropertyContainerName() 252 << "(\"" << m_container->getPropertyContainerName()
253 << "\")]"; 253 << "\")]";
254 cerr << "::updatePropertyEditor(\"" << name << "\", " 254 SVDEBUG << "::updatePropertyEditor(\"" << name << "\", "
255 << rangeChanged << "):"; 255 << rangeChanged << "):";
256 cerr << " type " << type << ", value " << value 256 SVDEBUG << " type " << type << ", value " << value
257 << ", have " << have << ", group \"" << groupName << "\"" << endl; 257 << ", have " << have << ", group \"" << groupName << "\"" << endl;
258 #endif 258 #endif
259 259
260 QString groupLabel = groupName; 260 QString groupLabel = groupName;
261 if (groupName == QString()) { 261 if (groupName == QString()) {
285 } 285 }
286 286
287 QGridLayout *groupLayout = m_groupLayouts[groupName]; 287 QGridLayout *groupLayout = m_groupLayouts[groupName];
288 288
289 #ifdef DEBUG_PROPERTY_BOX 289 #ifdef DEBUG_PROPERTY_BOX
290 cerr << "groupName becomes \"" << groupName << "\", groupLabel = \"" 290 SVDEBUG << "groupName becomes \"" << groupName << "\", groupLabel = \""
291 << groupLabel << "\", groupLayout = " << groupLayout << endl; 291 << groupLabel << "\", groupLayout = " << groupLayout << endl;
292 #endif 292 #endif
293 293
294 assert(groupLayout); 294 assert(groupLayout);
295 295
301 { 301 {
302 QAbstractButton *button; 302 QAbstractButton *button;
303 303
304 if (!(button = qobject_cast<QAbstractButton *>(existing))) { 304 if (!(button = qobject_cast<QAbstractButton *>(existing))) {
305 #ifdef DEBUG_PROPERTY_BOX 305 #ifdef DEBUG_PROPERTY_BOX
306 cerr << "PropertyBox: creating new checkbox" << endl; 306 SVDEBUG << "PropertyBox: creating new checkbox" << endl;
307 #endif 307 #endif
308 if (iconName != "") { 308 if (iconName != "") {
309 #ifdef Q_OS_MAC 309 #ifdef Q_OS_MAC
310 button = new NotifyingToolButton(); 310 button = new NotifyingToolButton();
311 #else 311 #else
358 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name)); 358 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
359 dial->blockSignals(false); 359 dial->blockSignals(false);
360 } 360 }
361 } else { 361 } else {
362 #ifdef DEBUG_PROPERTY_BOX 362 #ifdef DEBUG_PROPERTY_BOX
363 cerr << "PropertyBox: creating new dial" << endl; 363 SVDEBUG << "PropertyBox: creating new dial" << endl;
364 #endif 364 #endif
365 dial = new AudioDial(); 365 dial = new AudioDial();
366 dial->setObjectName(name); 366 dial->setObjectName(name);
367 dial->setMinimum(min); 367 dial->setMinimum(min);
368 dial->setMaximum(max); 368 dial->setMaximum(max);
406 ColourComboBox *cb; 406 ColourComboBox *cb;
407 407
408 if (!(cb = qobject_cast<ColourComboBox *>(existing))) { 408 if (!(cb = qobject_cast<ColourComboBox *>(existing))) {
409 409
410 #ifdef DEBUG_PROPERTY_BOX 410 #ifdef DEBUG_PROPERTY_BOX
411 cerr << "PropertyBox: creating new colour combobox" << endl; 411 SVDEBUG << "PropertyBox: creating new colour combobox" << endl;
412 #endif 412 #endif
413 cb = new ColourComboBox(true); 413 cb = new ColourComboBox(true);
414 cb->setObjectName(name); 414 cb->setObjectName(name);
415 415
416 connect(cb, SIGNAL(colourChanged(int)), 416 connect(cb, SIGNAL(colourChanged(int)),
445 { 445 {
446 ColourMapComboBox *cb; 446 ColourMapComboBox *cb;
447 447
448 if (!(cb = qobject_cast<ColourMapComboBox *>(existing))) { 448 if (!(cb = qobject_cast<ColourMapComboBox *>(existing))) {
449 #ifdef DEBUG_PROPERTY_BOX 449 #ifdef DEBUG_PROPERTY_BOX
450 cerr << "PropertyBox: creating new colourmap combobox" << endl; 450 SVDEBUG << "PropertyBox: creating new colourmap combobox" << endl;
451 #endif 451 #endif
452 cb = new ColourMapComboBox(false); 452 cb = new ColourMapComboBox(false);
453 cb->setObjectName(name); 453 cb->setObjectName(name);
454 454
455 connect(cb, SIGNAL(colourMapChanged(int)), 455 connect(cb, SIGNAL(colourMapChanged(int)),
485 { 485 {
486 NotifyingComboBox *cb; 486 NotifyingComboBox *cb;
487 487
488 if (!(cb = qobject_cast<NotifyingComboBox *>(existing))) { 488 if (!(cb = qobject_cast<NotifyingComboBox *>(existing))) {
489 #ifdef DEBUG_PROPERTY_BOX 489 #ifdef DEBUG_PROPERTY_BOX
490 cerr << "PropertyBox: creating new combobox" << endl; 490 SVDEBUG << "PropertyBox: creating new combobox" << endl;
491 #endif 491 #endif
492 cb = new NotifyingComboBox(); 492 cb = new NotifyingComboBox();
493 cb->setObjectName(name); 493 cb->setObjectName(name);
494 cb->setDuplicatesEnabled(false); 494 cb->setDuplicatesEnabled(false);
495 } 495 }
605 605
606 void 606 void
607 PropertyBox::unitDatabaseChanged() 607 PropertyBox::unitDatabaseChanged()
608 { 608 {
609 #ifdef DEBUG_PROPERTY_BOX 609 #ifdef DEBUG_PROPERTY_BOX
610 cerr << "PropertyBox[" << this << "]: unitDatabaseChanged" << endl; 610 SVDEBUG << "PropertyBox[" << this << "]: unitDatabaseChanged" << endl;
611 #endif 611 #endif
612 blockSignals(true); 612 blockSignals(true);
613 613
614 // cerr << "my container is " << m_container << endl; 614 // SVDEBUG << "my container is " << m_container << endl;
615 // cerr << "my container's name is... " << endl; 615 // SVDEBUG << "my container's name is... " << endl;
616 // cerr << m_container->objectName() << endl; 616 // SVDEBUG << m_container->objectName() << endl;
617 617
618 PropertyContainer::PropertyList properties = m_container->getProperties(); 618 PropertyContainer::PropertyList properties = m_container->getProperties();
619 for (size_t i = 0; i < properties.size(); ++i) { 619 for (size_t i = 0; i < properties.size(); ++i) {
620 if (m_container->getPropertyType(properties[i]) == 620 if (m_container->getPropertyType(properties[i]) ==
621 PropertyContainer::UnitsProperty) { 621 PropertyContainer::UnitsProperty) {