3
0

SceneSettingsCard.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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/Debug/TraceMessageBus.h>
  11. #include <AzCore/std/smart_ptr/shared_ptr.h>
  12. #include <AzCore/std/string/string.h>
  13. #include <AzToolsFramework/Debug/TraceContextMultiStackHandler.h>
  14. #include <AzQtComponents/Components/StyledDetailsTableModel.h>
  15. #include <AzQtComponents/Components/Widgets/Card.h>
  16. #include <AzQtComponents/Components/Widgets/CardHeader.h>
  17. #include <SceneAPI/SceneUI/SceneUIConfiguration.h>
  18. #include <QPair>
  19. #include <QString>
  20. #include <QVector>
  21. #endif
  22. class QSvgWidget;
  23. namespace AzQtComponents
  24. {
  25. class StyledDetailsTableView;
  26. class TableView;
  27. }
  28. namespace AZ
  29. {
  30. namespace SceneAPI
  31. {
  32. namespace SceneUI
  33. {
  34. class ProcessingHandler;
  35. }
  36. }
  37. }
  38. namespace AzToolsFramework
  39. {
  40. namespace Logging
  41. {
  42. class LogEntry;
  43. }
  44. }
  45. class QPushButton;
  46. class SceneSettingsCardHeader : public AzQtComponents::CardHeader
  47. {
  48. Q_OBJECT
  49. public:
  50. SceneSettingsCardHeader(QWidget* parent = nullptr);
  51. void SetCanClose(bool canClose);
  52. private:
  53. void triggerCloseButton();
  54. QPushButton* m_closeButton = nullptr;
  55. QSvgWidget* m_busySpinner = nullptr;
  56. friend class SceneSettingsCard;
  57. };
  58. AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
  59. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  60. class SCENE_UI_API SceneSettingsCard : public AzQtComponents::Card, public AZ::Debug::TraceMessageBus::Handler
  61. {
  62. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  63. AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
  64. Q_OBJECT
  65. public:
  66. enum class Layout
  67. {
  68. Loading,
  69. Resetting,
  70. Exporting
  71. };
  72. SceneSettingsCard(AZ::Uuid traceTag, QString fileTracked, Layout layout, QWidget* parent = nullptr);
  73. ~SceneSettingsCard();
  74. void SetAndStartProcessingHandler(const AZStd::shared_ptr<AZ::SceneAPI::SceneUI::ProcessingHandler>& handler);
  75. bool OnPrintf(const char* window, const char* message) override;
  76. bool OnError(const char* window, const char* message) override;
  77. bool OnWarning(const char* window, const char* message) override;
  78. bool OnAssert(const char* message) override;
  79. enum class State
  80. {
  81. Loading,
  82. Processing,
  83. Done,
  84. };
  85. void SetState(State newState);
  86. public Q_SLOTS:
  87. void AddLogEntry(const AzToolsFramework::Logging::LogEntry& logEntry);
  88. void OnSetStatusMessage(const AZStd::string& message);
  89. void OnProcessingComplete();
  90. signals:
  91. void ProcessingCompleted();
  92. private:
  93. enum class CompletionState
  94. {
  95. Success,
  96. Warning,
  97. Error,
  98. Failure
  99. };
  100. bool ShouldProcessMessage();
  101. void UpdateCompletionState(CompletionState newState);
  102. void CopyTraceContext(AzQtComponents::StyledDetailsTableModel::TableEntry& entry) const;
  103. QString GetTimeNowAsString();
  104. void ShowLogContextMenu(const QPoint& pos);
  105. void AddLogTableEntry(AzQtComponents::StyledDetailsTableModel::TableEntry& entry);
  106. AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
  107. QVector<QVector<QPair<QString, QString>>> m_additionalLogDetails;
  108. AzToolsFramework::Debug::TraceContextMultiStackHandler m_traceStackHandler;
  109. AZ::Uuid m_traceTag;
  110. AzQtComponents::StyledDetailsTableModel* m_reportModel = nullptr;
  111. AzQtComponents::TableView* m_reportView = nullptr;
  112. AZStd::shared_ptr<AZ::SceneAPI::SceneUI::ProcessingHandler> m_targetHandler;
  113. AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
  114. SceneSettingsCardHeader* m_settingsHeader = nullptr;
  115. CompletionState m_completionState = CompletionState::Success;
  116. State m_sceneCardState = State::Loading;
  117. QString m_fileTracked;
  118. int m_warningCount = 0;
  119. int m_errorCount = 0;
  120. };