Commit a5000ea6 authored by Sebastian Gottfried's avatar Sebastian Gottfried
Browse files

Qt5: Port ProfileSelector.qml And Friends

Now the home screen is fully functional once more.
parent 1d1ff6c5
......@@ -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 {
}
}
}
*/
}
}
}
......@@ -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
......
/*
* 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
......
......@@ -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
......
/*
* 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
}
}
}
......
/*
* 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"
......
/*
* 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
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment