From: Manuel Nickschas Date: Tue, 27 Nov 2007 00:04:44 +0000 (+0000) Subject: The nicklist is back! We now have a NickModel that can be attached to an IrcChannel X-Git-Tag: 0.1.0~64 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=e671e9da1edaab37ec403f575979f9a92a766e9a The nicklist is back! We now have a NickModel that can be attached to an IrcChannel and that provides access to the nicks in that channel. We also have a NickListWidget, that encapsulates a stack of NickViews (which are not-yet-fancy QTreeViews). There are still some things missing, nicks are not sorted yet and the output will be improved as well. But we can see nicks again, yay ;-) --- diff --git a/Quassel.kdevelop.filelist b/Quassel.kdevelop.filelist index 31f21d0a..8defbdb3 100644 --- a/Quassel.kdevelop.filelist +++ b/Quassel.kdevelop.filelist @@ -155,6 +155,8 @@ src/qtui/identities.cpp src/qtui/identities.h src/qtui/mainwin.cpp src/qtui/mainwin.h +src/qtui/nicklistwidget.cpp +src/qtui/nicklistwidget.h src/qtui/qtui.cpp src/qtui/qtui.h src/qtui/qtui.pri diff --git a/src/client/buffer.cpp b/src/client/buffer.cpp index 304d9ecb..023263bb 100644 --- a/src/client/buffer.cpp +++ b/src/client/buffer.cpp @@ -23,6 +23,7 @@ #include "client.h" #include "ircchannel.h" +#include "nickmodel.h" #include "util.h" @@ -30,7 +31,7 @@ Buffer::Buffer(BufferInfo bufferid, QObject *parent) : QObject(parent), _bufferInfo(bufferid), _active(false), - _ircChannel(0) + _ircChannel(0), _nickModel(0) { if(bufferid.buffer().isEmpty()) _type = StatusType; @@ -39,6 +40,7 @@ Buffer::Buffer(BufferInfo bufferid, QObject *parent) else _type = QueryType; + _nickModel = new NickModel(0, this); /* QSettings s; s.beginGroup(QString("GUI/BufferStates/%1/%2").arg(netname).arg(bufname)); @@ -149,6 +151,10 @@ void Buffer::processUserInput(QString msg) { emit userInput(_bufferInfo, msg); } +NickModel *Buffer::nickModel() const { + return _nickModel; +} + IrcChannel *Buffer::ircChannel() const { return _ircChannel; } @@ -156,12 +162,12 @@ IrcChannel *Buffer::ircChannel() const { 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())); } + _nickModel->setIrcChannel(ircChannel()); } // no longer needed diff --git a/src/client/buffer.h b/src/client/buffer.h index fcf28050..746ba3da 100644 --- a/src/client/buffer.h +++ b/src/client/buffer.h @@ -23,6 +23,7 @@ class AbstractUiMsg; class IrcChannel; +class NickModel; struct BufferState; @@ -80,6 +81,7 @@ public: * \returns A pointer to the associated IrcChannel object, if the buffer is a channel and online; 0 else. */ IrcChannel *ircChannel() const; + NickModel *nickModel() const; signals: void userInput(const BufferInfo &, QString); @@ -115,7 +117,8 @@ private: bool _active; Type _type; BufferState *state; - IrcChannel *_ircChannel; + QPointer _ircChannel; + QPointer _nickModel; QList layoutQueue; QList layoutedMsgs; diff --git a/src/client/nickmodel.cpp b/src/client/nickmodel.cpp index ad1884ca..d7e4248c 100644 --- a/src/client/nickmodel.cpp +++ b/src/client/nickmodel.cpp @@ -21,12 +21,16 @@ #include "nickmodel.h" #include "ircchannel.h" +#include "ircuser.h" +#include -NickModel::NickModel(IrcChannel *channel) : QAbstractItemModel(channel) { - //QStringList list; list << "test1" << "test2"; - //setStringList(list); +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() { @@ -34,3 +38,189 @@ 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(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) + if(role == 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; + } else return QVariant(); + } else { + IrcUser *user = users[cat-1][index.row()]; + switch(role) { + case Qt::DisplayRole: + 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 networkinfo... 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) { + 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); + } +} + + diff --git a/src/client/nickmodel.h b/src/client/nickmodel.h index 313c6781..b49ebf1d 100644 --- a/src/client/nickmodel.h +++ b/src/client/nickmodel.h @@ -22,47 +22,51 @@ #define _NICKMODEL_H_ #include +#include class IrcChannel; +class IrcUser; -/* -//! Represents a single IrcUser within a NickTreeModel. -class NickTreeItem : public TreeItem { +//! 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 QSortFilterProxyModel to do that instead. + */ +class NickModel : public QAbstractItemModel { Q_OBJECT public: - NickTreeItem(IrcUser *ircuser, TreeItem *parent = 0); - - //virtual QVariant data(int column, int row) const; - - private: + 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; -//! Represents a group of nicks, such as Ops, Voiced etc. -class NickTreeGroupItem : public TreeItem { - Q_OBJECT + IrcChannel *ircChannel() const; - public: - NickTreeGroupItem(const QString &title, TreeItem *parent = 0); + QModelIndex indexOfUser(IrcUser *) const; + int categoryFromModes(const QString &modes) const; + int categoryFromIndex(const QModelIndex &index) const; + int userCategory(IrcUser *) const; - //virtual QVariant data(int column, int row) const; + public slots: + void setIrcChannel(IrcChannel *); + void addUser(IrcUser *); + void removeUser(IrcUser *); + void removeUser(const QModelIndex &); + void renameUser(IrcUser *); + void changeUserModes(IrcUser *); private: -}; -*/ - -//! Represents the IrcUsers in a given IrcChannel. -class NickModel : public QAbstractItemModel { - Q_OBJECT - - public: - NickModel(IrcChannel *); - virtual ~NickModel(); - - private: - + IrcChannel *_ircChannel; + QVector > users; }; diff --git a/src/common/ircchannel.cpp b/src/common/ircchannel.cpp index 412ad2ad..c669d1f0 100644 --- a/src/common/ircchannel.cpp +++ b/src/common/ircchannel.cpp @@ -89,15 +89,15 @@ QList IrcChannel::ircUsers() const { return _userModes.keys(); } -QString IrcChannel::userMode(IrcUser *ircuser) const { +QString IrcChannel::userModes(IrcUser *ircuser) const { if(_userModes.contains(ircuser)) return _userModes[ircuser]; else return QString(); } -QString IrcChannel::userMode(const QString &nick) const { - return userMode(networkInfo->ircUser(nick)); +QString IrcChannel::userModes(const QString &nick) const { + return userModes(networkInfo->ircUser(nick)); } // ==================== @@ -143,7 +143,7 @@ void IrcChannel::setUserModes(IrcUser *ircuser, const QString &modes) { if(isKnownUser(ircuser)) { _userModes[ircuser] = modes; emit userModesSet(ircuser->nick(), modes); - emit userModesSet(ircuser, modes); + emit ircUserModesSet(ircuser, modes); } } @@ -155,11 +155,11 @@ void IrcChannel::setUserModes(const QString &nick, const QString &modes) { void IrcChannel::addUserMode(IrcUser *ircuser, const QString &mode) { if(!isKnownUser(ircuser) || !isValidChannelUserMode(mode)) return; - + if(!_userModes[ircuser].contains(mode)) { _userModes[ircuser] += mode; emit userModeAdded(ircuser->nick(), mode); - emit userModeAdded(ircuser, mode); + emit ircUserModeAdded(ircuser, mode); } } @@ -169,14 +169,14 @@ void IrcChannel::addUserMode(const QString &nick, const QString &mode) { } // REMOVE USER MODE -void IrcChannel::removeUserMode(IrcUser *ircuser, const QString &mode) { qDebug() << "remove mode:" << ircuser->nick() << mode; +void IrcChannel::removeUserMode(IrcUser *ircuser, const QString &mode) { if(!isKnownUser(ircuser) || !isValidChannelUserMode(mode)) return; if(_userModes[ircuser].contains(mode)) { _userModes[ircuser].remove(mode); emit userModeRemoved(ircuser->nick(), mode); - emit userModeRemoved(ircuser, mode); + emit ircUserModeRemoved(ircuser, mode); } } diff --git a/src/common/ircchannel.h b/src/common/ircchannel.h index 53fc9343..c66bf2b0 100644 --- a/src/common/ircchannel.h +++ b/src/common/ircchannel.h @@ -50,8 +50,8 @@ public: QList ircUsers() const; - QString userMode(IrcUser *ircuser) const; - QString userMode(const QString &nick) const; + QString userModes(IrcUser *ircuser) const; + QString userModes(const QString &nick) const; public slots: void setTopic(const QString &topic); @@ -82,15 +82,18 @@ public slots: signals: void topicSet(QString topic); void userModesSet(QString nick, QString modes); - void userModesSet(IrcUser *ircuser, QString modes); + //void userModesSet(IrcUser *ircuser, QString modes); void userModeAdded(QString nick, QString mode); - void userModeAdded(IrcUser *ircuser, QString mode); + //void userModeAdded(IrcUser *ircuser, QString mode); void userModeRemoved(QString nick, QString mode); - void userModeRemoved(IrcUser *ircuser, QString mode); + //void userModeRemoved(IrcUser *ircuser, QString mode); void ircUserJoined(IrcUser *ircuser); void ircUserParted(IrcUser *ircuser); void ircUserNickSet(IrcUser *ircuser, QString nick); + void ircUserModeAdded(IrcUser *ircuser, QString mode); + void ircUserModeRemoved(IrcUser *ircuser, QString mode); + void ircUserModesSet(IrcUser *ircuser, QString modes); void initDone(); diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 4bd2c96f..e8f515fd 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -24,6 +24,7 @@ #include "chatline-old.h" #include "client.h" #include "coreconnectdlg.h" +#include "nicklistwidget.h" #include "serverlist.h" #include "settingsdlg.h" //#include "settingspage.h" @@ -68,6 +69,18 @@ void MainWin::init() { setupMenus(); setupViews(); + // create nick dock + nickDock = new QDockWidget("Nicks", this); + nickDock->setObjectName("NickDock"); + nickDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); + + nickListWidget = new NickListWidget(nickDock); + nickDock->setWidget(nickListWidget); + + addDockWidget(Qt::RightDockWidgetArea, nickDock); + ui.menuViews->addAction(nickDock->toggleViewAction()); + + // restore mainwin state QSettings s; s.beginGroup("Geometry"); //resize(s.value("MainWinSize", QSize(500, 400)).toSize()); @@ -139,9 +152,6 @@ void MainWin::setupMenus() { connect(ui.actionSettingsDlg, SIGNAL(triggered()), this, SLOT(showSettingsDlg())); ui.actionSettingsDlg->setEnabled(false); connect(ui.actionAboutQt, SIGNAL(triggered()), QApplication::instance(), SLOT(aboutQt())); - // for debugging - connect(ui.actionImportBacklog, SIGNAL(triggered()), this, SLOT(importBacklog())); - Client::signalProxy()->attachSignal(this, SIGNAL(importOldBacklog())); } void MainWin::setupViews() { @@ -259,15 +269,9 @@ void MainWin::showBuffer(Buffer *b) { currentBuffer = b->bufferInfo().groupId(); //emit bufferSelected(b); //qApp->processEvents(); - ui.bufferWidget->setBuffer(b); + nickListWidget->setBuffer(b); + //if(b->bufferType() == Buffer::ChannelType) nickDock->show(); + //else nickDock->hide(); //emit bufferSelected(b); } - -void MainWin::importBacklog() { - if(QMessageBox::warning(this, "Import old backlog?", "Do you want to import your old file-based backlog into new the backlog database?
" - "This will permanently delete the contents of your database!", - QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes) { - emit importOldBacklog(); - } -} diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index d8416304..1689ee61 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -32,6 +32,7 @@ class Buffer; class SettingsDlg; class QtUi; class Message; +class NickListWidget; //!\brief The main window of Quassel's QtUi. class MainWin : public QMainWindow { @@ -63,13 +64,10 @@ class MainWin : public QMainWindow { void showBuffer(BufferInfo); void showBuffer(Buffer *); - void importBacklog(); - signals: void connectToCore(const QVariantMap &connInfo); void disconnectFromCore(); void requestBacklog(BufferInfo, QVariant, QVariant); - void importOldBacklog(); private: Ui::MainWin ui; @@ -91,6 +89,8 @@ class MainWin : public QMainWindow { QString currentProfile; QList netViews; + QDockWidget *nickDock; + NickListWidget *nickListWidget; friend class QtUi; }; diff --git a/src/qtui/nicklistwidget.cpp b/src/qtui/nicklistwidget.cpp new file mode 100644 index 00000000..a7a78dec --- /dev/null +++ b/src/qtui/nicklistwidget.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + * 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 "nicklistwidget.h" + +#include "buffer.h" +#include "nickview.h" + +NickListWidget::NickListWidget(QWidget *parent) : QWidget(parent) { + ui.setupUi(this); + +} + +void NickListWidget::setBuffer(Buffer *buf) { + if(buf->bufferType() != Buffer::ChannelType) { + ui.stackedWidget->setCurrentWidget(ui.emptyPage); + } else { + if(nickViews.contains(buf)) { + ui.stackedWidget->setCurrentWidget(nickViews.value(buf)); + } else { + NickView *view = new NickView(this); + view->setModel(buf->nickModel()); + nickViews[buf] = view; + ui.stackedWidget->addWidget(view); + ui.stackedWidget->setCurrentWidget(view); + } + } +} diff --git a/src/qtui/nicklistwidget.h b/src/qtui/nicklistwidget.h new file mode 100644 index 00000000..579d8fbf --- /dev/null +++ b/src/qtui/nicklistwidget.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * 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 _NICKLISTWIDGET_H_ +#define _NICKLISTWIDGET_H_ + +#include "ui_nicklistwidget.h" + +#include + +class Buffer; +class NickView; + +class NickListWidget : public QWidget { + Q_OBJECT + + public: + NickListWidget(QWidget *parent = 0); + + public slots: + void setBuffer(Buffer *); + + private: + Ui::NickListWidget ui; + QHash nickViews; + +}; + +#endif diff --git a/src/qtui/qtui.pri b/src/qtui/qtui.pri index cee2fad0..4698119e 100644 --- a/src/qtui/qtui.pri +++ b/src/qtui/qtui.pri @@ -3,13 +3,15 @@ QT_MOD = core gui network SRCS += bufferwidget.cpp channelwidgetinput.cpp chatline-old.cpp \ chatwidget.cpp coreconnectdlg.cpp configwizard.cpp \ - guisettings.cpp identities.cpp mainwin.cpp qtui.cpp qtuistyle.cpp serverlist.cpp settingsdlg.cpp tabcompleter.cpp topicwidget.cpp + guisettings.cpp identities.cpp mainwin.cpp nicklistwidget.cpp qtui.cpp qtuistyle.cpp serverlist.cpp settingsdlg.cpp \ + tabcompleter.cpp topicwidget.cpp HDRS += bufferwidget.h channelwidgetinput.h chatline-old.h chatwidget.h configwizard.h \ - coreconnectdlg.h guisettings.h identities.h mainwin.h qtui.h qtuistyle.h serverlist.h settingsdlg.h settingspage.h tabcompleter.h topicwidget.h + coreconnectdlg.h guisettings.h identities.h mainwin.h nicklistwidget.h qtui.h qtuistyle.h serverlist.h settingsdlg.h \ + settingspage.h tabcompleter.h topicwidget.h FORMNAMES = identitiesdlg.ui identitieseditdlg.ui networkeditdlg.ui mainwin.ui nickeditdlg.ui serverlistdlg.ui \ - servereditdlg.ui coreconnectdlg.ui bufferviewwidget.ui bufferwidget.ui settingsdlg.ui \ + servereditdlg.ui coreconnectdlg.ui bufferviewwidget.ui bufferwidget.ui nicklistwidget.ui settingsdlg.ui \ buffermgmtpage.ui connectionpage.ui usermgmtpage.ui topicwidget.ui for(ui, FORMNAMES) { diff --git a/src/qtui/ui/mainwin.ui b/src/qtui/ui/mainwin.ui index 794f50c0..e96cbb66 100644 --- a/src/qtui/ui/mainwin.ui +++ b/src/qtui/ui/mainwin.ui @@ -46,7 +46,7 @@ 0 0 800 - 22 + 28 @@ -96,7 +96,6 @@ Debug - diff --git a/src/qtui/ui/nicklistwidget.ui b/src/qtui/ui/nicklistwidget.ui new file mode 100644 index 00000000..31a0edcc --- /dev/null +++ b/src/qtui/ui/nicklistwidget.ui @@ -0,0 +1,52 @@ + + NickListWidget + + + + 0 + 0 + 94 + 223 + + + + + 0 + 0 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + 0 + + + + + + + + + diff --git a/src/uisupport/nickview.cpp b/src/uisupport/nickview.cpp index 7d9545cd..26a345df 100644 --- a/src/uisupport/nickview.cpp +++ b/src/uisupport/nickview.cpp @@ -19,9 +19,12 @@ ***************************************************************************/ #include "nickview.h" +#include "nickmodel.h" -NickView::NickView(QWidget *parent) : QTreeView(parent) { +NickView::NickView(QWidget *parent) : QTreeView(parent) { + setGeometry(0, 0, 30, 30); + //setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); } @@ -31,3 +34,6 @@ NickView::~NickView() { } +void NickView::setModel(NickModel *model) { + QTreeView::setModel(model); +} diff --git a/src/uisupport/nickview.h b/src/uisupport/nickview.h index 33effda4..25a6b3e3 100644 --- a/src/uisupport/nickview.h +++ b/src/uisupport/nickview.h @@ -23,6 +23,8 @@ #include +class NickModel; + class NickView : public QTreeView { Q_OBJECT @@ -30,6 +32,8 @@ class NickView : public QTreeView { NickView(QWidget *parent = 0); virtual ~NickView(); + public slots: + void setModel(NickModel *model);