diff --git a/src/qml/homescreen/CourseSelector.qml b/src/qml/homescreen/CourseSelector.qml index a8d6761..983f3e9 100644 --- a/src/qml/homescreen/CourseSelector.qml +++ b/src/qml/homescreen/CourseSelector.qml @@ -1,218 +1,178 @@ /* * Copyright 2012 Sebastian Gottfried * Copyright 2015 Sebastian Gottfried * * 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 . */ import QtQuick 2.4 -import QtQuick.Controls 1.3 +import QtQuick.Controls 2.0 import QtQuick.Layouts 1.1 import ktouch 1.0 -Item { +import "../common" + +FocusScope { id: root property CategorizedResourceSortFilterProxyModel courseModel property Profile profile property KeyboardLayout keyboardLayout property string keyboardLayoutName + property DataIndexCourse selectedCourse signal lessonSelected(variant course, variant lesson) + signal courseSelectec(Course course) function selectLastUsedCourse() { if (!profile) { return } var courseId = profile.lastUsedCourseId; if (courseId === "custom_lessons") { selectCourse(courseRepeater.count, true) return } for (var i = 0; i < courseModel.rowCount(); i++) { var dataIndexCourse = courseModel.data(courseModel.index(i, 0), ResourceModel.DataRole); if (dataIndexCourse.id === courseId) { selectCourse(i, true) return } } selectCourse(0, true) } function selectCourse(index, automaticSelection) { if (index === priv.currentIndex) { return } var direction = index > priv.currentIndex? Item.Left: Item.Right var dataIndexCourse = index < courseModel.rowCount()? courseModel.data(courseModel.index(index, 0), ResourceModel.DataRole): null; var targetPage = automaticSelection? coursePageContainer.activePage: coursePageContainer.inactivePage priv.currentIndex = index; targetPage.dataIndexCourse = dataIndexCourse if (!automaticSelection) { coursePageContainer.inactivePage = coursePageContainer.activePage coursePageContainer.activePage = targetPage coursePageContainer.inactivePage.hide(direction) coursePageContainer.activePage.show(direction) saveLastUsedCourse(dataIndexCourse? dataIndexCourse.id: "custom_lessons") } } function saveLastUsedCourse(courseId) { profile.lastUsedCourseId = courseId; profileDataAccess.updateProfile(profileDataAccess.indexOfProfile(profile)); } onProfileChanged: selectLastUsedCourse() Connections { target: courseModel onRowsRemoved: { nextButton.visible = previousButton.visible = courseModel.rowCount() > 1 - priv.currentIndex = -1 selectLastUsedCourse() } onRowsInserted: { nextButton.visible = previousButton.visible = courseModel.rowCount() > 1 - priv.currentIndex = -1 selectLastUsedCourse() } } - QtObject { - id: priv - property int currentIndex: -1 + ResourceModel { + id: resourceModel + dataIndex: ktouch.globalDataIndex } - SystemPalette { - id: palette - colorGroup: SystemPalette.Active + CategorizedResourceSortFilterProxyModel { + id: allKeyboardLayoutsModel + resourceModel: resourceModel + resourceTypeFilter: ResourceModel.KeyboardLayoutItem } - ColumnLayout { - anchors.fill: parent - spacing: 0 - - Rectangle { - id: head - Layout.fillWidth: true - height: Math.ceil(Math.max(courseTitleLabel.height, courseDescriptionButton.height) + 6) - color: palette.base - - RowLayout { - anchors { - fill: parent - leftMargin: 5 - rightMargin: 5 - topMargin: 3 - bottomMargin: 3 - } - - Label { - anchors.verticalCenter: parent.verticalCenter - id: courseTitleLabel - font.pointSize: 1.5 * Qt.font({'family': 'sansserif'}).pointSize - text: coursePageContainer.activePage.course.title - } - - Item { - id: smallSpacer - height: parent.height - width: 3 - } - - ToolButton { - id: courseDescriptionButton - anchors.verticalCenter: parent.verticalCenter - iconName: "dialog-information" - checkable: true - } + KColorScheme { + id: courseSelectorColorScheme + colorGroup: KColorScheme.Active + colorSet: KColorScheme.View + } - Item { - Layout.fillWidth: true - Layout.fillHeight: true - } + Rectangle { + id: bg + anchors.fill: parent + color: courseSelectorColorScheme.normalBackground + } - ToolButton { - id: previousButton - anchors.verticalCenter: parent.verticalCenter - iconName: "arrow-left" - enabled: priv.currentIndex > 0 - onClicked: { - var newIndex = priv.currentIndex - 1 - root.selectCourse(newIndex, false) - } - } + Flickable { + clip: true + anchors.fill: parent + contentWidth: width + contentHeight: content.height + Column { + id: content + width: parent.width - ToolButton { - id: nextButton - iconName: "arrow-right" - enabled: priv.currentIndex < courseModel.rowCount() - onClicked: { - var newIndex = (priv.currentIndex + 1) % (courseModel.rowCount() + 1) - root.selectCourse(newIndex, false) - } - } + ListItem { + width: parent.width + text: i18n('Courses For Your Keyboard Layout') + font.bold: true + bg.color: courseSelectorColorScheme.alternateBackground + bg.opacity: 1 + label.opacity: 0.7 } - } - Item { - Layout.fillWidth: true - Layout.minimumHeight: courseDescriptionItem.height - Layout.maximumHeight: courseDescriptionItem.height - CourseDescriptionItem { - id: courseDescriptionItem - active: courseDescriptionButton.checked - description: coursePageContainer.activePage.course.description + ListItem { width: parent.width + text: i18n('Other Courses') + font.bold: true + bg.color: courseSelectorColorScheme.alternateBackground + bg.opacity: 1 + label.opacity: 0.7 } - } - Item { - id: coursePageContainer - property CoursePage activePage: page0 - property CoursePage inactivePage: page1 - - Layout.fillWidth: true - Layout.fillHeight: true - - CoursePage { - id: page0 - profile: root.profile - keyboardLayout: root.keyboardLayout - keyboardLayoutName: root.keyboardLayoutName - onLessonSelected: root.lessonSelected(course, lesson) - Component.onCompleted: page0.showImmediately() + Repeater { + model: allKeyboardLayoutsModel + CourseSelectorKeyboardLayoutItem { + width: parent.width + name: keyboardLayoutName + title: display + resourceModel: allKeyboardLayoutsModel.resourceModel + selectedCourse: root.selectedCourse + onCourseSelected: { + root.selectedCourse = course + } + } } - CoursePage { - id: page1 - profile: root.profile - keyboardLayout: root.keyboardLayout - keyboardLayoutName: root.keyboardLayoutName - onLessonSelected: root.lessonSelected(course, lesson) - } } + ScrollBar.vertical: ScrollBar { } } + + + + + + } diff --git a/src/qml/homescreen/CourseSelectorKeyboardLayoutItem.qml b/src/qml/homescreen/CourseSelectorKeyboardLayoutItem.qml new file mode 100644 index 0000000..5105f41 --- /dev/null +++ b/src/qml/homescreen/CourseSelectorKeyboardLayoutItem.qml @@ -0,0 +1,95 @@ +/* + * Copyright 2012 Sebastian Gottfried + * Copyright 2015 Sebastian Gottfried + * + * 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 . + */ + +import QtQuick 2.4 +import ktouch 1.0 + +import "../common" + +Column { + id: root + property string name + property alias title: keyboardLayoutItem.text + property ResourceModel resourceModel + property DataIndexCourse selectedCourse + + signal courseSelected(DataIndexCourse course) + + height: keyboardLayoutItem.height + (loader.active? loader.height: 0) + clip: true + + ListItem { + id: keyboardLayoutItem + icon: "input-keyboard" + width: parent.width + onClicked: { + loader.active = !loader.active + } + } + + Loader { + id: loader + width: parent.width + active: false + property string keyboardLayoutNameFilter: root.name + sourceComponent: Component { + id: courseSelectionComponent + + Column { + CategorizedResourceSortFilterProxyModel { + id: courseModel + resourceModel: root.resourceModel + resourceTypeFilter: ResourceModel.CourseItem + keyboardLayoutNameFilter: loader.keyboardLayoutNameFilter + } + Repeater { + id: courseRepeater + model: courseModel + ListItem { + text: display + width: parent.width + reserveSpaceForIcon: true + highlighted: root.selectedCourse == dataRole + onClicked: { + courseSelected(dataRole) + } + } + } + ListItem { + text: i18n("Custom Lessons") + id: ownLessonsItem + reserveSpaceForIcon: true + width: parent.width + } + Component.onCompleted: { + if (courseModel.rowCount()) { + courseSelected(courseModel.data(courseModel.index(0, 0), ResourceModel.DataRole)) + } + } + } + } + } + + Behavior on height { + NumberAnimation { + duration: 150 + easing.type: Easing.InOutQuad + } + } +} + diff --git a/src/qml/homescreen/HomeScreen.qml b/src/qml/homescreen/HomeScreen.qml index 4b5972b..a6a8ac7 100644 --- a/src/qml/homescreen/HomeScreen.qml +++ b/src/qml/homescreen/HomeScreen.qml @@ -1,190 +1,202 @@ /* * Copyright 2012 Sebastian Gottfried * Copyright 2015 Sebastian Gottfried * * 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 . */ import QtQuick 2.4 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.1 import ktouch 1.0 import "../common" FocusScope { id: screen property CategorizedResourceSortFilterProxyModel courseModel property KeyboardLayout keyboardLayout property string keyboardLayoutName signal lessonSelected(variant course, variant lesson, variant profile) QtObject { id: d property Profile profile property int profileCount: profileDataAccess.profileCount onProfileCountChanged: findCurrentProfile() } function start() {} function reset() { profileDataAccess.loadProfiles(); } function findCurrentProfile() { d.profile = null var lastProfileId = preferences.lastUsedProfileId for (var i = 0; i < profileDataAccess.profileCount; i++) { var profile = profileDataAccess.profile(i) if (profile.id === lastProfileId) { d.profile = profile return; } } if (profileDataAccess.profileCount > 0) { d.profile = profileDataAccess.profile(0) preferences.lastUsedProfileId = d.profile.id preferences.writeConfig() } } function switchToProfile(profile) { d.profile = profile preferences.lastUsedProfileId = profile.id preferences.writeConfig() } ColumnLayout { anchors.fill: parent spacing: 0 ToolBar { KColorScheme { id: toolbarColorScheme colorGroup: KColorScheme.Active colorSet: KColorScheme.Complementary property color toolbarBackground: Qt.darker(toolbarColorScheme.shade(toolbarColorScheme.hoverDecoration, KColorScheme.MidShade, toolbarColorScheme.contrast, -0.2), 1.3) } visible: courseSelector.opacity > 0 id: header Layout.fillWidth: true height: 60 background: Rectangle { color: toolbarColorScheme.toolbarBackground } RowLayout { anchors.fill: parent spacing: 5 IconToolButton { id: profileButton icon: "user-identity" text: d.profile !== null? d.profile.name: "" color: toolbarColorScheme.normalText backgroundColor: toolbarColorScheme.normalBackground Layout.fillHeight: true Layout.preferredWidth: 300 onClicked: { if (checked) { profileSelectorSheet.open() } else { profileSelectorSheet.close() } } checkable: true } Item { Layout.fillWidth: true } IconToolButton { id: configureButton icon: "application-menu" color: toolbarColorScheme.normalText backgroundColor: toolbarColorScheme.normalBackground Layout.fillHeight: true Layout.preferredWidth: header.height onClicked: { var position = mapToItem(null, 0, height) ktouch.showMenu(position.x, position.y) } } } } Item { id: content Layout.fillWidth: true Layout.fillHeight: true - CourseSelector { - id: courseSelector - opacity: 1 - initialProfileForm.opacity - courseModel: screen.courseModel - profile: d.profile - keyboardLayout: screen.keyboardLayout - keyboardLayoutName: screen.keyboardLayoutName + RowLayout { anchors.fill: parent - onLessonSelected: screen.lessonSelected(course, lesson, d.profile) + + CourseSelector { + id: courseSelector + Layout.fillHeight: true + Layout.preferredWidth: 300 + opacity: 1 - initialProfileForm.opacity + courseModel: screen.courseModel + profile: d.profile + keyboardLayout: screen.keyboardLayout + keyboardLayoutName: screen.keyboardLayoutName + onLessonSelected: screen.lessonSelected(course, lesson, d.profile) + } + + Item { + id: filler + Layout.fillHeight: true + Layout.fillWidth: true + } } + InitialProfileForm { id: initialProfileForm opacity: profileDataAccess.profileCount == 0? 1: 0 anchors.fill: parent anchors.margins: 5 Behavior on opacity { NumberAnimation { duration: screen.visible? 500: 0 easing.type: Easing.InOutCubic } } } SheetDialog { id: profileSelectorSheet anchors.fill: parent onOpened: { if (d.profile) { var index = profileDataAccess.indexOfProfile(d.profile) profileSelector.selectProfile(index) } } onClosed: { profileButton.checked = false; } content: ProfileSelector { id: profileSelector anchors.fill: parent onProfileChosen: { screen.switchToProfile(profile) profileSelectorSheet.close() } } } } } } diff --git a/src/qml/homescreen/LessonSelector.qml b/src/qml/homescreen/LessonSelector.qml index 0609caa..17fdafa 100644 --- a/src/qml/homescreen/LessonSelector.qml +++ b/src/qml/homescreen/LessonSelector.qml @@ -1,124 +1,123 @@ /* * Copyright 2012 Sebastian Gottfried * Copyright 2015 Sebastian Gottfried * * 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 . */ import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.Layouts 1.1 import ktouch 1.0 import "../common" Item { id: item property Profile profile property DataIndexCourse dataIndexCourse property alias course: courseItem signal lessonSelected(variant course, variant lesson) function update() { if (!course.isValid) return; if (!profile) return; selectLastLesson() enableUnlockedLessons() } function selectLastLesson() { var lessonId = profileDataAccess.courseProgress(profile, course.id, ProfileDataAccess.LastSelectedLesson); if (lessonId !== "") { for (var index = 0; index < course.lessonCount; index++) { if (course.lesson(index).id === lessonId) { lessonList.currentIndex = index; break; } } } } function enableUnlockedLessons() { if (profile.skillLevel === Profile.Advanced) { lessonList.lastUnlockedIndex = course.lessonCount - 1; return; } lessonList.lastUnlockedIndex = 0; var lessonId = profileDataAccess.courseProgress(profile, course.id, ProfileDataAccess.LastUnlockedLesson); if (lessonId !== "") { for (var index = 0; index < course.lessonCount; index++) { if (course.lesson(index).id === lessonId) { lessonList.lastUnlockedIndex = index; break; } } } } onProfileChanged: update() onDataIndexCourseChanged: { course.update() update() } Course { id: courseItem function update() { if (item.dataIndexCourse === null) return if (isValid && courseItem.id === dataIndexCourse.id) return dataAccess.loadCourse(dataIndexCourse, courseItem) } Component.onCompleted: update() } LessonSelectorBase { anchors.fill: parent list:ScrollView { anchors.fill: parent ListView { anchors.fill: parent id: lessonList property int lastUnlockedIndex: 0 model: course.isValid? course.lessonCount: 0 spacing: 3 clip: true delegate: ListItem { property Lesson lesson: index < course.lessonCount? course.lesson(index): null property bool locked: index > lessonList.lastUnlockedIndex width: lessonList.width onClicked: lessonList.currentIndex = index onDoubleClicked: { if (!locked) { lessonSelected(course, lesson) } } iconSource: locked? "object-locked": "" - label.opacity: locked? 0.5: 1.0 - title: lesson? lesson.title: "" + text: lesson? lesson.title: "" } onModelChanged: update() } } selectedLesson: lessonList.currentItem != null? lessonList.currentItem.lesson: null selectedLessonLocked: lessonList.currentItem !== null && lessonList.currentItem.locked onStartButtonClicked: lessonSelected(course, lessonList.currentItem.lesson) } } diff --git a/src/qml/homescreen/ProfileSelector.qml b/src/qml/homescreen/ProfileSelector.qml index 609a08d..c263b94 100644 --- a/src/qml/homescreen/ProfileSelector.qml +++ b/src/qml/homescreen/ProfileSelector.qml @@ -1,115 +1,114 @@ /* * Copyright 2012 Sebastian Gottfried * Copyright 2015 Sebastian Gottfried * * 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 . */ import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.Layouts 1.1 import ktouch 1.0 import "../common" FocusScope { id: root signal profileChosen(variant profile) function createNewProfile() { var profile = profileDataAccess.createProfile() profileForm.profile = profile } function selectProfile(index) { list.currentIndex = index profileForm.profile = profileDataAccess.profile(index) } ColumnLayout { anchors.fill: parent anchors.bottomMargin: 10 spacing: 10 RowLayout { Layout.fillWidth: true Layout.fillHeight: true spacing: 10 Item { id: listContainer Layout.fillWidth: true Layout.fillHeight: true ScrollView { anchors.fill: parent ListView { id: list anchors.fill: parent - anchors.margins: 3 - spacing: 3 model: profileDataAccess.profileCount + 1 clip: true delegate: ListItem { property bool isNewButton: index >= profileDataAccess.profileCount width: list.width - title: isNewButton? + text: isNewButton? i18n("Create New Profile"): index < profileDataAccess.profileCount? profileDataAccess.profile(index).name: null label.font.italic: isNewButton - iconSource: isNewButton? "list-add": "user-identity" + icon: isNewButton? "list-add": "user-identity" + highlighted: ListView.isCurrentItem onClicked: { list.currentIndex = index if (isNewButton) { createNewProfile() } else { selectProfile(index) } } onDoubleClicked: { if (!isNewButton) { root.profileChosen(profileDataAccess.profile(list.currentIndex)) } } } } } } ProfileDetailsItem { id: profileForm Layout.fillWidth: true Layout.fillHeight: true onDeletionRequest: { var index = profileDataAccess.indexOfProfile(profileForm.profile) profileForm.profile = null profileDataAccess.removeProfile(index) selectProfile(Math.max(0, list.currentIndex - 1)) } } } Button { id: selectButton anchors.horizontalCenter: parent.horizontalCenter iconName: "go-next-view" text: i18n("Use Selected Profile") enabled: list.currentIndex !== -1 && list.currentIndex < profileDataAccess.profileCount onClicked: root.profileChosen(profileDataAccess.profile(list.currentIndex)) } } } diff --git a/src/qml/main.qml b/src/qml/main.qml index 8907209..4d1cbc3 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -1,239 +1,239 @@ /* * Copyright 2012 Sebastian Gottfried * Copyright 2015 Sebastian Gottfried * * 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 . */ import QtQuick 2.4 import ktouch 1.0 import "./common" import "./meters" import "./homescreen" import "./trainingscreen" import "./scorescreen" Rectangle { SystemPalette { id: activePallete colorGroup: SystemPalette.Active } id: main - color: activePallete.window + color: Qt.darker(activePallete.window, 1.6) function switchScreen(from, to) { switchScreenAnimation.from = from switchScreenAnimation.to = to switchScreenAnimation.start() } DataAccess { id: dataAccess } QtObject { id: helper property string name: ktouch.keyboardLayoutName property int keyboardLayoutCount: ktouch.globalDataIndex.keyboardLayoutCount property int courseCount: ktouch.globalDataIndex.courseCount onNameChanged: { keyboardLayout.update() } onKeyboardLayoutCountChanged: { if (ktouch.globalDataIndex.isValid) keyboardLayout.update() } } ResourceModel { id: resourceModel dataIndex: ktouch.globalDataIndex } ProfileDataAccess { id: profileDataAccess } Preferences { id: preferences } KeyboardLayout { id: keyboardLayout Component.onCompleted: { if (ktouch.globalDataIndex.isValid) { keyboardLayout.update() } } function update() { isValid = false var name = ktouch.keyboardLayoutName; // first pass - exact match for (var i = 0; i < ktouch.globalDataIndex.keyboardLayoutCount; i++) { var dataIndexLayout = ktouch.globalDataIndex.keyboardLayout(i) if (dataIndexLayout.name === name) { dataAccess.loadKeyboardLayout(dataIndexLayout, keyboardLayout) return } } // second pass - substring match for (var i = 0; i < ktouch.globalDataIndex.keyboardLayoutCount; i++) { var dataIndexLayout = ktouch.globalDataIndex.keyboardLayout(i) if (name.search(dataIndexLayout.name) === 0) { dataAccess.loadKeyboardLayout(dataIndexLayout, keyboardLayout) return } } } } CategorizedResourceSortFilterProxyModel { id: availableCourseModel resourceModel: resourceModel resourceTypeFilter: ResourceModel.CourseItem keyboardLayoutNameFilter: keyboardLayout.isValid? keyboardLayout.name: ktouch.keyboardLayoutName } Course { id: selectedCourse property Lesson selectedLesson } Lesson { id: customLessonCopy } HomeScreen { id: homeScreen anchors.fill: parent courseModel: availableCourseModel keyboardLayout: keyboardLayout keyboardLayoutName: keyboardLayout.isValid? keyboardLayout.name: helper.name visible: false focus: true onLessonSelected: { trainingScreen.profile = profile var lessonIndex = -1; for (var i = 0; i < course.lessonCount; i++) { if (lesson === course.lesson(i)) { lessonIndex = i break } } selectedCourse.copyFrom(course) if (lessonIndex !== -1) { selectedCourse.selectedLesson = selectedCourse.lesson(lessonIndex) } else { customLessonCopy.copyFrom(lesson) selectedCourse.selectedLesson = customLessonCopy } main.switchScreen(homeScreen, trainingScreen) } Component.onCompleted: { homeScreen.reset() homeScreen.visible = true } } TrainingScreen { id: trainingScreen anchors.fill: parent visible: false keyboardLayout: keyboardLayout course: selectedCourse lesson: selectedCourse.selectedLesson onRestartRequested: main.switchScreen(trainingScreen, trainingScreen) onAbortRequested: main.switchScreen(trainingScreen, homeScreen) onFinished: main.switchScreen(trainingScreen, scoreScreen) } ScoreScreen { id: scoreScreen anchors.fill: parent visible: false course: trainingScreen.course lesson: trainingScreen.lesson stats: trainingScreen.stats profile: trainingScreen.profile referenceStats: trainingScreen.referenceStats onHomeScreenRequested: main.switchScreen(scoreScreen, homeScreen) onLessonRepetionRequested: main.switchScreen(scoreScreen, trainingScreen) onNextLessonRequested: { selectedCourse.selectedLesson = lesson main.switchScreen(scoreScreen, trainingScreen) } } Rectangle { id: curtain anchors.fill: parent color: "#000" opacity: 0 } SequentialAnimation { id: switchScreenAnimation property Item from property Item to NumberAnimation { target: curtain property: "opacity" to: 1 duration: switchScreenAnimation.to == homeScreen? 250: 750 easing.type: Easing.OutQuad } PropertyAction { target: switchScreenAnimation.from property: "visible" value: false } ScriptAction { script: switchScreenAnimation.to.reset() } PropertyAction { target: switchScreenAnimation.to property: "visible" value: true } ScriptAction { script: { switchScreenAnimation.to.start() switchScreenAnimation.to.forceActiveFocus() } } NumberAnimation { target: curtain property: "opacity" to: 0 duration: switchScreenAnimation.to == homeScreen? 250: 750 easing.type: Easing.InQuad } } } diff --git a/src/qml/qml.qrc b/src/qml/qml.qrc index 657960c..6c2c915 100644 --- a/src/qml/qml.qrc +++ b/src/qml/qml.qrc @@ -1,47 +1,48 @@ main.qml meters/AccuracyMeter.qml meters/CharactersPerMinuteMeter.qml meters/ElapsedTimeMeter.qml meters/Meter.qml meters/StatBox.qml common/DetailedRadioButton.qml common/InfoItem.qml common/InformationTable.qml common/InlineToolbar.qml common/LearningProgressChart.qml common/ListItem.qml common/MessageBox.qml common/SelectionGrip.qml common/SelectionRectangle.qml common/SheetDialog.qml common/Balloon.qml scorescreen/ScoreScreen.qml trainingscreen/KeyboardUnavailableNotice.qml trainingscreen/TrainingScreenMenuOverlay.qml trainingscreen/TrainingScreen.qml trainingscreen/TrainingScreenToolbar.qml trainingscreen/TrainingWidget.qml homescreen/CourseDescriptionItem.qml homescreen/CoursePage.qml homescreen/CourseSelector.qml homescreen/InitialProfileForm.qml homescreen/LessonLockedNotice.qml homescreen/LessonPreview.qml homescreen/LessonSelectorBase.qml homescreen/HomeScreen.qml homescreen/CustomLessonSelector.qml homescreen/ProfileForm.qml homescreen/LessonSelector.qml homescreen/ProfileSelector.qml homescreen/ProfileDetailsItem.qml keyboard/Keyboard.qml keyboard/KeyItem.qml keyboard/KeyLabel.qml keyboard/KeyboardLayoutEditor.qml common/IconToolButton.qml + homescreen/CourseSelectorKeyboardLayoutItem.qml common/IconLabel.qml common/MonochromeIcon.qml