Compare commits

...

1 Commits

Author SHA1 Message Date
Adolfo Reyna 99ac246ab5 Associate .mp3 files with the Mp3Player application in Files browser 2026-06-28 22:24:45 -04:00
3 changed files with 12 additions and 0 deletions
@@ -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
+6
View File
@@ -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");
}