mirror of
https://github.com/ModOrganizer2/modorganizer-installer_bundle.git
synced 2026-07-27 14:02:39 -07:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b1dd8fb81 | ||
|
|
17c3bc3450 | ||
|
|
8f9b8cf564 | ||
|
|
6ef78cf305 | ||
|
|
729a2d2856 | ||
|
|
dc7d96ec8e | ||
|
|
6797d50370 | ||
|
|
1e359abd46 | ||
|
|
89e0c258e3 | ||
|
|
dbbed655a1 | ||
|
|
376e23c34c | ||
|
|
23cd59932b | ||
|
|
f58df55d2d | ||
|
|
6da60deda1 | ||
|
|
281bdd40a9 | ||
|
|
0419f0db69 |
@@ -0,0 +1,15 @@
|
||||
Import('qt_env')
|
||||
|
||||
env = qt_env.Clone()
|
||||
|
||||
env.DisableQtModules('Gui')
|
||||
env.AppendUnique(CPPDEFINES = [ 'INSTALLERBUNDLE_LIBRARY' ])
|
||||
|
||||
# Sigh
|
||||
env['CPPPATH'] += [ '.' ]
|
||||
|
||||
lib = env.SharedLibrary('installerBundle', env.Glob('*.cpp'))
|
||||
env.InstallModule(lib)
|
||||
|
||||
res = env['QT_USED_MODULES']
|
||||
Return('res')
|
||||
@@ -12,6 +12,11 @@ TEMPLATE = lib
|
||||
CONFIG += plugins
|
||||
CONFIG += dll
|
||||
|
||||
CONFIG(release, debug|release) {
|
||||
QMAKE_CXXFLAGS += /Zi
|
||||
QMAKE_LFLAGS += /DEBUG
|
||||
}
|
||||
|
||||
DEFINES += INSTALLERBUNDLE_LIBRARY
|
||||
|
||||
SOURCES += installerbundle.cpp
|
||||
@@ -20,3 +25,7 @@ HEADERS += installerbundle.h
|
||||
|
||||
|
||||
include(../plugin_template.pri)
|
||||
|
||||
OTHER_FILES += \
|
||||
installerbundle.json\
|
||||
SConscript
|
||||
|
||||
+42
-23
@@ -1,28 +1,31 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
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 "installerbundle.h"
|
||||
#include "iinstallationmanager.h"
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
|
||||
using namespace MOBase;
|
||||
|
||||
|
||||
InstallerBundle::InstallerBundle()
|
||||
{
|
||||
}
|
||||
@@ -81,20 +84,36 @@ bool InstallerBundle::isArchiveSupported(const DirectoryTree &tree) const
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ((tree.numNodes() == 0)
|
||||
&& (tree.numLeafs() == 1)
|
||||
&& (tree.leafsBegin()->getName().endsWith(".7z", Qt::CaseInsensitive)
|
||||
|| tree.leafsBegin()->getName().endsWith(".rar", Qt::CaseInsensitive))) {
|
||||
// nested archive
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
IPluginInstaller::EInstallResult InstallerBundle::install(QString &modName, DirectoryTree &tree)
|
||||
IPluginInstaller::EInstallResult InstallerBundle::install(GuessedValue<QString> &modName, DirectoryTree &tree,
|
||||
QString&, int&)
|
||||
{
|
||||
for (DirectoryTree::const_leaf_iterator fileIter = tree.leafsBegin();
|
||||
fileIter != tree.leafsEnd(); ++fileIter) {
|
||||
if (fileIter->getName().endsWith(".fomod", Qt::CaseInsensitive)) {
|
||||
QString name = fileIter->getName();
|
||||
if (name.endsWith(".fomod", Qt::CaseInsensitive)
|
||||
|| name.endsWith(".7z", Qt::CaseInsensitive)
|
||||
|| name.endsWith(".rar", Qt::CaseInsensitive)) {
|
||||
QString tempFile = manager()->extractFile(fileIter->getName());
|
||||
return manager()->installArchive(modName, tempFile);
|
||||
IPluginInstaller::EInstallResult res = manager()->installArchive(modName, tempFile);
|
||||
if (res == IPluginInstaller::RESULT_SUCCESS) {
|
||||
res = IPluginInstaller::RESULT_SUCCESSCANCEL;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return IPluginInstaller::RESULT_NOTATTEMPTED;
|
||||
}
|
||||
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
Q_EXPORT_PLUGIN2(installerBundle, InstallerBundle)
|
||||
#endif
|
||||
|
||||
+30
-26
@@ -1,22 +1,22 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
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 INSTALLERBUNDLE_H
|
||||
#define INSTALLERBUNDLE_H
|
||||
|
||||
@@ -24,29 +24,33 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <iplugininstallersimple.h>
|
||||
|
||||
|
||||
class InstallerBundle : public IPluginInstallerSimple
|
||||
class InstallerBundle : public MOBase::IPluginInstallerSimple
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(IPlugin IPluginInstaller IPluginInstallerSimple)
|
||||
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginInstaller MOBase::IPluginInstallerSimple)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
Q_PLUGIN_METADATA(IID "org.tannin.InstallerBundle" FILE "installerbundle.json")
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
InstallerBundle();
|
||||
|
||||
virtual bool init(IOrganizer *moInfo);
|
||||
virtual bool init(MOBase::IOrganizer *moInfo);
|
||||
virtual QString name() const;
|
||||
virtual QString author() const;
|
||||
virtual QString description() const;
|
||||
virtual VersionInfo version() const;
|
||||
virtual MOBase::VersionInfo version() const;
|
||||
virtual bool isActive() const;
|
||||
virtual QList<PluginSetting> settings() const;
|
||||
virtual QList<MOBase::PluginSetting> settings() const;
|
||||
|
||||
virtual unsigned int priority() const;
|
||||
virtual bool isManualInstaller() const;
|
||||
|
||||
virtual bool isArchiveSupported(const DirectoryTree &tree) const;
|
||||
virtual EInstallResult install(QString &modName, DirectoryTree &tree);
|
||||
virtual bool isArchiveSupported(const MOBase::DirectoryTree &tree) const;
|
||||
virtual EInstallResult install(MOBase::GuessedValue<QString> &modName, MOBase::DirectoryTree &tree,
|
||||
QString &version, int &modID);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user