GemRepoInspector.h 2.2 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 <GemRepo/GemRepoModel.h>
  11. #include <LinkWidget.h>
  12. #include <GemsSubWidget.h>
  13. #include <QItemSelection>
  14. #include <QScrollArea>
  15. #include <QSpacerItem>
  16. #include <QWidget>
  17. #include <QPersistentModelIndex>
  18. #endif
  19. QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
  20. QT_FORWARD_DECLARE_CLASS(QLabel)
  21. QT_FORWARD_DECLARE_CLASS(QPushButton)
  22. QT_FORWARD_DECLARE_CLASS(QItemSelectionModel)
  23. namespace AzQtComponents
  24. {
  25. class ElidingLabel;
  26. }
  27. namespace O3DE::ProjectManager
  28. {
  29. class GemRepoInspector : public QScrollArea
  30. {
  31. Q_OBJECT
  32. public:
  33. explicit GemRepoInspector(GemRepoModel* model, QItemSelectionModel* selectionModel, QWidget* parent = nullptr);
  34. ~GemRepoInspector() = default;
  35. void Update(const QModelIndex& modelIndex);
  36. signals:
  37. void RemoveRepo(const QModelIndex& modelIndex);
  38. void ShowToastNotification(const QString& notification);
  39. private slots:
  40. void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
  41. void OnCopyDownloadLinkClicked();
  42. private:
  43. void InitMainWidget();
  44. GemRepoModel* m_model = nullptr;
  45. QItemSelectionModel* m_selectionModel = nullptr;
  46. QWidget* m_mainWidget = nullptr;
  47. QVBoxLayout* m_mainLayout = nullptr;
  48. // General info section
  49. AzQtComponents::ElidingLabel* m_nameLabel = nullptr;
  50. LinkLabel* m_repoLinkLabel = nullptr;
  51. LinkLabel* m_copyDownloadLinkLabel = nullptr;
  52. QLabel* m_summaryLabel = nullptr;
  53. // Additional information
  54. QLabel* m_addInfoTitleLabel = nullptr;
  55. QLabel* m_addInfoTextLabel = nullptr;
  56. QSpacerItem* m_addInfoSpacer = nullptr;
  57. // Buttons
  58. QPushButton* m_removeRepoButton = nullptr;
  59. // Included objects
  60. GemsSubWidget* m_includedGems = nullptr;
  61. GemsSubWidget* m_includedProjects = nullptr;
  62. GemsSubWidget* m_includedTemplates = nullptr;
  63. QModelIndex m_curModelIndex;
  64. };
  65. } // namespace O3DE::ProjectManager