aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example-config.json10
-rw-r--r--include/Config.hpp5
-rw-r--r--src/Config.cpp5
-rw-r--r--src/QuickMedia.cpp8
-rw-r--r--src/plugins/FileManager.cpp11
-rw-r--r--src/plugins/Matrix.cpp2
6 files changed, 29 insertions, 12 deletions
diff --git a/example-config.json b/example-config.json
index b2efea3..1ab1718 100644
--- a/example-config.json
+++ b/example-config.json
@@ -95,7 +95,6 @@
},
"download": {
// Directores where to save different files when pressing ctrl+shift+s to save a file
-
"video_directory": "~/Videos",
"image_directory": "~/Pictures",
"music_directory": "~/Music",
@@ -111,11 +110,16 @@
"mangadex": {
"allow_hentai": false
},
+ "file_manager": {
+ // Set to true to enable grid view. If false, the file manager items are shown as a list instead
+ "grid_view": true
+ },
// Use system (fontconfig) fonts
"use_system_fonts": false,
- // Use system (~/.config/mpv) mpv.conf instead of the one provided by QuicKMedia
+ // Use system (~/.config/mpv) mpv.conf instead of the one provided by QuickMedia
"use_system_mpv_config": false,
- // Enable shaders. Only set to true if you have a very slow computer or dont care about any graphical effects
+ // Enable shaders. Only set to false if you have a very slow computer or dont care about graphical effects
+ // such as rounded corners. Rounded corners can also be disabled with the theme "rounded_rectangles" option
"enable_shaders": true,
// The theme to use. This should match the name of a file in either /usr/share/quickmedia/themes or ~/.config/quickmedia/themes, except without the .json at the end of the filename
"theme": "default",
diff --git a/include/Config.hpp b/include/Config.hpp
index 5bbeaff..df79da2 100644
--- a/include/Config.hpp
+++ b/include/Config.hpp
@@ -80,6 +80,10 @@ namespace QuickMedia {
bool allow_hentai = false;
};
+ struct FileManager {
+ bool grid_view = true;
+ };
+
struct Config {
Config() = default;
Config(const Config&) = delete;
@@ -98,6 +102,7 @@ namespace QuickMedia {
DownloadConfig download;
FontConfig font;
MangadexConfig mangadex;
+ FileManager file_manager;
bool use_system_fonts = false;
bool use_system_mpv_config = false;
bool enable_shaders = true;
diff --git a/src/Config.cpp b/src/Config.cpp
index fe4e984..c79249d 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -309,6 +309,11 @@ namespace QuickMedia {
get_json_value(mangadex_json, "allow_hentai", config->mangadex.allow_hentai);
}
+ const Json::Value &file_manager_json = json_root["file_manager"];
+ if(file_manager_json.isObject()) {
+ get_json_value(file_manager_json, "grid_view", config->file_manager.grid_view);
+ }
+
get_json_value(json_root, "use_system_fonts", config->use_system_fonts);
get_json_value(json_root, "use_system_mpv_config", config->use_system_mpv_config);
get_json_value(json_root, "enable_shaders", config->enable_shaders);
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 13450e3..04638f0 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1317,7 +1317,7 @@ namespace QuickMedia {
auto file_manager_page = std::make_unique<FileManagerPage>(this, fm_mime_type, file_selection_handler);
if(!file_manager_page->set_current_directory(file_manager_start_dir))
fprintf(stderr, "Warning: Invalid directory provided with --dir\n");
- auto file_manager_body = create_body(false, true);
+ auto file_manager_body = create_body(false, get_config().file_manager.grid_view);
BodyItems body_items;
file_manager_page->get_files_in_directory(body_items);
file_manager_body->set_items(std::move(body_items));
@@ -4833,7 +4833,7 @@ namespace QuickMedia {
std::filesystem::path &fm_dir = file_manager_start_dir;
auto file_manager_page = std::make_unique<FileManagerPage>(this, (FileManagerMimeType)(FILE_MANAGER_MIME_TYPE_IMAGE|FILE_MANAGER_MIME_TYPE_VIDEO));
file_manager_page->set_current_directory(fm_dir.string());
- auto file_manager_body = create_body(false, true);
+ auto file_manager_body = create_body(false, get_config().file_manager.grid_view);
BodyItems body_items;
file_manager_page->get_files_in_directory(body_items);
file_manager_body->set_items(std::move(body_items));
@@ -7401,7 +7401,7 @@ namespace QuickMedia {
std::filesystem::path &fm_dir = file_manager_start_dir;
auto file_manager_page = std::make_unique<FileManagerPage>(this);
file_manager_page->set_current_directory(fm_dir.string());
- auto file_manager_body = create_body(false, true);
+ auto file_manager_body = create_body(false, get_config().file_manager.grid_view);
BodyItems body_items;
file_manager_page->get_files_in_directory(body_items);
file_manager_body->set_items(std::move(body_items));
@@ -8239,7 +8239,7 @@ namespace QuickMedia {
auto file_manager_page = std::make_unique<FileManagerPage>(this);
file_manager_page->set_current_directory(file_manager_start_dir);
- auto file_manager_body = create_body(false, true);
+ auto file_manager_body = create_body(false, get_config().file_manager.grid_view);
BodyItems body_items;
file_manager_page->get_files_in_directory(body_items);
file_manager_body->set_items(std::move(body_items));
diff --git a/src/plugins/FileManager.cpp b/src/plugins/FileManager.cpp
index 6f16b0a..c731ec2 100644
--- a/src/plugins/FileManager.cpp
+++ b/src/plugins/FileManager.cpp
@@ -2,6 +2,7 @@
#include "../../include/FileAnalyzer.hpp"
#include "../../include/ResourceLoader.hpp"
#include "../../include/Theme.hpp"
+#include "../../include/Config.hpp"
#include "../../include/Storage.hpp"
#include "../../include/QuickMedia.hpp"
@@ -54,7 +55,7 @@ namespace QuickMedia {
return result;
set_last_accessed_dir(current_dir);
- auto body = create_body(false, true);
+ auto body = create_body(false, get_config().file_manager.grid_view);
body->set_items(std::move(result_items));
result_tabs.push_back(Tab{std::move(body), nullptr, nullptr});
return PluginResult::OK;
@@ -86,9 +87,11 @@ namespace QuickMedia {
if(current_dir != "/") {
auto parent_item = BodyItem::create("Go to parent directory");
parent_item->url = "..";
- parent_item->thumbnail_is_local = true;
- parent_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/folder.png");
- parent_item->thumbnail_size = mgl::vec2i(64, 64);
+ if(get_config().file_manager.grid_view) {
+ parent_item->thumbnail_is_local = true;
+ parent_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/folder.png");
+ parent_item->thumbnail_size = mgl::vec2i(64, 64);
+ }
result_items.push_back(std::move(parent_item));
}
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 16dd098..b9fbea0 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -1295,7 +1295,7 @@ namespace QuickMedia {
return std::vector<Tab>{};
};
- auto file_manager_body = create_body(false, true);
+ auto file_manager_body = create_body(false, get_config().file_manager.grid_view);
auto file_manager_page = std::make_unique<FileManagerPage>(program, FILE_MANAGER_MIME_TYPE_IMAGE, std::move(submit_handler));
file_manager_page->set_current_directory(get_home_dir().data);
BodyItems body_items;