From: Manuel Nickschas Date: Fri, 25 Jul 2008 23:31:12 +0000 (+0200) Subject: Introduce an id string for the views (provided by MessageFilter); allows storing... X-Git-Tag: 0.3.0~154 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=9ce42695baef3bdd6f61aaff23c4b59061e46fe6;hp=5b0af9082dcf0672a98391ac12c6e6bbaaff7a64 Introduce an id string for the views (provided by MessageFilter); allows storing per-view settings --- diff --git a/src/client/messagefilter.cpp b/src/client/messagefilter.cpp index 0c35ee9f..4ee6b16a 100644 --- a/src/client/messagefilter.cpp +++ b/src/client/messagefilter.cpp @@ -28,6 +28,17 @@ MessageFilter::MessageFilter(MessageModel *source, const QList &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; diff --git a/src/client/messagefilter.h b/src/client/messagefilter.h index efabff6e..d07a6e25 100644 --- a/src/client/messagefilter.h +++ b/src/client/messagefilter.h @@ -33,7 +33,7 @@ class MessageFilter : public QSortFilterProxyModel { MessageFilter(MessageModel *, const QList &buffers = QList(), QObject *parent = 0); virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; - + virtual QString idString() const; private: QList _bufferList; diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index 581377d0..2c8ef142 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -30,7 +30,11 @@ 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 &))); diff --git a/src/qtui/chatscene.h b/src/qtui/chatscene.h index a1a32d10..8701f697 100644 --- a/src/qtui/chatscene.h +++ b/src/qtui/chatscene.h @@ -36,7 +36,7 @@ class ChatScene : public QGraphicsScene { Q_OBJECT public: - ChatScene(QAbstractItemModel *model, QObject *parent); + ChatScene(QAbstractItemModel *model, const QString &idString, QObject *parent); virtual ~ChatScene(); Buffer *buffer() const; @@ -56,6 +56,7 @@ class ChatScene : public QGraphicsScene { void rowsInserted(const QModelIndex &, int, int); private: + QString _idString; qreal _width, _height; QAbstractItemModel *_model; QList _lines; diff --git a/src/qtui/chatview.cpp b/src/qtui/chatview.cpp index cc06e6aa..5bc02c57 100644 --- 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); - _scene = new ChatScene(filter, this); + _scene = new ChatScene(filter, filter->idString(), this); connect(_scene, SIGNAL(heightChanged(qreal)), this, SLOT(sceneHeightChanged(qreal))); setScene(_scene); }