X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fabstractbuffercontainer.h;h=b2798389f1095d0d30b836ff8dd4ee8144e0b977;hp=cb0e5026d836c896d3af66ef232ece5e0d6ef379;hb=cc6e7c08709c4e761e2fd9c2e322751015497003;hpb=1ef542382777aa0af9f9d1d6835bf6b1af880089 diff --git a/src/uisupport/abstractbuffercontainer.h b/src/uisupport/abstractbuffercontainer.h index cb0e5026..b2798389 100644 --- a/src/uisupport/abstractbuffercontainer.h +++ b/src/uisupport/abstractbuffercontainer.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel IRC Team * + * Copyright (C) 2005-2019 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,11 +15,12 @@ * 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. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef ABSTRACTBUFFERCONTAINER_H_ -#define ABSTRACTBUFFERCONTAINER_H_ +#pragma once + +#include "uisupport-export.h" #include "abstractitemview.h" #include "buffermodel.h" @@ -28,21 +29,22 @@ class AbstractChatView; class AbstractUiMsg; class Buffer; -class AbstractBufferContainer : public AbstractItemView { - Q_OBJECT +class UISUPPORT_EXPORT AbstractBufferContainer : public AbstractItemView +{ + Q_OBJECT - public: - AbstractBufferContainer(QWidget *parent); - virtual ~AbstractBufferContainer(); +public: + AbstractBufferContainer(QWidget* parent); inline BufferId currentBuffer() const { return _currentBuffer; } - signals: +signals: void currentChanged(BufferId); + void currentChanged(const QModelIndex&); - protected: +protected: //! Create an AbstractChatView for the given BufferId and add it to the UI if necessary - virtual AbstractChatView *createChatView(BufferId) = 0; + virtual AbstractChatView* createChatView(BufferId) = 0; //! Remove a chat view from the UI and delete it /** This method shall remove the view from the UI (for example, from a QStackedWidget) if appropriate. @@ -51,9 +53,14 @@ class AbstractBufferContainer : public AbstractItemView { */ virtual void removeChatView(BufferId) = 0; - protected slots: - virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); - virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); + //! If true, the marker line will be set automatically on buffer switch + /** \return Whether the marker line should be set on buffer switch + */ + virtual inline bool autoMarkerLine() const { return true; } + +protected slots: + void currentChanged(const QModelIndex& current, const QModelIndex& previous) override; + void rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end) override; //! Show the given chat view /** This method is called when the given chat view should be displayed. Use this e.g. for @@ -62,26 +69,18 @@ class AbstractBufferContainer : public AbstractItemView { */ virtual void showChatView(BufferId) = 0; - private slots: - void appendMsg(AbstractUiMsg *); - void prependMsg(AbstractUiMsg *); +private slots: void removeBuffer(BufferId bufferId); void setCurrentBuffer(BufferId bufferId); - private: +private: BufferId _currentBuffer; - QHash _chatViews; + QHash _chatViews; }; -class AbstractChatView { - - public: - virtual ~AbstractChatView() {}; - virtual void appendMsg(AbstractUiMsg *msg) = 0; - virtual void prependMsg(AbstractUiMsg *msg) = 0; - virtual void setContents(const QList &contents) = 0; - //virtual BufferId bufferId() const = 0; - +class AbstractChatView +{ +public: + virtual ~AbstractChatView() = default; + virtual MsgId lastMsgId() const = 0; }; - -#endif