qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
tabcompleter.h
Go to the documentation of this file.
1 /*
2  Copyright © 2005-2014 by the Quassel Project
3  devel@quassel-irc.org
4 
5  Copyright © 2014-2019 by The qTox Project Contributors
6 
7  This file is part of qTox, a Qt-based graphical interface for Tox.
8 
9  qTox is libre software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  qTox is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with qTox. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #pragma once
24 
25 #include "src/model/group.h"
27 #include <QMap>
28 #include <QString>
29 
30 class TabCompleter : public QObject
31 {
32  Q_OBJECT
33 public:
35 
36 public slots:
37  void complete();
38  void reset();
39 
40 private:
42  {
43  explicit SortableString(const QString& n)
44  : contents{n}
45  {
46  }
47  bool operator<(const SortableString& other) const;
48  QString contents;
49  };
50 
53  bool enabled;
54  const static QString nickSuffix;
55 
56  QMap<SortableString, QString> completionMap;
57  QMap<SortableString, QString>::Iterator nextCompletion;
59 
60  void buildCompletionList();
61 };
TabCompleter::SortableString
Definition: tabcompleter.h:41
group.h
TabCompleter::TabCompleter
TabCompleter(ChatTextEdit *msgEdit, Group *group)
Definition: tabcompleter.cpp:40
TabCompleter::SortableString::contents
QString contents
Definition: tabcompleter.h:48
TabCompleter::complete
void complete()
Definition: tabcompleter.cpp:90
TabCompleter::msgEdit
ChatTextEdit * msgEdit
Definition: tabcompleter.h:51
chattextedit.h
TabCompleter
Definition: tabcompleter.h:30
TabCompleter::buildCompletionList
void buildCompletionList()
Definition: tabcompleter.cpp:59
TabCompleter::SortableString::operator<
bool operator<(const SortableString &other) const
Definition: tabcompleter.cpp:132
TabCompleter::completionMap
QMap< SortableString, QString > completionMap
Definition: tabcompleter.h:56
TabCompleter::nextCompletion
QMap< SortableString, QString >::Iterator nextCompletion
Definition: tabcompleter.h:57
Group
Definition: group.h:34
ChatTextEdit
Definition: chattextedit.h:24
TabCompleter::enabled
bool enabled
Definition: tabcompleter.h:53
TabCompleter::group
Group * group
Definition: tabcompleter.h:52
TabCompleter::reset
void reset()
Definition: tabcompleter.cpp:126
TabCompleter::nickSuffix
const static QString nickSuffix
Definition: tabcompleter.h:54
TabCompleter::SortableString::SortableString
SortableString(const QString &n)
Definition: tabcompleter.h:43
TabCompleter::lastCompletionLength
int lastCompletionLength
Definition: tabcompleter.h:58