or usable yet. Some small fixes in the rest of the code, which should not conflict
with anything though.
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
- /***************************************************************************
+/***************************************************************************
* Copyright (C) 2005-07 by The Quassel Team *
* devel@quassel-irc.org *
* *
Q_OBJECT
public:
- enum myRoles {
+ enum myRoles {
BufferTypeRole = Qt::UserRole,
BufferActiveRole,
BufferNameRole,
layoutTimer->stop();
}
-void Client::coreSocketStateChanged(QAbstractSocket::SocketState state) { qDebug() << state;
+void Client::coreSocketStateChanged(QAbstractSocket::SocketState state) {
if(state == QAbstractSocket::UnconnectedState) coreSocketDisconnected();
}
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();
QXT_INIT_PRIVATE(QxtRPCPeer);
qxt_d().m_rpctype = type;
qxt_d().m_peer = device;
+ //qDebug() << device->metaObject()->className();
if (qobject_cast<QAbstractSocket *>(device)!=0)
{
QxtRPCConnection* conn = qxt_d().m_clients.value(sender());
if (!conn)
{
- if (qxt_d().m_peer!= qobject_cast<QAbstractSocket*>(sender())) // SPUT: why not QTcpSocket*?
+ //qDebug() << qxt_d().m_peer->metaObject()->className();
+ if (qxt_d().m_peer!= qobject_cast<QTcpSocket*>(sender()))
{
qWarning() << "QxtRPCPeer: Unrecognized object connected to disconnectSender";
return;
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();
// 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;
#include <QtCore>
#include <QSqlDatabase>
-//#include "global.h"
#include "message.h"
class Storage : public QObject {
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);
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.<br>"
ui.accountList->addItems(s.knownAccounts());
if(ui.accountList->count()) ui.accountList->item(0)->setSelected(true);
setWidgetStates();
+ doConnect(); // shortcut for development
}
CoreConnectDlg::~CoreConnectDlg() {
--- /dev/null
+/***************************************************************************
+ * 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);
+
+}
--- /dev/null
+/***************************************************************************
+ * 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
# 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
#include "coreconnectdlg.h"
#include "global.h"
+#include "mainwidget.h"
#include "message.h"
#include "qtopiagui.h"
#include "signalproxy.h"
//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
//return new ChatLine(msg);
return 0;
}
+
+void QtopiaMainWin::showBuffer(Buffer *b) {
+ mainWidget->setBuffer(b);
+}
#include "client.h"
#include "global.h"
+class MainWidget;
+
class QtopiaMainWin : public QMainWindow {
Q_OBJECT
void disconnectFromCore();
void requestBacklog(BufferId, QVariant, QVariant);
+ private slots:
+ void showBuffer(Buffer *);
+
private:
void init();
+ MainWidget *mainWidget;
+
friend class QtopiaGui;
};
--- /dev/null
+/***************************************************************************
+ * 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 <QtGui>
+
+
+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();
+}
--- /dev/null
+/***************************************************************************
+ * 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 <QPushButton>
+#include <QTimeLine>
+
+#include <QtGui>
+
+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
--- /dev/null
+<ui version="4.0" >
+ <class>MainWidget</class>
+ <widget class="QWidget" name="MainWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>291</width>
+ <height>358</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="TopicBar" name="topicBar" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font" >
+ <font>
+ <pointsize>15</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="chatWidget" >
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ <property name="html" >
+ <string><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></string>
+ </property>
+ <property name="textInteractionFlags" >
+ <enum>Qt::NoTextInteraction</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="inputLine" />
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>TopicBar</class>
+ <extends>QPushButton</extends>
+ <header>topicbar.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>