Messagelib

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

KDE's Doxygen guidelines are available online.