LeechCraft  0.6.70-18450-gabe19ee3b0
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 <QStringList>
14 #include <util/sll/util.h>
15 #include "tagsconfig.h"
16 
17 class QStringListModel;
18 
19 namespace Ui
20 {
21  class CategorySelector;
22 }
23 
24 namespace LC::Util
25 {
46  class UTIL_TAGS_API CategorySelector : public QDialog
47  {
48  Q_OBJECT
49 
50  class SelectorTagsModel;
51 
52  std::shared_ptr<Ui::CategorySelector> Ui_;
53  SelectorTagsModel& Model_;
54 
55  QString Separator_;
56  bool NotificationsEnabled_ = true;
57  public:
58  enum class ButtonsMode
59  {
60  NoButtons,
61  Close,
62  AcceptReject
63  };
64 
73  explicit CategorySelector (QWidget *parent = nullptr);
74 
81  void SetCaption (const QString& caption);
82 
93  QStringList GetSelections () const;
94 
104  QList<int> GetSelectedIndexes () const;
105 
115  void SetSelections (const QStringList& subset);
116 
122  QString GetSeparator () const;
123 
130  void SetSeparator (const QString&);
131 
134  void SetButtonsMode (ButtonsMode);
135 
154  virtual void SetPossibleSelections (QStringList selections, bool sort = true);
155 
156  QStringList GetPossibleSelections () const;
157 
160  void SelectAll ();
161 
164  void SelectNone ();
165 
174  void SetSelectionsFromString (const QString& newText);
175  protected:
179  void moveEvent (QMoveEvent*) override;
180  private:
183  void NotifyTagsSelection ();
184 
185  [[nodiscard]] Util::DefaultScopeGuard DisableNotifications (bool reemit = true);
186  signals:
191  void tagsSelectionChanged (const QStringList& newSelections);
192  };
193 }
#define UTIL_TAGS_API
Definition: tagsconfig.h:16
The CategorySelector widget provides a way to select amongst a group of items.