Base class for GUI-related assets of module, action or folder. Used by Shortcut Manager, Find Action Dialog, etc. More...
#include <SUIT_ShortcutMgr.h>

Classes | |
| struct | LangDependentAssets |
Public Types | |
| enum class | Type { Module , Item } |
Public Member Functions | |
| virtual | ~SUIT_ShortcutAssets ()=0 |
| const std::map< QString, std::shared_ptr< SUIT_ShortcutItemAssets > > & | children () const |
| std::shared_ptr< SUIT_ShortcutItemAssets > | findDescendantItem (const QString &theRelativeID) const |
| std::shared_ptr< SUIT_ShortcutItemAssets > | descendantItem (const QString &theRelativeID, bool theIsAction=true) |
| virtual int | depth () const =0 |
| virtual SUIT_ShortcutAssets::Type | type () const =0 |
| bool | fromJSON (const QJsonObject &theJsonObject, bool theParseDescendants=true, const std::set< QString > &theLangs={}) |
| bool | fromJSON (const QJsonObject &theJsonObject, const QString &theRelativeID, const std::set< QString > &theLangs={}) |
| Parses only the branch of descdendants, which leads to the item with theRelativeID. More... | |
| void | toJSON (QJsonObject &oJsonObject) const |
| virtual void | merge (const SUIT_ShortcutAssets &theOther, bool theOverride) |
| virtual void | merge (SUIT_ShortcutAssets &&theOther, bool theOverride) |
| void | loadIcon (bool theReload=false) |
| void | forEachDescendant (const std::function< void(SUIT_ShortcutItemAssets &)> &theFunc) const |
| Iterates all descendants. *this is not iterated. More... | |
| void | forEachDescendant (const std::function< void(const SUIT_ShortcutItemAssets &)> &theFunc) const |
| Iterates all descendants. *this is not iterated. More... | |
| void | forEachDescendant (const std::function< void(std::shared_ptr< SUIT_ShortcutItemAssets >)> &theFunc) const |
| Iterates all descendants. *this is not iterated. More... | |
| void | forEachDescendant (const std::function< void(std::shared_ptr< const SUIT_ShortcutItemAssets >)> &theFunc) const |
| Iterates all descendants. *this is not iterated. More... | |
| QString | toString () const |
| virtual QString | description () const =0 |
| QStringList | getLangs () const |
| void | clearAllLangsExcept (const QString &theLang) |
| const LangDependentAssets * | bestLangDependentAssets (QString theLang=QString()) const |
| virtual const QString & | bestName (const QString &theLang=QString()) const =0 |
| virtual const QString & | bestToolTip (const QString &theLang=QString()) const |
Public Attributes | |
| const QString | myModuleID |
| std::map< QString, LangDependentAssets > | myLangDependentAssets |
| QString | myIconPath |
| QIcon | myIcon |
Static Public Attributes | |
| static const QString | PROP_ID_LANG_DEPENDENT_ASSETS = "langDependentAssets" |
| static const QString | PROP_ID_ICON_PATH = "iconPath" |
| static const QString | PROP_ID_CHILDREN = "children" |
Protected Member Functions | |
| SUIT_ShortcutAssets (const QString &theModuleID) | |
Private Member Functions | |
| bool | fromJSONOwnProps (const QJsonObject &theJsonObject, const std::set< QString > &theLangs={}) |
| Parses everything, except children. More... | |
| virtual bool | fromJSONOtherProps (const QJsonObject &theJsonObject) |
| Parses properties of SUIT_ShortcutAssets subclasses. More... | |
| virtual void | toJSONVirtual (QJsonObject &oJsonObject) const |
Private Attributes | |
| std::map< QString, std::shared_ptr< SUIT_ShortcutItemAssets > > | myChildren |
Base class for GUI-related assets of module, action or folder. Used by Shortcut Manager, Find Action Dialog, etc.
|
strong |
|
protected |
References SUIT_ShortcutMgr::isModuleIDValid(), and myModuleID.
|
pure virtual |
| const SUIT_ShortcutAssets::LangDependentAssets * SUIT_ShortcutAssets::bestLangDependentAssets | ( | QString | theLang = QString() | ) | const |
| theLang | If empty, current language is requested. |
References SUIT_ShortcutMgr::currentLang(), DEFAULT_LANG, and myLangDependentAssets.
|
pure virtual |
Implemented in SUIT_ShortcutItemAssets, and SUIT_ShortcutModuleAssets.
|
virtual |
| theLang | If empty, current language is requested. |
References bestLangDependentAssets().
| const std::map< QString, std::shared_ptr< SUIT_ShortcutItemAssets > > & SUIT_ShortcutAssets::children | ( | ) | const |
References myChildren.
| void SUIT_ShortcutAssets::clearAllLangsExcept | ( | const QString & | theLang | ) |
References myLangDependentAssets.
|
pure virtual |
Implemented in SUIT_ShortcutItemAssets, and SUIT_ShortcutModuleAssets.
| std::shared_ptr< SUIT_ShortcutItemAssets > SUIT_ShortcutAssets::descendantItem | ( | const QString & | theRelativeID, |
| bool | theIsAction = true |
||
| ) |
| theRelativeID | If empty, nullptr is returned. |
| theIsAction | If true and the descendant is missing, makes the created item action. |
References SUIT_ShortcutItemAssets::create(), and SUIT_ShortcutMgr::splitIntoTokens().
|
pure virtual |
Implemented in SUIT_ShortcutItemAssets, and SUIT_ShortcutModuleAssets.
| std::shared_ptr< SUIT_ShortcutItemAssets > SUIT_ShortcutAssets::findDescendantItem | ( | const QString & | theRelativeID | ) | const |
| theRelativeID | If empty, nullptr is returned. |
References SUIT_ShortcutMgr::splitIntoTokens().
| void SUIT_ShortcutAssets::forEachDescendant | ( | const std::function< void(const SUIT_ShortcutItemAssets &)> & | theFunc | ) | const |
Iterates all descendants. *this is not iterated.
References forEachDescendant(), and myChildren.
| void SUIT_ShortcutAssets::forEachDescendant | ( | const std::function< void(std::shared_ptr< const SUIT_ShortcutItemAssets >)> & | theFunc | ) | const |
Iterates all descendants. *this is not iterated.
References myChildren.
| void SUIT_ShortcutAssets::forEachDescendant | ( | const std::function< void(std::shared_ptr< SUIT_ShortcutItemAssets >)> & | theFunc | ) | const |
Iterates all descendants. *this is not iterated.
References myChildren.
| void SUIT_ShortcutAssets::forEachDescendant | ( | const std::function< void(SUIT_ShortcutItemAssets &)> & | theFunc | ) | const |
Iterates all descendants. *this is not iterated.
References forEachDescendant(), and myChildren.
| bool SUIT_ShortcutAssets::fromJSON | ( | const QJsonObject & | theJsonObject, |
| bool | theParseDescendants = true, |
||
| const std::set< QString > & | theLangs = {} |
||
| ) |
| theLangs | If empty, LangDependentAssets in all available languages are parsed. |
References SUIT_ShortcutItemAssets::create(), description(), fromJSONOwnProps(), SUIT_ShortcutMgr::isInModuleIDTokenValid(), myChildren, PROP_ID_CHILDREN, and Warning().
| bool SUIT_ShortcutAssets::fromJSON | ( | const QJsonObject & | theJsonObject, |
| const QString & | theRelativeID, | ||
| const std::set< QString > & | theLangs = {} |
||
| ) |
Parses only the branch of descdendants, which leads to the item with theRelativeID.
| theRelativeID | If empty, no descendants are added/updated. |
| theLangs | If empty, LangDependentAssets in all available languages are parsed. |
References SUIT_ShortcutItemAssets::create(), description(), fromJSONOwnProps(), SUIT_ShortcutMgr::isInModuleIDTokenValid(), SUIT_ShortcutMgr::joinIntoRelativeID(), myChildren, PROP_ID_CHILDREN, SUIT_ShortcutMgr::splitIntoTokens(), and Warning().
|
inlineprivatevirtual |
Parses properties of SUIT_ShortcutAssets subclasses.
Reimplemented in SUIT_ShortcutItemAssets.
|
private |
Parses everything, except children.
| theLangs | If empty, LangDependentAssets in all available languages are parsed. |
References fromJSONOtherProps(), myIconPath, myLangDependentAssets, PROP_ID_ICON_PATH, and PROP_ID_LANG_DEPENDENT_ASSETS.
| QStringList SUIT_ShortcutAssets::getLangs | ( | ) | const |
References myLangDependentAssets.
| void SUIT_ShortcutAssets::loadIcon | ( | bool | theReload = false | ) |
References myIcon, myIconPath, and SUIT_tools::substituteVars().
|
virtual |
| theOverride | If true, values of theOther override conflicting values of this. |
References SUIT_ShortcutItemAssets::create(), loadIcon(), myChildren, myIcon, myIconPath, myLangDependentAssets, myModuleID, and Warning().
|
virtual |
| theOverride | If true, values of theOther override conflicting values of this. |
References loadIcon(), myChildren, myIcon, myIconPath, myLangDependentAssets, myModuleID, and Warning().
| void SUIT_ShortcutAssets::toJSON | ( | QJsonObject & | oJsonObject | ) | const |
|
inlineprivatevirtual |
Reimplemented in SUIT_ShortcutItemAssets.
| QString SUIT_ShortcutAssets::toString | ( | ) | const |
References toJSON().
|
pure virtual |
Implemented in SUIT_ShortcutItemAssets, and SUIT_ShortcutModuleAssets.
|
private |
| QIcon SUIT_ShortcutAssets::myIcon |
Not serialized.
| QString SUIT_ShortcutAssets::myIconPath |
| std::map<QString, LangDependentAssets> SUIT_ShortcutAssets::myLangDependentAssets |
| const QString SUIT_ShortcutAssets::myModuleID |
|
static |
|
static |
|
static |