From: Manuel Nickschas Date: Mon, 1 Oct 2007 23:35:16 +0000 (+0000) Subject: Committing my current state just in case. Mostly work on qtopia, nothing special X-Git-Tag: 0.1.0~150 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=4e9a619ab2a22ce3c933fbb36122632debfd415a Committing my current state just in case. Mostly work on qtopia, nothing special or usable yet. Some small fixes in the rest of the code, which should not conflict with anything though. --- diff --git a/Quassel.kdevelop.filelist b/Quassel.kdevelop.filelist index 6be6c32b..72570fff 100644 --- a/Quassel.kdevelop.filelist +++ b/Quassel.kdevelop.filelist @@ -127,3 +127,10 @@ src/qtopia/ui src/qtopia/ui/coreconnectdlg.ui src/qtopia/ui/coreconnectprogressdlg.ui src/qtopia/ui/editcoreacctdlg.ui +src/qtopia/mainwidget.cpp +src/qtopia/mainwidget.h +src/qtopia/ui/mainwidget.ui +qtopia-build +qtopia-build/Makefile +src/qtopia/topicbar.cpp +src/qtopia/topicbar.h diff --git a/src/client/buffertreemodel.h b/src/client/buffertreemodel.h index 56981fca..2d170ece 100644 --- a/src/client/buffertreemodel.h +++ b/src/client/buffertreemodel.h @@ -1,4 +1,4 @@ - /*************************************************************************** +/*************************************************************************** * Copyright (C) 2005-07 by The Quassel Team * * devel@quassel-irc.org * * * @@ -74,7 +74,7 @@ class BufferTreeModel : public TreeModel { Q_OBJECT public: - enum myRoles { + enum myRoles { BufferTypeRole = Qt::UserRole, BufferActiveRole, BufferNameRole, diff --git a/src/client/client.cpp b/src/client/client.cpp index 8ee2f395..7b715bd1 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -196,7 +196,7 @@ void Client::coreSocketDisconnected() { layoutTimer->stop(); } -void Client::coreSocketStateChanged(QAbstractSocket::SocketState state) { qDebug() << state; +void Client::coreSocketStateChanged(QAbstractSocket::SocketState state) { if(state == QAbstractSocket::UnconnectedState) coreSocketDisconnected(); } diff --git a/src/common/signalproxy.h b/src/common/signalproxy.h index 0014bbbf..7e746387 100644 --- a/src/common/signalproxy.h +++ b/src/common/signalproxy.h @@ -39,12 +39,12 @@ class SignalProxy : public QObject { public slots: void addPeer(QIODevice *device); - void detachObject(QObject* obj); - + void sendSignal(const char *signal, QVariant p1 = QVariant(), QVariant p2 = QVariant(), QVariant p3 = QVariant(), QVariant p4 = QVariant(), QVariant p5 = QVariant(), QVariant p6 = QVariant(), QVariant p7 = QVariant(), QVariant p8 = QVariant(), QVariant p9 = QVariant()); //void detachSender(); + void detachObject(QObject *); signals: void peerDisconnected(); diff --git a/src/contrib/qxt/qxtrpcpeer.cpp b/src/contrib/qxt/qxtrpcpeer.cpp index e9860500..661d7761 100644 --- a/src/contrib/qxt/qxtrpcpeer.cpp +++ b/src/contrib/qxt/qxtrpcpeer.cpp @@ -126,6 +126,7 @@ QxtRPCPeer::QxtRPCPeer(QIODevice* device, RPCTypes type, QObject* parent) : QObj QXT_INIT_PRIVATE(QxtRPCPeer); qxt_d().m_rpctype = type; qxt_d().m_peer = device; + //qDebug() << device->metaObject()->className(); if (qobject_cast(device)!=0) { @@ -523,7 +524,8 @@ void QxtRPCPeer::disconnectSender() QxtRPCConnection* conn = qxt_d().m_clients.value(sender()); if (!conn) { - if (qxt_d().m_peer!= qobject_cast(sender())) // SPUT: why not QTcpSocket*? + //qDebug() << qxt_d().m_peer->metaObject()->className(); + if (qxt_d().m_peer!= qobject_cast(sender())) { qWarning() << "QxtRPCPeer: Unrecognized object connected to disconnectSender"; return; diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index f85cf559..437200a8 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -50,7 +50,6 @@ CoreSession::CoreSession(UserId uid, Storage *_storage, QObject *parent) : QObje p->attachSignal(storage, SIGNAL(bufferIdUpdated(BufferId))); p->attachSignal(this, SIGNAL(sessionDataChanged(const QString &, const QVariant &)), SIGNAL(coreSessionDataChanged(const QString &, const QVariant &))); p->attachSlot(SIGNAL(clientSessionDataChanged(const QString &, const QVariant &)), this, SLOT(storeSessionData(const QString &, const QVariant &))); - /* Autoconnect. (When) do we actually do this? QStringList list; QVariantMap networks = retrieveSessionData("Networks").toMap(); diff --git a/src/core/server.cpp b/src/core/server.cpp index 60accee1..9123801c 100644 --- a/src/core/server.cpp +++ b/src/core/server.cpp @@ -558,7 +558,7 @@ void Server::handleServerJoin(QString prefix, QStringList params) { // Q_ASSERT(!chans.keys().contains(params[0])); TODO uncomment chans[params[0]] = QVariantMap(); n["Channels"] = chans; - nicks[nick] = n; qDebug() << network << nick << n; + nicks[nick] = n; emit nickUpdated(network, nick, n); } else { QVariantMap chans; diff --git a/src/core/storage.h b/src/core/storage.h index 3782ff14..a0e05e53 100644 --- a/src/core/storage.h +++ b/src/core/storage.h @@ -24,7 +24,6 @@ #include #include -//#include "global.h" #include "message.h" class Storage : public QObject { diff --git a/src/qtgui/chatwidget.cpp b/src/qtgui/chatwidget.cpp index a437a0d3..5a3ab403 100644 --- a/src/qtgui/chatwidget.cpp +++ b/src/qtgui/chatwidget.cpp @@ -25,6 +25,10 @@ ChatWidget::ChatWidget(QWidget *parent) : QAbstractScrollArea(parent) { + //setAutoFillBackground(false); + //QPalette palette; + //palette.setColor(backgroundRole(), QColor(0, 0, 0, 50)); + //setPalette(palette); scrollTimer = new QTimer(this); scrollTimer->setSingleShot(false); scrollTimer->setInterval(100); diff --git a/src/qtgui/coreconnectdlg.cpp b/src/qtgui/coreconnectdlg.cpp index a3326a4e..4d0740c5 100644 --- a/src/qtgui/coreconnectdlg.cpp +++ b/src/qtgui/coreconnectdlg.cpp @@ -60,7 +60,7 @@ CoreConnectDlg::CoreConnectDlg(QWidget *parent, bool /*doAutoConnect*/) : QDialo curacc = s.lastAccount(); if(!ui.accountList->count()) { //if(doAutoConnect) reject(); - + setAccountEditEnabled(false); QString newacc = QInputDialog::getText(this, tr("Create Account"), tr( "In order to connect to a Quassel Core, you need to create an account.
" diff --git a/src/qtopia/coreconnectdlg.cpp b/src/qtopia/coreconnectdlg.cpp index 2ffc9862..09fa196c 100644 --- a/src/qtopia/coreconnectdlg.cpp +++ b/src/qtopia/coreconnectdlg.cpp @@ -59,6 +59,7 @@ CoreConnectDlg::CoreConnectDlg(QWidget *parent, bool /*doAutoConnect*/) : QDialo ui.accountList->addItems(s.knownAccounts()); if(ui.accountList->count()) ui.accountList->item(0)->setSelected(true); setWidgetStates(); + doConnect(); // shortcut for development } CoreConnectDlg::~CoreConnectDlg() { diff --git a/src/qtopia/mainwidget.cpp b/src/qtopia/mainwidget.cpp new file mode 100644 index 00000000..9ab5b620 --- /dev/null +++ b/src/qtopia/mainwidget.cpp @@ -0,0 +1,47 @@ +/*************************************************************************** + * Copyright (C) 2005-07 by The Quassel IRC Development 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 "mainwidget.h" + +#include "buffer.h" + +MainWidget::MainWidget(QWidget *parent) : QWidget(parent) { + ui.setupUi(this); + +// ui.bufferLeft->setIcon(QIcon(":icon/left")); +// ui.bufferRight->setIcon(QIcon(":icon/right")); + //ui.bufferLeft->setIconSize(QSize(10, 10)); + //ui.bufferRight->setIconSize(QSize(10, 10)); + //ui.bufferLeft->setMaximumSize(QSize(10,10)); + //ui.bufferRight->setMaximumSize(QSize(10,10)); +} + +MainWidget::~MainWidget() { + + + +} + +void MainWidget::setBuffer(Buffer *b) { + // TODO update topic if changed; handle status buffer display + QString title = QString("%1 (%2): \"%3\"").arg(b->displayName()).arg(b->networkName()).arg(b->topic()); + ui.topicBar->setContents(title); + +} diff --git a/src/qtopia/mainwidget.h b/src/qtopia/mainwidget.h new file mode 100644 index 00000000..6e0691d4 --- /dev/null +++ b/src/qtopia/mainwidget.h @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2005-07 by The Quassel IRC Development 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 _MAINWIDGET_H_ +#define _MAINWIDGET_H_ + +#include "ui_mainwidget.h" + +class Buffer; + +class MainWidget : public QWidget { + Q_OBJECT + + public: + MainWidget(QWidget *parent = 0); + ~MainWidget(); + + public slots: + void setBuffer(Buffer *); + + private: + Ui::MainWidget ui; + + +}; + + +#endif diff --git a/src/qtopia/qtopia.pro b/src/qtopia/qtopia.pro index 263bbe80..ed8be35b 100644 --- a/src/qtopia/qtopia.pro +++ b/src/qtopia/qtopia.pro @@ -1,4 +1,4 @@ # Input -HEADERS += coreconnectdlg.h qtopiagui.h qtopiamainwin.h -SOURCES += coreconnectdlg.cpp qtopiagui.cpp qtopiamainwin.cpp main.cpp -FORMS += ui/coreconnectdlg.ui ui/coreconnectprogressdlg.ui ui/editcoreacctdlg.ui +HEADERS += coreconnectdlg.h mainwidget.h qtopiagui.h qtopiamainwin.h topicbar.h +SOURCES += coreconnectdlg.cpp mainwidget.cpp qtopiagui.cpp qtopiamainwin.cpp main.cpp topicbar.cpp +FORMS += ui/coreconnectdlg.ui ui/coreconnectprogressdlg.ui ui/editcoreacctdlg.ui ui/mainwidget.ui diff --git a/src/qtopia/qtopiamainwin.cpp b/src/qtopia/qtopiamainwin.cpp index 7a4a4805..f41cda92 100644 --- a/src/qtopia/qtopiamainwin.cpp +++ b/src/qtopia/qtopiamainwin.cpp @@ -22,6 +22,7 @@ #include "coreconnectdlg.h" #include "global.h" +#include "mainwidget.h" #include "message.h" #include "qtopiagui.h" #include "signalproxy.h" @@ -49,10 +50,17 @@ QtopiaMainWin::QtopiaMainWin(QWidget *parent, Qt::WFlags flags) : QMainWindow(pa //gui->init(); setWindowTitle("Quassel IRC"); - //setWindowTitle(QString::fromUtf8("Κυασελ Εγαρζη")); setWindowIcon(QIcon(":/qirc-icon.png")); setWindowIconText("Quassel IRC"); + mainWidget = new MainWidget(this); + setCentralWidget(mainWidget); + + QToolBar *toolBar = new QToolBar(this); + toolBar->setIconSize(QSize(16, 16)); + toolBar->addAction(QIcon(":icon/trash"), "Trash"); + addToolBar(toolBar); + } // at this point, client is fully initialized @@ -85,3 +93,7 @@ AbstractUiMsg *QtopiaMainWin::layoutMsg(const Message &msg) { //return new ChatLine(msg); return 0; } + +void QtopiaMainWin::showBuffer(Buffer *b) { + mainWidget->setBuffer(b); +} diff --git a/src/qtopia/qtopiamainwin.h b/src/qtopia/qtopiamainwin.h index 528fd81a..5d3ab9eb 100644 --- a/src/qtopia/qtopiamainwin.h +++ b/src/qtopia/qtopiamainwin.h @@ -26,6 +26,8 @@ #include "client.h" #include "global.h" +class MainWidget; + class QtopiaMainWin : public QMainWindow { Q_OBJECT @@ -44,9 +46,14 @@ class QtopiaMainWin : public QMainWindow { void disconnectFromCore(); void requestBacklog(BufferId, QVariant, QVariant); + private slots: + void showBuffer(Buffer *); + private: void init(); + MainWidget *mainWidget; + friend class QtopiaGui; }; diff --git a/src/qtopia/topicbar.cpp b/src/qtopia/topicbar.cpp new file mode 100644 index 00000000..8ad87fa0 --- /dev/null +++ b/src/qtopia/topicbar.cpp @@ -0,0 +1,83 @@ +/*************************************************************************** + * Copyright (C) 2005-07 by The Quassel IRC Development 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 "topicbar.h" + +#include + + +TopicBar::TopicBar(QWidget *parent) : QPushButton(parent) { + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + + // Define the font and calculate the metrics for it + topicFont = font(); + topicFont.setPointSize(5); + + // frameWidth = style()->pixelMetric(QStyle::PM_ButtonMargin); // Nice idea, but Qtopia's buttons are just too large... + frameWidth = 3; // so we hardcode a more reasonable framewidth than 7 + setFixedHeight(QFontMetrics(topicFont).height() + 2*frameWidth); + + fillText = " *** "; + oneshot = true; + timer = new QTimer(this); + timer->setInterval(20); + connect(timer, SIGNAL(timeout()), this, SLOT(updateOffset())); +} + +TopicBar::~TopicBar() { + + +} + +void TopicBar::setContents(QString t, bool _oneshot) { + text = t; oneshot = _oneshot; + int w = width() - 2*frameWidth; + QRect boundingRect = QFontMetrics(topicFont).boundingRect(text); + if(boundingRect.width() <= w) { + offset = 0; fillTextStart = -1; secondTextStart = -1; + timer->stop(); + } else { + fillTextStart = boundingRect.width(); + boundingRect = QFontMetrics(topicFont).boundingRect(fillText); + secondTextStart = fillTextStart + boundingRect.width(); + text = QString("%1%2%1").arg(text).arg(fillText); + offset = 0; + timer->start(); + } +} + +void TopicBar::paintEvent(QPaintEvent *event) { + QPushButton::paintEvent(event); + + QPainter painter(this); + painter.setFont(topicFont); + painter.setClipRect(frameWidth, frameWidth, rect().width() - 2*frameWidth, rect().height() - 2*frameWidth); + painter.drawText(QPoint(-offset + frameWidth, QFontMetrics(topicFont).ascent() + frameWidth), text); + +} + +void TopicBar::updateOffset() { + offset++; + if(offset >= secondTextStart) { + offset = 0; + if(oneshot) timer->stop(); // only scroll once! + } + update(); +} diff --git a/src/qtopia/topicbar.h b/src/qtopia/topicbar.h new file mode 100644 index 00000000..23afb1d6 --- /dev/null +++ b/src/qtopia/topicbar.h @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (C) 2005-07 by The Quassel IRC Development 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 _TOPICBAR_H_ +#define _TOPICBAR_H_ + +#include +#include + +#include + +class QPixmap; +class QTimer; + +class TopicBar : public QPushButton { + Q_OBJECT + + public: + TopicBar(QWidget *parent = 0); + ~TopicBar(); + + public slots: + void setContents(QString text, bool oneshot = true); + + protected: + virtual void paintEvent(QPaintEvent * event); + + private slots: + void updateOffset(); + + private: + QTimer *timer; + int offset; + int fillTextStart, secondTextStart; + QString text; + QString fillText; + QFont topicFont; + int frameWidth; + bool oneshot; +}; + + +#endif diff --git a/src/qtopia/ui/mainwidget.ui b/src/qtopia/ui/mainwidget.ui new file mode 100644 index 00000000..ea9d717d --- /dev/null +++ b/src/qtopia/ui/mainwidget.ui @@ -0,0 +1,75 @@ + + MainWidget + + + + 0 + 0 + 291 + 358 + + + + Form + + + + 0 + + + 0 + + + + + + 3 + 5 + 0 + 0 + + + + + 15 + + + + + + + + + + + true + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Trebuchet MS'; font-size:14pt; font-weight:400; font-style:normal; text-decoration:none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><span style=" font-size:6pt;">&lt;Sput&gt; So soll das hier dann mal ungefähr aussehen...</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:6pt;">&lt;Foo&gt; aha, na allzuviel Text bekommt man da wahrscheinlich nicht unter.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:6pt;">&lt;Sput&gt; Man wird sehen müssen...</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:6pt;">&lt;Foo&gt; Das ist wohl wahr...</p></body></html> + + + Qt::NoTextInteraction + + + + + + + + + + + TopicBar + QPushButton +
topicbar.h
+
+
+ + +