LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
categoryselector.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 <memory>
12 #include <QDialog>
13 #include <util/sll/util.h>
14 #include "tagsconfig.h"
15 
16 class QString;
17 class QStringList;
18 class QStringListModel;
19 
20 namespace Ui
21 {
22  class CategorySelector;
23 }
24 
25 namespace LC::Util
26 {
47  class UTIL_TAGS_API CategorySelector : public QDialog
48  {
49  Q_OBJECT
50 
51  class SelectorTagsModel;
52 
53  std::shared_ptr<Ui::CategorySelector> Ui_;
54  SelectorTagsModel& Model_;
55 
56  QString Separator_;
57  bool NotificationsEnabled_ = true;
58  public:
59  enum class ButtonsMode
60  {
61  NoButtons,
62  Close,
63  AcceptReject
64  };
65 
74  explicit CategorySelector (QWidget *parent = nullptr);
75 
82  void SetCaption (const QString& caption);
83 
94  QStringList GetSelections () const;
95 
105  QList<int> GetSelectedIndexes () const;
106 
116  void SetSelections (const QStringList& subset);
117 
123  QString GetSeparator () const;
124 
131  void SetSeparator (const QString&);
132 
135  void SetButtonsMode (ButtonsMode);
136 
155  virtual void SetPossibleSelections (QStringList selections, bool sort = true);
156 
157  QStringList GetPossibleSelections () const;
158 
161  void SelectAll ();
162 
165  void SelectNone ();
166 
175  void SetSelectionsFromString (const QString& newText);
176  protected:
180  void moveEvent (QMoveEvent*) override;
181  private:
184  void NotifyTagsSelection ();
185 
186  [[nodiscard]] Util::DefaultScopeGuard DisableNotifications (bool reemit = true);
187  signals:
192  void tagsSelectionChanged (const QStringList& newSelections);
193  };
194 }
#define UTIL_TAGS_API
Definition: tagsconfig.h:16
The CategorySelector widget provides a way to select amongst a group of items.