diff --git a/src/qml/common/GridView.qml b/src/qml/common/GridView.qml index 0acbaa3..781b96c 100644 --- a/src/qml/common/GridView.qml +++ b/src/qml/common/GridView.qml @@ -1,42 +1,42 @@ /* * Copyright 2017 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.9 -import QtQuick.Controls 2.2 +import QtQuick.Controls 2.2 as Controls import ktouch 1.0 GridView { id: control property alias colorScheme: colorScheme property alias background: backgroundItem KColorScheme { id: colorScheme colorGroup: control.enabled? KColorScheme.Active: KColorScheme.Disabled colorSet: KColorScheme.View } Rectangle { id: backgroundItem anchors.fill: parent color: colorScheme.normalBackground z: -1 } - ScrollBar.vertical: ScrollBar { } + Controls.ScrollBar.vertical: ScrollBar { } } diff --git a/src/qml/common/ListView.qml b/src/qml/common/ListView.qml index f90a208..bb6e4ba 100644 --- a/src/qml/common/ListView.qml +++ b/src/qml/common/ListView.qml @@ -1,62 +1,62 @@ /* * Copyright 2017 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.9 -import QtQuick.Controls 2.2 +import QtQuick.Controls 2.2 as Controls import ktouch 1.0 ListView { id: control property alias colorScheme: colorScheme KColorScheme { id: colorScheme colorGroup: control.enabled? KColorScheme.Active: KColorScheme.Disabled colorSet: KColorScheme.View } Rectangle { anchors.fill: parent color: colorScheme.normalBackground z: -1 } FocusBar { anchors { top: parent.top left: parent.left right: parent.right } height: 3 control: control z: -1 } FocusBar { anchors { left: parent.left right: parent.right bottom: parent.bottom } height: 3 control: control z: -1 } - ScrollBar.vertical: ScrollBar { } + Controls.ScrollBar.vertical: ScrollBar { } } diff --git a/src/qml/common/GridView.qml b/src/qml/common/ScrollBar.qml similarity index 62% copy from src/qml/common/GridView.qml copy to src/qml/common/ScrollBar.qml index 0acbaa3..5a2751b 100644 --- a/src/qml/common/GridView.qml +++ b/src/qml/common/ScrollBar.qml @@ -1,42 +1,51 @@ +import QtQuick 2.0 /* * Copyright 2017 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.9 -import QtQuick.Controls 2.2 +import QtQuick.Controls 2.2 as Controls import ktouch 1.0 -GridView { +Controls.ScrollBar { id: control property alias colorScheme: colorScheme - property alias background: backgroundItem KColorScheme { id: colorScheme colorGroup: control.enabled? KColorScheme.Active: KColorScheme.Disabled - colorSet: KColorScheme.View + colorSet: KColorScheme.Window } - Rectangle { - id: backgroundItem - anchors.fill: parent - color: colorScheme.normalBackground - z: -1 - } - - ScrollBar.vertical: ScrollBar { } + contentItem: Rectangle { + implicitWidth: 6 + implicitHeight: 100 + radius: width / 2 + color: control.pressed ? colorScheme.focusDecoration: colorScheme.alternateBackground + opacity: control.active? 1: 0.3 + Behavior on opacity { + NumberAnimation { + duration: 150 + } + } + Behavior on color { + ColorAnimation { + duration: 150 + } + } + } } diff --git a/src/qml/homescreen/CourseSelector.qml b/src/qml/homescreen/CourseSelector.qml index 68e4c23..fd21510 100644 --- a/src/qml/homescreen/CourseSelector.qml +++ b/src/qml/homescreen/CourseSelector.qml @@ -1,192 +1,192 @@ /* * 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.9 -import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 +import QtQuick.Controls 2.2 as Controls import ktouch 1.0 import "../common" FocusScope { id: root property Profile profile property string currentKeyboardLayoutName property string selectedKeyboardLayoutName property DataIndexKeyboardLayout selectedKeyboardLayout property DataIndexCourse selectedCourse signal lessonSelected(variant course, variant lesson) signal courseSelectec(Course course) function selectLastUsedCourse() { if (!profile) { return } var courseId = profile.lastUsedCourseId; // fist try to to select the course the user has used last for (var i = 0; i < allCoursesModel.rowCount(); i++) { var dataIndexCourse = allCoursesModel.data(allCoursesModel.index(i, 0), ResourceModel.DataRole); if (dataIndexCourse.id === courseId) { root.selectedCourse = dataIndexCourse return } } // if this fails try to select course matching the current keyboard layout if (coursesForCurrentKeyboardLayoutModel.rowCount() > 0) { var blub = coursesForCurrentKeyboardLayoutModel.data(coursesForCurrentKeyboardLayoutModel.index(0, 0), ResourceModel.DataRole); console.log(blub) root.selectedCourse = blub return; } // finally just select the first course if (allCoursesModel.rowCount() > 0) { root.selectedCourse = allCoursesModel.data(allCoursesModel.index(0, 0), ResourceModel.DataRole); } } onSelectedCourseChanged: { root.selectedKeyboardLayoutName = root.selectedCourse.keyboardLayoutName; for (var i = 0; i < ktouch.globalDataIndex.keyboardLayoutCount; i++) { var dataIndexLayout = ktouch.globalDataIndex.keyboardLayout(i) if (dataIndexLayout.name === root.selectedKeyboardLayoutName) { root.selectedKeyboardLayout = dataIndexLayout; return } } root.selectedKeyboardLayout = null; } function saveLastUsedCourse(course) { if (profile.lastUsedCourseId != course.id) { profile.lastUsedCourseId = course.id; profileDataAccess.updateProfile(profileDataAccess.indexOfProfile(profile)); } } onProfileChanged: selectLastUsedCourse() ResourceModel { id: resourceModel dataIndex: ktouch.globalDataIndex onRowsRemoved: { selectLastUsedCourse() } onRowsInserted: { selectLastUsedCourse() } } CategorizedResourceSortFilterProxyModel { id: allCoursesModel resourceModel: resourceModel resourceTypeFilter: ResourceModel.CourseItem } CategorizedResourceSortFilterProxyModel { id: coursesForCurrentKeyboardLayoutModel resourceModel: resourceModel resourceTypeFilter: ResourceModel.CourseItem keyboardLayoutNameFilter: root.currentKeyboardLayoutName } CategorizedResourceSortFilterProxyModel { id: currentKeyboardLayoutsModel resourceModel: resourceModel resourceTypeFilter: ResourceModel.KeyboardLayoutItem keyboardLayoutNameFilter: root.currentKeyboardLayoutName } CategorizedResourceSortFilterProxyModel { id: otherKeyboardLayoutsModel resourceModel: resourceModel resourceTypeFilter: ResourceModel.KeyboardLayoutItem keyboardLayoutNameFilter: root.currentKeyboardLayoutName invertedKeyboardLayoutNameFilter: true } KColorScheme { id: courseSelectorColorScheme colorGroup: KColorScheme.Active colorSet: KColorScheme.View } Rectangle { id: bg anchors.fill: parent color: courseSelectorColorScheme.normalBackground } Flickable { clip: true anchors.fill: parent contentWidth: width contentHeight: content.height Column { id: content width: parent.width CourseSelectorKeyboardLayoutList { width: parent.width title: i18n('Courses For Your Keyboard Layout') model: currentKeyboardLayoutsModel resourceModel: resourceModel colorScheme: courseSelectorColorScheme selectedKeyboardLayoutName: root.selectedKeyboardLayoutName selectedCourse: root.selectedCourse onCourseSelected: { root.selectedCourse = course root.saveLastUsedCourse(course) } } CourseSelectorKeyboardLayoutList { width: parent.width title: i18n('Other courses') model: otherKeyboardLayoutsModel resourceModel: resourceModel colorScheme: courseSelectorColorScheme selectedKeyboardLayoutName: root.selectedKeyboardLayoutName selectedCourse: root.selectedCourse onCourseSelected: { root.selectedCourse = course root.saveLastUsedCourse(course) } } } - ScrollBar.vertical: ScrollBar { } + Controls.ScrollBar.vertical: ScrollBar { } } } diff --git a/src/qml/qml.qrc b/src/qml/qml.qrc index 5922afe..41a0e7d 100644 --- a/src/qml/qml.qrc +++ b/src/qml/qml.qrc @@ -1,61 +1,62 @@ common/AutoTriggerButton.qml common/Balloon.qml common/Collapsable.qml common/FocusBar.qml common/GridView.qml common/IconButton.qml common/IconLabel.qml common/IconToolButton.qml common/InfoItem.qml common/InformationTable.qml common/InlineToolbar.qml common/Label.qml common/LearningProgressChart.qml common/ListItem.qml common/ListView.qml common/MessageBox.qml common/MonochromeIcon.qml common/PopupDialog.qml common/RadioButton.qml + common/ScrollBar.qml common/SelectionGrip.qml common/SelectionRectangle.qml common/SheetDialog.qml common/TextArea.qml common/TextField.qml homescreen/CourseDescriptionItem.qml homescreen/CourseSelector.qml homescreen/CourseSelectorKeyboardLayoutItem.qml homescreen/CourseSelectorKeyboardLayoutList.qml homescreen/HomeScreen.qml homescreen/InitialProfileDialog.qml homescreen/KeyboardLayoutMismatchMessage.qml homescreen/LessonDeletedMessage.qml homescreen/LessonEditorDialog.qml homescreen/LessonLockedNotice.qml homescreen/LessonSelector.qml homescreen/LessonSelectorItem.qml homescreen/ProfileComboBox.qml homescreen/ProfileDetailsItem.qml homescreen/ProfileForm.qml homescreen/ProfileSelector.qml homescreen/StatPopupDialog.qml keyboard/KeyItem.qml keyboard/KeyLabel.qml keyboard/Keyboard.qml keyboard/KeyboardLayoutEditor.qml main.qml meters/AccuracyMeter.qml meters/CharactersPerMinuteMeter.qml meters/ElapsedTimeMeter.qml meters/Meter.qml meters/StatBox.qml scorescreen/ScoreScreen.qml trainingscreen/KeyboardUnavailableNotice.qml trainingscreen/TrainingScreen.qml trainingscreen/TrainingScreenMenuOverlay.qml trainingscreen/TrainingScreenToolbar.qml trainingscreen/TrainingWidget.qml