diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3088aa3..8cb0ca2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Installer FOMOD Plugin +name: Build Installer FOMOD on: push: @@ -6,11 +6,42 @@ on: pull_request: types: [opened, synchronize, reopened] +env: + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" + jobs: build: runs-on: windows-2022 steps: - - name: Build Installer FOMOD Plugin - uses: ModOrganizer2/build-with-mob-action@master + # https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Install Qt + uses: jurplel/install-qt-action@v3 with: - mo2-dependencies: cmake_common uibase + setup-python: false + version: 6.7.0 + modules: + cache: true + + - uses: actions/checkout@v4 + + - name: "Set environmental variables" + shell: bash + run: | + echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV + + - name: Configure Installer FOMOD + shell: pwsh + run: | + cmake --preset vs2022-windows-standalone ` + "-DCMAKE_PREFIX_PATH=${env:QT_ROOT_DIR}\msvc2019_64" ` + "-DCMAKE_INSTALL_PREFIX=install" + + - name: Build Installer FOMOD + run: cmake --build vsbuild --config RelWithDebInfo --target INSTALL diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e68b55..8bc0c95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,8 @@ cmake_minimum_required(VERSION 3.16) project(installer_fomod) -if(DEFINED DEPENDENCIES_DIR) - include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake) -else() - include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake) -endif() +find_package(mo2-cmake CONFIG REQUIRED) + +mo2_configure_extension() add_subdirectory(src) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..16e1e6f --- /dev/null +++ b/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/metadata.json b/metadata.json new file mode 100644 index 0000000..db97bc1 --- /dev/null +++ b/metadata.json @@ -0,0 +1,34 @@ +{ + "id": "mo2-installer-fomod", + "name": "FOMOD Installer", + "version": "1.8.0", + "description": "Installer for XML based FOMOD archives.", + "author": { + "name": "Mod Organizer 2", + "homepage": "https://www.modorganizer.org/" + }, + "contributors": [ + "AL", + "AnyOldName3", + "Drew Warwick", + "Hugues92", + "Holt59", + "isanae", + "Krzysztof Starecki", + "LePresidente", + "LostDragonist", + "Silarn", + "Tannin", + "TheBloke", + "Thomas Tanner" + ], + "type": "plugin", + "content": { + "plugins": { + "autodetect": true + }, + "translations": { + "autodetect": "translations" + } + } +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fc35d8a..75a4640 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.16) +find_package(mo2-cmake CONFIG REQUIRED) +find_package(mo2-uibase CONFIG REQUIRED) + add_library(installer_fomod SHARED) mo2_configure_plugin(installer_fomod WARNINGS OFF) -mo2_install_target(installer_fomod) +target_link_libraries(installer_fomod PRIVATE mo2::uibase) +mo2_install_plugin(installer_fomod) diff --git a/src/SConscript b/src/SConscript deleted file mode 100644 index c2fa88c..0000000 --- a/src/SConscript +++ /dev/null @@ -1,28 +0,0 @@ -Import('qt_env') - -env = qt_env.Clone() - -env.Uic(env.Glob('*.ui')) - -env.AppendUnique(CPPDEFINES = [ - 'INSTALLERFOMOD_LIBRARY', - # boost uses things MS C++ is mldly unhappy about. - '_SCL_SECURE_NO_WARNINGS' -]) - -# can't use appendunique... -env['CPPPATH'] += [ '.', '../gamefeatures' ] - -env.AppendUnique(CPPPATH = [ - '${BOOSTPATH}' -]) - -env.AppendUnique(LIBS = [ - 'shell32' -]) - -lib = env.SharedLibrary('installerFomod', env.Glob('*.cpp')) -env.InstallModule(lib) - -res = env['QT_USED_MODULES'] -Return('res') diff --git a/src/fomodinstallerdialog.cpp b/src/fomodinstallerdialog.cpp index fbecdac..30e77f8 100644 --- a/src/fomodinstallerdialog.cpp +++ b/src/fomodinstallerdialog.cpp @@ -20,16 +20,10 @@ along with Mod Organizer. If not, see . #include "fomodinstallerdialog.h" #include "ui_fomodinstallerdialog.h" -#include "fomodscreenshotdialog.h" -#include "igamefeatures.h" -#include "imoinfo.h" -#include "iplugingame.h" -#include "log.h" -#include "report.h" -#include "scopeguard.h" -#include "scriptextender.h" -#include "utility.h" -#include "xmlreader.h" +#include +#include +#include +#include #include #include @@ -43,10 +37,17 @@ along with Mod Organizer. If not, see . #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fomodscreenshotdialog.h" +#include "xmlreader.h" using namespace MOBase; diff --git a/src/fomodinstallerdialog.h b/src/fomodinstallerdialog.h index 6d6c2d3..bd9f975 100644 --- a/src/fomodinstallerdialog.h +++ b/src/fomodinstallerdialog.h @@ -19,12 +19,6 @@ along with Mod Organizer. If not, see . #pragma once -#include "guessedvalue.h" -#include "ifiletree.h" -#include "imoinfo.h" -#include "iplugininstaller.h" -#include "ipluginlist.h" - #include #include #include @@ -34,6 +28,12 @@ along with Mod Organizer. If not, see . #include #include +#include +#include +#include +#include +#include + #include "installerfomod.h" class QAbstractButton; diff --git a/src/fomodscreenshotdialog.cpp b/src/fomodscreenshotdialog.cpp index a7d1029..568faa4 100644 --- a/src/fomodscreenshotdialog.cpp +++ b/src/fomodscreenshotdialog.cpp @@ -16,12 +16,9 @@ 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 "fomodscreenshotdialog.h" #include "ui_fomodscreenshotdialog.h" -#include "scalelabel.h" - #include #include #include @@ -30,6 +27,8 @@ along with Mod Organizer. If not, see . #include #include +#include "scalelabel.h" + constexpr int kScreenshotTileWidth = 100; constexpr int kScreenshotTileHeight = 80; constexpr int kScreenshotTileSpacing = 16; diff --git a/src/installerFomod.pro b/src/installerFomod.pro deleted file mode 100644 index e143230..0000000 --- a/src/installerFomod.pro +++ /dev/null @@ -1,50 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2013-01-01T19:24:15 -# -#------------------------------------------------- - -TARGET = installerFomod -TEMPLATE = lib - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -CONFIG += plugins -CONFIG += dll - -CONFIG(release, debug|release) { - QMAKE_CXXFLAGS += /Zi /wd4503 - QMAKE_LFLAGS += /DEBUG -} - -DEFINES += INSTALLERFOMOD_LIBRARY - -SOURCES += installerfomod.cpp \ - fomodinstallerdialog.cpp \ - fomodscreenshotdialog.cpp \ - scalelabel.cpp \ - xmlreader.cpp - -HEADERS += installerfomod.h \ - fomodinstallerdialog.h \ - fomodscreenshotdialog.h \ - scalelabel.h \ - xmlreader.h - -FORMS += \ - fomodinstallerdialog.ui \ - fomodscreenshotdialog.ui - -RESOURCES += \ - resources.qrc - -OTHER_FILES += \ - installerfomod.json\ - SConscript\ - CMakeLists.txt - -include(../plugin_template.pri) - -INCLUDEPATH += "$${BOOSTPATH}" -INCLUDEPATH += ../gamefeatures - diff --git a/src/installer_fomod_en.ts b/src/installer_fomod_en.ts index 5551e1c..44ac985 100644 --- a/src/installer_fomod_en.ts +++ b/src/installer_fomod_en.ts @@ -45,194 +45,194 @@ - - + + Next - + Cancel - + Failed to parse %1. See console for details. - + %1 missing. - + At least one condition was successful in an 'OR' clause! - + All conditions were successful in an 'AND' clause! - + No conditions were successful in an 'OR' clause! - + invalid plugin state %1 - + Missing - + Inactive - + Active - + Success: The file '%1' was marked %2. - + Missing requirement: The file '%1' should be %2, but was %3! - + Success: The required version of %1 is %2, and was detected as %3. - + Missing requirement: The required version of %1 is %2, but was detected as %3. - + Missing files or folders - + Install anyway - + The following files or folders were not found in the archive. This is likely due to an incorrect FOMOD installer. This mod may not work properly. - + Folder '%1'. - + File '%1'. - + <a href="%1">Link</a> - + unsupported order type %1 - + unsupported group type %1 - + All components in this group are required - + None - + Select one or more of these options: - + The flag '%1' matched '%2' - + The flag '%1' did not match '%2' - + The condition was not matched and is empty. - + The value exists but was not matched. - + Disabled - + This button is disabled because the following group(s) need a selection: - + Install - + This component is required - + It is recommended you enable this component - + Optional component - + This component is not usable in combination with other installed plugins - + You may be experiencing instability in combination with other installed plugins @@ -240,33 +240,28 @@ InstallerFomod - - Installer for xml based fomod archives. - - - - + Fomod Installer - + Installation as fomod failed: %1 - + image formats not supported. - - + + invalid problem key %1 - + This indicates that files from dlls/imageformats are missing from your MO installation or outdated. Images in installers may not be displayed. Please re-install MO diff --git a/src/installerfomod.cpp b/src/installerfomod.cpp index 8d50c82..d6ed2d7 100644 --- a/src/installerfomod.cpp +++ b/src/installerfomod.cpp @@ -1,18 +1,18 @@ #include "installerfomod.h" -#include "fomodinstallerdialog.h" -#include "imodinterface.h" -#include "imodlist.h" - -#include -#include -#include -#include - #include #include #include +#include +#include +#include +#include +#include +#include + +#include "fomodinstallerdialog.h" + using namespace MOBase; InstallerFomod::InstallerFomod() : m_MOInfo(nullptr) {} @@ -28,21 +28,6 @@ QString InstallerFomod::name() const return "Fomod Installer"; } -QString InstallerFomod::author() const -{ - return "Tannin & thosrtanner"; -} - -QString InstallerFomod::description() const -{ - return tr("Installer for xml based fomod archives."); -} - -VersionInfo InstallerFomod::version() const -{ - return VersionInfo(1, 7, 0, VersionInfo::RELEASE_FINAL); -} - QString InstallerFomod::localizedName() const { return tr("Fomod Installer"); @@ -58,18 +43,13 @@ bool InstallerFomod::checkDisabledMods() const return m_MOInfo->pluginSetting(name(), "see_disabled_mods").toBool(); } -QList InstallerFomod::settings() const +QList InstallerFomod::settings() const { - QList result; - result.push_back( - PluginSetting("prefer", "prefer this over the NCC based plugin", QVariant(true))); - result.push_back(PluginSetting("use_any_file", - "allow dependencies on any file, not just esp/esm", - QVariant(false))); - result.push_back(PluginSetting("see_disabled_mods", - "treat disabled mods as inactive rather than missing", - QVariant(false))); - return result; + return {Setting("use_any_file", "Any file as dependency", + "Allow dependencies on any file, not just esp/esm.", QVariant(false)), + Setting("see_disabled_mods", "See disabled mods", + "Treat disabled mods as inactive rather than missing.", + QVariant(false))}; } unsigned int InstallerFomod::priority() const @@ -82,8 +62,7 @@ bool InstallerFomod::isManualInstaller() const return false; } -void InstallerFomod::onInstallationStart(QString const& archive, bool reinstallation, - IModInterface* currentMod) +void InstallerFomod::onInstallationStart(QString const&, bool, IModInterface*) { m_InstallerUsed = false; } @@ -216,9 +195,10 @@ InstallerFomod::install(GuessedValue& modName, std::shared_ptr fomodTree = findFomodDirectory(tree); QString fomodPath = fomodTree->parent()->path(); - FomodInstallerDialog dialog( - this, modName, fomodPath, - std::bind(&InstallerFomod::fileState, this, std::placeholders::_1)); + FomodInstallerDialog dialog(this, modName, fomodPath, + [this](QString const& file) { + return fileState(file); + }); dialog.initData(m_MOInfo); if (!dialog.getVersion().isEmpty()) { version = dialog.getVersion(); diff --git a/src/installerfomod.h b/src/installerfomod.h index 303c269..c4d415a 100644 --- a/src/installerfomod.h +++ b/src/installerfomod.h @@ -1,9 +1,9 @@ #ifndef INSTALLERFOMOD_H #define INSTALLERFOMOD_H -#include -#include -#include +#include +#include +#include class InstallerFomod : public MOBase::IPluginInstallerSimple, public MOBase::IPluginDiagnose @@ -13,7 +13,7 @@ class InstallerFomod : public MOBase::IPluginInstallerSimple, Q_INTERFACES(MOBase::IPlugin MOBase::IPluginInstaller MOBase::IPluginInstallerSimple MOBase::IPluginDiagnose) #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - Q_PLUGIN_METADATA(IID "org.tannin.InstallerFomod" FILE "installerfomod.json") + Q_PLUGIN_METADATA(IID "org.tannin.InstallerFomod") #endif public: @@ -22,10 +22,7 @@ class InstallerFomod : public MOBase::IPluginInstallerSimple, 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; + virtual QList settings() const override; virtual unsigned int priority() const override; virtual bool isManualInstaller() const override; diff --git a/src/installerfomod.json b/src/installerfomod.json deleted file mode 100644 index 69a88e3..0000000 --- a/src/installerfomod.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/src/scalelabel.cpp b/src/scalelabel.cpp index ec9c745..e654bf5 100644 --- a/src/scalelabel.cpp +++ b/src/scalelabel.cpp @@ -1,4 +1,5 @@ #include "scalelabel.h" + #include static bool isResourceMovie(const QString& path) diff --git a/src/xmlreader.cpp b/src/xmlreader.cpp index 038b545..7f53710 100644 --- a/src/xmlreader.cpp +++ b/src/xmlreader.cpp @@ -1,8 +1,9 @@ #include "xmlreader.h" -#include "utility.h" #include +#include + using MOBase::Exception; bool XmlReader::getNextElement(QString const& start) @@ -22,7 +23,6 @@ bool XmlReader::getNextElement(QString const& start) case Invalid: throw Exception("bad xml"); - return false; default: qWarning() << "Unexpected token type " << tokenString() << " at " << lineNumber(); diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..6bb65b7 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,23 @@ +{ + "features": { + "standalone": { + "description": "Build Standalone.", + "dependencies": ["mo2-cmake", "mo2-uibase"] + } + }, + "vcpkg-configuration": { + "default-registry": { + "kind": "git", + "repository": "https://github.com/Microsoft/vcpkg", + "baseline": "8ae59b5b1329a51875abc71d528da93d9c3e8972" + }, + "registries": [ + { + "kind": "git", + "repository": "https://github.com/ModOrganizer2/vcpkg-registry", + "baseline": "84ff92223433d101738a3c6cef96fa6ae6a6f302", + "packages": ["mo2-*"] + } + ] + } +}