From 104a3f22b9bfdd71fa1e3584c3d56b2987c00f1f Mon Sep 17 00:00:00 2001 From: PeterLValve Date: Wed, 26 Mar 2014 16:22:42 -0700 Subject: [PATCH] UI: Update vogleditor_output so that it can be used from other files without having to be initialized * The global object needed to be marked as extern and instantiated in the implemention file. * Also fixed up the formatting of errors and warnings --- src/vogleditor/vogleditor_output.cpp | 11 ++++++----- src/vogleditor/vogleditor_output.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/vogleditor/vogleditor_output.cpp b/src/vogleditor/vogleditor_output.cpp index c96a06d..0c08f18 100644 --- a/src/vogleditor/vogleditor_output.cpp +++ b/src/vogleditor/vogleditor_output.cpp @@ -1,6 +1,8 @@ #include "vogleditor_output.h" #include +vogleditor_output gs_OUTPUT; + vogleditor_output::vogleditor_output() { } @@ -21,17 +23,16 @@ void vogleditor_output::warning(const char* pWarning) { if (m_pTextEdit != NULL) { - m_pTextEdit->append("Warning: "); - m_pTextEdit->append(pWarning); + QString msg = QString("Warning: %1").arg(pWarning); + m_pTextEdit->append(msg); } } - void vogleditor_output::error(const char* pError) { if (m_pTextEdit != NULL) { - m_pTextEdit->append("ERROR: "); - m_pTextEdit->append(pError); + QString msg = QString("ERROR: %1").arg(pError); + m_pTextEdit->append(msg); } } diff --git a/src/vogleditor/vogleditor_output.h b/src/vogleditor/vogleditor_output.h index bbeec1c..e3c13e0 100644 --- a/src/vogleditor/vogleditor_output.h +++ b/src/vogleditor/vogleditor_output.h @@ -19,7 +19,7 @@ private: QTextEdit* m_pTextEdit; }; -static vogleditor_output gs_OUTPUT; +extern vogleditor_output gs_OUTPUT; static void vogleditor_output_init(QTextEdit* pTextEdit) { gs_OUTPUT.init(pTextEdit); } static void vogleditor_output_message(const char* pMessage) { gs_OUTPUT.message(pMessage); } -- 2.45.2