comparison widgets/PropertyBox.cpp @ 1480:232262e38051 by-id

Update for changes to PlayParameters
author Chris Cannam
date Thu, 04 Jul 2019 18:04:44 +0100
parents c8a6fd3f9dff
children 76b388d4d19c
comparison
equal deleted inserted replaced
1479:9bf8aa2916e9 1480:232262e38051
140 this, SLOT(populateViewPlayFrame())); 140 this, SLOT(populateViewPlayFrame()));
141 connect(layer, SIGNAL(modelReplaced()), 141 connect(layer, SIGNAL(modelReplaced()),
142 this, SLOT(populateViewPlayFrame())); 142 this, SLOT(populateViewPlayFrame()));
143 } 143 }
144 144
145 PlayParameters *params = m_container->getPlayParameters(); 145 auto params = m_container->getPlayParameters();
146 if (!params && !layer) return; 146 if (!params && !layer) return;
147 147
148 m_viewPlayFrame = new QFrame; 148 m_viewPlayFrame = new QFrame;
149 m_viewPlayFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); 149 m_viewPlayFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
150 m_mainBox->addWidget(m_viewPlayFrame); 150 m_mainBox->addWidget(m_viewPlayFrame);
173 this, SLOT(playAudibleButtonChanged(bool))); 173 this, SLOT(playAudibleButtonChanged(bool)));
174 connect(m_playButton, SIGNAL(mouseEntered()), 174 connect(m_playButton, SIGNAL(mouseEntered()),
175 this, SLOT(mouseEnteredWidget())); 175 this, SLOT(mouseEnteredWidget()));
176 connect(m_playButton, SIGNAL(mouseLeft()), 176 connect(m_playButton, SIGNAL(mouseLeft()),
177 this, SLOT(mouseLeftWidget())); 177 this, SLOT(mouseLeftWidget()));
178 connect(params, SIGNAL(playAudibleChanged(bool)), 178 connect(params.get(), SIGNAL(playAudibleChanged(bool)),
179 this, SLOT(playAudibleChanged(bool))); 179 this, SLOT(playAudibleChanged(bool)));
180 180
181 LevelPanToolButton *levelPan = new LevelPanToolButton; 181 LevelPanToolButton *levelPan = new LevelPanToolButton;
182 levelPan->setFixedSize(buttonSize); 182 levelPan->setFixedSize(buttonSize);
183 levelPan->setImageSize((buttonSize.height() * 3) / 4); 183 levelPan->setImageSize((buttonSize.height() * 3) / 4);
184 layout->addWidget(levelPan, 0, col++, Qt::AlignCenter); 184 layout->addWidget(levelPan, 0, col++, Qt::AlignCenter);
185 connect(levelPan, SIGNAL(levelChanged(float)), 185 connect(levelPan, SIGNAL(levelChanged(float)),
186 this, SLOT(playGainControlChanged(float))); 186 this, SLOT(playGainControlChanged(float)));
187 connect(levelPan, SIGNAL(panChanged(float)), 187 connect(levelPan, SIGNAL(panChanged(float)),
188 this, SLOT(playPanControlChanged(float))); 188 this, SLOT(playPanControlChanged(float)));
189 connect(params, SIGNAL(playGainChanged(float)), 189 connect(params.get(), SIGNAL(playGainChanged(float)),
190 levelPan, SLOT(setLevel(float))); 190 levelPan, SLOT(setLevel(float)));
191 connect(params, SIGNAL(playPanChanged(float)), 191 connect(params.get(), SIGNAL(playPanChanged(float)),
192 levelPan, SLOT(setPan(float))); 192 levelPan, SLOT(setPan(float)));
193 connect(levelPan, SIGNAL(mouseEntered()), 193 connect(levelPan, SIGNAL(mouseEntered()),
194 this, SLOT(mouseEnteredWidget())); 194 this, SLOT(mouseEnteredWidget()));
195 connect(levelPan, SIGNAL(mouseLeft()), 195 connect(levelPan, SIGNAL(mouseLeft()),
196 this, SLOT(mouseLeftWidget())); 196 this, SLOT(mouseLeftWidget()));
672 } 672 }
673 673
674 void 674 void
675 PropertyBox::playAudibleButtonChanged(bool audible) 675 PropertyBox::playAudibleButtonChanged(bool audible)
676 { 676 {
677 PlayParameters *params = m_container->getPlayParameters(); 677 auto params = m_container->getPlayParameters();
678 if (!params) return; 678 if (!params) return;
679 679
680 if (params->isPlayAudible() != audible) { 680 if (params->isPlayAudible() != audible) {
681 PlayParameterRepository::EditCommand *command = 681 PlayParameterRepository::EditCommand *command =
682 new PlayParameterRepository::EditCommand(params); 682 new PlayParameterRepository::EditCommand(params);
688 void 688 void
689 PropertyBox::playGainControlChanged(float gain) 689 PropertyBox::playGainControlChanged(float gain)
690 { 690 {
691 QObject *obj = sender(); 691 QObject *obj = sender();
692 692
693 PlayParameters *params = m_container->getPlayParameters(); 693 auto params = m_container->getPlayParameters();
694 if (!params) return; 694 if (!params) return;
695 695
696 if (params->getPlayGain() != gain) { 696 if (params->getPlayGain() != gain) {
697 PlayParameterRepository::EditCommand *command = 697 PlayParameterRepository::EditCommand *command =
698 new PlayParameterRepository::EditCommand(params); 698 new PlayParameterRepository::EditCommand(params);
706 void 706 void
707 PropertyBox::playPanControlChanged(float pan) 707 PropertyBox::playPanControlChanged(float pan)
708 { 708 {
709 QObject *obj = sender(); 709 QObject *obj = sender();
710 710
711 PlayParameters *params = m_container->getPlayParameters(); 711 auto params = m_container->getPlayParameters();
712 if (!params) return; 712 if (!params) return;
713 713
714 if (params->getPlayPan() != pan) { 714 if (params->getPlayPan() != pan) {
715 PlayParameterRepository::EditCommand *command = 715 PlayParameterRepository::EditCommand *command =
716 new PlayParameterRepository::EditCommand(params); 716 new PlayParameterRepository::EditCommand(params);
722 } 722 }
723 723
724 void 724 void
725 PropertyBox::editPlayParameters() 725 PropertyBox::editPlayParameters()
726 { 726 {
727 PlayParameters *params = m_container->getPlayParameters(); 727 auto params = m_container->getPlayParameters();
728 if (!params) return; 728 if (!params) return;
729 729
730 QString clip = params->getPlayClipId(); 730 QString clip = params->getPlayClipId();
731 731
732 PlayParameterRepository::EditCommand *command = 732 PlayParameterRepository::EditCommand *command =
772 } 772 }
773 773
774 void 774 void
775 PropertyBox::playClipChanged(QString id) 775 PropertyBox::playClipChanged(QString id)
776 { 776 {
777 PlayParameters *params = m_container->getPlayParameters(); 777 auto params = m_container->getPlayParameters();
778 if (!params) return; 778 if (!params) return;
779 779
780 params->setPlayClipId(id); 780 params->setPlayClipId(id);
781 } 781 }
782 782
821 mainText = tr("Adjust playback level and pan of %1").arg(cname); 821 mainText = tr("Adjust playback level and pan of %1").arg(cname);
822 editText = tr("click then drag to adjust, ctrl+click to reset"); 822 editText = tr("click then drag to adjust, ctrl+click to reset");
823 823
824 } else if (wname == "playParamButton") { 824 } else if (wname == "playParamButton") {
825 825
826 PlayParameters *params = m_container->getPlayParameters(); 826 auto params = m_container->getPlayParameters();
827 if (params) { 827 if (params) {
828 help = tr("Change sound used for playback (currently \"%1\")") 828 help = tr("Change sound used for playback (currently \"%1\")")
829 .arg(params->getPlayClipId()); 829 .arg(params->getPlayClipId());
830 } 830 }
831 831