/***************************************************************************
- * Copyright (C) 2005-2013 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 *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef BUFFERVIEWFILTER_H_
-#define BUFFERVIEWFILTER_H_
+#pragma once
+
+#include "uisupport-export.h"
#include <QAction>
#include <QDropEvent>
/*****************************************
* Buffer View Filter
*****************************************/
-class BufferViewFilter : public QSortFilterProxyModel
+class UISUPPORT_EXPORT BufferViewFilter : public QSortFilterProxyModel
{
Q_OBJECT
};
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<QAction *> actions(const QModelIndex &index);
-public slots:
- void checkPreviousCurrentForRemoval(const QModelIndex ¤t, const QModelIndex &previous);
- void checkItemForRemoval(const QModelIndex &index) { checkItemsForRemoval(index, index); }
- void checkItemsForRemoval(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ 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;
- virtual void customEvent(QEvent *event);
signals:
- void _dataChanged(const QModelIndex &source_topLeft, const QModelIndex &source_bottomRight);
void configChanged();
private slots:
QSet<BufferId> _toAdd;
QSet<BufferId> _toTempRemove;
QSet<BufferId> _toRemove;
+ QString _filterString;
bool filterAcceptBuffer(const QModelIndex &) const;
bool filterAcceptNetwork(const QModelIndex &) const;
Q_DECLARE_OPERATORS_FOR_FLAGS(BufferViewFilter::Modes)
-
-#endif // BUFFERVIEWFILTER_H_