Skip to content

Commit 075a6d1

Browse files
minor code cleanup
1 parent 9c4d4e4 commit 075a6d1

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/qml/editorwidgets/relationeditors/gallery_relation_editor.qml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,7 @@ RelationEditorBase {
342342
close();
343343
}
344344
onCanceled: close()
345-
onClosed: {
346-
relationCameraLoader.active = false;
347-
relationCameraLoader.isVideo = false;
348-
}
345+
onClosed: relationCameraLoader.active = false
349346
}
350347
}
351348
}
@@ -768,16 +765,14 @@ RelationEditorBase {
768765
visible: attachmentIsAudio
769766
clip: true
770767

771-
readonly property int totalBars: Math.max(1, Math.floor((width - 24) / 5))
772-
773768
Row {
774769
id: waveformBars
775770
anchors.centerIn: parent
776771
height: parent.height * 0.7
777772
spacing: 2
778773

779774
Repeater {
780-
model: audioWaveformArea.totalBars
775+
model: Math.max(1, Math.floor((audioWaveformArea.width - 24) / 5))
781776

782777
Rectangle {
783778
width: 3
@@ -790,12 +785,14 @@ RelationEditorBase {
790785
radius: 1.5
791786
anchors.verticalCenter: parent.verticalCenter
792787
color: {
788+
const totalBars = Math.max(1, Math.floor((audioWaveformArea.width - 24) / 5));
793789
if (audioPlayerLoader.active && (index / totalBars) < audioPlayerLoader.progress) {
794790
return Theme.mainColor;
795791
}
796792
return Theme.mainTextDisabledColor;
797793
}
798794
opacity: {
795+
const totalBars = Math.max(1, Math.floor((audioWaveformArea.width - 24) / 5));
799796
if (audioPlayerLoader.active && (index / totalBars) < audioPlayerLoader.progress) {
800797
return 0.9;
801798
}

0 commit comments

Comments
 (0)