summaryrefslogtreecommitdiffstats
path: root/QtLauncher/DetailView.qml
blob: 2c750ec7c6f649ca2f3e10d5e4d54753e74cb8cf (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
119
120
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
pragma ComponentBehavior: Bound

import QtQuick
import QtQuick.Controls.Basic
import QtLauncher

Item {
    id: detailRoot
    anchors.fill: parent
    property alias appsModel: thumbList.model
    required property real pageMargin

    Item {
        id: detailInformation
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.top: parent.top
        anchors.bottom: listHolder.top
        anchors.margins: detailRoot.pageMargin

        CornerFrameImage {
            id: largeImg
            anchors.right: parent.right
            height: parent.height
            width: parent.width * 0.5

            MouseArea {
                anchors.fill: parent
                onClicked: detailRoot.appsModel.launchFromIndex(thumbList.currentIndex)
            }
        }

        Flickable {
            id: detailFlickable
            anchors.left: parent.left
            anchors.right: largeImg.left
            anchors.top: parent.top
            anchors.bottom: parent.bottom
            anchors.bottomMargin: detailRoot.pageMargin * 0.5
            anchors.rightMargin: detailRoot.pageMargin
            contentHeight: descriptionHolder.height
            contentWidth: width
            clip: true

            ScrollBar.vertical: FlickSlider { pageMargin: detailRoot.pageMargin }

            Column {
                id: descriptionHolder
                anchors.left: parent.left
                anchors.right: parent.right
                anchors.rightMargin: detailRoot.pageMargin * 0.5
                spacing: detailRoot.pageMargin * 0.5

                Text {
                    id: descriptionTitle
                    font.pixelSize: detailInformation.height * 0.11
                    width: descriptionHolder.width
                    text: qsTr("Demo Title")
                    color: ViewSettings.neon
                    font.family: ViewSettings.appFont
                    font.styleName: "SemiBold"
                    wrapMode: Text.WordWrap
                }

                Rectangle {
                    id: btmLine
                    width: descriptionTitle.paintedWidth
                    height: 2
                }

                Text {
                    id: descriptionText
                    anchors.margins: detailRoot.pageMargin * 0.5
                    font.pixelSize: detailInformation.height * 0.05
                    font.family: ViewSettings.appFont
                    width: descriptionHolder.width
                    wrapMode: Text.WordWrap
                    color: "white"
                    elide: Text.ElideRight
                }
            }
        }
    }

    Rectangle {
        id: listHolder
        anchors.bottom: parent.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        height: parent.height * 0.35
        color: ViewSettings.demolistBackgroundColor

        ListView {
            id: thumbList
            anchors.fill: parent
            anchors.margins: detailRoot.pageMargin * 0.5
            orientation: ListView.Horizontal
            onCurrentIndexChanged: {
                descriptionTitle.text = model.query(currentIndex, "name")
                descriptionText.text = model.query(currentIndex, "description")
                largeImg.source = model.query(currentIndex, "icon")
            }

            delegate: DetailViewIcon {
                required property var model
                required property int index
                pageMargin: detailRoot.pageMargin
                height: thumbList.height
                width: height
                isSelected: thumbList.currentIndex === index

                onClicked: thumbList.currentIndex = index
            }

            ScrollBar.horizontal: FlickSlider { pageMargin: detailRoot.pageMargin }
        }
    }
}