wahjam/wahjam — pull request #44 by teamikl (2012-04-06 17:25:19+00:00)
Title: Chatoutput class

This patch implements #43
Summary of changes

* separate application specific code and component.
* use "tr" for translation messages
* separate add message slots for message types.
* reuse QTextCharFormat/QTextCursor as member.
* URL auto-link

----
## Implementation notes

### Why those methods are slot

as QTextEdit#append is public slot, and it is an easy way to be callable from qtscript.

### Why so many add messages slots

Currently, ChatOutput is missing save information that sender, what type of messages, ...
The view shows it with format but that will be lost when saved as plain text.
So it was the prepare step to make message handlers in future. (like model-view for message log)

### parse url for autolink

I tried to do that by QSyntaxHighlighter, but QTextCharFormat#setAnchor in syntax-highlighter did not work.
The highlight url was worked, but that did not be clickable.

----
## I did not do in this patch

notes for future todo.

* API design, not frozen yet. some of slots may possible to be private or inline.
* Scalability of message log data (no max-lines, or no limit of data size) when log become too much?
* Extendability of parser for auto-link. its ad-hoc parser, need to be another approach when extend it.