From 7ee008e150bc5bcf76082d726f719ee0fdfda982 Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Wed, 11 Feb 2026 02:37:39 -0600 Subject: Fluorine Manager: full Linux port of Mod Organizer 2 Complete native Linux port with FUSE-based virtual filesystem, Proton/umu-run integration, and Flatpak packaging. Key features: - FUSE VFS replacing Windows USVFS (in-process + standalone helper for Flatpak) - Proton/GE-Proton/umu-run launcher with env var forwarding - Flatpak support (sandbox-aware VFS, NXM handler, umu-run) - Wine prefix management UI - Case-insensitive path resolution for Linux filesystems - QSettings-safe INI handling (avoids Bethesda INI corruption) - Portable instance support with auto-generated launcher scripts Co-Authored-By: Claude Opus 4.6 --- libs/installer_fomod_csharp/src/psettings.h | 108 ++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 libs/installer_fomod_csharp/src/psettings.h (limited to 'libs/installer_fomod_csharp/src/psettings.h') diff --git a/libs/installer_fomod_csharp/src/psettings.h b/libs/installer_fomod_csharp/src/psettings.h new file mode 100644 index 0000000..649c7da --- /dev/null +++ b/libs/installer_fomod_csharp/src/psettings.h @@ -0,0 +1,108 @@ +#ifndef PSETTINGS_H +#define PSETTINGS_H + +#include +#include +#include + +/** + * This is a small class that can be used to store INI settings in memory since + * QSettings is a pain to use without an actual file. + * + * It is a much simpler structure since it stores everything as string. + */ +struct PSettings +{ + + /** + * + */ + PSettings() = default; + +public: // Value read/write. + /** + * @brief Set the value of the given section/key. + * + * @param section The section of the value. + * @param key The key of the value. + * @param value The value to set. + */ + void setValue(QString section, QString key, QString value) + { + m_Values[std::make_pair(section, key)] = value; + } + + /** + * @brief Return the value at the given section/key. + * + * @param section The section of the value. + * @param key The key of the value. + * + * @return the corresponding value, or an empty string if the section/key does not + * exist. + */ + QString value(QString section, QString key) const + { + auto it = m_Values.find(std::make_pair(section, key)); + return it == m_Values.end() ? QString() : it->second; + } + + /** + * @brief Check if the given section/key exists in these settings. + * + * @param section The section of the value. + * @param key The key of the value. + * + * @return true if the section/key exist. + */ + bool hasValue(QString section, QString key) const + { + return m_Values.find(std::make_pair(section, key)) != m_Values.end(); + } + +public: // Output: + /** + * @brief Convert this PSettings to a string. + * + * @return a string representing the content of a valid INI file corresponding + * to this PSettings. + */ + QString toString() const + { + QString result = ""; + QString cSection; + for (auto& p : m_Values) { + if (cSection != p.first.first) { + if (!cSection.isEmpty()) { + result += '\n'; + } + cSection = p.first.first; + result += "[" + cSection + "]\n"; + } + result += p.first.second + "=" + p.second + "\n"; + } + return result; + } + + /** + * @brief Update the given QSettings with all the value in this. + * + * @param settings The settings to update. + */ + void update(QSettings& settings) const + { + for (auto& p : m_Values) { + if (p.first.first == "General") { + settings.setValue(p.first.second, p.second); + } else { + settings.setValue(p.first.first + "/" + p.first.second, p.second); + } + } + } + +private: + // Map from to value: + std::map, QString> m_Values; +}; + +#endif // !PSETTINGS_H -- cgit v1.3.1