summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastiangottfried@web.de>2015-06-09 15:20:19 (GMT)
committerSebastian Gottfried <sebastiangottfried@web.de>2015-06-09 15:20:19 (GMT)
commita5000ea6af2f0a8abd67410688a8eea33c52aecd (patch)
treeb6f5a9dd05c5feeaeb3fd2bc9b4e65b21e8c4eb4
parent1d1ff6c5651bb95a61363628dc2ac3ca18b02e70 (diff)
Qt5: Port ProfileSelector.qml And Friends
Now the home screen is fully functional once more.
-rw-r--r--src/qml/HomeScreen.qml15
-rw-r--r--src/qml/InfoItem.qml2
-rw-r--r--src/qml/InformationTable.qml12
-rw-r--r--src/qml/LearningProgressChart.qml8
-rw-r--r--src/qml/ProfileDetailsItem.qml43
-rw-r--r--src/qml/ProfileSelector.qml92
-rw-r--r--src/qml/SheetDialog.qml40
7 files changed, 100 insertions, 112 deletions
diff --git a/src/qml/HomeScreen.qml b/src/qml/HomeScreen.qml
index b8199d8..47dfb1f 100644
--- a/src/qml/HomeScreen.qml
+++ b/src/qml/HomeScreen.qml
@@ -90,14 +90,14 @@ FocusScope {
// iconName: "user-identity"
text: d.profile !== null? d.profile.name: ""
onClicked: {
- if (profileSelectorSheet.isOpen()) {
- profileSelectorSheet.close()
+ if (checked) {
+ profileSelectorSheet.open()
}
else {
- profileSelectorSheet.open()
+ profileSelectorSheet.close()
}
}
- checked: profileSelectorSheet.isOpen()
+ checkable: true
}
Item {
@@ -145,16 +145,18 @@ FocusScope {
}
}
- /*
SheetDialog {
id: profileSelectorSheet
anchors.fill: parent
- onOpended: {
+ onOpened: {
if (d.profile) {
var index = profileDataAccess.indexOfProfile(d.profile)
profileSelector.selectProfile(index)
}
}
+ onClosed: {
+ profileButton.checked = false;
+ }
content: ProfileSelector {
id: profileSelector
anchors.fill: parent
@@ -164,7 +166,6 @@ FocusScope {
}
}
}
- */
}
}
}
diff --git a/src/qml/InfoItem.qml b/src/qml/InfoItem.qml
index bc2b81d..d61c4e5 100644
--- a/src/qml/InfoItem.qml
+++ b/src/qml/InfoItem.qml
@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
+import QtQuick 2.4
QtObject {
property string title
diff --git a/src/qml/InformationTable.qml b/src/qml/InformationTable.qml
index 1f5b590..6538a78 100644
--- a/src/qml/InformationTable.qml
+++ b/src/qml/InformationTable.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,9 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
+import ktouch 1.0
Item {
property alias model: repeator.model
@@ -36,7 +38,7 @@ Item {
spacing: 5
height: Math.max(titleLabel.height, valueLabel.height)
width: column.width
- PlasmaComponents.Label {
+ Label {
id: titleLabel
width: Math.round((parent.width - parent.spacing) / 2)
horizontalAlignment: Text.AlignRight
@@ -46,7 +48,7 @@ Item {
wrapMode: Text.Wrap
height: Math.max(paintedHeight, valueLabel.paintedHeight)
}
- PlasmaComponents.Label {
+ Label {
id: valueLabel
width: parent.width - titleLabel.width - parent.spacing
horizontalAlignment: Text.AlignLeft
diff --git a/src/qml/LearningProgressChart.qml b/src/qml/LearningProgressChart.qml
index a2a05ed..99a03c0 100644
--- a/src/qml/LearningProgressChart.qml
+++ b/src/qml/LearningProgressChart.qml
@@ -15,9 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
import org.kde.charts 0.1
import ktouch 1.0
@@ -40,7 +40,7 @@ LineChart {
return 0;
}
-
+
dimensions: [
Dimension {
id: accuracyDimension
diff --git a/src/qml/ProfileDetailsItem.qml b/src/qml/ProfileDetailsItem.qml
index d173fb2..920626b 100644
--- a/src/qml/ProfileDetailsItem.qml
+++ b/src/qml/ProfileDetailsItem.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,10 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.locale 0.1 as Locale
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
+import org.kde.kcoreaddons 1.0
import org.kde.charts 0.1 as Charts
import ktouch 1.0
@@ -42,10 +43,12 @@ Item {
onProfileChanged: update()
- Locale.Locale {
- id: locale
+ SystemPalette {
+ id: activePalette
+ colorGroup: SystemPalette.Active
}
+
Item {
id: infoContainer
width: parent.width
@@ -68,11 +71,11 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 40
height: 250
- color: theme.backgroundColor
+ color: activePalette.base
border {
width: 1
- color: theme.textColor
+ color: activePalette.text
}
Column {
@@ -123,11 +126,11 @@ Item {
},
InfoItem {
title: i18n("Total training time:")
- text: profile && profile.id !== -1? locale.prettyFormatDuration(profileDataAccess.totalTrainingTime(profile)): ""
+ text: profile && profile.id !== -1? Format.formatDuration(profileDataAccess.totalTrainingTime(profile)): ""
},
InfoItem {
title: i18n("Last trained:")
- text: profile && profile.id !== -1 && profileInfoTable.trainedLessonCount > 0? locale.formatDateTime(profileDataAccess.lastTrainingSession(profile)): i18n("Never")
+ text: profile && profile.id !== -1 && profileInfoTable.trainedLessonCount > 0? profileDataAccess.lastTrainingSession(profile).toLocaleDateString(): i18n("Never")
}
]
@@ -142,18 +145,16 @@ Item {
topMargin: 5
}
content: [
- PlasmaComponents.ToolButton {
- iconSource: "document-edit"
+ ToolButton {
+ iconName: "document-edit"
text: i18n("Edit")
onClicked: root.state = "editor"
- width: minimumWidth
},
- PlasmaComponents.ToolButton {
- iconSource: "edit-delete"
+ ToolButton {
+ iconName: "edit-delete"
text: i18n("Delete")
enabled: profileDataAccess.profileCount > 1
onClicked: root.state = "deleteConfirmation"
- width: minimumWidth
}
]
}
@@ -194,7 +195,7 @@ Item {
height: childrenRect.height
spacing: 15
- PlasmaComponents.Label {
+ Label {
property string name
id: deleteConfirmationLabel
width: parent.width
@@ -207,16 +208,14 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
width: childrenRect.width
height: childrenRect.height
- PlasmaComponents.ToolButton {
- iconSource: "edit-delete"
+ ToolButton {
+ iconName: "edit-delete"
text: i18n("Delete")
onClicked: root.deletionRequest()
- width: minimumWidth
}
- PlasmaComponents.ToolButton {
+ ToolButton {
text: i18n("Cancel")
onClicked: root.state = "info"
- width: minimumWidth
}
}
}
diff --git a/src/qml/ProfileSelector.qml b/src/qml/ProfileSelector.qml
index a1bc904..b9e2320 100644
--- a/src/qml/ProfileSelector.qml
+++ b/src/qml/ProfileSelector.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
-import org.kde.plasma.components 0.1 as PlasmaComponents
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
import ktouch 1.0
FocusScope {
@@ -35,70 +36,61 @@ FocusScope {
profileForm.profile = profileDataAccess.profile(index)
}
- Column {
+ ColumnLayout {
anchors.fill: parent
+ anchors.bottomMargin: 10
spacing: 10
- Row {
- height: parent.height - selectButton.height - parent.spacing
- width: parent.width
+ RowLayout {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
spacing: 10
Item {
id: listContainer
- height: parent.height
- width: Math.round((parent.width - parent.spacing) / 2)
+ Layout.fillWidth: true
+ Layout.fillHeight: true
- ListView {
- id: list
+ ScrollView {
anchors.fill: parent
- model: profileDataAccess.profileCount + 1
- clip: true
- delegate: ListItem {
- property bool isNewButton: index >= profileDataAccess.profileCount
- width: list.width - scrollBar.width
- title: isNewButton?
- i18n("Create New Profile"):
- index < profileDataAccess.profileCount? profileDataAccess.profile(index).name: null
- label.font.italic: isNewButton
- iconSource: isNewButton? "list-add": "user-identity"
- onClicked: {
- list.currentIndex = index
- if (isNewButton) {
- createNewProfile()
+ 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?
+ i18n("Create New Profile"):
+ index < profileDataAccess.profileCount? profileDataAccess.profile(index).name: null
+ label.font.italic: isNewButton
+ iconSource: isNewButton? "list-add": "user-identity"
+ onClicked: {
+ list.currentIndex = index
+ if (isNewButton) {
+ createNewProfile()
+ }
+ else {
+ selectProfile(index)
+ }
}
- else {
- selectProfile(index)
- }
- }
- onDoubleClicked: {
- if (!isNewButton) {
- root.profileChosen(profileDataAccess.profile(list.currentIndex))
+ onDoubleClicked: {
+ if (!isNewButton) {
+ root.profileChosen(profileDataAccess.profile(list.currentIndex))
+ }
}
}
}
}
-
- PlasmaComponents.ScrollBar {
- id: scrollBar
- flickableItem: list
- }
- }
-
- PlasmaCore.SvgItem {
- id: line
- width: naturalSize.width
- height: parent.height
- elementId: "vertical-line"
- svg: PlasmaCore.Svg {
- imagePath: "widgets/line"
- }
}
ProfileDetailsItem {
id: profileForm
- width: parent.width - listContainer.width - line.width - 2 * parent.spacing
- height: parent.height
+ Layout.fillWidth: true
+ Layout.fillHeight: true
onDeletionRequest: {
var index = profileDataAccess.indexOfProfile(profileForm.profile)
@@ -109,7 +101,7 @@ FocusScope {
}
}
- PlasmaComponents.Button {
+ Button {
id: selectButton
anchors.horizontalCenter: parent.horizontalCenter
iconSource: "go-next-view"
diff --git a/src/qml/SheetDialog.qml b/src/qml/SheetDialog.qml
index c2b3b8c..babfffc 100644
--- a/src/qml/SheetDialog.qml
+++ b/src/qml/SheetDialog.qml
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Sebastian Gottfried <sebastiangottfried@web.de>
+ * Copyright 2015 Sebastian Gottfried <sebastiangottfried@web.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -15,20 +16,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import QtQuick 1.1
-import org.kde.plasma.core 0.1 as PlasmaCore
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.1
+import ktouch 1.0
Item {
id: root
+ SystemPalette {
+ id: activePalette
+ colorGroup: SystemPalette.Active
+ }
+
property alias content: contentArea.children
property int innerMargin: 20
- signal opended
+ signal opened
signal closed
function open() {
root.state = "open"
- opended()
+ opened()
}
function close() {
@@ -52,7 +60,7 @@ Item {
Rectangle {
id: bg
anchors.fill: parent
- color: theme.backgroundColor
+ color: activePalette.window
opacity: 1.0
Behavior on opacity {
@@ -62,30 +70,16 @@ Item {
}
}
- Item {
+ Rectangle {
id: slider
+ color: activePalette.window
width: parent.width
height: parent.height
- PlasmaCore.FrameSvgItem {
+ Item {
+ id: contentArea
anchors {
fill: parent
- leftMargin: 10
- rightMargin: 10
- bottomMargin: 10
- }
- imagePath: "dialogs/background"
- enabledBorders: PlasmaCore.FrameSvg.LeftBorder + PlasmaCore.FrameSvg.RightBorder + PlasmaCore.FrameSvg.BottomBorder
-
- Item {
- id: contentArea
- anchors {
- fill: parent
- leftMargin: parent.margins.left + innerMargin
- rightMargin: parent.margins.right + innerMargin
- topMargin: parent.margins.top + innerMargin
- bottomMargin: parent.margins.bottom + innerMargin
- }
}
}
}