From d079afedcfa1357afef4a20faf208588b4e97269 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Sun, 4 Nov 2007 01:17:13 +0000 Subject: [PATCH] Make QuasselTopia compile again. We got rid of the libqxt dependency... Note that it compiles now, but also immediately segfaults on exection :) --- Quassel.kdevelop.filelist | 2 + qtopia-build/quasseltopia.pro | 11 ++-- src/qtopia/chatline.cpp | 9 ++- src/qtopia/chatline.h | 2 + src/qtopia/mainwidget.cpp | 2 +- src/qtopia/qtopia.pri | 8 ++- src/qtopia/qtopiagui.cpp | 19 ++++-- src/qtopia/qtopiagui.h | 10 ++- src/qtopia/qtopiamainwin.cpp | 2 +- src/qtopia/qtopiamainwin.h | 2 +- src/qtopia/qtopiastyle.cpp | 113 ++++++++++++++++++++++++++++++++++ src/qtopia/qtopiastyle.h | 34 ++++++++++ 12 files changed, 190 insertions(+), 24 deletions(-) create mode 100644 src/qtopia/qtopiastyle.cpp create mode 100644 src/qtopia/qtopiastyle.h diff --git a/Quassel.kdevelop.filelist b/Quassel.kdevelop.filelist index f9798c02..61b69b0d 100644 --- a/Quassel.kdevelop.filelist +++ b/Quassel.kdevelop.filelist @@ -453,6 +453,8 @@ src/qtopia/qtopiagui.cpp src/qtopia/qtopiagui.h src/qtopia/qtopiamainwin.cpp src/qtopia/qtopiamainwin.h +src/qtopia/qtopiastyle.cpp +src/qtopia/qtopiastyle.h src/qtopia/topicbar.cpp src/qtopia/topicbar.h src/qtopia/ui diff --git a/qtopia-build/quasseltopia.pro b/qtopia-build/quasseltopia.pro index 72edf5e3..e04a2a0e 100644 --- a/qtopia-build/quasseltopia.pro +++ b/qtopia-build/quasseltopia.pro @@ -1,15 +1,18 @@ qtopia_project(qtopia app) -TARGET=quasseltopia -CONFIG+=debug qtopia_main no_quicklaunch no_singleexec no_sxe_test +TARGET = quasseltopia +CONFIG += debug qtopia_main no_quicklaunch no_singleexec no_sxe_test QT = core gui network # Find files -INCLUDEPATH+=../src/qtopia ../src/uisupport ../src/client ../src/common ../src/contrib/qxt +INCLUDEPATH += ../src/qtopia ../src/uisupport ../src/client ../src/common +DESTDIR = . +OBJECTS_DIR = .obj +MOC_DIR = .moc +UIC_DIR = .ui # Include .pri from src dirs -include(../src/contrib/qxt/qxt.pri) include(../src/common/common.pri) include(../src/qtopia/qtopia.pri) include(../src/client/client.pri) diff --git a/src/qtopia/chatline.cpp b/src/qtopia/chatline.cpp index 52f31385..c6ede09e 100644 --- a/src/qtopia/chatline.cpp +++ b/src/qtopia/chatline.cpp @@ -21,17 +21,16 @@ #include #include "chatline.h" +#include "qtopiagui.h" ChatLine::ChatLine(Message msg) { - _text = msg.text(); // FIXME - _sender = msg.sender(); + //_styledSender = QtopiaUi::style()->styleString(msg.formattedSender()); + //_styledText = QtopiaUi::style()->styleString(msg.formattedText()); _timestamp = msg.timestamp(); _msgId = msg.msgId(); _bufferInfo = msg.buffer(); - _htmlSender = formattedToHtml(msg.formattedSender()); - _htmlText = formattedToHtml(msg.formattedText()); - _htmlTimestamp = formattedToHtml(msg.formattedTimestamp()); + } QString ChatLine::sender() const { diff --git a/src/qtopia/chatline.h b/src/qtopia/chatline.h index 0477da37..61865c46 100644 --- a/src/qtopia/chatline.h +++ b/src/qtopia/chatline.h @@ -22,6 +22,7 @@ #define _CHATLINE_H_ #include "quasselui.h" +#include "uistyle.h" class ChatLine : public AbstractUiMsg { @@ -39,6 +40,7 @@ class ChatLine : public AbstractUiMsg { private: QString _sender, _text, _htmlSender, _htmlText, _htmlTimestamp; + UiStyle::StyledText _styledSender, _styledText; MsgId _msgId; BufferInfo _bufferInfo; QDateTime _timestamp; diff --git a/src/qtopia/mainwidget.cpp b/src/qtopia/mainwidget.cpp index 3600fadf..3213e2cd 100644 --- a/src/qtopia/mainwidget.cpp +++ b/src/qtopia/mainwidget.cpp @@ -42,7 +42,7 @@ MainWidget::~MainWidget() { void MainWidget::setBuffer(Buffer *buf) { // TODO update topic if changed; handle status buffer display - QString title = QString("%1 (%2): \"%3\"").arg(buf->displayName()).arg(buf->networkName()).arg(buf->topic()); + QString title = QString("%1 (%2): \"%3\"").arg(buf->name()).arg(buf->networkName()).arg(buf->topic()); ui.topicBar->setContents(title); //ui.chatWidget->setStyleSheet("div { color: #777777; }"); diff --git a/src/qtopia/qtopia.pri b/src/qtopia/qtopia.pri index 7e00cc4e..161f3e6e 100644 --- a/src/qtopia/qtopia.pri +++ b/src/qtopia/qtopia.pri @@ -1,4 +1,6 @@ -# Input -HDRS += chatline.h chatwidget.h coreconnectdlg.h mainwidget.h qtopiagui.h qtopiamainwin.h topicbar.h -SRCS += chatline.cpp chatwidget.cpp coreconnectdlg.cpp mainwidget.cpp qtopiagui.cpp qtopiamainwin.cpp main.cpp topicbar.cpp +DEPMOD = uisupport common client +QT_MOD = core gui network + +HDRS += chatline.h chatwidget.h coreconnectdlg.h mainwidget.h qtopiagui.h qtopiamainwin.h qtopiastyle.h topicbar.h +SRCS += chatline.cpp chatwidget.cpp coreconnectdlg.cpp main.cpp mainwidget.cpp qtopiagui.cpp qtopiamainwin.cpp qtopiastyle.cpp topicbar.cpp FRMS += ui/coreconnectdlg.ui ui/coreconnectprogressdlg.ui ui/editcoreacctdlg.ui ui/mainwidget.ui diff --git a/src/qtopia/qtopiagui.cpp b/src/qtopia/qtopiagui.cpp index 26251dde..c6d8844d 100644 --- a/src/qtopia/qtopiagui.cpp +++ b/src/qtopia/qtopiagui.cpp @@ -20,31 +20,38 @@ #include "qtopiagui.h" #include "qtopiamainwin.h" +#include "qtopiastyle.h" -QtopiaGui::QtopiaGui(QtopiaMainWin *mw) : AbstractUi(), mainWin(mw) { +QtopiaUi::QtopiaUi(QtopiaMainWin *mw) : AbstractUi(), mainWin(mw) { + _style = new QtopiaStyle(); connect(mainWin, SIGNAL(connectToCore(const QVariantMap &)), this, SIGNAL(connectToCore(const QVariantMap &))); connect(mainWin, SIGNAL(disconnectFromCore()), this, SIGNAL(disconnectFromCore())); } -QtopiaGui::~QtopiaGui() { +QtopiaUi::~QtopiaUi() { + delete _style; delete mainWin; } -void QtopiaGui::init() { +void QtopiaUi::init() { } -AbstractUiMsg *QtopiaGui::layoutMsg(const Message &msg) { +QtopiaStyle *QtopiaUi::style() const { + return _style; +} + +AbstractUiMsg *QtopiaUi::layoutMsg(const Message &msg) { return mainWin->layoutMsg(msg); } -void QtopiaGui::connectedToCore() { +void QtopiaUi::connectedToCore() { mainWin->connectedToCore(); } -void QtopiaGui::disconnectedFromCore() { +void QtopiaUi::disconnectedFromCore() { mainWin->disconnectedFromCore(); } diff --git a/src/qtopia/qtopiagui.h b/src/qtopia/qtopiagui.h index 747e5d69..b4dc2ba4 100644 --- a/src/qtopia/qtopiagui.h +++ b/src/qtopia/qtopiagui.h @@ -24,23 +24,27 @@ #include "quasselui.h" class QtopiaMainWin; +class QtopiaStyle; //! This class encapsulates Quassel's GUI for Qtopia. -class QtopiaGui : public AbstractUi { +class QtopiaUi : public AbstractUi { Q_OBJECT public: - QtopiaGui(QtopiaMainWin *mainWin); - ~QtopiaGui(); + QtopiaUi(QtopiaMainWin *mainWin); + ~QtopiaUi(); void init(); AbstractUiMsg *layoutMsg(const Message &); + QtopiaStyle *style() const; + protected slots: void connectedToCore(); void disconnectedFromCore(); private: QtopiaMainWin *mainWin; + QtopiaStyle *_style; }; diff --git a/src/qtopia/qtopiamainwin.cpp b/src/qtopia/qtopiamainwin.cpp index 5296eb47..b821b6a6 100644 --- a/src/qtopia/qtopiamainwin.cpp +++ b/src/qtopia/qtopiamainwin.cpp @@ -46,7 +46,7 @@ QtopiaMainWin::QtopiaMainWin(QWidget *parent, Qt::WFlags flags) : QMainWindow(pa QCoreApplication::setOrganizationName("Quassel IRC Development Team"); //Style::init(); - QtopiaGui *gui = new QtopiaGui(this); + QtopiaUi *gui = new QtopiaUi(this); Client::init(gui); setWindowTitle("Quassel IRC"); diff --git a/src/qtopia/qtopiamainwin.h b/src/qtopia/qtopiamainwin.h index 70ab8913..37f73161 100644 --- a/src/qtopia/qtopiamainwin.h +++ b/src/qtopia/qtopiamainwin.h @@ -54,7 +54,7 @@ class QtopiaMainWin : public QMainWindow { MainWidget *mainWidget; - friend class QtopiaGui; + friend class QtopiaUi; }; #endif diff --git a/src/qtopia/qtopiastyle.cpp b/src/qtopia/qtopiastyle.cpp new file mode 100644 index 00000000..12174f11 --- /dev/null +++ b/src/qtopia/qtopiastyle.cpp @@ -0,0 +1,113 @@ +/*************************************************************************** + * Copyright (C) 2005-07 by the Quassel IRC Team * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "qtopiastyle.h" + +QtopiaStyle::QtopiaStyle() : UiStyle() { + + QTextCharFormat def; + def.setFont(QFont("Verdana",6)); + setFormat(None, def); + + // We need to just set our internal formats; everything else is done by the base class... + + // Internal message formats + QTextCharFormat plainMsg; + plainMsg.setForeground(QBrush("black")); + setFormat(PlainMsg, plainMsg); + + QTextCharFormat notice; + notice.setForeground(QBrush("navy")); + setFormat(NoticeMsg, notice); + + QTextCharFormat server; + server.setForeground(QBrush("navy")); + setFormat(ServerMsg, server); + + QTextCharFormat error; + error.setForeground(QBrush("red")); + setFormat(ErrorMsg, error); + + QTextCharFormat join; + join.setForeground(QBrush("green")); + setFormat(JoinMsg, join); + + QTextCharFormat part; + part.setForeground(QBrush("indianred")); + setFormat(PartMsg, part); + + QTextCharFormat quit; + quit.setForeground(QBrush("indianred")); + setFormat(QuitMsg, quit); + + QTextCharFormat kick; + kick.setForeground(QBrush("indianred")); + setFormat(KickMsg, kick); + + QTextCharFormat nren; + nren.setForeground(QBrush("magenta")); + setFormat(RenameMsg, nren); + + QTextCharFormat mode; + mode.setForeground(QBrush("steelblue")); + setFormat(ModeMsg, mode); + + QTextCharFormat action; + action.setFontItalic(true); + action.setForeground(QBrush("darkmagenta")); + setFormat(ActionMsg, action); + + // Internal message element formats + QTextCharFormat ts; + ts.setForeground(QBrush("grey")); + setFormat(Timestamp, ts); + + QTextCharFormat sender; + sender.setAnchor(true); + sender.setForeground(QBrush("navy")); + setFormat(Sender, sender); + + QTextCharFormat nick; + nick.setAnchor(true); + nick.setFontWeight(QFont::Bold); + setFormat(Nick, nick); + + QTextCharFormat hostmask; + hostmask.setFontItalic(true); + setFormat(Hostmask, hostmask); + + QTextCharFormat channel; + channel.setAnchor(true); + channel.setFontWeight(QFont::Bold); + setFormat(ChannelName, channel); + + QTextCharFormat flags; + flags.setFontWeight(QFont::Bold); + setFormat(ModeFlags, flags); + + QTextCharFormat url; + url.setFontUnderline(true); + url.setAnchor(true); + setFormat(Url, url); + + +} + +QtopiaStyle::~QtopiaStyle() {} diff --git a/src/qtopia/qtopiastyle.h b/src/qtopia/qtopiastyle.h new file mode 100644 index 00000000..c22f7ea6 --- /dev/null +++ b/src/qtopia/qtopiastyle.h @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (C) 2005-07 by the Quassel IRC Team * + * devel@quassel-irc.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _QTOPIASTYLE_H_ +#define _QTOPIASTYLE_H_ + +#include "uistyle.h" + +class QtopiaStyle : public UiStyle { + + public: + QtopiaStyle(); + virtual ~QtopiaStyle(); + +}; + +#endif -- 2.20.1