Committing my current state just in case. Mostly work on qtopia, nothing special
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 1 Oct 2007 23:35:16 +0000 (23:35 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 1 Oct 2007 23:35:16 +0000 (23:35 +0000)
or usable yet. Some small fixes in the rest of the code, which should not conflict
with anything though.

19 files changed:
Quassel.kdevelop.filelist
src/client/buffertreemodel.h
src/client/client.cpp
src/common/signalproxy.h
src/contrib/qxt/qxtrpcpeer.cpp
src/core/coresession.cpp
src/core/server.cpp
src/core/storage.h
src/qtgui/chatwidget.cpp
src/qtgui/coreconnectdlg.cpp
src/qtopia/coreconnectdlg.cpp
src/qtopia/mainwidget.cpp [new file with mode: 0644]
src/qtopia/mainwidget.h [new file with mode: 0644]
src/qtopia/qtopia.pro
src/qtopia/qtopiamainwin.cpp
src/qtopia/qtopiamainwin.h
src/qtopia/topicbar.cpp [new file with mode: 0644]
src/qtopia/topicbar.h [new file with mode: 0644]
src/qtopia/ui/mainwidget.ui [new file with mode: 0644]

index 6be6c32..72570ff 100644 (file)
@@ -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
index 56981fc..2d170ec 100644 (file)
@@ -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,
index 8ee2f39..7b715bd 100644 (file)
@@ -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();
 }
 
index 0014bbb..7e74638 100644 (file)
@@ -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();
index e986050..661d776 100644 (file)
@@ -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<QAbstractSocket *>(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<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;
index f85cf55..437200a 100644 (file)
@@ -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();
index 60accee..9123801 100644 (file)
@@ -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;
index 3782ff1..a0e05e5 100644 (file)
@@ -24,7 +24,6 @@
 #include <QtCore>
 #include <QSqlDatabase>
 
-//#include "global.h"
 #include "message.h"
 
 class Storage : public QObject {
index a437a0d..5a3ab40 100644 (file)
 
 
 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);
index a3326a4..4d0740c 100644 (file)
@@ -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.<br>"
index 2ffc986..09fa196 100644 (file)
@@ -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 (file)
index 0000000..9ab5b62
--- /dev/null
@@ -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 (file)
index 0000000..6e0691d
--- /dev/null
@@ -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
index 263bbe8..ed8be35 100644 (file)
@@ -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
index 7a4a480..f41cda9 100644 (file)
@@ -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);
+}
index 528fd81..5d3ab9e 100644 (file)
@@ -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 (file)
index 0000000..8ad87fa
--- /dev/null
@@ -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 <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();
+}
diff --git a/src/qtopia/topicbar.h b/src/qtopia/topicbar.h
new file mode 100644 (file)
index 0000000..23afb1d
--- /dev/null
@@ -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 <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
diff --git a/src/qtopia/ui/mainwidget.ui b/src/qtopia/ui/mainwidget.ui
new file mode 100644 (file)
index 0000000..ea9d717
--- /dev/null
@@ -0,0 +1,75 @@
+<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>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Trebuchet MS'; font-size:14pt; font-weight:400; font-style:normal; text-decoration:none;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;">&lt;span style=" font-size:6pt;">&amp;lt;Sput&amp;gt; So soll das hier dann mal ungefähr aussehen...&lt;/span>&lt;/p>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:6pt;">&amp;lt;Foo&amp;gt; aha, na allzuviel Text bekommt man da wahrscheinlich nicht unter.&lt;/p>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:6pt;">&amp;lt;Sput&amp;gt; Man wird sehen müssen...&lt;/p>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:6pt;">&amp;lt;Foo&amp;gt; Das ist wohl wahr...&lt;/p>&lt;/body>&lt;/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>