ScreenWidget.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 <ScreenDefs.h>
  11. #include <ProjectInfo.h>
  12. #include <ScreensCtrl.h>
  13. #include <QWidget>
  14. #include <QStyleOption>
  15. #include <QPainter>
  16. #endif
  17. namespace O3DE::ProjectManager
  18. {
  19. class ScreenWidget
  20. : public QFrame
  21. {
  22. Q_OBJECT
  23. public:
  24. explicit ScreenWidget(QWidget* parent = nullptr)
  25. : QFrame(parent)
  26. {
  27. }
  28. ~ScreenWidget() = default;
  29. virtual ProjectManagerScreen GetScreenEnum()
  30. {
  31. return ProjectManagerScreen::Empty;
  32. }
  33. virtual bool IsReadyForNextScreen()
  34. {
  35. return true;
  36. }
  37. virtual bool IsTab()
  38. {
  39. return false;
  40. }
  41. virtual QString GetTabText()
  42. {
  43. return tr("Missing");
  44. }
  45. virtual bool ContainsScreen(ProjectManagerScreen screen)
  46. {
  47. return GetScreenEnum() == screen;
  48. }
  49. virtual void GoToScreen([[maybe_unused]] ProjectManagerScreen screen)
  50. {
  51. }
  52. virtual void Init()
  53. {
  54. }
  55. ScreensCtrl* GetScreensCtrl(QObject* widget)
  56. {
  57. if (!widget)
  58. {
  59. return nullptr;
  60. }
  61. ScreensCtrl* screensCtrl = qobject_cast<ScreensCtrl*> (widget);
  62. return screensCtrl ? screensCtrl : GetScreensCtrl(widget->parent());
  63. }
  64. //! Returns true if this screen is the current screen
  65. virtual bool IsCurrentScreen()
  66. {
  67. ScreensCtrl* screensCtrl = GetScreensCtrl(this);
  68. return screensCtrl ? screensCtrl->GetCurrentScreen() == this : false;
  69. }
  70. //! Notify this screen it is the current screen
  71. virtual void NotifyCurrentScreen()
  72. {
  73. }
  74. signals:
  75. void ChangeScreenRequest(ProjectManagerScreen screen);
  76. void GoToPreviousScreenRequest();
  77. void ResetScreenRequest(ProjectManagerScreen screen);
  78. void NotifyCurrentProject(const QString& projectPath);
  79. void NotifyBuildProject(const ProjectInfo& projectInfo);
  80. void NotifyProjectRemoved(const QString& projectPath);
  81. void NotifyRemoteContentRefreshed();
  82. };
  83. } // namespace O3DE::ProjectManager