aboutsummaryrefslogtreecommitdiffstats
path: root/src/clapcontrols/ClapWindow.qml
blob: 8047647ddccbb31e76e935cfaaa4e8188f215321 (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
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Qt-Commercial

import QtQuick
import QtQuick.Controls.Basic

import Clap.Interface
import Clap.Controls

ApplicationWindow {
    id: ctrl

    property bool pluginActive: true
    readonly property color cBg: QClapStyle.color("bg")

    visible: true
    flags: Qt.Window | Qt.WindowStaysOnTopHint | Qt.CustomizeWindowHint
    color: pluginActive ? cBg : Qt.tint(cBg, QClapStyle.color("tint"))

    Connections {
        target: ClapInterface
        function onVisibleChanged() {
            ctrl.visible = ClapInterface.visible;
        }
        function onTransientParentChanged() {
            console.log("transient parent changed " + ClapInterface.transientParent);
            ctrl.transientParent = ClapInterface.transientParent;
        }
        // function onStateChanged() {
        //     ctrl.pluginActive = QClapInterface.state == QClapInterface.Active;
        // }
    }

    Component.onCompleted: {
        QClapStyle.loadFont(0);
    }
}