}
quint64 BufferItem::id() const {
- return bufferInfo().bufferId().toInt();
+ return qHash(bufferInfo().bufferId());
}
bool BufferItem::isStatusBuffer() const {
}
quint64 NetworkItem::id() const {
- return _networkId.toInt();
+ return qHash(_networkId);
}
void NetworkItem::setActive(bool connected) {
}
QString IrcUserItem::nickName() const {
- return _ircUser->nick();
+ if(_ircUser)
+ return _ircUser->nick();
+ else
+ return QString();
+}
+
+bool IrcUserItem::isActive() const {
+ if(_ircUser)
+ return !_ircUser->isAway();
+ else
+ return false;
}
IrcUser *IrcUserItem::ircUser() {
}
quint64 IrcUserItem::id() const {
- return (quint64)_ircUser;
+ return qHash((IrcUser *)_ircUser);
}
QVariant IrcUserItem::data(int column, int role) const {
switch(role) {
case NetworkModel::ItemActiveRole:
- return !_ircUser->isAway();
+ return isActive();
case NetworkModel::ItemTypeRole:
return NetworkModel::IrcUserItemType;
case NetworkModel::BufferIdRole:
IrcUserItem(IrcUser *ircUser, AbstractTreeItem *parent);
QString nickName() const;
+ bool isActive() const;
+
IrcUser *ircUser();
virtual quint64 id() const;
virtual QVariant data(int column, int role) const;
void setNick(QString newNick);
private:
- IrcUser *_ircUser;
+ QPointer<IrcUser> _ircUser;
};
{
rootItem = new SimpleTreeItem(data, 0);
connectItem(rootItem);
+
+ /*
+ connect(this, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)),
+ this, SLOT(debug_rowsAboutToBeInserted(const QModelIndex &, int, int)));
+ connect(this, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
+ this, SLOT(debug_rowsAboutToBeRemoved(const QModelIndex &, int, int)));
+ connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
+ this, SLOT(debug_rowsInserted(const QModelIndex &, int, int)));
+ connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
+ this, SLOT(debug_rowsRemoved(const QModelIndex &, int, int)));
+ */
}
TreeModel::~TreeModel() {
void TreeModel::clear() {
rootItem->removeAllChilds();
}
+
+void TreeModel::debug_rowsAboutToBeInserted(const QModelIndex &parent, int start, int end) {
+ qDebug() << "debug_rowsAboutToBeInserted" << parent << parent.internalPointer() << parent.data().toString() << rowCount(parent) << start << end;
+}
+
+void TreeModel::debug_rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) {
+ qDebug() << "debug_rowsAboutToBeRemoved" << parent << parent.internalPointer() << parent.data().toString() << rowCount(parent) << start << end;
+ QModelIndex child;
+ for(int i = start; i <= end; i++) {
+ child = parent.child(i, 0);
+ qDebug() << " " << child << child.data().toString(); // << static_cast<AbstractTreeItem *>(parent.child(i, 0).internalPointer())->id();
+ }
+}
+
+void TreeModel::debug_rowsInserted(const QModelIndex &parent, int start, int end) {
+ qDebug() << "debug_rowsInserted" << parent << parent.internalPointer() << parent.data().toString() << rowCount(parent) << start << end;
+ QModelIndex child;
+ for(int i = start; i <= end; i++) {
+ child = parent.child(i, 0);
+ qDebug() << " " << child << child.data().toString(); // << static_cast<AbstractTreeItem *>(parent.child(i, 0).internalPointer())->id();
+ }
+}
+
+void TreeModel::debug_rowsRemoved(const QModelIndex &parent, int start, int end) {
+ qDebug() << "debug_rowsRemoved" << parent << parent.internalPointer() << parent.data().toString() << rowCount(parent) << start << end;
+}
};
ChildStatus _childStatus;
int _aboutToRemoveOrInsert;
- // QLinkedList<ChildStatus> _childStatus;
+private slots:
+ void debug_rowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
+ void debug_rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
+ void debug_rowsInserted(const QModelIndex &parent, int start, int end);
+ void debug_rowsRemoved(const QModelIndex &parent, int start, int end);
};
#endif
//qDebug() << "PART" << name() << ircuser->nick() << ircUsers().count();
// if you wonder why there is no counterpart to ircUserParted:
// the joines are propagted by the ircuser. the signal ircUserParted is only for convenience
+ disconnect(ircuser, 0, this, 0);
emit ircUserParted(ircuser);
if(network->isMe(ircuser))
deleteLater();
}
void IrcChannel::ircUserDestroyed() {
+ qDebug() << "IrcChannel::ircUserDestroyed()";
IrcUser *ircUser = static_cast<IrcUser *>(sender());
Q_ASSERT(ircUser);
_userModes.remove(ircUser);
}
IrcUser::~IrcUser() {
- //qDebug() << nick() << "destroyed.";
+ QList<IrcChannel *> channels = _channels.toList();
+ foreach(IrcChannel *channel, channels) {
+ partChannel(channel);
+ }
}
// ====================
return;
_ircUsers.remove(nick);
+ disconnect(ircuser, 0, this, 0);
emit ircUserRemoved(nick);
emit ircUserRemoved(ircuser);
ircuser->deleteLater();
quasselVersion = "0.2.0-pre";
quasselDate = "2008-02-04";
- quasselBuild = 455;
+ quasselBuild = 456;
//! Minimum client build number the core needs
- clientBuildNeeded = 437;
+ clientBuildNeeded = 456;
clientVersionNeeded = quasselVersion;
//! Minimum core build number the client needs
- coreBuildNeeded = 437;
+ coreBuildNeeded = 456;
coreVersionNeeded = quasselVersion;
}