QTfrontend/ui/widget/chatwidget.cpp
changeset 6177 5eba8970e8ae
parent 6167 728cabee2c9f
child 6178 affa860f2983
--- a/QTfrontend/ui/widget/chatwidget.cpp	Sat Oct 22 01:00:21 2011 +0200
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Sat Oct 22 01:53:14 2011 +0200
@@ -140,7 +140,26 @@
     mainLayout.addWidget(chatEditLine, 2, 0);
 
     chatText = new QTextBrowser(this);
-    chatText->document()->setDefaultStyleSheet(STYLE);
+
+    // load external stylesheet if there is any
+    QFile * file =
+        new QFile(HWDataManager::instance().findFileForRead("css/chat.css"));
+
+    if (file->exists() && file->open(QIODevice::ReadOnly | QIODevice::Text))
+    {
+        QString style = "";
+        QTextStream in(file);
+        while (!in.atEnd())
+        {
+            QString line = in.readLine();
+            if(!line.isEmpty())
+                style.append(line);
+        }
+        chatText->document()->setDefaultStyleSheet(style);
+    }
+    else
+        chatText->document()->setDefaultStyleSheet(STYLE);
+
     chatText->setMinimumHeight(20);
     chatText->setMinimumWidth(10);
     chatText->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);