From 2b21463514a46e7f3600f32560a0e944d15a2750 Mon Sep 17 00:00:00 2001 From: Tannin Date: Wed, 7 Jan 2015 23:13:40 +0100 Subject: - download servers that haven't been available for over a month are now purged from the known servers list - bugfix: encoding detection for fomod xmls could incorrectly interpret files as utf16 encoded - bugfix: hashing algorithm for bsa files was wrong - bugfix: nxmhandler reported non-issues as errors - bugfix: nxmhandler tried to apply chrome fix on every start - bugfix: "not endorsed" icon displayed for non-nexus mods - bugfix: when drag&dropping within the overwrite dialog the file might still get moved to a mod (and probably not the intended one) - bugfix: dropping files from overwrite on the modlist was refused when not sorting by priority (only in 1.2.15) - bugfix: unmanaged mods couldn't be reordered (only in 1.2.15) --- src/mainwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bf2d6139..ee2f32af 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3313,7 +3313,10 @@ void MainWindow::overwriteClosed(int) void MainWindow::displayModInformation(ModInfo::Ptr modInfo, unsigned int index, int tab) { - m_ModList.modInfoAboutToChange(modInfo); + if (!m_ModList.modInfoAboutToChange(modInfo)) { + qDebug("A different mod information dialog is open. If this is incorrect, please restart MO"); + return; + } std::vector flags = modInfo->getFlags(); if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_OVERWRITE) != flags.end()) { QDialog *dialog = this->findChild("__overwriteDialog"); -- cgit v1.3.1 From 6f1162c23fb0c9dfc92974e9985ef94f72bd75da Mon Sep 17 00:00:00 2001 From: Tannin Date: Thu, 8 Jan 2015 20:06:56 +0100 Subject: bugfix: showEvent contains initializion code that should be run only on first start of the application --- src/mainwindow.cpp | 66 ++++++++++++++++++++++++++++++------------------------ src/mainwindow.h | 2 ++ 2 files changed, 39 insertions(+), 29 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ee2f32af..44723449 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -157,8 +157,11 @@ static bool isOnline() MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget *parent) - : QMainWindow(parent), ui(new Ui::MainWindow), m_Tutorial(this, "MainWindow"), - m_ExeName(exeName), m_OldProfileIndex(-1), + : QMainWindow(parent) + , ui(new Ui::MainWindow) + , m_WasVisible(false) + , m_Tutorial(this, "MainWindow") + , m_ExeName(exeName), m_OldProfileIndex(-1), m_DirectoryStructure(new DirectoryEntry(L"data", NULL, 0)), m_ModList(this), m_ModListGroupingProxy(NULL), m_ModListSortProxy(NULL), m_PluginList(this), m_OldExecutableIndex(-1), m_GamePath(ToQString(GameInfo::instance().getGameDirectory())), @@ -833,39 +836,44 @@ void MainWindow::showEvent(QShowEvent *event) refreshFilters(); QMainWindow::showEvent(event); - m_Tutorial.registerControl(); - hookUpWindowTutorials(); - - if (m_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); + if (!m_WasVisible) { + // only the first time the window becomes visible + m_Tutorial.registerControl(); + + hookUpWindowTutorials(); + + if (m_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_Settings.directInterface().setValue("first_start", false); - } + m_Settings.directInterface().setValue("first_start", false); + } - // this has no visible impact when called before the ui is visible - int grouping = m_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_Settings.directInterface().value("group_state").toInt(); + ui->groupCombo->setCurrentIndex(grouping); - allowListResize(); + allowListResize(); - m_Settings.registerAsNXMHandler(false); + m_Settings.registerAsNXMHandler(false); + m_WasVisible = true; + } } diff --git a/src/mainwindow.h b/src/mainwindow.h index 8f035afd..5ccbf0c1 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -313,6 +313,8 @@ private: Ui::MainWindow *ui; + bool m_WasVisible; + MOBase::TutorialControl m_Tutorial; QString m_ExeName; -- cgit v1.3.1 From 8b3a42bd170431490c16a0a2c4beadd4d300cd49 Mon Sep 17 00:00:00 2001 From: Tannin Date: Thu, 8 Jan 2015 20:07:32 +0100 Subject: bugfix: translations for plugins were not used --- src/mainwindow.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 44723449..6f6b9a47 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4387,6 +4387,17 @@ void MainWindow::languageChange(const QString &newLanguage) installTranslator("qt"); installTranslator(ToQString(AppConfig::translationPrefix())); + foreach(IPlugin *plugin, m_Settings.plugins()) { + QObject *pluginObj = dynamic_cast(plugin); + if (pluginObj != NULL) { + QVariant fileNameVariant = pluginObj->property("filename"); + if (fileNameVariant.isValid()) { + QString fileName = QFileInfo(fileNameVariant.toString()).baseName(); + installTranslator(fileName); + } + } + } + ui->retranslateUi(this); ui->profileBox->setItemText(0, QObject::tr("")); -- cgit v1.3.1 From caf31e72cc3f7d607bcc1b53c7c179895cdd6ecf Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 11 Jan 2015 11:14:10 +0100 Subject: bugfix: executables with extensions other than .com, .cmd or .bat were started with cmd.exe (since 1.2.16) --- src/mainwindow.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6f6b9a47..fb9fede3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4371,6 +4371,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); } @@ -4523,9 +4524,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; -- cgit v1.3.1 From 9f09c30e0825c38dfa214f01cc381469b89e1c80 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 11 Jan 2015 11:14:58 +0100 Subject: bugfix: translations for some plugins weren't loaded --- src/mainwindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fb9fede3..63598d27 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4395,7 +4395,12 @@ void MainWindow::languageChange(const QString &newLanguage) if (fileNameVariant.isValid()) { QString fileName = QFileInfo(fileNameVariant.toString()).baseName(); installTranslator(fileName); + } else { + qWarning("no filename set for %s", qPrintable(plugin->name())); } + } else { + // this may be caused by the plugin not publicly deriving from one of its bases + qWarning("no plugin object for %s", qPrintable(plugin->name())); } } -- cgit v1.3.1 From 30c016567fef14460867155d80bd9af05575af81 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 11 Jan 2015 11:28:02 +0100 Subject: bugfix: first attempt at discovering java binary always failed --- src/mainwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 63598d27..6bb77a79 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4547,14 +4547,15 @@ int MainWindow::getBinaryExecuteInfo(const QFileInfo &targetInfo, QFileInfo &bin WCHAR buffer[MAX_PATH]; if (::FindExecutableW(targetPathW.c_str(), NULL, 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 (!::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(); -- cgit v1.3.1 From 2400e2c99ed3aa44152147ea7402c7f05f984aec Mon Sep 17 00:00:00 2001 From: Tannin Date: Thu, 22 Jan 2015 19:44:38 +0100 Subject: cleanup (mostly removing unused includes) --- src/browserdialog.cpp | 1 + src/browserdialog.h | 3 +-- src/browserview.h | 1 - src/downloadlistsortproxy.cpp | 1 + src/downloadlistsortproxy.h | 4 +++- src/downloadlistwidget.cpp | 1 - src/downloadlistwidget.h | 3 +-- src/downloadlistwidgetcompact.cpp | 1 - src/downloadmanager.cpp | 6 ++++-- src/downloadmanager.h | 4 +++- src/executableslist.cpp | 4 ++-- src/installationmanager.cpp | 5 +++-- src/main.cpp | 12 +++++------ src/mainwindow.cpp | 9 ++++---- src/modinfo.cpp | 1 - src/modinfodialog.cpp | 3 ++- src/modinfodialog.h | 3 +-- src/modlistsortproxy.cpp | 1 - src/nexusinterface.cpp | 1 - src/nexusinterface.h | 3 +-- src/pluginlist.cpp | 6 +++--- src/pluginlistsortproxy.cpp | 1 - src/profilesdialog.cpp | 1 - src/qtgroupingproxy.cpp | 2 +- src/savegamegamebryo.cpp | 10 ++++----- src/savegameinfowidget.cpp | 1 + src/savegameinfowidget.h | 3 ++- src/savegameinfowidgetgamebryo.cpp | 1 + src/savegameinfowidgetgamebryo.h | 3 ++- src/selfupdater.cpp | 5 +++-- src/selfupdater.h | 3 ++- src/shared/directoryentry.cpp | 7 ++---- src/shared/directoryentry.h | 5 ----- src/shared/inject.cpp | 5 +---- src/shared/stackdata.cpp | 8 ++++--- src/shared/util.cpp | 44 -------------------------------------- src/shared/util.h | 6 ------ src/spawn.cpp | 6 +++--- src/transfersavesdialog.cpp | 1 + src/transfersavesdialog.h | 3 ++- 40 files changed, 68 insertions(+), 120 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/browserdialog.cpp b/src/browserdialog.cpp index f93ffcae..6a76e600 100644 --- a/src/browserdialog.cpp +++ b/src/browserdialog.cpp @@ -19,6 +19,7 @@ along with Mod Organizer. If not, see . #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 10b44fac..e44234f0 100644 --- a/src/browserdialog.h +++ b/src/browserdialog.h @@ -20,8 +20,6 @@ along with Mod Organizer. If not, see . #ifndef BROWSERDIALOG_H #define BROWSERDIALOG_H -#include "browserview.h" -#include "tutorialcontrol.h" #include #include #include @@ -37,6 +35,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 . #ifndef NEXUSVIEW_H #define NEXUSVIEW_H -#include "finddialog.h" #include #include 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 . #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 . #include -#include "downloadmanager.h" + + +class DownloadManager; class DownloadListSortProxy : public QSortFilterProxyModel diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index 9d276de9..a9f7aa12 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -19,7 +19,6 @@ along with Mod Organizer. If not, see . #include "downloadlistwidget.h" #include "ui_downloadlistwidget.h" -#include "downloadmanager.h" #include #include #include 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 . #ifndef DOWNLOADLISTWIDGET_H #define DOWNLOADLISTWIDGET_H +#include "downloadmanager.h" #include #include #include #include #include -#include "downloadmanager.h" - namespace Ui { class DownloadListWidget; } diff --git a/src/downloadlistwidgetcompact.cpp b/src/downloadlistwidgetcompact.cpp index 21a690ab..813b08bc 100644 --- a/src/downloadlistwidgetcompact.cpp +++ b/src/downloadlistwidgetcompact.cpp @@ -24,7 +24,6 @@ along with Mod Organizer. If not, see . #include #include #include -#include "downloadmanager.h" DownloadListWidgetCompact::DownloadListWidgetCompact(QWidget *parent) : diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index b803d170..1ccc5b67 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -20,6 +20,8 @@ along with Mod Organizer. If not, see . #include "downloadmanager.h" #include "report.h" #include "nxmurl.h" +#include "nexusinterface.h" +#include "nxmaccessmanager.h" #include #include #include @@ -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 &preferredServers) +static int evaluateFileInfoMap(const QVariantMap &map, const std::map &preferredServers) { int result = 0; diff --git a/src/downloadmanager.h b/src/downloadmanager.h index 95288884..21987828 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -20,8 +20,8 @@ along with Mod Organizer. If not, see . #ifndef DOWNLOADMANAGER_H #define DOWNLOADMANAGER_H -#include "nexusinterface.h" #include +#include #include #include #include @@ -36,6 +36,8 @@ along with Mod Organizer. If not, see . #include +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 a526a9b7..f2bc02f6 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -29,14 +29,14 @@ 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() << obj.m_Arguments << obj.m_CloseMO << obj.m_SteamAppID << obj.m_WorkingDirectory << obj.m_Custom << obj.m_Toolbar; return out; } -QDataStream &operator>>(QDataStream &in, Executable &obj) +static QDataStream &operator>>(QDataStream &in, Executable &obj) { QString binaryTemp; int closeStyleTemp; diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index 880587b7..eb788a9c 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -58,7 +58,8 @@ typedef Archive* (*CreateArchiveType)(); -template T resolveFunction(QLibrary &lib, const char *name) +template +static T resolveFunction(QLibrary &lib, const char *name) { T temp = reinterpret_cast(lib.resolve(name)); if (temp == NULL) { @@ -192,7 +193,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 e0e91c40..51b4af82 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -81,7 +81,7 @@ using namespace MOShared; // set up required folders (for a first install or after an update or to fix a broken installation) -bool bootstrap() +static bool bootstrap() { GameInfo &gameInfo = GameInfo::instance(); @@ -153,7 +153,7 @@ bool bootstrap() } -void cleanupDir() +static void cleanupDir() { // files from previous versions of MO that are no longer // required (in that location) @@ -175,12 +175,12 @@ void cleanupDir() } -bool isNxmLink(const QString &link) +static 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, @@ -241,12 +241,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 6bb77a79..1ae165fb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -61,6 +61,7 @@ along with Mod Organizer. If not, see . #include "aboutdialog.h" #include "safewritefile.h" #include "organizerproxy.h" +#include "nxmaccessmanager.h" #include #include #include @@ -1426,7 +1427,7 @@ HANDLE MainWindow::spawnBinaryDirect(const QFileInfo &binary, const QString &arg } } -std::wstring getProcessName(DWORD processId) +static std::wstring getProcessName(DWORD processId) { HANDLE process = ::OpenProcess(PROCESS_QUERY_INFORMATION, false, processId); @@ -1948,7 +1949,7 @@ static bool BySortValue(const std::pair &LHS, const st template -QStringList toStringList(InputIterator current, InputIterator end) +static QStringList toStringList(InputIterator current, InputIterator end) { QStringList result; for (; current != end; ++current) { @@ -2204,7 +2205,7 @@ void MainWindow::readSettings() } -bool renameFile(const QString &oldName, const QString &newName, bool overwrite = true) +static bool renameFile(const QString &oldName, const QString &newName, bool overwrite = true) { if (overwrite && QFile::exists(newName)) { QFile::remove(newName); @@ -3890,7 +3891,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); diff --git a/src/modinfo.cpp b/src/modinfo.cpp index bf48ae8b..dd3f3c40 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -229,7 +229,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]->name(); diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index e6fb6f10..d216a7d5 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -26,6 +26,7 @@ along with Mod Organizer. If not, see . #include "bbcode.h" #include "questionboxmemory.h" #include "settings.h" +#include "categories.h" #include #include @@ -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 . #include "modinfo.h" -#include "categories.h" #include "tutorabledialog.h" #include @@ -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/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index b0e33bf2..bef3c387 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -20,7 +20,6 @@ along with Mod Organizer. If not, see . #include "modlistsortproxy.h" #include "modinfo.h" #include "profile.h" -#include "modlist.h" #include "messagedialog.h" #include #include diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index b4006097..490c7903 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -19,7 +19,6 @@ along with Mod Organizer. If not, see . #include "nexusinterface.h" #include "nxmaccessmanager.h" -#include "utility.h" #include "json.h" #include "selectiondialog.h" #include diff --git a/src/nexusinterface.h b/src/nexusinterface.h index af2f8c75..c645596e 100644 --- a/src/nexusinterface.h +++ b/src/nexusinterface.h @@ -21,7 +21,6 @@ along with Mod Organizer. If not, see . #define NEXUSINTERFACE_H -#include "nxmaccessmanager.h" #include #include @@ -37,7 +36,7 @@ along with Mod Organizer. If not, see . class NexusInterface; - +class NXMAccessManager; /** * @brief convenience class to make nxm requests easier diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index a97ad7af..cbfd9df2 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 aeb10d35..8d63e2e2 100644 --- a/src/pluginlistsortproxy.cpp +++ b/src/pluginlistsortproxy.cpp @@ -18,7 +18,6 @@ along with Mod Organizer. If not, see . */ #include "pluginlistsortproxy.h" -#include "pluginlist.h" #include "messagedialog.h" #include #include diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp index 3fdad880..ef9b607b 100644 --- a/src/profilesdialog.cpp +++ b/src/profilesdialog.cpp @@ -19,7 +19,6 @@ along with Mod Organizer. If not, see . #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 #include 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 . */ #include "savegamegamebyro.h" +#include "gameinfo.h" #include #include #include -#include "gameinfo.h" #include #include #include @@ -31,7 +31,7 @@ using namespace MOShared; template -void FileRead(QFile &file, T &value) +static void FileRead(QFile &file, T &value) { int read = file.read(reinterpret_cast(&value), sizeof(T)); if (read != sizeof(T)) { @@ -41,7 +41,7 @@ void FileRead(QFile &file, T &value) template -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 093b794c..ab48765a 100644 --- a/src/savegameinfowidget.cpp +++ b/src/savegameinfowidget.cpp @@ -20,6 +20,7 @@ along with Mod Organizer. If not, see . #include "savegameinfowidget.h" #include "ui_savegameinfowidget.h" #include "utility.h" +#include "savegame.h" #include 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 . #include #include -#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 deaa3e01..e8f56982 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 . */ +#include "savegamegamebyro.h" #include "savegameinfowidgetgamebryo.h" #include #include 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 . #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 6037422c..a97c2912 100644 --- a/src/selfupdater.cpp +++ b/src/selfupdater.cpp @@ -23,7 +23,8 @@ along with Mod Organizer. If not, see . #include "report.h" #include "messagedialog.h" #include "downloadmanager.h" - +#include "nexusinterface.h" +#include "nxmaccessmanager.h" #include #include #include @@ -45,7 +46,7 @@ using namespace MOShared; typedef Archive* (*CreateArchiveType)(); -template T resolveFunction(QLibrary &lib, const char *name) +template static T resolveFunction(QLibrary &lib, const char *name) { T temp = reinterpret_cast(lib.resolve(name)); if (temp == NULL) { diff --git a/src/selfupdater.h b/src/selfupdater.h index 75b0ff45..5877e1ec 100644 --- a/src/selfupdater.h +++ b/src/selfupdater.h @@ -21,7 +21,6 @@ along with Mod Organizer. If not, see . #define SELFUPDATER_H -#include "nexusinterface.h" #include #include @@ -31,6 +30,8 @@ along with Mod Organizer. If not, see . #include +class NexusInterface; + /** * @brief manages updates for Mod Organizer itself * This class is used to update the Mod Organizer diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index 7c0e7119..f34b0566 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -24,16 +24,13 @@ along with Mod Organizer. If not, see . #include #include #include -#include "error_report.h" -#include "util.h" #include "windows_error.h" #include #include #include -#include "util.h" #include "leaktrace.h" - #include +#include "error_report.h" namespace MOShared { @@ -155,7 +152,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 c06a49a1..7a39b576 100644 --- a/src/shared/directoryentry.h +++ b/src/shared/directoryentry.h @@ -36,11 +36,6 @@ along with Mod Organizer. If not, see . #include "util.h" - -#include "error_report.h" - - - namespace MOShared { diff --git a/src/shared/inject.cpp b/src/shared/inject.cpp index 5a111c4a..cf2a8972 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(remoteMem); - // determine the remote addresses of each of the parameters -// ULONG remoteDLLName = reinterpret_cast(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 7f6f6e52..016fb346 100644 --- a/src/shared/stackdata.cpp +++ b/src/shared/stackdata.cpp @@ -5,12 +5,14 @@ #include #include #include +#include "error_report.h" +#include using namespace MOShared; -void initDbgIfNecess() +static void initDbgIfNecess() { HANDLE process = ::GetCurrentProcess(); static std::set initialized; @@ -88,8 +90,7 @@ void StackData::load_modules(HANDLE process, DWORD processID) { CloseHandle(snap); } -#include "error_report.h" -#include +#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 1cbf088b..0f49d036 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -141,48 +141,4 @@ VS_FIXEDFILEINFO GetFileVersion(const std::wstring &fileName) } - - -std::string GetStack() -{ -#ifdef _DEBUG - HANDLE process = ::GetCurrentProcess(); - static std::set initialized; - if (initialized.find(::GetCurrentProcessId()) == initialized.end()) { - static bool firstCall = true; - if (firstCall) { - ::SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS); - firstCall = false; - } - if (!::SymInitialize(process, NULL, TRUE)) { - log("failed to initialize symbols: %d", ::GetLastError()); - } - initialized.insert(::GetCurrentProcessId()); - } - - LPVOID stack[32]; - WORD frames = ::CaptureStackBackTrace(0, 100, stack, NULL); - - 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 eba3fb3c..14017526 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -27,9 +27,6 @@ along with Mod Organizer. If not, see . 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); @@ -47,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 08f8c9f0..f719578b 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 b07b1673..e720fcd2 100644 --- a/src/transfersavesdialog.cpp +++ b/src/transfersavesdialog.cpp @@ -19,6 +19,7 @@ along with Mod Organizer. If not, see . #include "transfersavesdialog.h" #include "ui_transfersavesdialog.h" +#include "savegamegamebyro.h" #include "utility.h" #include #include diff --git a/src/transfersavesdialog.h b/src/transfersavesdialog.h index 37a85000..10048ed5 100644 --- a/src/transfersavesdialog.h +++ b/src/transfersavesdialog.h @@ -21,13 +21,14 @@ along with Mod Organizer. If not, see . #define TRANSFERSAVESDIALOG_H #include "tutorabledialog.h" -#include "savegamegamebyro.h" #include "profile.h" namespace Ui { class TransferSavesDialog; } +class SaveGame; + class TransferSavesDialog : public MOBase::TutorableDialog { Q_OBJECT -- cgit v1.3.1 From c2edbcf90ff78bb6040cdcd8538468d6e3d1d42e Mon Sep 17 00:00:00 2001 From: Tannin Date: Thu, 22 Jan 2015 19:47:18 +0100 Subject: bugfix: initialization order was wrong and so kept foreign language systems from correctly loading mod order if Unmanaged is translated "Unmanaged" is no longer translatable as its used internally as an identifier --- src/mainwindow.cpp | 4 ++-- src/modinfo.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1ae165fb..17308ab8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -200,6 +200,8 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget updateToolBar(); + languageChange(m_Settings.language()); + ModInfo::updateFromDisc(m_Settings.getModDirectory(), &m_DirectoryStructure, m_Settings.displayForeign()); // set up mod list @@ -355,8 +357,6 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget // before we start loading plugins we, add the dll path to the dll search order ::SetDllDirectoryW(ToWString(QDir::toNativeSeparators(qApp->applicationDirPath() + "/dlls")).c_str()); - languageChange(m_Settings.language()); - loadPlugins(); } diff --git a/src/modinfo.cpp b/src/modinfo.cpp index dd3f3c40..a9e134b7 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -1052,5 +1052,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(); } -- cgit v1.3.1 From b0fe23a71188757095b7917db5139a089266c256 Mon Sep 17 00:00:00 2001 From: Tannin Date: Thu, 22 Jan 2015 19:50:51 +0100 Subject: bugfix: When displaying the list of save games to delete the list is capped to 10 entries, otherwise the window may extend beyond the screen --- src/mainwindow.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 17308ab8..97ba1da1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4051,15 +4051,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 += "
  • " + QFileInfo(name).completeBaseName() + "
  • "; + if (count < 10) { + savesMsgLabel += "
  • " + QFileInfo(name).completeBaseName() + "
  • "; + } + ++count; deleteFiles << save->saveFiles(); } + if (count > 10) { + savesMsgLabel += "
  • ... " + tr("%1 more").arg(count - 10) + "
  • "; + } + if (QMessageBox::question(this, tr("Confirm"), tr("Are you sure you want to remove the following %n save(s)?
      %1

    Removed saves will be sent to the Recycle Bin.", "", selectedIndexes.count()) .arg(savesMsgLabel), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { -- cgit v1.3.1