Searches in data, provided in action asset files and shortcut preferences. More...
#include <SUIT_ShortcutMgr.h>
Classes | |
| class | AssetsAndSearchData |
Public Types | |
| enum | MatchField { ID , Name , ToolTip , KeySequence } |
Public Member Functions | |
| SUIT_ActionSearcher () | |
| SUIT_ActionSearcher (const SUIT_ActionSearcher &)=delete | |
| SUIT_ActionSearcher & | operator= (const SUIT_ActionSearcher &)=delete |
| virtual | ~SUIT_ActionSearcher () |
| bool | setIncludedModuleIDs (std::set< QString > theIncludedModuleIDs, bool doNotUpdateResults=false) |
| bool | includeDisabledActions (bool theOn, bool doNotUpdateResults=false) |
| bool | areDisabledActionsIncluded () const |
| bool | setFieldsToMatch (const std::set< SUIT_ActionSearcher::MatchField > &theFields, bool doNotUpdateResults=false) |
| std::pair< bool, bool > | setKeySequenceGetter (const std::function< QString(const QString &, const QString &)> &theKeySequenceGetter=std::function< QString(const QString &, const QString &)>(), bool doNotUpdateResults=false) |
| bool | setCaseSensitive (bool theOn, bool doNotUpdateResults=false) |
| bool | setQuery (const QString &theQuery) |
| const QString & | getQuery () const |
| const std::map< QString, std::map< QString, SUIT_ActionSearcher::AssetsAndSearchData > > & | getSearchResults () const |
Static Public Member Functions | |
| static double | matchKeySequenceString (const QString &theQuery, const QString &theKeySequence) |
Private Member Functions | |
| std::pair< bool, bool > | filter () |
| Applies filter to all actions, provided in asset files for SUIT_ShortcutMgr. More... | |
| std::pair< bool, bool > | filterResults () |
| Applies filter to search results only. More... | |
| bool | extendResults () |
| Applies filter only to actions, which are not in search results. More... | |
| double | matchAction (const SUIT_ShortcutItemAssets &theAssets) |
| QString | toString () const |
Private Attributes | |
| std::set< QString > | myIncludedModuleIDs |
| bool | myIncludeDisabledActions |
| std::set< SUIT_ActionSearcher::MatchField > | myFieldsToMatch |
| ::SUIT_tools::SUIT_SentenceMatcher * | myMatcher |
| std::function< QString(const QString &, const QString &)> | myKeySequenceGetter |
| std::map< QString, std::map< QString, SUIT_ActionSearcher::AssetsAndSearchData > > | mySearchResults |
Searches in data, provided in action asset files and shortcut preferences.
| SUIT_ActionSearcher::SUIT_ActionSearcher | ( | ) |
Default config: Included modules' IDs = { ROOT_MODULE_ID }; Include disabled actions = false; Fields to match = { Name, Tooltip }; Case sensitive = false; Fuzzy matching = true; Query = ""; // matches nothing.
References SUIT_ShortcutMgr::get(), SUIT_ShortcutMgr::getKeySequence(), myFieldsToMatch, myIncludeDisabledActions, myIncludedModuleIDs, myKeySequenceGetter, myMatcher, SUIT_ShortcutMgr::ROOT_MODULE_ID, SUIT_tools::SUIT_SentenceMatcher::setCaseSensitive(), SUIT_tools::SUIT_SentenceMatcher::setUseExactWordOrder(), and SUIT_tools::SUIT_SentenceMatcher::setUseFuzzyWords().
|
delete |
|
virtual |
References myMatcher.
|
inline |
|
private |
Applies filter only to actions, which are not in search results.
References SUIT_ShortcutMgr::get(), matchAction(), myIncludedModuleIDs, mySearchResults, ShCutDbg(), and TOKEN_SEPARATOR.
|
private |
Applies filter to all actions, provided in asset files for SUIT_ShortcutMgr.
References SUIT_ShortcutMgr::get(), matchAction(), SUIT_ActionSearcher::AssetsAndSearchData::matchMetrics(), SUIT_ActionSearcher::AssetsAndSearchData::myAssets, myIncludedModuleIDs, mySearchResults, SUIT_ActionSearcher::AssetsAndSearchData::setMatchMetrics(), and ShCutDbg().
|
private |
Applies filter to search results only.
References matchAction(), SUIT_ActionSearcher::AssetsAndSearchData::matchMetrics(), SUIT_ActionSearcher::AssetsAndSearchData::myAssets, mySearchResults, and SUIT_ActionSearcher::AssetsAndSearchData::setMatchMetrics().
|
inline |
References SUIT_tools::SUIT_SentenceMatcher::getQuery(), and myMatcher.
| const std::map< QString, std::map< QString, SUIT_ActionSearcher::AssetsAndSearchData > > & SUIT_ActionSearcher::getSearchResults | ( | ) | const |
References mySearchResults.
| bool SUIT_ActionSearcher::includeDisabledActions | ( | bool | theOn, |
| bool | doNotUpdateResults = false |
||
| ) |
| doNotUpdateResults | Set to true to initialize the instance without unnececessary computations. |
References extendResults(), filterResults(), myIncludeDisabledActions, ShCutDbg(), and toString().
|
private |
References SUIT_ShortcutItemAssets::bestPath(), SUIT_ShortcutMgr::currentLang(), DEFAULT_LANG, SUIT_ShortcutMgr::get(), SUIT_ShortcutMgr::getActions(), SUIT_tools::SUIT_SentenceMatcher::getQuery(), SUIT_ShortcutItemAssets::isAction(), SUIT_ShortcutMgr::makeActionID(), SUIT_tools::SUIT_SentenceMatcher::match(), matchKeySequenceString(), myFieldsToMatch, myIncludeDisabledActions, SUIT_ShortcutItemAssets::myInModuleID, myKeySequenceGetter, SUIT_ShortcutAssets::myLangDependentAssets, myMatcher, and SUIT_ShortcutAssets::myModuleID.
|
static |
|
delete |
| bool SUIT_ActionSearcher::setCaseSensitive | ( | bool | theOn, |
| bool | doNotUpdateResults = false |
||
| ) |
| doNotUpdateResults | Set to true to initialize the instance without unnececessary computations. |
References extendResults(), filterResults(), SUIT_tools::SUIT_SentenceMatcher::isCaseSensitive(), myMatcher, SUIT_tools::SUIT_SentenceMatcher::setCaseSensitive(), ShCutDbg(), and toString().
| bool SUIT_ActionSearcher::setFieldsToMatch | ( | const std::set< SUIT_ActionSearcher::MatchField > & | theFields, |
| bool | doNotUpdateResults = false |
||
| ) |
| doNotUpdateResults | Set to true to initialize the instance without unnececessary computations. |
References extendResults(), filter(), filterResults(), myFieldsToMatch, mySearchResults, ShCutDbg(), and toString().
| bool SUIT_ActionSearcher::setIncludedModuleIDs | ( | std::set< QString > | theIncludedModuleIDs, |
| bool | doNotUpdateResults = false |
||
| ) |
| doNotUpdateResults | Set to true to initialize the instance without unnececessary computations. |
References SUIT_ShortcutMgr::get(), SUIT_ShortcutMgr::getModuleAssets(), matchAction(), myIncludedModuleIDs, mySearchResults, ShCutDbg(), and toString().
| std::pair< bool, bool > SUIT_ActionSearcher::setKeySequenceGetter | ( | const std::function< QString(const QString &, const QString &)> & | theKeySequenceGetter = std::function<QString(const QString&, const QString&)>(), |
| bool | doNotUpdateResults = false |
||
| ) |
| theKeySequenceGetter | getKeySequence(theModuleID, theInModuleActionID). If empty, a default getter, retrieving key sequence from ShortcutMgr, is set. |
| doNotUpdateResults | Set to true to initialize the instance without unnececessary computations. |
References filter(), SUIT_ShortcutMgr::get(), SUIT_ShortcutMgr::getKeySequence(), and myKeySequenceGetter.
| bool SUIT_ActionSearcher::setQuery | ( | const QString & | theQuery | ) |
References filter(), SUIT_tools::SUIT_SentenceMatcher::getQuery(), myMatcher, SUIT_tools::SUIT_SentenceMatcher::setQuery(), ShCutDbg(), and toString().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |