1 /***************************************************************************
2 * Copyright (C) 2005-2020 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
23 #include "abstractbuffercontainer.h"
25 #include "ui_bufferwidget.h"
29 class ChatViewSearchBar;
30 class ChatViewSearchController;
32 class BufferWidget : public AbstractBufferContainer
37 BufferWidget(QWidget* parent);
38 ~BufferWidget() override;
40 bool eventFilter(QObject* watched, QEvent* event) override;
42 inline ChatViewSearchBar* searchBar() const { return ui.searchBar; }
43 void addActionsToMenu(QMenu*, const QPointF& pos);
44 virtual inline bool autoMarkerLineOnLostFocus() const { return _autoMarkerLineOnLostFocus; }
47 virtual void setMarkerLine(ChatView* view = nullptr, bool allowGoingBack = true);
48 virtual void jumpToMarkerLine(ChatView* view = nullptr, bool requestBacklog = true);
51 AbstractChatView* createChatView(BufferId) override;
52 void removeChatView(BufferId) override;
53 inline bool autoMarkerLine() const override { return _autoMarkerLine; }
56 void currentChanged(const QModelIndex& current, const QModelIndex& previous) override;
57 void showChatView(BufferId) override;
60 void scrollToHighlight(QGraphicsItem* highlightItem);
65 void setAutoMarkerLine(const QVariant&);
66 void setAutoMarkerLineOnLostFocus(const QVariant&);
68 * Sets the local cache of whether or not a buffer should fetch backlog upon show to provide a
69 * scrollable amount of backlog
71 * @seealso BacklogSettings::setEnsureBacklogOnBufferShow()
73 void setEnsureBacklogOnBufferShow(const QVariant&);
77 QHash<BufferId, QWidget*> _chatViews;
79 ChatViewSearchController* _chatViewSearchController;
82 bool _autoMarkerLineOnLostFocus;
83 bool _ensureBacklogOnBufferShow; ///< If a buffer fetches backlog upon show until scrollable