1 | /* |
2 | * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) |
3 | * |
4 | * This program is free software: you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation, either version 3 of the License, or |
7 | * (at your option) any later version. |
8 | * |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
16 | */ |
17 | #ifndef HEADERCOMPLETIONPOPUP_H |
18 | #define |
19 | |
20 | #include <QDir> |
21 | #include <QWidget> |
22 | #include "codecompletionlistview.h" |
23 | #include "../parser/cppparser.h" |
24 | |
25 | enum class { |
26 | , |
27 | , |
28 | |
29 | }; |
30 | |
31 | struct { |
32 | QString ; |
33 | QString ; |
34 | bool ; |
35 | int ; |
36 | HeaderCompletionListItemType ; |
37 | }; |
38 | |
39 | using =std::shared_ptr<HeaderCompletionListItem>; |
40 | |
41 | class : public QAbstractListModel { |
42 | Q_OBJECT |
43 | public: |
44 | explicit (const QList<PHeaderCompletionListItem>* files,QObject *parent = nullptr); |
45 | int (const QModelIndex &parent) const override; |
46 | QVariant (const QModelIndex &index, int role) const override; |
47 | void (); |
48 | void (const QColor &newColor); |
49 | void (const QColor &newColor); |
50 | void (const QColor &newColor); |
51 | |
52 | void (const QColor &newFolderColor); |
53 | |
54 | private: |
55 | const QList<PHeaderCompletionListItem> *; |
56 | QColor ; |
57 | QColor ; |
58 | QColor ; |
59 | QColor ; |
60 | }; |
61 | |
62 | class : public QWidget |
63 | { |
64 | Q_OBJECT |
65 | public: |
66 | (QWidget* parent=nullptr); |
67 | (); |
68 | void (const QString& phrase, const QString& fileName); |
69 | bool (const QString& phrase, bool autoHideOnSingleResult); |
70 | void (const KeyPressedCallback &newKeypressedCallback); |
71 | void (const QColor& localColor, |
72 | const QColor& projectColor, |
73 | const QColor& systemColor, |
74 | const QColor& folderColor); |
75 | QString (bool updateUsageCount); |
76 | |
77 | private: |
78 | void (const QString& member); |
79 | void (const QString& phrase); |
80 | void (const QString& path, HeaderCompletionListItemType type); |
81 | void (const QDir& dir, const QFileInfo &fileInfo, HeaderCompletionListItemType type); |
82 | void (const QString& baseDirPath, const QString& subDirName, HeaderCompletionListItemType type); |
83 | private: |
84 | |
85 | CodeCompletionListView* ; |
86 | HeaderCompletionListModel* ; |
87 | QHash<QString, PHeaderCompletionListItem> ; |
88 | QList<PHeaderCompletionListItem> ; |
89 | QHash<QString,int> ; |
90 | int ; |
91 | QSet<QString> ; |
92 | |
93 | PCppParser ; |
94 | QString ; |
95 | bool ; |
96 | bool ; |
97 | QString ; |
98 | |
99 | // QWidget interface |
100 | protected: |
101 | void (QShowEvent *event) override; |
102 | void (QHideEvent *event) override; |
103 | |
104 | // QObject interface |
105 | public: |
106 | bool (QEvent *event) override; |
107 | void (const PCppParser &newParser); |
108 | const QString &() const; |
109 | bool () const; |
110 | void (bool newIgnoreCase); |
111 | bool () const; |
112 | void (bool newSearchLocal); |
113 | }; |
114 | |
115 | #endif // HEADERCOMPLETIONPOPUP_H |
116 | |