comparison widgets/PropertyBox.cpp @ 706:97ea68f62c1f imaf_enc

Merge from default branch
author Chris Cannam
date Thu, 05 Dec 2013 09:47:02 +0000
parents 5e5ab4e8d64b 692a8b9804fe
children 282f4be8f058
comparison
equal deleted inserted replaced
678:26c5f7fd4807 706:97ea68f62c1f
62 m_container(container), 62 m_container(container),
63 m_showButton(0), 63 m_showButton(0),
64 m_playButton(0) 64 m_playButton(0)
65 { 65 {
66 #ifdef DEBUG_PROPERTY_BOX 66 #ifdef DEBUG_PROPERTY_BOX
67 std::cerr << "PropertyBox[" << this << "(\"" << 67 cerr << "PropertyBox[" << this << "(\"" <<
68 container->getPropertyContainerName() << "\" at " << container << ")]::PropertyBox" << std::endl; 68 container->getPropertyContainerName() << "\" at " << container << ")]::PropertyBox" << endl;
69 #endif 69 #endif
70 70
71 m_mainBox = new QVBoxLayout; 71 m_mainBox = new QVBoxLayout;
72 setLayout(m_mainBox); 72 setLayout(m_mainBox);
73 73
105 105
106 connect(ColourDatabase::getInstance(), SIGNAL(colourDatabaseChanged()), 106 connect(ColourDatabase::getInstance(), SIGNAL(colourDatabaseChanged()),
107 this, SLOT(colourDatabaseChanged())); 107 this, SLOT(colourDatabaseChanged()));
108 108
109 #ifdef DEBUG_PROPERTY_BOX 109 #ifdef DEBUG_PROPERTY_BOX
110 std::cerr << "PropertyBox[" << this << "]::PropertyBox returning" << std::endl; 110 cerr << "PropertyBox[" << this << "]::PropertyBox returning" << endl;
111 #endif 111 #endif
112 } 112 }
113 113
114 PropertyBox::~PropertyBox() 114 PropertyBox::~PropertyBox()
115 { 115 {
116 #ifdef DEBUG_PROPERTY_BOX 116 #ifdef DEBUG_PROPERTY_BOX
117 std::cerr << "PropertyBox[" << this << "]::~PropertyBox" << std::endl; 117 cerr << "PropertyBox[" << this << "]::~PropertyBox" << endl;
118 #endif 118 #endif
119 } 119 }
120 120
121 121
122 void 122 void
123 PropertyBox::populateViewPlayFrame() 123 PropertyBox::populateViewPlayFrame()
124 { 124 {
125 #ifdef DEBUG_PROPERTY_BOX 125 #ifdef DEBUG_PROPERTY_BOX
126 std::cerr << "PropertyBox(" << m_container << ")::populateViewPlayFrame" << std::endl; 126 cerr << "PropertyBox(" << m_container << ")::populateViewPlayFrame" << endl;
127 #endif 127 #endif
128 128
129 if (m_viewPlayFrame) { 129 if (m_viewPlayFrame) {
130 delete m_viewPlayFrame; 130 delete m_viewPlayFrame;
131 m_viewPlayFrame = 0; 131 m_viewPlayFrame = 0;
332 QString groupName = m_container->getPropertyGroupName(name); 332 QString groupName = m_container->getPropertyGroupName(name);
333 QString propertyLabel = m_container->getPropertyLabel(name); 333 QString propertyLabel = m_container->getPropertyLabel(name);
334 QString iconName = m_container->getPropertyIconName(name); 334 QString iconName = m_container->getPropertyIconName(name);
335 335
336 #ifdef DEBUG_PROPERTY_BOX 336 #ifdef DEBUG_PROPERTY_BOX
337 std::cerr << "PropertyBox[" << this 337 cerr << "PropertyBox[" << this
338 << "(\"" << m_container->getPropertyContainerName().toStdString() 338 << "(\"" << m_container->getPropertyContainerName()
339 << "\")]"; 339 << "\")]";
340 std::cerr << "::updatePropertyEditor(\"" << name << "\"):"; 340 cerr << "::updatePropertyEditor(\"" << name << "\"):";
341 std::cerr << " value " << value << ", have " << have << ", group \"" 341 cerr << " value " << value << ", have " << have << ", group \""
342 << groupName << "\"" << std::endl; 342 << groupName << "\"" << endl;
343 #endif 343 #endif
344 344
345 bool inGroup = (groupName != QString()); 345 bool inGroup = (groupName != QString());
346 346
347 if (!have) { 347 if (!have) {
348 if (inGroup) { 348 if (inGroup) {
349 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) { 349 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) {
350 #ifdef DEBUG_PROPERTY_BOX 350 #ifdef DEBUG_PROPERTY_BOX
351 std::cerr << "PropertyBox: adding label \"" << groupName << "\" and frame for group for \"" << name << "\"" << std::endl; 351 cerr << "PropertyBox: adding label \"" << groupName << "\" and frame for group for \"" << name << "\"" << endl;
352 #endif 352 #endif
353 m_layout->addWidget(new QLabel(groupName, m_mainWidget), row, 0); 353 m_layout->addWidget(new QLabel(groupName, m_mainWidget), row, 0);
354 QFrame *frame = new QFrame(m_mainWidget); 354 QFrame *frame = new QFrame(m_mainWidget);
355 m_layout->addWidget(frame, row, 1, 1, 2); 355 m_layout->addWidget(frame, row, 1, 1, 2);
356 m_groupLayouts[groupName] = new QGridLayout; 356 m_groupLayouts[groupName] = new QGridLayout;
357 m_groupLayouts[groupName]->setMargin(0); 357 m_groupLayouts[groupName]->setMargin(0);
358 frame->setLayout(m_groupLayouts[groupName]); 358 frame->setLayout(m_groupLayouts[groupName]);
359 } 359 }
360 } else { 360 } else {
361 #ifdef DEBUG_PROPERTY_BOX 361 #ifdef DEBUG_PROPERTY_BOX
362 std::cerr << "PropertyBox: adding label \"" << propertyLabel << "\"" << std::endl; 362 cerr << "PropertyBox: adding label \"" << propertyLabel << "\"" << endl;
363 #endif 363 #endif
364 m_layout->addWidget(new QLabel(propertyLabel, m_mainWidget), row, 0); 364 m_layout->addWidget(new QLabel(propertyLabel, m_mainWidget), row, 0);
365 } 365 }
366 } 366 }
367 367
374 if (have) { 374 if (have) {
375 button = dynamic_cast<QAbstractButton *>(m_propertyControllers[name]); 375 button = dynamic_cast<QAbstractButton *>(m_propertyControllers[name]);
376 assert(button); 376 assert(button);
377 } else { 377 } else {
378 #ifdef DEBUG_PROPERTY_BOX 378 #ifdef DEBUG_PROPERTY_BOX
379 std::cerr << "PropertyBox: creating new checkbox" << std::endl; 379 cerr << "PropertyBox: creating new checkbox" << endl;
380 #endif 380 #endif
381 if (iconName != "") { 381 if (iconName != "") {
382 button = new NotifyingPushButton(); 382 button = new NotifyingPushButton();
383 button->setCheckable(true); 383 button->setCheckable(true);
384 QIcon icon(IconLoader().load(iconName)); 384 QIcon icon(IconLoader().load(iconName));
428 dial->blockSignals(false); 428 dial->blockSignals(false);
429 } 429 }
430 430
431 } else { 431 } else {
432 #ifdef DEBUG_PROPERTY_BOX 432 #ifdef DEBUG_PROPERTY_BOX
433 std::cerr << "PropertyBox: creating new dial" << std::endl; 433 cerr << "PropertyBox: creating new dial" << endl;
434 #endif 434 #endif
435 dial = new AudioDial(); 435 dial = new AudioDial();
436 dial->setObjectName(name); 436 dial->setObjectName(name);
437 dial->setMinimum(min); 437 dial->setMinimum(min);
438 dial->setMaximum(max); 438 dial->setMaximum(max);
484 if (have) { 484 if (have) {
485 cb = dynamic_cast<NotifyingComboBox *>(m_propertyControllers[name]); 485 cb = dynamic_cast<NotifyingComboBox *>(m_propertyControllers[name]);
486 assert(cb); 486 assert(cb);
487 } else { 487 } else {
488 #ifdef DEBUG_PROPERTY_BOX 488 #ifdef DEBUG_PROPERTY_BOX
489 std::cerr << "PropertyBox: creating new combobox" << std::endl; 489 cerr << "PropertyBox: creating new combobox" << endl;
490 #endif 490 #endif
491 491
492 cb = new NotifyingComboBox(); 492 cb = new NotifyingComboBox();
493 cb->setObjectName(name); 493 cb->setObjectName(name);
494 cb->setDuplicatesEnabled(false); 494 cb->setDuplicatesEnabled(false);
569 } 569 }
570 } 570 }
571 } 571 }
572 cb->blockSignals(false); 572 cb->blockSignals(false);
573 573
574 #ifdef Q_WS_MAC 574 #ifdef Q_OS_MAC
575 // Crashes on startup without this, for some reason 575 // Crashes on startup without this, for some reason
576 cb->setMinimumSize(QSize(10, 10)); 576 cb->setMinimumSize(QSize(10, 10));
577 #endif 577 #endif
578 578
579 break; 579 break;
619 } 619 }
620 620
621 void 621 void
622 PropertyBox::unitDatabaseChanged() 622 PropertyBox::unitDatabaseChanged()
623 { 623 {
624 std::cerr << "PropertyBox[" << this << "]: unitDatabaseChanged" << std::endl; 624 cerr << "PropertyBox[" << this << "]: unitDatabaseChanged" << endl;
625 blockSignals(true); 625 blockSignals(true);
626 626
627 // std::cerr << "my container is " << m_container << std::endl; 627 // cerr << "my container is " << m_container << endl;
628 // std::cerr << "my container's name is... " << std::endl; 628 // cerr << "my container's name is... " << endl;
629 // std::cerr << m_container->objectName() << std::endl; 629 // cerr << m_container->objectName() << endl;
630 630
631 PropertyContainer::PropertyList properties = m_container->getProperties(); 631 PropertyContainer::PropertyList properties = m_container->getProperties();
632 for (size_t i = 0; i < properties.size(); ++i) { 632 for (size_t i = 0; i < properties.size(); ++i) {
633 if (m_container->getPropertyType(properties[i]) == 633 if (m_container->getPropertyType(properties[i]) ==
634 PropertyContainer::UnitsProperty) { 634 PropertyContainer::UnitsProperty) {