src/uisupport/bufferview.h
src/uisupport/bufferviewfilter.cpp
src/uisupport/bufferviewfilter.h
+src/uisupport/nickview.cpp
+src/uisupport/nickview.h
src/uisupport/uistyle.cpp
src/uisupport/uistyle.h
src/uisupport/uisupport.pri
#include "buffer.h"
#include "client.h"
+#include "ircchannel.h"
#include "util.h"
Buffer::Buffer(BufferInfo bufferid, QObject *parent)
: QObject(parent),
_bufferInfo(bufferid),
- _active(false)
+ _active(false),
+ _ircChannel(0)
{
if(bufferid.buffer().isEmpty())
_type = StatusType;
emit userInput(_bufferInfo, msg);
}
+IrcChannel *Buffer::ircChannel() const {
+ return _ircChannel;
+}
+
+void Buffer::setIrcChannel(IrcChannel *ircchan) {
+ if(_ircChannel) {
+ disconnect(_ircChannel, 0, this, 0);
+ // TODO: remove model etc
+ }
+ _ircChannel = ircchan;
+ if(_ircChannel) {
+ connect(_ircChannel, SIGNAL(destroyed()), this, SLOT(setIrcChannel()));
+ }
+}
+
// no longer needed
// back reference:
// void Buffer::setTopic(QString t) {
#define _BUFFER_H_
class AbstractUiMsg;
+class IrcChannel;
struct BufferState;
QString topic() const;
QString ownNick() const;
+ //! Returns a pointer to the associated IrcChannel object for the buffer.
+ /** A buffer has an IrcChannel object only if it is a channel buffer
+ * (i.e. bufferType() == ChannelType), and if it is active at the moment.
+ * \returns A pointer to the associated IrcChannel object, if the buffer is a channel and online; 0 else.
+ */
+ IrcChannel *ircChannel() const;
+
signals:
void userInput(const BufferInfo &, QString);
void nickListChanged(QVariantMap nicks);
void appendMsg(const Message &);
void prependMsg(const Message &);
bool layoutMsg();
+ void setIrcChannel(IrcChannel *chan = 0);
// no longer needed
// void setTopic(QString);
bool _active;
Type _type;
BufferState *state;
+ IrcChannel *_ircChannel;
QList<Message> layoutQueue;
QList<AbstractUiMsg *> layoutedMsgs;
/***************************************************************************
- * Copyright (C) 2005-07 by The Quassel Team *
+ * 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 *
*****************************************/
class BufferTreeItem : public TreeItem {
Q_OBJECT
-
+
public:
BufferTreeItem(Buffer *, TreeItem *parent = 0);
virtual uint id() const;
QVariant data(int column, int role) const;
-
+
Buffer *buffer() const { return buf; }
void setActivity(const Buffer::ActivityLevel &);
-
+
private:
QString text(int column) const;
QColor foreground(int column) const;
-
+
Buffer *buf;
Buffer::ActivityLevel activity;
};
*****************************************/
class NetworkTreeItem : public TreeItem {
Q_OBJECT
-
+
public:
NetworkTreeItem(const uint &netid, const QString &, TreeItem *parent = 0);
virtual QVariant data(int column, int row) const;
virtual uint id() const;
-
+
private:
uint _networkId;
QString net;
*****************************************/
class BufferTreeModel : public TreeModel {
Q_OBJECT
-
+
public:
enum myRoles {
BufferTypeRole = Qt::UserRole,
BufferUidRole,
NetworkIdRole
};
-
+
BufferTreeModel(QObject *parent = 0);
static QList<QVariant> defaultHeader();
static bool mimeContainsBufferList(const QMimeData *mimeData);
static QList< QPair<uint, uint> > mimeDataToBufferList(const QMimeData *mimeData);
-
+
virtual QStringList mimeTypes() const;
virtual QMimeData *mimeData(const QModelIndexList &) const;
virtual bool dropMimeData(const QMimeData *, Qt::DropAction, int, int, const QModelIndex &);
void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
void selectBuffer(Buffer *buffer);
void bufferActivity(Buffer::ActivityLevel, Buffer *buffer);
-
+
signals:
void bufferSelected(Buffer *);
void invalidateFilter();
void selectionChanged(const QModelIndex &);
-
+
private:
bool isBufferIndex(const QModelIndex &) const;
Buffer *getBufferByIndex(const QModelIndex &) const;
}
Client::~Client() {
+
}
void Client::init() {
net->deleteLater();
}
Q_ASSERT(_networkInfo.isEmpty());
-
+
coreConnectionInfo.clear();
sessionData.clear();
layoutQueue.clear();
connect(netinfo, SIGNAL(ircUserInitDone()), this, SLOT(updateCoreConnectionProgress()));
connect(netinfo, SIGNAL(ircChannelInitDone()), this, SLOT(updateCoreConnectionProgress()));
}
+ connect(netinfo, SIGNAL(ircChannelAdded(QString)), this, SLOT(ircChannelAdded(QString)));
connect(netinfo, SIGNAL(destroyed()), this, SLOT(networkInfoDestroyed()));
_networkInfo[netid] = netinfo;
}
//buffer->displayMsg(Message(bufferid, Message::Server, tr("Server disconnected."))); FIXME
buffer->setActive(false);
}
-
+
Q_ASSERT(networkInfo(networkid));
if(!networkInfo(networkid)->initialized()) {
qDebug() << "Network" << networkid << "disconnected while not yet initialized!";
}
}
+void Client::ircChannelAdded(QString chanName) {
+ NetworkInfo *netInfo = qobject_cast<NetworkInfo*>(sender());
+ Q_ASSERT(netInfo);
+ Buffer *buf = buffer(bufferInfo(netInfo->networkName(), chanName));
+ Q_ASSERT(buf);
+ buf->setIrcChannel(netInfo->ircChannel(chanName));
+
+}
+
void Client::updateBufferInfo(BufferInfo id) {
buffer(id)->updateBufferInfo(id);
}
static QList<NetworkInfo *> networkInfos();
static NetworkInfo *networkInfo(uint networkid);
-
+
static QList<BufferInfo> allBufferInfos();
static QList<Buffer *> buffers();
static Buffer *buffer(uint bufferUid);
static void fakeInput(uint bufferUid, QString message);
static void fakeInput(BufferInfo bufferInfo, QString message);
-
+
static void storeSessionData(const QString &key, const QVariant &data);
static QVariant retrieveSessionData(const QString &key, const QVariant &def = QVariant());
static QStringList sessionDataKeys();
void coreConnectionError(QString errorMsg);
void coreConnectionMsg(const QString &msg);
void coreConnectionProgress(uint part, uint total);
-
+
void showConfigWizard(const QVariantMap &coredata);
void connected();
//void connectToLocalCore();
void connectToCore(const QVariantMap &);
void disconnectFromCore();
-
+
void setCoreConfiguration(const QVariantMap &settings);
private slots:
private slots:
void bufferDestroyed();
void networkInfoDestroyed();
+ void ircChannelAdded(QString);
private:
Client(QObject *parent = 0);
virtual ~Client();
void init();
-
+
void syncToCore(const QVariant &coreState);
static QPointer<Client> instanceptr;
-
+
QPointer<QIODevice> socket;
QPointer<SignalProxy> _signalProxy;
QPointer<AbstractUi> mainUi;
quint32 blockSize;
bool connectedToCore;
-
+
QVariantMap coreConnectionInfo;
QHash<uint, Buffer *> _buffers;
QHash<uint, NetworkInfo*> _networkInfo;
#include "nicktreemodel.h"
-NickTreeModel::NickTreeModel(QObject *parent) : TreeModel(QList<QVariant>(), parent) {
+NickTreeModel::NickTreeModel(QObject *parent) : TreeModel(defaultHeader(), parent) {
//QStringList list; list << "test1" << "test2";
//setStringList(list);
}
+
+QList<QVariant> NickTreeModel::defaultHeader() {
+ QList<QVariant> data;
+ data << tr("Nick");
+ return data;
+}
#ifndef _NICKTREEMODEL_H_
#define _NICKTREEMODEL_H_
+#include "ircuser.h"
#include "treemodel.h"
+//! Represents a single IrcUser within a NickTreeModel.
+class NickTreeItem : public TreeItem {
+ Q_OBJECT
+
+ public:
+ NickTreeItem(IrcUser *ircuser, TreeItem *parent = 0);
+
+ virtual QVariant data(int column, int row) const;
+
+ private:
+
+};
+
+//! Represents a group of nicks, such as Ops, Voiced etc.
+class NickTreeGroupItem : public TreeItem {
+ Q_OBJECT
+
+ public:
+ NickTreeGroupItem(const QString &title, TreeItem *parent = 0);
+
+ virtual QVariant data(int column, int row) const;
+
+ private:
+
+};
+
+//! Represents the IrcUsers in a given IrcChannel.
class NickTreeModel : public TreeModel {
Q_OBJECT
NickTreeModel(QObject *parent = 0);
virtual ~NickTreeModel();
+ static QList<QVariant> defaultHeader();
+
private:
};
setObjectName(QString::number(networkInfo->networkId()) + "/" + channelname);
}
+IrcChannel::~IrcChannel() {
+
+}
+
// ====================
// PUBLIC:
// ====================
class IrcChannel : public QObject {
Q_OBJECT
-
+
Q_PROPERTY(QString name READ name STORED false)
Q_PROPERTY(QString topic READ topic WRITE setTopic STORED false)
public:
IrcChannel(const QString &channelname, NetworkInfo *networkInfo);
+ ~IrcChannel();
bool isKnownUser(IrcUser *ircuser) const;
bool isValidChannelUserMode(const QString &mode) const;
QString name() const;
QString topic() const;
-
+
QList<IrcUser *> ircUsers() const;
-
+
QString userMode(IrcUser *ircuser) const;
QString userMode(const QString &nick) const;
void setUserModes(IrcUser *ircuser, const QString &modes);
void setUserModes(const QString &nick, const QString &modes);
-
+
void addUserMode(IrcUser *ircuser, const QString &mode);
void addUserMode(const QString &nick, const QString &mode);
-
+
void removeUserMode(IrcUser *ircuser, const QString &mode);
void removeUserMode(const QString &nick, const QString &mode);
// init seters
void initSetUserModes(const QVariantMap &usermodes);
-
+
void setInitialized();
signals:
void ircUserJoined(IrcUser *ircuser);
void ircUserParted(IrcUser *ircuser);
-
+
void initDone();
private slots:
QString _topic;
QHash<IrcUser *, QString> _userModes;
-
+
NetworkInfo *networkInfo;
};
}
// I think this is unnecessary since IrcUsers have us as their daddy :)
-// NetworkInfo::~NetworkInfo() {
+//NetworkInfo::~NetworkInfo() {
// QHashIterator<QString, IrcUser *> ircuser(_ircUsers);
// while (ircuser.hasNext()) {
// ircuser.next();
// delete ircuser.value();
// }
-// }
+//}
uint NetworkInfo::networkId() const {
return _networkId;
public:
NetworkInfo(const uint &networkid, QObject *parent = 0);
- // virtual ~NetworkInfo();
+ //virtual ~NetworkInfo();
uint networkId() const;
bool initialized() const;
<number>1</number>
</property>
<item>
- <widget class="QListView" name="nickView" />
+ <widget class="NickView" name="nickView" />
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>NickView</class>
+ <extends>QTreeView</extends>
+ <header>nickview.h</header>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections/>
</ui>
--- /dev/null
+/***************************************************************************
+ * 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 "nickview.h"
+
+NickView::NickView(QWidget *parent) : QTreeView(parent) {
+
+
+
+}
+
+NickView::~NickView() {
+
+
+}
+
--- /dev/null
+/***************************************************************************
+ * 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 _NICKVIEW_H_
+#define _NICKVIEW_H_
+
+#include <QTreeView>
+
+class NickView : public QTreeView {
+ Q_OBJECT
+
+ public:
+ NickView(QWidget *parent = 0);
+ virtual ~NickView();
+
+
+
+
+};
+
+#endif
DEPMOD = common client
QT_MOD = core gui network
-SRCS += bufferview.cpp bufferviewfilter.cpp uistyle.cpp
-HDRS += bufferview.h bufferviewfilter.h uistyle.h
+SRCS += bufferview.cpp bufferviewfilter.cpp nickview.cpp uistyle.cpp
+HDRS += bufferview.h bufferviewfilter.h nickview.h uistyle.h
FORMNAMES =