AudioSystemPanel.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AudioSystemPanel.h>
  9. #include <ATLControlsModel.h>
  10. #include <AudioControl.h>
  11. #include <AudioControlsEditorPlugin.h>
  12. #include <IAudioSystemEditor.h>
  13. #include <QAudioControlEditorIcons.h>
  14. #include <QWidgetAction>
  15. #include <QPushButton>
  16. #include <QPaintEvent>
  17. #include <QPainter>
  18. #include <QMessageBox>
  19. #include <QMimeData>
  20. namespace AudioControls
  21. {
  22. //-------------------------------------------------------------------------------------------//
  23. CAudioSystemPanel::CAudioSystemPanel()
  24. {
  25. setupUi(this);
  26. m_filter.SetTree(m_pControlList);
  27. m_filter.AddFilter(&m_nameFilter);
  28. m_filter.AddFilter(&m_typeFilter);
  29. m_filter.AddFilter(&m_hideConnectedFilter);
  30. connect(m_pExternalListFilter, SIGNAL(textChanged(QString)), this, SLOT(SetNameFilter(QString)));
  31. connect(m_pHideAssignedCheckbox, SIGNAL(clicked(bool)), this, SLOT(SetHideConnected(bool)));
  32. m_pControlList->setContextMenuPolicy(Qt::CustomContextMenu);
  33. m_pControlList->UpdateModel();
  34. }
  35. //-------------------------------------------------------------------------------------------//
  36. void CAudioSystemPanel::SetNameFilter(QString filter)
  37. {
  38. m_nameFilter.SetFilter(filter);
  39. m_filter.ApplyFilter();
  40. }
  41. //-------------------------------------------------------------------------------------------//
  42. void CAudioSystemPanel::SetHideConnected(bool bHide)
  43. {
  44. m_hideConnectedFilter.SetHideConnected(bHide);
  45. m_filter.ApplyFilter();
  46. }
  47. //-------------------------------------------------------------------------------------------//
  48. void CAudioSystemPanel::Reload()
  49. {
  50. m_pControlList->Refresh();
  51. m_filter.ApplyFilter();
  52. }
  53. //-------------------------------------------------------------------------------------------//
  54. void CAudioSystemPanel::SetAllowedControls(EACEControlType type, bool bAllowed)
  55. {
  56. const AudioControls::IAudioSystemEditor* pAudioSystemEditorImpl = CAudioControlsEditorPlugin::GetAudioSystemEditorImpl();
  57. if (pAudioSystemEditorImpl)
  58. {
  59. m_allowedATLTypes[type] = bAllowed;
  60. uint nMask = 0;
  61. for (int i = 0; i < AudioControls::EACEControlType::eACET_NUM_TYPES; ++i)
  62. {
  63. if (m_allowedATLTypes[i])
  64. {
  65. nMask |= pAudioSystemEditorImpl->GetCompatibleTypes((EACEControlType)i);
  66. }
  67. }
  68. m_typeFilter.SetAllowedControlsMask(nMask);
  69. m_filter.ApplyFilter();
  70. }
  71. }
  72. } // namespace AudioControls
  73. #include <Source/Editor/moc_AudioSystemPanel.cpp>