forked from qt-creator/qt-creator
QmlDesigner: Create the CompositionNode class
This one is used to represent an effect with its attributes while editing the current composition. Also some refactoring to remove the composition properties from EffectNode. Change-Id: Idd0137db98cb608f3ead49ba3208e4480a185e88 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -11,7 +11,17 @@ namespace QmlDesigner {
|
||||
EffectNode::EffectNode(const QString &qenPath)
|
||||
: m_qenPath(qenPath)
|
||||
{
|
||||
parse(qenPath);
|
||||
const QFileInfo fileInfo = QFileInfo(qenPath);
|
||||
m_name = fileInfo.baseName();
|
||||
|
||||
QString iconPath = QStringLiteral("%1/icon/%2.svg").arg(fileInfo.absolutePath(), m_name);
|
||||
if (!QFileInfo::exists(iconPath)) {
|
||||
QDir parentDir = QDir(fileInfo.absolutePath());
|
||||
parentDir.cdUp();
|
||||
|
||||
iconPath = QStringLiteral("%1/%2").arg(parentDir.path(), "placeholder.svg");
|
||||
}
|
||||
m_iconPath = QUrl::fromLocalFile(iconPath);
|
||||
}
|
||||
|
||||
QString EffectNode::qenPath() const
|
||||
@@ -24,50 +34,9 @@ QString EffectNode::name() const
|
||||
return m_name;
|
||||
}
|
||||
|
||||
int EffectNode::nodeId() const
|
||||
{
|
||||
return m_nodeId;
|
||||
}
|
||||
|
||||
QString EffectNode::fragmentCode() const
|
||||
{
|
||||
return m_fragmentCode;
|
||||
}
|
||||
|
||||
QString EffectNode::vertexCode() const
|
||||
{
|
||||
return m_vertexCode;
|
||||
}
|
||||
|
||||
QString EffectNode::qmlCode() const
|
||||
{
|
||||
return m_qmlCode;
|
||||
}
|
||||
|
||||
QString EffectNode::description() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
void EffectNode::parse(const QString &qenPath)
|
||||
{
|
||||
const QFileInfo fileInfo = QFileInfo(qenPath);
|
||||
m_name = fileInfo.baseName();
|
||||
|
||||
QString iconPath = QStringLiteral("%1/icon/%2.svg").arg(fileInfo.absolutePath(), m_name);
|
||||
if (!QFileInfo::exists(iconPath)) {
|
||||
QDir parentDir = QDir(fileInfo.absolutePath());
|
||||
parentDir.cdUp();
|
||||
|
||||
iconPath = QStringLiteral("%1/%2").arg(parentDir.path(), "placeholder.svg");
|
||||
}
|
||||
m_iconPath = QUrl::fromLocalFile(iconPath);
|
||||
|
||||
// TODO: QDS-10467
|
||||
// Parse the effect from QEN file
|
||||
// The process from the older implementation has the concept of `project`
|
||||
// and it contains source & dest nodes that we don't need
|
||||
}
|
||||
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Reference in New Issue
Block a user