diff --git a/README.md b/README.md index 9c0fa017..e388af9d 100644 --- a/README.md +++ b/README.md @@ -45,11 +45,16 @@ Please report issues in our [issue tracker](https://github.com/issues). ### Next release -![Commits since last release](https://img.shields.io/github/commits-since/chordian/sidfactory2/release-20221007) +![Commits since last +release](https://img.shields.io/github/commits-since/chordian/sidfactory2/release-20221007) +- Added: [#156](https://github.com/Chordian/sidfactory2/issues/156) + Configuration option `Disk.Hide.Extensions` to hide files with certain + extensions in the file browser. Default values are `.sid`, `.wav` and `.mp3` +- Changed: Configuration parameter `Window.Scale` now has a range from 1.0 to + 10.0, so users can blow up the screen even bigger. Values below 1.0 were not + working correctly. -- Changed: Configuration parameter `Window.Scale` now has a range from 1.0 to 10.0, so users can blow up the screen even bigger. - Values below 1.0 were not working correctly. ### Build 20221007 - Fixed: [#162](https://github.com/Chordian/sidfactory2/issues/162) Crash when @@ -76,9 +81,6 @@ Please report issues in our [issue tracker](https://github.com/issues). - Fixed: reSID won't output a click anymore when launching SID Factory II or loading/saving files (Thanks to Tammo Hinrichs for implementing) -- Added: Configuration option `Disk.Hide.Extensions` to hide files with certain - extensions in the file browser. Default values are `.sid` and `.prg`. - ### Build 20211230 - Added: You can now add labels for song list rows. Left-click to edit a label. diff --git a/SIDFactoryII/config.ini b/SIDFactoryII/config.ini index 395df694..58146344 100644 --- a/SIDFactoryII/config.ini +++ b/SIDFactoryII/config.ini @@ -232,8 +232,9 @@ Key.OrderListOverview.Paste = @v:control // Hide files with these extensions from the file browser. // Use += to add to a list, or = to add the first element and disregard previously added elements -Disk.Hide.Extensions = ".sid" -Disk.Hide.Extensions += ".prg" +Disk.Hide.Extensions = ".sid" +Disk.Hide.Extensions += ".wav" +Disk.Hide.Extensions += ".mp3" [windows] // Applies to the windows platform only diff --git a/SIDFactoryII/source/runtime/editor/datasources/datasource_directory.cpp b/SIDFactoryII/source/runtime/editor/datasources/datasource_directory.cpp index fd0caa43..1d3b5936 100644 --- a/SIDFactoryII/source/runtime/editor/datasources/datasource_directory.cpp +++ b/SIDFactoryII/source/runtime/editor/datasources/datasource_directory.cpp @@ -1,7 +1,7 @@ #include "datasource_directory.h" #include "foundation/platform/iplatform.h" -#include "utils/configfile.h" #include "utils/config/configtypes.h" +#include "utils/configfile.h" #include using namespace fs; @@ -28,7 +28,7 @@ namespace Editor const size_t user_folder_count = user_folders.size(); const bool has_aliases = user_folders_alias.size() == user_folder_count; - for (size_t i = 0; iOS_ParsePath(user_folders[i]); path user_folder_path = path(user_folder); @@ -48,7 +48,7 @@ namespace Editor FOUNDATION_ASSERT(inIndex < static_cast(m_List.size())); const DirectoryEntry& entry = (*this)[inIndex]; - std::error_code error_code; + std::error_code error_code; switch (entry.m_Type) { @@ -58,11 +58,11 @@ namespace Editor case DirectoryEntry::Drive: case DirectoryEntry::Folder: - if(m_Platform->Storage_SetCurrentPath(entry.m_Path.string())) - { - GenerateData(); - return SelectResult::SelectFolderSucceeded; - } + if (m_Platform->Storage_SetCurrentPath(entry.m_Path.string())) + { + GenerateData(); + return SelectResult::SelectFolderSucceeded; + } return SelectResult::SelectFolderFailed; case DirectoryEntry::File: @@ -80,11 +80,11 @@ namespace Editor bool DataSourceDirectory::Back() { - std::error_code error_code; + std::error_code error_code; std::string current_path_string = current_path().string(); if (m_Platform->Storage_SetCurrentPath(current_path().parent_path().string())) - { + { GenerateData(); for (size_t i = 0; i < m_List.size(); ++i) @@ -146,7 +146,7 @@ namespace Editor fs::path current_path = fs::current_path(); const bool is_root = current_path.parent_path() == current_path; - if(!is_root) + if (!is_root) m_List.push_back({ DirectoryEntry::Back, ".." }); // Iterate entries in current directory and add folder to the list and cache files for adding afterward @@ -154,29 +154,27 @@ namespace Editor std::vector files; for (auto& path : directory_iterator) { - if(!m_Platform->Storage_IsSystemFile(path.path().string())) - { - std::error_code error_code; - if (is_directory(path, error_code)) - m_List.push_back({ DirectoryEntry::Folder, path }); - else if (is_regular_file(path, error_code)) { + if (!m_Platform->Storage_IsSystemFile(path.path().string())) + { + std::error_code error_code; + if (is_directory(path, error_code)) + m_List.push_back({ DirectoryEntry::Folder, path }); + else if (is_regular_file(path, error_code)) + { std::string extension = fs::path(path).extension(); // filter out files with extensions on the hide list bool showFile = true; - for (size_t i = 0; i < m_ExtensionFilter.size(); ++i) { - if (extension.compare(m_ExtensionFilter[i]) == 0) { + for (size_t i = 0; i < m_ExtensionFilter.size(); ++i) + { + if (extension.compare(m_ExtensionFilter[i]) == 0) + { showFile = false; } } - // TODO: more optimal, but crashes when extensionFilter is empty - // size_t i = 0; - // while (showFile && (i < m_ExtensionFilter.size())) { - // showFile = showFile && (extension.compare(m_ExtensionFilter[i++]) != 0); - // } - - if (showFile) { + if (showFile) + { files.push_back(path); } } @@ -187,32 +185,31 @@ namespace Editor m_List.push_back({ DirectoryEntry::File, file }); // Sort the list - std::sort(m_List.begin(), m_List.end(), [](const DirectoryEntry& inEntry1, const DirectoryEntry& inEntry2) + std::sort(m_List.begin(), m_List.end(), [](const DirectoryEntry& inEntry1, const DirectoryEntry& inEntry2) { + // If the types are the same, lets check the filenames against each other (and ignore case .. which means a transformation per comparison, not fast.. but who cares! This is disk operation stuff) + if (inEntry1.m_Type == inEntry2.m_Type) { - // If the types are the same, lets check the filenames against each other (and ignore case .. which means a transformation per comparasin, not fast.. but who cares! This is disk operation stuff) - if (inEntry1.m_Type == inEntry2.m_Type) + if (!(inEntry1.m_DisplayName.empty() ^ inEntry2.m_DisplayName.empty())) { - if (!(inEntry1.m_DisplayName.empty() ^ inEntry2.m_DisplayName.empty())) - { - std::string name1 = inEntry1.m_DisplayName.empty() ? inEntry1.m_Path.string() : inEntry1.m_DisplayName; - std::string name2 = inEntry2.m_DisplayName.empty() ? inEntry2.m_Path.string() : inEntry2.m_DisplayName; + std::string name1 = inEntry1.m_DisplayName.empty() ? inEntry1.m_Path.string() : inEntry1.m_DisplayName; + std::string name2 = inEntry2.m_DisplayName.empty() ? inEntry2.m_Path.string() : inEntry2.m_DisplayName; - std::transform(name1.begin(), name1.end(), name1.begin(), - [](char c) { return std::tolower(c); }); - std::transform(name2.begin(), name2.end(), name2.begin(), - [](char c) { return std::tolower(c); }); + std::transform(name1.begin(), name1.end(), name1.begin(), + [](char c) { return std::tolower(c); }); + std::transform(name2.begin(), name2.end(), name2.begin(), + [](char c) { return std::tolower(c); }); - return name1 < name2; - } - else - { - // If inEntry2 is not using the display name, entry 1 is and vice versa! - return inEntry2.m_DisplayName.empty(); - } + return name1 < name2; + } + else + { + // If inEntry2 is not using the display name, entry 1 is and vice versa! + return inEntry2.m_DisplayName.empty(); } + } - // Otherwise just prefer one type over the other - return inEntry1.m_Type < inEntry2.m_Type; - }); + // Otherwise just prefer one type over the other + return inEntry1.m_Type < inEntry2.m_Type; + }); } } diff --git a/dist/documentation/user.default.ini b/dist/documentation/user.default.ini index d56eadc4..f810fc78 100644 --- a/dist/documentation/user.default.ini +++ b/dist/documentation/user.default.ini @@ -69,8 +69,9 @@ Show.Overlay = 0 // If you set this to 1, the ove // Hide files with these extensions from the file browser. // Use += to add to a list, or = to add the first element and disregard previously added elements -Disk.Hide.Extensions = ".sid" -Disk.Hide.Extensions += ".prg" +Disk.Hide.Extensions = ".sid" +Disk.Hide.Extensions += ".wav" +Disk.Hide.Extensions += ".mp3" [windows] // Applies to the windows platform only