X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fabstractbuffercontainer.h;h=bf5833335ac6e8bd2cdd749e30801d8ae22b8e0f;hp=0e466277c1c83fdca7e0eb2934d5e79fd0ac39e0;hb=af569a42f6635f6abfcedeb45b730ee64d53e0b8;hpb=533eaaeda64759c01daa624365b8fc63eeba5ccf diff --git a/src/uisupport/abstractbuffercontainer.h b/src/uisupport/abstractbuffercontainer.h index 0e466277..bf583333 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-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -31,51 +31,52 @@ class Buffer; class AbstractBufferContainer : public AbstractItemView { Q_OBJECT - public: - AbstractBufferContainer(QWidget *parent); - virtual ~AbstractBufferContainer(); - - inline BufferId currentBuffer() const { return _currentBuffer; } - - signals: - void currentChanged(BufferId); - - protected: - //! Create an AbstractChatView for the given BufferId and add it to the UI if necessary - 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. - * It also shall delete the object afterwards. - * \param view The chat view to be removed and deleted - */ - 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); - - //! Show the given chat view - /** This method is called when the given chat view should be displayed. Use this e.g. for - * selecting the appropriate page in a QStackedWidget. - * \param view The chat view to be displayed. May be 0 if no chat view is selected. - */ - virtual void showChatView(BufferId) = 0; - - private slots: - void removeBuffer(BufferId bufferId); - void setCurrentBuffer(BufferId bufferId); - - private: - BufferId _currentBuffer; - QHash _chatViews; +public: + AbstractBufferContainer(QWidget *parent); + virtual ~AbstractBufferContainer(); + + inline BufferId currentBuffer() const { return _currentBuffer; } + +signals: + void currentChanged(BufferId); + void currentChanged(const QModelIndex &); + +protected: + //! Create an AbstractChatView for the given BufferId and add it to the UI if necessary + 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. + * It also shall delete the object afterwards. + * \param view The chat view to be removed and deleted + */ + 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); + + //! Show the given chat view + /** This method is called when the given chat view should be displayed. Use this e.g. for + * selecting the appropriate page in a QStackedWidget. + * \param view The chat view to be displayed. May be 0 if no chat view is selected. + */ + virtual void showChatView(BufferId) = 0; + +private slots: + void removeBuffer(BufferId bufferId); + void setCurrentBuffer(BufferId bufferId); + +private: + BufferId _currentBuffer; + QHash _chatViews; }; class AbstractChatView { - public: - virtual ~AbstractChatView() {}; - virtual MsgId lastMsgId() const = 0; +public: + virtual ~AbstractChatView() {}; + virtual MsgId lastMsgId() const = 0; }; #endif