2023-06-29 15:06:11 +03:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
|
|
|
|
|
|
#include "effectnode.h"
|
|
|
|
|
|
2023-08-14 11:12:04 +03:00
|
|
|
#include <QDir>
|
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
|
2023-06-29 15:06:11 +03:00
|
|
|
namespace QmlDesigner {
|
|
|
|
|
|
2023-08-14 11:12:04 +03:00
|
|
|
EffectNode::EffectNode(const QString &qenPath)
|
|
|
|
|
: m_qenPath(qenPath)
|
|
|
|
|
{
|
2023-08-16 11:35:10 +03:00
|
|
|
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);
|
2023-08-14 11:12:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString EffectNode::qenPath() const
|
|
|
|
|
{
|
|
|
|
|
return m_qenPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString EffectNode::name() const
|
|
|
|
|
{
|
|
|
|
|
return m_name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString EffectNode::description() const
|
|
|
|
|
{
|
|
|
|
|
return m_description;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-29 15:06:11 +03:00
|
|
|
} // namespace QmlDesigner
|