From c226406d8da8b9caa5f3e5c08164c2f2a3289a63 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 10 Apr 2008 22:11:47 +0000 Subject: [PATCH] old_crap-- --- dev-notes/ROADMAP | 33 ---- dev-notes/obsolete/nickmodel.cpp | 278 ------------------------------- dev-notes/obsolete/nickmodel.h | 95 ----------- dev-notes/paulk-notes.txt | 14 -- 4 files changed, 420 deletions(-) delete mode 100644 dev-notes/ROADMAP delete mode 100644 dev-notes/obsolete/nickmodel.cpp delete mode 100644 dev-notes/obsolete/nickmodel.h delete mode 100644 dev-notes/paulk-notes.txt diff --git a/dev-notes/ROADMAP b/dev-notes/ROADMAP deleted file mode 100644 index 10a2471d..00000000 --- a/dev-notes/ROADMAP +++ /dev/null @@ -1,33 +0,0 @@ -Preliminary roadmap for Quassel IRC - stuff we need to do before the first public release - -Already Done: -============= - chatwidget state - make signalproxy threadsafe - utf-8 / encodings - externalize SQL-queries, provide migration path... - Buffermodel - -Showstoppers: -============= -WiP: settings dialog -> Sput - serverlist, identities... -> Sput - mode changes in serverhandler -> EgS - make wizard more intuitive (account data, two-step auth) -> Sput - -Open: network settings in DB -> ? - switch to network-IDs (depends on network settings into db) -> ? - remove buffergroups (DB) -> ? - insert buffertype field rein (DB) -> ? - core-user admin, rights management (ACL) -> Sput? - -BUG: multi-user join (should be done while switching to network-IDs) -> ? - -Important: -========== -WiP: shortcuts -> Sput - -Open: save activity-state in core (client reconnect) -- save per-buffer timestamp locally in client -> ? - backlog administration -> ? - fix Activity and get rid of QtGui dep in client - diff --git a/dev-notes/obsolete/nickmodel.cpp b/dev-notes/obsolete/nickmodel.cpp deleted file mode 100644 index efde5128..00000000 --- a/dev-notes/obsolete/nickmodel.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * - * 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) version 3. * - * * - * 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 "nickmodel.h" - -#include "ircchannel.h" -#include "ircuser.h" - -#include - -NickModel::NickModel(IrcChannel *channel, QObject *parent) : QAbstractItemModel(parent) { - // we support 6 categories: q, a, o, h, v and standard - users = QVector >(6); - - if(channel) setIrcChannel(channel); - else _ircChannel = 0; -} - -NickModel::~NickModel() { - - -} - -IrcChannel *NickModel::ircChannel() const { - return _ircChannel; -} - -void NickModel::setIrcChannel(IrcChannel *channel) { - if(_ircChannel) { - disconnect(_ircChannel, 0, this, 0); - } - foreach(QList l, users) l.clear(); - _ircChannel = channel; - reset(); - if(_ircChannel) { - connect(channel, SIGNAL(destroyed()), this, SLOT(setIrcChannel())); - connect(channel, SIGNAL(ircUserJoined(IrcUser *)), this, SLOT(addUser(IrcUser *))); - connect(channel, SIGNAL(ircUserParted(IrcUser *)), this, SLOT(removeUser(IrcUser *))); - connect(channel, SIGNAL(ircUserNickSet(IrcUser *, QString)), this, SLOT(renameUser(IrcUser *))); - connect(channel, SIGNAL(ircUserModesSet(IrcUser *, QString)), this, SLOT(changeUserModes(IrcUser *))); - - foreach(IrcUser *ircuser, channel->ircUsers()) { - // TODO: make this efficient by sorting after everything is appended instead! - addUser(ircuser); - } - } -} - -QVariant NickModel::headerData(int section, Qt::Orientation orientation, int role) const { - if(section == 0 && role == Qt::DisplayRole) { - if(ircChannel()) return ircChannel()->name(); - else return "No channel"; - } - return QAbstractItemModel::headerData(section, orientation, role); -} - -QModelIndex NickModel::index(int row, int column, const QModelIndex &parent) const { - if(!parent.isValid()) { // Top-level item, i.e. a nick category - if(column > 0) return QModelIndex(); - //int r = 0; - //for(int i = 0; i < row; i++) { // we need to skip empty categories - if(row > users.count()) { - qDebug() << "invalid model index!"; - return QModelIndex(); - } - return createIndex(row, column, 0); - } - // Second-level item, i.e. a nick. internalId() contains the parent category (starting at 1). - int cat = parent.row() + 1; - if(row > users[cat-1].count()) { - qDebug() << "invalid model index!"; - return QModelIndex(); - } - return createIndex(row, column, cat); -} - -QModelIndex NickModel::indexOfUser(IrcUser *user) const { - int idx = -1; int cat; - for(cat = users.count()-1; cat >= 0; cat--) { - // we count backwards, since most users will usually be in the last category - idx = users[cat].indexOf(user); - if(idx >=0) break; - } - if(idx < 0) { - qWarning("NickModel: Index of unknown user requested!"); - return QModelIndex(); - } - return createIndex(idx, 0, cat+1); -} - -QModelIndex NickModel::parent(const QModelIndex &index) const { - if(!index.isValid()) return QModelIndex(); - int cat = index.internalId(); - if(cat) return createIndex(cat-1, 0, 0); - else return QModelIndex(); -} - -int NickModel::rowCount(const QModelIndex &parent) const { - if(!parent.isValid()) { - if(!ircChannel()) return 1; // informative text - return users.count(); - } - int cat = parent.internalId(); - if(!cat) { // top-level item (category) - return users[parent.row()].count(); - } - return 0; // second-level items don't have children -} - -int NickModel::columnCount(const QModelIndex &) const { - //if(!ircChannel()) return 0; - return 1; // all our items have exactly one column -} - -QVariant NickModel::data(const QModelIndex &index, int role) const { - if(!index.isValid()) return QVariant(); - if(!ircChannel()) { - // we show one item with informative text - switch(role) { - case Qt::DisplayRole: return tr("Not in channel"); - default: return QVariant(); - } - } - int cat = index.internalId(); - if(!cat) { // top-level item (category) - switch(role) { - case Qt::DisplayRole: { - QString title; - switch(index.row()) { - case 0: title = tr("%n Owner(s)", "", users[index.row()].count()); break; - case 1: title = tr("%n Admin(s)", "", users[index.row()].count()); break; - case 2: title = tr("%n Operator(s)", "", users[index.row()].count()); break; - case 3: title = tr("%n Half-Op(s)", "", users[index.row()].count()); break; - case 4: title = tr("%n Voiced", "", users[index.row()].count()); break; - case 5: title = tr("%n User(s)", "", users[index.row()].count()); break; - default: qDebug() << "invalid model index"; return QVariant(); - } - return title; - } - case SortKeyRole: return index.row(); - default: return QVariant(); - } - } else { - IrcUser *user = users[cat-1][index.row()]; - switch(role) { - case Qt::DisplayRole: - return user->nick(); - case Qt::ToolTipRole: - return user->hostmask(); - case SortKeyRole: - return user->nick(); - default: - return QVariant(); - } - } -} - -int NickModel::userCategory(IrcUser *user) const { - return categoryFromModes(ircChannel()->userModes(user)); -} - -int NickModel::categoryFromModes(const QString &modes) const { - int cat; - // we hardcode this even though we have PREFIX in network... but that wouldn't help with mapping modes to - // category strings anyway. - if(modes.contains('q')) cat = 1; - else if(modes.contains('a')) cat = 2; - else if(modes.contains('o')) cat = 3; - else if(modes.contains('h')) cat = 4; - else if(modes.contains('v')) cat = 5; - else cat = 6; - return cat; -} - -int NickModel::categoryFromIndex(const QModelIndex &index) const { - if(!index.isValid()) return -1; - return index.internalId(); -} - -void NickModel::addUser(IrcUser *user) { - int cat = userCategory(user); - beginInsertRows(createIndex(cat-1, 0, 0), 0, 0); - users[cat-1].prepend(user); - endInsertRows(); -} - -void NickModel::removeUser(IrcUser *user) { - // we don't know for sure which category this user was in, so we have to search - QModelIndex index = indexOfUser(user); - removeUser(index); -} - -void NickModel::removeUser(const QModelIndex &index) { - if(!index.isValid()) return; - beginRemoveRows(index.parent(), index.row(), index.row()); - users[index.internalId()-1].removeAt(index.row()); - endRemoveRows(); -} - -void NickModel::renameUser(IrcUser *user) { //qDebug() << "renaming" << user->nick(); - QModelIndex index = indexOfUser(user); - emit dataChanged(index, index); -} - -void NickModel::changeUserModes(IrcUser *user) { - QModelIndex oldindex = indexOfUser(user); - if(categoryFromIndex(oldindex) == categoryFromModes(ircChannel()->userModes(user))) { - // User is still in same category, no change necessary - emit dataChanged(oldindex, oldindex); - } else { - removeUser(oldindex); - addUser(user); - } -} - -/****************************************************************************************** - * FilteredNickModel - ******************************************************************************************/ - -FilteredNickModel::FilteredNickModel(QObject *parent) : QSortFilterProxyModel(parent) { - setDynamicSortFilter(true); - setSortCaseSensitivity(Qt::CaseInsensitive); - setSortRole(NickModel::SortKeyRole); - -} - -FilteredNickModel::~FilteredNickModel() { - -} - -void FilteredNickModel::setSourceModel(QAbstractItemModel *model) { - QSortFilterProxyModel::setSourceModel(model); - connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(sourceRowsInserted(const QModelIndex &, int, int))); - connect(model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); -} - -// Hide empty categories -bool FilteredNickModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { - if(!source_parent.isValid()) { - QModelIndex index = sourceModel()->index(source_row, 0); - return sourceModel()->rowCount(index); - } - return true; -} - -void FilteredNickModel::sourceRowsInserted(const QModelIndex &index, int start, int end) { - if(!index.isValid()) return; - if(sourceModel()->rowCount(index) <= end - start + 1) { - // category no longer empty - invalidateFilter(); - } -} - -void FilteredNickModel::sourceRowsRemoved(const QModelIndex &index, int, int) { - if(!index.isValid()) return; - if(sourceModel()->rowCount(index) == 0) { - // category is now empty! - invalidateFilter(); - } -} - diff --git a/dev-notes/obsolete/nickmodel.h b/dev-notes/obsolete/nickmodel.h deleted file mode 100644 index 4baa1117..00000000 --- a/dev-notes/obsolete/nickmodel.h +++ /dev/null @@ -1,95 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * - * 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) version 3. * - * * - * 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 _NICKMODEL_H_ -#define _NICKMODEL_H_ - -#include -#include -#include - -class IrcChannel; -class IrcUser; - -//! Represents the IrcUsers in a given IrcChannel. -/** This model is a wrapper around the nicks/IrcUsers stored in an IrcChannel. It provides a tree with two, - * levels, where the top-level items are the categories (such as Ops, Voiced etc), and the second-level items - * the actual nicks/users. Several roles are provided to access information about a nick. - * - * Note that the nicks are not sorted in any way. Use a FilteredNickModel instead. - */ -class NickModel : public QAbstractItemModel { - Q_OBJECT - - public: - enum NickModelRole { SortKeyRole = Qt::UserRole }; - - NickModel(IrcChannel *channel = 0, QObject *parent = 0); - virtual ~NickModel(); - - virtual QModelIndex index(int row, int col, const QModelIndex &parent) const; - virtual QModelIndex parent(const QModelIndex &index) const; - virtual int rowCount(const QModelIndex &) const; - virtual int columnCount(const QModelIndex &) const; - virtual QVariant data(const QModelIndex &, int role) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - - IrcChannel *ircChannel() const; - - QModelIndex indexOfUser(IrcUser *) const; - int categoryFromModes(const QString &modes) const; - int categoryFromIndex(const QModelIndex &index) const; - int userCategory(IrcUser *) const; - - public slots: - void setIrcChannel(IrcChannel *chan = 0); - void addUser(IrcUser *); - void removeUser(IrcUser *); - void removeUser(const QModelIndex &); - void renameUser(IrcUser *); - void changeUserModes(IrcUser *); - - private: - - IrcChannel *_ircChannel; - QVector > users; - -}; - -//! This ProxyModel can be used on top of a NickModel in order to provide a sorted nicklist and to hide unused categories. -class FilteredNickModel : public QSortFilterProxyModel { - Q_OBJECT - - public: - FilteredNickModel(QObject *parent = 0); - virtual ~FilteredNickModel(); - - virtual void setSourceModel(QAbstractItemModel *model); - - private slots: - void sourceRowsInserted(const QModelIndex &, int, int); - void sourceRowsRemoved(const QModelIndex &, int, int); - - protected: - virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; - -}; - -#endif diff --git a/dev-notes/paulk-notes.txt b/dev-notes/paulk-notes.txt deleted file mode 100644 index 6c5cb0f9..00000000 --- a/dev-notes/paulk-notes.txt +++ /dev/null @@ -1,14 +0,0 @@ - was macht der button neben dem topic-edit? - widget starten: topic editieren, channelmodes einstellen - ah, und soll man das topic auch direkt durch tippen in der zeile ändern können? - also channel settings - ja, soll man - oder soll das nicht-editierbar sein? - ok - channelmodes aber nicht direkt anzeigen - und wenn man editiert und kein enter drückt, dann timed das editing nach zwei minuten aus und zeigt wieder das derzeitig echt gesetzte topic. - ooooooook - merk dir das mal bis ich soweit bin in ein paar wochen :) -* QuAd|Haudrauf hat das bei x-chat angestunken - -test \ No newline at end of file -- 2.20.1