src/gui.cpp

changeset 322
5e701c3c3d8e
parent 321
48e429bfd58c
child 324
31c6e53e1e4e
--- a/src/gui.cpp	Wed Jul 03 00:43:27 2013 +0300
+++ b/src/gui.cpp	Thu Jul 04 03:05:39 2013 +0300
@@ -45,6 +45,7 @@
 #include "history.h"
 #include "widgets.h"
 #include "addObjectDialog.h"
+#include "msglog.h"
 #include "config.h"
 
 actionmeta g_actionMeta[MAX_ACTIONS];
@@ -79,6 +80,10 @@
 	connect (m_objList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selectionChanged ()));
 	connect (m_objList, SIGNAL (itemDoubleClicked (QListWidgetItem*)), this, SLOT (slot_editObject (QListWidgetItem*)));
 	
+	m_msglog = new MessageManager;
+	m_msglog->setRenderer( R() );
+	m_renderer->setMessageLog( m_msglog );
+	
 	m_splitter = new QSplitter;
 	m_splitter->addWidget (m_renderer);
 	m_splitter->addWidget (m_objList);
@@ -562,7 +567,7 @@
 	}
 	
 	if (!meta) {
-		logf (LOG_Warning, "unknown signal sender %p!\n", qAct);
+		log ("Warning: unknown signal sender %p!\n", qAct);
 		return;
 	}
 	
@@ -1043,6 +1048,8 @@
 		
 		if( f == g_curfile )
 			g_win->updateTitle ();
+		
+		log( "Saved to %1.", path );
 	}
 	else
 	{
@@ -1066,6 +1073,11 @@
 	}
 }
 
+void ForgeWindow::addMessage( str msg )
+{
+	m_msglog->addLine( msg );
+}
+
 // ============================================================================
 void ObjectList::contextMenuEvent (QContextMenuEvent* ev) {
 	g_win->spawnContextMenu (ev->globalPos ());
@@ -1095,19 +1107,6 @@
 }
 
 // =============================================================================
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-// =============================================================================
-// Print to message log
-// TODO: I don't think that the message log being a widget in the window
-// is a very good idea... maybe this should log into the renderer? Or into
-// another dialog that can be popped up?
-void ForgeWindow::logVA (LogType type, const char* fmtstr, va_list va) {
-	(void) type;
-	(void) fmtstr;
-	(void) va;
-}
-
-// =============================================================================
 QAction* findAction (str name) {
 	for (actionmeta& meta : g_actionMeta) {
 		if (meta.qAct == null)

mercurial