From df18e53ab4c988887f8b591a99c9a8e8fa75d38b Mon Sep 17 00:00:00 2001 From: Dayo Lawal Date: Mon, 21 Jun 2021 10:48:51 -0500 Subject: [PATCH] WriteStartupLog() not implemented Signed-off-by: Dayo Lawal --- .../Application/AzQtApplication.cpp | 3 +- .../Application/AzQtTraceLogger.cpp | 51 ++++++++++++++++--- .../Application/AzQtTraceLogger.h | 25 +++------ .../AzQtComponents/azqtcomponents_files.cmake | 2 + .../Code/Source/MaterialEditorApplication.cpp | 7 +-- .../Code/Source/MaterialEditorApplication.h | 2 + 6 files changed, 59 insertions(+), 31 deletions(-) diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtApplication.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtApplication.cpp index 0102bb62d1..b8bfc7a5d5 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtApplication.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtApplication.cpp @@ -33,8 +33,7 @@ namespace AzQtComponents AzQtComponents::PrepareQtPaths(); QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); - - + } void AzQtApplication::setDpiScaling() diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtTraceLogger.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtTraceLogger.cpp index da6254f018..3883669e6e 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtTraceLogger.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtTraceLogger.cpp @@ -12,22 +12,58 @@ #include -#include #include +#include +#include + namespace AzQtComponents { - AzQtTraceLogger::AzQtTraceLogger() + class AzQtTraceLogger::Impl : public AZ::Debug::TraceMessageBus::Handler + { + public: + void WriteStartupLog(char name[]); + + Impl() + { + AZ::Debug::TraceMessageBus::Handler::BusConnect(); + } + ~Impl() + { + AZ::Debug::TraceMessageBus::Handler::BusDisconnect(); + } + + protected: + ////////////////////////////////////////////////////////////////////////// + // AZ::Debug::TraceMessageBus::Handler overrides... + bool OnOutput(const char* window, const char* message) override; + ////////////////////////////////////////////////////////////////////////// + + struct LogMessage + { + public: + AZStd::string window; + AZStd::string message; + }; + AZStd::vector m_startupLogSink; + AZStd::unique_ptr m_logFile; + }; + + AzQtTraceLogger::AzQtTraceLogger() + : m_impl(new Impl) { - AZ::Debug::TraceMessageBus::Handler::BusConnect(); } AzQtTraceLogger::~AzQtTraceLogger() { - AZ::Debug::TraceMessageBus::Handler::BusDisconnect(); } - - bool AzQtTraceLogger::OnOutput(const char* window, const char* message) + + void AzQtTraceLogger::WriteStartupLog(char name[]) + { + m_impl->WriteStartupLog(name); + } + + bool AzQtTraceLogger::Impl::OnOutput(const char* window, const char* message) { if (m_logFile) { @@ -40,7 +76,7 @@ namespace AzQtComponents return false; } - void AzQtTraceLogger::WriteStartupLog(char name[]) + void AzQtTraceLogger::Impl::WriteStartupLog(char name[]) { using namespace AzFramework; @@ -76,4 +112,3 @@ namespace AzQtComponents } } } // namespace AzQtComponents - diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtTraceLogger.h b/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtTraceLogger.h index 29dfd6b32a..2207cfce4f 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtTraceLogger.h +++ b/Code/Framework/AzQtComponents/AzQtComponents/Application/AzQtTraceLogger.h @@ -12,33 +12,22 @@ #pragma once -#include #include +#include namespace AzQtComponents { - class AzQtTraceLogger : private AZ::Debug::TraceMessageBus::Handler + class AZ_QT_COMPONENTS_API AzQtTraceLogger { public: AzQtTraceLogger(); ~AzQtTraceLogger(); - void WriteStartupLog(char name[]); protected: - ////////////////////////////////////////////////////////////////////////// - // AZ::Debug::TraceMessageBus::Handler overrides... - bool OnOutput(const char* window, const char* message) override; - ////////////////////////////////////////////////////////////////////////// - - struct LogMessage - { - public: - AZStd::string window; - AZStd::string message; - }; - AZStd::vector m_startupLogSink; - AZStd::unique_ptr m_logFile; + class Impl; + AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING + AZStd::unique_ptr m_impl; + AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING }; -} - +} // namespace AzQtComponents diff --git a/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake b/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake index bcfbb84778..c9a025d472 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake +++ b/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake @@ -9,6 +9,8 @@ set(FILES AzQtComponentsAPI.h Application/AzQtApplication.cpp Application/AzQtApplication.h + Application/AzQtTraceLogger.cpp + Application/AzQtTraceLogger.h Buses/DragAndDrop.h Buses/ShortcutDispatch.h DragAndDrop/MainWindowDragAndDrop.h diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp index 2cc2bb852e..e20274da81 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.cpp @@ -352,7 +352,7 @@ namespace MaterialEditor ExitMainLoop(); } } - + ///* void MaterialEditorApplication::WriteStartupLog() { using namespace AzFramework; @@ -388,7 +388,7 @@ namespace MaterialEditor m_logFile->FlushLog(); } } - + //*/ void MaterialEditorApplication::LoadSettings() { AZ::SerializeContext* context = nullptr; @@ -476,7 +476,8 @@ namespace MaterialEditor return; } - m_traceLogger->WriteStartupLog("MaterialEditor.log"); + //m_traceLogger->WriteStartupLog("MaterialEditor.log"); + WriteStartupLog(); if (!LaunchDiscoveryService()) { diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.h b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.h index f5431ddd96..5d689a67ec 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.h +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/MaterialEditorApplication.h @@ -22,6 +22,8 @@ #include #include +#include + #include namespace MaterialEditor