[AudioSystem] ACE: Added "File -> Refresh Audio System" action (same as "Game -> Refresh Audio") with "Ctrl-Shift-R" shortcut.

Signed-off-by: Maxim Ivanov <imginimg@gmail.com>
This commit is contained in:
Maxim Ivanov
2021-12-17 15:42:05 +03:00
parent 1be475c81a
commit d9e1e59af7
3 changed files with 41 additions and 9 deletions
@@ -143,6 +143,7 @@
</property>
<addaction name="actionSaveAll"/>
<addaction name="actionReload"/>
<addaction name="actionRefreshAudioSystem"/>
</widget>
<addaction name="menuFile"/>
</widget>
@@ -170,6 +171,14 @@
<string>Ctrl+R</string>
</property>
</action>
<action name="actionRefreshAudioSystem">
<property name="text">
<string>Refresh Audio System</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+R</string>
</property>
</action>
</widget>
<resources>
<include location="AudioControlsEditorUI.qrc"/>
@@ -207,6 +216,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>actionRefreshAudioSystem</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>RefreshAudioSystem()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>485</x>
<y>336</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<signal>CurrentControlNameChanged(QString)</signal>
@@ -198,6 +198,20 @@ namespace AudioControls
}
}
//-------------------------------------------------------------------------------------------//
void CAudioControlsEditorWindow::RefreshAudioSystem()
{
QString sLevelName = GetIEditor()->GetLevelName();
if (QString::compare(sLevelName, "Untitled", Qt::CaseInsensitive) == 0)
{
// Rather pass empty QString to indicate that no level is loaded!
sLevelName = QString();
}
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::RefreshAudioSystem, sLevelName.toUtf8().data());
}
//-------------------------------------------------------------------------------------------//
void CAudioControlsEditorWindow::Save()
{
@@ -215,15 +229,7 @@ namespace AudioControls
messageBox.setWindowTitle("Audio Controls Editor");
if (messageBox.exec() == QMessageBox::Yes)
{
QString sLevelName = GetIEditor()->GetLevelName();
if (QString::compare(sLevelName, "Untitled", Qt::CaseInsensitive) == 0)
{
// Rather pass empty QString to indicate that no level is loaded!
sLevelName = QString();
}
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::RefreshAudioSystem, sLevelName.toUtf8().data());
RefreshAudioSystem();
}
}
m_pATLModel->ClearDirtyFlags();
@@ -61,6 +61,7 @@ namespace AudioControls
void UpdateInspector();
void FilterControlType(EACEControlType type, bool bShow);
void Update();
void RefreshAudioSystem();
protected:
void closeEvent(QCloseEvent* pEvent) override;