diff --git a/firmware/application/apps/ui_fileman.cpp b/firmware/application/apps/ui_fileman.cpp index 12e118a38..ec4e949ac 100644 --- a/firmware/application/apps/ui_fileman.cpp +++ b/firmware/application/apps/ui_fileman.cpp @@ -419,6 +419,17 @@ void FileManBaseView::reload_current(bool reset_pagination) { refresh_list(); } +void FileManBaseView::copy_waterfall(std::filesystem::path path) { + nav_.push( + "Install", " Use this gradient file\n for all waterfalls?", YESNO, + [this, path](bool choice) { + if (choice) { + delete_file(default_gradient_file); + copy_file(path, default_gradient_file); + } + }); +} + const FileManBaseView::file_assoc_t& FileManBaseView::get_assoc( const fs::path& ext) const { size_t index = 0; @@ -685,7 +696,11 @@ bool FileManagerView::handle_file_open() { auto ext = path.extension(); if (path_iequal(txt_ext, ext)) { - nav_.push(path); + if (path_iequal(current_path, u"/" + waterfalls_dir)) { + copy_waterfall(path); + } else { + nav_.push(path); + } return true; } else if (is_cxx_capture_file(path) || path_iequal(ppl_ext, ext)) { // TODO: Enough memory to push? diff --git a/firmware/application/apps/ui_fileman.hpp b/firmware/application/apps/ui_fileman.hpp index e044e53ec..3a4e8da07 100644 --- a/firmware/application/apps/ui_fileman.hpp +++ b/firmware/application/apps/ui_fileman.hpp @@ -96,6 +96,7 @@ class FileManBaseView : public View { void load_directory_contents(const std::filesystem::path& dir_path); void load_directory_contents_unordered(const std::filesystem::path& dir_path, size_t file_cnt); const file_assoc_t& get_assoc(const std::filesystem::path& ext) const; + void copy_waterfall(std::filesystem::path path); NavigationView& nav_; diff --git a/sdcard/WATERFALLS/aurora.txt b/sdcard/WATERFALLS/aurora.txt new file mode 100644 index 000000000..f564ebf8e --- /dev/null +++ b/sdcard/WATERFALLS/aurora.txt @@ -0,0 +1,14 @@ +# 0% black +0,0,0,0 + +# 25% blue +64,0,0,255 + +# 50% magenta +128,255,0,255 + +# 75% green +192,0,255,0 + +# 100% white +255,255,255,255 diff --git a/sdcard/WATERFALLS/flame.txt b/sdcard/WATERFALLS/flame.txt new file mode 100644 index 000000000..83bdbcc3f --- /dev/null +++ b/sdcard/WATERFALLS/flame.txt @@ -0,0 +1,11 @@ +# 0% black +0,0,0,0 + +# 33% red +84,255,0,0 + +# 66% yellow +168,255,255,0 + +# 100% white +255,255,255,255 diff --git a/sdcard/WATERFALLS/matrix.txt b/sdcard/WATERFALLS/matrix.txt new file mode 100644 index 000000000..726ad89d1 --- /dev/null +++ b/sdcard/WATERFALLS/matrix.txt @@ -0,0 +1,8 @@ +# 0% black +0,0,0,0 + +# 50% green +128,0,255,0 + +# 100% white +255,255,255,255 diff --git a/sdcard/WATERFALLS/sunset.txt b/sdcard/WATERFALLS/sunset.txt new file mode 100644 index 000000000..aeae107d7 --- /dev/null +++ b/sdcard/WATERFALLS/sunset.txt @@ -0,0 +1,14 @@ +# 0% black +0,0,0,0 + +# 25% blue +64,0,0,255 + +# 50% red +128,255,0,0 + +# 75% yellow +192,255,255,0 + +# 100% white +255,255,255,255