summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2021-08-29 21:30:34 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-30 08:56:33 +0000
commitb7409cb6c217eb02f42c6d03184fe1e4913bfac5 (patch)
treec3c07efc3ea43f77da59531487fa41be5a1d9d55 /examples
parent909f234f3ea65bddbd6d48955b50ca79eee28334 (diff)
ADecoder: Use writable path from QStandardPaths for the decoding output
Hardcoding a path might not be always guaranteed to give a writable path. Change-Id: Ia6f049bbaa173857c544fbb9b6fad70532713eaf Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 9e16bf2eace2a66ac93b507f9fd284628c91fdc3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/multimedia/audiodecoder/main.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/multimedia/audiodecoder/main.cpp b/examples/multimedia/audiodecoder/main.cpp
index f352bdea1..2f6637b22 100644
--- a/examples/multimedia/audiodecoder/main.cpp
+++ b/examples/multimedia/audiodecoder/main.cpp
@@ -58,6 +58,7 @@
#include <QApplication>
#include <QFileDialog>
#include <QMessageBox>
+#include <qstandardpaths.h>
#endif
#include <stdio.h>
@@ -106,13 +107,14 @@ int main(int argc, char *argv[])
#else
- const QString message = "You will be prompted to select an audio file which will be"
- "decoded and played back to you.";
+ const QString message = "You will be prompted to select an audio file (e.g. mp3 or ogg format) "
+ "which will be decoded and played back to you.";
QMessageBox messageBox(QMessageBox::Information, "Audio Decoder", message, QMessageBox::Ok);
messageBox.exec();
sourceFile = QFileInfo(QFileDialog::getOpenFileName(messageBox.parentWidget(),
"Select Audio File"));
- targetFile = QFileInfo("/data/local/tmp/out.wav");
+ auto musicPath = QStandardPaths::writableLocation(QStandardPaths::MusicLocation);
+ targetFile = QFileInfo(musicPath.append("/out.wav"));
isPlayback = true;
#endif
AudioDecoder decoder(isPlayback, isDelete, targetFile.absoluteFilePath());