X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fbufferviewfilter.h;h=72a6eef011b84421711e42b353584ebd7b75f9d3;hp=5cf0cceca7fcfd85f5b99b04f9f98884cc8f29a9;hb=e8a39b4c3c92e193ab861a3fea84a261bb6fbd24;hpb=cd2c2456d5051d97bddf171738b319a98a7f5178 diff --git a/src/uisupport/bufferviewfilter.h b/src/uisupport/bufferviewfilter.h index 5cf0ccec..72a6eef0 100644 --- a/src/uisupport/bufferviewfilter.h +++ b/src/uisupport/bufferviewfilter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,8 +18,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef BUFFERVIEWFILTER_H_ -#define BUFFERVIEWFILTER_H_ +#pragma once + +#include "uisupport-export.h" #include #include @@ -34,7 +35,7 @@ /***************************************** * Buffer View Filter *****************************************/ -class BufferViewFilter : public QSortFilterProxyModel +class UISUPPORT_EXPORT BufferViewFilter : public QSortFilterProxyModel { Q_OBJECT @@ -51,27 +52,29 @@ public: }; Q_DECLARE_FLAGS(Modes, Mode) - BufferViewFilter(QAbstractItemModel *model, BufferViewConfig *config = 0); + BufferViewFilter(QAbstractItemModel *model, BufferViewConfig *config = nullptr); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + Qt::ItemFlags flags(const QModelIndex &index) const override; + bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override; - QVariant data(const QModelIndex &index, int role) const; + QVariant data(const QModelIndex &index, int role) const override; QVariant checkedState(const QModelIndex &index) const; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; bool setCheckedState(const QModelIndex &index, Qt::CheckState state); void setConfig(BufferViewConfig *config); inline BufferViewConfig *config() const { return _config; } - virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override; QList actions(const QModelIndex &index); + void setFilterString(const QString string); + protected: - bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; - bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; + bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; + bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; bool bufferLessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; bool networkLessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; @@ -93,6 +96,7 @@ private: QSet _toAdd; QSet _toTempRemove; QSet _toRemove; + QString _filterString; bool filterAcceptBuffer(const QModelIndex &) const; bool filterAcceptNetwork(const QModelIndex &) const; @@ -103,5 +107,3 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(BufferViewFilter::Modes) - -#endif // BUFFERVIEWFILTER_H_