cutelyst  3.7.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
cuteleeview.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2013-2022 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef CUTELEE_VIEW_H
6 #define CUTELEE_VIEW_H
7 
8 #include <QObject>
9 #include <QStringList>
10 #include <QLocale>
11 #include <QVector>
12 
13 #include <Cutelyst/View>
14 
15 class QTranslator;
16 
17 namespace Cutelee {
18 class Engine;
19 }
20 
21 namespace Cutelyst {
22 
23 class CuteleeViewPrivate;
35 class CUTELYST_VIEW_CUTELEE_EXPORT CuteleeView final : public View
36 {
37  Q_OBJECT
38  Q_DECLARE_PRIVATE(CuteleeView)
39 public:
43  explicit CuteleeView(QObject *parent = nullptr, const QString &name = QString());
44 
45  Q_PROPERTY(QStringList includePaths READ includePaths WRITE setIncludePaths NOTIFY changed)
49  QStringList includePaths() const;
50 
54  void setIncludePaths(const QStringList &paths);
55 
56  Q_PROPERTY(QString templateExtension READ templateExtension WRITE setTemplateExtension NOTIFY changed)
60  QString templateExtension() const;
61 
65  void setTemplateExtension(const QString &extension);
66 
67  Q_PROPERTY(QString wrapper READ wrapper WRITE setWrapper NOTIFY changed)
68 
69 
72  QString wrapper() const;
73 
78  void setWrapper(const QString &name);
79 
80  Q_PROPERTY(bool cache READ isCaching WRITE setCache NOTIFY changed)
84  bool isCaching() const;
85 
90  void setCache(bool enable);
91 
95  Cutelee::Engine *engine() const;
96 
100  void preloadTemplates();
101 
102  QByteArray render(Context *c) const final;
103 
133  void addTranslator(const QLocale &locale, QTranslator *translator);
134 
146  void addTranslator(const QString &locale, QTranslator *translator);
147 
176  void addTranslationCatalog(const QString &path, const QString &catalog);
177 
186  void addTranslationCatalogs(const QMultiHash<QString, QString> &catalogs);
187 
213  QVector<QLocale> loadTranslationsFromDir(const QString &filename, const QString &directory, const QString &prefix = QStringLiteral("."), const QString &suffix = QStringLiteral(".qm"));
214 
215 Q_SIGNALS:
216  void changed();
217 };
218 
219 }
220 
221 #endif // CUTELEE_VIEW_H
The Cutelyst Context.
Definition: context.h:39
Cutelyst View abstract view component
Definition: view.h:22
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8