diff --git a/src/qml/common/MonochromeIcon.qml b/src/qml/common/Icon.qml similarity index 77% copy from src/qml/common/MonochromeIcon.qml copy to src/qml/common/Icon.qml index c3b4c93..85b3ec3 100644 --- a/src/qml/common/MonochromeIcon.qml +++ b/src/qml/common/Icon.qml @@ -1,32 +1,22 @@ /* * 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 QtGraphicalEffects 1.0 import org.kde.kquickcontrolsaddons 2.0 as Addons Addons.QIconItem { - property color color: "#000000" - id: icon - width: 24 - height: 24 - ColorOverlay { - anchors.fill: parent - source: icon - color: parent.color - } + } diff --git a/src/qml/common/MonochromeIcon.qml b/src/qml/common/MonochromeIcon.qml index c3b4c93..25008a7 100644 --- a/src/qml/common/MonochromeIcon.qml +++ b/src/qml/common/MonochromeIcon.qml @@ -1,32 +1,30 @@ /* * 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 QtGraphicalEffects 1.0 -import org.kde.kquickcontrolsaddons 2.0 as Addons -Addons.QIconItem { +Icon { property color color: "#000000" id: icon width: 24 height: 24 ColorOverlay { anchors.fill: parent source: icon color: parent.color } } diff --git a/src/qml/homescreen/LessonLockedNotice.qml b/src/qml/homescreen/LessonLockedNotice.qml index 7b565fb..3ab0ad8 100644 --- a/src/qml/homescreen/LessonLockedNotice.qml +++ b/src/qml/homescreen/LessonLockedNotice.qml @@ -1,80 +1,79 @@ /* * 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 QtGraphicalEffects 1.0 -import org.kde.kquickcontrolsaddons 2.0 import ktouch 1.0 +import '../common' Item { id: root width: content.width height: content.height property color glowColor: "#ffffff" KColorScheme { id: palette colorGroup: KColorScheme.Active colorSet: KColorScheme.Window } Column { id: content anchors.centerIn: parent width: Math.max(icon.width, text.width) spacing: 10 - QIconItem { + Icon { id: icon anchors.horizontalCenter: parent.horizontalCenter icon: "object-locked" width: 128 height: 128 } Rectangle { anchors.horizontalCenter: parent.horizontalCenter width: text.width + 2 * text.font.pixelSize height: text.height + text.font.pixelSize radius: text.font.pixelSize color: palette.neutralBackground Label { anchors.centerIn: parent id: text text: i18n("Complete Previous Lessons to Unlock") horizontalAlignment: Text.AlignHCenter font.weight: Font.Bold wrapMode: Text.Wrap } } } Glow { anchors.fill: content source: content color: root.glowColor samples: 25 } } diff --git a/src/qml/homescreen/ProfileForm.qml b/src/qml/homescreen/ProfileForm.qml index 688140f..d9fa1d2 100644 --- a/src/qml/homescreen/ProfileForm.qml +++ b/src/qml/homescreen/ProfileForm.qml @@ -1,116 +1,115 @@ /* * 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 ktouch 1.0 import "../common" ColumnLayout { id: root property alias name: nameTextField.text property int skillLevel: 0 property bool skillLevelSelectionEnabled: true property alias showWelcomeLabel: welcomeLabel.visible property alias doneButtonIconSource: doneBtn.icon property alias doneButtonText: doneBtn.text signal done() onSkillLevelChanged: { beginnerRadioButton.checked = skillLevel == Profile.Beginner advancedRadioButton.checked = skillLevel == Profile.Advanced } spacing: 15 Label { id: welcomeLabel Layout.fillWidth: true Layout.preferredWidth: 500 text: i18n("Before you start training, please introduce yourself:") } TextField { id: nameTextField Layout.fillWidth: true placeholderText: i18n("Name") } RadioButton { id: beginnerRadioButton Layout.maximumWidth: parent.width enabled: root.skillLevelSelectionEnabled text: i18n("I have no or only very little experience in machine typing") label.wrapMode: Text.Wrap onCheckedChanged: { if (checked) { root.skillLevel = Profile.Beginner } } } Label { text: i18n("Lessons are unlocked as your typing skills improve over time.") wrapMode: Text.Wrap Layout.maximumWidth: parent.width leftPadding: font.pixelSize * 2 font.italic: true enabled: root.skillLevelSelectionEnabled } RadioButton { id: advancedRadioButton Layout.maximumWidth: parent.width enabled: root.skillLevelSelectionEnabled text: i18n("I have no or only very little experience in machine typing") label.wrapMode: Text.Wrap onCheckedChanged: { if (checked) { root.skillLevel = Profile.Advanced } } } Label { text: i18n("All lessons are unlocked immediately.") wrapMode: Text.Wrap Layout.maximumWidth: parent.width leftPadding: font.pixelSize * 2 font.italic: true enabled: root.skillLevelSelectionEnabled } Item { Layout.fillWidth: true Layout.preferredHeight: doneBtn.implicitHeight IconButton { id: doneBtn anchors.horizontalCenter: parent.horizontalCenter bgColor: colorScheme.positiveBackground text: i18n("Done") enabled: nameTextField.text !== "" && (beginnerRadioButton.checked || advancedRadioButton.checked) icon: "dialog-ok" onClicked: done() } } } diff --git a/src/qml/homescreen/ProfileSelector.qml b/src/qml/homescreen/ProfileSelector.qml index 7062d0f..dcdb855 100644 --- a/src/qml/homescreen/ProfileSelector.qml +++ b/src/qml/homescreen/ProfileSelector.qml @@ -1,120 +1,121 @@ /* * Copyright 2012 Sebastian Gottfried * Copyright 2015 Sebastian Gottfried * 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.Layouts 1.3 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) } KColorScheme { id: listColorScheme colorGroup: KColorScheme.Active colorSet: KColorScheme.View } ColumnLayout { anchors.fill: parent spacing: 0 RowLayout { Layout.fillWidth: true Layout.fillHeight: true ListView { id: list Layout.fillWidth: true Layout.fillHeight: true model: profileDataAccess.profileCount + 1 clip: true delegate: ListItem { property bool isNewButton: index >= profileDataAccess.profileCount width: list.width text: isNewButton? i18n("Create New Profile"): index < profileDataAccess.profileCount? profileDataAccess.profile(index).name: null label.font.italic: isNewButton icon: isNewButton? "list-add": "user-identity" highlighted: ListView.isCurrentItem onClicked: { + list.forceActiveFocus() list.currentIndex = index if (isNewButton) { createNewProfile() } else { selectProfile(index) } } onDoubleClicked: { if (!isNewButton) { root.profileChosen(profileDataAccess.profile(list.currentIndex)) } } } onCurrentItemChanged: { if (currentItem.isNewButton) { createNewProfile() } else { selectProfile(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)) } } } IconButton { id: selectButton Layout.fillWidth: true icon: "go-next-view" text: i18n("Use Selected Profile") enabled: list.currentIndex !== -1 && list.currentIndex < profileDataAccess.profileCount bgColor: colorScheme.positiveBackground onClicked: root.profileChosen(profileDataAccess.profile(list.currentIndex)) } } } diff --git a/src/qml/qml.qrc b/src/qml/qml.qrc index 4521605..28bdd43 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/Icon.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/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