ToolsConfigPage.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. #ifndef CRYINCLUDE_EDITOR_TOOLSCONFIGPAGE_H
  9. #define CRYINCLUDE_EDITOR_TOOLSCONFIGPAGE_H
  10. #pragma once
  11. #if !defined(Q_MOC_RUN)
  12. #include <QDialog>
  13. #include <QStringListModel>
  14. #endif
  15. namespace Ui
  16. {
  17. class IconListDialog;
  18. class ToolsConfigPage;
  19. }
  20. class CommandModel;
  21. class MacroModel;
  22. class QStringListModel;
  23. class CIconListDialog
  24. : public QDialog
  25. {
  26. Q_OBJECT
  27. public:
  28. CIconListDialog(QWidget* pParent = nullptr);
  29. bool GetSelectedIconPath(QString& path) const;
  30. protected:
  31. void OnInitDialog();
  32. private:
  33. QScopedPointer<Ui::IconListDialog> m_ui;
  34. };
  35. class ToolsConfigDialog
  36. : public QDialog
  37. {
  38. Q_OBJECT
  39. public:
  40. ToolsConfigDialog(QWidget* parent = nullptr);
  41. private:
  42. void reject() override;
  43. void closeEvent(QCloseEvent* ev) override;
  44. };
  45. /** Tools configuration property page.
  46. */
  47. class CToolsConfigPage
  48. : public QWidget
  49. {
  50. Q_OBJECT
  51. public:
  52. CToolsConfigPage(QWidget* parent = nullptr);
  53. virtual ~CToolsConfigPage();
  54. virtual void OnOK();
  55. virtual void OnCancel();
  56. protected:
  57. virtual void OnInitDialog();
  58. void OnSelchangeMacroList();
  59. void OnSelchangeCommandList();
  60. void OnAssignCommand();
  61. void OnSelectMacroIcon();
  62. void OnClearMacroIcon();
  63. void OnConsoleCmd();
  64. void OnScriptCmd();
  65. void OnNewMacroItem();
  66. void OnNewCommandItem();
  67. void OnMoveMacroItemUp();
  68. void OnMoveMacroItemDown();
  69. void OnMoveCommandItemUp();
  70. void OnMoveCommandItemDown();
  71. void OnDeleteMacroItem();
  72. void OnDeleteCommandItem();
  73. //////////////////////////////////////////////////////////////////////////
  74. // Vars.
  75. //////////////////////////////////////////////////////////////////////////
  76. int m_consoleOrScript; // 0 -> console commands, 1 -> script commands
  77. void FillConsoleCmds();
  78. void FillScriptCmds();
  79. private:
  80. MacroModel* m_macroModel;
  81. CommandModel* m_commandModel;
  82. QStringListModel* m_completionModel;
  83. QScopedPointer<Ui::ToolsConfigPage> m_ui;
  84. };
  85. #endif // CRYINCLUDE_EDITOR_TOOLSCONFIGPAGE_H