Port to support QT 5.0

Rewrite and fix the TCP server class