Messagelib

messagepartrenderermanager.h
1 /*
2  SPDX-FileCopyrightText: 2016-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "messageviewer_export.h"
10 
11 #include <grantlee/template.h>
12 
13 #include <QMetaType>
14 #include <QObject>
15 
16 #include <functional>
17 
18 namespace GrantleeTheme
19 {
20 class Engine;
21 }
22 
23 namespace MessageViewer
24 {
25 class GlobalContext;
26 
27 using GrantleeCallback = std::function<void(Grantlee::OutputStream *)>;
28 /**
29  * @brief The MessagePartRendererManager class
30  */
31 class MESSAGEVIEWER_EXPORT MessagePartRendererManager : public QObject
32 {
33  Q_OBJECT
34 public:
35  explicit MessagePartRendererManager(QObject *parent = nullptr);
36  ~MessagePartRendererManager() override;
37  static MessagePartRendererManager *self();
38 
39  Q_REQUIRED_RESULT Grantlee::Template loadByName(const QString &name);
40  Q_REQUIRED_RESULT Grantlee::Context createContext();
41 
42 private:
43  void initializeRenderer();
44  GrantleeTheme::Engine *m_engine = nullptr;
45  GlobalContext *m_globalContext;
46 };
47 }
48 
49 Q_DECLARE_METATYPE(MessageViewer::GrantleeCallback)
50 
const QLatin1String name
The MessagePartRendererManager class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 23:04:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.