}
+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;
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;
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 &)));
Q_OBJECT
public:
- ChatScene(QAbstractItemModel *model, QObject *parent);
+ ChatScene(QAbstractItemModel *model, const QString &idString, QObject *parent);
virtual ~ChatScene();
Buffer *buffer() const;
void rowsInserted(const QModelIndex &, int, int);
private:
+ QString _idString;
qreal _width, _height;
QAbstractItemModel *_model;
QList<ChatLine *> _lines;
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);
}