Apply reviewer suggestions

Signed-off-by: Nemerle <nemerle5+git@gmail.com>
This commit is contained in:
Nemerle
2021-12-17 16:02:33 +01:00
449 changed files with 11205 additions and 5685 deletions
@@ -16,6 +16,8 @@
#include <ACETypes.h>
class QWidget;
namespace AudioControls
{
class IAudioSystemEditor;
@@ -150,6 +152,12 @@ namespace AudioControls
//! Informs the plugin that the ACE has saved the data in case it needs to do any clean up.
virtual void DataSaved() = 0;
//! Creates a widget for modifying connection properties.
//! The widget must have a "PropertiesChanged()" signal.
//! The widget ownership transferred to the caller.
virtual QWidget* CreateConnectionPropertiesWidget([[maybe_unused]] const TConnectionPtr connection,
[[maybe_unused]] EACEControlType atlControlType) { return nullptr; }
};
} // namespace AudioControls
@@ -154,6 +154,9 @@
<property name="text">
<string>Save All</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="actionReload">
<property name="icon">
@@ -121,27 +121,6 @@ namespace AudioControls
}
}
//-------------------------------------------------------------------------------------------//
void CAudioControlsEditorWindow::keyPressEvent(QKeyEvent* pEvent)
{
if (pEvent->key() == Qt::Key_S && pEvent->modifiers() == Qt::ControlModifier)
{
Save();
}
else if (pEvent->key() == Qt::Key_Z && (pEvent->modifiers() & Qt::ControlModifier))
{
if (pEvent->modifiers() & Qt::ShiftModifier)
{
GetIEditor()->Redo();
}
else
{
GetIEditor()->Undo();
}
}
QMainWindow::keyPressEvent(pEvent);
}
//-------------------------------------------------------------------------------------------//
void CAudioControlsEditorWindow::closeEvent(QCloseEvent* pEvent)
{
@@ -63,7 +63,6 @@ namespace AudioControls
void Update();
protected:
void keyPressEvent(QKeyEvent* pEvent) override;
void closeEvent(QCloseEvent* pEvent) override;
private:
@@ -16,18 +16,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>450</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>450</height>
</size>
</property>
<property name="windowTitle">
<string>Inspector Panel</string>
</property>
@@ -104,7 +92,7 @@
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="m_connectionPropertiesLayout">
<property name="spacing">
<number>0</number>
</property>
@@ -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)
{
@@ -40,6 +40,7 @@ namespace AudioControls
void ShowConnectionContextMenu(const QPoint& pos);
void CurrentConnectionModified();
void RemoveSelectedConnection();
void SelectedConnectionChanged();
private:
bool eventFilter(QObject* object, QEvent* event) override;
@@ -50,6 +51,8 @@ namespace AudioControls
CATLControl* m_control;
QColor m_notFoundColor;
QColor m_localizedColor;
QWidget* m_connectionPropertiesWidget = nullptr;
};
} // namespace AudioControls
@@ -298,10 +298,7 @@ namespace Audio
{
}
CATLAudioFileEntry::~CATLAudioFileEntry()
{
}
CATLAudioFileEntry::~CATLAudioFileEntry() = default;
#endif // !AUDIO_RELEASE
} // namespace Audio