GenericProposalModel: Rename PrefixMatch to ProposalMatch

Change-Id: I70e583d489f27b2dad1b9ab874091e638bbaff1f
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Andre Hartmann
2019-07-23 19:45:37 +02:00
committed by André Hartmann
parent 404a4295ce
commit a7bf0c0ea1
3 changed files with 12 additions and 12 deletions

View File

@@ -52,9 +52,9 @@ void ClangAssistProposalModel::sort(const QString &/*prefix*/)
auto currentItemsCompare = [](AssistProposalItemInterface *first, auto currentItemsCompare = [](AssistProposalItemInterface *first,
AssistProposalItemInterface *second) { AssistProposalItemInterface *second) {
if (first->prefixMatch() != second->prefixMatch()) { if (first->proposalMatch() != second->proposalMatch()) {
return static_cast<int>(first->prefixMatch()) return static_cast<int>(first->proposalMatch())
< static_cast<int>(second->prefixMatch()); < static_cast<int>(second->proposalMatch());
} }
return false; return false;
}; };

View File

@@ -42,7 +42,7 @@ class TEXTEDITOR_EXPORT AssistProposalItemInterface
{ {
public: public:
// We compare proposals by enum values, be careful changing their values // We compare proposals by enum values, be careful changing their values
enum class PrefixMatch enum class ProposalMatch
{ {
Full = 0, Full = 0,
Exact = 1, Exact = 1,
@@ -71,12 +71,12 @@ public:
inline int order() const { return m_order; } inline int order() const { return m_order; }
inline void setOrder(int order) { m_order = order; } inline void setOrder(int order) { m_order = order; }
inline PrefixMatch prefixMatch() { return m_prefixMatch; } inline ProposalMatch proposalMatch() { return m_proposalMatch; }
inline void setPrefixMatch(PrefixMatch match) { m_prefixMatch = match; } inline void setProposalMatch(ProposalMatch match) { m_proposalMatch = match; }
private: private:
int m_order = 0; int m_order = 0;
PrefixMatch m_prefixMatch = PrefixMatch::None; ProposalMatch m_proposalMatch = ProposalMatch::None;
}; };
} // namespace TextEditor } // namespace TextEditor

View File

@@ -307,16 +307,16 @@ void GenericProposalModel::filter(const QString &prefix)
m_currentItems.append(item); m_currentItems.append(item);
if (text.startsWith(prefix)) { if (text.startsWith(prefix)) {
// Direct match // Direct match
item->setPrefixMatch(text.length() == prefix.length() item->setProposalMatch(text.length() == prefix.length()
? AssistProposalItemInterface::PrefixMatch::Full ? AssistProposalItemInterface::ProposalMatch::Full
: AssistProposalItemInterface::PrefixMatch::Exact); : AssistProposalItemInterface::ProposalMatch::Exact);
continue; continue;
} }
if (text.startsWith(lowerPrefix, Qt::CaseInsensitive)) if (text.startsWith(lowerPrefix, Qt::CaseInsensitive))
item->setPrefixMatch(AssistProposalItemInterface::PrefixMatch::Prefix); item->setProposalMatch(AssistProposalItemInterface::ProposalMatch::Prefix);
else if (text.contains(lowerPrefix, Qt::CaseInsensitive)) else if (text.contains(lowerPrefix, Qt::CaseInsensitive))
item->setPrefixMatch(AssistProposalItemInterface::PrefixMatch::Infix); item->setProposalMatch(AssistProposalItemInterface::ProposalMatch::Infix);
} }
} }
} }