diff --git a/src/qml/DownloadPage.qml b/src/qml/DownloadPage.qml index 2592745..22547ad 100644 --- a/src/qml/DownloadPage.qml +++ b/src/qml/DownloadPage.qml @@ -1,115 +1,117 @@ /* * Copyright 2018 Andreas Cord-Landwehr * * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL */ import QtQuick 2.1 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.7 as Kirigami import org.kde.newstuff 1.0 as KNS Kirigami.Page { id: root /** * emitted whenever GHNS resources changed */ signal statusChanged(); title: i18n("Download Training Material") background: Rectangle { - color: Kirigami.Theme.viewBackgroundColor + color: Kirigami.Theme.backgroundColor + Kirigami.Theme.colorSet: Kirigami.Theme.View +// Kirigami.Theme.inherit: false } Component { id: courseDownloadItem Kirigami.AbstractListItem { id: listItem height: 50 width: parent.width text: model.name readonly property var status: model.status onStatusChanged: { root.statusChanged(); } checkable: false RowLayout { id: layout spacing: Kirigami.Units.smallSpacing*2 Kirigami.Icon { height: Kirigami.Units.iconSizes.smallMedium; width: height; SequentialAnimation on opacity { loops: Animation.Infinite; running: model.status == KNS.ItemsModel.InstallingStatus || model.status == KNS.ItemsModel.UpdatingStatus NumberAnimation { to: 0; duration: 500; } NumberAnimation { to: 1; duration: 500; } onRunningChanged: { if (!running) parent.opacity = 1; } } source: { // use complete list of KNS status messages if (model.status == KNS.ItemsModel.InvalidStatus) return "emblem-error"; if (model.status == KNS.ItemsModel.DownloadableStatus) return "vcs-added"; if (model.status == KNS.ItemsModel.InstalledStatus) return "vcs-normal"; if (model.status == KNS.ItemsModel.UpdateableStatus) return "vcs-update-required"; if (model.status == KNS.ItemsModel.DeletedStatus) return "vcs-added"; if (model.status == KNS.ItemsModel.InstallingStatus) return "vcs-locally-modified"; if (model.status == KNS.ItemsModel.UpdatingStatus) return "vcs-locally-modified"; return "emblem-error"; } } QQC2.Label { id: labelItem Layout.fillWidth: true text: listItem.text color: layout.indicateActiveFocus && (listItem.highlighted || listItem.checked || listItem.pressed) ? listItem.activeTextColor : listItem.textColor elide: Text.ElideRight font: listItem.font } QQC2.Button { visible: (model.status == KNS.ItemsModel.UpdateableStatus) ? true : false; text: i18nc("@action:button", "Update") onClicked: newStuffModel.installItem(model.index, model.PayloadRole) } QQC2.Button { visible: (model.status == KNS.ItemsModel.DownloadableStatus || model.status == KNS.ItemsModel.DeletedStatus) ? true : false; text: i18nc("@action:button", "Install") onClicked: newStuffModel.installItem(model.index, model.PayloadRole) } QQC2.Button { visible: (model.status == KNS.ItemsModel.InstalledStatus || model.status == KNS.ItemsModel.UpdateableStatus) ? true : false; text: i18nc("@action:button", "Remove") onClicked: newStuffModel.uninstallItem(model.index) } } } } ColumnLayout { ListView { id: listView width: root.width - 40 height: 50 * listView.count delegate: courseDownloadItem model: KNS.ItemsModel { id: newStuffModel; engine: newStuffEngine; } KNS.Engine { id: newStuffEngine; configFile: ":/artikulate/config/artikulate.knsrc"; onMessage: console.log("KNS Message: " + message); onIdleMessage: console.log("KNS Idle: " + message); onBusyMessage: console.log("KNS Busy: " + message); onErrorMessage: console.log("KNS Error: " + message); } } } } diff --git a/src/qml/TrainerCourseStatistics.qml b/src/qml/TrainerCourseStatistics.qml index 36cd537..50d6800 100644 --- a/src/qml/TrainerCourseStatistics.qml +++ b/src/qml/TrainerCourseStatistics.qml @@ -1,130 +1,131 @@ /* * Copyright 2013 Oindrila Gupta * Copyright 2013-2014 Andreas Cord-Landwehr * * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL */ import QtQuick 2.1 // import org.kde.plasma.core 0.1 as PlasmaCore // import org.kde.plasma.components 0.1 as PlasmaComponents // import org.kde.charts 0.1 as Charts import artikulate 1.0 Item { id: root property TrainingSession session property bool finished : session.isFinished onFinishedChanged : { if (finished) { statisticsChartLoader.sourceComponent = statisticsChart } } Loader { id: statisticsChartLoader height: Math.round(root.height - 60) width: Math.round(root.width - 20) } Rectangle { id: backgroundRect anchors.fill: parent + color: Kirigami.Theme.backgroundColor + Kirigami.Theme.colorSet: Kirigami.Theme.View z: -1 - color: "#ffffff" } Text { anchors { bottom: backgroundRect.bottom bottomMargin: 10 horizontalCenter: backgroundRect.horizontalCenter } text: i18n("Attempts") } //FIXME after kqtquickcharts is ported // Component { // id : statisticsChart // Column { // Row { // spacing: 15 // width: legendWord.width + legendExpression.width + legendSentence.width + legendParagraph.width + 3*15 // height:legendWord.height*2 // Item { // dummy // width: legendWord.height // height: legendWord.height // } // Charts.LegendItem { // id: legendWord // anchors.verticalCenter: parent.verticalCenter // dimension: wordDimension // } // Charts.LegendItem { // id: legendExpression // anchors.verticalCenter: parent.verticalCenter // dimension: expressionDimension // } // Charts.LegendItem { // id: legendSentence // anchors.verticalCenter: parent.verticalCenter // dimension: sentenceDimension // } // Charts.LegendItem { // id: legendParagraph // anchors.verticalCenter: parent.verticalCenter // dimension: paragraphDimension // } // } // // Charts.LineChart { // height: Math.round(root.height - 60) // width: Math.round(root.width - 20) // padding: 20 // model: LearningProgressModel { // id: statistics // session: root.session // } // pitch: 60 // // textRole: 3 // Qt::ToolTipRole // // dimensions: [ // // words // Charts.Dimension { // id: wordDimension // dataColumn: 0 // color: "#2DE86C" // maximumValue: Math.max(0, Math.ceil(statistics.maximumPhrasesPerTry / 4) * 4) + 5 // label: i18n("Words") // }, // // expressions // Charts.Dimension { // id: expressionDimension // dataColumn: 1 // color: "#327BFF" // maximumValue: Math.max(0, Math.ceil(statistics.maximumPhrasesPerTry / 4) * 4) + 5 // label: i18n("Expressions") // }, // // sentences // Charts.Dimension { // id: sentenceDimension // dataColumn: 2 // color: "#FFF13F" // maximumValue: Math.max(0, Math.ceil(statistics.maximumPhrasesPerTry / 4) * 4) + 5 // label: i18n("Sentences") // }, // // paragraphs // Charts.Dimension { // id: paragraphDimension // dataColumn: 3 // color: "#E85A02" // maximumValue: Math.max(0, Math.ceil(statistics.maximumPhrasesPerTry / 4) * 4) + 5 // label: i18n("Paragraphs") // } // ] // } // } // } } diff --git a/src/qml/TrainingPage.qml b/src/qml/TrainingPage.qml index 2714d9b..eda794c 100644 --- a/src/qml/TrainingPage.qml +++ b/src/qml/TrainingPage.qml @@ -1,154 +1,155 @@ /* * Copyright 2013-2019 Andreas Cord-Landwehr * Copyright 2013 Magdalena Konkiewicz * * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL */ import QtQuick 2.5 import QtQuick.Shapes 1.10 import QtQuick.Controls 2.3 as QQC2 import org.kde.kirigami 2.7 as Kirigami import artikulate 1.0 Kirigami.Page { id: root readonly property color colorTask: "#1dbf4e" readonly property color colorAnswer: "#7e48a5" background: Rectangle { - color: "#ffffff" + color: Kirigami.Theme.backgroundColor + Kirigami.Theme.colorSet: Kirigami.Theme.View } title: { var titleString = ""; if (g_trainingSession.unit === null) { titleString += i18n("Category: no category selected"); } else { titleString += i18n("Category: %1", g_trainingSession.unit.title) } if (g_trainingSession.unit !== null && g_trainingSession.course !== null) { titleString += " / " + g_trainingSession.course.i18nTitle } return titleString } actions { main: Kirigami.Action { text: i18n("Next") tooltip: i18n("Mark current phrase as completed and proceed with next one.") iconName: "dialog-ok" onTriggered: g_trainingSession.accept() } right: Kirigami.Action { text: i18n("Skip") tooltip: i18n("Skip current phrase and proceed with next one.") iconName: "go-next" enabled: g_trainingSession.hasNext onTriggered: g_trainingSession.skip() } } Rectangle { id: trainingTextRect width: Math.min(0.7 * parent.width, parent.width - 80) height: Math.max(200, phraseText.implicitHeight) anchors { left: parent.left top: parent.top leftMargin: 20 topMargin: 20 } color: root.colorTask Shape { id: taskTriangle width: 50 height: 40 anchors { top: parent.bottom horizontalCenter: parent.horizontalCenter horizontalCenterOffset: parent.width / 10 } ShapePath { fillColor: colorTask strokeColor: colorTask PathLine { x: 0; y: 0 } PathLine { x: taskTriangle.width; y: taskTriangle.height } PathLine { x: taskTriangle.width; y: 0 } } } QQC2.TextArea { id: phraseText anchors.fill: parent objectName: "phraseText" text: (g_trainingSession.phrase !== null) ? g_trainingSession.phrase.text : "" font.pointSize: 24 wrapMode: Text.WordWrap readOnly: true background: Item {} horizontalAlignment: Text.AlignHCenter verticalAlignment: TextEdit.AlignVCenter } SoundPlayer { id: buttonNativePlay anchors { top: taskTriangle.bottom topMargin: 20 horizontalCenter: taskTriangle.right } text: i18n("Play original") fileUrl: g_trainingSession.phrase === null ? "" : g_trainingSession.phrase.soundFileUrl } } Rectangle { id: trainingUserRect width: 200 height: 0.65 * width anchors { right: parent.right top: trainingTextRect.bottom rightMargin: 20 topMargin: 154 } color: root.colorAnswer Shape { id: answerTriangle width: 50 height: 40 anchors { bottom: parent.top horizontalCenter: parent.horizontalCenter horizontalCenterOffset: -parent.width / 10 } ShapePath { fillColor: root.colorAnswer strokeColor: root.colorAnswer PathLine { x: 0; y: 0 } PathLine { x: 0; y: taskTriangle.height } PathLine { x: taskTriangle.width; y: taskTriangle.height } } } SoundRecorder { id: recorder anchors { bottom: answerTriangle.top bottomMargin: 20 horizontalCenter: answerTriangle.left } text: i18n("Record yourself") } SoundPlayer { id: player anchors { centerIn: parent } text: i18n("Play yourself") fileUrl: recorder.outputFileUrl } } }