Instantiate the QmlChatView instead of the QGV-based ChatView
[quassel.git] / src / qtui / qtui.cpp
index f3bb9a6..99a6eae 100644 (file)
 #include "types.h"
 #include "util.h"
 
+#ifdef HAVE_QML
+#  include "qmlmessagemodel.h"
+#endif
+
 #ifdef Q_WS_X11
 #  include <QX11Info>
 #endif
@@ -62,6 +66,7 @@ QtUi::QtUi() : GraphicalUi() {
 
   connect(_mainWin, SIGNAL(connectToCore(const QVariantMap &)), this, SIGNAL(connectToCore(const QVariantMap &)));
   connect(_mainWin, SIGNAL(disconnectFromCore()), this, SIGNAL(disconnectFromCore()));
+  connect(Client::instance(), SIGNAL(bufferMarkedAsRead(BufferId)), SLOT(closeNotifications(BufferId)));
 }
 
 QtUi::~QtUi() {
@@ -80,7 +85,11 @@ void QtUi::init() {
 }
 
 MessageModel *QtUi::createMessageModel(QObject *parent) {
+#ifdef HAVE_QML
+  return new QmlMessageModel(parent);
+#else
   return new ChatLineModel(parent);
+#endif
 }
 
 AbstractMessageProcessor *QtUi::createMessageProcessor(QObject *parent) {
@@ -200,3 +209,9 @@ void QtUi::notificationActivated(uint notificationId) {
 
   activateMainWidget();
 }
+
+void QtUi::bufferMarkedAsRead(BufferId bufferId) {
+  if(bufferId.isValid()) {
+    closeNotifications(bufferId);
+  }
+}