projects
/
quassel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5b0af90
)
Introduce an id string for the views (provided by MessageFilter); allows storing...
author
Manuel Nickschas
<sputnick@quassel-irc.org>
Fri, 25 Jul 2008 23:31:12 +0000
(
01:31
+0200)
committer
Manuel Nickschas
<sputnick@quassel-irc.org>
Sat, 2 Aug 2008 13:17:11 +0000
(15:17 +0200)
src/client/messagefilter.cpp
patch
|
blob
|
history
src/client/messagefilter.h
patch
|
blob
|
history
src/qtui/chatscene.cpp
patch
|
blob
|
history
src/qtui/chatscene.h
patch
|
blob
|
history
src/qtui/chatview.cpp
patch
|
blob
|
history
diff --git
a/src/client/messagefilter.cpp
b/src/client/messagefilter.cpp
index
0c35ee9
..
4ee6b16
100644
(file)
--- a/
src/client/messagefilter.cpp
+++ b/
src/client/messagefilter.cpp
@@
-28,6
+28,17
@@
MessageFilter::MessageFilter(MessageModel *source, const QList<BufferId> &buffer
}
}
+QString MessageFilter::idString() const {
+ if(_bufferList.isEmpty()) return "*";
+ QString idstr;
+ QStringList bufids;
+ foreach(BufferId id, _bufferList) bufids << QString(id.toInt());
+ bufids.sort();
+ foreach(QString id, bufids) idstr += id + '|';
+ idstr.chop(1);
+ return idstr;
+}
+
bool MessageFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
Q_UNUSED(sourceParent);
if(_bufferList.isEmpty()) return true;
bool MessageFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
Q_UNUSED(sourceParent);
if(_bufferList.isEmpty()) return true;
diff --git
a/src/client/messagefilter.h
b/src/client/messagefilter.h
index
efabff6
..
d07a6e2
100644
(file)
--- a/
src/client/messagefilter.h
+++ b/
src/client/messagefilter.h
@@
-33,7
+33,7
@@
class MessageFilter : public QSortFilterProxyModel {
MessageFilter(MessageModel *, const QList<BufferId> &buffers = QList<BufferId>(), QObject *parent = 0);
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
MessageFilter(MessageModel *, const QList<BufferId> &buffers = QList<BufferId>(), QObject *parent = 0);
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
-
+ virtual QString idString() const;
private:
QList<BufferId> _bufferList;
private:
QList<BufferId> _bufferList;
diff --git
a/src/qtui/chatscene.cpp
b/src/qtui/chatscene.cpp
index
581377d
..
2c8ef14
100644
(file)
--- a/
src/qtui/chatscene.cpp
+++ b/
src/qtui/chatscene.cpp
@@
-30,7
+30,11
@@
const qreal minContentsWidth = 200;
const qreal minContentsWidth = 200;
-ChatScene::ChatScene(QAbstractItemModel *model, QObject *parent) : QGraphicsScene(parent), _model(model) {
+ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, QObject *parent)
+ : QGraphicsScene(parent),
+ _idString(idString),
+ _model(model)
+{
_width = 0;
connect(this, SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(rectChanged(const QRectF &)));
_width = 0;
connect(this, SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(rectChanged(const QRectF &)));
diff --git
a/src/qtui/chatscene.h
b/src/qtui/chatscene.h
index
a1a32d1
..
8701f69
100644
(file)
--- a/
src/qtui/chatscene.h
+++ b/
src/qtui/chatscene.h
@@
-36,7
+36,7
@@
class ChatScene : public QGraphicsScene {
Q_OBJECT
public:
Q_OBJECT
public:
- ChatScene(QAbstractItemModel *model, QObject *parent);
+ ChatScene(QAbstractItemModel *model,
const QString &idString,
QObject *parent);
virtual ~ChatScene();
Buffer *buffer() const;
virtual ~ChatScene();
Buffer *buffer() const;
@@
-56,6
+56,7
@@
class ChatScene : public QGraphicsScene {
void rowsInserted(const QModelIndex &, int, int);
private:
void rowsInserted(const QModelIndex &, int, int);
private:
+ QString _idString;
qreal _width, _height;
QAbstractItemModel *_model;
QList<ChatLine *> _lines;
qreal _width, _height;
QAbstractItemModel *_model;
QList<ChatLine *> _lines;
diff --git
a/src/qtui/chatview.cpp
b/src/qtui/chatview.cpp
index
cc06e6a
..
5bc02c5
100644
(file)
--- a/
src/qtui/chatview.cpp
+++ b/
src/qtui/chatview.cpp
@@
-38,7
+38,7
@@
ChatView::ChatView(Buffer *buf, QWidget *parent) : QGraphicsView(parent), Abstra
filterList.append(buf->bufferInfo().bufferId());
MessageFilter *filter = new MessageFilter(Client::messageModel(), filterList, this);
filterList.append(buf->bufferInfo().bufferId());
MessageFilter *filter = new MessageFilter(Client::messageModel(), filterList, this);
- _scene = new ChatScene(filter, this);
+ _scene = new ChatScene(filter,
filter->idString(),
this);
connect(_scene, SIGNAL(heightChanged(qreal)), this, SLOT(sceneHeightChanged(qreal)));
setScene(_scene);
}
connect(_scene, SIGNAL(heightChanged(qreal)), this, SLOT(sceneHeightChanged(qreal)));
setScene(_scene);
}