aboutsummaryrefslogtreecommitdiff
path: root/libs/tool_inieditor
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-11 02:37:39 -0600
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-02-11 02:37:39 -0600
commit7ee008e150bc5bcf76082d726f719ee0fdfda982 (patch)
tree27fb39be241fdb5ac2734c574de678977d1856d0 /libs/tool_inieditor
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 <noreply@anthropic.com>
Diffstat (limited to 'libs/tool_inieditor')
-rw-r--r--libs/tool_inieditor/.clang-format41
-rw-r--r--libs/tool_inieditor/.gitattributes7
-rw-r--r--libs/tool_inieditor/.gitignore5
-rw-r--r--libs/tool_inieditor/.pre-commit-config.yaml20
-rw-r--r--libs/tool_inieditor/CMakeLists.txt5
-rw-r--r--libs/tool_inieditor/CMakePresets.json60
-rw-r--r--libs/tool_inieditor/src/CMakeLists.txt13
-rw-r--r--libs/tool_inieditor/src/inieditor.cpp152
-rw-r--r--libs/tool_inieditor/src/inieditor.h55
-rw-r--r--libs/tool_inieditor/src/inieditor.qrc5
-rw-r--r--libs/tool_inieditor/src/inieditor_en.ts54
-rw-r--r--libs/tool_inieditor/src/resources/document-properties.pngbin0 -> 688 bytes
-rw-r--r--libs/tool_inieditor/vcpkg.json15
13 files changed, 432 insertions, 0 deletions
diff --git a/libs/tool_inieditor/.clang-format b/libs/tool_inieditor/.clang-format
new file mode 100644
index 0000000..6098e1f
--- /dev/null
+++ b/libs/tool_inieditor/.clang-format
@@ -0,0 +1,41 @@
+---
+# We'll use defaults from the LLVM style, but with 4 columns indentation.
+BasedOnStyle: LLVM
+IndentWidth: 2
+---
+Language: Cpp
+DeriveLineEnding: false
+UseCRLF: true
+DerivePointerAlignment: false
+PointerAlignment: Left
+AlignConsecutiveAssignments: true
+AllowShortFunctionsOnASingleLine: Inline
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: Empty
+AlwaysBreakTemplateDeclarations: Yes
+AccessModifierOffset: -2
+AlignTrailingComments: true
+SpacesBeforeTrailingComments: 2
+NamespaceIndentation: Inner
+MaxEmptyLinesToKeep: 1
+BreakBeforeBraces: Custom
+BraceWrapping:
+ AfterCaseLabel: false
+ AfterClass: true
+ AfterControlStatement: false
+ AfterEnum: true
+ AfterFunction: true
+ AfterNamespace: true
+ AfterStruct: true
+ AfterUnion: true
+ AfterExternBlock: true
+ BeforeCatch: false
+ BeforeElse: false
+ BeforeLambdaBody: false
+ BeforeWhile: false
+ IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: true
+ColumnLimit: 88
+ForEachMacros: ['Q_FOREACH', 'foreach']
diff --git a/libs/tool_inieditor/.gitattributes b/libs/tool_inieditor/.gitattributes
new file mode 100644
index 0000000..f869712
--- /dev/null
+++ b/libs/tool_inieditor/.gitattributes
@@ -0,0 +1,7 @@
+# Set the default behavior, in case people don't have core.autocrlf set.
+* text=auto
+
+# Explicitly declare text files you want to always be normalized and converted
+# to native line endings on checkout.
+*.cpp text eol=crlf
+*.h text eol=crlf
diff --git a/libs/tool_inieditor/.gitignore b/libs/tool_inieditor/.gitignore
new file mode 100644
index 0000000..cf71be7
--- /dev/null
+++ b/libs/tool_inieditor/.gitignore
@@ -0,0 +1,5 @@
+edit
+CMakeLists.txt.user
+/msbuild.log
+/*std*.log
+/*build
diff --git a/libs/tool_inieditor/.pre-commit-config.yaml b/libs/tool_inieditor/.pre-commit-config.yaml
new file mode 100644
index 0000000..eb8969c
--- /dev/null
+++ b/libs/tool_inieditor/.pre-commit-config.yaml
@@ -0,0 +1,20 @@
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v6.0.0
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: check-merge-conflict
+ - id: check-case-conflict
+ - repo: https://github.com/pre-commit/mirrors-clang-format
+ rev: v21.1.8
+ hooks:
+ - id: clang-format
+ 'types_or': [c++, c]
+
+ci:
+ autofix_commit_msg: "[pre-commit.ci] Auto fixes from pre-commit.com hooks."
+ autofix_prs: true
+ autoupdate_commit_msg: "[pre-commit.ci] Pre-commit autoupdate."
+ autoupdate_schedule: quarterly
+ submodules: false
diff --git a/libs/tool_inieditor/CMakeLists.txt b/libs/tool_inieditor/CMakeLists.txt
new file mode 100644
index 0000000..3c843b0
--- /dev/null
+++ b/libs/tool_inieditor/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.16)
+
+project(inieditor)
+
+add_subdirectory(src)
diff --git a/libs/tool_inieditor/CMakePresets.json b/libs/tool_inieditor/CMakePresets.json
new file mode 100644
index 0000000..16e1e6f
--- /dev/null
+++ b/libs/tool_inieditor/CMakePresets.json
@@ -0,0 +1,60 @@
+{
+ "configurePresets": [
+ {
+ "errors": {
+ "deprecated": true
+ },
+ "hidden": true,
+ "name": "cmake-dev",
+ "warnings": {
+ "deprecated": true,
+ "dev": true
+ }
+ },
+ {
+ "cacheVariables": {
+ "VCPKG_MANIFEST_NO_DEFAULT_FEATURES": {
+ "type": "BOOL",
+ "value": "ON"
+ }
+ },
+ "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
+ "hidden": true,
+ "name": "vcpkg"
+ },
+ {
+ "hidden": true,
+ "inherits": ["vcpkg"],
+ "name": "vcpkg-dev"
+ },
+ {
+ "binaryDir": "${sourceDir}/vsbuild",
+ "architecture": {
+ "strategy": "set",
+ "value": "x64"
+ },
+ "cacheVariables": {
+ "CMAKE_CXX_FLAGS": "/EHsc /MP /W4",
+ "VCPKG_TARGET_TRIPLET": {
+ "type": "STRING",
+ "value": "x64-windows-static-md"
+ }
+ },
+ "generator": "Visual Studio 17 2022",
+ "inherits": ["cmake-dev", "vcpkg-dev"],
+ "name": "vs2022-windows",
+ "toolset": "v143"
+ },
+ {
+ "cacheVariables": {
+ "VCPKG_MANIFEST_FEATURES": {
+ "type": "STRING",
+ "value": "standalone"
+ }
+ },
+ "inherits": "vs2022-windows",
+ "name": "vs2022-windows-standalone"
+ }
+ ],
+ "version": 4
+}
diff --git a/libs/tool_inieditor/src/CMakeLists.txt b/libs/tool_inieditor/src/CMakeLists.txt
new file mode 100644
index 0000000..3774ee6
--- /dev/null
+++ b/libs/tool_inieditor/src/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.16)
+
+file(GLOB inieditor_SOURCES CONFIGURE_DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/*.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/*.ui
+ ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc
+)
+
+add_library(inieditor SHARED ${inieditor_SOURCES})
+mo2_configure_plugin(inieditor NO_SOURCES WARNINGS 4)
+target_link_libraries(inieditor PRIVATE mo2::uibase)
+mo2_install_plugin(inieditor)
diff --git a/libs/tool_inieditor/src/inieditor.cpp b/libs/tool_inieditor/src/inieditor.cpp
new file mode 100644
index 0000000..b892137
--- /dev/null
+++ b/libs/tool_inieditor/src/inieditor.cpp
@@ -0,0 +1,152 @@
+/*
+Copyright (C) 2012 Sebastian Herbord. All rights reserved.
+
+This file is part of ini editor plugin for MO
+
+Ini editor plugin is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Ini editor plugin is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Ini editor plugin. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "inieditor.h"
+
+#include <QApplication>
+#include <QDesktopServices>
+#include <QDir>
+#include <QMessageBox>
+#include <QUrl>
+#include <QtPlugin>
+
+#include <uibase/imoinfo.h>
+#include <uibase/iplugingame.h>
+#include <uibase/textviewer.h>
+#include <uibase/utility.h>
+
+using namespace MOBase;
+
+IniEditor::IniEditor() : m_MOInfo(nullptr) {}
+
+bool IniEditor::init(IOrganizer* moInfo)
+{
+ m_MOInfo = moInfo;
+ return true;
+}
+
+QString IniEditor::name() const
+{
+ return "INI Editor";
+}
+
+QString IniEditor::localizedName() const
+{
+ return tr("INI Editor");
+}
+
+QString IniEditor::author() const
+{
+ return "Tannin";
+}
+
+QString IniEditor::description() const
+{
+ return tr("Very basic editor for INI files");
+}
+
+VersionInfo IniEditor::version() const
+{
+ return VersionInfo(1, 1, 0, VersionInfo::RELEASE_FINAL);
+}
+
+QList<PluginSetting> IniEditor::settings() const
+{
+ QList<PluginSetting> result;
+ result.push_back(PluginSetting("external", "Use an external editor to open the files",
+ QVariant(false)));
+ result.push_back(PluginSetting(
+ "associated",
+ "When using an external editor, use the application associated with \"INI\" "
+ "files. "
+ "If false, uses the \"edit\" command which usually invokes regular notepad.",
+ QVariant(true)));
+ return result;
+}
+
+QString IniEditor::displayName() const
+{
+ return tr("INI Editor");
+}
+
+QString IniEditor::tooltip() const
+{
+ return tr("Edit the INI files of the current profile");
+}
+
+QIcon IniEditor::icon() const
+{
+ return QIcon(":/inieditor/icon_document");
+}
+
+void IniEditor::display() const
+{
+ if (m_MOInfo == nullptr) {
+ throw MyException(tr("plugin not initialized"));
+ }
+
+ QStringList iniFiles = m_MOInfo->managedGame()->iniFiles();
+ if (m_MOInfo->pluginSetting(name(), "external").toBool()) {
+ for (QString const& file : iniFiles) {
+ QString fileName = m_MOInfo->profile()->absoluteIniFilePath(file);
+#ifdef _WIN32
+ ::ShellExecuteW(nullptr,
+ m_MOInfo->pluginSetting(name(), "associated").toBool() ? L"open"
+ : L"edit",
+ ToWString(fileName).c_str(), nullptr, nullptr, SW_SHOWNORMAL);
+#else
+ QDesktopServices::openUrl(QUrl::fromLocalFile(fileName));
+#endif
+ }
+ } else {
+ TextViewer* viewer = new TextViewer("INI Files", parentWidget());
+ if (m_MOInfo->profile()->localSettingsEnabled()) {
+ viewer->setDescription(tr(
+ " Editing profile-specific INIs. Profile-specific game INI files are "
+ "Enabled.\n \n You can change the INI Editor settings (in the main Mod "
+ "Organizer settings under the plugins tab) to use an external text editor,\n "
+ "either notepad or your windows associated program to .INI files."));
+ } else {
+ viewer->setDescription(tr(
+ " Editing global INIs (in 'myGames' folder). Profile-specific game INI files "
+ "are Disabled.\n \n You can change the INI Editor settings (in the main Mod "
+ "Organizer settings under the plugins tab) to use an external text editor,\n "
+ "either notepad or your windows associated program to .INI files."));
+ }
+ for (QString const& file : iniFiles) {
+ QString fileName = m_MOInfo->profile()->absoluteIniFilePath(file);
+ QFileInfo fileInfo(fileName);
+ if (fileInfo.exists()) {
+ if (fileInfo.size() < 1024 * 1024) {
+ viewer->addFile(fileName, true);
+ } else {
+ QMessageBox::warning(parentWidget(), tr("File too big"),
+ tr("Sorry, the file %1 is too large"
+ " to be handled by the INI Editor")
+ .arg(fileName));
+ }
+ }
+ }
+ viewer->show();
+ }
+}
+
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+Q_EXPORT_PLUGIN2(iniEditor, IniEditor)
+#endif
diff --git a/libs/tool_inieditor/src/inieditor.h b/libs/tool_inieditor/src/inieditor.h
new file mode 100644
index 0000000..fa60ef2
--- /dev/null
+++ b/libs/tool_inieditor/src/inieditor.h
@@ -0,0 +1,55 @@
+/*
+Copyright (C) 2012 Sebastian Herbord. All rights reserved.
+
+This file is part of ini editor plugin for MO
+
+Ini editor plugin is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Ini editor plugin is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Ini editor plugin. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef INIEDITOR_H
+#define INIEDITOR_H
+
+#include <uibase/iplugintool.h>
+
+class IniEditor : public MOBase::IPluginTool
+{
+ Q_OBJECT
+ Q_INTERFACES(MOBase::IPlugin MOBase::IPluginTool)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ Q_PLUGIN_METADATA(IID "org.tannin.IniEditor")
+#endif
+
+public:
+ IniEditor();
+
+ virtual bool init(MOBase::IOrganizer* moInfo) override;
+ virtual QString name() const override;
+ virtual QString localizedName() const override;
+ virtual QString author() const override;
+ virtual QString description() const override;
+ virtual MOBase::VersionInfo version() const override;
+ virtual QList<MOBase::PluginSetting> settings() const override;
+
+ virtual QString displayName() const;
+ virtual QString tooltip() const;
+ virtual QIcon icon() const;
+
+public slots:
+ virtual void display() const;
+
+private:
+ const MOBase::IOrganizer* m_MOInfo;
+};
+
+#endif // INIEDITOR_H
diff --git a/libs/tool_inieditor/src/inieditor.qrc b/libs/tool_inieditor/src/inieditor.qrc
new file mode 100644
index 0000000..e50f7eb
--- /dev/null
+++ b/libs/tool_inieditor/src/inieditor.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/inieditor">
+ <file alias="icon_document">resources/document-properties.png</file>
+ </qresource>
+</RCC>
diff --git a/libs/tool_inieditor/src/inieditor_en.ts b/libs/tool_inieditor/src/inieditor_en.ts
new file mode 100644
index 0000000..db11a1f
--- /dev/null
+++ b/libs/tool_inieditor/src/inieditor_en.ts
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="en_US">
+<context>
+ <name>IniEditor</name>
+ <message>
+ <location filename="inieditor.cpp" line="65"/>
+ <source>Very basic editor for INI files</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="inieditor.cpp" line="55"/>
+ <location filename="inieditor.cpp" line="84"/>
+ <source>INI Editor</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="inieditor.cpp" line="89"/>
+ <source>Edit the INI files of the current profile</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="inieditor.cpp" line="100"/>
+ <source>plugin not initialized</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="inieditor.cpp" line="115"/>
+ <source> Editing profile-specific INIs. Profile-specific game INI files are Enabled.
+
+ You can change the INI Editor settings (in the main Mod Organizer settings under the plugins tab) to use an external text editor,
+ either notepad or your windows associated program to .INI files.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="inieditor.cpp" line="128"/>
+ <source>File too big</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="inieditor.cpp" line="129"/>
+ <source>Sorry, the file %1 is too large to be handled by the INI Editor</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="inieditor.cpp" line="118"/>
+ <source> Editing global INIs (in &apos;myGames&apos; folder). Profile-specific game INI files are Disabled.
+
+ You can change the INI Editor settings (in the main Mod Organizer settings under the plugins tab) to use an external text editor,
+ either notepad or your windows associated program to .INI files.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/libs/tool_inieditor/src/resources/document-properties.png b/libs/tool_inieditor/src/resources/document-properties.png
new file mode 100644
index 0000000..a5ad728
--- /dev/null
+++ b/libs/tool_inieditor/src/resources/document-properties.png
Binary files differ
diff --git a/libs/tool_inieditor/vcpkg.json b/libs/tool_inieditor/vcpkg.json
new file mode 100644
index 0000000..486b0fd
--- /dev/null
+++ b/libs/tool_inieditor/vcpkg.json
@@ -0,0 +1,15 @@
+{
+ "features": {
+ "standalone": {
+ "description": "Build Standalone.",
+ "dependencies": ["mo2-cmake", "mo2-uibase"]
+ }
+ },
+ "vcpkg-configuration": {
+ "default-registry": {
+ "kind": "git",
+ "repository": "https://github.com/ModOrganizer2/vcpkg-registry",
+ "baseline": "d194ec4e14052784518d5e9f1c5ccac16de49c2c"
+ }
+ }
+}