FullRepresentation.qml 2.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * Copyright 2018  Friedrich W. H. Kossebau <kossebau@kde.org>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

18
import QtQuick 2.9
19

20
import QtQuick.Layouts 1.3
21 22

import org.kde.plasma.plasmoid 2.0
23
import org.kde.plasma.components 3.0 as PlasmaComponents
24

25
ColumnLayout {
26 27
    id: fullRoot

28
    Layout.margins: units.smallSpacing
29

30 31
    property alias generalModel: topPanel.generalModel
    property alias observationModel: topPanel.observationModel
32

33
    TopPanel {
34
        id: topPanel
35

36
        Layout.fillWidth: true
37 38
    }

39 40
    SwitchPanel {
        Layout.fillWidth: true
41

42
        forecastViewTitle: generalModel.forecastTitle
43 44 45
        forecastModel: root.forecastModel
        detailsModel: root.detailsModel
        noticesModel: root.noticesModel
46 47 48
    }

    PlasmaComponents.Label {
49
        readonly property string creditUrl: generalModel.creditUrl
50

51 52
        Layout.alignment: Qt.AlignVCenter | Qt.AlignRight

53 54 55 56 57 58 59 60 61
        wrapMode: Text.WordWrap
        horizontalAlignment: Text.AlignRight
        font {
            pointSize: theme.smallestFont.pointSize
            underline: !!creditUrl
        }
        linkColor : color
        opacity: 0.6
        textFormat: Text.StyledText
62

63
        text: {
64
            var result = generalModel.courtesy;
65 66 67 68 69 70 71 72 73 74 75
            if (creditUrl) {
                result = "<a href=\"" + creditUrl + "\">" + result + "</a>";
            }
            return result;
        }

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