UI: Show popup menu w/ vol. control config button

Use the config button on volume controls to allow the ability for
filters/properties to be accessed via the mixer.  Particularly useful
for the purpose of accessing filters/properties of global audio outputs
that are added via audio settings.
master
jp9000 2015-06-20 18:57:06 -07:00
parent 3c93345179
commit 97ead131c1
2 changed files with 51 additions and 1 deletions

View File

@ -1245,9 +1245,55 @@ void OBSBasic::MoveSceneItem(OBSSceneItem item, obs_order_movement movement)
ui->sources->setCurrentRow(curRow);
}
void OBSBasic::GetAudioSourceFilters()
{
QAction *action = reinterpret_cast<QAction*>(sender());
VolControl *vol = action->property("volControl").value<VolControl*>();
obs_source_t *source = vol->GetSource();
CreateFiltersWindow(source);
}
void OBSBasic::GetAudioSourceProperties()
{
QAction *action = reinterpret_cast<QAction*>(sender());
VolControl *vol = action->property("volControl").value<VolControl*>();
obs_source_t *source = vol->GetSource();
CreatePropertiesWindow(source);
}
void OBSBasic::VolControlContextMenu()
{
VolControl *vol = reinterpret_cast<VolControl*>(sender());
QAction filtersAction(QTStr("Filters"), this);
QAction propertiesAction(QTStr("Properties"), this);
connect(&filtersAction, &QAction::triggered,
this, &OBSBasic::GetAudioSourceFilters,
Qt::DirectConnection);
connect(&propertiesAction, &QAction::triggered,
this, &OBSBasic::GetAudioSourceProperties,
Qt::DirectConnection);
filtersAction.setProperty("volControl",
QVariant::fromValue<VolControl*>(vol));
propertiesAction.setProperty("volControl",
QVariant::fromValue<VolControl*>(vol));
QMenu popup(this);
popup.addAction(&filtersAction);
popup.addAction(&propertiesAction);
popup.exec(QCursor::pos());
}
void OBSBasic::ActivateAudioSource(OBSSource source)
{
VolControl *vol = new VolControl(source);
VolControl *vol = new VolControl(source, true);
connect(vol, &VolControl::ConfigClicked,
this, &OBSBasic::VolControlContextMenu);
volumes.push_back(vol);
ui->volumeWidgets->layout()->addWidget(vol);

View File

@ -156,6 +156,10 @@ private:
void Nudge(int dist, MoveDir dir);
void OpenProjector(obs_source_t *source, int monitor);
void GetAudioSourceFilters();
void GetAudioSourceProperties();
void VolControlContextMenu();
obs_hotkey_pair_id streamingHotkeys, recordingHotkeys;
public slots: