summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Tanner <trtanner@btinternet.com>2016-01-24 18:10:25 +0000
committerThomas Tanner <trtanner@btinternet.com>2016-01-24 18:10:25 +0000
commit0e9a86ebfc1a97742d0812a7b6ae8bb7f4662673 (patch)
treef900f46ac4f14f8635533279bd434b06e6f3a94e /src
parente90fbb1df211513ee2176aee136fbc387750bbc2 (diff)
parent8da9ba5404f51521b3425b6213e8139189dbca69 (diff)
Merge branch 'master' into issue/418
# Conflicts: # SConstruct # src/organizerproxy.cpp
Diffstat (limited to 'src')
-rw-r--r--src/downloadmanager.cpp4
-rw-r--r--src/mainwindow.cpp12
-rw-r--r--src/modinfo.cpp6
-rw-r--r--src/nexusinterface.cpp12
-rw-r--r--src/organizercore.cpp8
-rw-r--r--src/organizerproxy.cpp2
-rw-r--r--src/pluginlist.cpp6
-rw-r--r--src/profile.cpp2
-rw-r--r--src/selfupdater.cpp40
-rw-r--r--src/selfupdater.h17
-rw-r--r--src/settings.cpp2
11 files changed, 68 insertions, 43 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index c551e590..e327e55a 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -450,7 +450,7 @@ void DownloadManager::addNXMDownload(const QString &url)
{
NXMUrl nxmInfo(url);
- QString managedGame = m_ManagedGame->getGameShortName();
+ QString managedGame = m_ManagedGame->gameShortName();
qDebug("add nxm download: %s", qPrintable(url));
if (nxmInfo.game().compare(managedGame, Qt::CaseInsensitive) != 0) {
qDebug("download requested for wrong game (game: %s, url: %s)", qPrintable(managedGame), qPrintable(nxmInfo.game()));
@@ -1247,7 +1247,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;
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4d608d59..096ce94b 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1285,7 +1285,7 @@ QDir MainWindow::currentSavesDir() const
L"General", L"SLocalSavePath", L"Saves",
path, MAX_PATH,
ToWString(m_OrganizerCore.currentProfile()->absolutePath() + "/" +
- m_OrganizerCore.managedGame()->getIniFiles()[0]).c_str());
+ m_OrganizerCore.managedGame()->iniFiles()[0]).c_str());
savesDir.setPath(m_OrganizerCore.managedGame()->documentsDirectory().absoluteFilePath(QString::fromWCharArray(path)));
}
@@ -3812,7 +3812,7 @@ void MainWindow::on_actionEndorseMO_triggered()
NexusInterface::instance()->getGameURL()),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
NexusInterface::instance()->requestToggleEndorsement(
- m_OrganizerCore.managedGame()->getNexusModOrganizerID(), true, this, QVariant(), QString());
+ m_OrganizerCore.managedGame()->nexusModOrganizerID(), true, this, QVariant(), QString());
}
}
@@ -3876,7 +3876,7 @@ void MainWindow::nxmUpdatesAvailable(const std::vector<int> &modIDs, QVariant us
QVariantList resultList = resultData.toList();
for (auto iter = resultList.begin(); iter != resultList.end(); ++iter) {
QVariantMap result = iter->toMap();
- if (result["id"].toInt() == m_OrganizerCore.managedGame()->getNexusModOrganizerID()) {
+ if (result["id"].toInt() == m_OrganizerCore.managedGame()->nexusModOrganizerID()) {
if (!result["voted_by_user"].toBool()) {
ui->actionEndorseMO->setVisible(true);
}
@@ -4392,7 +4392,7 @@ void MainWindow::on_bossButton_clicked()
parameters << "--unattended"
<< "--stdout"
<< "--noreport"
- << "--game" << m_OrganizerCore.managedGame()->getGameShortName()
+ << "--game" << m_OrganizerCore.managedGame()->gameShortName()
<< "--gamePath" << QString("\"%1\"").arg(m_OrganizerCore.managedGame()->gameDirectory().absolutePath())
<< "--out" << outPath;
@@ -4526,12 +4526,12 @@ void MainWindow::on_bossButton_clicked()
// if the game specifies load order by file time, our own load order file needs to be removed because it's outdated.
// refreshESPList will then use the file time as the load order.
- if (m_OrganizerCore.managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
+ if (m_OrganizerCore.managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
qDebug("removing loadorder.txt");
QFile::remove(m_OrganizerCore.currentProfile()->getLoadOrderFileName());
}
m_OrganizerCore.refreshESPList();
- if (m_OrganizerCore.managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
+ if (m_OrganizerCore.managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
// the load order should have been retrieved from file time, now save it to our own format
m_OrganizerCore.savePluginList();
}
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 8bc767c5..1081daf8 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -220,8 +220,8 @@ void ModInfo::updateFromDisc(const QString &modDirectory,
}
{ // list plugins in the data directory and make a foreign-managed mod out of each
- QStringList dlcPlugins = game->getDLCPlugins();
- QStringList mainPlugins = game->getPrimaryPlugins();
+ QStringList dlcPlugins = game->DLCPlugins();
+ QStringList mainPlugins = game->primaryPlugins();
QDir dataDir(game->dataDirectory());
for (const QString &file : dataDir.entryList({ "*.esp", "*.esm" })) {
if (std::find_if(mainPlugins.begin(), mainPlugins.end(),
@@ -291,7 +291,7 @@ int ModInfo::checkAllForUpdate(QObject *receiver)
//I ought to store this, it's used elsewhere
IPluginGame const *game = qApp->property("managed_game").value<IPluginGame const *>();
- modIDs.push_back(game->getNexusModOrganizerID());
+ modIDs.push_back(game->nexusModOrganizerID());
for (const ModInfo::Ptr &mod : s_Collection) {
if (mod->canBeUpdated()) {
diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp
index 26a74ef6..d0eb58a6 100644
--- a/src/nexusinterface.cpp
+++ b/src/nexusinterface.cpp
@@ -250,12 +250,12 @@ bool NexusInterface::isURLGameRelated(const QUrl &url) const
QString NexusInterface::getGameURL() const
{
- return "http://www.nexusmods.com/" + m_Game->getGameShortName().toLower();
+ return "http://www.nexusmods.com/" + m_Game->gameShortName().toLower();
}
QString NexusInterface::getOldModsURL() const
{
- return "http://" + m_Game->getGameShortName().toLower() + ".nexusmods.com/mods";
+ return "http://" + m_Game->gameShortName().toLower() + ".nexusmods.com/mods";
}
@@ -593,7 +593,7 @@ void NexusInterface::managedGameChanged(IPluginGame const *game)
namespace {
QString get_management_url(MOBase::IPluginGame const *game)
{
- return "http://nmm.nexusmods.com/" + game->getGameShortName().toLower();
+ return "http://nmm.nexusmods.com/" + game->gameShortName().toLower();
}
}
@@ -613,7 +613,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(int modID
, m_ID(s_NextID.fetchAndAddAcquire(1))
, m_URL(get_management_url(game))
, m_SubModule(subModule)
- , m_NexusGameID(game->getNexusGameID())
+ , m_NexusGameID(game->nexusGameID())
, m_Endorse(false)
{}
@@ -634,7 +634,7 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(std::vector<int> modIDList
, m_ID(s_NextID.fetchAndAddAcquire(1))
, m_URL(get_management_url(game))
, m_SubModule(subModule)
- , m_NexusGameID(game->getNexusGameID())
+ , m_NexusGameID(game->nexusGameID())
, m_Endorse(false)
{}
@@ -655,6 +655,6 @@ NexusInterface::NXMRequestInfo::NXMRequestInfo(int modID
, m_ID(s_NextID.fetchAndAddAcquire(1))
, m_URL(get_management_url(game))
, m_SubModule(subModule)
- , m_NexusGameID(game->getNexusGameID())
+ , m_NexusGameID(game->nexusGameID())
, m_Endorse(false)
{}
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index e92ecb97..cee367b0 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -414,8 +414,8 @@ void OrganizerCore::connectPlugins(PluginContainer *container)
}
//Do this the hard way
for (const IPluginGame * const game : container->plugins<IPluginGame>()) {
- QString n = game->getGameShortName();
- if (game->getGameShortName() == "Skyrim") {
+ QString n = game->gameShortName();
+ if (game->gameShortName() == "Skyrim") {
m_Updater.setNexusDownload(game);
break;
}
@@ -955,12 +955,12 @@ void OrganizerCore::spawnBinary(const QFileInfo &binary, const QString &argument
refreshDirectoryStructure();
// need to remove our stored load order because it may be outdated if a foreign tool changed the
// file time. After removing that file, refreshESPList will use the file time as the order
- if (managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
+ if (managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
qDebug("removing loadorder.txt");
QFile::remove(m_CurrentProfile->getLoadOrderFileName());
}
refreshESPList();
- if (managedGame()->getLoadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
+ if (managedGame()->loadOrderMechanism() == IPluginGame::LoadOrderMechanism::FileTime) {
// the load order should have been retrieved from file time, now save it to our own format
savePluginList();
}
diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp
index de1b6d03..b6dbd242 100644
--- a/src/organizerproxy.cpp
+++ b/src/organizerproxy.cpp
@@ -167,7 +167,7 @@ MOBase::IModList *OrganizerProxy::modList() const
return m_Proxied->modList();
}
-IProfile *OrganizerProxy::profile() const
+MOBase::IProfile *OrganizerProxy::profile() const
{
return m_Proxied->currentProfile();
}
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp
index 7a609374..bf5a09dc 100644
--- a/src/pluginlist.cpp
+++ b/src/pluginlist.cpp
@@ -127,7 +127,7 @@ void PluginList::refresh(const QString &profileName
m_ESPsByPriority.clear();
m_ESPs.clear();
- QStringList primaryPlugins = m_GamePlugin->getPrimaryPlugins();
+ QStringList primaryPlugins = m_GamePlugin->primaryPlugins();
m_CurrentProfile = profileName;
@@ -312,7 +312,7 @@ bool PluginList::readLoadOrder(const QString &fileName)
int priority = 0;
- QStringList primaryPlugins = m_GamePlugin->getPrimaryPlugins();
+ QStringList primaryPlugins = m_GamePlugin->primaryPlugins();
for (const QString &plugin : primaryPlugins) {
if (availableESPs.find(plugin) != availableESPs.end()) {
m_ESPLoadOrder[plugin] = priority++;
@@ -503,7 +503,7 @@ void PluginList::saveTo(const QString &pluginFileName
bool PluginList::saveLoadOrder(DirectoryEntry &directoryStructure)
{
- if (m_GamePlugin->getLoadOrderMechanism() != IPluginGame::LoadOrderMechanism::FileTime) {
+ if (m_GamePlugin->loadOrderMechanism() != IPluginGame::LoadOrderMechanism::FileTime) {
// nothing to do
return true;
}
diff --git a/src/profile.cpp b/src/profile.cpp
index b0b8db46..21fb0b7a 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -684,7 +684,7 @@ QString Profile::getDeleterFileName() const
QString Profile::getIniFileName() const
{
- return m_Directory.absoluteFilePath(m_GamePlugin->getIniFiles()[0]);
+ return m_Directory.absoluteFilePath(m_GamePlugin->iniFiles()[0]);
}
QString Profile::getProfileTweaks() const
diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp
index 11478fbc..bc8908bc 100644
--- a/src/selfupdater.cpp
+++ b/src/selfupdater.cpp
@@ -19,6 +19,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "selfupdater.h"
+#include "archive.h"
+#include "callback.h"
#include "utility.h"
#include "installationmanager.h"
#include "iplugingame.h"
@@ -30,15 +32,36 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <report.h>
#include <util.h>
+#include <QApplication>
+#include <QCoreApplication>
+#include <QDir>
+#include <QFileInfo>
+#include <QLibrary>
#include <QMessageBox>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
-#include <QDir>
-#include <QLibrary>
+#include <QNetworkReply>
#include <QProcess>
-#include <QApplication>
+#include <QProgressDialog>
+#include <QRegExp>
+#include <QStringList>
+#include <QTimer>
+#include <QUrl>
+#include <QVariantList>
+#include <QVariantMap>
+
+#include <Qt>
+#include <QtDebug>
+#include <QtAlgorithms>
+
#include <boost/bind.hpp>
+#include <Windows.h> //for VS_FIXEDFILEINFO, GetLastError
+
+#include <exception>
+#include <map>
+#include <stddef.h> //for size_t
+#include <stdexcept>
using namespace MOBase;
using namespace MOShared;
@@ -77,8 +100,6 @@ SelfUpdater::SelfUpdater(NexusInterface *nexusInterface)
throw MyException(InstallationManager::getErrorString(m_ArchiveHandler->getLastError()));
}
- connect(m_Progress, SIGNAL(canceled()), this, SLOT(downloadCancel()));
-
VS_FIXEDFILEINFO version = GetFileVersion(ToWString(QApplication::applicationFilePath()));
m_MOVersion = VersionInfo(version.dwFileVersionMS >> 16,
@@ -105,7 +126,7 @@ void SelfUpdater::testForUpdate()
}
if (m_UpdateRequestID == -1 && m_NexusDownload != nullptr) {
m_UpdateRequestID = m_Interface->requestDescription(
- m_NexusDownload->getNexusModOrganizerID(), this, QVariant(),
+ m_NexusDownload->nexusModOrganizerID(), this, QVariant(),
QString(), m_NexusDownload);
}
}
@@ -123,7 +144,7 @@ void SelfUpdater::startUpdate()
if (QMessageBox::question(m_Parent, tr("Update"),
tr("An update is available (newest version: %1), do you want to install it?").arg(m_NewestVersion),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- m_UpdateRequestID = m_Interface->requestFiles(m_NexusDownload->getNexusModOrganizerID(),
+ m_UpdateRequestID = m_Interface->requestFiles(m_NexusDownload->nexusModOrganizerID(),
this, m_NewestVersion, "",
m_NexusDownload);
}
@@ -135,6 +156,7 @@ void SelfUpdater::showProgress()
{
if (m_Progress == nullptr) {
m_Progress = new QProgressDialog(m_Parent, Qt::Dialog);
+ connect(m_Progress, SIGNAL(canceled()), this, SLOT(downloadCancel()));
}
m_Progress->setModal(true);
m_Progress->show();
@@ -416,7 +438,7 @@ void SelfUpdater::nxmFilesAvailable(int, QVariant userData, QVariant resultData,
if (updateFileID != -1) {
qDebug("update available: %d", updateFileID);
- m_UpdateRequestID = m_Interface->requestDownloadURL(m_NexusDownload->getNexusModOrganizerID(),
+ m_UpdateRequestID = m_Interface->requestDownloadURL(m_NexusDownload->nexusModOrganizerID(),
updateFileID, this, updateFileName, "",
m_NexusDownload);
} else if (mainFileID != -1) {
@@ -425,7 +447,7 @@ void SelfUpdater::nxmFilesAvailable(int, QVariant userData, QVariant resultData,
tr("No incremental update available for this version, "
"the complete package needs to be downloaded (%1 kB)").arg(mainFileSize),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
- m_UpdateRequestID = m_Interface->requestDownloadURL(m_NexusDownload->getNexusModOrganizerID(),
+ m_UpdateRequestID = m_Interface->requestDownloadURL(m_NexusDownload->nexusModOrganizerID(),
mainFileID, this, mainFileName, "",
m_NexusDownload);
}
diff --git a/src/selfupdater.h b/src/selfupdater.h
index 446778fb..37021b42 100644
--- a/src/selfupdater.h
+++ b/src/selfupdater.h
@@ -21,17 +21,20 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define SELFUPDATER_H
-#include <archive.h>
#include <versioninfo.h>
-#include <QObject>
-#include <QNetworkReply>
-#include <QFile>
-#include <QProgressDialog>
-
+class Archive;
+class NexusInterface;
namespace MOBase { class IPluginGame; }
-class NexusInterface;
+#include <QFile>
+#include <QObject>
+#include <QString>
+#include <QVariant>
+#include <QtGlobal> //for qint64
+
+class QNetworkReply;
+class QProgressDialog;
/**
diff --git a/src/settings.cpp b/src/settings.cpp
index d493be1d..7b812759 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -107,7 +107,7 @@ void Settings::registerAsNXMHandler(bool force)
std::wstring nxmPath = ToWString(QCoreApplication::applicationDirPath() + "/nxmhandler.exe");
std::wstring executable = ToWString(QCoreApplication::applicationFilePath());
std::wstring mode = force ? L"forcereg" : L"reg";
- std::wstring parameters = mode + L" " + m_GamePlugin->getGameShortName().toStdWString() + L" \"" + executable + L"\"";
+ std::wstring parameters = mode + L" " + m_GamePlugin->gameShortName().toStdWString() + L" \"" + executable + L"\"";
HINSTANCE res = ::ShellExecuteW(nullptr, L"open", nxmPath.c_str(), parameters.c_str(), nullptr, SW_SHOWNORMAL);
if ((int)res <= 32) {
QMessageBox::critical(nullptr, tr("Failed"),