Skip to content

Commit

Permalink
sound: the chart image can be saved
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmm committed Jun 13, 2024
1 parent a4550b4 commit 1f617c3
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/contents/ui/SoundWave.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import EoSSoundBackend
import EoSdb
import EosSoundSourceModel
import QtCharts
import QtCore
import QtQuick
import QtQuick.Controls as Controls
import QtQuick.Dialogs
import QtQuick.Layouts
import org.kde.kirigami as Kirigami

Expand Down Expand Up @@ -51,6 +53,22 @@ Kirigami.ScrollablePage {
target: EoSSoundBackend
}

FileDialog {
id: fileDialogSaveChart

fileMode: FileDialog.SaveFile
currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
nameFilters: ["PNG files (*.png)"]
onAccepted: {
chartWaveForm.grabToImage(function(result) {
result.saveToFile(fileDialogSaveChart.selectedFile.toString().replace(".png", "_waveform.png"));
});
chartFFT.grabToImage(function(result) {
result.saveToFile(fileDialogSaveChart.selectedFile.toString().replace(".png", "_fft.png"));
});
}
}

ColumnLayout {
anchors.fill: parent

Expand Down Expand Up @@ -217,8 +235,11 @@ Kirigami.ScrollablePage {

},
Kirigami.Action {
text: i18n("Save Chart")
text: i18n("Save Charts")
icon.name: "folder-chart-symbolic"
onTriggered: {
fileDialogSaveChart.open();
}
},
Kirigami.Action {
text: i18n("Save Table")
Expand Down

0 comments on commit 1f617c3

Please sign in to comment.