Installing a custom waterfall gradient via fileman

This commit is contained in:
Belousov Oleg 2025-04-10 23:51:11 +03:00
parent 8b7de608a6
commit d4647b9e0c
6 changed files with 64 additions and 1 deletions

View File

@ -419,6 +419,17 @@ void FileManBaseView::reload_current(bool reset_pagination) {
refresh_list();
}
void FileManBaseView::copy_waterfall(std::filesystem::path path) {
nav_.push<ModalMessageView>(
"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<TextEditorView>(path);
if (path_iequal(current_path, u"/" + waterfalls_dir)) {
copy_waterfall(path);
} else {
nav_.push<TextEditorView>(path);
}
return true;
} else if (is_cxx_capture_file(path) || path_iequal(ppl_ext, ext)) {
// TODO: Enough memory to push?

View File

@ -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_;

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,8 @@
# 0% black
0,0,0,0
# 50% green
128,0,255,0
# 100% white
255,255,255,255

View File

@ -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