21 #include "mediafinder.h"
24 #include "exception.h"
28 #include <QtCore/QUrl>
30 MediaFinderNodeFactory::MediaFinderNodeFactory() {}
37 if (expr.size() <= 1) {
40 QStringLiteral(
"'media_finder' tag requires at least one argument"));
47 MediaFinderNode::MediaFinderNode(
48 const QList<FilterExpression> &mediaExpressionList, QObject *parent)
49 :
Node(parent), m_mediaExpressionList(mediaExpressionList)
56 auto engine = t->engine();
60 auto fileUrl = engine->mediaUri(
getSafeString(fe.resolve(c)));
61 if (fileUrl.second.isEmpty())
63 auto uri = QUrl::fromLocalFile(fileUrl.first).toString();
64 c->addExternalMedia(uri, fileUrl.second);
65 if (c->
urlType() == Context::AbsoluteUrls)
QList< FilterExpression > getFilterExpressionList(const QStringList &list, Parser *p) const
Q_INVOKABLE QStringList smartSplit(const QString &str) const
The Context class holds the context to render a Template with.
QString relativeMediaPath() const
An exception for use when implementing template tags.
A FilterExpression object represents a filter expression in a template.
Base class for all nodes.
void streamValueInContext(OutputStream *stream, const QVariant &input, Cutelee::Context *c) const
TemplateImpl * containerTemplate() const
The OutputStream class is used to render templates to a QTextStream.
The Parser class processes a string template into a tree of nodes.
Cutelee::SafeString getSafeString(const QVariant &input)
Utility functions used throughout Cutelee.