comparison widgets/PropertyBox.cpp @ 0:fc9323a41f5a

start base : Sonic Visualiser sv1-1.0rc1
author lbajardsilogic
date Fri, 11 May 2007 09:08:14 +0000
parents
children 4f3e6a09239a
comparison
equal deleted inserted replaced
-1:000000000000 0:fc9323a41f5a
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam and QMUL.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #include "PropertyBox.h"
17 #include "PluginParameterDialog.h"
18
19 #include "system/System.h"
20 #include "base/PropertyContainer.h"
21 #include "base/PlayParameters.h"
22 #include "layer/Layer.h"
23 #include "base/UnitDatabase.h"
24 #include "base/RangeMapper.h"
25
26 #include "plugin/RealTimePluginFactory.h"
27 #include "plugin/RealTimePluginInstance.h"
28 #include "plugin/PluginXml.h"
29
30 #include "AudioDial.h"
31 #include "LEDButton.h"
32
33 #include "NotifyingCheckBox.h"
34 #include "NotifyingComboBox.h"
35
36 #include <QGridLayout>
37 #include <QHBoxLayout>
38 #include <QVBoxLayout>
39 #include <QPushButton>
40 #include <QLabel>
41 #include <QFrame>
42 #include <QApplication>
43
44 #include <cassert>
45 #include <iostream>
46 #include <cmath>
47
48 //#define DEBUG_PROPERTY_BOX 1
49
50 PropertyBox::PropertyBox(PropertyContainer *container) :
51 m_container(container),
52 m_showButton(0),
53 m_playButton(0)
54 {
55 #ifdef DEBUG_PROPERTY_BOX
56 std::cerr << "PropertyBox[" << this << "(\"" <<
57 container->getPropertyContainerName().toStdString() << "\")]::PropertyBox" << std::endl;
58 #endif
59
60 m_mainBox = new QVBoxLayout;
61 setLayout(m_mainBox);
62
63 // m_nameWidget = new QLabel;
64 // m_mainBox->addWidget(m_nameWidget);
65 // m_nameWidget->setText(container->objectName());
66
67 m_mainWidget = new QWidget;
68 m_mainBox->addWidget(m_mainWidget);
69 m_mainBox->insertStretch(2, 10);
70
71 m_viewPlayFrame = 0;
72 populateViewPlayFrame();
73
74 m_layout = new QGridLayout;
75 m_layout->setMargin(0);
76 m_mainWidget->setLayout(m_layout);
77
78 PropertyContainer::PropertyList properties = m_container->getProperties();
79
80 blockSignals(true);
81
82 size_t i;
83
84 for (i = 0; i < properties.size(); ++i) {
85 updatePropertyEditor(properties[i]);
86 }
87
88 blockSignals(false);
89
90 m_layout->setRowStretch(m_layout->rowCount(), 10);
91
92 connect(UnitDatabase::getInstance(), SIGNAL(unitDatabaseChanged()),
93 this, SLOT(unitDatabaseChanged()));
94
95 #ifdef DEBUG_PROPERTY_BOX
96 std::cerr << "PropertyBox[" << this << "]::PropertyBox returning" << std::endl;
97 #endif
98 }
99
100 PropertyBox::~PropertyBox()
101 {
102 #ifdef DEBUG_PROPERTY_BOX
103 std::cerr << "PropertyBox[" << this << "]::~PropertyBox" << std::endl;
104 #endif
105 }
106
107 void
108 PropertyBox::populateViewPlayFrame()
109 {
110 #ifdef DEBUG_PROPERTY_BOX
111 std::cerr << "PropertyBox(" << m_container << ")::populateViewPlayFrame" << std::endl;
112 #endif
113
114 if (m_viewPlayFrame) {
115 delete m_viewPlayFrame;
116 m_viewPlayFrame = 0;
117 }
118
119 if (!m_container) return;
120
121 Layer *layer = dynamic_cast<Layer *>(m_container);
122 if (layer) {
123 disconnect(layer, SIGNAL(modelReplaced()),
124 this, SLOT(populateViewPlayFrame()));
125 connect(layer, SIGNAL(modelReplaced()),
126 this, SLOT(populateViewPlayFrame()));
127 }
128
129 PlayParameters *params = m_container->getPlayParameters();
130 if (!params && !layer) return;
131
132 m_viewPlayFrame = new QFrame;
133 m_viewPlayFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
134 m_mainBox->addWidget(m_viewPlayFrame);
135
136 QHBoxLayout *layout = new QHBoxLayout;
137 m_viewPlayFrame->setLayout(layout);
138
139 layout->setMargin(layout->margin() / 2);
140
141 #ifdef DEBUG_PROPERTY_BOX
142 std::cerr << "PropertyBox::populateViewPlayFrame: container " << m_container << " (name " << m_container->getPropertyContainerName().toStdString() << ") params " << params << std::endl;
143 #endif
144
145 if (layer) {
146 QLabel *showLabel = new QLabel(tr("Show"));
147 layout->addWidget(showLabel);
148 layout->setAlignment(showLabel, Qt::AlignVCenter);
149
150 m_showButton = new LEDButton(Qt::blue);
151 layout->addWidget(m_showButton);
152 connect(m_showButton, SIGNAL(stateChanged(bool)),
153 this, SIGNAL(showLayer(bool)));
154 connect(m_showButton, SIGNAL(mouseEntered()),
155 this, SLOT(mouseEnteredWidget()));
156 connect(m_showButton, SIGNAL(mouseLeft()),
157 this, SLOT(mouseLeftWidget()));
158 layout->setAlignment(m_showButton, Qt::AlignVCenter);
159 }
160
161 if (params) {
162
163 QLabel *playLabel = new QLabel(tr("Play"));
164 layout->addWidget(playLabel);
165 layout->setAlignment(playLabel, Qt::AlignVCenter);
166
167 m_playButton = new LEDButton(Qt::darkGreen);
168 m_playButton->setState(!params->isPlayMuted());
169 layout->addWidget(m_playButton);
170 connect(m_playButton, SIGNAL(stateChanged(bool)),
171 params, SLOT(setPlayAudible(bool)));
172 connect(m_playButton, SIGNAL(mouseEntered()),
173 this, SLOT(mouseEnteredWidget()));
174 connect(m_playButton, SIGNAL(mouseLeft()),
175 this, SLOT(mouseLeftWidget()));
176 connect(params, SIGNAL(playAudibleChanged(bool)),
177 m_playButton, SLOT(setState(bool)));
178 layout->setAlignment(m_playButton, Qt::AlignVCenter);
179
180 layout->insertStretch(-1, 10);
181
182 if (params->getPlayPluginId() != "") {
183 QPushButton *pluginButton = new QPushButton(QIcon(":icons/faders.png"), "");
184 pluginButton->setFixedWidth(24);
185 pluginButton->setFixedHeight(24);
186 layout->addWidget(pluginButton);
187 connect(pluginButton, SIGNAL(clicked()),
188 this, SLOT(editPlugin()));
189 }
190
191 AudioDial *gainDial = new AudioDial;
192 layout->addWidget(gainDial);
193 gainDial->setMeterColor(Qt::darkRed);
194 gainDial->setMinimum(-50);
195 gainDial->setMaximum(50);
196 gainDial->setPageStep(1);
197 gainDial->setFixedWidth(24);
198 gainDial->setFixedHeight(24);
199 gainDial->setNotchesVisible(false);
200 gainDial->setDefaultValue(0);
201 gainDial->setObjectName(tr("Playback Gain"));
202 gainDial->setRangeMapper(new LinearRangeMapper
203 (-50, 50, -25, 25, tr("dB")));
204 gainDial->setShowToolTip(true);
205 connect(gainDial, SIGNAL(valueChanged(int)),
206 this, SLOT(playGainDialChanged(int)));
207 connect(params, SIGNAL(playGainChanged(float)),
208 this, SLOT(playGainChanged(float)));
209 connect(this, SIGNAL(changePlayGain(float)),
210 params, SLOT(setPlayGain(float)));
211 connect(this, SIGNAL(changePlayGainDial(int)),
212 gainDial, SLOT(setValue(int)));
213 connect(gainDial, SIGNAL(mouseEntered()),
214 this, SLOT(mouseEnteredWidget()));
215 connect(gainDial, SIGNAL(mouseLeft()),
216 this, SLOT(mouseLeftWidget()));
217 layout->setAlignment(gainDial, Qt::AlignVCenter);
218
219 AudioDial *panDial = new AudioDial;
220 layout->addWidget(panDial);
221 panDial->setMeterColor(Qt::darkGreen);
222 panDial->setMinimum(-50);
223 panDial->setMaximum(50);
224 panDial->setPageStep(1);
225 panDial->setFixedWidth(24);
226 panDial->setFixedHeight(24);
227 panDial->setNotchesVisible(false);
228 panDial->setToolTip(tr("Playback Pan / Balance"));
229 panDial->setDefaultValue(0);
230 panDial->setObjectName(tr("Playback Pan / Balance"));
231 panDial->setShowToolTip(true);
232 connect(panDial, SIGNAL(valueChanged(int)),
233 this, SLOT(playPanDialChanged(int)));
234 connect(params, SIGNAL(playPanChanged(float)),
235 this, SLOT(playPanChanged(float)));
236 connect(this, SIGNAL(changePlayPan(float)),
237 params, SLOT(setPlayPan(float)));
238 connect(this, SIGNAL(changePlayPanDial(int)),
239 panDial, SLOT(setValue(int)));
240 connect(panDial, SIGNAL(mouseEntered()),
241 this, SLOT(mouseEnteredWidget()));
242 connect(panDial, SIGNAL(mouseLeft()),
243 this, SLOT(mouseLeftWidget()));
244 layout->setAlignment(panDial, Qt::AlignVCenter);
245
246 } else {
247
248 layout->insertStretch(-1, 10);
249 }
250 }
251
252 void
253 PropertyBox::updatePropertyEditor(PropertyContainer::PropertyName name,
254 bool rangeChanged)
255 {
256 PropertyContainer::PropertyType type = m_container->getPropertyType(name);
257 int row = m_layout->rowCount();
258
259 int min = 0, max = 0, value = 0, deflt = 0;
260 value = m_container->getPropertyRangeAndValue(name, &min, &max, &deflt);
261
262 bool have = (m_propertyControllers.find(name) !=
263 m_propertyControllers.end());
264
265 QString groupName = m_container->getPropertyGroupName(name);
266 QString propertyLabel = m_container->getPropertyLabel(name);
267
268 #ifdef DEBUG_PROPERTY_BOX
269 std::cerr << "PropertyBox[" << this
270 << "(\"" << m_container->getPropertyContainerName().toStdString()
271 << "\")]";
272 std::cerr << "::updatePropertyEditor(\"" << name.toStdString() << "\"):";
273 std::cerr << " value " << value << ", have " << have << ", group \""
274 << groupName.toStdString() << "\"" << std::endl;
275 #endif
276
277 bool inGroup = (groupName != QString());
278
279 if (!have) {
280 if (inGroup) {
281 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) {
282 #ifdef DEBUG_PROPERTY_BOX
283 std::cerr << "PropertyBox: adding label \"" << groupName.toStdString() << "\" and frame for group for \"" << name.toStdString() << "\"" << std::endl;
284 #endif
285 m_layout->addWidget(new QLabel(groupName, m_mainWidget), row, 0);
286 QFrame *frame = new QFrame(m_mainWidget);
287 m_layout->addWidget(frame, row, 1, 1, 2);
288 m_groupLayouts[groupName] = new QHBoxLayout;
289 m_groupLayouts[groupName]->setMargin(0);
290 frame->setLayout(m_groupLayouts[groupName]);
291 }
292 } else {
293 #ifdef DEBUG_PROPERTY_BOX
294 std::cerr << "PropertyBox: adding label \"" << propertyLabel.toStdString() << "\"" << std::endl;
295 #endif
296 m_layout->addWidget(new QLabel(propertyLabel, m_mainWidget), row, 0);
297 }
298 }
299
300 switch (type) {
301
302 case PropertyContainer::ToggleProperty:
303 {
304 NotifyingCheckBox *cb;
305
306 if (have) {
307 cb = dynamic_cast<NotifyingCheckBox *>(m_propertyControllers[name]);
308 assert(cb);
309 } else {
310 #ifdef DEBUG_PROPERTY_BOX
311 std::cerr << "PropertyBox: creating new checkbox" << std::endl;
312 #endif
313 cb = new NotifyingCheckBox();
314 cb->setObjectName(name);
315 connect(cb, SIGNAL(stateChanged(int)),
316 this, SLOT(propertyControllerChanged(int)));
317 connect(cb, SIGNAL(mouseEntered()),
318 this, SLOT(mouseEnteredWidget()));
319 connect(cb, SIGNAL(mouseLeft()),
320 this, SLOT(mouseLeftWidget()));
321 if (inGroup) {
322 cb->setToolTip(propertyLabel);
323 m_groupLayouts[groupName]->addWidget(cb);
324 } else {
325 m_layout->addWidget(cb, row, 1, 1, 2);
326 }
327 m_propertyControllers[name] = cb;
328 }
329
330 if (cb->isChecked() != (value > 0)) {
331 cb->blockSignals(true);
332 cb->setChecked(value > 0);
333 cb->blockSignals(false);
334 }
335 break;
336 }
337
338 case PropertyContainer::RangeProperty:
339 {
340 AudioDial *dial;
341
342 if (have) {
343 dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]);
344 assert(dial);
345 if (rangeChanged) {
346 dial->blockSignals(true);
347 dial->setMinimum(min);
348 dial->setMaximum(max);
349 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
350 dial->blockSignals(false);
351 }
352
353 } else {
354 #ifdef DEBUG_PROPERTY_BOX
355 std::cerr << "PropertyBox: creating new dial" << std::endl;
356 #endif
357 dial = new AudioDial();
358 dial->setObjectName(name);
359 dial->setMinimum(min);
360 dial->setMaximum(max);
361 dial->setPageStep(1);
362 dial->setNotchesVisible((max - min) <= 12);
363 dial->setDefaultValue(deflt);
364 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
365 dial->setShowToolTip(true);
366 connect(dial, SIGNAL(valueChanged(int)),
367 this, SLOT(propertyControllerChanged(int)));
368 connect(dial, SIGNAL(mouseEntered()),
369 this, SLOT(mouseEnteredWidget()));
370 connect(dial, SIGNAL(mouseLeft()),
371 this, SLOT(mouseLeftWidget()));
372
373 if (inGroup) {
374 dial->setFixedWidth(24);
375 dial->setFixedHeight(24);
376 m_groupLayouts[groupName]->addWidget(dial);
377 } else {
378 dial->setFixedWidth(32);
379 dial->setFixedHeight(32);
380 m_layout->addWidget(dial, row, 1);
381 QLabel *label = new QLabel(m_mainWidget);
382 connect(dial, SIGNAL(valueChanged(int)),
383 label, SLOT(setNum(int)));
384 label->setNum(value);
385 m_layout->addWidget(label, row, 2);
386 }
387
388 m_propertyControllers[name] = dial;
389 }
390
391 if (dial->value() != value) {
392 dial->blockSignals(true);
393 dial->setValue(value);
394 dial->blockSignals(false);
395 }
396 break;
397 }
398
399 case PropertyContainer::ValueProperty:
400 case PropertyContainer::UnitsProperty:
401 {
402 NotifyingComboBox *cb;
403
404 if (have) {
405 cb = dynamic_cast<NotifyingComboBox *>(m_propertyControllers[name]);
406 assert(cb);
407 } else {
408 #ifdef DEBUG_PROPERTY_BOX
409 std::cerr << "PropertyBox: creating new combobox" << std::endl;
410 #endif
411
412 cb = new NotifyingComboBox();
413 cb->setObjectName(name);
414 cb->setDuplicatesEnabled(false);
415 }
416
417 if (!have || rangeChanged) {
418 cb->blockSignals(true);
419 cb->clear();
420 if (type == PropertyContainer::ValueProperty) {
421 for (int i = min; i <= max; ++i) {
422 cb->addItem(m_container->getPropertyValueLabel(name, i));
423 }
424 cb->setEditable(false);
425 } else {
426 QStringList units = UnitDatabase::getInstance()->getKnownUnits();
427 for (int i = 0; i < units.size(); ++i) {
428 cb->addItem(units[i]);
429 }
430 cb->setEditable(true);
431 }
432 cb->blockSignals(false);
433 }
434
435 if (!have) {
436 connect(cb, SIGNAL(activated(int)),
437 this, SLOT(propertyControllerChanged(int)));
438 connect(cb, SIGNAL(mouseEntered()),
439 this, SLOT(mouseEnteredWidget()));
440 connect(cb, SIGNAL(mouseLeft()),
441 this, SLOT(mouseLeftWidget()));
442
443 if (inGroup) {
444 cb->setToolTip(propertyLabel);
445 m_groupLayouts[groupName]->addWidget(cb);
446 } else {
447 m_layout->addWidget(cb, row, 1, 1, 2);
448 }
449 m_propertyControllers[name] = cb;
450 }
451
452 cb->blockSignals(true);
453 if (type == PropertyContainer::ValueProperty) {
454 if (cb->currentIndex() != value) {
455 cb->setCurrentIndex(value);
456 }
457 } else {
458 QString unit = UnitDatabase::getInstance()->getUnitById(value);
459 if (cb->currentText() != unit) {
460 for (int i = 0; i < cb->count(); ++i) {
461 if (cb->itemText(i) == unit) {
462 cb->setCurrentIndex(i);
463 break;
464 }
465 }
466 }
467 }
468 cb->blockSignals(false);
469
470 #ifdef Q_WS_MAC
471 // Crashes on startup without this, for some reason
472 cb->setMinimumSize(QSize(10, 10));
473 #endif
474
475 break;
476 }
477
478 default:
479 break;
480 }
481 }
482
483 void
484 PropertyBox::propertyContainerPropertyChanged(PropertyContainer *pc)
485 {
486 if (pc != m_container) return;
487
488 #ifdef DEBUG_PROPERTY_BOX
489 std::cerr << "PropertyBox::propertyContainerPropertyChanged" << std::endl;
490 #endif
491
492 PropertyContainer::PropertyList properties = m_container->getProperties();
493 size_t i;
494
495 blockSignals(true);
496
497 for (i = 0; i < properties.size(); ++i) {
498 updatePropertyEditor(properties[i]);
499 }
500
501 blockSignals(false);
502 }
503
504 void
505 PropertyBox::propertyContainerPropertyRangeChanged(PropertyContainer *)
506 {
507 blockSignals(true);
508
509 PropertyContainer::PropertyList properties = m_container->getProperties();
510 for (size_t i = 0; i < properties.size(); ++i) {
511 updatePropertyEditor(properties[i], true);
512 }
513
514 blockSignals(false);
515 }
516
517 void
518 PropertyBox::unitDatabaseChanged()
519 {
520 blockSignals(true);
521
522 PropertyContainer::PropertyList properties = m_container->getProperties();
523 for (size_t i = 0; i < properties.size(); ++i) {
524 updatePropertyEditor(properties[i]);
525 }
526
527 blockSignals(false);
528 }
529
530 void
531 PropertyBox::propertyControllerChanged(int value)
532 {
533 QObject *obj = sender();
534 QString name = obj->objectName();
535
536 #ifdef DEBUG_PROPERTY_BOX
537 std::cerr << "PropertyBox::propertyControllerChanged(" << name.toStdString()
538 << ", " << value << ")" << std::endl;
539 #endif
540
541 PropertyContainer::PropertyType type = m_container->getPropertyType(name);
542
543 if (type == PropertyContainer::UnitsProperty) {
544 NotifyingComboBox *cb = dynamic_cast<NotifyingComboBox *>(obj);
545 if (cb) {
546 QString unit = cb->currentText();
547 m_container->setPropertyWithCommand
548 (name, UnitDatabase::getInstance()->getUnitId(unit));
549 }
550 } else if (type != PropertyContainer::InvalidProperty) {
551 m_container->setPropertyWithCommand(name, value);
552 }
553
554 updateContextHelp(obj);
555 }
556
557 void
558 PropertyBox::playGainChanged(float gain)
559 {
560 int dialValue = lrint(log10(gain) * 20.0);
561 if (dialValue < -50) dialValue = -50;
562 if (dialValue > 50) dialValue = 50;
563 emit changePlayGainDial(dialValue);
564 }
565
566 void
567 PropertyBox::playGainDialChanged(int dialValue)
568 {
569 QObject *obj = sender();
570 float gain = pow(10, float(dialValue) / 20.0);
571 emit changePlayGain(gain);
572 updateContextHelp(obj);
573 }
574
575 void
576 PropertyBox::playPanChanged(float pan)
577 {
578 int dialValue = lrint(pan * 50.0);
579 if (dialValue < -50) dialValue = -50;
580 if (dialValue > 50) dialValue = 50;
581 emit changePlayPanDial(dialValue);
582 }
583
584 void
585 PropertyBox::playPanDialChanged(int dialValue)
586 {
587 QObject *obj = sender();
588 float pan = float(dialValue) / 50.0;
589 if (pan < -1.0) pan = -1.0;
590 if (pan > 1.0) pan = 1.0;
591 emit changePlayPan(pan);
592 updateContextHelp(obj);
593 }
594
595 void
596 PropertyBox::editPlugin()
597 {
598 //!!! should probably just emit and let something else do this
599
600 PlayParameters *params = m_container->getPlayParameters();
601 if (!params) return;
602
603 QString pluginId = params->getPlayPluginId();
604 QString configurationXml = params->getPlayPluginConfiguration();
605
606 RealTimePluginFactory *factory =
607 RealTimePluginFactory::instanceFor(pluginId);
608 if (!factory) return;
609
610 RealTimePluginInstance *instance =
611 factory->instantiatePlugin(pluginId, 0, 0, 48000, 1024, 1);
612 if (!instance) return;
613
614 PluginXml(instance).setParametersFromXml(configurationXml);
615
616 PluginParameterDialog *dialog = new PluginParameterDialog(instance);
617 connect(dialog, SIGNAL(pluginConfigurationChanged(QString)),
618 this, SLOT(pluginConfigurationChanged(QString)));
619
620 if (dialog->exec() == QDialog::Accepted) {
621 params->setPlayPluginConfiguration(PluginXml(instance).toXmlString());
622 } else {
623 // restore in case we mucked about with the configuration
624 // as a consequence of signals from the dialog
625 params->setPlayPluginConfiguration(configurationXml);
626 }
627
628 delete dialog;
629 delete instance;
630 }
631
632 void
633 PropertyBox::pluginConfigurationChanged(QString configurationXml)
634 {
635 PlayParameters *params = m_container->getPlayParameters();
636 if (!params) return;
637
638 params->setPlayPluginConfiguration(configurationXml);
639 }
640
641 void
642 PropertyBox::layerVisibilityChanged(bool visible)
643 {
644 if (m_showButton) m_showButton->setState(visible);
645 }
646
647 void
648 PropertyBox::mouseEnteredWidget()
649 {
650 updateContextHelp(sender());
651 }
652
653 void
654 PropertyBox::updateContextHelp(QObject *o)
655 {
656 QWidget *w = dynamic_cast<QWidget *>(o);
657 if (!w) return;
658
659 if (!m_container) return;
660 QString cname = m_container->getPropertyContainerName();
661 if (cname == "") return;
662
663 QString wname = w->objectName();
664
665 QString extraText;
666 AudioDial *dial = dynamic_cast<AudioDial *>(w);
667 if (dial) {
668 float mv = dial->mappedValue();
669 QString unit = "";
670 if (dial->rangeMapper()) unit = dial->rangeMapper()->getUnit();
671 if (unit != "") {
672 extraText = tr(" (current value: %1%2)").arg(mv).arg(unit);
673 } else {
674 extraText = tr(" (current value: %1)").arg(mv);
675 }
676 }
677
678 if (w == m_showButton) {
679 emit contextHelpChanged(tr("Toggle Visibility of %1").arg(cname));
680 } else if (w == m_playButton) {
681 emit contextHelpChanged(tr("Toggle Playback of %1").arg(cname));
682 } else if (wname == "") {
683 return;
684 } else if (dynamic_cast<NotifyingCheckBox *>(w)) {
685 emit contextHelpChanged(tr("Toggle %1 property of %2")
686 .arg(wname).arg(cname));
687 } else {
688 emit contextHelpChanged(tr("Adjust %1 property of %2%3")
689 .arg(wname).arg(cname).arg(extraText));
690 }
691 }
692
693 void
694 PropertyBox::mouseLeftWidget()
695 {
696 if (!(QApplication::mouseButtons() & Qt::LeftButton)) {
697 emit contextHelpChanged("");
698 }
699 }
700
701