diff --git a/src/Steam/FileSystem/FileSystem.cpp b/src/Steam/FileSystem/FileSystem.cpp index 71ba2f9..817b1d0 100644 --- a/src/Steam/FileSystem/FileSystem.cpp +++ b/src/Steam/FileSystem/FileSystem.cpp @@ -6,20 +6,18 @@ #include #include -const char* assets_default_paths [] = { +std::vector appDirectoryPaths = { ".steam/steam/steamapps/common", ".local/share/Steam/steamapps/common", ".var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common", "snap/steam/common/.local/share/Steam/steamapps/common", - nullptr }; -const char* workshop_content_default_paths [] = { +std::vector workshopDirectoryPaths = { ".local/share/Steam/steamapps/workshop/content", ".steam/steam/steamapps/workshop/content", ".var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/workshop/content", "snap/steam/common/.local/share/Steam/steamapps/workshop/content", - nullptr }; std::filesystem::path detectHomepath () { @@ -33,14 +31,14 @@ std::filesystem::path detectHomepath () { if (!std::filesystem::is_directory (path)) sLog.exception ("Cannot find home directory for current user, ", home, " is not a directory"); - return home; + return path; } std::filesystem::path Steam::FileSystem::workshopDirectory (int appID, const std::string& contentID) { auto homepath = detectHomepath (); - for (const char** current = workshop_content_default_paths; *current != nullptr; current++) { - auto currentpath = std::filesystem::path (homepath) / *current / std::to_string (appID) / contentID; + for (const auto& current : workshopDirectoryPaths) { + auto currentpath = std::filesystem::path (homepath) / current / std::to_string (appID) / contentID; if (!std::filesystem::exists (currentpath) || !std::filesystem::is_directory (currentpath)) continue; @@ -54,8 +52,8 @@ std::filesystem::path Steam::FileSystem::workshopDirectory (int appID, const std std::filesystem::path Steam::FileSystem::appDirectory (const std::string& appDirectory, const std::string& path) { auto homepath = detectHomepath (); - for (const char** current = assets_default_paths; *current != nullptr; current++) { - auto currentpath = std::filesystem::path (homepath) / *current / appDirectory / path; + for (const auto& current : appDirectoryPaths) { + auto currentpath = std::filesystem::path (homepath) / current / appDirectory / path; if (!std::filesystem::exists (currentpath) || !std::filesystem::is_directory (currentpath)) continue; diff --git a/src/WallpaperEngine/Application/WallpaperApplication.cpp b/src/WallpaperEngine/Application/WallpaperApplication.cpp index e82b529..b616018 100644 --- a/src/WallpaperEngine/Application/WallpaperApplication.cpp +++ b/src/WallpaperEngine/Application/WallpaperApplication.cpp @@ -402,16 +402,13 @@ void WallpaperApplication::show () { static struct tm* timeinfo; if (this->m_context.settings.general.dumpStructure) { - // TODO: REWRITE TO USE THE NEW DUMPER - /* - auto prettyPrinter = PrettyPrinter::CPrettyPrinter (); + auto prettyPrinter = Data::Dumpers::StringPrinter (); for (const auto& [background, info] : this->m_renderContext->getWallpapers ()) { - prettyPrinter.printWallpaper (*info); + prettyPrinter.printWallpaper (info->getWallpaperData ()); } std::cout << prettyPrinter.str () << std::endl; - */ } #if DEMOMODE diff --git a/src/WallpaperEngine/Data/Model/Material.h b/src/WallpaperEngine/Data/Model/Material.h index 6f77ca9..1e294b6 100644 --- a/src/WallpaperEngine/Data/Model/Material.h +++ b/src/WallpaperEngine/Data/Model/Material.h @@ -35,7 +35,6 @@ enum DepthwriteMode { }; struct MaterialPass { - // TODO: WRITE ENUMS FOR THESE /** Blending mode */ BlendingMode blending; /** Culling mode */ diff --git a/src/WallpaperEngine/Data/Model/Object.h b/src/WallpaperEngine/Data/Model/Object.h index 118dd24..1438426 100644 --- a/src/WallpaperEngine/Data/Model/Object.h +++ b/src/WallpaperEngine/Data/Model/Object.h @@ -22,8 +22,6 @@ struct ObjectData { std::vector dependencies; }; -//TODO: CHECK IF THE SEMANTICS FOR MEMORY ARE RIGHT HERE - /** * Base class for all objects, represents a single object in the scene * diff --git a/src/WallpaperEngine/Data/Model/Property.h b/src/WallpaperEngine/Data/Model/Property.h index 8516a34..4002c8b 100644 --- a/src/WallpaperEngine/Data/Model/Property.h +++ b/src/WallpaperEngine/Data/Model/Property.h @@ -33,9 +33,9 @@ class Property : public DynamicValue, public TypeCaster, public PropertyData { virtual void update(const std::string& value) = 0; }; -class PropertySlider : public Property, SliderData { +class PropertySlider final : public Property, SliderData { public: - PropertySlider (PropertyData data, SliderData sliderData, float value) : Property (std::move(data)), SliderData (sliderData) { + PropertySlider (PropertyData data, SliderData sliderData, const float value) : Property (std::move(data)), SliderData (std::move (sliderData)) { this->update (value); } @@ -45,9 +45,9 @@ class PropertySlider : public Property, SliderData { } }; -class PropertyBoolean : public Property { +class PropertyBoolean final : public Property { public: - explicit PropertyBoolean (PropertyData data, bool value) : Property (std::move(data)) { + explicit PropertyBoolean (PropertyData data, const bool value) : Property (std::move(data)) { this->update (value); } @@ -57,9 +57,9 @@ class PropertyBoolean : public Property { } }; -class PropertyColor : public Property { +class PropertyColor final : public Property { public: - explicit PropertyColor (PropertyData data, std::string value) : Property (std::move(data)) { + explicit PropertyColor (PropertyData data, const std::string& value) : Property (std::move(data)) { this->PropertyColor::update (value); } @@ -70,7 +70,7 @@ class PropertyColor : public Property { // TODO: ENSURE ALL THIS PARSING IS CORRECT if (copy.find (',') != std::string::npos) { // replace comma separator with spaces so it's - std::replace (copy.begin (), copy.end (), ',', ' '); + std::ranges::replace (copy, ',', ' '); } // hex colors should be converted to int colors @@ -110,9 +110,9 @@ class PropertyColor : public Property { } }; -class PropertyCombo : public Property, ComboData { +class PropertyCombo final : public Property, ComboData { public: - PropertyCombo (PropertyData data, ComboData comboData, std::string value) : Property (std::move(data)), ComboData (std::move(comboData)) { + PropertyCombo (PropertyData data, ComboData comboData, const std::string& value) : Property (std::move(data)), ComboData (std::move(comboData)) { this->PropertyCombo::update (value); } @@ -122,7 +122,7 @@ class PropertyCombo : public Property, ComboData { } }; -class PropertyText : public Property { +class PropertyText final : public Property { public: explicit PropertyText (PropertyData data) : Property (std::move(data)) {} @@ -136,9 +136,9 @@ class PropertyText : public Property { } }; -class PropertySceneTexture : public Property { +class PropertySceneTexture final : public Property { public: - explicit PropertySceneTexture (PropertyData data, std::string value) : Property (std::move(data)) { + explicit PropertySceneTexture (PropertyData data, const std::string& value) : Property (std::move(data)) { this->PropertySceneTexture::update (value); } diff --git a/src/WallpaperEngine/Data/Model/Types.h b/src/WallpaperEngine/Data/Model/Types.h index 0e716f5..8edc54a 100644 --- a/src/WallpaperEngine/Data/Model/Types.h +++ b/src/WallpaperEngine/Data/Model/Types.h @@ -5,10 +5,6 @@ #include #include -namespace WallpaperEngine::FileSystem { -class Container; -} - namespace WallpaperEngine::Data::Model { struct Project; class Wallpaper; @@ -40,13 +36,11 @@ using PropertySharedPtr = std::shared_ptr ; using Properties = std::map ; using DynamicValueUniquePtr = std::unique_ptr ; using UserSettingUniquePtr = std::unique_ptr ; -// TODO: UP TO THIS POINT using ShaderConstantMap = std::map ; using ProjectUniquePtr = std::unique_ptr ; using WallpaperUniquePtr = std::unique_ptr ; -using ContainerUniquePtr = std::unique_ptr ; using SceneUniquePtr = std::unique_ptr ; using WebUniquePtr = std::unique_ptr ; using VideoUniquePtr = std::unique_ptr