FullRepresentation.qml 1.47 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.components 3.0 as PlasmaComponents
13

14
ColumnLayout {
15 16
    id: fullRoot

17
    Layout.margins: units.smallSpacing
18

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

22
    TopPanel {
23
        id: topPanel
24

25
        Layout.fillWidth: true
26 27
    }

28 29
    SwitchPanel {
        Layout.fillWidth: true
30

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

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

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

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

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

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