aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_quick/src
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/installer_quick/src
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/installer_quick/src')
-rw-r--r--libs/installer_quick/src/CMakeLists.txt13
-rw-r--r--libs/installer_quick/src/installer_quick_en.ts51
-rw-r--r--libs/installer_quick/src/installerquick.cpp176
-rw-r--r--libs/installer_quick/src/installerquick.h77
-rw-r--r--libs/installer_quick/src/simpleinstalldialog.cpp69
-rw-r--r--libs/installer_quick/src/simpleinstalldialog.h72
-rw-r--r--libs/installer_quick/src/simpleinstalldialog.ui86
7 files changed, 544 insertions, 0 deletions
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="en_US">
+<context>
+ <name>InstallerQuick</name>
+ <message>
+ <location filename="installerquick.cpp" line="31"/>
+ <source>Simple Installer</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="installerquick.cpp" line="41"/>
+ <source>Installer for very simple archives</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>SimpleInstallDialog</name>
+ <message>
+ <location filename="simpleinstalldialog.ui" line="14"/>
+ <source>Quick Install</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="simpleinstalldialog.ui" line="22"/>
+ <source>Name</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="simpleinstalldialog.ui" line="40"/>
+ <location filename="simpleinstalldialog.ui" line="43"/>
+ <source>Opens a Dialog that allows custom modifications.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="simpleinstalldialog.ui" line="46"/>
+ <source>Manual</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="simpleinstalldialog.ui" line="66"/>
+ <source>OK</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="simpleinstalldialog.ui" line="76"/>
+ <source>Cancel</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
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 <QDialog>
+#include <QtPlugin>
+
+#include <uibase/game_features/igamefeatures.h>
+#include <uibase/iplugingame.h>
+#include <uibase/log.h>
+
+#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<PluginSetting> 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<const IFileTree> 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<QString, FileNameComparator> 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<const IFileTree>
+InstallerQuick::getSimpleArchiveBase(std::shared_ptr<const IFileTree> 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<const IFileTree> tree) const
+{
+ auto checker = m_MOInfo->gameFeatures()->gameFeature<ModDataChecker>();
+ 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<QString>& modName,
+ std::shared_ptr<IFileTree>& tree, QString&, int&)
+{
+ const QString dataFolderName = m_MOInfo->managedGame()->dataDirectory().dirName();
+ auto checker = m_MOInfo->gameFeatures()->gameFeature<ModDataChecker>();
+
+ auto base = std::const_pointer_cast<IFileTree>(
+ 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 <uibase/game_features/moddatachecker.h>
+#include <uibase/iplugininstallersimple.h>
+
+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<MOBase::PluginSetting> settings() const override;
+
+ // Installer functions:
+ virtual unsigned int priority() const override;
+ virtual bool isManualInstaller() const override;
+ virtual bool
+ isArchiveSupported(std::shared_ptr<const MOBase::IFileTree> tree) const override;
+
+ // Simple installer functions:
+ virtual EInstallResult install(MOBase::GuessedValue<QString>& modName,
+ std::shared_ptr<MOBase::IFileTree>& 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<const MOBase::IFileTree> 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<const MOBase::IFileTree>
+ getSimpleArchiveBase(std::shared_ptr<const MOBase::IFileTree> 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 <http://www.gnu.org/licenses/>.
+*/
+#include "simpleinstalldialog.h"
+#include "ui_simpleinstalldialog.h"
+
+#include <QLineEdit>
+
+#include <QComboBox>
+#include <QCompleter>
+
+using namespace MOBase;
+
+SimpleInstallDialog::SimpleInstallDialog(const GuessedValue<QString>& 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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SIMPLEINSTALLDIALOG_H
+#define SIMPLEINSTALLDIALOG_H
+
+#include <QDialog>
+#include <uibase/guessedvalue.h>
+
+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<QString>& 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SimpleInstallDialog</class>
+ <widget class="QDialog" name="SimpleInstallDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>83</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Quick Install</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="nameCombo">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QPushButton" name="manualBtn">
+ <property name="toolTip">
+ <string>Opens a Dialog that allows custom modifications.</string>
+ </property>
+ <property name="whatsThis">
+ <string>Opens a Dialog that allows custom modifications.</string>
+ </property>
+ <property name="text">
+ <string>Manual</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="okBtn">
+ <property name="text">
+ <string>OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelBtn">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>