summaryrefslogtreecommitdiffstats
path: root/src/tools/launcher-qml/launcher-qml_p.h
blob: c4676bb0bc025afe4703ef43459dfb659ed4e0fa (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
56
// 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 WITH Qt-GPL-exception-1.0

#ifndef LAUNCHER_QML_P_H
#define LAUNCHER_QML_P_H

#include <QObject>
#include <QVariantMap>
#include <QVector>
#include <QPointer>
#include <QQmlIncubationController>
#include <QQmlApplicationEngine>
#include <QtAppManCommon/global.h>

QT_FORWARD_DECLARE_CLASS(QTimerEvent)
QT_FORWARD_DECLARE_CLASS(QQuickWindow)

QT_BEGIN_NAMESPACE_AM

class ApplicationMain;

class Controller : public QObject
{
    Q_OBJECT

public:
    Controller(ApplicationMain *am, bool quickLaunched);
    Controller(ApplicationMain *am, bool quickLaunched, const QPair<QString, QString> &directLoad);

public Q_SLOTS:
    void startApplication(const QString &baseDir, const QString &qmlFile, const QString &document,
                          const QString &mimeType, const QVariantMap &application,
                          const QVariantMap &systemProperties);

private:
    QQmlApplicationEngine m_engine;
    QVariantMap m_configuration;
    bool m_launched = false;
    bool m_quickLaunched;
    QQuickWindow *m_window = nullptr;
    QVector<QPointer<QQuickWindow>> m_allWindows;

    void updateSlowAnimationsForWindow(QQuickWindow *window);

protected:
    bool eventFilter(QObject *o, QEvent *e) override;

private Q_SLOTS:
    void updateSlowAnimations(bool isSlow);
};

QT_END_NAMESPACE_AM

#endif // LAUNCHER_QML_P_H