Compare commits

...
24 Commits
Author SHA1 Message Date
Tannin 256cdb8df7 fixed priority ordering after enabling/disabling mod 2016-05-09 20:36:13 +02:00
Tannin 32480f7a81 minor fixes 2016-05-07 00:23:13 +02:00
Tannin e43762e7db profiles can now be configured to use the global game settings instead of profile-local 2016-05-07 00:22:23 +02:00
Tannin afe0d749c4 added option to use a mod as the target to create now files instead of "overwrite" 2016-05-07 00:18:23 +02:00
Tannin eb97c46ed6 cleanup 2016-05-07 00:03:38 +02:00
Tannin d958e11e2b now using github for self updater 2016-05-06 23:47:51 +02:00
Tannin b0e3e86a61 moved plugins.txt reading/writing to game plugin 2016-05-06 23:39:08 +02:00
Tannin 9df612c7ca more configuration options
- overwrite path configurable
- one can now set a base directory for all configurable paths
- user can now opt in/out of receiving pre-release updates (not functional yet)
2016-03-02 21:28:17 +01:00
Tannin 0899724d90 profile- and group-dropdown no longer switch by mouse-wheel. Plus fixed refreshing of right-hand side tabs 2016-03-02 21:22:26 +01:00
Tannin 53d9789740 updated icon and splash screen. MO can now use custom instance specific splash screens and splashes stored in game plugins 2016-03-02 21:20:38 +01:00
Tannin 4f8c71d626 merged master into new_vfs_library 2016-02-12 19:08:25 +01:00
Tannin fd68248698 fixed browse-button for mod directory (in settings) 2016-02-09 20:57:20 +01:00
Tannin 1ad2115e01 fixed cleanup of file handles 2016-02-09 20:55:39 +01:00
Tannin 8d1dd6238f fixed display of process name in unlock-widget 2016-02-09 20:54:54 +01:00
Tannin aaa1f52bdd fixed cleanup on restart 2016-02-09 20:53:09 +01:00
Tannin b085aeea0e changed focus policy on grouping selection to prevent accidentally changing the grouping mode 2016-02-09 20:51:56 +01:00
Tannin ea621ef859 fixed update of window title 2016-02-09 20:50:07 +01:00
Tannin 3202713cff updated to match current usvfs api 2016-02-09 20:46:46 +01:00
Tannin ad9d50e5f0 replaced boost&qt foreach-implementations by the c++11 variant 2016-02-09 20:32:26 +01:00
Tannin 63eaf453e0 portable setup is no longer offered if the directory isn't writable 2016-02-09 20:05:41 +01:00
Tannin 8a9a1680b0 code formatting (clang_format) 2016-02-09 20:02:58 +01:00
Tannin 1439347def updated version number 2016-02-08 20:33:53 +01:00
Tannin a9a51f5085 fixed a potential crash-cause when querying download info and slight improvement (?) to the regex that extracts the modid 2016-01-10 20:22:50 +01:00
Tannin 2aae65d6f6 made instance-switching usable
this includes tons and tons of changes to how paths are determined.
the profiles-dir can now also be configured
2016-01-10 20:19:56 +01:00
75 changed files with 3325 additions and 2859 deletions
+2 -2
View File
@@ -2,13 +2,13 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(organizer)
SET(DEPENDENCIES_DIR CACHE PATH "")
# hint to find qt in dependencies path
LIST(APPEND CMAKE_PREFIX_PATH ${DEPENDENCIES_DIR}/qt5/lib/cmake)
FILE(GLOB_RECURSE BOOST_ROOT ${DEPENDENCIES_DIR}/boost*/project-config.jam)
GET_FILENAME_COMPONENT(BOOST_ROOT ${BOOST_ROOT} DIRECTORY)
SET(ZLIB_ROOT ${DEPENDENCIES_DIR}/zlib)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(src)
+31 -10
View File
@@ -431,16 +431,24 @@ msvs_version = int(env['MSVS_VERSION'].split('.')[0]) + 2000
if msvs_version > 2010:
msvs_version += 1
# Need more work on the qt version stuff
#build-ModOrganizer-Desktop_Qt_5_4_1_MSVC2013_OpenGL_32bit-Debug
build_dir = 'scons-ModOrganizer-QT_%s_for_MSVS%d_32bit-%s' % (
#os.path.basename(env['QTDIR']).replace('.', '_'),
'5_4_1_OpenGL',
# Read the QT version info
with open(os.path.join(env['QTDIR'], 'mkspecs', 'qconfig.pri')) as qtinfo:
for line in qtinfo:
info = re.split(r'\s*=\s*', line.rstrip())
if info[0] == 'QT_VERSION':
env[info[0]] = info[1]
elif '_VERSION' in info[0]:
env[info[0]] = int(info[1])
build_dir = 'scons-ModOrganizer-QT_%s_%sfor_MSVS%d_32bit-%s' % (
env['QT_VERSION'].replace('.', '_'),
'OpenGL_' if 'opengl' in env['QTDIR'] else '',
msvs_version,
config.title())
# Put the sconsign file somewhere sane
env.SConsignFile(os.path.join(build_dir, '.sconsign.dblite'))
env.CacheDir(os.path.join(build_dir, '.cache'))
#this doesn't seem to work
#env.VariantDir('build/$CONFIG', 'source')
@@ -531,9 +539,6 @@ qt_env = env.Clone()
if qt_env['CONFIG'] != 'debug':
qt_env.AppendUnique(CPPDEFINES = [ 'QT_NO_DEBUG' ])
# Better way of working this out
qt_env['QT_MAJOR_VERSION'] = 5 #int(os.path.basename(env['QTDIR']).split('.')[0])
qt_env.Tool('qt%d' % qt_env['QT_MAJOR_VERSION'])
# FIXME See if I can work out how to get official scons qt to work. Appears
@@ -618,6 +623,20 @@ if qt_env['QT_MAJOR_VERSION'] > 4:
]
# Finally, set up rules to install the DLLs.
# use windeployqt.exe to install all required libraries
#SET(windeploy_parameters --no-translations --no-plugins --libdir dlls --release-with-debug-info --no-compiler-runtime)
#INSTALL(
# CODE
# "EXECUTE_PROCESS(
# COMMAND
# ${qt5bin}/windeployqt.exe ModOrganizer.exe ${windeploy_parameters}
# COMMAND
# ${qt5bin}/windeployqt.exe uibase.dll ${windeploy_parameters}
# WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin
# )"
#)
# this should probably be a rule though it seems to produce an awful lot of
# Stuff(TM). or a postaction
dll_path = os.path.join('$INSTALL_PATH', 'DLLs')
@@ -648,8 +667,10 @@ if 'WebKit' in libs_to_install and qt_env['QT_MAJOR_VERSION'] == 4:
if qt_env['QT_MAJOR_VERSION'] > 4:
# Guesswork a bit.
dlls_to_install += [
os.path.join(env['QTDIR'], 'bin', 'icu%s53.dll' % lib)
for lib in ('dt','in', 'uc')
os.path.join(env['QTDIR'],
'bin',
'icu%s%d%d.dll' % (lib, qt_env['QT_MAJOR_VERSION'], qt_env['QT_MINOR_VERSION'] - 1))
for lib in ('dt','in', 'uc')
]
platform_dlls = []
+11 -3
View File
@@ -36,6 +36,7 @@ includes = dict()
adding = None
added = dict()
lcadded = dict()
foundline = None
@@ -70,6 +71,7 @@ def process_next_line(line, outfile):
m = re.match(r'.*class (.*);', line)
if m:
added[m.group(1)] = (adding, line)
lcadded[m.group(1).lower() + '.h'] = m.group(1)
else:
added[line] = (adding, line)
elif removing:
@@ -79,12 +81,18 @@ def process_next_line(line, outfile):
m = re.match(r'- #include [<"](.*)[">] +// lines (.*)-', line)
if m:
foundline = m.group(2)
if m.group(1) in added:
# Note: In this project at least we have a naming convention of
# lower case filename and upper case classname.
clname = m.group(1)
if clname not in added:
if clname in lcadded:
clname = lcadded[clname]
if clname in added:
messages[removing].append(
'%s(%s) : warning I0004: Replace include of %s with '
'forward reference %s' % (
removing, m.group(2), m.group(1), added[m.group(1)][1]))
del added[m.group(1)]
removing, m.group(2), m.group(1), added[clname][1]))
del added[clname]
else:
messages[removing].append(
'%s(%s) : warning I0001: Unnecessary include of %s' % (
+1 -1
View File
@@ -2463,7 +2463,7 @@
{ include: [ "@\"(QtCore/)?qglobal\\.h\"", "private", "<QtGlobal>", "public" ] },
{ include: [ "@\"(QtCore/)?qnamespace\\.h\"", "private", "<Qt>", "public" ] },
{ include: [ "@\"(QtCore/)?qlogging\\.h\"", "private", "<QtDebug>", "public" ] }, #qDebug, qWarning, etc
{ include: [ "@\"(QtCore/)?qalgorithms\\.h\"", "private", "<QAlgorithms>", "public" ] }, #qSort, etc
{ include: [ "@\"(QtCore/)?qalgorithms\\.h\"", "private", "<QtAlgorithms>", "public" ] }, #qSort, etc
{ include: [ "@\"(QtWinExtras/)?qwinfunctions\\.h\"", "private", "<QtWin>", "public" ] }, # for fromHICON
# These ones are just madness. For instance, why with the above do we get
+30 -41
View File
@@ -18,10 +18,6 @@ SET(organizer_SRCS
settings.cpp
selfupdater.cpp
selectiondialog.cpp
savegameinfowidgetgamebryo.cpp
savegameinfowidget.cpp
savegamegamebryo.cpp
savegame.cpp
queryoverwritedialog.cpp
profilesdialog.cpp
profile.cpp
@@ -35,11 +31,11 @@ SET(organizer_SRCS
modlist.cpp
modinfodialog.cpp
modinfo.cpp
modinfobackup.cpp
modinfoforeign.cpp
modinfooverwrite.cpp
modinforegular.cpp
modinfowithconflictinfo.cpp
modinfobackup.cpp
modinfoforeign.cpp
modinfooverwrite.cpp
modinforegular.cpp
modinfowithconflictinfo.cpp
messagedialog.cpp
mainwindow.cpp
main.cpp
@@ -80,26 +76,21 @@ SET(organizer_SRCS
previewdialog.cpp
aboutdialog.cpp
json.cpp
safewritefile.cpp
modflagicondelegate.cpp
genericicondelegate.cpp
organizerproxy.cpp
viewmarkingscrollbar.cpp
plugincontainer.cpp
organizercore.cpp
instancemanager.cpp
usvfsconnector.cpp
eventfilter.cpp
shared/inject.cpp
shared/windows_error.cpp
shared/error_report.cpp
shared/directoryentry.cpp
shared/gameinfo.cpp
shared/oblivioninfo.cpp
shared/fallout3info.cpp
shared/fallout4info.cpp
shared/falloutnvinfo.cpp
shared/util.cpp
shared/skyriminfo.cpp
shared/appconfig.cpp
shared/leaktrace.cpp
shared/stackdata.cpp
@@ -114,10 +105,6 @@ SET(organizer_HDRS
settings.h
selfupdater.h
selectiondialog.h
savegameinfowidgetgamebryo.h
savegameinfowidget.h
savegamegamebyro.h
savegame.h
queryoverwritedialog.h
profilesdialog.h
profile.h
@@ -131,11 +118,11 @@ SET(organizer_HDRS
modlist.h
modinfodialog.h
modinfo.h
modinfobackup.h
modinfoforeign.h
modinfooverwrite.h
modinforegular.h
modinfowithconflictinfo.h
modinfobackup.h
modinfoforeign.h
modinfooverwrite.h
modinforegular.h
modinfowithconflictinfo.h
messagedialog.h
mainwindow.h
loghighlighter.h
@@ -175,7 +162,6 @@ SET(organizer_HDRS
previewdialog.h
aboutdialog.h
json.h
safewritefile.h
modflagicondelegate.h
genericicondelegate.h
organizerproxy.h
@@ -183,19 +169,15 @@ SET(organizer_HDRS
plugincontainer.h
organizercore.h
iuserinterface.h
instancemanager.h
usvfsconnector.h
eventfilter.h
shared/inject.h
shared/windows_error.h
shared/error_report.h
shared/directoryentry.h
shared/gameinfo.h
shared/oblivioninfo.h
shared/fallout3info.h
shared/fallout4info.h
shared/falloutnvinfo.h
shared/util.h
shared/skyriminfo.h
shared/appconfig.h
shared/appconfig.inc
shared/leaktrace.h
@@ -208,7 +190,6 @@ SET(organizer_UIS
simpleinstalldialog.ui
settingsdialog.ui
selectiondialog.ui
savegameinfowidget.ui
queryoverwritedialog.ui
profilesdialog.ui
overwriteinfodialog.ui
@@ -266,7 +247,7 @@ INCLUDE_DIRECTORIES(${Qt5Declarative_INCLUDES})
ADD_DEFINITIONS(-DQT_MESSAGELOGCONTEXT)
# Boost
SET(Boost_USE_STATIC_LIBS ON)
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE(Boost REQUIRED)
@@ -293,16 +274,22 @@ INCLUDE_DIRECTORIES(${project_path}/uibase/src
${project_path}/archive/src
${project_path}/../usvfs/usvfs
${project_path}/game_gamebryo/src
${project_path}/game_features/src)
MESSAGE(STATUS ${project_path}/gameGamebryo/src)
${project_path}/game_features/src
${project_path}/githubpp/src)
INCLUDE_DIRECTORIES(shared ${ZLIB_INCLUDE_DIRS})
LINK_DIRECTORIES(${lib_path}
${project_path}/../zlib/lib)
ADD_DEFINITIONS(-D_UNICODE -DUNICODE -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS)
EXECUTE_PROCESS(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
ADD_DEFINITIONS(-D_UNICODE -DUNICODE -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -DGITID="${GIT_COMMIT_HASH}")
IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
SET(usvfs_name usvfs_x64)
@@ -315,11 +302,13 @@ TARGET_LINK_LIBRARIES(ModOrganizer
Qt5::Widgets Qt5::WinExtras Qt5::WebKitWidgets
${Boost_LIBRARIES}
zlibstatic
uibase esptk bsatk
uibase esptk bsatk githubpp
${usvfs_name}
Dbghelp advapi32 Version Shlwapi)
SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES COMPILE_FLAGS /GL)
IF (NOT "${OPTIMIZE_COMPILE_FLAGS}" STREQUAL "")
SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES COMPILE_FLAGS_RELWITHDEBINFO
${OPTIMIZE_COMPILE_FLAGS})
ENDIF()
SET_TARGET_PROPERTIES(ModOrganizer PROPERTIES LINK_FLAGS_RELWITHDEBINFO
"/LARGEADDRESSAWARE ${OPTIMIZE_LINK_FLAGS}")
+12 -1
View File
@@ -22,6 +22,14 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "ui_aboutdialog.h"
#include <utility.h>
#include <QApplication>
#include <QLabel>
#include <QListWidget>
#include <QListWidgetItem>
#include <QTextBrowser>
#include <QVariant>
#include <Qt>
AboutDialog::AboutDialog(const QString &version, QWidget *parent)
: QDialog(parent)
@@ -46,10 +54,13 @@ AboutDialog::AboutDialog(const QString &version, QWidget *parent)
addLicense("RRZE Icon Set", LICENSE_CCBY3);
addLicense("Icons by Lorc, Delapouite and sbed available on http://game-icons.net", LICENSE_CCBY3);
addLicense("Castle Core", LICENSE_APACHE2);
addLicense("LOOT", LICENSE_GPL3);
ui->nameLabel->setText(QString("<span style=\"font-size:12pt; font-weight:600;\">%1 %2</span>").arg(ui->nameLabel->text()).arg(version));
#ifdef HGID
#if defined(HGID)
ui->revisionLabel->setText(ui->revisionLabel->text() + " " + HGID);
#elif defined(GITID)
ui->revisionLabel->setText(ui->revisionLabel->text() + " " + GITID);
#else
ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
#endif
+4 -3
View File
@@ -22,10 +22,11 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define ABOUTDIALOG_H
#include <QDialog>
#include <QListWidgetItem>
class QListWidgetItem;
#include <QObject>
#include <QString>
#include <map>
#include <vector>
#include <utility>
namespace Ui {
class AboutDialog;
+46 -4
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>508</width>
<height>335</height>
<width>746</width>
<height>369</height>
</rect>
</property>
<property name="windowTitle">
@@ -18,13 +18,50 @@
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="iconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>250</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>250</width>
<height>250</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources.qrc">:/MO/gui/mo_icon.ico</pixmap>
<pixmap resource="resources.qrc">:/MO/gui/splash</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@@ -83,7 +120,7 @@
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string notr="true">Copyright 2011-2015 Sebastian Herbord</string>
<string notr="true">Copyright 2011-2016 Sebastian Herbord</string>
</property>
</widget>
</item>
@@ -265,6 +302,11 @@
<string notr="true">thosrtanner</string>
</property>
</item>
<item>
<property name="text">
<string>ogrotten</string>
</property>
</item>
</widget>
</item>
</layout>
+13 -9
View File
@@ -21,9 +21,14 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "ui_activatemodsdialog.h"
#include <QComboBox>
#include <QHeaderView>
#include <QLabel>
#include <QString>
#include <QTableWidget>
ActivateModsDialog::ActivateModsDialog(const std::map<QString, std::vector<QString> > &missingPlugins, QWidget *parent)
#include <QtGlobal>
ActivateModsDialog::ActivateModsDialog(SaveGameInfo::MissingAssets const &missingAssets, QWidget *parent)
: TutorableDialog("ActivateMods", parent), ui(new Ui::ActivateModsDialog)
{
ui->setupUi(this);
@@ -40,18 +45,17 @@ ActivateModsDialog::ActivateModsDialog(const std::map<QString, std::vector<QStri
int row = 0;
modsTable->setRowCount(missingPlugins.size());
modsTable->setRowCount(missingAssets.size());
for (std::map<QString, std::vector<QString> >::const_iterator espIter = missingPlugins.begin();
espIter != missingPlugins.end(); ++espIter, ++row) {
modsTable->setCellWidget(row, 0, new QLabel(espIter->first));
if (espIter->second.size() == 0) {
for (SaveGameInfo::MissingAssets::const_iterator espIter = missingAssets.begin();
espIter != missingAssets.end(); ++espIter, ++row) {
modsTable->setCellWidget(row, 0, new QLabel(espIter.key()));
if (espIter->size() == 0) {
modsTable->setCellWidget(row, 1, new QLabel(tr("not found")));
} else {
QComboBox* combo = new QComboBox();
for (std::vector<QString>::const_iterator modIter = espIter->second.begin();
modIter != espIter->second.end(); ++modIter) {
combo->addItem(*modIter);
for (QString const &mod : espIter.value()) {
combo->addItem(mod);
}
modsTable->setCellWidget(row, 1, combo);
}
+8 -2
View File
@@ -20,8 +20,14 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#ifndef ACTIVATEMODSDIALOG_H
#define ACTIVATEMODSDIALOG_H
#include "savegameinfo.h"
#include "tutorabledialog.h"
#include <map>
#include <QObject>
class QString;
class QWidget;
#include <set>
namespace Ui {
@@ -42,7 +48,7 @@ public:
* @param missingPlugins a map containing missing plugins that need to be activated
* @param parent ... Defaults to 0.
**/
explicit ActivateModsDialog(const std::map<QString, std::vector<QString> > &missingPlugins, QWidget *parent = 0);
explicit ActivateModsDialog(SaveGameInfo::MissingAssets const &missingAssets, QWidget *parent = 0);
~ActivateModsDialog();
/**
+1 -1
View File
@@ -188,7 +188,7 @@ int CategoryFactory::addCategory(const QString &name, const std::vector<int> &ne
void CategoryFactory::addCategory(int id, const QString &name, const std::vector<int> &nexusIDs, int parentID)
{
int index = m_Categories.size();
int index = static_cast<int>(m_Categories.size());
m_Categories.push_back(Category(index, id, name, nexusIDs, parentID));
for (int nexusID : nexusIDs) {
m_NexusMap[nexusID] = index;
+1 -1
View File
@@ -159,7 +159,7 @@ void DirectoryRefresher::refresh()
} catch (const std::exception &e) {
emit error(tr("failed to read mod (%1): %2").arg(iter->modName, e.what()));
}
emit progress((i * 100) / m_Mods.size() + 1);
emit progress((i * 100) / static_cast<int>(m_Mods.size()) + 1);
}
emit progress(100);
+33 -37
View File
@@ -88,7 +88,8 @@ DownloadManager::DownloadInfo *DownloadManager::DownloadInfo::createFromMeta(con
QString fileName = QFileInfo(filePath).fileName();
if (fileName.endsWith(UNFINISHED)) {
info->m_FileName = fileName.mid(0, fileName.length() - strlen(UNFINISHED));
info->m_FileName = fileName.mid(
0, fileName.length() - static_cast<int>(strlen(UNFINISHED)));
info->m_State = STATE_PAUSED;
} else {
info->m_FileName = fileName;
@@ -471,7 +472,7 @@ void DownloadManager::addNXMDownload(const QString &url)
void DownloadManager::removeFile(int index, bool deleteFile)
{
if (index >= m_ActiveDownloads.size()) {
throw MyException(tr("invalid index"));
throw MyException(tr("remove: invalid download index %1").arg(index));
}
DownloadInfo *download = m_ActiveDownloads.at(index);
@@ -538,7 +539,7 @@ void DownloadManager::refreshAlphabeticalTranslation()
void DownloadManager::restoreDownload(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("restore: invalid download index: %1").arg(index));
}
DownloadInfo *download = m_ActiveDownloads.at(index);
@@ -571,7 +572,7 @@ void DownloadManager::removeDownload(int index, bool deleteFile)
}
} else {
if (index >= m_ActiveDownloads.size()) {
reportError(tr("invalid index %1").arg(index));
reportError(tr("remove: invalid download index %1").arg(index));
return;
}
@@ -589,7 +590,7 @@ void DownloadManager::removeDownload(int index, bool deleteFile)
void DownloadManager::cancelDownload(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
reportError(tr("invalid index %1").arg(index));
reportError(tr("cancel: invalid download index %1").arg(index));
return;
}
@@ -602,7 +603,7 @@ void DownloadManager::cancelDownload(int index)
void DownloadManager::pauseDownload(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
reportError(tr("invalid index %1").arg(index));
reportError(tr("pause: invalid download index %1").arg(index));
return;
}
@@ -622,7 +623,7 @@ void DownloadManager::pauseDownload(int index)
void DownloadManager::resumeDownload(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
reportError(tr("invalid index %1").arg(index));
reportError(tr("resume: invalid download index %1").arg(index));
return;
}
DownloadInfo *info = m_ActiveDownloads[index];
@@ -633,7 +634,7 @@ void DownloadManager::resumeDownload(int index)
void DownloadManager::resumeDownloadInt(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
reportError(tr("invalid index %1").arg(index));
reportError(tr("resume (int): invalid download index %1").arg(index));
return;
}
DownloadInfo *info = m_ActiveDownloads[index];
@@ -673,7 +674,7 @@ DownloadManager::DownloadInfo *DownloadManager::downloadInfoByID(unsigned int id
void DownloadManager::queryInfo(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
reportError(tr("invalid index %1").arg(index));
reportError(tr("query: invalid download index %1").arg(index));
return;
}
DownloadInfo *info = m_ActiveDownloads[index];
@@ -693,19 +694,14 @@ void DownloadManager::queryInfo(int index)
QString ignore;
NexusInterface::interpretNexusFileName(fileName, ignore, info->m_FileInfo->modID, true);
if (info->m_FileInfo->modID < 0) {
QString modIDString;
while (modIDString.isEmpty()) {
modIDString = QInputDialog::getText(nullptr, tr("Please enter the nexus mod id"), tr("Mod ID:"), QLineEdit::Normal,
QString(), nullptr, 0, Qt::ImhFormattedNumbersOnly);
if (modIDString.isNull()) {
// canceled
return;
} else if (modIDString.contains(QRegExp("[^0-9]"))) {
qDebug("illegal character in mod-id");
modIDString.clear();
}
}
info->m_FileInfo->modID = modIDString.toInt(nullptr, 10);
bool ok = false;
int modId = QInputDialog::getInt(
nullptr, tr("Please enter the nexus mod id"), tr("Mod ID:"), 1, 1,
std::numeric_limits<int>::max(), 1, &ok);
// careful now: while the dialog was displayed, events were processed.
// the download list might have changed and our info-ptr invalidated.
m_ActiveDownloads[index]->m_FileInfo->modID = modId;
return;
}
}
info->m_ReQueried = true;
@@ -726,7 +722,7 @@ int DownloadManager::numPendingDownloads() const
std::pair<int, int> DownloadManager::getPendingDownload(int index)
{
if ((index < 0) || (index >= m_PendingDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("get pending: invalid download index %1").arg(index));
}
return m_PendingDownloads.at(index);
@@ -735,7 +731,7 @@ std::pair<int, int> DownloadManager::getPendingDownload(int index)
QString DownloadManager::getFilePath(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("get path: invalid download index %1").arg(index));
}
return m_OutputDirectory + "/" + m_ActiveDownloads.at(index)->m_FileName;
@@ -756,7 +752,7 @@ QString DownloadManager::getFileTypeString(int fileType)
QString DownloadManager::getDisplayName(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("display name: invalid download index %1").arg(index));
}
DownloadInfo *info = m_ActiveDownloads.at(index);
@@ -773,7 +769,7 @@ QString DownloadManager::getDisplayName(int index) const
QString DownloadManager::getFileName(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("file name: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_FileName;
@@ -782,7 +778,7 @@ QString DownloadManager::getFileName(int index) const
QDateTime DownloadManager::getFileTime(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("file time: invalid download index %1").arg(index));
}
DownloadInfo *info = m_ActiveDownloads.at(index);
@@ -796,7 +792,7 @@ QDateTime DownloadManager::getFileTime(int index) const
qint64 DownloadManager::getFileSize(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("file size: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_TotalSize;
@@ -806,7 +802,7 @@ qint64 DownloadManager::getFileSize(int index) const
int DownloadManager::getProgress(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("progress: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_Progress;
@@ -816,7 +812,7 @@ int DownloadManager::getProgress(int index) const
DownloadManager::DownloadState DownloadManager::getState(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("state: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_State;
@@ -826,7 +822,7 @@ DownloadManager::DownloadState DownloadManager::getState(int index) const
bool DownloadManager::isInfoIncomplete(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("infocomplete: invalid download index %1").arg(index));
}
DownloadInfo *info = m_ActiveDownloads.at(index);
@@ -841,7 +837,7 @@ bool DownloadManager::isInfoIncomplete(int index) const
int DownloadManager::getModID(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("mod id: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_FileInfo->modID;
}
@@ -849,7 +845,7 @@ int DownloadManager::getModID(int index) const
bool DownloadManager::isHidden(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("ishidden: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_Hidden;
}
@@ -858,7 +854,7 @@ bool DownloadManager::isHidden(int index) const
const ModRepositoryFileInfo *DownloadManager::getFileInfo(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("file info: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_FileInfo;
@@ -868,7 +864,7 @@ const ModRepositoryFileInfo *DownloadManager::getFileInfo(int index) const
void DownloadManager::markInstalled(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("mark installed: invalid download index %1").arg(index));
}
DownloadInfo *info = m_ActiveDownloads.at(index);
@@ -883,7 +879,7 @@ void DownloadManager::markInstalled(int index)
void DownloadManager::markUninstalled(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
throw MyException(tr("invalid index"));
throw MyException(tr("mark uninstalled: invalid download index %1").arg(index));
}
DownloadInfo *info = m_ActiveDownloads.at(index);
@@ -1247,7 +1243,7 @@ int DownloadManager::startDownloadURLs(const QStringList &urls)
int DownloadManager::startDownloadNexusFile(int modID, int fileID)
{
int newID = m_ActiveDownloads.size();
addNXMDownload(QString("nxm://%1/mods/%2/files/%3").arg(m_ManagedGame->getGameShortName()).arg(modID).arg(fileID));
addNXMDownload(QString("nxm://%1/mods/%2/files/%3").arg(m_ManagedGame->gameShortName()).arg(modID).arg(fileID));
return newID;
}
+52 -14
View File
@@ -21,6 +21,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "ui_editexecutablesdialog.h"
#include "filedialogmemory.h"
#include "stackdata.h"
#include "modlist.h"
#include <QMessageBox>
#include <Shellapi.h>
#include <utility.h>
@@ -29,15 +30,20 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
using namespace MOBase;
using namespace MOShared;
EditExecutablesDialog::EditExecutablesDialog(const ExecutablesList &executablesList, QWidget *parent)
EditExecutablesDialog::EditExecutablesDialog(
const ExecutablesList &executablesList, const ModList &modList,
Profile *profile, QWidget *parent)
: TutorableDialog("EditExecutables", parent)
, ui(new Ui::EditExecutablesDialog)
, m_CurrentItem(nullptr)
, m_ExecutablesList(executablesList)
, m_Profile(profile)
{
ui->setupUi(this);
refreshExecutablesWidget();
ui->newFilesModBox->addItems(modList.allMods());
}
EditExecutablesDialog::~EditExecutablesDialog()
@@ -86,23 +92,30 @@ void EditExecutablesDialog::resetInput()
ui->appIDOverwriteEdit->clear();
ui->overwriteAppIDBox->setChecked(false);
ui->useAppIconCheckBox->setChecked(false);
ui->newFilesModCheckBox->setChecked(false);
m_CurrentItem = nullptr;
}
void EditExecutablesDialog::saveExecutable()
{
m_ExecutablesList.updateExecutable(ui->titleEdit->text(),
QDir::fromNativeSeparators(ui->binaryEdit->text()),
ui->argumentsEdit->text(),
QDir::fromNativeSeparators(ui->workingDirEdit->text()),
ui->overwriteAppIDBox->isChecked() ?
ui->appIDOverwriteEdit->text() : "",
Executable::UseApplicationIcon | Executable::CustomExecutable,
(ui->useAppIconCheckBox->isChecked() ?
Executable::UseApplicationIcon : Executable::Flags())
| Executable::CustomExecutable);
m_ExecutablesList.updateExecutable(
ui->titleEdit->text(),
QDir::fromNativeSeparators(ui->binaryEdit->text()),
ui->argumentsEdit->text(),
QDir::fromNativeSeparators(ui->workingDirEdit->text()),
ui->overwriteAppIDBox->isChecked() ?
ui->appIDOverwriteEdit->text() : "",
Executable::UseApplicationIcon | Executable::CustomExecutable,
(ui->useAppIconCheckBox->isChecked() ?
Executable::UseApplicationIcon : Executable::Flags())
| Executable::CustomExecutable);
if (ui->newFilesModCheckBox->isChecked()) {
m_Profile->storeSetting("custom_overwrites", ui->titleEdit->text(),
ui->newFilesModBox->currentText());
}
}
void EditExecutablesDialog::delayedRefresh()
@@ -126,15 +139,17 @@ void EditExecutablesDialog::on_addButton_clicked()
void EditExecutablesDialog::on_browseButton_clicked()
{
QString binaryName = FileDialogMemory::getOpenFileName("editExecutableBinary", this,
tr("Select a binary"), QString(), tr("Executable (%1)").arg("*.exe *.bat *.jar"));
QString binaryName = FileDialogMemory::getOpenFileName(
"editExecutableBinary", this, tr("Select a binary"), QString(),
tr("Executable (%1)").arg("*.exe *.bat *.jar"));
if (binaryName.endsWith(".jar", Qt::CaseInsensitive)) {
QString binaryPath;
{ // try to find java automatically
std::wstring binaryNameW = ToWString(binaryName);
WCHAR buffer[MAX_PATH];
if (::FindExecutableW(binaryNameW.c_str(), nullptr, buffer) > (HINSTANCE)32) {
if (::FindExecutableW(binaryNameW.c_str(), nullptr, buffer)
> reinterpret_cast<HINSTANCE>(32)) {
DWORD binaryType = 0UL;
if (!::GetBinaryTypeW(binaryNameW.c_str(), &binaryType)) {
qDebug("failed to determine binary type of \"%ls\": %lu", binaryNameW.c_str(), ::GetLastError());
@@ -210,8 +225,13 @@ bool EditExecutablesDialog::executableChanged()
{
if (m_CurrentItem != nullptr) {
Executable const &selectedExecutable(m_ExecutablesList.find(m_CurrentItem->text()));
QString storedCustomOverwrite = m_Profile->setting("custom_overwrites", selectedExecutable.m_Title).toString();
return selectedExecutable.m_Arguments != ui->argumentsEdit->text()
|| selectedExecutable.m_SteamAppID != ui->appIDOverwriteEdit->text()
|| !storedCustomOverwrite.isEmpty() != ui->newFilesModCheckBox->isChecked()
|| !storedCustomOverwrite.isEmpty() && (storedCustomOverwrite != ui->newFilesModBox->currentText())
|| selectedExecutable.m_WorkingDirectory != QDir::fromNativeSeparators(ui->workingDirEdit->text())
|| selectedExecutable.m_BinaryInfo.absoluteFilePath() != QDir::fromNativeSeparators(ui->binaryEdit->text())
|| selectedExecutable.usesOwnIcon() != ui->useAppIconCheckBox->isChecked();
@@ -294,5 +314,23 @@ void EditExecutablesDialog::on_executablesListBox_clicked(const QModelIndex &cur
ui->appIDOverwriteEdit->clear();
}
ui->useAppIconCheckBox->setChecked(selectedExecutable.usesOwnIcon());
int index = -1;
QString customOverwrite = m_Profile->setting("custom_overwrites", selectedExecutable.m_Title).toString();
if (!customOverwrite.isEmpty()) {
index = ui->newFilesModBox->findText(customOverwrite);
qDebug("find %s -> %d", qPrintable(customOverwrite), index);
}
ui->newFilesModCheckBox->setChecked(index != -1);
if (index != -1) {
ui->newFilesModBox->setCurrentIndex(index);
}
}
}
void EditExecutablesDialog::on_newFilesModCheckBox_toggled(bool checked)
{
ui->newFilesModBox->setEnabled(checked);
}
+17 -4
View File
@@ -24,11 +24,16 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QListWidgetItem>
#include <QTimer>
#include "executableslist.h"
#include "profile.h"
namespace Ui {
class EditExecutablesDialog;
}
class ModList;
/**
* @brief Dialog to manage the list of executables
**/
@@ -44,7 +49,10 @@ public:
* @param executablesList current list of executables
* @param parent parent widget
**/
explicit EditExecutablesDialog(const ExecutablesList &executablesList, QWidget *parent = 0);
explicit EditExecutablesDialog(const ExecutablesList &executablesList,
const ModList &modList,
Profile *profile,
QWidget *parent = 0);
~EditExecutablesDialog();
@@ -56,6 +64,10 @@ public:
ExecutablesList getExecutablesList() const;
void saveExecutable();
private slots:
void on_newFilesModCheckBox_toggled(bool checked);
private slots:
void on_binaryEdit_textChanged(const QString &arg1);
@@ -89,12 +101,13 @@ private:
bool executableChanged();
private:
Ui::EditExecutablesDialog *ui;
Ui::EditExecutablesDialog *ui;
QListWidgetItem *m_CurrentItem;
QListWidgetItem *m_CurrentItem;
ExecutablesList m_ExecutablesList;
ExecutablesList m_ExecutablesList;
Profile *m_Profile;
};
#endif // EDITEXECUTABLESDIALOG_H
+47 -2
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>384</width>
<height>446</height>
<width>426</width>
<height>460</height>
</rect>
</property>
<property name="windowTitle">
@@ -164,6 +164,27 @@ Right now the only case I know of where this needs to be overwritten is for the
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9" stretch="0,1">
<item>
<widget class="QCheckBox" name="newFilesModCheckBox">
<property name="toolTip">
<string>If this is enabled, new files are created in the specified mod instead of the &quot;Overwrite&quot; mod.</string>
</property>
<property name="text">
<string>Create Files in Mod instead of Overwrite (*)</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="newFilesModBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="useAppIconCheckBox">
<property name="text">
@@ -171,6 +192,13 @@ Right now the only case I know of where this needs to be overwritten is for the
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>(*) This setting is profile-specific</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@@ -235,6 +263,23 @@ Right now the only case I know of where this needs to be overwritten is for the
</item>
</layout>
</widget>
<tabstops>
<tabstop>executablesListBox</tabstop>
<tabstop>titleEdit</tabstop>
<tabstop>binaryEdit</tabstop>
<tabstop>browseButton</tabstop>
<tabstop>workingDirEdit</tabstop>
<tabstop>browseDirButton</tabstop>
<tabstop>argumentsEdit</tabstop>
<tabstop>overwriteAppIDBox</tabstop>
<tabstop>appIDOverwriteEdit</tabstop>
<tabstop>newFilesModCheckBox</tabstop>
<tabstop>newFilesModBox</tabstop>
<tabstop>useAppIconCheckBox</tabstop>
<tabstop>addButton</tabstop>
<tabstop>removeButton</tabstop>
<tabstop>closeButton</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
+33
View File
@@ -0,0 +1,33 @@
/*
Copyright (C) 2016 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 "eventfilter.h"
EventFilter::EventFilter(QObject *parent,
const EventFilter::HandlerFunc &handler)
: QObject(parent)
, m_Handler(handler)
{
}
bool EventFilter::eventFilter(QObject *obj, QEvent *event)
{
return m_Handler(obj, event);
}
@@ -1,44 +1,44 @@
/*
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 SAVEGAMEINFOWIDGETGAMEBRYO_H
#define SAVEGAMEINFOWIDGETGAMEBRYO_H
#include "savegameinfowidget.h"
#include "pluginlist.h"
class SaveGame;
class SaveGameInfoWidgetGamebryo : public SaveGameInfoWidget
{
public:
explicit SaveGameInfoWidgetGamebryo(const SaveGame *saveGame, PluginList *pluginList, QWidget *parent = 0);
virtual void setSave(const SaveGame *saveGame);
private:
PluginList *m_PluginList;
};
#endif // SAVEGAMEINFOWIDGETGAMEBRYO_H
/*
Copyright (C) 2016 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/>.
*/
#pragma once
#include <QObject>
#include <functional>
class EventFilter : public QObject {
Q_OBJECT
typedef std::function<bool (QObject*, QEvent*)> HandlerFunc;
public:
EventFilter(QObject *parent, const HandlerFunc &handler);
virtual bool eventFilter(QObject *obj , QEvent *event) override;
private:
HandlerFunc m_Handler;
};
+2 -1
View File
@@ -133,7 +133,8 @@ public:
const QString &steamAppID,
Executable::Flags flags)
{
updateExecutable(title, executableName, arguments, workingDirectory, steamAppID, Executable::AllFlags, flags);
updateExecutable(title, executableName, arguments, workingDirectory,
steamAppID, Executable::AllFlags, flags);
}
/**
+43 -26
View File
@@ -68,7 +68,10 @@ static T resolveFunction(QLibrary &lib, const char *name)
{
T temp = reinterpret_cast<T>(lib.resolve(name));
if (temp == nullptr) {
throw std::runtime_error(QObject::tr("invalid 7-zip32.dll: %1").arg(lib.errorString()).toLatin1().constData());
throw std::runtime_error(QObject::tr("invalid 7-zip32.dll: %1")
.arg(lib.errorString())
.toLatin1()
.constData());
}
return temp;
}
@@ -78,12 +81,15 @@ InstallationManager::InstallationManager()
: m_ParentWidget(nullptr)
, m_SupportedExtensions({ "zip", "rar", "7z", "fomod", "001" })
{
QLibrary archiveLib("dlls\\archive.dll");
QLibrary archiveLib(QCoreApplication::applicationDirPath()
+ "\\dlls\\archive.dll");
if (!archiveLib.load()) {
throw MyException(tr("archive.dll not loaded: \"%1\"").arg(archiveLib.errorString()));
throw MyException(
tr("archive.dll not loaded: \"%1\"").arg(archiveLib.errorString()));
}
CreateArchiveType CreateArchiveFunc = resolveFunction<CreateArchiveType>(archiveLib, "CreateArchive");
CreateArchiveType CreateArchiveFunc
= resolveFunction<CreateArchiveType>(archiveLib, "CreateArchive");
m_ArchiveHandler = CreateArchiveFunc();
if (!m_ArchiveHandler->isValid()) {
@@ -91,7 +97,6 @@ InstallationManager::InstallationManager()
}
}
InstallationManager::~InstallationManager()
{
delete m_ArchiveHandler;
@@ -111,10 +116,10 @@ void InstallationManager::setURL(QString const &url)
void InstallationManager::queryPassword(QString *password)
{
*password = QInputDialog::getText(nullptr, tr("Password required"), tr("Password"), QLineEdit::Password);
*password = QInputDialog::getText(nullptr, tr("Password required"),
tr("Password"), QLineEdit::Password);
}
void InstallationManager::mapToArchive(const DirectoryTree::Node *node, QString path, FileData * const *data)
{
if (path.length() > 0) {
@@ -341,7 +346,8 @@ DirectoryTree *InstallationManager::createFilesTree()
// to uncheck all files in a directory while keeping the dir checked. Those directories are
// currently not installed.
DirectoryTree::Node *newNode = new DirectoryTree::Node;
newNode->setData(DirectoryTreeInformation(*componentIter, i));
newNode->setData(
DirectoryTreeInformation(*componentIter, static_cast<int>(i)));
currentNode->addNode(newNode, false);
currentNode = newNode;
} else {
@@ -633,13 +639,14 @@ void InstallationManager::postInstallCleanup()
m_TempFilesToDelete.clear();
// try to delete each directory we had temporary files in. the call fails for non-empty directories which is ok
foreach (const QString &dir, directoriesToRemove) {
for (const QString &dir : directoriesToRemove) {
QDir().rmdir(dir);
}
}
bool InstallationManager::install(const QString &fileName, GuessedValue<QString> &modName, bool &hasIniTweaks)
bool InstallationManager::install(const QString &fileName,
GuessedValue<QString> &modName,
bool &hasIniTweaks)
{
QFileInfo fileInfo(fileName);
if (m_SupportedExtensions.find(fileInfo.suffix()) == m_SupportedExtensions.end()) {
@@ -667,7 +674,8 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString>
version = metaFile.value("version", "").toString();
newestVersion = metaFile.value("newestVersion", "").toString();
unsigned int categoryIndex = CategoryFactory::instance().resolveNexusID(metaFile.value("category", 0).toInt());
unsigned int categoryIndex = CategoryFactory::instance().resolveNexusID(
metaFile.value("category", 0).toInt());
categoryID = CategoryFactory::instance().getCategoryID(categoryIndex);
repository = metaFile.value("repository", "").toString();
}
@@ -718,7 +726,7 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString>
return LHS->priority() > RHS->priority();
});
foreach (IPluginInstaller *installer, m_Installers) {
for (IPluginInstaller *installer : m_Installers) {
// don't use inactive installers (installer can't be null here but vc static code analysis thinks it could)
if ((installer == nullptr) || !installer->isActive()) {
continue;
@@ -735,14 +743,18 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString>
try {
{ // simple case
IPluginInstallerSimple *installerSimple = dynamic_cast<IPluginInstallerSimple*>(installer);
if ((installerSimple != nullptr) &&
(filesTree != nullptr) && (installer->isArchiveSupported(*filesTree))) {
installResult = installerSimple->install(modName, *filesTree, version, modID);
IPluginInstallerSimple *installerSimple
= dynamic_cast<IPluginInstallerSimple *>(installer);
if ((installerSimple != nullptr) && (filesTree != nullptr)
&& (installer->isArchiveSupported(*filesTree))) {
installResult
= installerSimple->install(modName, *filesTree, version, modID);
if (installResult == IPluginInstaller::RESULT_SUCCESS) {
mapToArchive(filesTree.data());
// the simple installer only prepares the installation, the rest works the same for all installers
if (!doInstall(modName, modID, version, newestVersion, categoryID, repository)) {
// the simple installer only prepares the installation, the rest
// works the same for all installers
if (!doInstall(modName, modID, version, newestVersion, categoryID,
repository)) {
installResult = IPluginInstaller::RESULT_FAILED;
}
}
@@ -750,13 +762,18 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString>
}
{ // custom case
IPluginInstallerCustom *installerCustom = dynamic_cast<IPluginInstallerCustom*>(installer);
if ((installerCustom != nullptr) &&
(((filesTree != nullptr) && installer->isArchiveSupported(*filesTree)) ||
((filesTree == nullptr) && installerCustom->isArchiveSupported(fileName)))) {
std::set<QString> installerExtensions = installerCustom->supportedExtensions();
if (installerExtensions.find(fileInfo.suffix()) != installerExtensions.end()) {
installResult = installerCustom->install(modName, fileName, version, modID);
IPluginInstallerCustom *installerCustom
= dynamic_cast<IPluginInstallerCustom *>(installer);
if ((installerCustom != nullptr)
&& (((filesTree != nullptr)
&& installer->isArchiveSupported(*filesTree))
|| ((filesTree == nullptr)
&& installerCustom->isArchiveSupported(fileName)))) {
std::set<QString> installerExt
= installerCustom->supportedExtensions();
if (installerExt.find(fileInfo.suffix()) != installerExt.end()) {
installResult
= installerCustom->install(modName, fileName, version, modID);
unsigned int idx = ModInfo::getIndex(modName);
if (idx != UINT_MAX) {
ModInfo::Ptr info = ModInfo::getByIndex(idx);

Some files were not shown because too many files have changed in this diff Show More