FullRepresentation.qml 1.53 KB
Newer Older
1
/*
2
 * SPDX-FileCopyrightText: 2018 Friedrich W. H. Kossebau <kossebau@kde.org>
3
 *
4
 * SPDX-License-Identifier: GPL-2.0-or-later
5 6
 */

7
import QtQuick 2.9
8

9
import QtQuick.Layouts 1.3
10 11

import org.kde.plasma.plasmoid 2.0
12
import org.kde.plasma.core 2.0 as PlasmaCore
13
import org.kde.plasma.components 3.0 as PlasmaComponents
14

15
ColumnLayout {
16 17
    id: fullRoot

18
    Layout.margins: PlasmaCore.Units.smallSpacing
19

20 21
    property alias generalModel: topPanel.generalModel
    property alias observationModel: topPanel.observationModel
22

23
    TopPanel {
24
        id: topPanel
25

26
        Layout.fillWidth: true
27 28
    }

29 30
    SwitchPanel {
        Layout.fillWidth: true
31

32
        forecastViewTitle: generalModel.forecastTitle
33 34 35
        forecastModel: root.forecastModel
        detailsModel: root.detailsModel
        noticesModel: root.noticesModel
36 37 38
    }

    PlasmaComponents.Label {
39
        readonly property string creditUrl: generalModel.creditUrl
40

41 42
        Layout.alignment: Qt.AlignVCenter | Qt.AlignRight

43 44 45 46 47 48 49 50 51
        wrapMode: Text.WordWrap
        horizontalAlignment: Text.AlignRight
        font {
            pointSize: theme.smallestFont.pointSize
            underline: !!creditUrl
        }
        linkColor : color
        opacity: 0.6
        textFormat: Text.StyledText
52

53
        text: {
54
            var result = generalModel.courtesy;
55 56 57 58 59 60 61 62 63 64 65
            if (creditUrl) {
                result = "<a href=\"" + creditUrl + "\">" + result + "</a>";
            }
            return result;
        }

        onLinkActivated: {
            Qt.openUrlExternally(link);
        }
    }
}