ProjectButtonWidget.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. * its licensors.
  4. *
  5. * For complete copyright and license terms please see the LICENSE at the root of this
  6. * distribution (the "License"). All use of this software is governed by the License,
  7. * or, if provided, by the license below or the license accompanying this file. Do not
  8. * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. *
  11. */
  12. #pragma once
  13. #if !defined(Q_MOC_RUN)
  14. #include <ProjectInfo.h>
  15. #include <QLabel>
  16. #endif
  17. QT_FORWARD_DECLARE_CLASS(QPixmap)
  18. QT_FORWARD_DECLARE_CLASS(QPushButton)
  19. QT_FORWARD_DECLARE_CLASS(QAction)
  20. QT_FORWARD_DECLARE_CLASS(QProgressBar)
  21. namespace O3DE::ProjectManager
  22. {
  23. class LabelButton
  24. : public QLabel
  25. {
  26. Q_OBJECT // AUTOMOC
  27. public:
  28. explicit LabelButton(QWidget* parent = nullptr);
  29. ~LabelButton() = default;
  30. void SetEnabled(bool enabled);
  31. void SetOverlayText(const QString& text);
  32. QLabel* GetOverlayLabel();
  33. QProgressBar* GetProgressBar();
  34. QPushButton* GetBuildButton();
  35. signals:
  36. void triggered();
  37. public slots:
  38. void mousePressEvent(QMouseEvent* event) override;
  39. private:
  40. QLabel* m_overlayLabel;
  41. QProgressBar* m_progressBar;
  42. QPushButton* m_buildButton;
  43. bool m_enabled = true;
  44. };
  45. class ProjectButton
  46. : public QFrame
  47. {
  48. Q_OBJECT // AUTOMOC
  49. public:
  50. explicit ProjectButton(const ProjectInfo& m_projectInfo, QWidget* parent = nullptr, bool processing = false);
  51. ~ProjectButton() = default;
  52. void SetLaunchButtonEnabled(bool enabled);
  53. void ShowBuildButton(bool show);
  54. void SetButtonOverlayText(const QString& text);
  55. void SetProgressBarValue(int progress);
  56. signals:
  57. void OpenProject(const QString& projectName);
  58. void EditProject(const QString& projectName);
  59. void CopyProject(const QString& projectName);
  60. void RemoveProject(const QString& projectName);
  61. void DeleteProject(const QString& projectName);
  62. void BuildProject(const ProjectInfo& projectInfo);
  63. private:
  64. void BaseSetup();
  65. void ProcessingSetup();
  66. void ReadySetup();
  67. ProjectInfo m_projectInfo;
  68. LabelButton* m_projectImageLabel;
  69. QFrame* m_projectFooter;
  70. };
  71. } // namespace O3DE::ProjectManager