summaryrefslogtreecommitdiff
path: root/gui/components/MotdBox.qml
blob: 18c928ea200dc49e210b266d718a23ba2659d4b6 (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
import QtQuick 2.15
import QtQuick.Controls 2.2
import QtGraphicalEffects 1.0
import "../themes/themes.js" as Theme

Item {
    id: motdBox
    width: parent.width
    property var motdText: ""
    property var motdLink: ""
    property var url: ""
    anchors.horizontalCenter: parent.horizontalCenter

    Rectangle {

        id: labelWrapper
        color: "transparent"
        height: label.paintedHeight + Theme.windowMargin
        width: parent.width
        anchors.verticalCenter: parent.verticalCenter

        Label {
            id: label
            width: labelWrapper.width - Theme.windowMargin
            anchors.centerIn: parent
            text: motdBox.motdText
            horizontalAlignment: Text.AlignHCenter
            wrapMode: Text.Wrap
            font.pixelSize: Theme.fontSizeSmall - 2
            onLinkActivated: Qt.openUrlExternally(link)
            HoverHandler {
                cursorShape: Qt.PointingHandCursor
            }
         }

        Label {
            id: link
            color: Theme.green
            width: labelWrapper.width - Theme.windowMargin
            anchors.top: label.bottom
            anchors.topMargin: 10
            text: motdBox.motdLink
            horizontalAlignment: Text.AlignHCenter
            wrapMode: Label.Wrap
            font.pixelSize: Theme.fontSizeSmall
            onLinkActivated: Qt.openUrlExternally(link)
            HoverHandler {
                cursorShape: Qt.PointingHandCursor
            }
         }
    }
}