X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fbufferviewfilter.h;h=a9da1165980fd8f725f2024961a095929eff7d04;hp=01812b9b07ec2eac4b1d313966539eae9aed1f2f;hb=694f9bfbf7f1af19108461c7e00d133e55082bce;hpb=61c8d84d1c849373e0f115dc748ed45cff95287d diff --git a/src/uisupport/bufferviewfilter.h b/src/uisupport/bufferviewfilter.h index 01812b9b..a9da1165 100644 --- a/src/uisupport/bufferviewfilter.h +++ b/src/uisupport/bufferviewfilter.h @@ -34,78 +34,81 @@ /***************************************** * Buffer View Filter *****************************************/ -class BufferViewFilter : public QSortFilterProxyModel { - Q_OBJECT +class BufferViewFilter : public QSortFilterProxyModel +{ + Q_OBJECT public: - enum Mode { - NoActive = 0x01, - NoInactive = 0x02, - SomeNets = 0x04, - AllNets = 0x08, - NoChannels = 0x10, - NoQueries = 0x20, - NoServers = 0x40, - FullCustom = 0x80 - }; - Q_DECLARE_FLAGS(Modes, Mode) + enum Mode { + NoActive = 0x01, + NoInactive = 0x02, + SomeNets = 0x04, + AllNets = 0x08, + NoChannels = 0x10, + NoQueries = 0x20, + NoServers = 0x40, + FullCustom = 0x80 + }; + Q_DECLARE_FLAGS(Modes, Mode) - BufferViewFilter(QAbstractItemModel *model, BufferViewConfig *config = 0); + BufferViewFilter(QAbstractItemModel *model, BufferViewConfig *config = 0); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); - QVariant data(const QModelIndex &index, int role) const; - QVariant checkedState(const QModelIndex &index) const; + QVariant data(const QModelIndex &index, int role) const; + QVariant checkedState(const QModelIndex &index) const; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - bool setCheckedState(const QModelIndex &index, Qt::CheckState state); + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + bool setCheckedState(const QModelIndex &index, Qt::CheckState state); - void setConfig(BufferViewConfig *config); - inline BufferViewConfig *config() const { return _config; } + void setConfig(BufferViewConfig *config); + inline BufferViewConfig *config() const { return _config; } - virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); - QList actions(const QModelIndex &index); + QList 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 checkPreviousCurrentForRemoval(const QModelIndex ¤t, const QModelIndex &previous); + void checkItemForRemoval(const QModelIndex &index) { checkItemsForRemoval(index, index); } + void checkItemsForRemoval(const QModelIndex &topLeft, const QModelIndex &bottomRight); protected: - bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; - bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; - 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); + bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; + bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; + 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(); + void _dataChanged(const QModelIndex &source_topLeft, const QModelIndex &source_bottomRight); + void configChanged(); private slots: - void configInitialized(); - void enableEditMode(bool enable); - void showServerQueriesChanged(); + void configInitialized(); + void enableEditMode(bool enable); + void showServerQueriesChanged(); private: - QPointer _config; - Qt::SortOrder _sortOrder; - - bool _showServerQueries; - bool _editMode; - QAction _enableEditMode; - QSet _toAdd; - QSet _toTempRemove; - QSet _toRemove; - - bool filterAcceptBuffer(const QModelIndex &) const; - bool filterAcceptNetwork(const QModelIndex &) const; - void addBuffer(const BufferId &bufferId) const; - void addBuffers(const QList &bufferIds) const; - static bool bufferIdLessThan(const BufferId &, const BufferId &); + QPointer _config; + Qt::SortOrder _sortOrder; + + bool _showServerQueries; + bool _editMode; + QAction _enableEditMode; + QSet _toAdd; + QSet _toTempRemove; + QSet _toRemove; + + bool filterAcceptBuffer(const QModelIndex &) const; + bool filterAcceptNetwork(const QModelIndex &) const; + void addBuffer(const BufferId &bufferId) const; + void addBuffers(const QList &bufferIds) const; + static bool bufferIdLessThan(const BufferId &, const BufferId &); }; + + Q_DECLARE_OPERATORS_FOR_FLAGS(BufferViewFilter::Modes) #endif // BUFFERVIEWFILTER_H_