src/MessageLog.h

changeset 647
b87941923eb4
parent 642
751a8df42842
child 650
db7146a87ae4
--- a/src/MessageLog.h	Wed Mar 05 17:12:22 2014 +0200
+++ b/src/MessageLog.h	Wed Mar 05 17:29:27 2014 +0200
@@ -25,27 +25,38 @@
 class GLRenderer;
 class QTimer;
 
-/* The message manager is an object which keeps track of messages that appear
- * on the renderer's screen. Each line is contained in a separate object which
- * contains the text, expiry time and alpha. The message manager is doubly
- * linked to its corresponding renderer.
- *
- * Message manager calls its tick() function regularly to update the messages,
- * where each line's expiry is checked for. Lines begin to fade out when nearing
- * their expiry. If the message manager's lines change, the renderer undergoes
- * repainting.
- */
+//!
+//! @brief Manages the list of messages at the top-left of the renderer.
+//!
+//! The message manager is an object which keeps track of messages that appear
+//! on the renderer's screen. Each line is contained in a separate object which
+//! contains the text, expiry time and alpha. The message manager is doubly
+//! linked to its corresponding renderer.
+//!
+//! Message manager calls its @c tick() function regularly to update the messages,
+//! where each line's expiry is checked for. Lines begin to fade out when nearing
+//! their expiry. If the message manager's lines change, the renderer undergoes
+//! repainting.
+//!
 class MessageManager : public QObject
 {
 	Q_OBJECT
 	PROPERTY (public, GLRenderer*, renderer, setRenderer, STOCK_WRITE)
 
 	public:
-		// Single line of the message log.
+		//! @class MessageManager::Line
+		//! A single line of the message log.
 		class Line
 		{
 			public:
+				//! Constructs a line with the given @c text
 				Line (QString text);
+
+				//! Check this line's expiry and update alpha accordingly.
+				//! @c changed is updated to whether the line has somehow
+				//! changed since the last update.
+				//! @returns true if the line is to still stick around, false
+				//! @returns if it expired.
 				bool update (bool& changed);
 
 				QString text;
@@ -53,14 +64,21 @@
 				QDateTime expiry;
 		};
 
-		explicit MessageManager (QObject* parent = 0);
+		//! Constructs the message manager.
+		explicit MessageManager (QObject* parent = null);
+
+		//! Adds a line with the given @c text to the message manager.
 		void addLine (QString line);
+
+		//! @returns all active lines in the message manager.
 		const QList<Line>& getLines() const;
 
 	private:
-		QList<Line> m_lines;
-		QTimer* m_ticker;
+		QList<Line>	m_lines;
+		QTimer*		m_ticker;
 
 	private slots:
+		//! Ticks the manager. This is called by the timer to update
+		//! the messages.
 		void tick();
 };

mercurial