LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
tagsfiltermodel.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <QSortFilterProxyModel>
12 #include "tagsconfig.h"
13 
14 namespace LC::Util
15 {
29  class UTIL_TAGS_API TagsFilterModel : public QSortFilterProxyModel
30  {
31  bool NormalMode_ = true;
32  QString Separator_;
33  public:
38  enum class TagsInclusionMode
39  {
45  Any,
46 
52  All
53  };
54  private:
55  TagsInclusionMode TagsMode_ = TagsInclusionMode::All;
56  public:
61  explicit TagsFilterModel (QObject *parent = nullptr);
62 
76  void SetSeparator (const QString& separator);
77 
85  void SetTagsInclusionMode (TagsInclusionMode mode);
86 
93  void SetTagsMode (bool enabled);
94  protected:
97  bool filterAcceptsRow (int, const QModelIndex&) const override;
98 
108  virtual QStringList GetTagsForIndex (int row) const = 0;
109  private:
110  bool FilterNormalMode (int, const QModelIndex&) const;
111  bool FilterTagsMode (int, const QModelIndex&) const;
112  };
113 }
#define UTIL_TAGS_API
Definition: tagsconfig.h:16
Provides filter model with additional tags filter mode.
TagsInclusionMode
Describes the modes of matching two sets of tags.