Skip to content

Commit 25eda7b

Browse files
Simplified code
1 parent 871d277 commit 25eda7b

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

app/qml/form/editors/MMFormPhotoViewer.qml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ MMPrivateComponents.MMBaseInput {
7575
visible: photoStateGroup.state !== "notSet"
7676

7777
photoUrl: root.photoUrl
78-
isLocalFile: filePrefixBasedOnSystem()
78+
isLocalFile: isPhotoUrlPathValid()
7979
cache: false
8080

8181
fillMode: Image.PreserveAspectCrop
@@ -125,7 +125,7 @@ MMPrivateComponents.MMBaseInput {
125125
iconSource: __style.drawIcon
126126
iconColor: __style.forestColor
127127

128-
visible: root.editState === "enabled" && photoStateGroup.state !== "notSet" && __activeProject.photoSketchingEnabled && isFilePrefixValid()
128+
visible: root.editState === "enabled" && photoStateGroup.state !== "notSet" && __activeProject.photoSketchingEnabled && isPhotoUrlPathValid()
129129

130130
onClicked: {
131131
sketchingLoader.active = true
@@ -186,14 +186,8 @@ MMPrivateComponents.MMBaseInput {
186186
}
187187
}
188188

189-
function filePrefixBasedOnSystem(){
189+
function isPhotoUrlPathValid(){
190190
let filePrefix = Qt.platform.os === "windows" ? "file:///" : "file://"
191191
return root.photoUrl.startsWith( filePrefix )
192192
}
193-
194-
function isFilePrefixValid()
195-
{
196-
let filePrefix = Qt.platform.os === "windows" ? "file:///" : "file://"
197-
return root.photoUrl.startsWith(filePrefix)
198-
}
199193
}

0 commit comments

Comments
 (0)