X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fbufferviewfilter.h;h=d1483d3dcf30090f1d19fafa6767af16d4d27468;hp=4a80f7ecd5b9817e4a4a144db8e932fb6ad49416;hb=617a3966941742a4e235af440d3665d0274354a8;hpb=6fe30667a4a4747e8fad048dad499f7d2390b044 diff --git a/src/uisupport/bufferviewfilter.h b/src/uisupport/bufferviewfilter.h index 4a80f7ec..d1483d3d 100644 --- a/src/uisupport/bufferviewfilter.h +++ b/src/uisupport/bufferviewfilter.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -21,7 +21,7 @@ #ifndef BUFFERVIEWFILTER_H_ #define BUFFERVIEWFILTER_H_ -#include +#include #include #include #include @@ -36,7 +36,7 @@ *****************************************/ class BufferViewFilter : public QSortFilterProxyModel { Q_OBJECT - + public: enum Mode { NoActive = 0x01, @@ -48,26 +48,31 @@ public: NoServers = 0x40, FullCustom = 0x80 }; - Q_DECLARE_FLAGS(Modes, Mode); + Q_DECLARE_FLAGS(Modes, Mode) 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); QVariant data(const QModelIndex &index, int role) const; - QVariant foreground(const QModelIndex &index) 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); void setConfig(BufferViewConfig *config); inline BufferViewConfig *config() const { return _config; } + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + + QList actions(const QModelIndex &index); + public slots: - void removeBuffer(const QModelIndex &); 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 source_rowsInserted(const QModelIndex &parent, int start, int end); - + protected: bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const; @@ -77,23 +82,30 @@ protected: signals: void _dataChanged(const QModelIndex &source_topLeft, const QModelIndex &source_bottomRight); - + void configChanged(); + +private slots: + void configInitialized(); + void enableEditMode(bool enable); + void showServerQueriesChanged(); + private: - QPointer _config; - - QColor _FgColorInactiveActivity; - QColor _FgColorNoActivity; - QColor _FgColorHighlightActivity; - QColor _FgColorNewMessageActivity; - QColor _FgColorOtherActivity; - void loadColors(); + QPointer _config, _tmpConfig; + 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 &); + 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) - -bool bufferIdLessThan(const BufferId &, const BufferId &); +Q_DECLARE_OPERATORS_FOR_FLAGS(BufferViewFilter::Modes) #endif // BUFFERVIEWFILTER_H_