summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2015-01-24 19:34:12 +0100
committerTannin <devnull@localhost>2015-01-24 19:34:12 +0100
commitc3a95bdef1d989a54684b966e042b12bf682046d (patch)
tree83a09ca9252b9d5a060acb415b8c3c0923cfe2c3 /src
parent9edc39633b82b5e02d33c4b0a395fe110af28eb4 (diff)
parentf756aede08edb315ebe5882098191ebfe971fd81 (diff)
Merge with branch1.2
Diffstat (limited to 'src')
-rw-r--r--src/browserdialog.cpp1
-rw-r--r--src/browserdialog.h3
-rw-r--r--src/browserview.h1
-rw-r--r--src/downloadlistsortproxy.cpp1
-rw-r--r--src/downloadlistsortproxy.h4
-rw-r--r--src/downloadlistwidget.cpp1
-rw-r--r--src/downloadlistwidget.h3
-rw-r--r--src/downloadlistwidgetcompact.cpp1
-rw-r--r--src/downloadmanager.cpp6
-rw-r--r--src/downloadmanager.h4
-rw-r--r--src/executableslist.cpp4
-rw-r--r--src/helper.cpp23
-rw-r--r--src/helper.h9
-rw-r--r--src/installationmanager.cpp5
-rw-r--r--src/main.cpp6
-rw-r--r--src/mainwindow.cpp108
-rw-r--r--src/mainwindow.h2
-rw-r--r--src/modinfo.cpp7
-rw-r--r--src/modinfo.h4
-rw-r--r--src/modinfodialog.cpp3
-rw-r--r--src/modinfodialog.h3
-rw-r--r--src/modlist.cpp12
-rw-r--r--src/modlist.h2
-rw-r--r--src/modlistsortproxy.cpp38
-rw-r--r--src/nexusinterface.cpp1
-rw-r--r--src/nexusinterface.h3
-rw-r--r--src/overwriteinfodialog.ui5
-rw-r--r--src/pluginlist.cpp6
-rw-r--r--src/pluginlistsortproxy.cpp4
-rw-r--r--src/profile.cpp13
-rw-r--r--src/profilesdialog.cpp1
-rw-r--r--src/qtgroupingproxy.cpp2
-rw-r--r--src/savegamegamebryo.cpp10
-rw-r--r--src/savegameinfowidget.cpp1
-rw-r--r--src/savegameinfowidget.h3
-rw-r--r--src/savegameinfowidgetgamebryo.cpp1
-rw-r--r--src/savegameinfowidgetgamebryo.h3
-rw-r--r--src/selfupdater.cpp5
-rw-r--r--src/selfupdater.h3
-rw-r--r--src/settings.cpp12
-rw-r--r--src/shared/directoryentry.cpp11
-rw-r--r--src/shared/directoryentry.h5
-rw-r--r--src/shared/inject.cpp5
-rw-r--r--src/shared/stackdata.cpp8
-rw-r--r--src/shared/util.cpp68
-rw-r--r--src/shared/util.h7
-rw-r--r--src/spawn.cpp6
-rw-r--r--src/transfersavesdialog.cpp1
-rw-r--r--src/transfersavesdialog.h3
49 files changed, 195 insertions, 243 deletions
diff --git a/src/browserdialog.cpp b/src/browserdialog.cpp
index 1401b941..c382c112 100644
--- a/src/browserdialog.cpp
+++ b/src/browserdialog.cpp
@@ -19,6 +19,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "browserdialog.h"
#include "ui_browserdialog.h"
+#include "browserview.h"
#include "messagedialog.h"
#include "report.h"
diff --git a/src/browserdialog.h b/src/browserdialog.h
index 680f5c03..04567f5f 100644
--- a/src/browserdialog.h
+++ b/src/browserdialog.h
@@ -20,8 +20,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#ifndef BROWSERDIALOG_H
#define BROWSERDIALOG_H
-#include "browserview.h"
-#include "tutorialcontrol.h"
#include <QDialog>
#include <QNetworkRequest>
#include <QNetworkReply>
@@ -36,6 +34,7 @@ namespace Ui {
class BrowserDialog;
}
+class BrowserView;
/**
* @brief a dialog containing a webbrowser that is intended to browse the nexus network
diff --git a/src/browserview.h b/src/browserview.h
index 4f002ffc..f8b132b8 100644
--- a/src/browserview.h
+++ b/src/browserview.h
@@ -20,7 +20,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#ifndef NEXUSVIEW_H
#define NEXUSVIEW_H
-#include "finddialog.h"
#include <QWebView>
#include <QWebPage>
diff --git a/src/downloadlistsortproxy.cpp b/src/downloadlistsortproxy.cpp
index 31deba0b..59d7bce6 100644
--- a/src/downloadlistsortproxy.cpp
+++ b/src/downloadlistsortproxy.cpp
@@ -19,6 +19,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "downloadlistsortproxy.h"
#include "downloadlist.h"
+#include "downloadmanager.h"
DownloadListSortProxy::DownloadListSortProxy(const DownloadManager *manager, QObject *parent)
: QSortFilterProxyModel(parent), m_Manager(manager), m_CurrentFilter()
diff --git a/src/downloadlistsortproxy.h b/src/downloadlistsortproxy.h
index e2c1bfb6..71ac7e56 100644
--- a/src/downloadlistsortproxy.h
+++ b/src/downloadlistsortproxy.h
@@ -22,7 +22,9 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QSortFilterProxyModel>
-#include "downloadmanager.h"
+
+
+class DownloadManager;
class DownloadListSortProxy : public QSortFilterProxyModel
diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp
index 2a398bc0..78bdf1aa 100644
--- a/src/downloadlistwidget.cpp
+++ b/src/downloadlistwidget.cpp
@@ -19,7 +19,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "downloadlistwidget.h"
#include "ui_downloadlistwidget.h"
-#include "downloadmanager.h"
#include <QPainter>
#include <QMouseEvent>
#include <QMenu>
diff --git a/src/downloadlistwidget.h b/src/downloadlistwidget.h
index a8e702e3..c1dfe4cd 100644
--- a/src/downloadlistwidget.h
+++ b/src/downloadlistwidget.h
@@ -20,14 +20,13 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#ifndef DOWNLOADLISTWIDGET_H
#define DOWNLOADLISTWIDGET_H
+#include "downloadmanager.h"
#include <QWidget>
#include <QItemDelegate>
#include <QLabel>
#include <QProgressBar>
#include <QTreeView>
-#include "downloadmanager.h"
-
namespace Ui {
class DownloadListWidget;
}
diff --git a/src/downloadlistwidgetcompact.cpp b/src/downloadlistwidgetcompact.cpp
index a298494a..e37d5ef5 100644
--- a/src/downloadlistwidgetcompact.cpp
+++ b/src/downloadlistwidgetcompact.cpp
@@ -24,7 +24,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QMenu>
#include <QMessageBox>
#include <QSortFilterProxyModel>
-#include "downloadmanager.h"
DownloadListWidgetCompact::DownloadListWidgetCompact(QWidget *parent) :
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 1d141656..b5bc8148 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -20,6 +20,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "downloadmanager.h"
#include "report.h"
#include "nxmurl.h"
+#include "nexusinterface.h"
+#include "nxmaccessmanager.h"
#include <gameinfo.h>
#include <nxmurl.h>
#include <taskprogressmanager.h>
@@ -1082,7 +1084,7 @@ QDateTime DownloadManager::matchDate(const QString &timeString)
}
-EFileCategory convertFileCategory(int id)
+static EFileCategory convertFileCategory(int id)
{
// TODO: need to handle file categories in the mod page plugin
switch (id) {
@@ -1200,7 +1202,7 @@ void DownloadManager::nxmFileInfoAvailable(int modID, int fileID, QVariant userD
m_RequestIDs.insert(m_NexusInterface->requestDownloadURL(modID, fileID, this, qVariantFromValue(test), QString()));
}
-int evaluateFileInfoMap(const QVariantMap &map, const std::map<QString, int> &preferredServers)
+static int evaluateFileInfoMap(const QVariantMap &map, const std::map<QString, int> &preferredServers)
{
int result = 0;
diff --git a/src/downloadmanager.h b/src/downloadmanager.h
index 52da27b8..c077ae79 100644
--- a/src/downloadmanager.h
+++ b/src/downloadmanager.h
@@ -20,8 +20,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#ifndef DOWNLOADMANAGER_H
#define DOWNLOADMANAGER_H
-#include "nexusinterface.h"
#include <idownloadmanager.h>
+#include <modrepositoryfileinfo.h>
#include <set>
#include <QObject>
#include <QUrl>
@@ -36,6 +36,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QSettings>
+class NexusInterface;
+
/*!
* \brief manages downloading of files and provides progress information for gui elements
**/
diff --git a/src/executableslist.cpp b/src/executableslist.cpp
index 65a2ea80..35bb30ae 100644
--- a/src/executableslist.cpp
+++ b/src/executableslist.cpp
@@ -29,7 +29,7 @@ using namespace MOBase;
using namespace MOShared;
-QDataStream &operator<<(QDataStream &out, const Executable &obj)
+static QDataStream &operator<<(QDataStream &out, const Executable &obj)
{
out << obj.m_Title
<< obj.m_BinaryInfo.absoluteFilePath()
@@ -42,7 +42,7 @@ QDataStream &operator<<(QDataStream &out, const Executable &obj)
return out;
}
-QDataStream &operator>>(QDataStream &in, Executable &obj)
+static QDataStream &operator>>(QDataStream &in, Executable &obj)
{
QString binaryTemp;
int closeStyleTemp;
diff --git a/src/helper.cpp b/src/helper.cpp
index f47a468a..4c22dbda 100644
--- a/src/helper.cpp
+++ b/src/helper.cpp
@@ -31,7 +31,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
namespace Helper {
-bool helperExec(LPCWSTR moDirectory, LPCWSTR commandLine)
+static bool helperExec(LPCWSTR moDirectory, LPCWSTR commandLine)
{
wchar_t fileName[MAX_PATH];
_snwprintf(fileName, MAX_PATH, L"%ls\\helper.exe", moDirectory);
@@ -81,27 +81,6 @@ bool init(const std::wstring &moDirectory)
}
-bool setNXMHandler(const std::wstring &moDirectory, bool enable)
-{
- DWORD userNameLen = UNLEN + 1;
- wchar_t userName[UNLEN + 1];
-
- if (!GetUserName(userName, &userNameLen)) {
- reportError(QObject::tr("failed to determine account name"));
- return false;
- }
-
- wchar_t *commandLine = new wchar_t[32768];
- _snwprintf(commandLine, 32768, L"handleNXM \"%ls\" %d",
- moDirectory.c_str(), enable ? 1 : 0);
-
- bool res = helperExec(moDirectory.c_str(), commandLine);
- delete [] commandLine;
-
- return res;
-}
-
-
bool backdateBSAs(const std::wstring &moDirectory, const std::wstring &dataPath)
{
wchar_t *commandLine = new wchar_t[32768];
diff --git a/src/helper.h b/src/helper.h
index 0144c39f..36f10db1 100644
--- a/src/helper.h
+++ b/src/helper.h
@@ -44,15 +44,6 @@ namespace Helper {
bool init(const std::wstring &moDirectory);
/**
- * @brief set or unset the current instance of ModOrganizer as the global handler for nxm links
- *
- * @param moDirectory absolute path to the modOrganizer base directory
- * @param enable if true, ModOrganizer will become the handler for nxm links. If false, the nxm handler will be unset
- * @return true on success
- **/
-bool setNXMHandler(const std::wstring &moDirectory, bool enable);
-
-/**
* @brief sets the last modified time for all .bsa-files in the target directory well into the past
* @param moDirectory absolute path to the modOrganizer base directory
* @param dataPath the path taht contains the .bsa-files, usually the data directory of the game
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp
index 7c54828e..6101cf39 100644
--- a/src/installationmanager.cpp
+++ b/src/installationmanager.cpp
@@ -58,7 +58,8 @@ typedef Archive* (*CreateArchiveType)();
-template <typename T> T resolveFunction(QLibrary &lib, const char *name)
+template <typename T>
+static T resolveFunction(QLibrary &lib, const char *name)
{
T temp = reinterpret_cast<T>(lib.resolve(name));
if (temp == nullptr) {
@@ -200,7 +201,7 @@ QString InstallationManager::extractFile(const QString &fileName)
}
-QString canonicalize(const QString &name)
+static QString canonicalize(const QString &name)
{
QString result(name);
if ((result.startsWith('/')) ||
diff --git a/src/main.cpp b/src/main.cpp
index 92ebf8bc..a048d50d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -149,7 +149,7 @@ bool isNxmLink(const QString &link)
return link.left(6).toLower() == "nxm://";
}
-LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs)
+static LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs)
{
typedef BOOL (WINAPI *FuncMiniDumpWriteDump)(HANDLE process, DWORD pid, HANDLE file, MINIDUMP_TYPE dumpType,
const PMINIDUMP_EXCEPTION_INFORMATION exceptionParam,
@@ -211,12 +211,12 @@ LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *exceptionPtrs
return result;
}
-void registerMetaTypes()
+static void registerMetaTypes()
{
registerExecutable();
}
-bool HaveWriteAccess(const std::wstring &path)
+static bool HaveWriteAccess(const std::wstring &path)
{
bool writable = false;
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 594849f2..50a07b75 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -60,6 +60,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "aboutdialog.h"
#include "safewritefile.h"
#include "organizerproxy.h"
+#include "nxmaccessmanager.h
#include <archive.h>
#include <gameinfo.h>
#include <appconfig.h>
@@ -138,15 +139,16 @@ using namespace MOShared;
MainWindow::MainWindow(const QString &exeName
- , QSettings &initSettings
+ : QMainWindow(parent), ui(new Ui::MainWindow), m_Tutorial(this, "MainWindow"),
, OrganizerCore &organizerCore
, PluginContainer &pluginContainer
, QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
+ , m_WasVisible(false)
, m_Tutorial(this, "MainWindow")
, m_ExeName(exeName)
- , m_OldProfileIndex(-1)
+ , m_OldProfileIndex(-1),
, m_ModListGroupingProxy(nullptr)
, m_ModListSortProxy(nullptr)
, m_OldExecutableIndex(-1)
@@ -189,6 +191,8 @@ MainWindow::MainWindow(const QString &exeName
updateToolBar();
+ languageChange(m_Settings.language());
+
// set up mod list
m_ModListSortProxy = m_OrganizerCore.createModListProxyModel();
@@ -320,7 +324,6 @@ MainWindow::MainWindow(const QString &exeName
for (const QString &fileName : m_PluginContainer.pluginFileNames()) {
installTranslator(QFileInfo(fileName).baseName());
}
-
for (IPluginTool *toolPlugin : m_PluginContainer.plugins<IPluginTool>()) {
registerPluginTool(toolPlugin);
}
@@ -766,39 +769,44 @@ void MainWindow::showEvent(QShowEvent *event)
refreshFilters();
QMainWindow::showEvent(event);
- m_Tutorial.registerControl();
- hookUpWindowTutorials();
+ if (!m_WasVisible) {
+ // only the first time the window becomes visible
+ m_Tutorial.registerControl();
- if (m_OrganizerCore.settings().directInterface().value("first_start", true).toBool()) {
- QString firstStepsTutorial = ToQString(AppConfig::firstStepsTutorial());
- if (TutorialManager::instance().hasTutorial(firstStepsTutorial)) {
- if (QMessageBox::question(this, tr("Show tutorial?"),
- tr("You are starting Mod Organizer for the first time. "
- "Do you want to show a tutorial of its basic features? If you choose "
- "no you can always start the tutorial from the \"Help\"-menu."),
- QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- TutorialManager::instance().activateTutorial("MainWindow", firstStepsTutorial);
+ hookUpWindowTutorials();
+
+ if (m_OrganizerCore.settings().directInterface().value("first_start", true).toBool()) {
+ QString firstStepsTutorial = ToQString(AppConfig::firstStepsTutorial());
+ if (TutorialManager::instance().hasTutorial(firstStepsTutorial)) {
+ if (QMessageBox::question(this, tr("Show tutorial?"),
+ tr("You are starting Mod Organizer for the first time. "
+ "Do you want to show a tutorial of its basic features? If you choose "
+ "no you can always start the tutorial from the \"Help\"-menu."),
+ QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
+ TutorialManager::instance().activateTutorial("MainWindow", firstStepsTutorial);
+ }
+ } else {
+ qCritical() << firstStepsTutorial << " missing";
+ QPoint pos = ui->toolBar->mapToGlobal(QPoint());
+ pos.rx() += ui->toolBar->width() / 2;
+ pos.ry() += ui->toolBar->height();
+ QWhatsThis::showText(pos,
+ QObject::tr("Please use \"Help\" from the toolbar to get usage instructions to all elements"));
}
- } else {
- qCritical() << firstStepsTutorial << " missing";
- QPoint pos = ui->toolBar->mapToGlobal(QPoint());
- pos.rx() += ui->toolBar->width() / 2;
- pos.ry() += ui->toolBar->height();
- QWhatsThis::showText(pos,
- QObject::tr("Please use \"Help\" from the toolbar to get usage instructions to all elements"));
- }
m_OrganizerCore.settings().directInterface().setValue("first_start", false);
- }
+ }
- // this has no visible impact when called before the ui is visible
- int grouping = m_OrganizerCore.settings().directInterface().value("group_state").toInt();
- ui->groupCombo->setCurrentIndex(grouping);
+ // this has no visible impact when called before the ui is visible
+ int grouping = m_OrganizerCore.settings().directInterface().value("group_state").toInt();
+ ui->groupCombo->setCurrentIndex(grouping);
- allowListResize();
+ allowListResize();
- m_OrganizerCore.settings().registerAsNXMHandler(false);
+ m_OrganizerCore.settings().registerAsNXMHandler(false);
+ m_WasVisible = true;
+ }
}
@@ -1309,7 +1317,15 @@ static bool BySortValue(const std::pair<UINT32, QTreeWidgetItem*> &LHS, const st
return LHS.first < RHS.first;
}
-
+template <typename InputIterator>
+static QStringList toStringList(InputIterator current, InputIterator end)
+{
+ QStringList result;
+ for (; current != end; ++current) {
+ result.append(*current);
+ }
+ return result;
+}
void MainWindow::updateBSAList(const QStringList &defaultArchives, const QStringList &activeArchives)
{
m_DefaultArchives = defaultArchives;
@@ -2317,7 +2333,10 @@ void MainWindow::overwriteClosed(int)
void MainWindow::displayModInformation(ModInfo::Ptr modInfo, unsigned int index, int tab)
{
- m_OrganizerCore.modList()->modInfoAboutToChange(modInfo);
+ if (!m_OrganizerCore.modList()->modInfoAboutToChange(modInfo)) {
+ qDebug("A different mod information dialog is open. If this is incorrect, please restart MO");
+ return;
+ }
std::vector<ModInfo::EFlag> flags = modInfo->getFlags();
if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_OVERWRITE) != flags.end()) {
QDialog *dialog = this->findChild<QDialog*>("__overwriteDialog");
@@ -2914,7 +2933,7 @@ void MainWindow::exportModListCSV()
}
}
-void addMenuAsPushButton(QMenu *menu, QMenu *subMenu)
+static void addMenuAsPushButton(QMenu *menu, QMenu *subMenu)
{
QPushButton *pushBtn = new QPushButton(subMenu->title());
pushBtn->setMenu(subMenu);
@@ -3082,15 +3101,24 @@ void MainWindow::deleteSavegame_clicked()
QString savesMsgLabel;
QStringList deleteFiles;
+ int count = 0;
+
foreach (const QModelIndex &idx, selectedIndexes) {
QString name = idx.data().toString();
SaveGame *save = new SaveGame(this, idx.data(Qt::UserRole).toString());
- savesMsgLabel += "<li>" + QFileInfo(name).completeBaseName() + "</li>";
+ if (count < 10) {
+ savesMsgLabel += "<li>" + QFileInfo(name).completeBaseName() + "</li>";
+ }
+ ++count;
deleteFiles << save->saveFiles();
}
+ if (count > 10) {
+ savesMsgLabel += "<li><i>... " + tr("%1 more").arg(count - 10) + "</i></li>";
+ }
+
if (QMessageBox::question(this, tr("Confirm"), tr("Are you sure you want to remove the following %n save(s)?<br><ul>%1</ul><br>Removed saves will be sent to the Recycle Bin.", "", selectedIndexes.count())
.arg(savesMsgLabel),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
@@ -3354,6 +3382,7 @@ void MainWindow::installTranslator(const QString &name)
qWarning("localization file %s not found", qPrintable(fileName));
} // we don't actually expect localization files for english
}
+
qApp->installTranslator(translator);
m_Translators.push_back(translator);
}
@@ -3436,9 +3465,9 @@ void MainWindow::writeDataToFile()
int MainWindow::getBinaryExecuteInfo(const QFileInfo &targetInfo, QFileInfo &binaryInfo, QString &arguments)
{
QString extension = targetInfo.completeSuffix();
- if ((extension.compare("cmd", Qt::CaseInsensitive)) ||
- (extension.compare("com", Qt::CaseInsensitive)) ||
- (extension.compare("bat", Qt::CaseInsensitive))) {
+ if ((extension.compare("cmd", Qt::CaseInsensitive) == 0) ||
+ (extension.compare("com", Qt::CaseInsensitive) == 0) ||
+ (extension.compare("bat", Qt::CaseInsensitive) == 0)) {
binaryInfo = QFileInfo("C:\\Windows\\System32\\cmd.exe");
arguments = QString("/C \"%1\"").arg(QDir::toNativeSeparators(targetInfo.absoluteFilePath()));
return 1;
@@ -3452,16 +3481,17 @@ int MainWindow::getBinaryExecuteInfo(const QFileInfo &targetInfo, QFileInfo &bin
{ // try to find java automatically
WCHAR buffer[MAX_PATH];
- if (::FindExecutableW(targetPathW.c_str(), nullptr, buffer) > (HINSTANCE)32) {
- DWORD binaryType = 0UL;
- if (!::GetBinaryTypeW(targetPathW.c_str(), &binaryType)) {
- qDebug("failed to determine binary type of \"%ls\": %lu", targetPathW.c_str(), ::GetLastError());
+ if (::FindExecutableW(targetPathW.c_str(), nullptr, buffer) > (HINSTANCE)32) {
+ DWORD binaryType = 0UL;
+ if (!::GetBinaryTypeW(buffer, &binaryType)) {
+ qDebug("failed to determine binary type of \"%ls\": %lu", buffer, ::GetLastError());
} else if (binaryType == SCS_32BIT_BINARY) {
binaryPath = ToQString(buffer);
}
}
}
if (binaryPath.isEmpty() && (extension == "jar")) {
+ // second attempt: look to the registry
QSettings javaReg("HKEY_LOCAL_MACHINE\\Software\\JavaSoft\\Java Runtime Environment", QSettings::NativeFormat);
if (javaReg.contains("CurrentVersion")) {
QString currentVersion = javaReg.value("CurrentVersion").toString();
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 52c202a7..b9f93cd5 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -256,6 +256,8 @@ private:
Ui::MainWindow *ui;
+ bool m_WasVisible;
+
MOBase::TutorialControl m_Tutorial;
QString m_ExeName;
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index e956377c..b1d9bed4 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -244,7 +244,6 @@ void ModInfo::updateIndices()
{
s_ModsByName.clear();
s_ModsByModID.clear();
- QRegExp backupRegEx(".*backup[0-9]*$");
for (unsigned int i = 0; i < s_Collection.size(); ++i) {
QString modName = s_Collection[i]->internalName();
@@ -843,7 +842,7 @@ void ModInfoRegular::ignoreUpdate(bool ignore)
std::vector<ModInfo::EFlag> ModInfoRegular::getFlags() const
{
std::vector<ModInfo::EFlag> result = ModInfoWithConflictInfo::getFlags();
- if ((m_NexusID != -1) && (endorsedState() == ENDORSED_FALSE)) {
+ if ((m_NexusID > 0) && (endorsedState() == ENDORSED_FALSE)) {
result.push_back(ModInfo::FLAG_NOTENDORSED);
}
if (!isValid()) {
@@ -1044,8 +1043,6 @@ QStringList ModInfoOverwrite::archives() const
return result;
}
-const char ModInfoForeign::INT_IDENTIFIER[] = "__int__foreign";
-
QString ModInfoForeign::name() const
{
return m_Name;
@@ -1086,5 +1083,5 @@ ModInfoForeign::ModInfoForeign(const QString &referenceFile, const QStringList &
, m_Archives(archives)
{
m_CreationTime = QFileInfo(referenceFile).created();
- m_Name = tr("Unmanaged") + ": " + QFileInfo(m_ReferenceFile).baseName();
+ m_Name = "Unmanaged: " + QFileInfo(m_ReferenceFile).baseName();
}
diff --git a/src/modinfo.h b/src/modinfo.h
index 048196f7..903f474a 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -1068,10 +1068,6 @@ class ModInfoForeign : public ModInfoWithConflictInfo
public:
- static const char INT_IDENTIFIER[];
-
-public:
-
virtual bool updateAvailable() const { return false; }
virtual bool updateIgnored() const { return false; }
virtual bool downgradeAvailable() const { return false; }
diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp
index 0dfdd1f4..f1bb97c7 100644
--- a/src/modinfodialog.cpp
+++ b/src/modinfodialog.cpp
@@ -26,6 +26,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "bbcode.h"
#include "questionboxmemory.h"
#include "settings.h"
+#include "categories.h"
#include <gameinfo.h>
#include <QDir>
@@ -54,7 +55,7 @@ private:
};
-bool operator<(const ModFileListWidget &LHS, const ModFileListWidget &RHS)
+static bool operator<(const ModFileListWidget &LHS, const ModFileListWidget &RHS)
{
return LHS.m_SortValue < RHS.m_SortValue;
}
diff --git a/src/modinfodialog.h b/src/modinfodialog.h
index 652bcab6..312ff99e 100644
--- a/src/modinfodialog.h
+++ b/src/modinfodialog.h
@@ -22,7 +22,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "modinfo.h"
-#include "categories.h"
#include "tutorabledialog.h"
#include <QDialog>
@@ -45,7 +44,7 @@ namespace Ui {
class QFileSystemModel;
class QTreeView;
-
+class CategoryFactory;
/**
* this is a larger dialog used to visualise information abount the mod.
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 55344865..19c0ac8c 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -633,10 +633,15 @@ void ModList::setOverwriteMarkers(const std::set<unsigned int> &overwrite, const
notifyChange(0, rowCount());
}
-void ModList::modInfoAboutToChange(ModInfo::Ptr info)
+bool ModList::modInfoAboutToChange(ModInfo::Ptr info)
{
- m_ChangeInfo.name = info->name();
- m_ChangeInfo.state = state(info->name());
+ if (m_ChangeInfo.name.isEmpty()) {
+ m_ChangeInfo.name = info->name();
+ m_ChangeInfo.state = state(info->name());
+ return true;
+ } else {
+ return false;
+ }
}
void ModList::modInfoChanged(ModInfo::Ptr info)
@@ -652,6 +657,7 @@ void ModList::modInfoChanged(ModInfo::Ptr info)
} else {
qCritical("modInfoChanged not called after modInfoAboutToChange");
}
+ m_ChangeInfo.name = QString();
}
void ModList::disconnectSlots() {
diff --git a/src/modlist.h b/src/modlist.h
index 8dcab2fa..8475d97a 100644
--- a/src/modlist.h
+++ b/src/modlist.h
@@ -104,7 +104,7 @@ public:
void setOverwriteMarkers(const std::set<unsigned int> &overwrite, const std::set<unsigned int> &overwritten);
- void modInfoAboutToChange(ModInfo::Ptr info);
+ bool modInfoAboutToChange(ModInfo::Ptr info);
void modInfoChanged(ModInfo::Ptr info);
void disconnectSlots();
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp
index 6c24be98..9eeb3439 100644
--- a/src/modlistsortproxy.cpp
+++ b/src/modlistsortproxy.cpp
@@ -20,12 +20,12 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "modlistsortproxy.h"
#include "modinfo.h"
#include "profile.h"
-#include "modlist.h"
#include "messagedialog.h"
#include <QMenu>
#include <QCheckBox>
#include <QWidgetAction>
#include <QApplication>
+#include <QMimeData>
#include <QDebug>
#include <QTreeView>
@@ -347,23 +347,23 @@ bool ModListSortProxy::filterAcceptsRow(int row, const QModelIndex &parent) cons
bool ModListSortProxy::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent)
{
- if (sortColumn() != ModList::COL_PRIORITY) {
- QWidget *wid = qApp->activeWindow()->findChild<QTreeView*>("modList");
- MessageDialog::showMessage(tr("Drag&Drop is only supported when sorting by priority"), wid);
- return false;
- }
- if ((row == -1) && (column == -1)) {
- return this->sourceModel()->dropMimeData(data, action, -1, -1, mapToSource(parent));
- }
- // in the regular model, when dropping between rows, the row-value passed to
- // the sourceModel is inconsistent between ascending and descending ordering.
- // This should fix that
- if (sortOrder() == Qt::DescendingOrder) {
- --row;
- }
+ if (!data->hasUrls() && (sortColumn() != ModList::COL_PRIORITY)) {
+ QWidget *wid = qApp->activeWindow()->findChild<QTreeView*>("modList");
+ MessageDialog::showMessage(tr("Drag&Drop is only supported when sorting by priority"), wid);
+ return false;
+ }
+ if ((row == -1) && (column == -1)) {
+ return this->sourceModel()->dropMimeData(data, action, -1, -1, mapToSource(parent));
+ }
+ // in the regular model, when dropping between rows, the row-value passed to
+ // the sourceModel is inconsistent between ascending and descending ordering.
+ // This should fix that
+ if (sortOrder() == Qt::DescendingOrder) {
+ --row;
+ }
- QModelIndex proxyIndex = index(row, column, parent);
- QModelIndex sourceIndex = mapToSource(proxyIndex);
- return this->sourceModel()->dropMimeData(data, action, sourceIndex.row(), sourceIndex.column(),
- sourceIndex.parent());
+ QModelIndex proxyIndex = index(row, column, parent);
+ QModelIndex sourceIndex = mapToSource(proxyIndex);
+ return this->sourceModel()->dropMimeData(data, action, sourceIndex.row(), sourceIndex.column(),
+ sourceIndex.parent());
}
diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp
index bd40921f..5e29e8ee 100644
--- a/src/nexusinterface.cpp
+++ b/src/nexusinterface.cpp
@@ -19,7 +19,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "nexusinterface.h"
#include "nxmaccessmanager.h"
-#include "utility.h"
#include "json.h"
#include "selectiondialog.h"
#include <QApplication>
diff --git a/src/nexusinterface.h b/src/nexusinterface.h
index 28accd3d..c0ee50cd 100644
--- a/src/nexusinterface.h
+++ b/src/nexusinterface.h
@@ -21,7 +21,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define NEXUSINTERFACE_H
-#include "nxmaccessmanager.h"
#include <utility.h>
#include <gameinfo.h>
@@ -37,7 +36,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
class NexusInterface;
-
+class NXMAccessManager;
/**
* @brief convenience class to make nxm requests easier
diff --git a/src/overwriteinfodialog.ui b/src/overwriteinfodialog.ui
index 2c194ecf..5e5986ca 100644
--- a/src/overwriteinfodialog.ui
+++ b/src/overwriteinfodialog.ui
@@ -23,7 +23,10 @@
<bool>true</bool>
</property>
<property name="dragDropMode">
- <enum>QAbstractItemView::DragOnly</enum>
+ <enum>QAbstractItemView::DragDrop</enum>
+ </property>
+ <property name="defaultDropAction">
+ <enum>Qt::MoveAction</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp
index f0352e8a..ad177247 100644
--- a/src/pluginlist.cpp
+++ b/src/pluginlist.cpp
@@ -52,11 +52,11 @@ using namespace MOBase;
using namespace MOShared;
-bool ByName(const PluginList::ESPInfo& LHS, const PluginList::ESPInfo& RHS) {
+static bool ByName(const PluginList::ESPInfo& LHS, const PluginList::ESPInfo& RHS) {
return LHS.m_Name.toUpper() < RHS.m_Name.toUpper();
}
-bool ByPriority(const PluginList::ESPInfo& LHS, const PluginList::ESPInfo& RHS) {
+static bool ByPriority(const PluginList::ESPInfo& LHS, const PluginList::ESPInfo& RHS) {
if (LHS.m_IsMaster && !RHS.m_IsMaster) {
return true;
} else if (!LHS.m_IsMaster && RHS.m_IsMaster) {
@@ -66,7 +66,7 @@ bool ByPriority(const PluginList::ESPInfo& LHS, const PluginList::ESPInfo& RHS)
}
}
-bool ByDate(const PluginList::ESPInfo& LHS, const PluginList::ESPInfo& RHS) {
+static bool ByDate(const PluginList::ESPInfo& LHS, const PluginList::ESPInfo& RHS) {
return QFileInfo(LHS.m_FullPath).lastModified() < QFileInfo(RHS.m_FullPath).lastModified();
/* QString lhsExtension = LHS.m_Name.right(3).toLower();
QString rhsExtension = RHS.m_Name.right(3).toLower();
diff --git a/src/pluginlistsortproxy.cpp b/src/pluginlistsortproxy.cpp
index 4f840f52..8d63e2e2 100644
--- a/src/pluginlistsortproxy.cpp
+++ b/src/pluginlistsortproxy.cpp
@@ -18,7 +18,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "pluginlistsortproxy.h"
-#include "pluginlist.h"
#include "messagedialog.h"
#include <QMenu>
#include <QCheckBox>
@@ -61,9 +60,6 @@ Qt::ItemFlags PluginListSortProxy::flags(const QModelIndex &modelIndex) const
}
-
-
-
void PluginListSortProxy::updateFilter(const QString &filter)
{
m_CurrentFilter = filter;
diff --git a/src/profile.cpp b/src/profile.cpp
index 775b309e..dd6814fd 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -286,7 +286,7 @@ void Profile::refreshModStatus()
modName = QString::fromUtf8(line.trimmed().constData());
}
if (modName.size() > 0) {
- QString lookupName = modName + (line.at(0) == '*' ? ModInfoForeign::INT_IDENTIFIER : "");
+ QString lookupName = modName;
if (namesRead.find(lookupName) != namesRead.end()) {
continue;
} else {
@@ -305,14 +305,17 @@ void Profile::refreshModStatus()
m_ModStatus[modIndex].m_Priority = index++;
}
} else {
- qDebug("mod \"%s\" (profile \"%s\") not found",
- modName.toUtf8().constData(), m_Directory.path().toUtf8().constData());
+ qWarning("no mod state for \"%s\" (profile \"%s\")",
+ qPrintable(modName), m_Directory.path().toUtf8().constData());
// need to rewrite the modlist to fix this
modStatusModified = true;
}
+ } else {
+ qDebug("mod \"%s\" (profile \"%s\") not found",
+ qPrintable(modName), m_Directory.path().toUtf8().constData());
+ // need to rewrite the modlist to fix this
+ modStatusModified = true;
}
- } else {
- // line was empty after trimming
}
}
diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp
index 02566db3..c6731041 100644
--- a/src/profilesdialog.cpp
+++ b/src/profilesdialog.cpp
@@ -19,7 +19,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "profilesdialog.h"
#include "ui_profilesdialog.h"
-#include "profile.h"
#include "report.h"
#include "utility.h"
#include "transfersavesdialog.h"
diff --git a/src/qtgroupingproxy.cpp b/src/qtgroupingproxy.cpp
index 64ca5241..c5ee8591 100644
--- a/src/qtgroupingproxy.cpp
+++ b/src/qtgroupingproxy.cpp
@@ -17,7 +17,7 @@
// Modifications 2013-03-27 to 2013-03-29 by Sebastian Herbord
-#include "QtGroupingProxy.h"
+#include "qtgroupingproxy.h"
#include <QDebug>
#include <QIcon>
diff --git a/src/savegamegamebryo.cpp b/src/savegamegamebryo.cpp
index f593ef5a..7b012e22 100644
--- a/src/savegamegamebryo.cpp
+++ b/src/savegamegamebryo.cpp
@@ -18,10 +18,10 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/
#include "savegamegamebyro.h"
+#include "gameinfo.h"
#include <QFile>
#include <QBuffer>
#include <set>
-#include "gameinfo.h"
#include <QFileInfo>
#include <QDateTime>
#include <limits>
@@ -31,7 +31,7 @@ using namespace MOShared;
template <typename T>
-void FileRead(QFile &file, T &value)
+static void FileRead(QFile &file, T &value)
{
int read = file.read(reinterpret_cast<char*>(&value), sizeof(T));
if (read != sizeof(T)) {
@@ -41,7 +41,7 @@ void FileRead(QFile &file, T &value)
template <typename T>
-void FileSkip(QFile &file, int count = 1)
+static void FileSkip(QFile &file, int count = 1)
{
char ignore[sizeof(T)];
for (int i = 0; i < count; ++i) {
@@ -52,7 +52,7 @@ void FileSkip(QFile &file, int count = 1)
}
-QString ReadBString(QFile &file)
+static QString ReadBString(QFile &file)
{
char buffer[256];
file.read(buffer, 1); // size including zero termination
@@ -62,7 +62,7 @@ QString ReadBString(QFile &file)
}
-QString ReadFOSString(QFile &file, bool delimiter)
+static QString ReadFOSString(QFile &file, bool delimiter)
{
union {
char lengthBuffer[2];
diff --git a/src/savegameinfowidget.cpp b/src/savegameinfowidget.cpp
index 7da89747..13cad272 100644
--- a/src/savegameinfowidget.cpp
+++ b/src/savegameinfowidget.cpp
@@ -20,6 +20,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "savegameinfowidget.h"
#include "ui_savegameinfowidget.h"
#include "utility.h"
+#include "savegame.h"
#include <QGraphicsDropShadowEffect>
diff --git a/src/savegameinfowidget.h b/src/savegameinfowidget.h
index d1cd2b98..dfb0f8b1 100644
--- a/src/savegameinfowidget.h
+++ b/src/savegameinfowidget.h
@@ -22,12 +22,13 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QWidget>
#include <QFrame>
-#include "savegame.h"
namespace Ui {
class SaveGameInfoWidget;
}
+class SaveGame;
+
class SaveGameInfoWidget : public QWidget
{
Q_OBJECT
diff --git a/src/savegameinfowidgetgamebryo.cpp b/src/savegameinfowidgetgamebryo.cpp
index 8a7cf1ba..b87d3165 100644
--- a/src/savegameinfowidgetgamebryo.cpp
+++ b/src/savegameinfowidgetgamebryo.cpp
@@ -17,6 +17,7 @@ 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 "savegamegamebyro.h"
#include "savegameinfowidgetgamebryo.h"
#include <QLabel>
#include <QVBoxLayout>
diff --git a/src/savegameinfowidgetgamebryo.h b/src/savegameinfowidgetgamebryo.h
index 1f5fd7ee..149a8885 100644
--- a/src/savegameinfowidgetgamebryo.h
+++ b/src/savegameinfowidgetgamebryo.h
@@ -21,11 +21,12 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define SAVEGAMEINFOWIDGETGAMEBRYO_H
-#include "savegamegamebyro.h"
#include "savegameinfowidget.h"
#include "pluginlist.h"
+class SaveGame;
+
class SaveGameInfoWidgetGamebryo : public SaveGameInfoWidget
{
public:
diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp
index 0c222ebb..659233f1 100644
--- a/src/selfupdater.cpp
+++ b/src/selfupdater.cpp
@@ -23,7 +23,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "report.h"
#include "messagedialog.h"
#include "downloadmanager.h"
-
+#include "nexusinterface.h"
+#include "nxmaccessmanager.h"
#include <versioninfo.h>
#include <gameinfo.h>
#include <skyriminfo.h>
@@ -45,7 +46,7 @@ using namespace MOShared;
typedef Archive* (*CreateArchiveType)();
-template <typename T> T resolveFunction(QLibrary &lib, const char *name)
+template <typename T> static T resolveFunction(QLibrary &lib, const char *name)
{
T temp = reinterpret_cast<T>(lib.resolve(name));
if (temp == nullptr) {
diff --git a/src/selfupdater.h b/src/selfupdater.h
index c376234a..b5bbc406 100644
--- a/src/selfupdater.h
+++ b/src/selfupdater.h
@@ -21,7 +21,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define SELFUPDATER_H
-#include "nexusinterface.h"
#include <archive.h>
#include <versioninfo.h>
@@ -31,6 +30,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QProgressDialog>
+class NexusInterface;
+
/**
* @brief manages updates for Mod Organizer itself
* This class is used to update the Mod Organizer
diff --git a/src/settings.cpp b/src/settings.cpp
index a052620d..862ed5f3 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -413,7 +413,19 @@ void Settings::updateServers(const QList<ServerInfo> &servers)
}
}
+ // clean up unavailable servers
+ QDate now = QDate::currentDate();
+ foreach (const QString &key, m_Settings.childKeys()) {
+ QVariantMap val = m_Settings.value(key).toMap();
+ QDate lastSeen = val["lastSeen"].toDate();
+ if (lastSeen.daysTo(now) > 30) {
+ qDebug("removing server %s since it hasn't been available for downloads in over a month", qPrintable(key));
+ m_Settings.remove(key);
+ }
+ }
+
m_Settings.endGroup();
+
m_Settings.sync();
}
diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp
index 7f7a01f5..5cf75752 100644
--- a/src/shared/directoryentry.cpp
+++ b/src/shared/directoryentry.cpp
@@ -24,23 +24,18 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <ctime>
#include <algorithm>
#include <bsatk.h>
-#include "error_report.h"
-#include "util.h"
#include "windows_error.h"
#include <boost/bind.hpp>
#include <boost/scoped_array.hpp>
#include <boost/foreach.hpp>
-#include "util.h"
#include "leaktrace.h"
-
#include <map>
+#include "error_report.h"
namespace MOShared {
-
-static int s_Count = 0;
-
+static const int MAXPATH_UNICODE = 32767;
class OriginConnection {
@@ -155,7 +150,7 @@ void FilesOrigin::removeFile(FileEntry::Index index)
-std::wstring tail(const std::wstring &source, const size_t count)
+static std::wstring tail(const std::wstring &source, const size_t count)
{
if (count >= source.length()) {
return source;
diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h
index 4333c1eb..0075d5e5 100644
--- a/src/shared/directoryentry.h
+++ b/src/shared/directoryentry.h
@@ -36,11 +36,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
-
-#include "error_report.h"
-
-
-
namespace MOShared {
diff --git a/src/shared/inject.cpp b/src/shared/inject.cpp
index 143652c2..36db7840 100644
--- a/src/shared/inject.cpp
+++ b/src/shared/inject.cpp
@@ -93,7 +93,7 @@ void injectDLL(HANDLE processHandle, HANDLE threadHandle, const std::string &dll
0x68, 0xBA, 0xAD, 0xF0, 0x0D, // PUSH imm32 ("Init")
0x50, // PUSH EAX
0xB8, 0xBA, 0xAD, 0xF0, 0x0D, // MOVE EAX, imm32 (GetProcAddress)
- 0xFF, 0xD0, // CALL EAX (GetProcAddress)
+ 0xFF, 0xD0, // CALL EAX (=GetProcAddress, leaves address of init function in eax)
0x68, 0xBA, 0xAD, 0xF0, 0x0D, // PUSH imm32 (profile name)
0x68, 0xBA, 0xAD, 0xF0, 0x0D, // PUSH imm32 (log level)
0xFF, 0xD0, // CALL EAX (=InitFunction)
@@ -109,9 +109,6 @@ void injectDLL(HANDLE processHandle, HANDLE threadHandle, const std::string &dll
throw windows_error("failed to allocate memory for stub");
}
TParameters *remoteParams = reinterpret_cast<TParameters*>(remoteMem);
- // determine the remote addresses of each of the parameters
-// ULONG remoteDLLName = reinterpret_cast<ULONG>(remoteMem);
-// ULONG remoteInitString = remoteDLLName + MAX_PATH * sizeof(char);
// dizzy yet? we still have to calculate the entry point as an address relative to our stub
ULONG entryPoint = 0;
diff --git a/src/shared/stackdata.cpp b/src/shared/stackdata.cpp
index 39e69569..2f8bfc4e 100644
--- a/src/shared/stackdata.cpp
+++ b/src/shared/stackdata.cpp
@@ -5,12 +5,14 @@
#include <sstream>
#include <TlHelp32.h>
#include <set>
+#include "error_report.h"
+#include <boost/predef.h>
using namespace MOShared;
-void initDbgIfNecess()
+static void initDbgIfNecess()
{
HANDLE process = ::GetCurrentProcess();
static std::set<DWORD> initialized;
@@ -88,8 +90,7 @@ void StackData::load_modules(HANDLE process, DWORD processID) {
CloseHandle(snap);
}
-#include "error_report.h"
-#include <boost/predef.h>
+#pragma warning( disable : 4748 )
void StackData::initTrace() {
load_modules(::GetCurrentProcess(), ::GetCurrentProcessId());
@@ -134,6 +135,7 @@ void StackData::initTrace() {
}
}
+#pragma warning( enable : 4748 )
bool MOShared::operator==(const StackData &LHS, const StackData &RHS) {
if (LHS.m_Count != RHS.m_Count) {
diff --git a/src/shared/util.cpp b/src/shared/util.cpp
index 8f64277f..ceed3a34 100644
--- a/src/shared/util.cpp
+++ b/src/shared/util.cpp
@@ -32,28 +32,16 @@ namespace MOShared {
bool FileExists(const std::string &filename)
{
- WIN32_FIND_DATAA findData;
- ZeroMemory(&findData, sizeof(WIN32_FIND_DATAA));
- HANDLE search = ::FindFirstFileExA(filename.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, nullptr, 0);
- if (search == INVALID_HANDLE_VALUE) {
- return false;
- } else {
- FindClose(search);
- return true;
- }
+ DWORD dwAttrib = ::GetFileAttributesA(filename.c_str());
+
+ return (dwAttrib != INVALID_FILE_ATTRIBUTES);
}
bool FileExists(const std::wstring &filename)
{
- WIN32_FIND_DATAW findData;
- ZeroMemory(&findData, sizeof(WIN32_FIND_DATAW));
- HANDLE search = ::FindFirstFileExW(filename.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, nullptr, 0);
- if (search == INVALID_HANDLE_VALUE) {
- return false;
- } else {
- FindClose(search);
- return true;
- }
+ DWORD dwAttrib = ::GetFileAttributesW(filename.c_str());
+
+ return (dwAttrib != INVALID_FILE_ATTRIBUTES);
}
bool FileExists(const std::wstring &searchPath, const std::wstring &filename)
@@ -153,48 +141,4 @@ VS_FIXEDFILEINFO GetFileVersion(const std::wstring &fileName)
}
-
-
-std::string GetStack()
-{
-#ifdef _DEBUG
- HANDLE process = ::GetCurrentProcess();
- static std::set<DWORD> initialized;
- if (initialized.find(::GetCurrentProcessId()) == initialized.end()) {
- static bool firstCall = true;
- if (firstCall) {
- ::SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS);
- firstCall = false;
- }
- if (!::SymInitialize(process, nullptr, TRUE)) {
- log("failed to initialize symbols: %d", ::GetLastError());
- }
- initialized.insert(::GetCurrentProcessId());
- }
-
- LPVOID stack[32];
- WORD frames = ::CaptureStackBackTrace(0, 100, stack, nullptr);
-
- char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
- PSYMBOL_INFO symbol = (PSYMBOL_INFO)buffer;
- symbol->SizeOfStruct = sizeof(SYMBOL_INFO);
- symbol->MaxNameLen = MAX_SYM_NAME;
-
- std::ostringstream stackStream;
- for(unsigned int i = 0; i < frames; ++i) {
- DWORD64 addr = (DWORD64)stack[i];
- DWORD64 displacement = 0;
- if (!::SymFromAddr(::GetCurrentProcess(), addr, &displacement, symbol)) {
- stackStream << frames - i - 1 << ": " << stack[i] << " - " << ::GetLastError() << " (error)\n";
- } else {
- stackStream << frames - i - 1 << ": " << symbol->Name << "\n";
- }
- }
- return stackStream.str();
-#else
- return "";
-#endif
-}
-
-
} // namespace MOShared
diff --git a/src/shared/util.h b/src/shared/util.h
index 4af1fb1e..14017526 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -27,9 +27,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
namespace MOShared {
-
-static const int MAXPATH_UNICODE = 32767;
-
+/// Test if a file (or directory) by the specified name exists
bool FileExists(const std::string &filename);
bool FileExists(const std::wstring &filename);
@@ -46,9 +44,6 @@ std::wstring ToLower(const std::wstring &text);
VS_FIXEDFILEINFO GetFileVersion(const std::wstring &fileName);
-/// Get a stack trace as a line-break separated list of function names. This only works in debug builds
-std::string GetStack();
-
} // namespace MOShared
#endif // UTIL_H
diff --git a/src/spawn.cpp b/src/spawn.cpp
index 96c219fc..c031b25e 100644
--- a/src/spawn.cpp
+++ b/src/spawn.cpp
@@ -36,9 +36,9 @@ using namespace MOShared;
static const int BUFSIZE = 4096;
-bool spawn(LPCWSTR binary, LPCWSTR arguments, LPCWSTR currentDirectory, bool suspended,
- HANDLE stdOut, HANDLE stdErr,
- HANDLE& processHandle, HANDLE& threadHandle)
+static bool spawn(LPCWSTR binary, LPCWSTR arguments, LPCWSTR currentDirectory, bool suspended,
+ HANDLE stdOut, HANDLE stdErr,
+ HANDLE& processHandle, HANDLE& threadHandle)
{
BOOL inheritHandles = FALSE;
STARTUPINFO si;
diff --git a/src/transfersavesdialog.cpp b/src/transfersavesdialog.cpp
index 5d20c253..79c2f55a 100644
--- a/src/transfersavesdialog.cpp
+++ b/src/transfersavesdialog.cpp
@@ -19,6 +19,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "transfersavesdialog.h"
#include "ui_transfersavesdialog.h"
+#include "savegamegamebyro.h"
#include "utility.h"
#include <gameinfo.h>
#include <QDir>
diff --git a/src/transfersavesdialog.h b/src/transfersavesdialog.h
index 4d466bf2..b9265b6a 100644
--- a/src/transfersavesdialog.h
+++ b/src/transfersavesdialog.h
@@ -21,7 +21,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define TRANSFERSAVESDIALOG_H
#include "tutorabledialog.h"
-#include "savegamegamebyro.h"
#include "profile.h"
#include <iplugingame.h>
@@ -29,6 +28,8 @@ namespace Ui {
class TransferSavesDialog;
}
+class SaveGame;
+
class TransferSavesDialog : public MOBase::TutorableDialog
{
Q_OBJECT