ATLControlsResourceDialog.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. #pragma once
  9. #if !defined(Q_MOC_RUN)
  10. #include <AzCore/std/string/string_view.h>
  11. #include <ACETypes.h>
  12. #include <AudioControlFilters.h>
  13. #include <QTreeWidgetFilter.h>
  14. #include <QWidget>
  15. #include <QDialog>
  16. #include <QLineEdit>
  17. #endif
  18. class QAudioControlsTreeView;
  19. class QDialogButtonBox;
  20. class QAudioControlSortProxy;
  21. class QStandardItemModel;
  22. namespace AudioControls
  23. {
  24. class CATLControlsModel;
  25. class CATLControl;
  26. //-------------------------------------------------------------------------------------------//
  27. class ATLControlsDialog
  28. : public QDialog
  29. {
  30. Q_OBJECT
  31. public:
  32. ATLControlsDialog(QWidget* pParent, EACEControlType eType);
  33. ~ATLControlsDialog();
  34. private slots:
  35. void UpdateSelectedControl();
  36. void SetTextFilter(QString filter);
  37. void EnterPressed();
  38. void StopTrigger();
  39. public:
  40. void SetScope(const AZStd::string& sScope);
  41. const char* ChooseItem(const char* currentValue);
  42. QSize sizeHint() const override;
  43. void showEvent(QShowEvent* e) override;
  44. private:
  45. QModelIndex FindItem(const AZStd::string_view sControlName);
  46. void ApplyFilter();
  47. bool ApplyFilter(const QModelIndex parent);
  48. bool IsValid(const QModelIndex index);
  49. bool IsCriteriaMatch(const CATLControl* control) const;
  50. const CATLControl* GetControlFromModelIndex(const QModelIndex index) const;
  51. QString GetWindowTitle(EACEControlType type) const;
  52. // ------------------ QWidget ----------------------------
  53. bool eventFilter(QObject* pObject, QEvent* pEvent) override;
  54. // -------------------------------------------------------
  55. // Filtering
  56. QString m_sFilter;
  57. EACEControlType m_eType;
  58. AZStd::string m_sScope;
  59. AZStd::string m_sControlName;
  60. QAudioControlsTreeView* m_pControlTree;
  61. QDialogButtonBox* pDialogButtons;
  62. QLineEdit* m_TextFilterLineEdit;
  63. QStandardItemModel* m_pTreeModel;
  64. QAudioControlSortProxy* m_pProxyModel;
  65. CATLControlsModel* m_pATLModel;
  66. };
  67. } // namespace AudioControls