From: Marcus Eggenberger Date: Mon, 28 Jan 2008 15:40:27 +0000 (+0000) Subject: - Made BufferId, NetworkId and BufferInfo available from all childs of BufferItems... X-Git-Tag: 0.2.0-alpha1~187 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=bf9530ddf0b227b6737e9cc672d40a703516c7ea - Made BufferId, NetworkId and BufferInfo available from all childs of BufferItems and below. - some cleanup in Client --- diff --git a/src/client/client.cpp b/src/client/client.cpp index cedc0422..e7ddd7f1 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -249,11 +249,7 @@ void Client::fakeInput(BufferId bufferUid, QString message) { if(!buff) qWarning() << "No Buffer with uid" << bufferUid << "can't send Input" << message; else - emit instance()->sendInput(buff->bufferInfo(), message); -} - -void Client::fakeInput(BufferInfo bufferInfo, QString message) { - fakeInput(bufferInfo, message); + instance()->userInput(buff->bufferInfo(), message); } /*** core connection stuff ***/ diff --git a/src/client/client.h b/src/client/client.h index 32ae3a92..c1567642 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -98,7 +98,6 @@ public: static bool isSynced(); static void fakeInput(BufferId 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()); diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 4f4603dd..f2fc6da3 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -368,6 +368,22 @@ int UserCategoryItem::categoryFromModes(const QString &modes) { } return categories.count(); } + +QVariant UserCategoryItem::data(int column, int role) const { + switch(role) { + case NetworkModel::ItemTypeRole: + return NetworkModel::UserCategoryItemType; + case NetworkModel::BufferIdRole: + return parent()->data(column, role); + case NetworkModel::NetworkIdRole: + return parent()->data(column, role); + case NetworkModel::BufferInfoRole: + return parent()->data(column, role); + default: + return PropertyMapItem::data(column, role); + } +} + /***************************************** * Irc User Items @@ -396,9 +412,22 @@ quint64 IrcUserItem::id() const { } QVariant IrcUserItem::data(int column, int role) const { - if(role != Qt::ToolTipRole) + switch(role) { + case NetworkModel::ItemTypeRole: + return NetworkModel::IrcUserItemType; + case NetworkModel::BufferIdRole: + return parent()->data(column, role); + case NetworkModel::NetworkIdRole: + return parent()->data(column, role); + case NetworkModel::BufferInfoRole: + return parent()->data(column, role); + default: return PropertyMapItem::data(column, role); + } +} +QString IrcUserItem::toolTip(int column) const { + Q_UNUSED(column); return "

" + nickName() + "
" + _ircUser->hostmask() + "

"; } diff --git a/src/client/networkmodel.h b/src/client/networkmodel.h index dfea333c..82136484 100644 --- a/src/client/networkmodel.h +++ b/src/client/networkmodel.h @@ -116,8 +116,8 @@ class NetworkItem : public PropertyMapItem { public: NetworkItem(const NetworkId &netid, AbstractTreeItem *parent = 0); - virtual QVariant data(int column, int row) const; virtual quint64 id() const; + virtual QVariant data(int column, int row) const; bool isActive() const; @@ -150,7 +150,8 @@ public: QString categoryId(); virtual quint64 id() const; - + virtual QVariant data(int column, int role) const; + void addUser(IrcUser *ircUser); static int categoryFromModes(const QString &modes); @@ -180,9 +181,9 @@ public: QString nickName() const; IrcUser *ircUser(); virtual quint64 id() const; - virtual QVariant data(int column, int role) const; - + virtual QString toolTip(int column) const; + private slots: void setNick(QString newNick); @@ -208,11 +209,10 @@ public: }; enum itemTypes { - AbstractItemType, - SimpleItemType, NetworkItemType, BufferItemType, - NickItemType + UserCategoryItemType, + IrcUserItemType }; NetworkModel(QObject *parent = 0); diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index dd06446a..f40fa7d5 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -247,10 +247,18 @@ PropertyMapItem::~PropertyMapItem() { } QVariant PropertyMapItem::data(int column, int role) const { - if(column >= columnCount() || role != Qt::DisplayRole) + if(column >= columnCount()) return QVariant(); - return property(_propertyOrder[column].toAscii()); + switch(role) { + case Qt::ToolTipRole: + return toolTip(column); + case Qt::DisplayRole: + return property(_propertyOrder[column].toAscii()); + default: + return QVariant(); + } + } bool PropertyMapItem::setData(int column, const QVariant &value, int role) { diff --git a/src/client/treemodel.h b/src/client/treemodel.h index 5ff823ac..2b77c5b2 100644 --- a/src/client/treemodel.h +++ b/src/client/treemodel.h @@ -125,6 +125,7 @@ public: virtual QVariant data(int column, int role) const; virtual bool setData(int column, const QVariant &value, int role); + virtual QString toolTip(int column) const { Q_UNUSED(column) return QString(); } virtual int columnCount() const; void appendProperty(const QString &property); diff --git a/src/qtui/inputwidget.cpp b/src/qtui/inputwidget.cpp index af6d25a0..c1086287 100644 --- a/src/qtui/inputwidget.cpp +++ b/src/qtui/inputwidget.cpp @@ -34,7 +34,7 @@ InputWidget::InputWidget(QWidget *parent) ui.setupUi(this); connect(ui.inputEdit, SIGNAL(returnPressed()), this, SLOT(enterPressed())); connect(ui.ownNick, SIGNAL(activated(QString)), this, SLOT(changeNick(QString))); - connect(this, SIGNAL(userInput(BufferInfo, QString)), Client::instance(), SLOT(userInput(BufferInfo, QString))); + connect(this, SIGNAL(userInput(BufferInfo, QString)), Client::instance(), SIGNAL(sendInput(BufferInfo, QString))); setFocusProxy(ui.inputEdit); } diff --git a/version.inc b/version.inc index 2e7baf67..6d99efc8 100644 --- a/version.inc +++ b/version.inc @@ -5,7 +5,7 @@ quasselVersion = "0.2.0-pre"; quasselDate = "2008-01-28"; - quasselBuild = 391; + quasselBuild = 393; //! Minimum client build number the core needs clientBuildNeeded = 358;