[AudioSystem] Allow audio engines to provide widgets for modifying connection properties. (#6303)
Signed-off-by: Maxim Ivanov <imginimg@gmail.com>
This commit is contained in:
@@ -37,6 +37,7 @@ namespace AudioControls
|
||||
m_connectionList->installEventFilter(this);
|
||||
|
||||
connect(m_connectionList, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(ShowConnectionContextMenu(const QPoint&)));
|
||||
connect(m_connectionList, SIGNAL(itemSelectionChanged()), this, SLOT(SelectedConnectionChanged()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
@@ -100,6 +101,57 @@ namespace AudioControls
|
||||
contextMenu.exec(m_connectionList->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
void QConnectionsWidget::SelectedConnectionChanged()
|
||||
{
|
||||
TConnectionPtr connection;
|
||||
EACEControlType controlType = AudioControls::eACET_NUM_TYPES;
|
||||
if (m_control)
|
||||
{
|
||||
QList<QListWidgetItem*> selected = m_connectionList->selectedItems();
|
||||
if (selected.length() == 1)
|
||||
{
|
||||
QListWidgetItem* currentItem = selected[0];
|
||||
if (currentItem)
|
||||
{
|
||||
const CID externalId = currentItem->data(eMDR_ID).toInt();
|
||||
connection = m_control->GetConnection(externalId);
|
||||
controlType = m_control->GetType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_connectionPropertiesWidget)
|
||||
{
|
||||
delete m_connectionPropertiesWidget;
|
||||
m_connectionPropertiesWidget = nullptr;
|
||||
}
|
||||
|
||||
if (connection && connection->HasProperties())
|
||||
{
|
||||
if (IAudioSystemEditor* audioSystemImpl = CAudioControlsEditorPlugin::GetAudioSystemEditorImpl())
|
||||
{
|
||||
m_connectionPropertiesWidget = audioSystemImpl->CreateConnectionPropertiesWidget(connection, controlType);
|
||||
if (m_connectionPropertiesWidget)
|
||||
{
|
||||
m_connectionPropertiesWidget->setParent(m_connectionPropertiesFrame);
|
||||
m_connectionPropertiesLayout->addWidget(m_connectionPropertiesWidget);
|
||||
|
||||
bool widgetHasChangedSignal = m_connectionPropertiesWidget->metaObject()->indexOfSignal("PropertiesChanged()") != -1;
|
||||
AZ_Error(
|
||||
"Audio", widgetHasChangedSignal,
|
||||
"The widget created by IAudioSystemEditor::CreateConnectionPropertiesWidget() must have a \"PropertiesChanged()\" "
|
||||
"signal.");
|
||||
|
||||
if (widgetHasChangedSignal)
|
||||
{
|
||||
connect(m_connectionPropertiesWidget, SIGNAL(PropertiesChanged()), this, SLOT(CurrentConnectionModified()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
void QConnectionsWidget::MakeConnectionTo(IAudioSystemControl* middlewareControl)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user