Warning, /education/gcompris/src/activities/piano_composition/LyricsArea.qml is written in an unsupported language. File is not indexed.
0001 /* GCompris - LyricsArea.qml 0002 * 0003 * SPDX-FileCopyrightText: 2018 Aman Kumar Gupta <gupta2140@gmail.com> 0004 * 0005 * Authors: 0006 * Beth Hadley <bethmhadley@gmail.com> (GTK+ version) 0007 * Johnny Jazeix <jazeix@gmail.com> (Qt Quick port) 0008 * Aman Kumar Gupta <gupta2140@gmail.com> (Qt Quick port) 0009 * 0010 * SPDX-License-Identifier: GPL-3.0-or-later 0011 */ 0012 import QtQuick 2.12 0013 import GCompris 1.0 0014 0015 import "../../core" 0016 0017 Rectangle { 0018 id: lyricsArea 0019 0020 property string title: "" 0021 property string origin: "" 0022 property string lyrics: "" 0023 0024 border.width: 3 0025 radius: 5 0026 border.color: "black" 0027 opacity: 0.8 0028 visible: background.isLyricsMode 0029 Item { 0030 id: melodyTitle 0031 width: parent.width 0032 height: parent.height / 6 0033 GCText { 0034 id: titleText 0035 fontSizeMode: Text.Fit 0036 wrapMode: Text.WordWrap 0037 text: qsTr("Title: %1").arg(lyricsArea.title) 0038 anchors.fill: parent 0039 anchors.rightMargin: parent.width * 0.02 0040 anchors.leftMargin: parent.width * 0.02 0041 horizontalAlignment: Text.AlignHCenter 0042 verticalAlignment: Text.AlignVCenter 0043 font.bold: true 0044 color: "green" 0045 } 0046 } 0047 0048 Rectangle { 0049 id: titleUnderline 0050 width: titleText.contentWidth 0051 height: 3 0052 color: "black" 0053 anchors.top: melodyTitle.bottom 0054 anchors.horizontalCenter: melodyTitle.horizontalCenter 0055 } 0056 0057 Item { 0058 id: melodyOrigin 0059 width: parent.width 0060 height: parent.height / 8 0061 anchors.top: titleUnderline.bottom 0062 GCText { 0063 fontSizeMode: Text.Fit 0064 wrapMode: Text.WordWrap 0065 text: qsTr("Origin: %1").arg(lyricsArea.origin) 0066 anchors.fill: parent 0067 anchors.rightMargin: parent.width * 0.02 0068 anchors.leftMargin: parent.width * 0.02 0069 horizontalAlignment: Text.AlignHCenter 0070 verticalAlignment: Text.AlignVCenter 0071 font.italic: true 0072 color: "red" 0073 } 0074 } 0075 0076 Item { 0077 id: melodyLyrics 0078 width: parent.width 0079 height: parent.height - melodyTitle.height - melodyOrigin.height - 20 0080 anchors.top: melodyOrigin.bottom 0081 GCText { 0082 fontSizeMode: Text.Fit 0083 wrapMode: Text.WordWrap 0084 text: lyricsArea.lyrics 0085 anchors.fill: parent 0086 anchors.rightMargin: parent.width * 0.05 0087 anchors.leftMargin: parent.width * 0.05 0088 horizontalAlignment: Text.AlignHCenter 0089 verticalAlignment: Text.AlignVCenter 0090 } 0091 } 0092 0093 function resetLyricsArea() { 0094 lyricsArea.title = "" 0095 lyricsArea.origin = "" 0096 lyricsArea.lyrics = "" 0097 optionsRow.lyricsOrPianoModeIndex = 0 0098 } 0099 0100 function setLyrics(title, origin, lyrics) { 0101 resetLyricsArea() 0102 lyricsArea.title = title 0103 lyricsArea.origin = origin 0104 lyricsArea.lyrics = lyrics 0105 optionsRow.lyricsOrPianoModeIndex = 1 0106 } 0107 }