summaryrefslogtreecommitdiff
path: root/src/manager-lib/runtimefactory.h
blob: 8a15d0a1aafbe62d8b8314f2eec5afb5c9b2f015 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#pragma once

#include <QHash>
#include <QObject>

#include <QtAppManCommon/global.h>

QT_BEGIN_NAMESPACE_AM

class Application;
class AbstractRuntime;
class AbstractRuntimeManager;
class AbstractContainer;


class RuntimeFactory : public QObject
{
    Q_OBJECT
public:
    static RuntimeFactory *instance();
    ~RuntimeFactory();

    QStringList runtimeIds() const;

    AbstractRuntimeManager *manager(const QString &id);
    AbstractRuntime *create(AbstractContainer *container, Application *app);
    AbstractRuntime *createQuickLauncher(AbstractContainer *container, const QString &id);

    void setConfiguration(const QVariantMap &configuration);
    void setSystemProperties(const QVariantMap &thirdParty, const QVariantMap &builtIn);
    void setSlowAnimations(bool isSlow);
    void setSystemOpenGLConfiguration(const QVariantMap &openGLConfiguration);
    void setIconTheme(const QStringList &themeSearchPaths, const QString &themeName);

    bool registerRuntime(AbstractRuntimeManager *manager);
    bool registerRuntime(AbstractRuntimeManager *manager, const QString &identifier);

private:
    RuntimeFactory(QObject *parent = nullptr);
    RuntimeFactory(const RuntimeFactory &);
    RuntimeFactory &operator=(const RuntimeFactory &);
    static RuntimeFactory *s_instance;

    QHash<QString, AbstractRuntimeManager *> m_runtimes;

    // To be passed to newly created runtimes
    bool m_slowAnimations{false};
};

QT_END_NAMESPACE_AM