Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added screenshots/gpxlist_landscape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/gpxlist_landscape_inverted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/gpxlist_portrait.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/gpxlist_portrait_inverted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/trainlist_landscape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/trainlist_landscape_original.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 7 additions & 17 deletions src/GPXList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ ColumnLayout {

RowLayout{
spacing: 2
anchors.top: parent.top
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true

ColumnLayout {
spacing: 0
anchors.top: parent.top
anchors.fill: parent
Layout.fillHeight: true

Row
{
Expand Down Expand Up @@ -88,9 +87,8 @@ ColumnLayout {
Layout.fillWidth: true
Layout.minimumWidth: 50
Layout.preferredWidth: 100
Layout.maximumWidth: row.left
Layout.minimumHeight: 150
Layout.preferredHeight: parent.height
Layout.fillHeight: true
ScrollBar.vertical: ScrollBar {}
id: list
FolderListModel {
Expand Down Expand Up @@ -186,12 +184,9 @@ ColumnLayout {
}

ScrollView {
anchors.top: parent.top
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
//contentHeight: map.height
Layout.preferredHeight: parent.height
Layout.fillWidth: true
Layout.fillHeight: true
Layout.fillWidth: true
Layout.minimumWidth: 100
Layout.preferredWidth: 200

Expand Down Expand Up @@ -267,17 +262,12 @@ ColumnLayout {

Button {
id: searchButton
height: 50
width: parent.width
Layout.fillWidth: true
Layout.preferredHeight: 50
text: "Other folders"
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter
onClicked: {
console.log("folder is " + rootItem.getWritableAppDir() + 'gpx')
// Create a fresh FileDialog instance
fileDialogLoader.active = true
}
anchors {
bottom: parent.bottom
}
}
}
200 changes: 96 additions & 104 deletions src/TrainingProgramsList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,54 @@ import QtQuick.Dialogs 1.0
import QtCharts 2.2
import Qt.labs.settings 1.0

ColumnLayout {
signal trainprogram_open_clicked(url name)
signal trainprogram_open_other_folder(url name)
signal trainprogram_preview(url name)
signal trainprogram_autostart_requested()
property url selectedWorkoutUrl: ""
property url initialWorkoutUrl: ""

function openWorkoutPreview(fileUrl) {
if (!fileUrl || fileUrl.toString() === "") {
return
}
selectedWorkoutUrl = fileUrl
trainprogram_preview(fileUrl)
powerSeries.clear();
for(var i=0;i<rootItem.preview_workout_points;i+=10)
{
powerSeries.append(i * 1000, rootItem.preview_workout_watt[i]);
}
rootItem.update_chart_power(powerChart);
}

Component.onCompleted: {
Qt.callLater(function() {
openWorkoutPreview(initialWorkoutUrl)
})
}

MessageDialog {
id: deleteDialog
text: "Delete workout?"
informativeText: "This cannot be undone."
buttons: (MessageDialog.Yes | MessageDialog.No)
onYesClicked: {
if (rootItem.deleteTrainingProgramFile(selectedWorkoutUrl)) {
selectedWorkoutUrl = ""
var currentFolder = folderModel.folder
folderModel.folder = ""
folderModel.folder = currentFolder
}
visible = false
}
onNoClicked: visible = false
}

Loader {
id: fileDialogLoader
active: false
ColumnLayout {
signal trainprogram_open_clicked(url name)
signal trainprogram_open_other_folder(url name)
signal trainprogram_preview(url name)
signal trainprogram_autostart_requested()
property url selectedWorkoutUrl: ""
property url initialWorkoutUrl: ""
function openWorkoutPreview(fileUrl) {
if (!fileUrl || fileUrl.toString() === "") {
return
}
selectedWorkoutUrl = fileUrl
trainprogram_preview(fileUrl)
powerSeries.clear();
for(var i=0;i<rootItem.preview_workout_points;i+=10)
{
powerSeries.append(i * 1000, rootItem.preview_workout_watt[i]);
}
rootItem.update_chart_power(powerChart);
}
Component.onCompleted: {
Qt.callLater(function() {
openWorkoutPreview(initialWorkoutUrl)
})
}
MessageDialog {
id: deleteDialog
text: "Delete workout?"
informativeText: "This cannot be undone."
buttons: (MessageDialog.Yes | MessageDialog.No)
onYesClicked: {
if (rootItem.deleteTrainingProgramFile(selectedWorkoutUrl)) {
selectedWorkoutUrl = ""
var currentFolder = folderModel.folder
folderModel.folder = ""
folderModel.folder = currentFolder
}
visible = false
}
onNoClicked: visible = false
}
Loader {
id: fileDialogLoader
active: false
sourceComponent: Component {
FileDialog {
title: "Please choose a file"
Expand Down Expand Up @@ -83,13 +83,12 @@ ColumnLayout {

RowLayout{
spacing: 2
anchors.top: parent.top
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true

ColumnLayout {
spacing: 0
anchors.top: parent.top
anchors.fill: parent
Layout.fillHeight: true

Row
{
Expand Down Expand Up @@ -127,9 +126,8 @@ ColumnLayout {
Layout.fillWidth: true
Layout.minimumWidth: 50
Layout.preferredWidth: 100
Layout.maximumWidth: row.left
Layout.minimumHeight: 150
Layout.preferredHeight: parent.height
Layout.fillHeight: true
ScrollBar.vertical: ScrollBar {}
id: list
FolderListModel {
Expand Down Expand Up @@ -215,36 +213,35 @@ ColumnLayout {
}*/
}
focus: true
onCurrentItemChanged: {
let fileUrl = folderModel.get(list.currentIndex, 'fileUrl') || folderModel.get(list.currentIndex, 'fileURL');
if (fileUrl && !folderModel.isFolder(list.currentIndex)) {
selectedWorkoutUrl = fileUrl
list.currentItem.textColor = Material.color(Material.Yellow)
console.log(fileUrl + ' selected');
trainprogram_preview(fileUrl)
onCurrentItemChanged: {
let fileUrl = folderModel.get(list.currentIndex, 'fileUrl') || folderModel.get(list.currentIndex, 'fileURL');
if (fileUrl && !folderModel.isFolder(list.currentIndex)) {
selectedWorkoutUrl = fileUrl
list.currentItem.textColor = Material.color(Material.Yellow)
console.log(fileUrl + ' selected');
trainprogram_preview(fileUrl)
powerSeries.clear();
for(var i=0;i<rootItem.preview_workout_points;i+=10)
{
powerSeries.append(i * 1000, rootItem.preview_workout_watt[i]);
}
rootItem.update_chart_power(powerChart);
//trainprogram_open_clicked(fileUrl);
//popup.open()
} else {
selectedWorkoutUrl = ""
}
}
//trainprogram_open_clicked(fileUrl);
//popup.open()
} else {
selectedWorkoutUrl = ""
}
}
Component.onCompleted: {

}
}
}

ScrollView {
anchors.top: parent.top
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
contentHeight: date.height + description.height + powerChart.height
Layout.preferredHeight: parent.height
Layout.fillHeight: true
Layout.fillWidth: true
Layout.minimumWidth: 100
Layout.preferredWidth: 200
Expand Down Expand Up @@ -342,41 +339,36 @@ ColumnLayout {
}
}

RowLayout {
height: 50
width: parent.width
Layout.alignment: Qt.AlignCenter | Qt.AlignVCenter

Button {
Layout.fillWidth: true
text: "Start Workout"
visible: selectedWorkoutUrl != ""
onClicked: {
trainprogram_open_clicked(selectedWorkoutUrl)
trainprogram_autostart_requested()
}
}

Button {
id: deleteButton
Layout.fillWidth: true
text: "Delete"
visible: selectedWorkoutUrl != ""
onClicked: deleteDialog.visible = true
}

Button {
id: searchButton
Layout.fillWidth: true
text: "Other folders"
onClicked: {
console.log("folder is " + rootItem.getWritableAppDir() + 'training')
// Create a fresh FileDialog instance
fileDialogLoader.active = true
}
}
anchors {
bottom: parent.bottom
RowLayout {
Layout.fillWidth: true
Layout.preferredHeight: 50

Button {
Layout.fillWidth: true
text: "Start Workout"
visible: selectedWorkoutUrl != ""
onClicked: {
trainprogram_open_clicked(selectedWorkoutUrl)
trainprogram_autostart_requested()
}
}

Button {
id: deleteButton
Layout.fillWidth: true
text: "Delete"
visible: selectedWorkoutUrl != ""
onClicked: deleteDialog.visible = true
}

Button {
id: searchButton
Layout.fillWidth: true
text: "Other folders"
onClicked: {
console.log("folder is " + rootItem.getWritableAppDir() + 'training')
fileDialogLoader.active = true
}
}
}
}
Loading