summaryrefslogtreecommitdiffstats
path: root/tools/qqem/qml/OutputView.qml
blob: e48f03e8b06a51d325be7581ec2ee8cc5b6938f1 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QQEMLib 1.0

Item {
    id: rootItem

    property alias outputEditorView: outputEditorView
    property alias effectPreview: effectPreview

    function showHelp() {
        tabBarViews.currentIndex = 2;
    }
    function showCodePreview() {
        tabBarViews.currentIndex = 1;
    }

    function renderToImage(filename) {
        effectPreview.renderToImage(filename);
    }

    FpsHelper {
        id: fpsHelper
        enabled: previewAnimationRunning
    }

    TabBar {
        id: tabBarViews
        currentIndex: 0
        TabButton {
            text: "Preview"
            width: 100
        }
        TabButton {
            text: "Code"
            width: 100
        }
        TabButton {
            text: "Help"
            width: 100
        }
    }
    Rectangle {
        anchors.fill: toolbarRow
        color: mainView.backgroundColor1
        opacity: 0.8
    }
    Row {
        id: toolbarRow
        anchors.right: parent.right
        anchors.verticalCenter: tabBarViews.verticalCenter
        height: tabBarViews.height * 0.8
        PlaybackTimeComponent {
            id: playbackTimeComponent
        }
        Item {
            width: 10
            height: 1
        }
        CustomIconButton {
            id: resetTimeButton
            height: parent.height
            width: height
            icon: "images/icon_restart.png"
            description: "Restart time"
            onClicked: {
                // Reset the time to 0
                previewFrameTimer.reset();
                playbackTimeComponent.reset();
            }
        }
        CustomIconButton {
            id: playPauseButton
            height: parent.height
            width: height
            icon: previewAnimationRunning ? "images/icon_pause.png" : "images/icon_play.png"
            description: "Play / Pause time"
            onClicked: {
                previewAnimationRunning = !previewAnimationRunning;
            }
        }
    }

    EffectPreview {
        id: effectPreview
        anchors.top: tabBarViews.bottom
        anchors.bottom: statusBar.top
        width: parent.width
        FrameAnimation {
            id: previewFrameTimer
            running: true
            paused: !previewAnimationRunning
        }
    }
    EditorView {
        id: outputEditorView
        anchors.top: tabBarViews.bottom
        anchors.bottom: statusBar.top
        width: parent.width
        editable: false
        visible: tabBarViews.currentIndex == 1
    }
    HelpView {
        id: helpView
        anchors.top: tabBarViews.bottom
        anchors.bottom: statusBar.top
        width: parent.width
        visible: tabBarViews.currentIndex == 2
    }

    StatusBar {
        id: statusBar
    }
}