Changeset View
Changeset View
Standalone View
Standalone View
src/completion/katecompletionmodel.h
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | 52 | public: | |||
---|---|---|---|---|---|
64 | KateCompletionWidget *widget() const; | 64 | KateCompletionWidget *widget() const; | ||
65 | 65 | | |||
66 | QString currentCompletion(KTextEditor::CodeCompletionModel *model) const; | 66 | QString currentCompletion(KTextEditor::CodeCompletionModel *model) const; | ||
67 | void setCurrentCompletion(KTextEditor::CodeCompletionModel *model, const QString &completion); | 67 | void setCurrentCompletion(KTextEditor::CodeCompletionModel *model, const QString &completion); | ||
68 | 68 | | |||
69 | Qt::CaseSensitivity matchCaseSensitivity() const; | 69 | Qt::CaseSensitivity matchCaseSensitivity() const; | ||
70 | void setMatchCaseSensitivity(Qt::CaseSensitivity cs); | 70 | void setMatchCaseSensitivity(Qt::CaseSensitivity cs); | ||
71 | 71 | | |||
72 | Qt::CaseSensitivity exactMatchCaseSensitivity() const; | ||||
73 | void setExactMatchCaseSensitivity(Qt::CaseSensitivity cs); | ||||
74 | | ||||
72 | static QString columnName(int column); | 75 | static QString columnName(int column); | ||
73 | int translateColumn(int sourceColumn) const; | 76 | int translateColumn(int sourceColumn) const; | ||
74 | 77 | | |||
75 | static QString propertyName(KTextEditor::CodeCompletionModel::CompletionProperty property); | 78 | static QString propertyName(KTextEditor::CodeCompletionModel::CompletionProperty property); | ||
76 | 79 | | |||
77 | ///Returns a common prefix for all current visible completion entries | 80 | ///Returns a common prefix for all current visible completion entries | ||
78 | ///If there is no common prefix, extracts the next useful prefix for the selected index | 81 | ///If there is no common prefix, extracts the next useful prefix for the selected index | ||
79 | QString commonPrefix(QModelIndex selectedIndex) const; | 82 | QString commonPrefix(QModelIndex selectedIndex) const; | ||
▲ Show 20 Lines • Show All 274 Lines • ▼ Show 20 Line(s) | 322 | private: | |||
354 | 357 | | |||
355 | /// Removes attributes not used in grouping from the input \a attribute | 358 | /// Removes attributes not used in grouping from the input \a attribute | ||
356 | int groupingAttributes(int attribute) const; | 359 | int groupingAttributes(int attribute) const; | ||
357 | int countBits(int value) const; | 360 | int countBits(int value) const; | ||
358 | 361 | | |||
359 | void resort(); | 362 | void resort(); | ||
360 | void refilter(); | 363 | void refilter(); | ||
361 | 364 | | |||
362 | static bool matchesAbbreviation(const QString &word, const QString &typed); | 365 | static bool matchesAbbreviation(const QString &word, const QString &typed, Qt::CaseSensitivity caseSensitive); | ||
363 | 366 | | |||
364 | bool m_hasGroups = false; | 367 | bool m_hasGroups = false; | ||
365 | 368 | | |||
366 | // ### Runtime state | 369 | // ### Runtime state | ||
367 | // General | 370 | // General | ||
368 | QList<KTextEditor::CodeCompletionModel *> m_completionModels; | 371 | QList<KTextEditor::CodeCompletionModel *> m_completionModels; | ||
369 | QMap<KTextEditor::CodeCompletionModel *, QString> m_currentMatch; | 372 | QMap<KTextEditor::CodeCompletionModel *, QString> m_currentMatch; | ||
370 | Qt::CaseSensitivity m_matchCaseSensitivity = Qt::CaseInsensitive; | | |||
371 | 373 | | |||
372 | // Column merging | 374 | // Column merging | ||
373 | QList< QList<int> > m_columnMerges; | 375 | QList< QList<int> > m_columnMerges; | ||
374 | 376 | | |||
375 | QTimer *m_updateBestMatchesTimer; | 377 | QTimer *m_updateBestMatchesTimer; | ||
376 | 378 | | |||
377 | Group *m_ungrouped; | 379 | Group *m_ungrouped; | ||
378 | Group *m_argumentHints; //The argument-hints will be passed on to another model, to be shown in another widget | 380 | Group *m_argumentHints; //The argument-hints will be passed on to another model, to be shown in another widget | ||
379 | Group *m_bestMatches; //A temporary group used for holding the best matches of all visible items | 381 | Group *m_bestMatches; //A temporary group used for holding the best matches of all visible items | ||
380 | 382 | | |||
381 | // Storing the sorted order | 383 | // Storing the sorted order | ||
382 | QList<Group *> m_rowTable; | 384 | QList<Group *> m_rowTable; | ||
383 | QList<Group *> m_emptyGroups; | 385 | QList<Group *> m_emptyGroups; | ||
384 | // Quick access to each specific group (if it exists) | 386 | // Quick access to each specific group (if it exists) | ||
385 | QMultiHash<int, Group *> m_groupHash; | 387 | QMultiHash<int, Group *> m_groupHash; | ||
386 | // Maps custom group-names to their specific groups | 388 | // Maps custom group-names to their specific groups | ||
387 | QHash<QString, Group *> m_customGroupHash; | 389 | QHash<QString, Group *> m_customGroupHash; | ||
388 | 390 | | |||
389 | // ### Configurable state | 391 | // ### Configurable state | ||
392 | // Matching | ||||
393 | Qt::CaseSensitivity m_matchCaseSensitivity = Qt::CaseInsensitive; | ||||
394 | Qt::CaseSensitivity m_exactMatchCaseSensitivity = Qt::CaseInsensitive; // Must be equal to or stricter than m_matchCaseSensitivity. | ||||
mwolff: should this comment be asserted in the setters or is it handled gracefully in the logic below? | |||||
I added asserts to the setters. One should be aware then though that it restricts the order in which these must be called. For example, if both settings are case-insensitive at first and both should be changed to case-sensitive, then the exact-match-sensitivity must be changed before the match-sensitivity. Alternatively, one could make a single setter function that changes both properties. thomassc: I added asserts to the setters. One should be aware then though that it restricts the order in… | |||||
mwolff: either that, or handle it gracefully (with a warning?) wherever it's used? | |||||
395 | | ||||
390 | // Sorting | 396 | // Sorting | ||
391 | bool m_sortingEnabled = false; | 397 | bool m_sortingEnabled = false; | ||
392 | bool m_sortingAlphabetical = false; | 398 | bool m_sortingAlphabetical = false; | ||
393 | bool m_isSortingByInheritance = false; | 399 | bool m_isSortingByInheritance = false; | ||
394 | Qt::CaseSensitivity m_sortingCaseSensitivity = Qt::CaseInsensitive; | 400 | Qt::CaseSensitivity m_sortingCaseSensitivity = Qt::CaseInsensitive; | ||
395 | QHash< int, QList<int> > m_sortingGroupingOrder; | 401 | QHash< int, QList<int> > m_sortingGroupingOrder; | ||
396 | 402 | | |||
397 | // Filtering | 403 | // Filtering | ||
Show All 20 Lines |
should this comment be asserted in the setters or is it handled gracefully in the logic below?