Mercurial > hg > svgui
comparison widgets/PropertyBox.cpp @ 1180:6a6a63506e3f levelpanwidget
Some work on play parameters and level controls in property box
| author | Chris Cannam |
|---|---|
| date | Tue, 06 Dec 2016 09:47:27 +0000 |
| parents | 7c31eb5bc77d |
| children | 306c24eeab10 |
comparison
equal
deleted
inserted
replaced
| 1179:7c31eb5bc77d | 1180:6a6a63506e3f |
|---|---|
| 175 layout->setAlignment(m_showButton, Qt::AlignVCenter); | 175 layout->setAlignment(m_showButton, Qt::AlignVCenter); |
| 176 } | 176 } |
| 177 | 177 |
| 178 if (params) { | 178 if (params) { |
| 179 | 179 |
| 180 QLabel *playLabel = new QLabel(tr("Play")); | |
| 181 layout->addWidget(playLabel); | |
| 182 layout->setAlignment(playLabel, Qt::AlignVCenter); | |
| 183 | |
| 184 m_playButton = new LEDButton(Qt::darkGreen); | |
| 185 m_playButton->setState(!params->isPlayMuted()); | |
| 186 layout->addWidget(m_playButton); | |
| 187 connect(m_playButton, SIGNAL(stateChanged(bool)), | |
| 188 this, SLOT(playAudibleButtonChanged(bool))); | |
| 189 connect(m_playButton, SIGNAL(mouseEntered()), | |
| 190 this, SLOT(mouseEnteredWidget())); | |
| 191 connect(m_playButton, SIGNAL(mouseLeft()), | |
| 192 this, SLOT(mouseLeftWidget())); | |
| 193 connect(params, SIGNAL(playAudibleChanged(bool)), | |
| 194 this, SLOT(playAudibleChanged(bool))); | |
| 195 layout->setAlignment(m_playButton, Qt::AlignVCenter); | |
| 196 | |
| 197 layout->insertStretch(-1, 10); | 180 layout->insertStretch(-1, 10); |
| 198 | 181 |
| 199 if (params->getPlayClipId() != "") { | 182 if (params->getPlayClipId() != "") { |
| 200 QPushButton *playParamButton = | 183 NotifyingPushButton *playParamButton = new NotifyingPushButton; |
| 201 new QPushButton(QIcon(":icons/faders.png"), ""); | 184 playParamButton->setObjectName("playParamButton"); |
| 185 playParamButton->setIcon(IconLoader().load("faders")); | |
| 202 playParamButton->setFixedWidth(WidgetScale::scalePixelSize(24)); | 186 playParamButton->setFixedWidth(WidgetScale::scalePixelSize(24)); |
| 203 playParamButton->setFixedHeight(WidgetScale::scalePixelSize(24)); | 187 playParamButton->setFixedHeight(WidgetScale::scalePixelSize(24)); |
| 204 layout->addWidget(playParamButton); | 188 layout->addWidget(playParamButton); |
| 205 connect(playParamButton, SIGNAL(clicked()), | 189 connect(playParamButton, SIGNAL(clicked()), |
| 206 this, SLOT(editPlayParameters())); | 190 this, SLOT(editPlayParameters())); |
| 191 connect(playParamButton, SIGNAL(mouseEntered()), | |
| 192 this, SLOT(mouseEnteredWidget())); | |
| 193 connect(playParamButton, SIGNAL(mouseLeft()), | |
| 194 this, SLOT(mouseLeftWidget())); | |
| 207 } | 195 } |
| 208 | 196 |
| 209 LevelPanToolButton *levelPan = new LevelPanToolButton; | 197 LevelPanToolButton *levelPan = new LevelPanToolButton; |
| 210 layout->addWidget(levelPan); | 198 layout->addWidget(levelPan); |
| 211 connect(levelPan, SIGNAL(levelChanged(float)), | 199 connect(levelPan, SIGNAL(levelChanged(float)), |
| 214 this, SLOT(playPanControlChanged(float))); | 202 this, SLOT(playPanControlChanged(float))); |
| 215 connect(params, SIGNAL(playGainChanged(float)), | 203 connect(params, SIGNAL(playGainChanged(float)), |
| 216 levelPan, SLOT(setLevel(float))); | 204 levelPan, SLOT(setLevel(float))); |
| 217 connect(params, SIGNAL(playPanChanged(float)), | 205 connect(params, SIGNAL(playPanChanged(float)), |
| 218 levelPan, SLOT(setPan(float))); | 206 levelPan, SLOT(setPan(float))); |
| 207 connect(levelPan, SIGNAL(mouseEntered()), | |
| 208 this, SLOT(mouseEnteredWidget())); | |
| 209 connect(levelPan, SIGNAL(mouseLeft()), | |
| 210 this, SLOT(mouseLeftWidget())); | |
| 211 | |
| 212 m_playButton = new NotifyingPushButton; | |
| 213 m_playButton->setCheckable(true); | |
| 214 m_playButton->setIcon(IconLoader().load("speaker")); | |
| 215 m_playButton->setChecked(!params->isPlayMuted()); | |
| 216 layout->addWidget(m_playButton); | |
| 217 connect(m_playButton, SIGNAL(toggled(bool)), | |
| 218 this, SLOT(playAudibleButtonChanged(bool))); | |
| 219 connect(m_playButton, SIGNAL(mouseEntered()), | |
| 220 this, SLOT(mouseEnteredWidget())); | |
| 221 connect(m_playButton, SIGNAL(mouseLeft()), | |
| 222 this, SLOT(mouseLeftWidget())); | |
| 223 connect(params, SIGNAL(playAudibleChanged(bool)), | |
| 224 this, SLOT(playAudibleChanged(bool))); | |
| 225 layout->setAlignment(m_playButton, Qt::AlignVCenter); | |
| 219 | 226 |
| 220 } else { | 227 } else { |
| 221 | 228 |
| 222 layout->insertStretch(-1, 10); | 229 layout->insertStretch(-1, 10); |
| 223 } | 230 } |
| 650 } | 657 } |
| 651 | 658 |
| 652 void | 659 void |
| 653 PropertyBox::playAudibleChanged(bool audible) | 660 PropertyBox::playAudibleChanged(bool audible) |
| 654 { | 661 { |
| 655 m_playButton->setState(audible); | 662 m_playButton->setChecked(audible); |
| 656 } | 663 } |
| 657 | 664 |
| 658 void | 665 void |
| 659 PropertyBox::playAudibleButtonChanged(bool audible) | 666 PropertyBox::playAudibleButtonChanged(bool audible) |
| 660 { | 667 { |
| 784 | 791 |
| 785 if (!m_container) return; | 792 if (!m_container) return; |
| 786 QString cname = m_container->getPropertyContainerName(); | 793 QString cname = m_container->getPropertyContainerName(); |
| 787 if (cname == "") return; | 794 if (cname == "") return; |
| 788 | 795 |
| 796 LevelPanToolButton *lp = qobject_cast<LevelPanToolButton *>(w); | |
| 797 if (lp) { | |
| 798 emit contextHelpChanged(tr("Adjust playback level and pan of %1").arg(cname)); | |
| 799 return; | |
| 800 } | |
| 801 | |
| 789 QString wname = w->objectName(); | 802 QString wname = w->objectName(); |
| 790 | 803 |
| 804 if (wname == "playParamButton") { | |
| 805 PlayParameters *params = m_container->getPlayParameters(); | |
| 806 if (params) { | |
| 807 emit contextHelpChanged | |
| 808 (tr("Change sound used for playback (currently \"%1\")") | |
| 809 .arg(params->getPlayClipId())); | |
| 810 return; | |
| 811 } | |
| 812 } | |
| 813 | |
| 791 QString extraText; | 814 QString extraText; |
| 792 AudioDial *dial = dynamic_cast<AudioDial *>(w); | 815 |
| 816 AudioDial *dial = qobject_cast<AudioDial *>(w); | |
| 793 if (dial) { | 817 if (dial) { |
| 794 double mv = dial->mappedValue(); | 818 double mv = dial->mappedValue(); |
| 795 QString unit = ""; | 819 QString unit = ""; |
| 796 if (dial->rangeMapper()) unit = dial->rangeMapper()->getUnit(); | 820 if (dial->rangeMapper()) unit = dial->rangeMapper()->getUnit(); |
| 797 if (unit != "") { | 821 if (unit != "") { |
