#include "messagefilter.h"
+MessageFilter::MessageFilter(QAbstractItemModel *source, QObject *parent) : QSortFilterProxyModel(parent) {
+ setSourceModel(source);
+}
+
MessageFilter::MessageFilter(MessageModel *source, const QList<BufferId> &buffers, QObject *parent)
: QSortFilterProxyModel(parent),
_bufferList(buffers)
class MessageFilter : public QSortFilterProxyModel {
Q_OBJECT
+ protected:
+ MessageFilter(QAbstractItemModel *source, QObject *parent = 0);
+
public:
MessageFilter(MessageModel *, const QList<BufferId> &buffers = QList<BufferId>(), QObject *parent = 0);
chatline.cpp
chatlinemodel.cpp
chatlinemodelitem.cpp
+ chatmonitorfilter.cpp
chatscene.cpp
chatview.cpp
columnhandleitem.cpp
bufferwidget.h
channellistdlg.h
chatlinemodel.h
+ chatmonitorfilter.h
chatscene.h
chatview.h
columnhandleitem.h
--- /dev/null
+/***************************************************************************
+* Copyright (C) 2005-08 by the Quassel Project *
+* 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) version 3. *
+* *
+* 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 "chatmonitorfilter.h"
+
+ChatMonitorFilter::ChatMonitorFilter(MessageModel *model, QObject *parent)
+: MessageFilter(model, QList<BufferId>(), parent)
+{
+ _initTime = QDateTime::currentDateTime();
+
+}
+
+bool ChatMonitorFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
+ QDateTime msgTime = sourceModel()->data(sourceModel()->index(sourceRow, 0), MessageModel::TimestampRole).toDateTime();
+ return msgTime > _initTime;
+}
+
+QString ChatMonitorFilter::idString() const {
+ return "ChatMonitor";
+}
--- /dev/null
+/***************************************************************************
+* Copyright (C) 2005-08 by the Quassel Project *
+* 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) version 3. *
+* *
+* 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 CHATMONITORFILTER_H_
+#define CHATMONITORFILTER_H_
+
+#include <QDateTime>
+
+#include "messagefilter.h"
+
+class ChatMonitorFilter : public MessageFilter {
+ Q_OBJECT
+
+ public:
+ ChatMonitorFilter(MessageModel *model, QObject *parent = 0);
+
+ virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+ virtual QString idString() const;
+
+ private:
+ QDateTime _initTime;
+};
+
+#endif
#include "quasselui.h"
ChatView::ChatView(Buffer *buf, QWidget *parent) : QGraphicsView(parent), AbstractChatView() {
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setAlignment(Qt::AlignBottom);
- setInteractive(true);
-
QList<BufferId> filterList;
filterList.append(buf->bufferInfo().bufferId());
MessageFilter *filter = new MessageFilter(Client::messageModel(), filterList, this);
+ init(filter);
+
+}
+
+ChatView::ChatView(MessageFilter *filter, QWidget *parent) : QGraphicsView(parent), AbstractChatView() {
+ init(filter);
+}
+
+void ChatView::init(MessageFilter *filter) {
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setAlignment(Qt::AlignBottom);
+ setInteractive(true);
_scene = new ChatScene(filter, filter->idString(), this);
connect(_scene, SIGNAL(heightChanged(qreal)), this, SLOT(sceneHeightChanged(qreal)));
setScene(_scene);
}
-
ChatView::~ChatView() {
}
class Buffer;
class ChatLine;
class ChatScene;
+class MessageFilter;
class ChatView : public QGraphicsView, public AbstractChatView {
Q_OBJECT
public:
+ ChatView(MessageFilter *, QWidget *parent = 0);
ChatView(Buffer *, QWidget *parent = 0);
~ChatView();
virtual void sceneHeightChanged(qreal height);
private:
+ void init(MessageFilter *filter);
+
ChatScene *_scene;
};
void ColumnHandleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
Q_UNUSED(option);
Q_UNUSED(widget);
-
+
QLinearGradient gradient(0, 0, width(), 0);
gradient.setColorAt(0.25, Qt::transparent);
gradient.setColorAt(0.5, QColor(0, 0, 0, _hover * 200));
#include "bufferviewfilter.h"
#include "bufferviewmanager.h"
#include "channellistdlg.h"
+#include "chatmonitorfilter.h"
+#include "chatview.h"
#include "client.h"
#include "clientbacklogmanager.h"
#include "coreinfodlg.h"
}
void MainWin::setupChatMonitor() {
-/*
VerticalDock *dock = new VerticalDock(tr("Chat Monitor"), this);
dock->setObjectName("ChatMonitorDock");
- ChatWidget *chatWidget = new ChatWidget(0, this);
- chatWidget->show();
- dock->setWidget(chatWidget);
+ ChatMonitorFilter *filter = new ChatMonitorFilter(Client::messageModel(), this); qDebug() << filter;
+ ChatView *chatView = new ChatView(filter, this);
+ chatView->show();
+ dock->setWidget(chatView);
dock->show();
- Buffer *buf = Client::monitorBuffer();
- if(!buf)
- return;
-
- chatWidget->setContents(buf->contents());
- connect(buf, SIGNAL(msgAppended(AbstractUiMsg *)), chatWidget, SLOT(appendMsg(AbstractUiMsg *)));
- connect(buf, SIGNAL(msgPrepended(AbstractUiMsg *)), chatWidget, SLOT(prependMsg(AbstractUiMsg *)));
-
addDockWidget(Qt::TopDockWidgetArea, dock, Qt::Vertical);
ui.menuViews->addAction(dock->toggleViewAction());
-*/
}
void MainWin::setupInputWidget() {