]> git.cworth.org Git - vogl/commitdiff
UI: Update vogleditor_output so that it can be used from other files without having...
authorPeterLValve <peterl@valvesoftware.com>
Wed, 26 Mar 2014 23:22:42 +0000 (16:22 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 1 Apr 2014 19:37:33 +0000 (12:37 -0700)
* 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
src/vogleditor/vogleditor_output.h

index c96a06dc8420cab88ca414f3518409863d5b35f0..0c08f18f8864934daa1f7345719f98f4999e0f33 100644 (file)
@@ -1,6 +1,8 @@
 #include "vogleditor_output.h"
 #include <QTextEdit>
 
+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);
     }
 }
index bbeec1c5425b7be8163ca0fcf5cb50caf2a9a5e7..e3c13e077db9195b4f85e9e54b68289a5a3aae03 100644 (file)
@@ -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); }