Commit 8bc7b2bd authored by Jerome Guidon's avatar Jerome Guidon
Browse files

Fix fields behavior when creating a radio.

Fields were on read-only mode.
Also made some renaming for consistency with modifying.
parent e2d32dd9
Pipeline #63897 passed with stage
in 29 seconds
......@@ -52,7 +52,7 @@ FocusScope {
metadataLoader.setSource(Kirigami.Settings.isMobile ? "mobile/MobileMediaTrackMetadataView.qml" : "MediaTrackMetadataView.qml",
{
"modelType": ElisaUtils.Radio,
"isCreation": true,
"isCreating": true,
"showImage": false,
"showTrackFileName": false,
"showDeleteButton": true,
......
......@@ -22,7 +22,7 @@ Kirigami.FormLayout {
property var modelType
property bool showDeleteButton
property bool isCreation
property bool isCreating
property bool isModifying
property bool canAddMoreMetadata
property bool showModifyDeleteButtons
......@@ -79,7 +79,7 @@ Kirigami.FormLayout {
isRemovable: model.isRemovable
onEdited: model.display = display
readOnly: !isModifying || (metadataModel.isReadOnly || model.isReadOnly)
readOnly: (!isModifying && !isCreating) || (metadataModel.isReadOnly || model.isReadOnly)
onDeleteField: metadataModel.removeData(model.index)
Layout.minimumHeight: Kirigami.Units.gridUnit * 1.5
......@@ -122,7 +122,7 @@ Kirigami.FormLayout {
Layout.minimumHeight: implicitHeight
alignment: Qt.AlignLeft
visible: showDeleteButton && !isCreation
visible: showDeleteButton && !isCreating
Button {
id: deleteButton
......
......@@ -21,7 +21,7 @@ Window {
property url fileName
property bool editableMetadata
property bool isModifying: false
property bool isCreation: false
property bool isCreating: false
property bool canAddMoreMetadata: false
property bool showImage
property bool showTrackFileName
......@@ -32,7 +32,7 @@ Window {
LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true
title: isCreation ? i18nc("Window title for track metadata", "Create a Radio") :
title: isCreating ? i18nc("Window title for track metadata", "Create a Radio") :
i18nc("Window title for track metadata", "View Details")
EditableTrackMetadataModel {
......@@ -74,7 +74,7 @@ Window {
metadataModel: realModel
modelType: trackMetadata.modelType
showDeleteButton: trackMetadata.showDeleteButton
isCreation: trackMetadata.isCreation
isCreating: trackMetadata.isCreating
isModifying: trackMetadata.isModifying
canAddMoreMetadata: trackMetadata.canAddMoreMetadata
showImage: trackMetadata.showImage
......@@ -132,7 +132,7 @@ Window {
Layout.minimumHeight: implicitHeight
alignment: Qt.AlignLeft
visible: showDeleteButton && !isCreation
visible: showDeleteButton && !isCreating
Button {
id: deleteButton
......@@ -173,8 +173,8 @@ Window {
onClicked:
{
realModel.saveData()
if (isCreation) {
isCreation = false
if (isCreating) {
isCreating = false
isModifying = true
}
}
......@@ -193,7 +193,7 @@ Window {
target: ElisaApplication
function onMusicManagerChanged() {
if (isCreation) {
if (isCreating) {
realModel.initializeForNewRadio()
} else {
realModel.initializeByUrl(modelType, fileName)
......@@ -203,7 +203,7 @@ Window {
Component.onCompleted: {
if (ElisaApplication.musicManager) {
if (isCreation) {
if (isCreating) {
realModel.initializeForNewRadio()
} else {
realModel.initializeByUrl(modelType, fileName)
......@@ -236,7 +236,7 @@ Window {
State {
name: 'readOnly'
when: editableMetadata && !isModifying && !isCreation
when: editableMetadata && !isModifying && !isCreating
changes: [
PropertyChanges {
......@@ -254,7 +254,7 @@ Window {
State {
name: 'readWrite'
when: editableMetadata && isModifying && !isCreation && (!realModel.isDataValid || !realModel.isDirty)
when: editableMetadata && isModifying && !isCreating && (!realModel.isDataValid || !realModel.isDirty)
changes: [
PropertyChanges {
......@@ -272,7 +272,7 @@ Window {
State {
name: 'readWriteAndDirty'
when: editableMetadata && isModifying && !isCreation && realModel.isDataValid && realModel.isDirty
when: editableMetadata && isModifying && !isCreating && realModel.isDataValid && realModel.isDirty
changes: [
PropertyChanges {
......@@ -290,7 +290,7 @@ Window {
State {
name: 'create'
when: editableMetadata && !isModifying && isCreation && (!realModel.isDataValid || !realModel.isDirty)
when: editableMetadata && !isModifying && isCreating && (!realModel.isDataValid || !realModel.isDirty)
changes: [
PropertyChanges {
......@@ -308,7 +308,7 @@ Window {
State {
name: 'createAndDirty'
when: editableMetadata && !isModifying && isCreation && realModel.isDataValid && realModel.isDirty
when: editableMetadata && !isModifying && isCreating && realModel.isDataValid && realModel.isDirty
changes: [
PropertyChanges {
......
......@@ -25,7 +25,7 @@ Kirigami.ScrollablePage {
property url fileName
property bool editableMetadata
property bool isModifying: false
property bool isCreation: false
property bool isCreating: false
property bool canAddMoreMetadata: false
property bool showImage
property bool showTrackFileName
......@@ -36,7 +36,7 @@ Kirigami.ScrollablePage {
LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true
title: isCreation ? i18nc("Window title for track metadata", "Create a Radio") :
title: isCreating ? i18nc("Window title for track metadata", "Create a Radio") :
i18nc("Window title for track metadata", "View Details")
actions.main: Kirigami.Action {
......@@ -44,8 +44,8 @@ Kirigami.ScrollablePage {
text: i18n("Save")
onTriggered: {
realModel.saveData()
if (isCreation) {
isCreation = false
if (isCreating) {
isCreating = false
isModifying = true
}
mainWindow.pageStack.layers.pop();
......@@ -62,7 +62,7 @@ Kirigami.ScrollablePage {
Component.onCompleted: {
if (ElisaApplication.musicManager) {
if (isCreation) {
if (isCreating) {
realModel.initializeForNewRadio()
} else {
realModel.initializeByUrl(modelType, fileName)
......@@ -78,7 +78,7 @@ Kirigami.ScrollablePage {
target: ElisaApplication
function onMusicManagerChanged() {
if (isCreation) {
if (isCreating) {
realModel.initializeForNewRadio()
} else {
realModel.initializeByUrl(modelType, fileName)
......@@ -124,7 +124,7 @@ Kirigami.ScrollablePage {
metadataModel: realModel
modelType: trackMetadata.modelType
showDeleteButton: trackMetadata.showDeleteButton
isCreation: trackMetadata.isCreation
isCreating: trackMetadata.isCreating
isModifying: trackMetadata.isModifying
canAddMoreMetadata: trackMetadata.canAddMoreMetadata
showImage: trackMetadata.showImage
......
Markdown is supported
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