a chatwidget, including colors and stuff...
src/qtopia/qtopiamainwin.h
src/qtopia/qtopiastyle.cpp
src/qtopia/qtopiastyle.h
src/qtopia/qtopiamainwin.h
src/qtopia/qtopiastyle.cpp
src/qtopia/qtopiastyle.h
+src/qtopia/qtopiaui.cpp
+src/qtopia/qtopiaui.h
+src/qtopia/qtopiauistyle.cpp
+src/qtopia/qtopiauistyle.h
src/qtopia/topicbar.cpp
src/qtopia/topicbar.h
src/qtopia/ui
src/qtopia/topicbar.cpp
src/qtopia/topicbar.h
src/qtopia/ui
#include "chatline.h"
#include "qtopiaui.h"
#include "chatline.h"
#include "qtopiaui.h"
+#include "qtopiauistyle.h"
ChatLine::ChatLine(Message msg) {
ChatLine::ChatLine(Message msg) {
- //_styledSender = QtopiaUi::style()->styleString(msg.formattedSender());
- //_styledText = QtopiaUi::style()->styleString(msg.formattedText());
+ _styledSender = QtopiaUi::style()->styleString(msg.formattedSender());
+ _styledText = QtopiaUi::style()->styleString(msg.formattedText());
_timestamp = msg.timestamp();
_msgId = msg.msgId();
_bufferInfo = msg.buffer();
_timestamp = msg.timestamp();
_msgId = msg.msgId();
_bufferInfo = msg.buffer();
-QString ChatLine::htmlSender() const {
- return _htmlSender;
+UiStyle::StyledText ChatLine::styledSender() const {
+ return _styledSender;
-QString ChatLine::htmlText() const {
- return _htmlText;
+UiStyle::StyledText ChatLine::styledText() const {
+ return _styledText;
-QString ChatLine::htmlTimestamp() const {
- return _htmlTimestamp;
-}
QString ChatLine::formattedToHtml(const QString &f) {
QString ChatLine::formattedToHtml(const QString &f) {
BufferInfo bufferInfo() const;
QDateTime timestamp() const;
BufferInfo bufferInfo() const;
QDateTime timestamp() const;
- QString htmlSender() const;
- QString htmlText() const;
- QString htmlTimestamp() const;
+ UiStyle::StyledText styledSender() const;
+ UiStyle::StyledText styledText() const;
private:
QString _sender, _text, _htmlSender, _htmlText, _htmlTimestamp;
private:
QString _sender, _text, _htmlSender, _htmlText, _htmlTimestamp;
#include "chatwidget.h"
ChatWidget::ChatWidget(QWidget *parent) : QTextEdit(parent) {
#include "chatwidget.h"
ChatWidget::ChatWidget(QWidget *parent) : QTextEdit(parent) {
+ setStyleSheet("background-color: rgba(255, 255, 255, 60%)");
}
void ChatWidget::setContents(QList<ChatLine *> lines) {
}
void ChatWidget::setContents(QList<ChatLine *> lines) {
}
void ChatWidget::appendChatLine(ChatLine *line) {
}
void ChatWidget::appendChatLine(ChatLine *line) {
- append(line->text()); qDebug() << "appending";
+ QTextCursor cursor = textCursor();
+ moveCursor(QTextCursor::End);
+ insertChatLine(line);
+ setTextCursor(cursor);
}
void ChatWidget::appendChatLines(QList<ChatLine *> list) {
}
void ChatWidget::appendChatLines(QList<ChatLine *> list) {
}
void ChatWidget::prependChatLine(ChatLine *line) {
}
void ChatWidget::prependChatLine(ChatLine *line) {
- qDebug() << "prepending"; return;
QTextCursor cursor = textCursor();
moveCursor(QTextCursor::Start);
QTextCursor cursor = textCursor();
moveCursor(QTextCursor::Start);
- insertHtml(line->text());
- QTextCharFormat fmt;
- fmt.setForeground(QBrush("#eeff33"));
- QFont font("Courier", 8);
- font.setFixedPitch(true); qDebug() << font.family();
- fmt.setFont(font);
- //fmt.setBackground(QBrush("#112233"));
- QTextCursor crsor(document());
- crsor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
- crsor.select(QTextCursor::Document);
- crsor.setCharFormat(fmt);
}
void ChatWidget::prependChatLines(QList<ChatLine *> list) {
}
void ChatWidget::prependChatLines(QList<ChatLine *> list) {
+ foreach(ChatLine *line, list) {
+ prependChatLine(line);
+ }
+}
+void ChatWidget::insertChatLine(ChatLine *line) {
+ insertStyledText(line->styledSender());
+ insertPlainText(" ");
+ insertStyledText(line->styledText());
+ insertPlainText("\n");
+}
+void ChatWidget::insertStyledText(const QtopiaUiStyle::StyledText &stext) {
+ QTextCursor cursor = textCursor();
+ foreach(QTextLayout::FormatRange format, stext.formats) {
+ cursor.setCharFormat(format.format);
+ setTextCursor(cursor);
+ insertPlainText(stext.text.mid(format.start, format.length));
+ }
#include <QTextEdit>
#include "chatline.h"
#include <QTextEdit>
#include "chatline.h"
+#include "qtopiauistyle.h"
#include "quasselui.h"
class ChatWidget : public QTextEdit {
#include "quasselui.h"
class ChatWidget : public QTextEdit {
void appendChatLines(QList<ChatLine *>);
private:
void appendChatLines(QList<ChatLine *>);
private:
+ void insertChatLine(ChatLine *);
+ void insertStyledText(const QtopiaUiStyle::StyledText &);
emit requestBacklog(id, 100, -1);
}
// FIXME just for testing: select first available buffer
emit requestBacklog(id, 100, -1);
}
// FIXME just for testing: select first available buffer
- if(Client::allBufferInfos().count() > 1) {
- Buffer *b = Client::buffer(Client::allBufferInfos()[1]);
+ if(Client::allBufferInfos().count() > 2) {
+ Buffer *b = Client::buffer(Client::allBufferInfos()[2]);
Client::bufferModel()->selectBuffer(b);
}
}
Client::bufferModel()->selectBuffer(b);
}
}
#include "qtopiamainwin.h"
#include "qtopiauistyle.h"
#include "qtopiamainwin.h"
#include "qtopiauistyle.h"
+QtopiaUiStyle *QtopiaUi::_style;
+
QtopiaUi::QtopiaUi(QtopiaMainWin *mw) : AbstractUi(), mainWin(mw) {
_style = new QtopiaUiStyle();
connect(mainWin, SIGNAL(connectToCore(const QVariantMap &)), this, SIGNAL(connectToCore(const QVariantMap &)));
QtopiaUi::QtopiaUi(QtopiaMainWin *mw) : AbstractUi(), mainWin(mw) {
_style = new QtopiaUiStyle();
connect(mainWin, SIGNAL(connectToCore(const QVariantMap &)), this, SIGNAL(connectToCore(const QVariantMap &)));
-QtopiaUiStyle *QtopiaUi::style() const {
+QtopiaUiStyle *QtopiaUi::style() {
void init();
AbstractUiMsg *layoutMsg(const Message &);
void init();
AbstractUiMsg *layoutMsg(const Message &);
- QtopiaUiStyle *style() const;
+ static QtopiaUiStyle *style();
protected slots:
void connectedToCore();
protected slots:
void connectedToCore();
private:
QtopiaMainWin *mainWin;
private:
QtopiaMainWin *mainWin;
+ static QtopiaUiStyle *_style;
QtopiaUiStyle::QtopiaUiStyle() : UiStyle() {
QTextCharFormat def;
QtopiaUiStyle::QtopiaUiStyle() : UiStyle() {
QTextCharFormat def;
- def.setFont(QFont("Verdana",6));
+ def.setFont(QFont("Verdana",5));
setFormat(None, def);
// We need to just set our internal formats; everything else is done by the base class...
setFormat(None, def);
// We need to just set our internal formats; everything else is done by the base class...
setFormat(JoinMsg, join);
QTextCharFormat part;
setFormat(JoinMsg, join);
QTextCharFormat part;
- part.setForeground(QBrush("#cd5c5c"));
+ part.setForeground(QBrush("#ff0000"));
setFormat(PartMsg, part);
QTextCharFormat quit;
setFormat(PartMsg, part);
QTextCharFormat quit;
- quit.setForeground(QBrush("#cd5c5c"));
+ quit.setForeground(QBrush("#ff0000"));
setFormat(QuitMsg, quit);
QTextCharFormat kick;
setFormat(QuitMsg, quit);
QTextCharFormat kick;
- kick.setForeground(QBrush("#cd5c5c"));
+ kick.setForeground(QBrush("#ff0000"));
setFormat(KickMsg, kick);
QTextCharFormat nren;
setFormat(KickMsg, kick);
QTextCharFormat nren;