Version: 9.15.0
SUIT_ShortcutItemAssets Class Reference

May represent not just an action, but also a folder within item tree of a module. May also represent action-folder: an action with nested actions. Each action inModuleID is unique within a tree of assets. More...

#include <SUIT_ShortcutMgr.h>

Inheritance diagram for SUIT_ShortcutItemAssets:
Inheritance graph

Public Member Functions

 ~SUIT_ShortcutItemAssets ()=default
 
int depth () const
 
SUIT_ShortcutAssets::Type type () const
 
void merge (const SUIT_ShortcutItemAssets &theOther, bool theOverride)
 
virtual void merge (SUIT_ShortcutItemAssets &&theOther, bool theOverride)
 
const QString & bestName (const QString &theLang=QString()) const
 
const QString & bestPath (const QString theLang=QString()) const
 Composed as <depth_1_item.bestName>/...<depth_N_item.bestName>.../<this->bestName>. Module name is not included. More...
 
QString description () const
 
bool isAction () const
 
bool isFolder () const
 
std::shared_ptr< SUIT_ShortcutAssetsparent () const
 
std::shared_ptr< SUIT_ShortcutModuleAssetsmodule () const
 
QString actionID () const
 Even if SUIT_ShortcutItemAssets is not action, its ID is composed in the same way. More...
 
const QIcon & icon () const
 
- Public Member Functions inherited from SUIT_ShortcutAssets
virtual ~SUIT_ShortcutAssets ()=0
 
const std::map< QString, std::shared_ptr< SUIT_ShortcutItemAssets > > & children () const
 
std::shared_ptr< SUIT_ShortcutItemAssetsfindDescendantItem (const QString &theRelativeID) const
 
std::shared_ptr< SUIT_ShortcutItemAssetsdescendantItem (const QString &theRelativeID, bool theIsAction=true)
 
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
 
QStringList getLangs () const
 
void clearAllLangsExcept (const QString &theLang)
 
const LangDependentAssetsbestLangDependentAssets (QString theLang=QString()) const
 
virtual const QString & bestToolTip (const QString &theLang=QString()) const
 

Static Public Member Functions

static void loadDefaultIcons ()
 

Public Attributes

const QString myIDLastToken
 
const QString myInModuleID
 
- Public Attributes inherited from SUIT_ShortcutAssets
const QString myModuleID
 
std::map< QString, LangDependentAssetsmyLangDependentAssets
 
QString myIconPath
 
QIcon myIcon
 

Static Public Attributes

static const QString PROP_ID_IS_ACTION = "isAction"
 
- Static Public Attributes inherited from SUIT_ShortcutAssets
static const QString PROP_ID_LANG_DEPENDENT_ASSETS = "langDependentAssets"
 
static const QString PROP_ID_ICON_PATH = "iconPath"
 
static const QString PROP_ID_CHILDREN = "children"
 

Private Member Functions

 SUIT_ShortcutItemAssets (std::shared_ptr< SUIT_ShortcutModuleAssets > theModule, const QString &theIDLastToken, bool theIsAction=true)
 Creates root item of module. More...
 
 SUIT_ShortcutItemAssets (std::shared_ptr< SUIT_ShortcutItemAssets > theParentItem, const QString &theIDLastToken, bool theIsAction=true)
 Creates nested item within item tree of module. More...
 
 SUIT_ShortcutItemAssets (const SUIT_ShortcutItemAssets &)=delete
 
SUIT_ShortcutItemAssetsoperator= (const SUIT_ShortcutItemAssets &)=delete
 
bool fromJSONOtherProps (const QJsonObject &theJsonObject)
 Parses properties of SUIT_ShortcutAssets subclasses. More...
 
void toJSONVirtual (QJsonObject &oJsonObject) const
 

Static Private Member Functions

static std::shared_ptr< SUIT_ShortcutItemAssetscreate (std::shared_ptr< SUIT_ShortcutAssets > theParentItemOrModule, const QString &theIDLastToken, bool theIsAction=true)
 

Private Attributes

std::weak_ptr< SUIT_ShortcutAssetsmyParent
 
bool myIsAction
 
const int myDepth
 
std::map< QString, QString > myBestPaths
 {lang, bestPath}[] More...
 

Static Private Attributes

static QIcon DEFAUT_ICON_ACTION = QIcon()
 
static QIcon DEFAUT_ICON_FOLDER = QIcon()
 
static QIcon DEFAUT_ICON_FOLDER_ACTION = QIcon()
 

Friends

class SUIT_ShortcutAssets
 

Additional Inherited Members

- Public Types inherited from SUIT_ShortcutAssets
enum class  Type { Module , Item }
 
- Protected Member Functions inherited from SUIT_ShortcutAssets
 SUIT_ShortcutAssets (const QString &theModuleID)
 

Detailed Description

May represent not just an action, but also a folder within item tree of a module. May also represent action-folder: an action with nested actions. Each action inModuleID is unique within a tree of assets.

Constructor & Destructor Documentation

◆ SUIT_ShortcutItemAssets() [1/3]

SUIT_ShortcutItemAssets::SUIT_ShortcutItemAssets ( std::shared_ptr< SUIT_ShortcutModuleAssets theModule,
const QString &  theIDLastToken,
bool  theIsAction = true 
)
private

Creates root item of module.

Parameters
theModulemust not be nullptr.
theIDLastTokenis also a inModuleID.

◆ SUIT_ShortcutItemAssets() [2/3]

SUIT_ShortcutItemAssets::SUIT_ShortcutItemAssets ( std::shared_ptr< SUIT_ShortcutItemAssets theParentItem,
const QString &  theIDLastToken,
bool  theIsAction = true 
)
private

Creates nested item within item tree of module.

Parameters
theParentmust not be nullptr.

◆ SUIT_ShortcutItemAssets() [3/3]

SUIT_ShortcutItemAssets::SUIT_ShortcutItemAssets ( const SUIT_ShortcutItemAssets )
privatedelete

◆ ~SUIT_ShortcutItemAssets()

SUIT_ShortcutItemAssets::~SUIT_ShortcutItemAssets ( )
default

Member Function Documentation

◆ actionID()

QString SUIT_ShortcutItemAssets::actionID ( ) const

Even if SUIT_ShortcutItemAssets is not action, its ID is composed in the same way.

References myInModuleID, SUIT_ShortcutAssets::myModuleID, and TOKEN_SEPARATOR.

◆ bestName()

const QString & SUIT_ShortcutItemAssets::bestName ( const QString &  theLang = QString()) const
virtual
Parameters
theLangIf empty, current language is requested.
Returns
Requested name or name in EN, if requested language is absent. If EN is absent - inModuleID.

Implements SUIT_ShortcutAssets.

References SUIT_ShortcutAssets::bestLangDependentAssets(), and myIDLastToken.

◆ bestPath()

const QString & SUIT_ShortcutItemAssets::bestPath ( const QString  theLang = QString()) const

Composed as <depth_1_item.bestName>/...<depth_N_item.bestName>.../<this->bestName>. Module name is not included.

References actionID(), bestName(), SUIT_ShortcutMgr::currentLang(), depth(), SUIT_ShortcutAssets::Item, myBestPaths, myInModuleID, parent(), SUIT_ShortcutMgr::splitIntoTokens(), TOKEN_SEPARATOR, and Warning().

◆ create()

std::shared_ptr< SUIT_ShortcutItemAssets > SUIT_ShortcutItemAssets::create ( std::shared_ptr< SUIT_ShortcutAssets theParentItemOrModule,
const QString &  theIDLastToken,
bool  theIsAction = true 
)
staticprivate

◆ depth()

int SUIT_ShortcutItemAssets::depth ( ) const
virtual

Implements SUIT_ShortcutAssets.

References myDepth.

◆ description()

QString SUIT_ShortcutItemAssets::description ( ) const
virtual

Implements SUIT_ShortcutAssets.

References actionID(), and myIsAction.

◆ fromJSONOtherProps()

bool SUIT_ShortcutItemAssets::fromJSONOtherProps ( const QJsonObject &  theJsonObject)
privatevirtual

Parses properties of SUIT_ShortcutAssets subclasses.

Returns
true, if any property is parsed.

Reimplemented from SUIT_ShortcutAssets.

References myIsAction, and PROP_ID_IS_ACTION.

◆ icon()

const QIcon & SUIT_ShortcutItemAssets::icon ( ) const
Returns
myIcon, if !myIcon.isNull(). Otherwise returns appropriate default icon.

References SUIT_ShortcutAssets::children(), DEFAUT_ICON_ACTION, DEFAUT_ICON_FOLDER, DEFAUT_ICON_FOLDER_ACTION, SUIT_ShortcutAssets::myIcon, and myIsAction.

◆ isAction()

bool SUIT_ShortcutItemAssets::isAction ( ) const

References myIsAction.

◆ isFolder()

bool SUIT_ShortcutItemAssets::isFolder ( ) const

◆ loadDefaultIcons()

void SUIT_ShortcutItemAssets::loadDefaultIcons ( )
static

◆ merge() [1/2]

void SUIT_ShortcutItemAssets::merge ( const SUIT_ShortcutItemAssets theOther,
bool  theOverride 
)
Parameters
theOverrideIf true, values of theOther override conflicting values of this.

References SUIT_ShortcutAssets::merge(), myInModuleID, myIsAction, SUIT_ShortcutAssets::myModuleID, TOKEN_SEPARATOR, and Warning().

◆ merge() [2/2]

void SUIT_ShortcutItemAssets::merge ( SUIT_ShortcutItemAssets &&  theOther,
bool  theOverride 
)
virtual
Parameters
theOverrideIf true, values of theOther override conflicting values of this.

References SUIT_ShortcutAssets::merge(), myInModuleID, myIsAction, SUIT_ShortcutAssets::myModuleID, TOKEN_SEPARATOR, and Warning().

◆ module()

std::shared_ptr< SUIT_ShortcutModuleAssets > SUIT_ShortcutItemAssets::module ( ) const

◆ operator=()

SUIT_ShortcutItemAssets& SUIT_ShortcutItemAssets::operator= ( const SUIT_ShortcutItemAssets )
privatedelete

◆ parent()

std::shared_ptr< SUIT_ShortcutAssets > SUIT_ShortcutItemAssets::parent ( ) const

References myParent.

◆ toJSONVirtual()

void SUIT_ShortcutItemAssets::toJSONVirtual ( QJsonObject &  oJsonObject) const
privatevirtual

Reimplemented from SUIT_ShortcutAssets.

References myIsAction, and PROP_ID_IS_ACTION.

◆ type()

SUIT_ShortcutAssets::Type SUIT_ShortcutItemAssets::type ( ) const
inlinevirtual

Friends And Related Function Documentation

◆ SUIT_ShortcutAssets

friend class SUIT_ShortcutAssets
friend

Member Data Documentation

◆ DEFAUT_ICON_ACTION

QIcon SUIT_ShortcutItemAssets::DEFAUT_ICON_ACTION = QIcon()
staticprivate

◆ DEFAUT_ICON_FOLDER

QIcon SUIT_ShortcutItemAssets::DEFAUT_ICON_FOLDER = QIcon()
staticprivate

◆ DEFAUT_ICON_FOLDER_ACTION

QIcon SUIT_ShortcutItemAssets::DEFAUT_ICON_FOLDER_ACTION = QIcon()
staticprivate

◆ myBestPaths

std::map<QString, QString> SUIT_ShortcutItemAssets::myBestPaths
mutableprivate

{lang, bestPath}[]

◆ myDepth

const int SUIT_ShortcutItemAssets::myDepth
private

◆ myIDLastToken

const QString SUIT_ShortcutItemAssets::myIDLastToken

◆ myInModuleID

const QString SUIT_ShortcutItemAssets::myInModuleID

◆ myIsAction

bool SUIT_ShortcutItemAssets::myIsAction
private

◆ myParent

std::weak_ptr<SUIT_ShortcutAssets> SUIT_ShortcutItemAssets::myParent
private

◆ PROP_ID_IS_ACTION

const QString SUIT_ShortcutItemAssets::PROP_ID_IS_ACTION = "isAction"
static

The documentation for this class was generated from the following files: