Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 99ac246ab5 |
@@ -7,5 +7,6 @@ namespace tt::app::files {
|
||||
bool isSupportedAppFile(const std::string& filename);
|
||||
bool isSupportedImageFile(const std::string& filename);
|
||||
bool isSupportedTextFile(const std::string& filename);
|
||||
bool isSupportedAudioFile(const std::string& filename);
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -26,4 +26,9 @@ bool isSupportedTextFile(const std::string& filename) {
|
||||
filename_lower.ends_with(".properties");
|
||||
}
|
||||
|
||||
bool isSupportedAudioFile(const std::string& filename) {
|
||||
std::string filename_lower = string::lowercase(filename);
|
||||
return filename_lower.ends_with(".mp3");
|
||||
}
|
||||
|
||||
} // namespace tt::app::filebrowser
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include <Tactility/app/imageviewer/ImageViewer.h>
|
||||
#include <Tactility/app/inputdialog/InputDialog.h>
|
||||
#include <Tactility/app/notes/Notes.h>
|
||||
#include <Tactility/app/App.h>
|
||||
#include <Tactility/Bundle.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/kernel/Platform.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
@@ -233,6 +235,10 @@ void View::viewFile(const std::string& path, const std::string& filename) {
|
||||
// Remove forward slash, because we need a relative path
|
||||
notes::start(processed_filepath.substr(1));
|
||||
}
|
||||
} else if (isSupportedAudioFile(filename)) {
|
||||
auto parameters = std::make_shared<Bundle>();
|
||||
parameters->putString("file", processed_filepath);
|
||||
app::start("one.tactility.mp3player", parameters);
|
||||
} else {
|
||||
LOGGER.warn("Opening files of this type is not supported");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user