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_quick/src/CMakeLists.txt | 13 ++ libs/installer_quick/src/installer_quick_en.ts | 51 +++++++ libs/installer_quick/src/installerquick.cpp | 176 +++++++++++++++++++++++ libs/installer_quick/src/installerquick.h | 77 ++++++++++ libs/installer_quick/src/simpleinstalldialog.cpp | 69 +++++++++ libs/installer_quick/src/simpleinstalldialog.h | 72 ++++++++++ libs/installer_quick/src/simpleinstalldialog.ui | 86 +++++++++++ 7 files changed, 544 insertions(+) create mode 100644 libs/installer_quick/src/CMakeLists.txt create mode 100644 libs/installer_quick/src/installer_quick_en.ts create mode 100644 libs/installer_quick/src/installerquick.cpp create mode 100644 libs/installer_quick/src/installerquick.h create mode 100644 libs/installer_quick/src/simpleinstalldialog.cpp create mode 100644 libs/installer_quick/src/simpleinstalldialog.h create mode 100644 libs/installer_quick/src/simpleinstalldialog.ui (limited to 'libs/installer_quick/src') diff --git a/libs/installer_quick/src/CMakeLists.txt b/libs/installer_quick/src/CMakeLists.txt new file mode 100644 index 0000000..050ddf0 --- /dev/null +++ b/libs/installer_quick/src/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.16) + +file(GLOB installer_quick_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(installer_quick SHARED ${installer_quick_SOURCES}) +mo2_configure_plugin(installer_quick NO_SOURCES WARNINGS 4) +target_link_libraries(installer_quick PRIVATE mo2::uibase) +mo2_install_plugin(installer_quick) diff --git a/libs/installer_quick/src/installer_quick_en.ts b/libs/installer_quick/src/installer_quick_en.ts new file mode 100644 index 0000000..f5aa081 --- /dev/null +++ b/libs/installer_quick/src/installer_quick_en.ts @@ -0,0 +1,51 @@ + + + + + InstallerQuick + + + Simple Installer + + + + + Installer for very simple archives + + + + + SimpleInstallDialog + + + Quick Install + + + + + Name + + + + + + Opens a Dialog that allows custom modifications. + + + + + Manual + + + + + OK + + + + + Cancel + + + + diff --git a/libs/installer_quick/src/installerquick.cpp b/libs/installer_quick/src/installerquick.cpp new file mode 100644 index 0000000..20b4b76 --- /dev/null +++ b/libs/installer_quick/src/installerquick.cpp @@ -0,0 +1,176 @@ +#include "installerquick.h" + +#include +#include + +#include +#include +#include + +#include "simpleinstalldialog.h" + +using namespace MOBase; + +InstallerQuick::InstallerQuick() : m_MOInfo(nullptr) {} + +bool InstallerQuick::init(IOrganizer* moInfo) +{ + m_MOInfo = moInfo; + // Note: Cannot retrieve the checker here because the game might + // not be initialized yet. + return true; +} + +QString InstallerQuick::name() const +{ + return "Simple Installer"; +} + +QString InstallerQuick::localizedName() const +{ + return tr("Simple Installer"); +} + +QString InstallerQuick::author() const +{ + return "Tannin"; +} + +QString InstallerQuick::description() const +{ + return tr("Installer for very simple archives"); +} + +VersionInfo InstallerQuick::version() const +{ + return VersionInfo(1, 3, 0, VersionInfo::RELEASE_FINAL); +} + +QList InstallerQuick::settings() const +{ + return {PluginSetting("silent", + "simple plugins will be installed without any user interaction", + QVariant(false))}; +} + +unsigned int InstallerQuick::priority() const +{ + return 50; +} + +bool InstallerQuick::isManualInstaller() const +{ + return false; +} + +bool InstallerQuick::isDataTextArchiveTopLayer(std::shared_ptr tree, + QString const& dataFolderName, + ModDataChecker*) const +{ + // A "DataText" archive is defined as having exactly one folder named like + // `dataFolderName` and one or more "useless" files (text files, pdf, or images). + static const std::set txtExtensions{ + "txt", "pdf", "md", "jpg", "jpeg", "png", "bmp"}; + bool dataFound = false; + bool txtFound = false; + for (auto entry : *tree) { + if (entry->isDir()) { + // If data was already found, or this is a directory not named "data", fail: + if (dataFound || entry->compare(dataFolderName) != 0) { + return false; + } + dataFound = true; + } else { + if (txtExtensions.count(entry->suffix()) == 0) { + return false; + } + txtFound = true; + } + } + return dataFound && txtFound; +} + +std::shared_ptr +InstallerQuick::getSimpleArchiveBase(std::shared_ptr dataTree, + QString const& dataFolderName, + ModDataChecker* checker) const +{ + if (!checker) { + return nullptr; + } + while (true) { + if (checker->dataLooksValid(dataTree) == ModDataChecker::CheckReturn::VALID || + isDataTextArchiveTopLayer(dataTree, dataFolderName, checker)) { + return dataTree; + } else if (dataTree->size() == 1 && dataTree->at(0)->isDir()) { + dataTree = dataTree->at(0)->astree(); + } else { + log::debug("Archive is not a simple archive."); + return nullptr; + } + } +} + +bool InstallerQuick::isArchiveSupported(std::shared_ptr tree) const +{ + auto checker = m_MOInfo->gameFeatures()->gameFeature(); + if (!checker) { + return false; + } + if (getSimpleArchiveBase(tree, m_MOInfo->managedGame()->dataDirectory().dirName(), + checker.get()) != nullptr) { + return true; + } + return checker->dataLooksValid(tree) == ModDataChecker::CheckReturn::FIXABLE; +} + +IPluginInstaller::EInstallResult +InstallerQuick::install(GuessedValue& modName, + std::shared_ptr& tree, QString&, int&) +{ + const QString dataFolderName = m_MOInfo->managedGame()->dataDirectory().dirName(); + auto checker = m_MOInfo->gameFeatures()->gameFeature(); + + auto base = std::const_pointer_cast( + getSimpleArchiveBase(tree, dataFolderName, checker.get())); + if (base == nullptr && + checker->dataLooksValid(tree) == ModDataChecker::CheckReturn::FIXABLE) { + tree = checker->fix(tree); + } else { + tree = base; + } + if (tree != nullptr) { + SimpleInstallDialog dialog(modName, parentWidget()); + if (m_MOInfo->pluginSetting(name(), "silent").toBool() || + dialog.exec() == QDialog::Accepted) { + modName.update(dialog.getName(), GUESS_USER); + + // If we have a data+txt archive, we move files to the data folder and + // switch to the data folder. We need to check that we actually have a + // checker here, otherwise it is anyway impossible that + // isDataTextArchiveTopLayer() returned true. + if (checker && isDataTextArchiveTopLayer(tree, dataFolderName, checker.get())) { + auto dataTree = tree->findDirectory(dataFolderName); + dataTree->detach(); + dataTree->merge(tree); + tree = dataTree; + } + return RESULT_SUCCESS; + } else { + if (dialog.manualRequested()) { + modName.update(dialog.getName(), GUESS_USER); + return RESULT_MANUALREQUESTED; + } else { + return RESULT_CANCELED; + } + } + } else { + // install shouldn't even have even have been called + qCritical("unsupported archive for quick installer"); + return RESULT_FAILED; + } +} + +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +Q_EXPORT_PLUGIN2(installerQuick, InstallerQuick) +#endif diff --git a/libs/installer_quick/src/installerquick.h b/libs/installer_quick/src/installerquick.h new file mode 100644 index 0000000..5d9c910 --- /dev/null +++ b/libs/installer_quick/src/installerquick.h @@ -0,0 +1,77 @@ +#ifndef INSTALLERQUICK_H +#define INSTALLERQUICK_H + +#include +#include + +class InstallerQuick : public MOBase::IPluginInstallerSimple +{ + Q_OBJECT + Q_INTERFACES(MOBase::IPlugin MOBase::IPluginInstaller MOBase::IPluginInstallerSimple) +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + Q_PLUGIN_METADATA(IID "org.tannin.InstallerQuick") +#endif + +public: + InstallerQuick(); + + // Plugin functions: + 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 settings() const override; + + // Installer functions: + virtual unsigned int priority() const override; + virtual bool isManualInstaller() const override; + virtual bool + isArchiveSupported(std::shared_ptr tree) const override; + + // Simple installer functions: + virtual EInstallResult install(MOBase::GuessedValue& modName, + std::shared_ptr& tree, + QString& version, int& modID) override; + +private: + /** + * @brief Check if the archive is a "DataText" archive. + * + * A "DataText" archive is defined as having exactly one folder named like the data + * folder of the game (`dataFolderName`) and one or more text or PDF files (standard + * package from french modding site). + * + * @param tree The tree to check. + * @param dataFolderName Name of the data folder (e.g., "data" for gamebryo games). + * @param checker The mod data checker, or a null pointer if none is available. + * + * @return true if the tree represents a "DataText" archive, false otherwise. + */ + bool isDataTextArchiveTopLayer(std::shared_ptr tree, + QString const& dataFolderName, + MOBase::ModDataChecker* checker) const; + + /** + * @brief Get the base of the archive. + * + * The base of the archive is either a "DataText" folder (i.e., a folder containing + * TXT or PDF files and a valid data folder), or an actual data folder. + * + * @param tree The tree to check. + * @param dataFolderName Name of the data folder (e.g., "data" for gamebryo games). + * @param checker The mod data checker, or a null pointer if none is available. + * + * @return the "base" of the archive, or a null pointer if none was found. + */ + std::shared_ptr + getSimpleArchiveBase(std::shared_ptr dataTree, + QString const& dataFolderName, + MOBase::ModDataChecker* checker) const; + +private: + const MOBase::IOrganizer* m_MOInfo; +}; + +#endif // INSTALLERQUICK_H diff --git a/libs/installer_quick/src/simpleinstalldialog.cpp b/libs/installer_quick/src/simpleinstalldialog.cpp new file mode 100644 index 0000000..b36b46e --- /dev/null +++ b/libs/installer_quick/src/simpleinstalldialog.cpp @@ -0,0 +1,69 @@ +/* +Copyright (C) 2012 Sebastian Herbord. All rights reserved. + +This file is part of Mod Organizer. + +Mod Organizer 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. + +Mod Organizer 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 Mod Organizer. If not, see . +*/ +#include "simpleinstalldialog.h" +#include "ui_simpleinstalldialog.h" + +#include + +#include +#include + +using namespace MOBase; + +SimpleInstallDialog::SimpleInstallDialog(const GuessedValue& preset, + QWidget* parent) + : QDialog(parent), ui(new Ui::SimpleInstallDialog), m_Manual(false) +{ + ui->setupUi(this); + + for (auto iter = preset.variants().begin(); iter != preset.variants().end(); ++iter) { + ui->nameCombo->addItem(*iter); + } + + ui->nameCombo->setCurrentIndex(ui->nameCombo->findText(preset)); + + setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); + ui->nameCombo->completer()->setCaseSensitivity(Qt::CaseSensitive); +} + +SimpleInstallDialog::~SimpleInstallDialog() +{ + delete ui; +} + +QString SimpleInstallDialog::getName() const +{ + return ui->nameCombo->currentText(); +} + +void SimpleInstallDialog::on_okBtn_clicked() +{ + this->accept(); +} + +void SimpleInstallDialog::on_cancelBtn_clicked() +{ + this->reject(); +} + +void SimpleInstallDialog::on_manualBtn_clicked() +{ + m_Manual = true; + this->reject(); +} diff --git a/libs/installer_quick/src/simpleinstalldialog.h b/libs/installer_quick/src/simpleinstalldialog.h new file mode 100644 index 0000000..e491438 --- /dev/null +++ b/libs/installer_quick/src/simpleinstalldialog.h @@ -0,0 +1,72 @@ +/* +Copyright (C) 2012 Sebastian Herbord. All rights reserved. + +This file is part of Mod Organizer. + +Mod Organizer 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. + +Mod Organizer 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 Mod Organizer. If not, see . +*/ + +#ifndef SIMPLEINSTALLDIALOG_H +#define SIMPLEINSTALLDIALOG_H + +#include +#include + +namespace Ui +{ +class SimpleInstallDialog; +} + +/** + * @brief Dialog for the installation of a simple archive + * a simple archive is one that doesn't require any manual changes to work correctly + **/ +class SimpleInstallDialog : public QDialog +{ + Q_OBJECT + +public: + /** + * @brief constructor + * + * @param preset suggested name for the mod + * @param parent parent widget + **/ + explicit SimpleInstallDialog(const MOBase::GuessedValue& preset, + QWidget* parent = 0); + ~SimpleInstallDialog(); + + /** + * @return true if the user requested the manual installation dialog + **/ + bool manualRequested() const { return m_Manual; } + /** + * @return the (user-modified) mod name + **/ + QString getName() const; + +private slots: + + void on_okBtn_clicked(); + + void on_cancelBtn_clicked(); + + void on_manualBtn_clicked(); + +private: + Ui::SimpleInstallDialog* ui; + bool m_Manual; +}; + +#endif // SIMPLEINSTALLDIALOG_H diff --git a/libs/installer_quick/src/simpleinstalldialog.ui b/libs/installer_quick/src/simpleinstalldialog.ui new file mode 100644 index 0000000..38a31ee --- /dev/null +++ b/libs/installer_quick/src/simpleinstalldialog.ui @@ -0,0 +1,86 @@ + + + SimpleInstallDialog + + + + 0 + 0 + 400 + 83 + + + + Quick Install + + + + + + + + Name + + + + + + + true + + + + + + + + + + + Opens a Dialog that allows custom modifications. + + + Opens a Dialog that allows custom modifications. + + + Manual + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + true + + + + + + + Cancel + + + + + + + + + + -- cgit v1.3.1