From 1bfc91046badb609261c78b4b5e03bba4dcb61bd Mon Sep 17 00:00:00 2001
From: Tannin
Date: Mon, 28 Dec 2015 14:33:30 +0100
Subject: removed get-prefix from many getters. removed const from managed_game
variable. other fixes
---
src/modinfo.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'src/modinfo.cpp')
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 8bc767c5..5593b0f0 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(),
@@ -289,9 +289,9 @@ int ModInfo::checkAllForUpdate(QObject *receiver)
std::vector modIDs;
//I ought to store this, it's used elsewhere
- IPluginGame const *game = qApp->property("managed_game").value();
+ IPluginGame const *game = qApp->property("managed_game").value();
- modIDs.push_back(game->getNexusModOrganizerID());
+ modIDs.push_back(game->nexusModOrganizerID());
for (const ModInfo::Ptr &mod : s_Collection) {
if (mod->canBeUpdated()) {
--
cgit v1.3.1
From eb97c46ed68a965d6ddf44fa6741fa929fd7d278 Mon Sep 17 00:00:00 2001
From: Tannin
Date: Sat, 7 May 2016 00:03:38 +0200
Subject: cleanup
---
src/CMakeLists.txt | 12 ++++-
src/aboutdialog.cpp | 5 ++-
src/aboutdialog.ui | 50 +++++++++++++++++++--
src/categories.cpp | 2 +-
src/directoryrefresher.cpp | 2 +-
src/downloadmanager.cpp | 47 +++++++++----------
src/editexecutablesdialog.cpp | 8 ++--
src/editexecutablesdialog.ui | 4 +-
src/executableslist.h | 3 +-
src/installationmanager.cpp | 3 +-
src/logbuffer.cpp | 22 +++++----
src/main.cpp | 6 +--
src/mainwindow.cpp | 14 +++---
src/mainwindow.ui | 40 +++++++++++------
src/modflagicondelegate.cpp | 6 +--
src/modinfo.cpp | 6 +--
src/modinfodialog.cpp | 10 +++--
src/nexusinterface.cpp | 11 ++---
src/organizercore.cpp | 12 +++--
src/persistentcookiejar.cpp | 2 +-
src/plugincontainer.cpp | 4 +-
src/profile.cpp | 17 +++----
src/profile.h | 2 +-
src/profilesdialog.cpp | 102 ++++++++++++++++++++----------------------
src/profilesdialog.ui | 4 +-
src/shared/util.cpp | 8 +++-
src/usvfsconnector.cpp | 9 +++-
src/version.rc | 4 +-
28 files changed, 248 insertions(+), 167 deletions(-)
(limited to 'src/modinfo.cpp')
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 02c63ad2..a8b43c59 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -272,14 +272,22 @@ INCLUDE_DIRECTORIES(${project_path}/uibase/src
${project_path}/archive/src
${project_path}/../usvfs/usvfs
${project_path}/game_gamebryo/src
- ${project_path}/game_features/src)
+ ${project_path}/game_features/src
+ ${project_path}/githubpp/src)
INCLUDE_DIRECTORIES(shared ${ZLIB_INCLUDE_DIRS})
LINK_DIRECTORIES(${lib_path}
${project_path}/../zlib/lib)
-ADD_DEFINITIONS(-D_UNICODE -DUNICODE -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS)
+EXECUTE_PROCESS(
+ COMMAND git log -1 --format=%h
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_COMMIT_HASH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+ADD_DEFINITIONS(-D_UNICODE -DUNICODE -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -DGITID="${GIT_COMMIT_HASH}")
IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
SET(usvfs_name usvfs_x64)
diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp
index 3657a10d..ed57a217 100644
--- a/src/aboutdialog.cpp
+++ b/src/aboutdialog.cpp
@@ -54,10 +54,13 @@ AboutDialog::AboutDialog(const QString &version, QWidget *parent)
addLicense("RRZE Icon Set", LICENSE_CCBY3);
addLicense("Icons by Lorc, Delapouite and sbed available on http://game-icons.net", LICENSE_CCBY3);
addLicense("Castle Core", LICENSE_APACHE2);
+ addLicense("LOOT", LICENSE_GPL3);
ui->nameLabel->setText(QString("%1 %2").arg(ui->nameLabel->text()).arg(version));
-#ifdef HGID
+#if defined(HGID)
ui->revisionLabel->setText(ui->revisionLabel->text() + " " + HGID);
+#elif defined(GITID)
+ ui->revisionLabel->setText(ui->revisionLabel->text() + " " + GITID);
#else
ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
#endif
diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui
index ea5d2141..8d560f2b 100644
--- a/src/aboutdialog.ui
+++ b/src/aboutdialog.ui
@@ -6,8 +6,8 @@
0
0
- 508
- 335
+ 746
+ 369
@@ -18,13 +18,50 @@
-
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
-
+
+
+ 0
+ 0
+
+
+
+
+ 250
+ 250
+
+
+
+
+ 250
+ 250
+
+
- :/MO/gui/mo_icon.ico
+ :/MO/gui/splash
+
+
+ true
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
@@ -83,7 +120,7 @@
-
- Copyright 2011-2015 Sebastian Herbord
+ Copyright 2011-2016 Sebastian Herbord
@@ -265,6 +302,11 @@
thosrtanner
+ -
+
+ ogrotten
+
+
diff --git a/src/categories.cpp b/src/categories.cpp
index 7539d3fd..50ba5271 100644
--- a/src/categories.cpp
+++ b/src/categories.cpp
@@ -188,7 +188,7 @@ int CategoryFactory::addCategory(const QString &name, const std::vector &ne
void CategoryFactory::addCategory(int id, const QString &name, const std::vector &nexusIDs, int parentID)
{
- int index = m_Categories.size();
+ int index = static_cast(m_Categories.size());
m_Categories.push_back(Category(index, id, name, nexusIDs, parentID));
for (int nexusID : nexusIDs) {
m_NexusMap[nexusID] = index;
diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp
index 4eac4103..0a8b82be 100644
--- a/src/directoryrefresher.cpp
+++ b/src/directoryrefresher.cpp
@@ -159,7 +159,7 @@ void DirectoryRefresher::refresh()
} catch (const std::exception &e) {
emit error(tr("failed to read mod (%1): %2").arg(iter->modName, e.what()));
}
- emit progress((i * 100) / m_Mods.size() + 1);
+ emit progress((i * 100) / static_cast(m_Mods.size()) + 1);
}
emit progress(100);
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 6b4628cc..b92e171e 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -88,7 +88,8 @@ DownloadManager::DownloadInfo *DownloadManager::DownloadInfo::createFromMeta(con
QString fileName = QFileInfo(filePath).fileName();
if (fileName.endsWith(UNFINISHED)) {
- info->m_FileName = fileName.mid(0, fileName.length() - strlen(UNFINISHED));
+ info->m_FileName = fileName.mid(
+ 0, fileName.length() - static_cast(strlen(UNFINISHED)));
info->m_State = STATE_PAUSED;
} else {
info->m_FileName = fileName;
@@ -471,7 +472,7 @@ void DownloadManager::addNXMDownload(const QString &url)
void DownloadManager::removeFile(int index, bool deleteFile)
{
if (index >= m_ActiveDownloads.size()) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("remove: invalid download index %1").arg(index));
}
DownloadInfo *download = m_ActiveDownloads.at(index);
@@ -538,7 +539,7 @@ void DownloadManager::refreshAlphabeticalTranslation()
void DownloadManager::restoreDownload(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("restore: invalid download index: %1").arg(index));
}
DownloadInfo *download = m_ActiveDownloads.at(index);
@@ -571,7 +572,7 @@ void DownloadManager::removeDownload(int index, bool deleteFile)
}
} else {
if (index >= m_ActiveDownloads.size()) {
- reportError(tr("invalid index %1").arg(index));
+ reportError(tr("remove: invalid download index %1").arg(index));
return;
}
@@ -589,7 +590,7 @@ void DownloadManager::removeDownload(int index, bool deleteFile)
void DownloadManager::cancelDownload(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- reportError(tr("invalid index %1").arg(index));
+ reportError(tr("cancel: invalid download index %1").arg(index));
return;
}
@@ -602,7 +603,7 @@ void DownloadManager::cancelDownload(int index)
void DownloadManager::pauseDownload(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- reportError(tr("invalid index %1").arg(index));
+ reportError(tr("pause: invalid download index %1").arg(index));
return;
}
@@ -622,7 +623,7 @@ void DownloadManager::pauseDownload(int index)
void DownloadManager::resumeDownload(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- reportError(tr("invalid index %1").arg(index));
+ reportError(tr("resume: invalid download index %1").arg(index));
return;
}
DownloadInfo *info = m_ActiveDownloads[index];
@@ -633,7 +634,7 @@ void DownloadManager::resumeDownload(int index)
void DownloadManager::resumeDownloadInt(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- reportError(tr("invalid index %1").arg(index));
+ reportError(tr("resume (int): invalid download index %1").arg(index));
return;
}
DownloadInfo *info = m_ActiveDownloads[index];
@@ -673,7 +674,7 @@ DownloadManager::DownloadInfo *DownloadManager::downloadInfoByID(unsigned int id
void DownloadManager::queryInfo(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- reportError(tr("invalid index %1").arg(index));
+ reportError(tr("query: invalid download index %1").arg(index));
return;
}
DownloadInfo *info = m_ActiveDownloads[index];
@@ -721,7 +722,7 @@ int DownloadManager::numPendingDownloads() const
std::pair DownloadManager::getPendingDownload(int index)
{
if ((index < 0) || (index >= m_PendingDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("get pending: invalid download index %1").arg(index));
}
return m_PendingDownloads.at(index);
@@ -730,7 +731,7 @@ std::pair DownloadManager::getPendingDownload(int index)
QString DownloadManager::getFilePath(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("get path: invalid download index %1").arg(index));
}
return m_OutputDirectory + "/" + m_ActiveDownloads.at(index)->m_FileName;
@@ -751,7 +752,7 @@ QString DownloadManager::getFileTypeString(int fileType)
QString DownloadManager::getDisplayName(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("display name: invalid download index %1").arg(index));
}
DownloadInfo *info = m_ActiveDownloads.at(index);
@@ -768,7 +769,7 @@ QString DownloadManager::getDisplayName(int index) const
QString DownloadManager::getFileName(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("file name: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_FileName;
@@ -777,7 +778,7 @@ QString DownloadManager::getFileName(int index) const
QDateTime DownloadManager::getFileTime(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("file time: invalid download index %1").arg(index));
}
DownloadInfo *info = m_ActiveDownloads.at(index);
@@ -791,7 +792,7 @@ QDateTime DownloadManager::getFileTime(int index) const
qint64 DownloadManager::getFileSize(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("file size: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_TotalSize;
@@ -801,7 +802,7 @@ qint64 DownloadManager::getFileSize(int index) const
int DownloadManager::getProgress(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("progress: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_Progress;
@@ -811,7 +812,7 @@ int DownloadManager::getProgress(int index) const
DownloadManager::DownloadState DownloadManager::getState(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("state: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_State;
@@ -821,7 +822,7 @@ DownloadManager::DownloadState DownloadManager::getState(int index) const
bool DownloadManager::isInfoIncomplete(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("infocomplete: invalid download index %1").arg(index));
}
DownloadInfo *info = m_ActiveDownloads.at(index);
@@ -836,7 +837,7 @@ bool DownloadManager::isInfoIncomplete(int index) const
int DownloadManager::getModID(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("mod id: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_FileInfo->modID;
}
@@ -844,7 +845,7 @@ int DownloadManager::getModID(int index) const
bool DownloadManager::isHidden(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("ishidden: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_Hidden;
}
@@ -853,7 +854,7 @@ bool DownloadManager::isHidden(int index) const
const ModRepositoryFileInfo *DownloadManager::getFileInfo(int index) const
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("file info: invalid download index %1").arg(index));
}
return m_ActiveDownloads.at(index)->m_FileInfo;
@@ -863,7 +864,7 @@ const ModRepositoryFileInfo *DownloadManager::getFileInfo(int index) const
void DownloadManager::markInstalled(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("mark installed: invalid download index %1").arg(index));
}
DownloadInfo *info = m_ActiveDownloads.at(index);
@@ -878,7 +879,7 @@ void DownloadManager::markInstalled(int index)
void DownloadManager::markUninstalled(int index)
{
if ((index < 0) || (index >= m_ActiveDownloads.size())) {
- throw MyException(tr("invalid index"));
+ throw MyException(tr("mark uninstalled: invalid download index %1").arg(index));
}
DownloadInfo *info = m_ActiveDownloads.at(index);
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index 1b2d5a48..05a7603d 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -126,15 +126,17 @@ void EditExecutablesDialog::on_addButton_clicked()
void EditExecutablesDialog::on_browseButton_clicked()
{
- QString binaryName = FileDialogMemory::getOpenFileName("editExecutableBinary", this,
- tr("Select a binary"), QString(), tr("Executable (%1)").arg("*.exe *.bat *.jar"));
+ QString binaryName = FileDialogMemory::getOpenFileName(
+ "editExecutableBinary", this, tr("Select a binary"), QString(),
+ tr("Executable (%1)").arg("*.exe *.bat *.jar"));
if (binaryName.endsWith(".jar", Qt::CaseInsensitive)) {
QString binaryPath;
{ // try to find java automatically
std::wstring binaryNameW = ToWString(binaryName);
WCHAR buffer[MAX_PATH];
- if (::FindExecutableW(binaryNameW.c_str(), nullptr, buffer) > (HINSTANCE)32) {
+ if (::FindExecutableW(binaryNameW.c_str(), nullptr, buffer)
+ > reinterpret_cast(32)) {
DWORD binaryType = 0UL;
if (!::GetBinaryTypeW(binaryNameW.c_str(), &binaryType)) {
qDebug("failed to determine binary type of \"%ls\": %lu", binaryNameW.c_str(), ::GetLastError());
diff --git a/src/editexecutablesdialog.ui b/src/editexecutablesdialog.ui
index a2aad19a..2640bb15 100644
--- a/src/editexecutablesdialog.ui
+++ b/src/editexecutablesdialog.ui
@@ -6,8 +6,8 @@
0
0
- 384
- 446
+ 426
+ 460
diff --git a/src/executableslist.h b/src/executableslist.h
index eb7d2d6f..0534c09e 100644
--- a/src/executableslist.h
+++ b/src/executableslist.h
@@ -133,7 +133,8 @@ public:
const QString &steamAppID,
Executable::Flags flags)
{
- updateExecutable(title, executableName, arguments, workingDirectory, steamAppID, Executable::AllFlags, flags);
+ updateExecutable(title, executableName, arguments, workingDirectory,
+ steamAppID, Executable::AllFlags, flags);
}
/**
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp
index 8ab27124..bf5ee91a 100644
--- a/src/installationmanager.cpp
+++ b/src/installationmanager.cpp
@@ -346,7 +346,8 @@ DirectoryTree *InstallationManager::createFilesTree()
// to uncheck all files in a directory while keeping the dir checked. Those directories are
// currently not installed.
DirectoryTree::Node *newNode = new DirectoryTree::Node;
- newNode->setData(DirectoryTreeInformation(*componentIter, i));
+ newNode->setData(
+ DirectoryTreeInformation(*componentIter, static_cast(i)));
currentNode->addNode(newNode, false);
currentNode = newNode;
} else {
diff --git a/src/logbuffer.cpp b/src/logbuffer.cpp
index 8207dcbb..522ce3c8 100644
--- a/src/logbuffer.cpp
+++ b/src/logbuffer.cpp
@@ -53,13 +53,15 @@ void LogBuffer::logMessage(QtMsgType type, const QString &message)
if (type >= m_MinMsgType) {
Message msg = {type, QTime::currentTime(), message};
if (m_NumMessages < m_Messages.size()) {
- beginInsertRows(QModelIndex(), m_NumMessages, m_NumMessages + 1);
+ beginInsertRows(QModelIndex(), static_cast(m_NumMessages),
+ static_cast(m_NumMessages) + 1);
}
m_Messages.at(m_NumMessages % m_Messages.size()) = msg;
if (m_NumMessages < m_Messages.size()) {
endInsertRows();
} else {
- emit dataChanged(createIndex(0, 0), createIndex(m_Messages.size(), 0));
+ emit dataChanged(createIndex(0, 0),
+ createIndex(static_cast(m_Messages.size()), 0));
}
++m_NumMessages;
if (type >= QtCriticalMsg) {
@@ -84,9 +86,10 @@ void LogBuffer::write() const
return;
}
- unsigned int i = (m_NumMessages > m_Messages.size())
- ? m_NumMessages - m_Messages.size()
- : 0U;
+ unsigned int i
+ = (m_NumMessages > m_Messages.size())
+ ? static_cast(m_NumMessages - m_Messages.size())
+ : 0U;
for (; i < m_NumMessages; ++i) {
file.write(m_Messages.at(i % m_Messages.size()).toString().toUtf8());
file.write("\r\n");
@@ -165,7 +168,7 @@ int LogBuffer::rowCount(const QModelIndex &parent) const
if (parent.isValid())
return 0;
else
- return std::min(m_NumMessages, m_Messages.size());
+ return static_cast(std::min(m_NumMessages, m_Messages.size()));
}
int LogBuffer::columnCount(const QModelIndex &) const
@@ -175,9 +178,10 @@ int LogBuffer::columnCount(const QModelIndex &) const
QVariant LogBuffer::data(const QModelIndex &index, int role) const
{
- unsigned offset = m_NumMessages < m_Messages.size()
- ? 0
- : m_NumMessages - m_Messages.size();
+ unsigned int offset
+ = m_NumMessages < m_Messages.size()
+ ? 0
+ : static_cast(m_NumMessages - m_Messages.size());
unsigned int msgIndex = (offset + index.row() + 1) % m_Messages.size();
switch (role) {
case Qt::DisplayRole: {
diff --git a/src/main.cpp b/src/main.cpp
index eb3a7248..6db5a50e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -161,9 +161,9 @@ static LONG WINAPI MyUnhandledExceptionFilter(struct _EXCEPTION_POINTERS *except
if (dbgDLL) {
FuncMiniDumpWriteDump funcDump = (FuncMiniDumpWriteDump)::GetProcAddress(dbgDLL, "MiniDumpWriteDump");
if (funcDump) {
- wchar_t exeNameBuffer[MAX_PATH];
- ::GetModuleFileNameW(nullptr, exeNameBuffer, MAX_PATH);
- QString dumpName = QString::fromWCharArray(exeNameBuffer) + ".dmp";
+ QString dataPath = qApp->property("dataPath").toString();
+ QString exeName = QFileInfo(qApp->applicationFilePath()).fileName();
+ QString dumpName = dataPath + "/" + exeName + ".dmp";
if (QMessageBox::question(nullptr, QObject::tr("Woops"),
QObject::tr("ModOrganizer has crashed! "
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 24391999..e174a17c 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -144,15 +144,10 @@ along with Mod Organizer. If not, see .
#include
#include
-#include
+#include
#include
-
-#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include
-#else
-#include
-#endif
#ifndef Q_MOC_RUN
#include
@@ -4198,7 +4193,12 @@ void MainWindow::on_bossButton_clicked()
HANDLE stdOutWrite = INVALID_HANDLE_VALUE;
HANDLE stdOutRead = INVALID_HANDLE_VALUE;
createStdoutPipe(&stdOutRead, &stdOutWrite);
- m_OrganizerCore.prepareVFS();
+ try {
+ m_OrganizerCore.prepareVFS();
+ } catch (const std::exception &e) {
+ QMessageBox::warning(qApp->activeWindow(), tr("Error"), e.what());
+ return;
+ }
HANDLE loot = startBinary(QFileInfo(qApp->applicationDirPath() + "/loot/lootcli.exe"),
parameters.join(" "),
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 7d23cde5..f504994a 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -45,7 +45,10 @@
Categories
-
+
+
+ 0
+
3
@@ -92,25 +95,34 @@
-
-
-
- false
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 25
+
- Click blank area to deselect
+ Clear
+
+
+ true
-
-
-
-
-
-
- false
-
-
- false
+
+
+
+ 0
+ 0
+
-
diff --git a/src/modflagicondelegate.cpp b/src/modflagicondelegate.cpp
index d66c3ac5..5c4167ad 100644
--- a/src/modflagicondelegate.cpp
+++ b/src/modflagicondelegate.cpp
@@ -58,7 +58,7 @@ size_t ModFlagIconDelegate::getNumIcons(const QModelIndex &index) const
if (modIdx < ModInfo::getNumMods()) {
ModInfo::Ptr info = ModInfo::getByIndex(modIdx);
std::vector flags = info->getFlags();
- int count = flags.size();
+ size_t count = flags.size();
if (std::find_first_of(flags.begin(), flags.end(), m_ConflictFlags, m_ConflictFlags + 4) == flags.end()) {
++count;
}
@@ -71,11 +71,11 @@ size_t ModFlagIconDelegate::getNumIcons(const QModelIndex &index) const
QSize ModFlagIconDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &modelIndex) const
{
- int count = getNumIcons(modelIndex);
+ size_t count = getNumIcons(modelIndex);
unsigned int index = modelIndex.data(Qt::UserRole + 1).toInt();
QSize result;
if (index < ModInfo::getNumMods()) {
- result = QSize(count * 40, 20);
+ result = QSize(static_cast(count) * 40, 20);
} else {
result = QSize(1, 20);
}
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 5593b0f0..3c97ca85 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -112,7 +112,7 @@ void ModInfo::createFromOverwrite()
unsigned int ModInfo::getNumMods()
{
QMutexLocker locker(&s_Mutex);
- return s_Collection.size();
+ return static_cast(s_Collection.size());
}
@@ -121,7 +121,7 @@ ModInfo::Ptr ModInfo::getByIndex(unsigned int index)
QMutexLocker locker(&s_Mutex);
if (index >= s_Collection.size()) {
- throw MyException(tr("invalid index %1").arg(index));
+ throw MyException(tr("invalid mod index %1").arg(index));
}
return s_Collection[index];
}
@@ -150,7 +150,7 @@ bool ModInfo::removeMod(unsigned int index)
QMutexLocker locker(&s_Mutex);
if (index >= s_Collection.size()) {
- throw MyException(tr("invalid index %1").arg(index));
+ throw MyException(tr("remove: invalid mod index %1").arg(index));
}
// update the indices first
ModInfo::Ptr modInfo = s_Collection[index];
diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp
index feaac2d4..e1a2183c 100644
--- a/src/modinfodialog.cpp
+++ b/src/modinfodialog.cpp
@@ -351,14 +351,18 @@ void ModInfoDialog::refreshLists()
void ModInfoDialog::addCategories(const CategoryFactory &factory, const std::set &enabledCategories, QTreeWidgetItem *root, int rootLevel)
{
- for (size_t i = 0; i < factory.numCategories(); ++i) {
+ for (int i = 0; i < static_cast(factory.numCategories()); ++i) {
if (factory.getParentID(i) != rootLevel) {
continue;
}
int categoryID = factory.getCategoryID(i);
- QTreeWidgetItem *newItem = new QTreeWidgetItem(QStringList(factory.getCategoryName(i)));
+ QTreeWidgetItem *newItem
+ = new QTreeWidgetItem(QStringList(factory.getCategoryName(i)));
newItem->setFlags(newItem->flags() | Qt::ItemIsUserCheckable);
- newItem->setCheckState(0, enabledCategories.find(categoryID) != enabledCategories.end() ? Qt::Checked : Qt::Unchecked);
+ newItem->setCheckState(0, enabledCategories.find(categoryID)
+ != enabledCategories.end()
+ ? Qt::Checked
+ : Qt::Unchecked);
newItem->setData(0, Qt::UserRole, categoryID);
if (factory.hasChildren(i)) {
addCategories(factory, enabledCategories, newItem, categoryID);
diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp
index c689501f..4a44c067 100644
--- a/src/nexusinterface.cpp
+++ b/src/nexusinterface.cpp
@@ -206,11 +206,12 @@ void NexusInterface::interpretNexusFileName(const QString &fileName, QString &mo
std::string candidate2 = result[2].str();
if (candidate2.length() != 0 && (candidate2.find_last_of("VvRr") == std::string::npos)) {
// well, that second match might be an id too...
- unsigned offset = strspn(candidate2.c_str(), "-_ ");
+ size_t offset = strspn(candidate2.c_str(), "-_ ");
if (offset < candidate2.length() && query) {
SelectionDialog selection(tr("Failed to guess mod id for \"%1\", please pick the correct one").arg(fileName));
QString r2Highlight(fileName);
- r2Highlight.insert(result.position(2) + result.length(2), "* ").insert(result.position(2) + offset, " *");
+ r2Highlight.insert(result.position(2) + result.length(2), "* ")
+ .insert(result.position(2) + static_cast(offset), " *");
QString r3Highlight(fileName);
r3Highlight.insert(result.position(3) + result.length(3), "* ").insert(result.position(3), " *");
@@ -264,14 +265,14 @@ QString NexusInterface::getModURL(int modID) const
return QString("%1/mods/%2").arg(getGameURL()).arg(modID);
}
-bool NexusInterface::isModURL(int modID, QString const &url) const
+bool NexusInterface::isModURL(int modID, const QString &url) const
{
- if (url == getModURL(modID)) {
+ if (QUrl(url) == QUrl(getModURL(modID))) {
return true;
}
//Try the alternate (old style) mod name
QString alt = QString("%1/%2").arg(getOldModsURL()).arg(modID);
- return alt == url;
+ return QUrl(alt) == QUrl(url);
}
int NexusInterface::requestDescription(int modID, QObject *receiver, QVariant userData,
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index f6196aa7..b1eaaef3 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -1345,8 +1345,6 @@ void OrganizerCore::refreshESPList()
// clear list
try {
m_PluginList.refresh(m_CurrentProfile->name(), *m_DirectoryStructure,
- m_CurrentProfile->getPluginsFileName(),
- m_CurrentProfile->getLoadOrderFileName(),
m_CurrentProfile->getLockedOrderFileName());
} catch (const std::exception &e) {
reportError(tr("Failed to refresh list of esps: %1").arg(e.what()));
@@ -1621,7 +1619,7 @@ void OrganizerCore::loginSuccessful(bool necessary)
if (necessary) {
MessageDialog::showMessage(tr("login successful"), qApp->activeWindow());
}
- foreach (QString url, m_PendingDownloads) {
+ for (QString url : m_PendingDownloads) {
downloadRequestedNXM(url);
}
m_PendingDownloads.clear();
@@ -1765,9 +1763,7 @@ void OrganizerCore::savePluginList()
m_PostRefreshTasks.append([&]() { this->savePluginList(); });
return;
}
- m_PluginList.saveTo(m_CurrentProfile->getPluginsFileName(),
- m_CurrentProfile->getLoadOrderFileName(),
- m_CurrentProfile->getLockedOrderFileName(),
+ m_PluginList.saveTo(m_CurrentProfile->getLockedOrderFileName(),
m_CurrentProfile->getDeleterFileName(),
m_Settings.hideUncheckedPlugins());
m_PluginList.saveLoadOrder(*m_DirectoryStructure);
@@ -1825,6 +1821,7 @@ std::vector OrganizerCore::fileMapping()
return result;
}
+
std::vector OrganizerCore::fileMapping(
const QString &dataPath, const QString &relPath, const DirectoryEntry *base,
const DirectoryEntry *directoryEntry, int createDestination)
@@ -1841,8 +1838,9 @@ std::vector OrganizerCore::fileMapping(
QString originPath
= QString::fromStdWString(base->getOriginByID(origin).getPath());
QString fileName = QString::fromStdWString(current->getName());
+// QString fileName = ToQString(current->getName());
QString source = originPath + relPath + fileName;
- QString target = dataPath + relPath + fileName;
+ QString target = dataPath + relPath + fileName;
if (source != target) {
result.push_back({source, target, false, false});
}
diff --git a/src/persistentcookiejar.cpp b/src/persistentcookiejar.cpp
index 6ca0de39..44537491 100644
--- a/src/persistentcookiejar.cpp
+++ b/src/persistentcookiejar.cpp
@@ -26,7 +26,7 @@ void PersistentCookieJar::save() {
QList cookies = allCookies();
data << static_cast(cookies.size());
- foreach (const QNetworkCookie &cookie, allCookies()) {
+ for (const QNetworkCookie &cookie : allCookies()) {
data << cookie.toRawForm();
}
diff --git a/src/plugincontainer.cpp b/src/plugincontainer.cpp
index a594f703..c4976d2c 100644
--- a/src/plugincontainer.cpp
+++ b/src/plugincontainer.cpp
@@ -200,7 +200,7 @@ void PluginContainer::unloadPlugins()
bf::for_each(m_Plugins, clearPlugins());
- foreach (const boost::signals2::connection &connection, m_DiagnosisConnections) {
+ for (const boost::signals2::connection &connection : m_DiagnosisConnections) {
connection.disconnect();
}
m_DiagnosisConnections.clear();
@@ -283,7 +283,7 @@ void PluginContainer::loadPlugins()
m_PluginLoaders.push_back(pluginLoader.release());
} else {
m_FailedPlugins.push_back(pluginName);
- qWarning("plugin \"%s\" failed to load", qPrintable(pluginName));
+ qWarning("plugin \"%s\" failed to load (may be outdated)", qPrintable(pluginName));
}
}
}
diff --git a/src/profile.cpp b/src/profile.cpp
index 8cc60cc0..d71b5a0f 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -163,7 +163,7 @@ void Profile::writeModlistNow()
return;
}
- for (int i = m_ModStatus.size() - 1; i >= 0; --i) {
+ for (int i = static_cast(m_ModStatus.size()) - 1; i >= 0; --i) {
// the priority order was inverted on load so it has to be inverted again
unsigned int index = m_ModIndexByPriority[i];
if (index != UINT_MAX) {
@@ -311,7 +311,7 @@ void Profile::refreshModStatus()
// invert priority order to match that of the pluginlist. Also
// give priorities to mods not referenced in the profile
for (size_t i = 0; i < m_ModStatus.size(); ++i) {
- ModInfo::Ptr modInfo = ModInfo::getByIndex(i);
+ ModInfo::Ptr modInfo = ModInfo::getByIndex(static_cast(i));
if (modInfo->alwaysEnabled()) {
m_ModStatus[i].m_Enabled = true;
}
@@ -340,7 +340,7 @@ void Profile::refreshModStatus()
if (topInsert < 0) {
int offset = topInsert * -1;
for (size_t i = 0; i < m_ModStatus.size(); ++i) {
- ModInfo::Ptr modInfo = ModInfo::getByIndex(i);
+ ModInfo::Ptr modInfo = ModInfo::getByIndex(static_cast(i));
if (modInfo->getFixedPriority() == INT_MAX) {
continue;
}
@@ -636,11 +636,12 @@ bool Profile::enableLocalSaves(bool enable)
m_Directory.mkdir("saves");
}
} else {
- QMessageBox::StandardButton res = QMessageBox::question(QApplication::activeModalWidget(), tr("Delete savegames?"),
- tr("Do you want to delete local savegames? (If you select \"No\", the save games "
- "will show up again if you re-enable local savegames)"),
- QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
- QMessageBox::Cancel);
+ QMessageBox::StandardButton res = QMessageBox::question(
+ QApplication::activeModalWidget(), tr("Delete savegames?"),
+ tr("Do you want to delete local savegames? (If you select \"No\", the "
+ "save games will show up again if you re-enable local savegames)"),
+ QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
+ QMessageBox::Cancel);
if (res == QMessageBox::Yes) {
shellDelete(QStringList(m_Directory.absoluteFilePath("saves")));
} else if (res == QMessageBox::No) {
diff --git a/src/profile.h b/src/profile.h
index ece23ef9..87dd91a5 100644
--- a/src/profile.h
+++ b/src/profile.h
@@ -174,7 +174,7 @@ public:
/**
* @return path to this profile
**/
- QString absolutePath() const;
+ virtual QString absolutePath() const override;
/**
* @return path to this profile's save games
diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp
index 1a47cf74..40f01f0e 100644
--- a/src/profilesdialog.cpp
+++ b/src/profilesdialog.cpp
@@ -66,17 +66,15 @@ ProfilesDialog::ProfilesDialog(const QString &profileName, MOBase::IPluginGame c
profileIter.next();
QListWidgetItem *item = addItem(profileIter.filePath());
if (profileName == profileIter.fileName()) {
- m_ProfilesList->setCurrentItem(item);
+ ui->profilesList->setCurrentItem(item);
}
}
- QCheckBox *invalidationBox = findChild("invalidationBox");
-
BSAInvalidation *invalidation = game->feature();
if (invalidation == nullptr) {
- invalidationBox->setToolTip(tr("Archive invalidation isn't required for this game."));
- invalidationBox->setEnabled(false);
+ ui->invalidationBox->setToolTip(tr("Archive invalidation isn't required for this game."));
+ ui->invalidationBox->setEnabled(false);
}
}
@@ -89,13 +87,13 @@ void ProfilesDialog::showEvent(QShowEvent *event)
{
TutorableDialog::showEvent(event);
- if (m_ProfilesList->count() == 0) {
- QPoint pos = m_ProfilesList->mapToGlobal(QPoint(0, 0));
- pos.rx() += m_ProfilesList->width() / 2;
- pos.ry() += (m_ProfilesList->height() / 2) - 20;
+ if (ui->profilesList->count() == 0) {
+ QPoint pos = ui->profilesList->mapToGlobal(QPoint(0, 0));
+ pos.rx() += ui->profilesList->width() / 2;
+ pos.ry() += (ui->profilesList->height() / 2) - 20;
QWhatsThis::showText(pos,
QObject::tr("Before you can use ModOrganizer, you need to create at least one profile. "
- "ATTENTION: Run the game at least once before creating a profile!"), m_ProfilesList);
+ "ATTENTION: Run the game at least once before creating a profile!"), ui->profilesList);
}
}
@@ -108,7 +106,7 @@ void ProfilesDialog::on_closeButton_clicked()
QListWidgetItem *ProfilesDialog::addItem(const QString &name)
{
QDir profileDir(name);
- QListWidgetItem *newItem = new QListWidgetItem(profileDir.dirName(), m_ProfilesList);
+ QListWidgetItem *newItem = new QListWidgetItem(profileDir.dirName(), ui->profilesList);
try {
newItem->setData(Qt::UserRole, QVariant::fromValue(Profile::Ptr(new Profile(profileDir, m_Game))));
m_FailState = false;
@@ -121,10 +119,9 @@ QListWidgetItem *ProfilesDialog::addItem(const QString &name)
void ProfilesDialog::createProfile(const QString &name, bool useDefaultSettings)
{
try {
- QListWidget *profilesList = findChild("profilesList");
- QListWidgetItem *newItem = new QListWidgetItem(name, profilesList);
+ QListWidgetItem *newItem = new QListWidgetItem(name, ui->profilesList);
newItem->setData(Qt::UserRole, QVariant::fromValue(Profile::Ptr(new Profile(name, m_Game, useDefaultSettings))));
- profilesList->addItem(newItem);
+ ui->profilesList->addItem(newItem);
m_FailState = false;
} catch (const std::exception&) {
m_FailState = true;
@@ -135,10 +132,9 @@ void ProfilesDialog::createProfile(const QString &name, bool useDefaultSettings)
void ProfilesDialog::createProfile(const QString &name, const Profile &reference)
{
try {
- QListWidget *profilesList = findChild("profilesList");
- QListWidgetItem *newItem = new QListWidgetItem(name, profilesList);
+ QListWidgetItem *newItem = new QListWidgetItem(name, ui->profilesList);
newItem->setData(Qt::UserRole, QVariant::fromValue(Profile::Ptr(Profile::createPtrFrom(name, reference, m_Game))));
- profilesList->addItem(newItem);
+ ui->profilesList->addItem(newItem);
m_FailState = false;
} catch (const std::exception&) {
m_FailState = true;
@@ -164,20 +160,23 @@ void ProfilesDialog::on_addProfileButton_clicked()
void ProfilesDialog::on_copyProfileButton_clicked()
{
bool okClicked;
- QString name = QInputDialog::getText(this, tr("Name"), tr("Please enter a name for the new profile"), QLineEdit::Normal, QString(), &okClicked);
+ QString name = QInputDialog::getText(
+ this, tr("Name"), tr("Please enter a name for the new profile"),
+ QLineEdit::Normal, QString(), &okClicked);
fixDirectoryName(name);
if (okClicked) {
if (name.size() > 0) {
- QListWidget *profilesList = findChild("profilesList");
-
try {
- const Profile::Ptr currentProfile = profilesList->currentItem()->data(Qt::UserRole).value();
+ const Profile::Ptr currentProfile = ui->profilesList->currentItem()
+ ->data(Qt::UserRole)
+ .value();
createProfile(name, *currentProfile);
} catch (const std::exception &e) {
reportError(tr("failed to copy profile: %1").arg(e.what()));
}
} else {
- QMessageBox::warning(this, tr("Invalid name"), tr("Invalid profile name"));
+ QMessageBox::warning(this, tr("Invalid name"),
+ tr("Invalid profile name"));
}
}
}
@@ -188,13 +187,11 @@ void ProfilesDialog::on_removeProfileButton_clicked()
QMessageBox::Yes | QMessageBox::No);
if (confirmBox.exec() == QMessageBox::Yes) {
- QListWidget *profilesList = findChild("profilesList");
-
- Profile::Ptr currentProfile = profilesList->currentItem()->data(Qt::UserRole).value();
+ Profile::Ptr currentProfile = ui->profilesList->currentItem()->data(Qt::UserRole).value();
QString profilePath;
if (currentProfile.get() == nullptr) {
profilePath = Settings::instance().getProfileDirectory()
- + "/" + profilesList->currentItem()->text();
+ + "/" + ui->profilesList->currentItem()->text();
if (QMessageBox::question(this, tr("Profile broken"),
tr("This profile you're about to delete seems to be broken or the path is invalid. "
"I'm about to delete the following folder: \"%1\". Proceed?").arg(profilePath), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
@@ -205,7 +202,7 @@ void ProfilesDialog::on_removeProfileButton_clicked()
// we have to get rid of the it before deleting the directory
profilePath = currentProfile->absolutePath();
}
- QListWidgetItem* item = profilesList->takeItem(profilesList->currentRow());
+ QListWidgetItem* item = ui->profilesList->takeItem(ui->profilesList->currentRow());
if (item != nullptr) {
delete item;
}
@@ -270,53 +267,50 @@ void ProfilesDialog::on_invalidationBox_stateChanged(int state)
void ProfilesDialog::on_profilesList_currentItemChanged(QListWidgetItem *current, QListWidgetItem*)
{
- QCheckBox *invalidationBox = findChild("invalidationBox");
- QCheckBox *localSavesBox = findChild("localSavesBox");
- QPushButton *copyButton = findChild("copyProfileButton");
- QPushButton *removeButton = findChild("removeProfileButton");
- QPushButton *transferButton = findChild("transferButton");
- QPushButton *renameButton = findChild("renameButton");
-
if (current != nullptr) {
if (!current->data(Qt::UserRole).isValid()) return;
const Profile::Ptr currentProfile = current->data(Qt::UserRole).value();
try {
bool invalidationSupported = false;
- invalidationBox->blockSignals(true);
- invalidationBox->setChecked(currentProfile->invalidationActive(&invalidationSupported));
- invalidationBox->setEnabled(invalidationSupported);
- invalidationBox->blockSignals(false);
+ ui->invalidationBox->blockSignals(true);
+ ui->invalidationBox->setChecked(currentProfile->invalidationActive(&invalidationSupported));
+ ui->invalidationBox->setEnabled(invalidationSupported);
+ ui->invalidationBox->blockSignals(false);
bool localSaves = currentProfile->localSavesEnabled();
- transferButton->setEnabled(localSaves);
+ ui->transferButton->setEnabled(localSaves);
// prevent the stateChanged-event for the saves-box from triggering, otherwise it may think local saves
// were disabled and delete the files/rename the dir
- localSavesBox->blockSignals(true);
- localSavesBox->setChecked(localSaves);
- localSavesBox->blockSignals(false);
+ ui->localSavesBox->blockSignals(true);
+ ui->localSavesBox->setChecked(localSaves);
+ ui->localSavesBox->blockSignals(false);
+
+ ui->copyProfileButton->setEnabled(true);
+ ui->removeProfileButton->setEnabled(true);
+ ui->renameButton->setEnabled(true);
- copyButton->setEnabled(true);
- removeButton->setEnabled(true);
- renameButton->setEnabled(true);
+ ui->localIniFilesBox->blockSignals(true);
+ ui->localIniFilesBox->setChecked(currentProfile->localSettingsEnabled());
+ ui->localIniFilesBox->blockSignals(false);
} catch (const std::exception& E) {
reportError(tr("failed to determine if invalidation is active: %1").arg(E.what()));
- copyButton->setEnabled(false);
- removeButton->setEnabled(false);
- renameButton->setEnabled(false);
- invalidationBox->setChecked(false);
+ ui->copyProfileButton->setEnabled(false);
+ ui->removeProfileButton->setEnabled(false);
+ ui->renameButton->setEnabled(false);
+ ui->invalidationBox->setChecked(false);
}
} else {
- invalidationBox->setChecked(false);
- copyButton->setEnabled(false);
- removeButton->setEnabled(false);
- renameButton->setEnabled(false);
+ ui->invalidationBox->setChecked(false);
+ ui->copyProfileButton->setEnabled(false);
+ ui->removeProfileButton->setEnabled(false);
+ ui->renameButton->setEnabled(false);
}
}
void ProfilesDialog::on_localSavesBox_stateChanged(int state)
{
- Profile::Ptr currentProfile = m_ProfilesList->currentItem()->data(Qt::UserRole).value();
+ Profile::Ptr currentProfile = ui->profilesList->currentItem()->data(Qt::UserRole).value();
if (currentProfile->enableLocalSaves(state == Qt::Checked)) {
ui->transferButton->setEnabled(state == Qt::Checked);
diff --git a/src/profilesdialog.ui b/src/profilesdialog.ui
index 0c952877..fe03f466 100644
--- a/src/profilesdialog.ui
+++ b/src/profilesdialog.ui
@@ -6,8 +6,8 @@
0
0
- 471
- 318
+ 482
+ 332
diff --git a/src/shared/util.cpp b/src/shared/util.cpp
index 3692aae1..5491a9e6 100644
--- a/src/shared/util.cpp
+++ b/src/shared/util.cpp
@@ -81,12 +81,16 @@ std::wstring ToWString(const std::string &source, bool utf8)
if (!utf8) {
codepage = AreFileApisANSI() ? GetACP() : GetOEMCP();
}
- int sizeRequired = ::MultiByteToWideChar(codepage, 0, source.c_str(), source.length(), nullptr, 0);
+ int sizeRequired
+ = ::MultiByteToWideChar(codepage, 0, source.c_str(),
+ static_cast(source.length()), nullptr, 0);
if (sizeRequired == 0) {
throw windows_error("failed to convert string to wide character");
}
result.resize(sizeRequired, L'\0');
- ::MultiByteToWideChar(codepage, 0, source.c_str(), source.length(), &result[0], sizeRequired);
+ ::MultiByteToWideChar(codepage, 0, source.c_str(),
+ static_cast(source.length()), &result[0],
+ sizeRequired);
}
return result;
diff --git a/src/usvfsconnector.cpp b/src/usvfsconnector.cpp
index db20a54f..bc818685 100644
--- a/src/usvfsconnector.cpp
+++ b/src/usvfsconnector.cpp
@@ -76,13 +76,16 @@ LogWorker::~LogWorker()
void LogWorker::process()
{
+ int noLogCycles = 0;
while (!m_QuitRequested) {
if (GetLogMessages(&m_Buffer[0], m_Buffer.size(), false)) {
m_LogFile.write(m_Buffer.c_str());
m_LogFile.write("\n");
m_LogFile.flush();
+ noLogCycles = 0;
} else {
- QThread::sleep(1);
+ QThread::msleep(std::min(40, noLogCycles) * 5);
+ ++noLogCycles;
}
}
emit finished();
@@ -148,11 +151,13 @@ void UsvfsConnector::updateMapping(const MappingType &mapping)
if (value % 10 == 0) {
QCoreApplication::processEvents();
}
+
if (map.isDirectory) {
VirtualLinkDirectoryStatic(map.source.toStdWString().c_str(),
map.destination.toStdWString().c_str(),
(map.createTarget ? LINKFLAG_CREATETARGET : 0)
- | LINKFLAG_RECURSIVE);
+ | LINKFLAG_RECURSIVE
+ );
} else {
VirtualLinkFile(map.source.toStdWString().c_str(),
map.destination.toStdWString().c_str(), 0);
diff --git a/src/version.rc b/src/version.rc
index 028912d7..872c65d7 100644
--- a/src/version.rc
+++ b/src/version.rc
@@ -1,7 +1,7 @@
#include "Winver.h"
-#define VER_FILEVERSION 2,0,4
-#define VER_FILEVERSION_STR "2,0,4alpha\0"
+#define VER_FILEVERSION 2,0,5
+#define VER_FILEVERSION_STR "2.0.5beta\0"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
--
cgit v1.3.1
From cd83f4e7324966c9387dad19e8b15b12d902e182 Mon Sep 17 00:00:00 2001
From: Tannin
Date: Sun, 19 Jun 2016 16:01:15 +0200
Subject: reduced number of mod content icons a bit because they take too much
space
---
src/modflagicondelegate.cpp | 6 +++---
src/modinfo.cpp | 2 --
src/modinfo.h | 6 ++----
src/modinforegular.cpp | 30 ++++++++++++++++++------------
src/modlist.cpp | 4 +---
5 files changed, 24 insertions(+), 24 deletions(-)
(limited to 'src/modinfo.cpp')
diff --git a/src/modflagicondelegate.cpp b/src/modflagicondelegate.cpp
index 5c4167ad..61df0a0d 100644
--- a/src/modflagicondelegate.cpp
+++ b/src/modflagicondelegate.cpp
@@ -12,8 +12,7 @@ ModFlagIconDelegate::ModFlagIconDelegate(QObject *parent)
{
}
-QList ModFlagIconDelegate::getIcons(const QModelIndex &index) const
-{
+QList ModFlagIconDelegate::getIcons(const QModelIndex &index) const {
QList result;
QVariant modid = index.data(Qt::UserRole + 1);
if (modid.isValid()) {
@@ -21,7 +20,8 @@ QList ModFlagIconDelegate::getIcons(const QModelIndex &index) const
std::vector flags = info->getFlags();
{ // insert conflict icon first to provide nicer alignment
- auto iter = std::find_first_of(flags.begin(), flags.end(), m_ConflictFlags, m_ConflictFlags + 4);
+ auto iter = std::find_first_of(flags.begin(), flags.end(),
+ m_ConflictFlags, m_ConflictFlags + 4);
if (iter != flags.end()) {
result.append(getFlagIcon(*iter));
flags.erase(iter);
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 3c97ca85..53b74244 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -92,12 +92,10 @@ QString ModInfo::getContentTypeName(int contentType)
case CONTENT_MESH: return tr("Meshes");
case CONTENT_BSA: return tr("BSA");
case CONTENT_INTERFACE: return tr("UI Changes");
- case CONTENT_MUSIC: return tr("Music");
case CONTENT_SOUND: return tr("Sound Effects");
case CONTENT_SCRIPT: return tr("Scripts");
case CONTENT_SKSE: return tr("SKSE Plugins");
case CONTENT_SKYPROC: return tr("SkyProc Tools");
- case CONTENT_STRING: return tr("Strings");
default: throw MyException(tr("invalid content type %1").arg(contentType));
}
}
diff --git a/src/modinfo.h b/src/modinfo.h
index c10232da..69a3434a 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -76,15 +76,13 @@ public:
CONTENT_MESH,
CONTENT_BSA,
CONTENT_INTERFACE,
- CONTENT_MUSIC,
CONTENT_SOUND,
CONTENT_SCRIPT,
CONTENT_SKSE,
- CONTENT_SKYPROC,
- CONTENT_STRING
+ CONTENT_SKYPROC
};
- static const int NUM_CONTENT_TYPES = CONTENT_STRING + 1;
+ static const int NUM_CONTENT_TYPES = CONTENT_SKYPROC + 1;
enum EHighlight {
HIGHLIGHT_NONE = 0,
diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp
index b1f73a37..231e5497 100644
--- a/src/modinforegular.cpp
+++ b/src/modinforegular.cpp
@@ -433,25 +433,31 @@ std::vector ModInfoRegular::getContents() const
if (dir.entryList(QStringList() << "*.esp" << "*.esm").size() > 0) {
m_CachedContent.push_back(CONTENT_PLUGIN);
}
- if (dir.entryList(QStringList() << "*.bsa").size() > 0) {
+ if (dir.entryList(QStringList() << "*.bsa" << "*.ba2").size() > 0) {
m_CachedContent.push_back(CONTENT_BSA);
}
- ScriptExtender *extender = qApp->property("managed_game").value()->feature();
+ ScriptExtender *extender = qApp->property("managed_game")
+ .value()
+ ->feature();
if (extender != nullptr) {
QString sePluginPath = extender->name() + "/plugins";
- if (dir.exists(sePluginPath)) m_CachedContent.push_back(CONTENT_SKSE);
+ if (dir.exists(sePluginPath))
+ m_CachedContent.push_back(CONTENT_SKSE);
}
- if (dir.exists("textures")) m_CachedContent.push_back(CONTENT_TEXTURE);
- if (dir.exists("meshes")) m_CachedContent.push_back(CONTENT_MESH);
- if (dir.exists("interface")
- || dir.exists("menus")) m_CachedContent.push_back(CONTENT_INTERFACE);
- if (dir.exists("music")) m_CachedContent.push_back(CONTENT_MUSIC);
- if (dir.exists("sound")) m_CachedContent.push_back(CONTENT_SOUND);
- if (dir.exists("scripts")) m_CachedContent.push_back(CONTENT_SCRIPT);
- if (dir.exists("strings")) m_CachedContent.push_back(CONTENT_STRING);
- if (dir.exists("SkyProc Patchers")) m_CachedContent.push_back(CONTENT_SKYPROC);
+ if (dir.exists("textures"))
+ m_CachedContent.push_back(CONTENT_TEXTURE);
+ if (dir.exists("meshes"))
+ m_CachedContent.push_back(CONTENT_MESH);
+ if (dir.exists("interface") || dir.exists("menus"))
+ m_CachedContent.push_back(CONTENT_INTERFACE);
+ if (dir.exists("music") || dir.exists("sound"))
+ m_CachedContent.push_back(CONTENT_SOUND);
+ if (dir.exists("scripts"))
+ m_CachedContent.push_back(CONTENT_SCRIPT);
+ if (dir.exists("SkyProc Patchers"))
+ m_CachedContent.push_back(CONTENT_SKYPROC);
m_LastContentCheck = QTime::currentTime();
}
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 9d7f32c8..fca98aac 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -64,12 +64,10 @@ ModList::ModList(QObject *parent)
m_ContentIcons[ModInfo::CONTENT_INTERFACE] = std::make_tuple(":/MO/gui/content/interface", tr("Interface"));
m_ContentIcons[ModInfo::CONTENT_MESH] = std::make_tuple(":/MO/gui/content/mesh", tr("Meshes"));
m_ContentIcons[ModInfo::CONTENT_BSA] = std::make_tuple(":/MO/gui/content/bsa", tr("BSA"));
- m_ContentIcons[ModInfo::CONTENT_MUSIC] = std::make_tuple(":/MO/gui/content/music", tr("Music"));
m_ContentIcons[ModInfo::CONTENT_SCRIPT] = std::make_tuple(":/MO/gui/content/script", tr("Scripts (Papyrus)"));
m_ContentIcons[ModInfo::CONTENT_SKSE] = std::make_tuple(":/MO/gui/content/skse", tr("Script Extender Plugin"));
m_ContentIcons[ModInfo::CONTENT_SKYPROC] = std::make_tuple(":/MO/gui/content/skyproc", tr("SkyProc Patcher"));
- m_ContentIcons[ModInfo::CONTENT_SOUND] = std::make_tuple(":/MO/gui/content/sound", tr("Sound"));
- m_ContentIcons[ModInfo::CONTENT_STRING] = std::make_tuple(":/MO/gui/content/string", tr("Strings"));
+ m_ContentIcons[ModInfo::CONTENT_SOUND] = std::make_tuple(":/MO/gui/content/sound", tr("Sound or Music"));
m_ContentIcons[ModInfo::CONTENT_TEXTURE] = std::make_tuple(":/MO/gui/content/texture", tr("Textures"));
m_LastCheck.start();
--
cgit v1.3.1
From 352975e757f5e68e1e1d2738ab0cb2e9ac5b31dc Mon Sep 17 00:00:00 2001
From: Tannin
Date: Sun, 19 Jun 2016 16:01:51 +0200
Subject: updated to use the unmanaged-mod game plugin feature
---
src/modinfo.cpp | 39 ++++++++++++++-------------------------
src/modinfo.h | 2 +-
src/modinfoforeign.cpp | 12 ++++++------
src/modinfoforeign.h | 6 +++---
4 files changed, 24 insertions(+), 35 deletions(-)
(limited to 'src/modinfo.cpp')
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 53b74244..7cb4b4ba 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -35,6 +35,7 @@ along with Mod Organizer. If not, see .
#include
#include
#include
+#include
#include
#include
@@ -75,11 +76,13 @@ ModInfo::Ptr ModInfo::createFrom(const QDir &dir, DirectoryEntry **directoryStru
return result;
}
-ModInfo::Ptr ModInfo::createFromPlugin(const QString &espName, const QStringList &bsaNames
- , DirectoryEntry ** directoryStructure)
-{
+ModInfo::Ptr ModInfo::createFromPlugin(const QString &modName,
+ const QString &espName,
+ const QStringList &bsaNames,
+ DirectoryEntry **directoryStructure) {
QMutexLocker locker(&s_Mutex);
- ModInfo::Ptr result = ModInfo::Ptr(new ModInfoForeign(espName, bsaNames, directoryStructure));
+ ModInfo::Ptr result = ModInfo::Ptr(
+ new ModInfoForeign(modName, espName, bsaNames, directoryStructure));
s_Collection.push_back(result);
return result;
}
@@ -217,27 +220,13 @@ void ModInfo::updateFromDisc(const QString &modDirectory,
}
}
- { // list plugins in the data directory and make a foreign-managed mod out of each
- 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(),
- [&file](QString const &p) {
- return p.compare(file, Qt::CaseInsensitive) == 0; }) == mainPlugins.end()
- && (displayForeign // show non-dlc bundles only if the user wants them
- || std::find_if(dlcPlugins.begin(), dlcPlugins.end(),
- [&file](QString const &p) {
- return p.compare(file, Qt::CaseInsensitive) == 0; }) != dlcPlugins.end())) {
-
- QFileInfo f(file); //Just so I can get a basename...
- QStringList archives;
- for (const QString &archiveName : dataDir.entryList({ f.baseName() + "*.bsa" })) {
- archives.append(dataDir.absoluteFilePath(archiveName));
- }
-
- createFromPlugin(file, archives, directoryStructure);
- }
+ UnmanagedMods *unmanaged = game->feature();
+ if (unmanaged != nullptr) {
+ for (const QString &modName : unmanaged->mods(!displayForeign)) {
+ createFromPlugin(unmanaged->displayName(modName),
+ unmanaged->referenceFile(modName).absoluteFilePath(),
+ unmanaged->secondaryFiles(modName),
+ directoryStructure);
}
}
diff --git a/src/modinfo.h b/src/modinfo.h
index 69a3434a..501588ec 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -186,7 +186,7 @@ public:
* @param bsaNames names of archives
* @return a new mod
*/
- static ModInfo::Ptr createFromPlugin(const QString &espName, const QStringList &bsaNames, MOShared::DirectoryEntry **directoryStructure);
+ static ModInfo::Ptr createFromPlugin(const QString &modName, const QString &espName, const QStringList &bsaNames, MOShared::DirectoryEntry **directoryStructure);
/**
* @brief retieve a name for one of the CONTENT_ enums
diff --git a/src/modinfoforeign.cpp b/src/modinfoforeign.cpp
index bf222166..4ba16bb1 100644
--- a/src/modinfoforeign.cpp
+++ b/src/modinfoforeign.cpp
@@ -43,12 +43,12 @@ QString ModInfoForeign::getDescription() const
return tr("This pseudo mod represents content managed outside MO. It isn't modified by MO.");
}
-ModInfoForeign::ModInfoForeign(const QString &referenceFile, const QStringList &archives,
+ModInfoForeign::ModInfoForeign(const QString &modName,
+ const QString &referenceFile,
+ const QStringList &archives,
DirectoryEntry **directoryStructure)
- : ModInfoWithConflictInfo(directoryStructure)
- , m_ReferenceFile(referenceFile)
- , m_Archives(archives)
-{
+ : ModInfoWithConflictInfo(directoryStructure),
+ m_ReferenceFile(referenceFile), m_Archives(archives) {
m_CreationTime = QFileInfo(referenceFile).created();
- m_Name = "Unmanaged: " + QFileInfo(m_ReferenceFile).baseName();
+ m_Name = "Unmanaged: " + modName;
}
diff --git a/src/modinfoforeign.h b/src/modinfoforeign.h
index b35c099b..839bcdce 100644
--- a/src/modinfoforeign.h
+++ b/src/modinfoforeign.h
@@ -51,9 +51,9 @@ public:
virtual void addInstalledFile(int, int) {}
protected:
-
- ModInfoForeign(const QString &referenceFile, const QStringList &archives, MOShared::DirectoryEntry **directoryStructure);
-
+ ModInfoForeign(const QString &modName, const QString &referenceFile,
+ const QStringList &archives,
+ MOShared::DirectoryEntry **directoryStructure);
private:
QString m_Name;
--
cgit v1.3.1
From 3cf3de700eeac08867d509e478449e46d7ff9f12 Mon Sep 17 00:00:00 2001
From: Jeremy Rimpo
Date: Wed, 8 Nov 2017 19:30:20 -0600
Subject: Add MCM detection (but doesn't fix loading issues :()
---
src/modinfo.cpp | 1 +
src/modinfo.h | 3 ++-
src/modinforegular.cpp | 2 ++
src/modlist.cpp | 3 ++-
src/resources.qrc | 1 +
5 files changed, 8 insertions(+), 2 deletions(-)
(limited to 'src/modinfo.cpp')
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 7cb4b4ba..5d3c1e41 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -99,6 +99,7 @@ QString ModInfo::getContentTypeName(int contentType)
case CONTENT_SCRIPT: return tr("Scripts");
case CONTENT_SKSE: return tr("SKSE Plugins");
case CONTENT_SKYPROC: return tr("SkyProc Tools");
+ case CONTENT_MCM: return tr("MCM Data");
default: throw MyException(tr("invalid content type %1").arg(contentType));
}
}
diff --git a/src/modinfo.h b/src/modinfo.h
index 501588ec..1485a4b3 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -79,7 +79,8 @@ public:
CONTENT_SOUND,
CONTENT_SCRIPT,
CONTENT_SKSE,
- CONTENT_SKYPROC
+ CONTENT_SKYPROC,
+ CONTENT_MCM
};
static const int NUM_CONTENT_TYPES = CONTENT_SKYPROC + 1;
diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp
index 1194f604..c296d792 100644
--- a/src/modinforegular.cpp
+++ b/src/modinforegular.cpp
@@ -458,6 +458,8 @@ std::vector ModInfoRegular::getContents() const
m_CachedContent.push_back(CONTENT_SCRIPT);
if (dir.exists("SkyProc Patchers"))
m_CachedContent.push_back(CONTENT_SKYPROC);
+ if (dir.exists("MCM"))
+ m_CachedContent.push_back(CONTENT_MCM);
m_LastContentCheck = QTime::currentTime();
}
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 0aea7a98..ffbdee95 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -60,7 +60,7 @@ ModList::ModList(QObject *parent)
, m_FontMetrics(QFont())
, m_DropOnItems(false)
{
- m_ContentIcons[ModInfo::CONTENT_PLUGIN] = std::make_tuple(":/MO/gui/content/plugin", tr("Game plugins (esp/esm/esl)"));
+ m_ContentIcons[ModInfo::CONTENT_PLUGIN] = std::make_tuple(":/MO/gui/content/plugin", tr("Game Plugins (ESP/ESM/ESL)"));
m_ContentIcons[ModInfo::CONTENT_INTERFACE] = std::make_tuple(":/MO/gui/content/interface", tr("Interface"));
m_ContentIcons[ModInfo::CONTENT_MESH] = std::make_tuple(":/MO/gui/content/mesh", tr("Meshes"));
m_ContentIcons[ModInfo::CONTENT_BSA] = std::make_tuple(":/MO/gui/content/bsa", tr("BSA"));
@@ -69,6 +69,7 @@ ModList::ModList(QObject *parent)
m_ContentIcons[ModInfo::CONTENT_SKYPROC] = std::make_tuple(":/MO/gui/content/skyproc", tr("SkyProc Patcher"));
m_ContentIcons[ModInfo::CONTENT_SOUND] = std::make_tuple(":/MO/gui/content/sound", tr("Sound or Music"));
m_ContentIcons[ModInfo::CONTENT_TEXTURE] = std::make_tuple(":/MO/gui/content/texture", tr("Textures"));
+ m_ContentIcons[ModInfo::CONTENT_MCM] = std::make_tuple(":/MO/gui/content/menu", tr("MCM Configuration"));
m_LastCheck.start();
}
diff --git a/src/resources.qrc b/src/resources.qrc
index d357801c..e88eda06 100644
--- a/src/resources.qrc
+++ b/src/resources.qrc
@@ -82,6 +82,7 @@
resources/contents/breastplate.png
resources/contents/conversation.png
resources/contents/locked-chest.png
+ resources/contents/config.png
qt.conf
--
cgit v1.3.1
From d7bc542b3d1a96a546d48850e61d3ecdc953c4cc Mon Sep 17 00:00:00 2001
From: Jeremy Rimpo
Date: Thu, 30 Nov 2017 16:37:14 -0600
Subject: Implement mod/plugin highlighting when pair is selected
---
src/CMakeLists.txt | 2 +
src/mainwindow.cpp | 15 +
src/mainwindow.h | 3 +
src/mainwindow.ui | 7 +-
src/modinfo.cpp | 5 +
src/modinfo.h | 14 +-
src/modinfooverwrite.cpp | 8 +-
src/modinforegular.cpp | 10 +-
src/modlist.cpp | 37 ++-
src/modlist.h | 3 +
src/organizer_en.ts | 812 ++++++++++++++++++++++++-----------------------
src/pluginlist.cpp | 34 +-
src/pluginlist.h | 3 +
src/pluginlistview.cpp | 58 ++++
src/pluginlistview.h | 24 ++
15 files changed, 629 insertions(+), 406 deletions(-)
create mode 100644 src/pluginlistview.cpp
create mode 100644 src/pluginlistview.h
(limited to 'src/modinfo.cpp')
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d5ebf6ae..d603336c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,6 +23,7 @@ SET(organizer_SRCS
profile.cpp
pluginlistsortproxy.cpp
pluginlist.cpp
+ pluginlistview.cpp
overwriteinfodialog.cpp
nxmaccessmanager.cpp
nexusinterface.cpp
@@ -109,6 +110,7 @@ SET(organizer_HDRS
profile.h
pluginlistsortproxy.h
pluginlist.h
+ pluginlistview.h
overwriteinfodialog.h
nxmaccessmanager.h
nexusinterface.h
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 0a6e32c3..84860767 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -357,6 +357,9 @@ MainWindow::MainWindow(QSettings &initSettings
connect(this, SIGNAL(styleChanged(QString)), this, SLOT(updateStyle(QString)));
+ connect(ui->espList->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(esplistSelectionsChanged(QItemSelection)));
+ connect(ui->modList->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(modlistSelectionsChanged(QItemSelection)));
+
m_UpdateProblemsTimer.setSingleShot(true);
connect(&m_UpdateProblemsTimer, SIGNAL(timeout()), this, SLOT(updateProblemsButton()));
@@ -2121,6 +2124,18 @@ void MainWindow::modlistSelectionChanged(const QModelIndex ¤t, const QMode
ui->modList->verticalScrollBar()->repaint();
}
+void MainWindow::modlistSelectionsChanged(const QItemSelection &selected)
+{
+ m_OrganizerCore.pluginList()->highlightPlugins(selected, *m_OrganizerCore.directoryStructure());
+ ui->espList->verticalScrollBar()->repaint();
+}
+
+void MainWindow::esplistSelectionsChanged(const QItemSelection &selected)
+{
+ m_OrganizerCore.modList()->highlightMods(selected, *m_OrganizerCore.directoryStructure());
+ ui->modList->verticalScrollBar()->repaint();
+}
+
void MainWindow::modListSortIndicatorChanged(int, Qt::SortOrder)
{
ui->modList->verticalScrollBar()->repaint();
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 06c51203..cec6c407 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -520,6 +520,9 @@ private slots:
void modlistSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous);
void modListSortIndicatorChanged(int column, Qt::SortOrder order);
+ void modlistSelectionsChanged(const QItemSelection ¤t);
+ void esplistSelectionsChanged(const QItemSelection ¤t);
+
private slots: // ui slots
// actions
void on_actionAdd_Profile_triggered();
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 743ce012..26b9e375 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -791,7 +791,7 @@ p, li { white-space: pre-wrap; }
-
-
+
250
@@ -1412,6 +1412,11 @@ Right now this has very limited functionality
QTreeView
+
+ PluginListView
+ QTreeView
+
+
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 5d3c1e41..77df6216 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -301,6 +301,11 @@ void ModInfo::setVersion(const VersionInfo &version)
m_Version = version;
}
+void ModInfo::setPluginSelected(const bool &isSelected)
+{
+ m_PluginSelected = isSelected;
+}
+
void ModInfo::addCategory(const QString &categoryName)
{
int id = CategoryFactory::instance().getCategoryID(categoryName);
diff --git a/src/modinfo.h b/src/modinfo.h
index 1485a4b3..c62df549 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -67,7 +67,8 @@ public:
FLAG_CONFLICT_OVERWRITE,
FLAG_CONFLICT_OVERWRITTEN,
FLAG_CONFLICT_MIXED,
- FLAG_CONFLICT_REDUNDANT
+ FLAG_CONFLICT_REDUNDANT,
+ FLAG_PLUGIN_SELECTED
};
enum EContent {
@@ -89,7 +90,8 @@ public:
HIGHLIGHT_NONE = 0,
HIGHLIGHT_INVALID = 1,
HIGHLIGHT_CENTER = 2,
- HIGHLIGHT_IMPORTANT = 4
+ HIGHLIGHT_IMPORTANT = 4,
+ HIGHLIGHT_PLUGIN = 8
};
enum EEndorsedState {
@@ -268,6 +270,12 @@ public:
*/
virtual void setVersion(const MOBase::VersionInfo &version);
+ /**
+ * @brief Controls if mod should be highlighted based on plugin selection
+ * @param isSelected whether or not the plugin has a selected mod
+ **/
+ virtual void setPluginSelected(const bool &isSelected);
+
/**
* @brief set the newest version of this mod on the nexus
*
@@ -599,6 +607,8 @@ protected:
MOBase::VersionInfo m_Version;
+ bool m_PluginSelected = false;
+
private:
static QMutex s_Mutex;
diff --git a/src/modinfooverwrite.cpp b/src/modinfooverwrite.cpp
index 0104998a..6b8c9bd9 100644
--- a/src/modinfooverwrite.cpp
+++ b/src/modinfooverwrite.cpp
@@ -29,12 +29,18 @@ std::vector ModInfoOverwrite::getFlags() const
{
std::vector result;
result.push_back(FLAG_OVERWRITE);
+ if (m_PluginSelected)
+ result.push_back(FLAG_PLUGIN_SELECTED);
return result;
}
int ModInfoOverwrite::getHighlight() const
{
- return (isValid() ? HIGHLIGHT_IMPORTANT : HIGHLIGHT_INVALID) | HIGHLIGHT_CENTER;
+ int highlight = (isValid() ? HIGHLIGHT_IMPORTANT : HIGHLIGHT_INVALID) | HIGHLIGHT_CENTER;
+ auto flags = getFlags();
+ if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_PLUGIN_SELECTED) != flags.end())
+ highlight |= HIGHLIGHT_PLUGIN;
+ return highlight;
}
QString ModInfoOverwrite::getDescription() const
diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp
index c296d792..9d94002b 100644
--- a/src/modinforegular.cpp
+++ b/src/modinforegular.cpp
@@ -420,6 +420,9 @@ std::vector ModInfoRegular::getFlags() const
if (m_Notes.length() != 0) {
result.push_back(ModInfo::FLAG_NOTES);
}
+ if (m_PluginSelected) {
+ result.push_back(ModInfo::FLAG_PLUGIN_SELECTED);
+ }
return result;
}
@@ -471,7 +474,12 @@ std::vector ModInfoRegular::getContents() const
int ModInfoRegular::getHighlight() const
{
- return isValid() ? HIGHLIGHT_NONE: HIGHLIGHT_INVALID;
+ if (!isValid())
+ return HIGHLIGHT_INVALID;
+ auto flags = getFlags();
+ if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_PLUGIN_SELECTED) != flags.end())
+ return HIGHLIGHT_PLUGIN;
+ return HIGHLIGHT_NONE;
}
diff --git a/src/modlist.cpp b/src/modlist.cpp
index ffbdee95..c6341251 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -338,6 +338,7 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const
int highlight = modInfo->getHighlight();
if (highlight & ModInfo::HIGHLIGHT_IMPORTANT) return QBrush(Qt::darkRed);
else if (highlight & ModInfo::HIGHLIGHT_INVALID) return QBrush(Qt::darkGray);
+ else if (highlight & ModInfo::HIGHLIGHT_PLUGIN) return QBrush(Qt::darkBlue);
} else if (column == COL_VERSION) {
if (!modInfo->getNewestVersion().isValid()) {
return QVariant();
@@ -350,7 +351,9 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const
return QVariant();
} else if ((role == Qt::BackgroundRole)
|| (role == ViewMarkingScrollBar::DEFAULT_ROLE)) {
- if (m_Overwrite.find(modIndex) != m_Overwrite.end()) {
+ if (modInfo->getHighlight() & ModInfo::HIGHLIGHT_PLUGIN) {
+ return QColor(0, 0, 255, 32);
+ } else if (m_Overwrite.find(modIndex) != m_Overwrite.end()) {
return QColor(0, 255, 0, 32);
} else if (m_Overwritten.find(modIndex) != m_Overwritten.end()) {
return QColor(255, 0, 0, 32);
@@ -685,6 +688,38 @@ int ModList::timeElapsedSinceLastChecked() const
return m_LastCheck.elapsed();
}
+void ModList::highlightMods(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry)
+{
+ for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) {
+ ModInfo::getByIndex(i)->setPluginSelected(false);
+ }
+ for (QModelIndex idx : selected.indexes()) {
+ QString modName = idx.data().toString();
+
+ const MOShared::FileEntry::Ptr fileEntry = directoryEntry.findFile(modName.toStdWString());
+ if (fileEntry.get() != nullptr) {
+ QString fileName;
+ bool archive = false;
+ std::vector origins;
+ {
+ std::vector alternatives = fileEntry->getAlternatives();
+ origins.push_back(fileEntry->getOrigin(archive));
+ origins.insert(origins.end(), alternatives.begin(), alternatives.end());
+ }
+ for (int originId : origins) {
+ MOShared::FilesOrigin &origin = directoryEntry.getOriginByID(originId);
+ for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) {
+ if (ModInfo::getByIndex(i)->internalName() == QString::fromStdWString(origin.getName())) {
+ ModInfo::getByIndex(i)->setPluginSelected(true);
+ break;
+ }
+ }
+ }
+ }
+ }
+ notifyChange(0, rowCount() - 1);
+}
+
IModList::ModStates ModList::state(unsigned int modIndex) const
{
IModList::ModStates result;
diff --git a/src/modlist.h b/src/modlist.h
index 358fd583..bd715107 100644
--- a/src/modlist.h
+++ b/src/modlist.h
@@ -27,6 +27,7 @@ along with Mod Organizer. If not, see .
#include "profile.h"
#include
+#include
#include
#include
@@ -113,6 +114,8 @@ public:
int timeElapsedSinceLastChecked() const;
+ void highlightMods(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry);
+
public:
/// \copydoc MOBase::IModList::displayName
diff --git a/src/organizer_en.ts b/src/organizer_en.ts
index f8e6ffaa..cd6277df 100644
--- a/src/organizer_en.ts
+++ b/src/organizer_en.ts
@@ -820,148 +820,148 @@ p, li { white-space: pre-wrap; }
EditExecutablesDialog
-
+
Modify Executables
-
+
List of configured executables
-
+
This is a list of your configured executables. Executables in grey are automatically recognised and can not be modified.
-
+
Title
-
-
+
+
Name of the executable. This is only for display purposes.
-
+
Binary
-
-
+
+
Binary to run
-
+
Browse filesystem
-
+
Browse filesystem for the executable to run.
-
-
+
+
...
-
+
Start in
-
+
Arguments
-
-
+
+
Arguments to pass to the application
-
+
Allow the Steam AppID to be used for this executable to be changed.
-
+
Allow the Steam AppID to be used for this executable to be changed.
Every game/tool distributed through Steam has a unique ID. MO needs to know this ID to start those programs directly, otherwise the program is started by steam and then MO will not work. By default, MO will use the AppID for the game.
Right now the only case I know of where this needs to be overwritten is for the Skyrim Creation Kit which has its own AppID. This overwrite is already preconfigured.
-
+
Overwrite Steam AppID
-
+
Steam AppID to use for this executable that differs from the games AppID.
-
+
Steam AppID to use for this executable that differs from the games AppID.
Every game/tool distributed through Steam has a unique ID. MO needs to know this ID to start those programs directly, otherwise the program is started by steam and then MO will not work. By default, MO will use the AppID for the game (usually 72850).
Right now the only case I know of where this needs to be overwritten is for the Skyrim Creation Kit which has its own AppID (usually 202480). This overwrite is already preconfigured.
-
+
If this is enabled, new files are created in the specified mod instead of the "Overwrite" mod.
-
+
Create Files in Mod instead of Overwrite (*)
-
+
Use Application's Icon for shortcuts
-
+
(*) This setting is profile-specific
-
-
+
+
Add an executable
-
+
Add
-
-
+
+
Remove the selected executable
-
+
Remove
-
+
Close
@@ -1131,87 +1131,87 @@ p, li { white-space: pre-wrap; }
-
+
Extracting files
-
+
failed to create backup
-
+
Mod Name
-
+
Name
-
+
Invalid name
-
+
The name you entered is invalid, please enter a different one.
-
+
File format "%1" not supported
-
+
None of the available installer plugins were able to handle that archive
-
+
no error
-
+
7z.dll not found
-
+
7z.dll isn't valid
-
+
archive not found
-
+
failed to open archive
-
+
unsupported archive type
-
+
internal library error
-
+
archive invalid
-
+
unknown archive error
@@ -1461,8 +1461,8 @@ p, li { white-space: pre-wrap; }
-
-
+
+
Refresh
@@ -1641,7 +1641,7 @@ p, li { white-space: pre-wrap; }
-
+
Update
@@ -1652,7 +1652,7 @@ p, li { white-space: pre-wrap; }
-
+
No Problems
@@ -1682,7 +1682,7 @@ Right now this has very limited functionality
-
+
Endorse Mod Organizer
@@ -1707,579 +1707,579 @@ Right now this has very limited functionality
-
+
Toolbar
-
+
Desktop
-
+
Start Menu
-
+
Problems
-
+
There are potential problems with your setup
-
+
Everything seems to be in order
-
+
Help on UI
-
+
Documentation Wiki
-
+
Report Issue
-
+
Tutorials
-
+
About
-
+
About Qt
-
+
Name
-
+
Please enter a name for the new profile
-
+
failed to create profile: %1
-
+
Show tutorial?
-
+
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.
-
+
Downloads in progress
-
+
There are still downloads in progress, do you really want to quit?
-
+
Plugin "%1" failed: %2
-
+
Plugin "%1" failed
-
+
Browse Mod Page
-
+
Also in: <br>
-
+
No conflict
-
+
<Edit...>
-
+
Activating Network Proxy
-
+
Choose Mod
-
+
Mod Archive
-
+
Start Tutorial?
-
+
You're about to start a tutorial. For technical reasons it's not possible to end the tutorial early. Continue?
-
+
failed to spawn notepad.exe: %1
-
+
failed to open %1
-
+
failed to change origin name: %1
-
+
failed to move "%1" from mod "%2" to "%3": %4
-
+
<Contains %1>
-
+
<Checked>
-
+
<Unchecked>
-
+
<Update>
-
+
<Managed by MO>
-
+
<Managed outside MO>
-
+
<No category>
-
+
<Conflicted>
-
+
<Not Endorsed>
-
+
failed to rename mod: %1
-
+
Overwrite?
-
+
This will replace the existing mod "%1". Continue?
-
+
failed to remove mod "%1"
-
-
-
+
+
+
failed to rename "%1" to "%2"
-
-
-
-
+
+
+
+
Confirm
-
+
Remove the following mods?<br><ul>%1</ul>
-
+
failed to remove mod: %1
-
-
+
+
Failed
-
+
Installation file no longer exists
-
+
Mods installed with old versions of MO can't be reinstalled in this way.
-
+
You need to be logged in with Nexus to resume a download
-
-
+
+
You need to be logged in with Nexus to endorse
-
+
Failed to display overwrite dialog: %1
-
+
Nexus ID for this Mod is unknown
-
+
Web page for this mod is unknown
-
-
-
+
+
+
Create Mod...
-
+
This will create an empty mod.
Please enter a name:
-
-
+
+
A mod with this name already exists
-
+
This will move all files from overwrite into a new, regular mod.
Please enter a name:
-
+
Not logged in, endorsement information will be wrong
-
+
Continue?
-
+
The versioning scheme decides which version is considered newer than another.
This function will guess the versioning scheme under the assumption that the installed version is outdated.
-
-
+
+
Sorry
-
+
I don't know a versioning scheme where %1 is newer than %2.
-
+
Really enable all visible mods?
-
+
Really disable all visible mods?
-
+
Choose what to export
-
+
Everything
-
+
All installed mods are included in the list
-
+
Active Mods
-
+
Only active (checked) mods from your current profile are included
-
+
Visible
-
+
All mods visible in the mod list are included
-
+
export failed: %1
-
+
Install Mod...
-
+
Create empty mod
-
+
Enable all visible
-
+
Disable all visible
-
+
Check all for update
-
+
Export to csv...
-
+
All Mods
-
+
Sync to Mods...
-
+
Restore Backup
-
+
Remove Backup...
-
+
Add/Remove Categories
-
+
Replace Categories
-
+
Primary Category
-
+
Change versioning scheme
-
+
Un-ignore update
-
+
Ignore update
-
+
Rename Mod...
-
+
Remove Mod...
-
+
Reinstall Mod
-
+
Un-Endorse
-
-
+
+
Endorse
-
+
Won't endorse
-
+
Endorsement state unknown
-
+
Ignore missing data
-
+
Visit on Nexus
-
+
Visit web page
-
+
Open in explorer
-
+
Information...
-
-
+
+
Exception:
-
-
+
+
Unknown exception
-
+
<All>
-
+
<Multiple>
-
+
%1 more
-
+
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.
@@ -2287,12 +2287,12 @@ This function will guess the versioning scheme under the assumption that the ins
-
+
Enable Mods...
-
+
Delete %n save(s)
@@ -2300,319 +2300,319 @@ This function will guess the versioning scheme under the assumption that the ins
-
+
failed to remove %1
-
+
failed to create %1
-
+
Can't change download directory while downloads are in progress!
-
+
failed to write to file %1
-
+
%1 written
-
+
Select binary
-
+
Binary
-
+
Enter Name
-
+
Please enter a name for the executable
-
+
Not an executable
-
+
This is not a recognized executable.
-
-
+
+
Replace file?
-
+
There already is a hidden version of this file. Replace it?
-
-
+
+
File operation failed
-
-
+
+
Failed to remove "%1". Maybe you lack the required file permissions?
-
+
There already is a visible version of this file. Replace it?
-
+
file not found: %1
-
+
failed to generate preview for %1
-
+
Sorry, can't preview anything. This function currently does not support extracting from bsas.
-
+
Update available
-
+
Open/Execute
-
+
Add as Executable
-
+
Preview
-
+
Un-Hide
-
+
Hide
-
+
Write To File...
-
+
Do you want to endorse Mod Organizer on %1 now?
-
+
Thank you!
-
+
Thank you for your endorsement!
-
+
Request to Nexus failed: %1
-
-
+
+
failed to read %1: %2
-
-
+
+
Error
-
+
failed to extract %1 (errorcode %2)
-
+
Extract BSA
-
+
This archive contains invalid hashes. Some files may be broken.
-
+
Are you sure?
-
+
This will restart MO, continue?
-
+
Edit Categories...
-
+
Deselect filter
-
+
Remove
-
+
Enable all
-
+
Disable all
-
+
Unlock load order
-
+
Lock load order
-
+
depends on missing "%1"
-
+
incompatible with "%1"
-
+
Please wait while LOOT is running
-
+
loot failed. Exit code was: %1
-
+
failed to start loot
-
+
failed to run loot: %1
-
+
Errors occured
-
+
Backup of load order created
-
+
Choose backup to restore
-
+
No Backups
-
+
There are no backups to restore
-
-
+
+
Restore failed
-
-
+
+
Failed to restore the backup. Errorcode: %1
-
+
Backup of modlist created
-
+
A file with the same name has already been downloaded. What would you like to do?
-
+
Overwrite
-
+
Rename new file
-
+
Ignore file
@@ -2675,16 +2675,21 @@ This function will guess the versioning scheme under the assumption that the ins
+ MCM Data
+
+
+
+
invalid content type %1
-
+
invalid mod index %1
-
+
remove: invalid mod index %1
@@ -3225,7 +3230,7 @@ p, li { white-space: pre-wrap; }
ModInfoOverwrite
-
+
This pseudo mod contains files from the virtual data tree that got modified (i.e. by the construction kit)
@@ -3239,13 +3244,13 @@ p, li { white-space: pre-wrap; }
-
+
%1 contains no esp/esm/esl and no asset (textures, meshes, interface, ...) directory
%1 contains no esp/esm and no asset (textures, meshes, interface, ...) directory
-
+
Categories: <br>
@@ -3254,8 +3259,8 @@ p, li { white-space: pre-wrap; }
ModList
- Game plugins (esp/esm/esl)
- Game plugins (esp/esm)
+ Game Plugins (ESP/ESM/ESL)
+ Game plugins (esp/esm/esl)
@@ -3299,174 +3304,179 @@ p, li { white-space: pre-wrap; }
-
+
+ MCM Configuration
+
+
+
+
This entry contains files that have been created inside the virtual data tree (i.e. by the construction kit)
-
+
Backup
-
+
No valid game data
-
+
Not endorsed yet
-
+
Overwrites files
-
+
Overwritten files
-
+
Overwrites & Overwritten
-
+
Redundant
-
+
Non-MO
-
+
invalid
-
+
installed version: "%1", newest version: "%2"
-
+
The newest version on Nexus seems to be older than the one you have installed. This could either mean the version you have has been withdrawn (i.e. due to a bug) or the author uses a non-standard versioning scheme and that newest version is actually newer. Either way you may want to "upgrade".
-
+
Categories: <br>
-
+
Invalid name
-
+
drag&drop failed: %1
-
+
Confirm
-
+
Are you sure you want to remove "%1"?
-
+
Flags
-
+
Content
-
+
Mod Name
-
+
Version
-
+
Priority
-
+
Category
-
+
Nexus ID
-
+
Installation
-
-
+
+
unknown
-
+
Name of your mods
-
+
Version of the mod (if available)
-
+
Installation priority of your mod. The higher, the more "important" it is and thus overwrites files from mods with lower priority.
-
+
Category of the mod.
-
+
Id of the mod as used on Nexus.
-
+
Emblemes to highlight things that might require attention.
-
+
Depicts the content of the mod:<br><table cellspacing=7><tr><td><img src=":/MO/gui/content/plugin" width=32/></td><td>Game plugins (esp/esm/esl)</tr><tr><td><img src=":/MO/gui/content/interface" width=32/></td><td>Interface</tr><tr><td><img src=":/MO/gui/content/mesh" width=32/></td><td>Meshes</tr><tr><td><img src=":/MO/gui/content/bsa" width=32/></td><td>BSA</tr><tr><td><img src=":/MO/gui/content/texture" width=32/></td><td>Textures</tr><tr><td><img src=":/MO/gui/content/sound" width=32/></td><td>Sounds</tr><tr><td><img src=":/MO/gui/content/music" width=32/></td><td>Music</tr><tr><td><img src=":/MO/gui/content/string" width=32/></td><td>Strings</tr><tr><td><img src=":/MO/gui/content/script" width=32/></td><td>Scripts (Papyrus)</tr><tr><td><img src=":/MO/gui/content/skse" width=32/></td><td>Script Extender plugins</tr><tr><td><img src=":/MO/gui/content/skyproc" width=32/></td><td>SkyProc Patcher</tr></table>
Depicts the content of the mod:<br><table cellspacing=7><tr><td><img src=":/MO/gui/content/plugin" width=32/></td><td>Game plugins (esp/esm)</tr><tr><td><img src=":/MO/gui/content/interface" width=32/></td><td>Interface</tr><tr><td><img src=":/MO/gui/content/mesh" width=32/></td><td>Meshes</tr><tr><td><img src=":/MO/gui/content/bsa" width=32/></td><td>BSA</tr><tr><td><img src=":/MO/gui/content/texture" width=32/></td><td>Textures</tr><tr><td><img src=":/MO/gui/content/sound" width=32/></td><td>Sounds</tr><tr><td><img src=":/MO/gui/content/music" width=32/></td><td>Music</tr><tr><td><img src=":/MO/gui/content/string" width=32/></td><td>Strings</tr><tr><td><img src=":/MO/gui/content/script" width=32/></td><td>Scripts (Papyrus)</tr><tr><td><img src=":/MO/gui/content/skse" width=32/></td><td>Script Extender plugins</tr><tr><td><img src=":/MO/gui/content/skyproc" width=32/></td><td>SkyProc Patcher</tr></table>
-
+
Time this mod was installed
@@ -3554,189 +3564,189 @@ p, li { white-space: pre-wrap; }
OrganizerCore
-
-
+
+
Failed to write settings
-
+
An error occured trying to update MO settings to %1: %2
-
+
File is write protected
-
+
Invalid file format (probably a bug)
-
+
Unknown error %1
-
+
An error occured trying to write back MO settings to %1: %2
-
-
+
+
Download started
-
+
Download failed
-
-
+
+
Installation successful
-
-
+
+
Configure Mod
-
-
+
+
This mod contains ini tweaks. Do you want to configure them now?
-
-
+
+
mod "%1" not found
-
-
+
+
Installation cancelled
-
-
+
+
The mod was not installed completely.
-
+
Executable "%1" not found
-
+
Start Steam?
-
+
Steam is required to be running already to correctly start the game. Should MO try to start steam now?
-
+
Error
-
+
No profile set
-
+
Failed to refresh list of esps: %1
-
+
Multiple esps/esls activated, please check that they don't conflict.
-
+
Download?
-
+
A download has been started but no installed page plugin recognizes it.
If you download anyway no information (i.e. version) will be associated with the download.
Continue?
-
+
failed to update mod list: %1
-
-
+
+
login successful
-
+
Login failed
-
+
Login failed, try again?
-
+
login failed: %1. Download will not be associated with an account
-
+
login failed: %1
-
+
login failed: %1. You need to log-in with Nexus to update MO.
-
+
Too many esps, esms, and esls enabled
-
-
+
+
Description missing
-
+
The game doesn't allow more than 255 active plugins (including the official ones) to be loaded. You have to disable some unused plugins or merge some plugins into one. You can find a guide here: <a href="http://wiki.step-project.com/Guide:Merging_Plugins">http://wiki.step-project.com/Guide:Merging_Plugins</a>
-
+
failed to save load order: %1
-
+
The designated write target "%1" is not enabled.
@@ -3833,110 +3843,110 @@ Continue?
PluginList
-
+
Name
-
+
Priority
-
+
Mod Index
-
+
Flags
-
-
+
+
unknown
-
+
Name of your mods
-
+
Load priority of your mod. The higher, the more "important" it is and thus overwrites data from plugins with lower priority.
-
+
The modindex determines the formids of objects originating from this mods.
The modindex determins the formids of objects originating from this mods.
-
+
failed to update esp info for file %1 (source id: %2), error: %3
-
+
esp not found: %1
-
-
+
+
Confirm
-
+
Really enable all plugins?
-
+
Really disable all plugins?
-
+
The file containing locked plugin indices is broken
-
+
This plugin can't be disabled (enforced by the game)
-
+
<b>Origin</b>: %1
-
+
Author
-
+
Description
-
+
Missing Masters
-
+
Enabled Masters
-
+
failed to restore load order for %1
@@ -4289,15 +4299,15 @@ p, li { white-space: pre-wrap; }
-
-
-
-
+
+
+
+
invalid index %1
-
+
invalid category id %1
@@ -4442,66 +4452,72 @@ p, li { white-space: pre-wrap; }
-
+
game doesn't support a script extender
-
+
+ Failed to delete %1
+
+
+
+
Failed to deactivate script extender loading
-
+
Failed to remove %1: %2
-
-
+
+
Failed to rename %1 to %2
-
+
Failed to deactivate proxy-dll loading
-
+
Failed to set up script extender loading
-
+
Failed to delete old proxy-dll %1
-
+
+
Failed to copy %1 to %2
-
+
Failed to overwrite %1
-
+
Failed to set up proxy-dll loading
-
+
Error
-
+
Failed to create "%1". Your user account probably lacks permission.
@@ -4528,75 +4544,75 @@ p, li { white-space: pre-wrap; }
-
+
Could not use configuration settings for game "%1", path "%2".
-
-
+
+
Please select the game to manage
-
+
No game identified in "%1". The directory is required to contain the game binary and its launcher.
-
+
Please select the game edition you have (MO can't start the game correctly if this is set incorrectly!)
-
+
failed to start application: %1
-
+
Mod Organizer
-
+
An instance of Mod Organizer is already running
-
+
Failed to set up instance
-
+
Please use "Help" from the toolbar to get usage instructions to all elements
-
-
+
+
<Manage...>
-
+
failed to parse profile %1: %2
-
+
Failed to start "%1"
-
+
Waiting
-
+
Please press OK once you're logged into steam.
@@ -4617,12 +4633,12 @@ p, li { white-space: pre-wrap; }
-
+
failed to access %1
-
+
failed to set file time %1
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp
index 4420bf17..a215b9d3 100644
--- a/src/pluginlist.cpp
+++ b/src/pluginlist.cpp
@@ -21,6 +21,7 @@ along with Mod Organizer. If not, see .
#include "settings.h"
#include "scopeguard.h"
#include "modinfo.h"
+#include "viewmarkingscrollbar.h"
#include
#include
#include
@@ -107,6 +108,28 @@ QString PluginList::getColumnToolTip(int column)
}
}
+void PluginList::highlightPlugins(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry)
+{
+ for (auto &esp : m_ESPs) {
+ esp.m_ModSelected = false;
+ }
+ for (QModelIndex idx : selected.indexes()) {
+ ModInfo::Ptr selectedMod = ModInfo::getByIndex(idx.data(Qt::UserRole + 1).toInt());
+ if (!selectedMod.isNull()) {
+ QDir dir(selectedMod->absolutePath());
+ QStringList plugins = dir.entryList(QStringList() << "*.esp" << "*.esm" << "*.esl");
+ if (plugins.size() > 0) {
+ for (auto plugin : plugins) {
+ std::map::iterator iter = m_ESPsByName.find(plugin.toLower());
+ if (iter != m_ESPsByName.end()) {
+ m_ESPs[iter->second].m_ModSelected = true;
+ }
+ }
+ }
+ }
+ }
+ emit dataChanged(this->index(0, 0), this->index(m_ESPs.size() - 1, this->columnCount() - 1));
+}
void PluginList::refresh(const QString &profileName
, const DirectoryEntry &baseDirectory
@@ -752,9 +775,16 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const
}
} else if (role == Qt::ForegroundRole) {
if ((modelIndex.column() == COL_NAME) &&
- m_ESPs[index].m_ForceEnabled) {
+ m_ESPs[index].m_ForceEnabled) {
return QBrush(Qt::gray);
}
+ } else if (role == Qt::BackgroundRole
+ || (role == ViewMarkingScrollBar::DEFAULT_ROLE)) {
+ if (m_ESPs[index].m_ModSelected) {
+ return QColor(0, 0, 255, 32);
+ } else {
+ return QVariant();
+ }
} else if (role == Qt::FontRole) {
QFont result;
if (m_ESPs[index].m_IsMaster) {
@@ -1134,7 +1164,7 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled,
const QString &originName, const QString &fullPath,
bool hasIni)
: m_Name(name), m_FullPath(fullPath), m_Enabled(enabled), m_ForceEnabled(enabled),
- m_Priority(0), m_LoadOrder(-1), m_OriginName(originName), m_HasIni(hasIni)
+ m_Priority(0), m_LoadOrder(-1), m_OriginName(originName), m_HasIni(hasIni), m_ModSelected(false)
{
try {
ESP::File file(ToWString(fullPath));
diff --git a/src/pluginlist.h b/src/pluginlist.h
index e98f5c41..19e98989 100644
--- a/src/pluginlist.h
+++ b/src/pluginlist.h
@@ -200,6 +200,8 @@ public:
static QString getColumnName(int column);
static QString getColumnToolTip(int column);
+ void highlightPlugins(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry);
+
void refreshLoadOrder();
void disconnectSlots();
@@ -277,6 +279,7 @@ private:
QString m_OriginName;
bool m_IsMaster;
bool m_IsLight;
+ bool m_ModSelected;
QString m_Author;
QString m_Description;
bool m_HasIni;
diff --git a/src/pluginlistview.cpp b/src/pluginlistview.cpp
new file mode 100644
index 00000000..0fcf8183
--- /dev/null
+++ b/src/pluginlistview.cpp
@@ -0,0 +1,58 @@
+#include "pluginlistview.h"
+#include
+#include
+#include
+
+
+class PluginListViewStyle : public QProxyStyle {
+public:
+ PluginListViewStyle(QStyle *style, int indentation);
+
+ void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
+ QPainter *painter, const QWidget *widget = 0) const;
+private:
+ int m_Indentation;
+};
+
+PluginListViewStyle::PluginListViewStyle(QStyle *style, int indentation)
+ : QProxyStyle(style), m_Indentation(indentation)
+{
+}
+
+void PluginListViewStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
+ QPainter *painter, const QWidget *widget) const
+{
+ if (element == QStyle::PE_IndicatorItemViewItemDrop && !option->rect.isNull()) {
+ QStyleOption opt(*option);
+ opt.rect.setLeft(m_Indentation);
+ if (widget) {
+ opt.rect.setRight(widget->width() - 5); // 5 is an arbitrary value that seems to work ok
+ }
+ QProxyStyle::drawPrimitive(element, &opt, painter, widget);
+ }
+ else {
+ QProxyStyle::drawPrimitive(element, option, painter, widget);
+ }
+}
+
+PluginListView::PluginListView(QWidget *parent)
+ : QTreeView(parent)
+ , m_Scrollbar(new ViewMarkingScrollBar(this->model(), this))
+{
+ setVerticalScrollBar(m_Scrollbar);
+}
+
+void PluginListView::dragEnterEvent(QDragEnterEvent *event)
+{
+ emit dropModeUpdate(event->mimeData()->hasUrls());
+
+ QTreeView::dragEnterEvent(event);
+}
+
+void PluginListView::setModel(QAbstractItemModel *model)
+{
+ QTreeView::setModel(model);
+ setVerticalScrollBar(new ViewMarkingScrollBar(model, this));
+}
+
+#pragma once
diff --git a/src/pluginlistview.h b/src/pluginlistview.h
new file mode 100644
index 00000000..bdd4ee61
--- /dev/null
+++ b/src/pluginlistview.h
@@ -0,0 +1,24 @@
+#ifndef PLUGINLISTVIEW_H
+#define PLUGINLISTVIEW_H
+
+#include
+#include
+#include "viewmarkingscrollbar.h"
+
+class PluginListView : public QTreeView
+{
+ Q_OBJECT
+public:
+ explicit PluginListView(QWidget *parent = 0);
+ virtual void dragEnterEvent(QDragEnterEvent *event);
+ virtual void setModel(QAbstractItemModel *model);
+signals:
+ void dropModeUpdate(bool dropOnRows);
+
+ public slots:
+private:
+
+ ViewMarkingScrollBar *m_Scrollbar;
+};
+
+#endif // PLUGINLISTVIEW_H
--
cgit v1.3.1
From 083d1078753698b5ff347d91aa17219fd1e1cb5a Mon Sep 17 00:00:00 2001
From: Jeremy Rimpo
Date: Wed, 13 Dec 2017 03:11:03 -0600
Subject: A number of improvements and fixes * Move diagnostics tab to un-break
tutorials targeting tab 3 * Restrict order locking for force-enabled plugins
* Cascade locked positions in the case of a conflict * Should remove existing
invalid locks * Add some info to primary plugins in plugin list *
Differentiate plugin names for DLC and CC content
---
src/modinfo.cpp | 7 +-
src/modinfo.h | 9 +-
src/modinfoforeign.cpp | 12 +-
src/modinfoforeign.h | 2 +-
src/pluginlist.cpp | 30 +++-
src/settingsdialog.ui | 364 ++++++++++++++++++++++++-------------------------
6 files changed, 235 insertions(+), 189 deletions(-)
(limited to 'src/modinfo.cpp')
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 77df6216..4f74086f 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -79,10 +79,11 @@ ModInfo::Ptr ModInfo::createFrom(const QDir &dir, DirectoryEntry **directoryStru
ModInfo::Ptr ModInfo::createFromPlugin(const QString &modName,
const QString &espName,
const QStringList &bsaNames,
+ ModInfo::EModType modType,
DirectoryEntry **directoryStructure) {
QMutexLocker locker(&s_Mutex);
ModInfo::Ptr result = ModInfo::Ptr(
- new ModInfoForeign(modName, espName, bsaNames, directoryStructure));
+ new ModInfoForeign(modName, espName, bsaNames, modType, directoryStructure));
s_Collection.push_back(result);
return result;
}
@@ -224,9 +225,13 @@ void ModInfo::updateFromDisc(const QString &modDirectory,
UnmanagedMods *unmanaged = game->feature();
if (unmanaged != nullptr) {
for (const QString &modName : unmanaged->mods(!displayForeign)) {
+ ModInfo::EModType modType = game->DLCPlugins().contains(unmanaged->referenceFile(modName).fileName(), Qt::CaseInsensitive) ? ModInfo::EModType::MOD_DLC :
+ (game->CCPlugins().contains(unmanaged->referenceFile(modName).fileName(), Qt::CaseInsensitive) ? ModInfo::EModType::MOD_CC : ModInfo::EModType::MOD_DEFAULT);
+
createFromPlugin(unmanaged->displayName(modName),
unmanaged->referenceFile(modName).absoluteFilePath(),
unmanaged->secondaryFiles(modName),
+ modType,
directoryStructure);
}
}
diff --git a/src/modinfo.h b/src/modinfo.h
index c62df549..0bdf6e43 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -101,6 +101,13 @@ public:
ENDORSED_NEVER
};
+ enum EModType {
+ MOD_DEFAULT,
+ MOD_DLC,
+ MOD_CC
+ };
+
+
public:
/**
@@ -189,7 +196,7 @@ public:
* @param bsaNames names of archives
* @return a new mod
*/
- static ModInfo::Ptr createFromPlugin(const QString &modName, const QString &espName, const QStringList &bsaNames, MOShared::DirectoryEntry **directoryStructure);
+ static ModInfo::Ptr createFromPlugin(const QString &modName, const QString &espName, const QStringList &bsaNames, ModInfo::EModType modType, MOShared::DirectoryEntry **directoryStructure);
/**
* @brief retieve a name for one of the CONTENT_ enums
diff --git a/src/modinfoforeign.cpp b/src/modinfoforeign.cpp
index 6ad8b6d8..0bde2c30 100644
--- a/src/modinfoforeign.cpp
+++ b/src/modinfoforeign.cpp
@@ -50,9 +50,19 @@ QString ModInfoForeign::getDescription() const
ModInfoForeign::ModInfoForeign(const QString &modName,
const QString &referenceFile,
const QStringList &archives,
+ ModInfo::EModType modType,
DirectoryEntry **directoryStructure)
: ModInfoWithConflictInfo(directoryStructure),
m_ReferenceFile(referenceFile), m_Archives(archives) {
m_CreationTime = QFileInfo(referenceFile).created();
- m_Name = "Unmanaged: " + modName;
+ switch (modType) {
+ case ModInfo::EModType::MOD_DLC:
+ m_Name = "DLC: " + modName;
+ break;
+ case ModInfo::EModType::MOD_CC:
+ m_Name = "Creation Club: " + modName;
+ break;
+ default:
+ m_Name = "Unmanaged: " + modName;
+ }
}
diff --git a/src/modinfoforeign.h b/src/modinfoforeign.h
index 839bcdce..d60064f0 100644
--- a/src/modinfoforeign.h
+++ b/src/modinfoforeign.h
@@ -52,7 +52,7 @@ public:
protected:
ModInfoForeign(const QString &modName, const QString &referenceFile,
- const QStringList &archives,
+ const QStringList &archives, ModInfo::EModType modType,
MOShared::DirectoryEntry **directoryStructure);
private:
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp
index 61d33fe9..6392d44b 100644
--- a/src/pluginlist.cpp
+++ b/src/pluginlist.cpp
@@ -347,7 +347,26 @@ void PluginList::readLockedOrderFrom(const QString &fileName)
if ((line.size() > 0) && (line.at(0) != '#')) {
QList fields = line.split('|');
if (fields.count() == 2) {
- m_LockedOrder[QString::fromUtf8(fields.at(0))] = fields.at(1).trimmed().toInt();
+ int priority = fields.at(1).trimmed().toInt();
+ QString name = QString::fromUtf8(fields.at(0));
+ // Avoid locking a force-enabled plugin
+ if (!m_ESPs[m_ESPsByName.at(name)].m_ForceEnabled) {
+ // Is this an open and unclaimed priority?
+ if (m_ESPs[m_ESPsByPriority.at(priority)].m_ForceEnabled ||
+ std::find_if(m_LockedOrder.begin(), m_LockedOrder.end(), [&](const std::pair &a) { return a.second == priority; }) != m_LockedOrder.end()) {
+ // Attempt to find a priority but step over force-enabled plugins and already-set locks
+ int calcPriority = priority;
+ do {
+ ++calcPriority;
+ } while (calcPriority < m_ESPsByPriority.size() || (m_ESPs[m_ESPsByPriority.at(calcPriority)].m_ForceEnabled &&
+ std::find_if(m_LockedOrder.begin(), m_LockedOrder.end(), [&](const std::pair &a) { return a.second == calcPriority; }) != m_LockedOrder.end()));
+ // If we have a match, we can reassign the priority...
+ if (calcPriority < m_ESPsByPriority.size())
+ m_LockedOrder[name] = calcPriority;
+ } else {
+ m_LockedOrder[name] = priority;
+ }
+ }
} else {
reportError(tr("The file containing locked plugin indices is broken"));
break;
@@ -467,7 +486,10 @@ bool PluginList::isESPLocked(int index) const
void PluginList::lockESPIndex(int index, bool lock)
{
if (lock) {
- m_LockedOrder[getName(index).toLower()] = m_ESPs.at(index).m_LoadOrder;
+ if (!m_ESPs.at(index).m_ForceEnabled)
+ m_LockedOrder[getName(index).toLower()] = m_ESPs.at(index).m_LoadOrder;
+ else
+ return;
} else {
auto iter = m_LockedOrder.find(getName(index).toLower());
if (iter != m_LockedOrder.end()) {
@@ -817,7 +839,9 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const
}
}
if (m_ESPs[index].m_ForceEnabled) {
- toolTip += tr("This plugin can't be disabled (enforced by the game)");
+ QString text = tr("Origin: %1").arg(m_ESPs[index].m_OriginName);
+ text += tr("
This plugin can't be disabled (enforced by the game).");
+ toolTip += text;
} else {
QString text = tr("Origin: %1").arg(m_ESPs[index].m_OriginName);
if (m_ESPs[index].m_Author.size() > 0) {
diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui
index 7a902748..3c47d226 100644
--- a/src/settingsdialog.ui
+++ b/src/settingsdialog.ui
@@ -336,188 +336,6 @@ If you use pre-releases, never contact me directly by e-mail or via private mess
-
-
- Diagnostics
-
-
- -
-
-
-
-
-
- Log Level
-
-
-
- -
-
-
- Decides the amount of data printed to "ModOrganizer.log"
-
-
-
- Decides the amount of data printed to "ModOrganizer.log".
- "Debug" produces very useful information for finding problems. There is usually no noteworthy performance impact but the file may become rather large. If this is a problem you may prefer the "Info" level for regluar use. On the "Error" level the log file usually remains empty.
-
-
-
-
-
- Debug
-
-
- -
-
- Info (recommended)
-
-
- -
-
- Warning
-
-
- -
-
- Error
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
-
-
-
- Crash Dumps
-
-
-
- -
-
-
- Decides which type of crash dumps are collected when injected processes crash.
-
-
-
- Decides which type of crash dumps are collected when injected processes crash.
- "None" Disables the generation of crash dumps by MO.
- "Mini" Default level which generates small dumps (only stack traces).
- "Data" Much larger dumps with additional information which may be need (also data segments).
- "Full" Even larger dumps with a full memory dump of the process.
-
-
-
-
-
- None
-
-
- -
-
- Mini (recommended)
-
-
- -
-
- Data
-
-
- -
-
- Full
-
-
-
-
-
-
- -
-
-
-
-
-
- Max Dumps To Keep
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 60
- 20
-
-
-
-
- -
-
-
- Maximum number of crash dumps to keep on disk. Use 0 for unlimited.
-
-
-
- Maximum number of crash dumps to keep on disk. Use 0 for unlimited.
- Set "Crash Dumps" above to None to disable crash dump collection.
-
-
-
-
-
-
- -
-
-
-
- Logs and crash dumps are stored under your current instance in the <a href="LOGS_FULL_PATH">LOGS_DIR</a>
- and <a href="DUMPS_FULL_PATH">DUMPS_DIR</a> folders.
- Sending logs and/or crash dumps to the developers can help investigate issues.
- It is recommended to compress large log and dmp files before sending.
-
-
-
- true
-
-
- Hint: right click link and copy link location
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 20
- 232
-
-
-
-
-
-
Nexus
@@ -1164,6 +982,188 @@ For the other games this is not a sufficient replacement for AI!
+
+
+ Diagnostics
+
+
+ -
+
+
-
+
+
+ Log Level
+
+
+
+ -
+
+
+ Decides the amount of data printed to "ModOrganizer.log"
+
+
+
+ Decides the amount of data printed to "ModOrganizer.log".
+ "Debug" produces very useful information for finding problems. There is usually no noteworthy performance impact but the file may become rather large. If this is a problem you may prefer the "Info" level for regluar use. On the "Error" level the log file usually remains empty.
+
+
+
-
+
+ Debug
+
+
+ -
+
+ Info (recommended)
+
+
+ -
+
+ Warning
+
+
+ -
+
+ Error
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
-
+
+
+ Crash Dumps
+
+
+
+ -
+
+
+ Decides which type of crash dumps are collected when injected processes crash.
+
+
+
+ Decides which type of crash dumps are collected when injected processes crash.
+ "None" Disables the generation of crash dumps by MO.
+ "Mini" Default level which generates small dumps (only stack traces).
+ "Data" Much larger dumps with additional information which may be need (also data segments).
+ "Full" Even larger dumps with a full memory dump of the process.
+
+
+
-
+
+ None
+
+
+ -
+
+ Mini (recommended)
+
+
+ -
+
+ Data
+
+
+ -
+
+ Full
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Max Dumps To Keep
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 60
+ 20
+
+
+
+
+ -
+
+
+ Maximum number of crash dumps to keep on disk. Use 0 for unlimited.
+
+
+
+ Maximum number of crash dumps to keep on disk. Use 0 for unlimited.
+ Set "Crash Dumps" above to None to disable crash dump collection.
+
+
+
+
+
+
+ -
+
+
+
+ Logs and crash dumps are stored under your current instance in the <a href="LOGS_FULL_PATH">LOGS_DIR</a>
+ and <a href="DUMPS_FULL_PATH">DUMPS_DIR</a> folders.
+ Sending logs and/or crash dumps to the developers can help investigate issues.
+ It is recommended to compress large log and dmp files before sending.
+
+
+
+ true
+
+
+ Hint: right click link and copy link location
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Expanding
+
+
+
+ 20
+ 232
+
+
+
+
+
+
-
--
cgit v1.3.1
From 7b45d807d6c2c8b5663ec53183e81e16a5baf739 Mon Sep 17 00:00:00 2001
From: Jeremy Rimpo
Date: Fri, 15 Dec 2017 15:01:39 -0600
Subject: Restore archive tab and partial functionality
---
src/iuserinterface.h | 4 +
src/mainwindow.cpp | 191 ++++++++++++++++++++++++++++++++++++++++++++++-
src/mainwindow.h | 13 ++++
src/mainwindow.ui | 107 ++++++++++++++++++++++++++
src/modinfo.cpp | 2 +-
src/modinfooverwrite.cpp | 2 +-
src/modinforegular.cpp | 2 +-
src/modlist.cpp | 2 +-
src/organizercore.cpp | 13 ++++
src/organizercore.h | 1 +
10 files changed, 331 insertions(+), 6 deletions(-)
(limited to 'src/modinfo.cpp')
diff --git a/src/iuserinterface.h b/src/iuserinterface.h
index 255c7ac0..7ce71c24 100644
--- a/src/iuserinterface.h
+++ b/src/iuserinterface.h
@@ -28,6 +28,10 @@ public:
virtual void displayModInformation(ModInfo::Ptr modInfo, unsigned int index, int tab) = 0;
+ virtual void updateBSAList(const QStringList &defaultArchives, const QStringList &activeArchives) = 0;
+
+ virtual MOBase::DelayedFileWriterBase &archivesWriter() = 0;
+
virtual ILockedWaitingForProcess* lock() = 0;
virtual void unlock() = 0;
};
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 85808e8d..141bcf2a 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -200,6 +200,7 @@ MainWindow::MainWindow(QSettings &initSettings
, m_OrganizerCore(organizerCore)
, m_PluginContainer(pluginContainer)
, m_DidUpdateMasterList(false)
+ , m_ArchiveListWriter(std::bind(&MainWindow::saveArchiveList, this))
{
QWebEngineProfile::defaultProfile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
QWebEngineProfile::defaultProfile()->setHttpCacheMaximumSize(52428800);
@@ -278,6 +279,8 @@ MainWindow::MainWindow(QSettings &initSettings
ui->espList->setItemDelegateForColumn(PluginList::COL_FLAGS, new GenericIconDelegate(ui->espList));
ui->espList->installEventFilter(m_OrganizerCore.pluginList());
+ ui->bsaList->setLocalMoveOnly(true);
+
bool pluginListAdjusted = registerWidgetState(ui->espList->objectName(), ui->espList->header(), "plugin_list_state");
registerWidgetState(ui->dataTree->objectName(), ui->dataTree->header());
registerWidgetState(ui->downloadView->objectName(),
@@ -358,6 +361,9 @@ MainWindow::MainWindow(QSettings &initSettings
connect(this, SIGNAL(styleChanged(QString)), this, SLOT(updateStyle(QString)));
+ m_CheckBSATimer.setSingleShot(true);
+ connect(&m_CheckBSATimer, SIGNAL(timeout()), this, SLOT(checkBSAList()));
+
connect(ui->espList->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(esplistSelectionsChanged(QItemSelection)));
connect(ui->modList->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(modlistSelectionsChanged(QItemSelection)));
@@ -1378,6 +1384,147 @@ static QStringList toStringList(InputIterator current, InputIterator end)
return result;
}
+void MainWindow::updateBSAList(const QStringList &defaultArchives, const QStringList &activeArchives)
+{
+ m_DefaultArchives = defaultArchives;
+ ui->bsaList->clear();
+ ui->bsaList->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
+ std::vector> items;
+
+ BSAInvalidation * invalidation = m_OrganizerCore.managedGame()->feature();
+ std::vector files = m_OrganizerCore.directoryStructure()->getFiles();
+
+ QStringList plugins = m_OrganizerCore.findFiles("", [](const QString &fileName) -> bool {
+ return fileName.endsWith(".esp", Qt::CaseInsensitive)
+ || fileName.endsWith(".esm", Qt::CaseInsensitive);
+ });
+
+ auto hasAssociatedPlugin = [&](const QString &bsaName) -> bool {
+ for (const QString &pluginName : plugins) {
+ QFileInfo pluginInfo(pluginName);
+ if (bsaName.startsWith(QFileInfo(pluginName).baseName(), Qt::CaseInsensitive)
+ && (m_OrganizerCore.pluginList()->state(pluginInfo.fileName()) == IPluginList::STATE_ACTIVE)) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ for (FileEntry::Ptr current : files) {
+ QFileInfo fileInfo(ToQString(current->getName().c_str()));
+
+ if (fileInfo.suffix().toLower() == "bsa" || fileInfo.suffix().toLower() == "ba2") {
+ int index = activeArchives.indexOf(fileInfo.fileName());
+ if (index == -1) {
+ index = 0xFFFF;
+ }
+ else {
+ index += 2;
+ }
+
+ if ((invalidation != nullptr) && invalidation->isInvalidationBSA(fileInfo.fileName())) {
+ index = 1;
+ }
+
+ int originId = current->getOrigin();
+ FilesOrigin & origin = m_OrganizerCore.directoryStructure()->getOriginByID(originId);
+
+ QTreeWidgetItem * newItem = new QTreeWidgetItem(QStringList()
+ << fileInfo.fileName()
+ << ToQString(origin.getName()));
+ newItem->setData(0, Qt::UserRole, index);
+ newItem->setData(1, Qt::UserRole, originId);
+ newItem->setFlags(newItem->flags() & ~Qt::ItemIsDropEnabled | Qt::ItemIsUserCheckable);
+ newItem->setCheckState(0, (index != -1) ? Qt::Checked : Qt::Unchecked);
+ newItem->setData(0, Qt::UserRole, false);
+ if (m_OrganizerCore.settings().forceEnableCoreFiles()
+ && defaultArchives.contains(fileInfo.fileName())) {
+ newItem->setCheckState(0, Qt::Checked);
+ newItem->setDisabled(true);
+ newItem->setData(0, Qt::UserRole, true);
+ } else if (fileInfo.fileName().compare("update.bsa", Qt::CaseInsensitive) == 0) {
+ newItem->setCheckState(0, Qt::Checked);
+ newItem->setDisabled(true);
+ } else if (hasAssociatedPlugin(fileInfo.fileName())) {
+ newItem->setCheckState(0, Qt::Checked);
+ newItem->setDisabled(true);
+ }
+ if (index < 0) index = 0;
+
+ UINT32 sortValue = ((origin.getPriority() & 0xFFFF) << 16) | (index & 0xFFFF);
+ items.push_back(std::make_pair(sortValue, newItem));
+ }
+ }
+ std::sort(items.begin(), items.end(), BySortValue);
+
+ for (auto iter = items.begin(); iter != items.end(); ++iter) {
+ int originID = iter->second->data(1, Qt::UserRole).toInt();
+
+ FilesOrigin origin = m_OrganizerCore.directoryStructure()->getOriginByID(originID);
+ QString modName("data");
+ unsigned int modIndex = ModInfo::getIndex(ToQString(origin.getName()));
+ if (modIndex != UINT_MAX) {
+ ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex);
+ modName = modInfo->name();
+ }
+ QList items = ui->bsaList->findItems(modName, Qt::MatchFixedString);
+ QTreeWidgetItem * subItem = nullptr;
+ if (items.length() > 0) {
+ subItem = items.at(0);
+ }
+ else {
+ subItem = new QTreeWidgetItem(QStringList(modName));
+ subItem->setFlags(subItem->flags() & ~Qt::ItemIsDragEnabled);
+ ui->bsaList->addTopLevelItem(subItem);
+ }
+ subItem->addChild(iter->second);
+ subItem->setExpanded(true);
+ }
+ checkBSAList();
+}
+
+void MainWindow::checkBSAList()
+{
+ DataArchives * archives = m_OrganizerCore.managedGame()->feature();
+
+ if (archives != nullptr) {
+ ui->bsaList->blockSignals(true);
+ ON_BLOCK_EXIT([&]() { ui->bsaList->blockSignals(false); });
+
+ QStringList defaultArchives = archives->archives(m_OrganizerCore.currentProfile());
+
+ bool warning = false;
+
+ for (int i = 0; i < ui->bsaList->topLevelItemCount(); ++i) {
+ bool modWarning = false;
+ QTreeWidgetItem * tlItem = ui->bsaList->topLevelItem(i);
+ for (int j = 0; j < tlItem->childCount(); ++j) {
+ QTreeWidgetItem * item = tlItem->child(j);
+ QString filename = item->text(0);
+ item->setIcon(0, QIcon());
+ item->setToolTip(0, QString());
+
+ if (item->checkState(0) == Qt::Unchecked) {
+ if (defaultArchives.contains(filename)) {
+ item->setIcon(0, QIcon(":/MO/gui/warning"));
+ item->setToolTip(0, tr("This bsa is enabled in the ini file so it may be required!"));
+ modWarning = true;
+ }
+ }
+ }
+ if (modWarning) {
+ ui->bsaList->expandItem(ui->bsaList->topLevelItem(i));
+ warning = true;
+ }
+ }
+ if (warning) {
+ ui->tabWidget->setTabIcon(1, QIcon(":/MO/gui/warning"));
+ } else {
+ ui->tabWidget->setTabIcon(1, QIcon());
+ }
+ }
+}
+
void MainWindow::saveModMetas()
{
for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) {
@@ -1524,10 +1671,12 @@ void MainWindow::on_tabWidget_currentChanged(int index)
if (index == 0) {
m_OrganizerCore.refreshESPList();
} else if (index == 1) {
- refreshDataTree();
+ m_OrganizerCore.refreshBSAList();
} else if (index == 2) {
- refreshSaveList();
+ refreshDataTree();
} else if (index == 3) {
+ refreshSaveList();
+ } else if (index == 4) {
ui->downloadView->scrollToBottom();
}
}
@@ -1806,6 +1955,7 @@ void MainWindow::modorder_changed()
}
m_OrganizerCore.refreshBSAList();
m_OrganizerCore.currentProfile()->modlistWriter().write();
+ m_ArchiveListWriter.write();
m_OrganizerCore.directoryStructure()->getFileRegister()->sortOrigins();
{ // refresh selection
@@ -2741,6 +2891,31 @@ void MainWindow::replaceCategories_MenuHandler() {
refreshFilters();
}
+void MainWindow::saveArchiveList()
+{
+ if (m_OrganizerCore.isArchivesInit()) {
+ SafeWriteFile archiveFile(m_OrganizerCore.currentProfile()->getArchivesFileName());
+ for (int i = 0; i < ui->bsaList->topLevelItemCount(); ++i) {
+ QTreeWidgetItem * tlItem = ui->bsaList->topLevelItem(i);
+ for (int j = 0; j < tlItem->childCount(); ++j) {
+ QTreeWidgetItem * item = tlItem->child(j);
+ if (item->checkState(0) == Qt::Checked) {
+ // in managed mode, "register" all enabled archives, otherwise register only the files registered in the ini
+ if (ui->manageArchivesBox->isChecked() ||
+ item->data(0, Qt::UserRole).toBool()) {
+ archiveFile->write(item->text(0).toUtf8().append("\r\n"));
+ }
+ }
+ }
+ }
+ if (archiveFile.commitIfDifferent(m_ArchiveListHash)) {
+ qDebug("%s saved", qPrintable(QDir::toNativeSeparators(m_OrganizerCore.currentProfile()->getArchivesFileName())));
+ }
+ } else {
+ qWarning("archive list not initialised");
+ }
+}
+
void MainWindow::checkModsForUpdates()
{
statusBar()->show();
@@ -3957,6 +4132,12 @@ void MainWindow::displayColumnSelection(const QPoint &pos)
}
}
+void MainWindow::on_bsaList_itemChanged(QTreeWidgetItem*, int)
+{
+ m_ArchiveListWriter.write();
+ m_CheckBSATimer.start(500);
+}
+
void MainWindow::on_actionProblems_triggered()
{
ProblemsDialog problems(m_PluginContainer.plugins(), this);
@@ -4543,6 +4724,12 @@ void MainWindow::on_categoriesOrBtn_toggled(bool checked)
}
}
+void MainWindow::on_managedArchiveLabel_linkHovered(const QString&)
+{
+ QToolTip::showText(QCursor::pos(),
+ ui->managedArchiveLabel->toolTip());
+}
+
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
//Accept copy or move drags to the download window. Link drags are not
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 575bf020..45a41137 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -120,12 +120,15 @@ public:
virtual void unlock() override;
bool addProfile();
+ void updateBSAList(const QStringList &defaultArchives, const QStringList &activeArchives);
void refreshDataTree();
void refreshSaveList();
void setModListSorting(int index);
void setESPListSorting(int index);
+ void saveArchiveList();
+
void registerPluginTool(MOBase::IPluginTool *tool);
void registerModPage(MOBase::IPluginModPage *modPage);
@@ -148,6 +151,8 @@ public:
virtual bool closeWindow();
virtual void setWindowEnabled(bool enabled);
+ virtual MOBase::DelayedFileWriterBase &archivesWriter() override { return m_ArchiveListWriter; }
+
public slots:
void displayColumnSelection(const QPoint &pos);
@@ -346,6 +351,8 @@ private:
std::vector m_RemoveWidget;
+ QByteArray m_ArchiveListHash;
+
bool m_DidUpdateMasterList;
LockedDialogBase *m_LockDialog { nullptr };
@@ -355,6 +362,8 @@ private:
std::vector> m_PersistedGeometry;
+ MOBase::DelayedFileWriter m_ArchiveListWriter;
+
enum class ShortcutType {
Toolbar,
Desktop,
@@ -478,6 +487,8 @@ private slots:
void startExeAction();
+ void checkBSAList();
+
void updateProblemsButton();
void saveModMetas();
@@ -552,6 +563,7 @@ private slots: // ui slots
void on_categoriesList_itemSelectionChanged();
void on_linkButton_pressed();
void on_showHiddenBox_toggled(bool checked);
+ void on_bsaList_itemChanged(QTreeWidgetItem *item, int column);
void on_bossButton_clicked();
void on_saveButton_clicked();
@@ -561,6 +573,7 @@ private slots: // ui slots
void on_actionCopy_Log_to_Clipboard_triggered();
void on_categoriesAndBtn_toggled(bool checked);
void on_categoriesOrBtn_toggled(bool checked);
+ void on_managedArchiveLabel_linkHovered(const QString &link);
};
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 26b9e375..1e7339b8 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -902,6 +902,113 @@ p, li { white-space: pre-wrap; }
+
+
+ Archives
+
+
+
+ 6
+
+
+
+ 6
+
+
+ 6
+
+
+ 6
+
+ -
+
+
-
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ <html><head/><body><p>BSAs are bundles of game assets (textures, scripts, ...). By default, the engine loads these bundles in a separate step from loose files. MO can manage those archives to align their load order with that of loose files:</p><p>If archives are <span style=" font-weight:600;">managed</span>, their load order is specified by the priority of the corresponding mod (left pane), the same as the loose files. You can manually enable any BSA that has no corresponding plugin active.<br/></p><p>If archives are <span style=" font-weight:600;">not managed</span> their load order is specified by the priority of the corresponding plugin (right pane, plugins tab). You can then not manually enable BSAs where the plugin isn't active.</p><p>In either case you can not disable archives if there is a matching plugin, the game will load them no matter what.</p></body></html>
+
+
+ <html><head/><body><p>Have MO manage archives (<a href="#"><span style=" text-decoration: underline; color:#0000ff;">read more</span></a>)</p></body></html>
+
+
+ true
+
+
+
+
+
+ -
+
+
+ Qt::CustomContextMenu
+
+
+ List of available BS Archives. Archives not checked here are not managed by MO and ignore installation order.
+
+
+ BSA files are archives (comparable to .zip files) that contain data assets (meshes, textures, ...) to be used by the game. As such they "compete" with loose files in your data directory over which is loaded.
+ By default, BSAs that share their base name with an enabled ESP (i.e. plugin.esp and plugin.bsa) are automatically loaded and will have precedence over all loose files, the installation order you set up to the left is then ignored!
+
+ BSAs checked here are loaded in such a way that your installation order is obeyed properly.
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+ true
+
+
+ false
+
+
+ false
+
+
+ QAbstractItemView::DragDrop
+
+
+ Qt::MoveAction
+
+
+ QAbstractItemView::SingleSelection
+
+
+ QAbstractItemView::SelectRows
+
+
+ 20
+
+
+ true
+
+
+ 1
+
+
+ false
+
+
+ 200
+
+
+
+ File
+
+
+
+
+
+
Data
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 4f74086f..d3687d31 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -94,7 +94,7 @@ QString ModInfo::getContentTypeName(int contentType)
case CONTENT_PLUGIN: return tr("Plugins");
case CONTENT_TEXTURE: return tr("Textures");
case CONTENT_MESH: return tr("Meshes");
- case CONTENT_BSA: return tr("BSA");
+ case CONTENT_BSA: return tr("Bethesda Archive");
case CONTENT_INTERFACE: return tr("UI Changes");
case CONTENT_SOUND: return tr("Sound Effects");
case CONTENT_SCRIPT: return tr("Scripts");
diff --git a/src/modinfooverwrite.cpp b/src/modinfooverwrite.cpp
index 6b8c9bd9..360212c0 100644
--- a/src/modinfooverwrite.cpp
+++ b/src/modinfooverwrite.cpp
@@ -53,7 +53,7 @@ QStringList ModInfoOverwrite::archives() const
{
QStringList result;
QDir dir(this->absolutePath());
- for (const QString &archive : dir.entryList(QStringList("*.bsa"))) {
+ for (const QString &archive : dir.entryList(QStringList({ "*.bsa", "*.ba2" }))) {
result.append(this->absolutePath() + "/" + archive);
}
return result;
diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp
index 9d94002b..5486bb2c 100644
--- a/src/modinforegular.cpp
+++ b/src/modinforegular.cpp
@@ -551,7 +551,7 @@ QStringList ModInfoRegular::archives() const
{
QStringList result;
QDir dir(this->absolutePath());
- for (const QString &archive : dir.entryList(QStringList("*.bsa"))) {
+ for (const QString &archive : dir.entryList(QStringList({ "*.bsa", "*.ba2" }))) {
result.append(this->absolutePath() + "/" + archive);
}
return result;
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 53350c59..d7b5f471 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -64,7 +64,7 @@ ModList::ModList(QObject *parent)
m_ContentIcons[ModInfo::CONTENT_PLUGIN] = std::make_tuple(":/MO/gui/content/plugin", tr("Game Plugins (ESP/ESM/ESL)"));
m_ContentIcons[ModInfo::CONTENT_INTERFACE] = std::make_tuple(":/MO/gui/content/interface", tr("Interface"));
m_ContentIcons[ModInfo::CONTENT_MESH] = std::make_tuple(":/MO/gui/content/mesh", tr("Meshes"));
- m_ContentIcons[ModInfo::CONTENT_BSA] = std::make_tuple(":/MO/gui/content/bsa", tr("BSA"));
+ m_ContentIcons[ModInfo::CONTENT_BSA] = std::make_tuple(":/MO/gui/content/bsa", tr("Bethesda Archive"));
m_ContentIcons[ModInfo::CONTENT_SCRIPT] = std::make_tuple(":/MO/gui/content/script", tr("Scripts (Papyrus)"));
m_ContentIcons[ModInfo::CONTENT_SKSE] = std::make_tuple(":/MO/gui/content/skse", tr("Script Extender Plugin"));
m_ContentIcons[ModInfo::CONTENT_SKYPROC] = std::make_tuple(":/MO/gui/content/skyproc", tr("SkyProc Patcher"));
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index dd77f19a..1a336d91 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -1494,6 +1494,10 @@ void OrganizerCore::refreshBSAList()
if (m_ActiveArchives.isEmpty()) {
m_ActiveArchives = m_DefaultArchives;
}
+
+ if (m_UserInterface != nullptr) {
+ m_UserInterface->updateBSAList(m_DefaultArchives, m_ActiveArchives);
+ }
m_ArchivesInit = true;
}
@@ -1572,6 +1576,9 @@ void OrganizerCore::updateModInDirectoryStructure(unsigned int index,
// now we need to refresh the bsa list and save it so there is no confusion
// about what archives are avaiable and active
refreshBSAList();
+ if (m_UserInterface != nullptr) {
+ m_UserInterface->archivesWriter().writeImmediately(false);
+ }
std::vector archives = enabledArchives();
m_DirectoryRefresher.setMods(
@@ -1729,6 +1736,9 @@ void OrganizerCore::modStatusChanged(unsigned int index)
= m_DirectoryStructure->getOriginByName(ToWString(modInfo->name()));
origin.enable(false);
}
+ if (m_UserInterface != nullptr) {
+ m_UserInterface->archivesWriter().write();
+ }
}
modInfo->clearCaches();
@@ -1885,6 +1895,9 @@ bool OrganizerCore::saveCurrentLists()
try {
savePluginList();
+ if (m_UserInterface != nullptr) {
+ m_UserInterface->archivesWriter().write();
+ }
} catch (const std::exception &e) {
reportError(tr("failed to save load order: %1").arg(e.what()));
}
diff --git a/src/organizercore.h b/src/organizercore.h
index cf030e0a..decb3d01 100644
--- a/src/organizercore.h
+++ b/src/organizercore.h
@@ -315,6 +315,7 @@ private:
ModList m_ModList;
PluginList m_PluginList;
+
QList> m_PostLoginTasks;
QList> m_PostRefreshTasks;
--
cgit v1.3.1
From 385a888c0bc8e5b4d4a6791e46eed3b5963c403a Mon Sep 17 00:00:00 2001
From: Jeremy Rimpo
Date: Sun, 17 Dec 2017 21:33:04 -0600
Subject: Implement file priority for loose files > archives
---
src/mainwindow.cpp | 24 +++++++--------
src/mainwindow.ui | 30 +++++++++---------
src/modinfo.cpp | 3 +-
src/modinfodialog.cpp | 10 +++---
src/modinfowithconflictinfo.cpp | 10 +++---
src/modlist.cpp | 11 +++----
src/organizercore.cpp | 8 ++---
src/pluginlist.cpp | 26 ++++++++--------
src/shared/directoryentry.cpp | 68 ++++++++++++++++++++++-------------------
src/shared/directoryentry.h | 6 ++--
src/syncoverwritedialog.cpp | 6 ++--
11 files changed, 103 insertions(+), 99 deletions(-)
(limited to 'src/modinfo.cpp')
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 141bcf2a..22e99e37 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1148,17 +1148,17 @@ void MainWindow::updateTo(QTreeWidgetItem *subTree, const std::wstring &director
fileChild->setData(1, Qt::UserRole, source);
fileChild->setData(1, Qt::UserRole + 1, originID);
- std::vector alternatives = current->getAlternatives();
+ std::vector> alternatives = current->getAlternatives();
if (!alternatives.empty()) {
std::wostringstream altString;
altString << ToWString(tr("Also in:
"));
- for (std::vector::iterator altIter = alternatives.begin();
+ for (std::vector>::iterator altIter = alternatives.begin();
altIter != alternatives.end(); ++altIter) {
if (altIter != alternatives.begin()) {
altString << " , ";
}
- altString << "" << m_OrganizerCore.directoryStructure()->getOriginByID(*altIter).getName() << "";
+ altString << "" << m_OrganizerCore.directoryStructure()->getOriginByID(altIter->first).getName() << "";
}
fileChild->setToolTip(1, QString("%1").arg(ToQString(altString.str())));
fileChild->setForeground(1, QBrush(Qt::red));
@@ -1396,7 +1396,8 @@ void MainWindow::updateBSAList(const QStringList &defaultArchives, const QString
QStringList plugins = m_OrganizerCore.findFiles("", [](const QString &fileName) -> bool {
return fileName.endsWith(".esp", Qt::CaseInsensitive)
- || fileName.endsWith(".esm", Qt::CaseInsensitive);
+ || fileName.endsWith(".esm", Qt::CaseInsensitive)
+ || fileName.endsWith(".esl", Qt::CaseInsensitive);
});
auto hasAssociatedPlugin = [&](const QString &bsaName) -> bool {
@@ -1434,7 +1435,7 @@ void MainWindow::updateBSAList(const QStringList &defaultArchives, const QString
<< ToQString(origin.getName()));
newItem->setData(0, Qt::UserRole, index);
newItem->setData(1, Qt::UserRole, originId);
- newItem->setFlags(newItem->flags() & ~Qt::ItemIsDropEnabled | Qt::ItemIsUserCheckable);
+ newItem->setFlags(newItem->flags() & ~(Qt::ItemIsDropEnabled | Qt::ItemIsUserCheckable));
newItem->setCheckState(0, (index != -1) ? Qt::Checked : Qt::Unchecked);
newItem->setData(0, Qt::UserRole, false);
if (m_OrganizerCore.settings().forceEnableCoreFiles()
@@ -1448,6 +1449,9 @@ void MainWindow::updateBSAList(const QStringList &defaultArchives, const QString
} else if (hasAssociatedPlugin(fileInfo.fileName())) {
newItem->setCheckState(0, Qt::Checked);
newItem->setDisabled(true);
+ } else {
+ newItem->setCheckState(0, Qt::Unchecked);
+ newItem->setDisabled(true);
}
if (index < 0) index = 0;
@@ -2900,11 +2904,7 @@ void MainWindow::saveArchiveList()
for (int j = 0; j < tlItem->childCount(); ++j) {
QTreeWidgetItem * item = tlItem->child(j);
if (item->checkState(0) == Qt::Checked) {
- // in managed mode, "register" all enabled archives, otherwise register only the files registered in the ini
- if (ui->manageArchivesBox->isChecked() ||
- item->data(0, Qt::UserRole).toBool()) {
- archiveFile->write(item->text(0).toUtf8().append("\r\n"));
- }
+ archiveFile->write(item->text(0).toUtf8().append("\r\n"));
}
}
}
@@ -3763,8 +3763,8 @@ void MainWindow::previewDataFile()
};
addFunc(file->getOrigin());
- for (int i : file->getAlternatives()) {
- addFunc(i);
+ for (auto alt : file->getAlternatives()) {
+ addFunc(alt.first);
}
if (preview.numVariants() > 0) {
preview.exec();
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 1e7339b8..d8fa1432 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -922,23 +922,23 @@ p, li { white-space: pre-wrap; }
-
-
-
-
-
-
-
-
- true
-
-
-
+
+
+
+
+
+
+
+
+
+
-
- <html><head/><body><p>BSAs are bundles of game assets (textures, scripts, ...). By default, the engine loads these bundles in a separate step from loose files. MO can manage those archives to align their load order with that of loose files:</p><p>If archives are <span style=" font-weight:600;">managed</span>, their load order is specified by the priority of the corresponding mod (left pane), the same as the loose files. You can manually enable any BSA that has no corresponding plugin active.<br/></p><p>If archives are <span style=" font-weight:600;">not managed</span> their load order is specified by the priority of the corresponding plugin (right pane, plugins tab). You can then not manually enable BSAs where the plugin isn't active.</p><p>In either case you can not disable archives if there is a matching plugin, the game will load them no matter what.</p></body></html>
+ <html><head/><body><p>BSAs / BA2s are bundles of game assets (textures, scripts, etc.). By default, the engine loads these bundles in a separate step from loose files. <p>Their load order is specified by the priority of the corresponding plugin (right pane, plugins tab).</p><p>If there is a matching plugin, the game will load them no matter what.</p></body></html>
- <html><head/><body><p>Have MO manage archives (<a href="#"><span style=" text-decoration: underline; color:#0000ff;">read more</span></a>)</p></body></html>
+ <html><head/><body><p>Currently detected archives. (<a href="#"><span style=" text-decoration: underline; color:#0000ff;">What is an archive?</span></a>)</p></body></html>
true
@@ -965,7 +965,7 @@ p, li { white-space: pre-wrap; }
QAbstractItemView::NoEditTriggers
- true
+ false
false
@@ -974,10 +974,10 @@ p, li { white-space: pre-wrap; }
false
- QAbstractItemView::DragDrop
+ QAbstractItemView::NoDragDrop
- Qt::MoveAction
+ Qt::IgnoreAction
QAbstractItemView::SingleSelection
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index d3687d31..c14eedb7 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -123,9 +123,10 @@ ModInfo::Ptr ModInfo::getByIndex(unsigned int index)
{
QMutexLocker locker(&s_Mutex);
- if (index >= s_Collection.size()) {
+ if (index >= s_Collection.size() && index != ULONG_MAX) {
throw MyException(tr("invalid mod index %1").arg(index));
}
+ if (index == ULONG_MAX) return s_Collection[ModInfo::getIndex("Overwrite")];
return s_Collection[index];
}
diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp
index d43808b6..ccd2a122 100644
--- a/src/modinfodialog.cpp
+++ b/src/modinfodialog.cpp
@@ -266,22 +266,22 @@ void ModInfoDialog::refreshLists()
QString fileName = relativeName.mid(0).prepend(m_RootPath);
bool archive;
if ((*iter)->getOrigin(archive) == m_Origin->getID()) {
- std::vector alternatives = (*iter)->getAlternatives();
+ std::vector> alternatives = (*iter)->getAlternatives();
if (!alternatives.empty()) {
std::wostringstream altString;
- for (std::vector::iterator altIter = alternatives.begin();
+ for (std::vector>::iterator altIter = alternatives.begin();
altIter != alternatives.end(); ++altIter) {
if (altIter != alternatives.begin()) {
altString << ", ";
}
- altString << m_Directory->getOriginByID(*altIter).getName();
+ altString << m_Directory->getOriginByID(altIter->first).getName();
}
QStringList fields(relativeName.prepend("..."));
fields.append(ToQString(altString.str()));
QTreeWidgetItem *item = new QTreeWidgetItem(fields);
item->setData(0, Qt::UserRole, fileName);
- item->setData(1, Qt::UserRole, ToQString(m_Directory->getOriginByID(alternatives[0]).getName()));
- item->setData(1, Qt::UserRole + 1, alternatives[0]);
+ item->setData(1, Qt::UserRole, ToQString(m_Directory->getOriginByID(alternatives.begin()->first).getName()));
+ item->setData(1, Qt::UserRole + 1, alternatives.begin()->first);
item->setData(1, Qt::UserRole + 2, archive);
ui->overwriteTree->addTopLevelItem(item);
++numOverwrite;
diff --git a/src/modinfowithconflictinfo.cpp b/src/modinfowithconflictinfo.cpp
index fbf2345f..b8ece783 100644
--- a/src/modinfowithconflictinfo.cpp
+++ b/src/modinfowithconflictinfo.cpp
@@ -57,8 +57,8 @@ void ModInfoWithConflictInfo::doConflictCheck() const
std::vector files = origin.getFiles();
// for all files in this origin
for (FileEntry::Ptr file : files) {
- const std::vector &alternatives = file->getAlternatives();
- if ((alternatives.size() == 0) || (alternatives[0] == dataID)) {
+ const std::vector> &alternatives = file->getAlternatives();
+ if ((alternatives.size() == 0) || (alternatives.begin()->first == dataID)) {
// no alternatives -> no conflict
providesAnything = true;
} else {
@@ -71,9 +71,9 @@ void ModInfoWithConflictInfo::doConflictCheck() const
}
// for all non-providing alternative origins
- for (int altId : alternatives) {
- if ((altId != dataID) && (altId != origin.getID())) {
- FilesOrigin &altOrigin = (*m_DirectoryStructure)->getOriginByID(altId);
+ for (auto altInfo : alternatives) {
+ if ((altInfo.first != dataID) && (altInfo.first != origin.getID())) {
+ FilesOrigin &altOrigin = (*m_DirectoryStructure)->getOriginByID(altInfo.first);
unsigned int altIndex = ModInfo::getIndex(ToQString(altOrigin.getName()));
if (origin.getPriority() > altOrigin.getPriority()) {
m_OverwriteList.insert(altIndex);
diff --git a/src/modlist.cpp b/src/modlist.cpp
index d7b5f471..3afa94b5 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -701,14 +701,13 @@ void ModList::highlightMods(const QItemSelection &selected, const MOShared::Dire
if (fileEntry.get() != nullptr) {
QString fileName;
bool archive = false;
- std::vector origins;
+ std::vector> origins;
{
- std::vector alternatives = fileEntry->getAlternatives();
- origins.push_back(fileEntry->getOrigin(archive));
- origins.insert(origins.end(), alternatives.begin(), alternatives.end());
+ std::vector> alternatives = fileEntry->getAlternatives();
+ origins.insert(origins.end(), std::pair(fileEntry->getOrigin(archive), fileEntry->getArchive()));
}
- for (int originId : origins) {
- MOShared::FilesOrigin &origin = directoryEntry.getOriginByID(originId);
+ for (auto originInfo : origins) {
+ MOShared::FilesOrigin &origin = directoryEntry.getOriginByID(originInfo.first);
for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) {
if (ModInfo::getByIndex(i)->internalName() == QString::fromStdWString(origin.getName())) {
ModInfo::getByIndex(i)->setPluginSelected(true);
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index 1a336d91..98920479 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -1002,9 +1002,9 @@ QStringList OrganizerCore::getFileOrigins(const QString &fileName) const
if (file.get() != nullptr) {
result.append(ToQString(
m_DirectoryStructure->getOriginByID(file->getOrigin()).getName()));
- foreach (int i, file->getAlternatives()) {
+ foreach (auto i, file->getAlternatives()) {
result.append(
- ToQString(m_DirectoryStructure->getOriginByID(i).getName()));
+ ToQString(m_DirectoryStructure->getOriginByID(i.first).getName()));
}
} else {
qDebug("%s not found", qPrintable(fileName));
@@ -1030,9 +1030,9 @@ QList OrganizerCore::findFileInfos(
m_DirectoryStructure->getOriginByID(file->getOrigin(fromArchive))
.getName()));
info.archive = fromArchive ? ToQString(file->getArchive()) : "";
- foreach (int idx, file->getAlternatives()) {
+ foreach (auto idx, file->getAlternatives()) {
info.origins.append(
- ToQString(m_DirectoryStructure->getOriginByID(idx).getName()));
+ ToQString(m_DirectoryStructure->getOriginByID(idx.first).getName()));
}
if (filter(info)) {
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp
index 6392d44b..775086fd 100644
--- a/src/pluginlist.cpp
+++ b/src/pluginlist.cpp
@@ -115,23 +115,23 @@ void PluginList::highlightPlugins(const QItemSelection &selected, const MOShared
}
for (QModelIndex idx : selected.indexes()) {
ModInfo::Ptr selectedMod = ModInfo::getByIndex(idx.data(Qt::UserRole + 1).toInt());
- if (!selectedMod.isNull() && profile.modEnabled(idx.data(Qt::UserRole + 1).toInt())) {
- QDir dir(selectedMod->absolutePath());
- QStringList plugins = dir.entryList(QStringList() << "*.esp" << "*.esm" << "*.esl");
- MOShared::FilesOrigin origin = directoryEntry.getOriginByName(selectedMod->internalName().toStdWString());
- if (plugins.size() > 0) {
- for (auto plugin : plugins) {
+ if (!selectedMod.isNull() && profile.modEnabled(idx.data(Qt::UserRole + 1).toInt())) {
+ QDir dir(selectedMod->absolutePath());
+ QStringList plugins = dir.entryList(QStringList() << "*.esp" << "*.esm" << "*.esl");
+ MOShared::FilesOrigin origin = directoryEntry.getOriginByName(selectedMod->internalName().toStdWString());
+ if (plugins.size() > 0) {
+ for (auto plugin : plugins) {
MOShared::FileEntry::Ptr file = directoryEntry.findFile(plugin.toStdWString());
if (file->getOrigin() != origin.getID()) {
- const std::vector alternatives = file->getAlternatives();
- if (std::find(alternatives.begin(), alternatives.end(), origin.getID()) == alternatives.end())
+ const std::vector> alternatives = file->getAlternatives();
+ if (std::find_if(alternatives.begin(), alternatives.end(), [&](const std::pair& element) { return element.first == origin.getID(); }) == alternatives.end())
continue;
}
- std::map::iterator iter = m_ESPsByName.find(plugin.toLower());
- if (iter != m_ESPsByName.end()) {
- m_ESPs[iter->second].m_ModSelected = true;
- }
- }
+ std::map::iterator iter = m_ESPsByName.find(plugin.toLower());
+ if (iter != m_ESPsByName.end()) {
+ m_ESPs[iter->second].m_ModSelected = true;
+ }
+ }
}
}
}
diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp
index df6a7b5a..e1cba08c 100644
--- a/src/shared/directoryentry.cpp
+++ b/src/shared/directoryentry.cpp
@@ -236,9 +236,10 @@ void FileEntry::addOrigin(int origin, FILETIME fileTime, const std::wstring &arc
m_FileTime = fileTime;
m_Archive = archive;
} else if ((m_Parent != nullptr)
- && (m_Parent->getOriginByID(origin).getPriority() > m_Parent->getOriginByID(m_Origin).getPriority())) {
- if (std::find(m_Alternatives.begin(), m_Alternatives.end(), m_Origin) == m_Alternatives.end()) {
- m_Alternatives.push_back(m_Origin);
+ && (m_Parent->getOriginByID(origin).getPriority() > m_Parent->getOriginByID(m_Origin).getPriority())
+ && (archive.size() == 0 || m_Archive.size() > 0 )) {
+ if (std::find_if(m_Alternatives.begin(), m_Alternatives.end(), [&](const std::pair &i) -> bool { return i.first == m_Origin; }) == m_Alternatives.end()) {
+ m_Alternatives.push_back(std::pair(m_Origin, m_Archive));
}
m_Origin = origin;
m_FileTime = fileTime;
@@ -249,20 +250,20 @@ void FileEntry::addOrigin(int origin, FILETIME fileTime, const std::wstring &arc
// already an origin
return;
}
- for (std::vector::iterator iter = m_Alternatives.begin(); iter != m_Alternatives.end(); ++iter) {
- if (*iter == origin) {
+ for (std::vector>::iterator iter = m_Alternatives.begin(); iter != m_Alternatives.end(); ++iter) {
+ if (iter->first == origin) {
// already an origin
return;
}
if ((m_Parent != nullptr)
- && (m_Parent->getOriginByID(*iter).getPriority() < m_Parent->getOriginByID(origin).getPriority())) {
- m_Alternatives.insert(iter, origin);
+ && (m_Parent->getOriginByID(iter->first).getPriority() < m_Parent->getOriginByID(origin).getPriority())) {
+ m_Alternatives.insert(iter, std::pair(origin, archive));
found = true;
break;
}
}
if (!found) {
- m_Alternatives.push_back(origin);
+ m_Alternatives.push_back(std::pair(origin, archive));
}
}
}
@@ -272,14 +273,14 @@ bool FileEntry::removeOrigin(int origin)
if (m_Origin == origin) {
if (!m_Alternatives.empty()) {
// find alternative with the highest priority
- std::vector::iterator currentIter = m_Alternatives.begin();
- for (std::vector::iterator iter = m_Alternatives.begin(); iter != m_Alternatives.end(); ++iter) {
- if ((m_Parent->getOriginByID(*iter).getPriority() > m_Parent->getOriginByID(*currentIter).getPriority()) &&
- (*iter != origin)) {
+ std::vector>::iterator currentIter = m_Alternatives.begin();
+ for (std::vector>::iterator iter = m_Alternatives.begin(); iter != m_Alternatives.end(); ++iter) {
+ if ((m_Parent->getOriginByID(iter->first).getPriority() > m_Parent->getOriginByID(currentIter->first).getPriority()) &&
+ (iter->first != origin)) {
currentIter = iter;
}
}
- int currentID = *currentIter;
+ int currentID = currentIter->first;
m_Alternatives.erase(currentIter);
m_Origin = currentID;
@@ -303,23 +304,13 @@ bool FileEntry::removeOrigin(int origin)
return true;
}
} else {
- std::vector::iterator newEnd = std::remove(m_Alternatives.begin(), m_Alternatives.end(), origin);
- m_Alternatives.erase(newEnd, m_Alternatives.end());
+ std::vector>::iterator newEnd = std::find_if(m_Alternatives.begin(), m_Alternatives.end(), [&](const std::pair &i) -> bool { return i.first == origin; });
+ if (newEnd != m_Alternatives.end())
+ m_Alternatives.erase(newEnd, m_Alternatives.end());
}
return false;
}
-
-// sorted by priority descending
-static bool ByOriginPriority(DirectoryEntry *entry, int LHS, int RHS)
-{
- int l = entry->getOriginByID(LHS).getPriority(); if (l < 0) l = INT_MAX;
- int r = entry->getOriginByID(RHS).getPriority(); if (r < 0) r = INT_MAX;
-
- return l < r;
-}
-
-
FileEntry::FileEntry()
: m_Index(UINT_MAX), m_Name(), m_Origin(-1), m_Parent(nullptr), m_LastAccessed(time(nullptr))
{
@@ -339,10 +330,23 @@ FileEntry::~FileEntry()
void FileEntry::sortOrigins()
{
- m_Alternatives.push_back(m_Origin);
- std::sort(m_Alternatives.begin(), m_Alternatives.end(), boost::bind(ByOriginPriority, m_Parent, _1, _2));
- m_Origin = m_Alternatives[m_Alternatives.size() - 1];
- m_Alternatives.pop_back();
+ m_Alternatives.push_back(std::pair(m_Origin, m_Archive));
+ std::sort(m_Alternatives.begin(), m_Alternatives.end(), [&](const std::pair &LHS, const std::pair &RHS) -> bool {
+ if ((!LHS.second.size() && !RHS.second.size()) || (LHS.second.size() && RHS.second.size())) {
+ int l = m_Parent->getOriginByID(LHS.first).getPriority(); if (l < 0) l = INT_MAX;
+ int r = m_Parent->getOriginByID(RHS.first).getPriority(); if (r < 0) r = INT_MAX;
+
+ return l < r;
+ }
+
+ if (RHS.second.size()) return false;
+ return true;
+ });
+ if (!m_Alternatives.empty()) {
+ m_Origin = m_Alternatives.back().first;
+ m_Archive = m_Alternatives.back().second;
+ m_Alternatives.pop_back();
+ }
}
@@ -886,9 +890,9 @@ void FileRegister::unregisterFile(FileEntry::Ptr file)
// unregister from origin
int originID = file->getOrigin(ignore);
m_OriginConnection->getByID(originID).removeFile(file->getIndex());
- const std::vector &alternatives = file->getAlternatives();
+ const std::vector> &alternatives = file->getAlternatives();
for (auto iter = alternatives.begin(); iter != alternatives.end(); ++iter) {
- m_OriginConnection->getByID(*iter).removeFile(file->getIndex());
+ m_OriginConnection->getByID(iter->first).removeFile(file->getIndex());
}
// unregister from directory
diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h
index 04b8782b..8dbedaf4 100644
--- a/src/shared/directoryentry.h
+++ b/src/shared/directoryentry.h
@@ -72,7 +72,7 @@ public:
// gets the list of alternative origins (origins with lower priority than the primary one).
// if sortOrigins has been called, it is sorted by priority (ascending)
- const std::vector &getAlternatives() const { return m_Alternatives; }
+ const std::vector> &getAlternatives() const { return m_Alternatives; }
const std::wstring &getName() const { return m_Name; }
int getOrigin() const { return m_Origin; }
@@ -96,9 +96,9 @@ private:
Index m_Index;
std::wstring m_Name;
- int m_Origin;
+ int m_Origin = -1;
std::wstring m_Archive;
- std::vector m_Alternatives;
+ std::vector> m_Alternatives;
DirectoryEntry *m_Parent;
mutable FILETIME m_FileTime;
diff --git a/src/syncoverwritedialog.cpp b/src/syncoverwritedialog.cpp
index aeed0a55..f03e29c5 100644
--- a/src/syncoverwritedialog.cpp
+++ b/src/syncoverwritedialog.cpp
@@ -98,9 +98,9 @@ void SyncOverwriteDialog::readTree(const QString &path, DirectoryEntry *director
bool ignore;
int origin = entry->getOrigin(ignore);
addToComboBox(combo, ToQString(m_DirectoryStructure->getOriginByID(origin).getName()), origin);
- const std::vector &alternatives = entry->getAlternatives();
- for (std::vector::const_iterator iter = alternatives.begin(); iter != alternatives.end(); ++iter) {
- addToComboBox(combo, ToQString(m_DirectoryStructure->getOriginByID(*iter).getName()), *iter);
+ const std::vector> &alternatives = entry->getAlternatives();
+ for (std::vector>::const_iterator iter = alternatives.begin(); iter != alternatives.end(); ++iter) {
+ addToComboBox(combo, ToQString(m_DirectoryStructure->getOriginByID(iter->first).getName()), iter->first);
}
combo->setCurrentIndex(combo->count() - 1);
} else {
--
cgit v1.3.1
From 5e5c9c07291f6b09623d31c92b1fb61c4ede576e Mon Sep 17 00:00:00 2001
From: Sandro Jäckel
Date: Thu, 22 Feb 2018 16:54:34 +0100
Subject: Applied clang-format on source
---
.clang-format | 11 +
src/aboutdialog.cpp | 95 +-
src/aboutdialog.h | 44 +-
src/activatemodsdialog.cpp | 99 +-
src/activatemodsdialog.h | 58 +-
src/bbcode.cpp | 415 +-
src/bbcode.h | 7 +-
src/browserdialog.cpp | 370 +-
src/browserdialog.h | 110 +-
src/browserview.cpp | 77 +-
src/browserview.h | 67 +-
src/categories.cpp | 516 ++-
src/categories.h | 306 +-
src/categoriesdialog.cpp | 320 +-
src/categoriesdialog.h | 46 +-
src/credentialsdialog.cpp | 32 +-
src/credentialsdialog.h | 21 +-
src/csvbuilder.cpp | 345 +-
src/csvbuilder.h | 99 +-
src/descriptionpage.h | 14 +-
src/directoryrefresher.cpp | 203 +-
src/directoryrefresher.h | 200 +-
src/downloadlist.cpp | 123 +-
src/downloadlist.h | 96 +-
src/downloadlistsortproxy.cpp | 71 +-
src/downloadlistsortproxy.h | 27 +-
src/downloadlistwidget.cpp | 482 +--
src/downloadlistwidget.h | 103 +-
src/downloadlistwidgetcompact.cpp | 455 +--
src/downloadlistwidgetcompact.h | 114 +-
src/downloadmanager.cpp | 2325 +++++------
src/downloadmanager.h | 837 ++--
src/editexecutablesdialog.cpp | 459 +--
src/editexecutablesdialog.h | 91 +-
src/eventfilter.cpp | 14 +-
src/eventfilter.h | 16 +-
src/executableslist.cpp | 253 +-
src/executableslist.h | 273 +-
src/filedialogmemory.cpp | 106 +-
src/filedialogmemory.h | 37 +-
src/gameinfoimpl.cpp | 49 +-
src/genericicondelegate.cpp | 44 +-
src/genericicondelegate.h | 45 +-
src/helper.cpp | 90 +-
src/helper.h | 13 +-
src/icondelegate.cpp | 71 +-
src/icondelegate.h | 22 +-
src/ilockedwaitingforprocess.h | 7 +-
src/installationmanager.cpp | 1334 +++---
src/installationmanager.h | 303 +-
src/instancemanager.cpp | 410 +-
src/instancemanager.h | 46 +-
src/iuserinterface.h | 35 +-
src/json.cpp | 823 ++--
src/json.h | 105 +-
src/loadmechanism.cpp | 454 +--
src/loadmechanism.h | 119 +-
src/lockeddialog.cpp | 64 +-
src/lockeddialog.h | 21 +-
src/lockeddialogbase.cpp | 65 +-
src/lockeddialogbase.h | 32 +-
src/logbuffer.cpp | 337 +-
src/logbuffer.h | 78 +-
src/loghighlighter.cpp | 47 +-
src/loghighlighter.h | 9 +-
src/main.cpp | 1052 +++--
src/mainwindow.cpp | 8136 ++++++++++++++++++-------------------
src/mainwindow.h | 691 ++--
src/messagedialog.cpp | 107 +-
src/messagedialog.h | 46 +-
src/moapplication.cpp | 175 +-
src/moapplication.h | 19 +-
src/modeltest.cpp | 496 ++-
src/modeltest.h | 62 +-
src/modflagicondelegate.cpp | 142 +-
src/modflagicondelegate.h | 17 +-
src/modinfo.cpp | 512 ++-
src/modinfo.h | 1111 +++--
src/modinfobackup.cpp | 22 +-
src/modinfobackup.h | 49 +-
src/modinfodialog.cpp | 1832 ++++-----
src/modinfodialog.h | 313 +-
src/modinfoforeign.cpp | 76 +-
src/modinfoforeign.h | 100 +-
src/modinfooverwrite.cpp | 75 +-
src/modinfooverwrite.h | 82 +-
src/modinforegular.cpp | 878 ++--
src/modinforegular.h | 622 ++-
src/modinfowithconflictinfo.cpp | 184 +-
src/modinfowithconflictinfo.h | 62 +-
src/modlist.cpp | 1891 +++++----
src/modlist.h | 432 +-
src/modlistsortproxy.cpp | 646 ++-
src/modlistsortproxy.h | 134 +-
src/modlistview.cpp | 67 +-
src/modlistview.h | 22 +-
src/moshortcut.cpp | 26 +-
src/moshortcut.h | 23 +-
src/motddialog.cpp | 27 +-
src/motddialog.h | 19 +-
src/nexusinterface.cpp | 943 ++---
src/nexusinterface.h | 700 ++--
src/noeditdelegate.cpp | 9 +-
src/noeditdelegate.h | 6 +-
src/nxmaccessmanager.cpp | 478 +--
src/nxmaccessmanager.h | 131 +-
src/organizercore.cpp | 3491 ++++++++--------
src/organizercore.h | 408 +-
src/organizerproxy.cpp | 187 +-
src/organizerproxy.h | 93 +-
src/overwriteinfodialog.cpp | 340 +-
src/overwriteinfodialog.h | 53 +-
src/persistentcookiejar.cpp | 96 +-
src/persistentcookiejar.h | 19 +-
src/plugincontainer.cpp | 502 ++-
src/plugincontainer.h | 115 +-
src/pluginlist.cpp | 1866 ++++-----
src/pluginlist.h | 501 ++-
src/pluginlistsortproxy.cpp | 137 +-
src/pluginlistsortproxy.h | 44 +-
src/pluginlistview.cpp | 66 +-
src/pluginlistview.h | 22 +-
src/previewdialog.cpp | 66 +-
src/previewdialog.h | 24 +-
src/previewgenerator.cpp | 40 +-
src/previewgenerator.h | 24 +-
src/problemsdialog.cpp | 104 +-
src/problemsdialog.h | 30 +-
src/profile.cpp | 1180 +++---
src/profile.h | 569 ++-
src/profileinputdialog.cpp | 28 +-
src/profileinputdialog.h | 19 +-
src/profilesdialog.cpp | 460 +--
src/profilesdialog.h | 81 +-
src/qtgroupingproxy.cpp | 1651 ++++----
src/qtgroupingproxy.h | 235 +-
src/queryoverwritedialog.cpp | 51 +-
src/queryoverwritedialog.h | 39 +-
src/savetextasdialog.cpp | 54 +-
src/savetextasdialog.h | 21 +-
src/selectiondialog.cpp | 107 +-
src/selectiondialog.h | 54 +-
src/selfupdater.cpp | 412 +-
src/selfupdater.h | 142 +-
src/serverinfo.h | 13 +-
src/settings.cpp | 1491 ++++---
src/settings.h | 846 ++--
src/settingsdialog.cpp | 319 +-
src/settingsdialog.h | 53 +-
src/shared/appconfig.cpp | 4 +-
src/shared/appconfig.h | 4 +-
src/shared/directoryentry.cpp | 1332 +++---
src/shared/directoryentry.h | 405 +-
src/shared/error_report.cpp | 98 +-
src/shared/leaktrace.cpp | 70 +-
src/shared/leaktrace.h | 7 +-
src/shared/stackdata.cpp | 219 +-
src/shared/stackdata.h | 43 +-
src/shared/util.cpp | 209 +-
src/shared/util.h | 23 +-
src/shared/windows_error.cpp | 43 +-
src/shared/windows_error.h | 14 +-
src/singleinstance.cpp | 125 +-
src/singleinstance.h | 79 +-
src/spawn.cpp | 244 +-
src/spawn.h | 12 +-
src/syncoverwritedialog.cpp | 215 +-
src/syncoverwritedialog.h | 31 +-
src/transfersavesdialog.cpp | 464 +--
src/transfersavesdialog.h | 81 +-
src/usvfsconnector.cpp | 251 +-
src/usvfsconnector.h | 50 +-
src/viewmarkingscrollbar.cpp | 54 +-
src/viewmarkingscrollbar.h | 20 +-
src/waitingonclosedialog.cpp | 61 +-
src/waitingonclosedialog.h | 23 +-
176 files changed, 26451 insertions(+), 30158 deletions(-)
create mode 100644 .clang-format
(limited to 'src/modinfo.cpp')
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..6e34f96b
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,11 @@
+---
+Language: Cpp
+BasedOnStyle: LLVM
+
+AccessModifierOffset: -4
+AlwaysBreakTemplateDeclarations: true
+ColumnLimit: 120
+DerivePointerAlignment: false
+IndentWidth: 4
+PointerAlignment: Left
+SortUsingDeclarations: true
\ No newline at end of file
diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp
index ed57a217..e79109ad 100644
--- a/src/aboutdialog.cpp
+++ b/src/aboutdialog.cpp
@@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see .
*/
-
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
#include
@@ -30,65 +29,55 @@ along with Mod Organizer. If not, see .
#include
#include
-
-AboutDialog::AboutDialog(const QString &version, QWidget *parent)
- : QDialog(parent)
- , ui(new Ui::AboutDialog)
-{
- ui->setupUi(this);
-
- m_LicenseFiles[LICENSE_LGPL3] = "lgpl-3.0.txt";
- m_LicenseFiles[LICENSE_GPL3] = "gpl-3.0.txt";
- m_LicenseFiles[LICENSE_BSD3] = "bsd3.txt";
- m_LicenseFiles[LICENSE_BOOST] = "boost.txt";
- m_LicenseFiles[LICENSE_CCBY3] = "by-sa3.txt";
- m_LicenseFiles[LICENSE_ZLIB] = "zlib.txt";
- m_LicenseFiles[LICENSE_APACHE2] = "apache-license-2.0.txt";
-
- addLicense("Qt", LICENSE_LGPL3);
- addLicense("Qt Json", LICENSE_GPL3);
- addLicense("Boost Library", LICENSE_BOOST);
- addLicense("7-zip", LICENSE_LGPL3);
- addLicense("ZLib", LICENSE_ZLIB);
- addLicense("Tango Icon Theme", LICENSE_NONE);
- addLicense("RRZE Icon Set", LICENSE_CCBY3);
- addLicense("Icons by Lorc, Delapouite and sbed available on http://game-icons.net", LICENSE_CCBY3);
- addLicense("Castle Core", LICENSE_APACHE2);
- addLicense("LOOT", LICENSE_GPL3);
-
- ui->nameLabel->setText(QString("%1 %2").arg(ui->nameLabel->text()).arg(version));
+AboutDialog::AboutDialog(const QString& version, QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
+ ui->setupUi(this);
+
+ m_LicenseFiles[LICENSE_LGPL3] = "lgpl-3.0.txt";
+ m_LicenseFiles[LICENSE_GPL3] = "gpl-3.0.txt";
+ m_LicenseFiles[LICENSE_BSD3] = "bsd3.txt";
+ m_LicenseFiles[LICENSE_BOOST] = "boost.txt";
+ m_LicenseFiles[LICENSE_CCBY3] = "by-sa3.txt";
+ m_LicenseFiles[LICENSE_ZLIB] = "zlib.txt";
+ m_LicenseFiles[LICENSE_APACHE2] = "apache-license-2.0.txt";
+
+ addLicense("Qt", LICENSE_LGPL3);
+ addLicense("Qt Json", LICENSE_GPL3);
+ addLicense("Boost Library", LICENSE_BOOST);
+ addLicense("7-zip", LICENSE_LGPL3);
+ addLicense("ZLib", LICENSE_ZLIB);
+ addLicense("Tango Icon Theme", LICENSE_NONE);
+ addLicense("RRZE Icon Set", LICENSE_CCBY3);
+ addLicense("Icons by Lorc, Delapouite and sbed available on http://game-icons.net", LICENSE_CCBY3);
+ addLicense("Castle Core", LICENSE_APACHE2);
+ addLicense("LOOT", LICENSE_GPL3);
+
+ ui->nameLabel->setText(QString("%1 %2")
+ .arg(ui->nameLabel->text())
+ .arg(version));
#if defined(HGID)
- ui->revisionLabel->setText(ui->revisionLabel->text() + " " + HGID);
+ ui->revisionLabel->setText(ui->revisionLabel->text() + " " + HGID);
#elif defined(GITID)
- ui->revisionLabel->setText(ui->revisionLabel->text() + " " + GITID);
+ ui->revisionLabel->setText(ui->revisionLabel->text() + " " + GITID);
#else
- ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
+ ui->revisionLabel->setText(ui->revisionLabel->text() + " unknown");
#endif
}
+AboutDialog::~AboutDialog() { delete ui; }
-AboutDialog::~AboutDialog()
-{
- delete ui;
+void AboutDialog::addLicense(const QString& name, Licenses license) {
+ QListWidgetItem* item = new QListWidgetItem(name);
+ item->setData(Qt::UserRole, license);
+ ui->creditsList->addItem(item);
}
-
-void AboutDialog::addLicense(const QString &name, Licenses license)
-{
- QListWidgetItem *item = new QListWidgetItem(name);
- item->setData(Qt::UserRole, license);
- ui->creditsList->addItem(item);
-}
-
-
-void AboutDialog::on_creditsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem*)
-{
- auto iter = m_LicenseFiles.find(current->data(Qt::UserRole).toInt());
- if (iter != m_LicenseFiles.end()) {
- QString filePath = qApp->applicationDirPath() + "/license/" + iter->second;
- QString text = MOBase::readFileText(filePath);
- ui->licenseText->setText(text);
- } else {
- ui->licenseText->setText(tr("No license"));
- }
+void AboutDialog::on_creditsList_currentItemChanged(QListWidgetItem* current, QListWidgetItem*) {
+ auto iter = m_LicenseFiles.find(current->data(Qt::UserRole).toInt());
+ if (iter != m_LicenseFiles.end()) {
+ QString filePath = qApp->applicationDirPath() + "/license/" + iter->second;
+ QString text = MOBase::readFileText(filePath);
+ ui->licenseText->setText(text);
+ } else {
+ ui->licenseText->setText(tr("No license"));
+ }
}
diff --git a/src/aboutdialog.h b/src/aboutdialog.h
index 103a0d2f..a5c93834 100644
--- a/src/aboutdialog.h
+++ b/src/aboutdialog.h
@@ -18,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see .
*/
-
#define ABOUTDIALOG_H
#include
@@ -29,43 +28,38 @@ class QListWidgetItem;
#include
");
- m_TagMap["code"] = std::make_pair(QRegExp("\\[code\\](.*)\\[/code\\]"),
- "\\1
");
- m_TagMap["heading"]= std::make_pair(QRegExp("\\[heading\\](.*)\\[/heading\\]"),
- "\\1
");
- m_TagMap["line"] = std::make_pair(QRegExp("\\[line\\]"),
- "
");
-
- // lists
- m_TagMap["list"] = std::make_pair(QRegExp("\\[list\\](.*)\\[/list\\]"),
- "");
- m_TagMap["list="] = std::make_pair(QRegExp("\\[list.*\\](.*)\\[/list\\]"),
- "\\1
");
- m_TagMap["ul"] = std::make_pair(QRegExp("\\[ul\\](.*)\\[/ul\\]"),
- "");
- m_TagMap["ol"] = std::make_pair(QRegExp("\\[ol\\](.*)\\[/ol\\]"),
- "\\1
");
- m_TagMap["li"] = std::make_pair(QRegExp("\\[li\\](.*)\\[/li\\]"),
- "\\1");
-
- // tables
- m_TagMap["table"] = std::make_pair(QRegExp("\\[table\\](.*)\\[/table\\]"),
- "");
- m_TagMap["tr"] = std::make_pair(QRegExp("\\[tr\\](.*)\\[/tr\\]"),
- "\\1
");
- m_TagMap["th"] = std::make_pair(QRegExp("\\[th\\](.*)\\[/th\\]"),
- "\\1 | ");
- m_TagMap["td"] = std::make_pair(QRegExp("\\[td\\](.*)\\[/td\\]"),
- "\\1 | ");
-
- // web content
- m_TagMap["url"] = std::make_pair(QRegExp("\\[url\\](.*)\\[/url\\]"),
- "\\1");
- m_TagMap["url="] = std::make_pair(QRegExp("\\[url=([^\\]]*)\\](.*)\\[/url\\]"),
- "\\2");
- m_TagMap["img"] = std::make_pair(QRegExp("\\[img\\](.*)\\[/img\\]"),
- "
");
- m_TagMap["img="] = std::make_pair(QRegExp("\\[img=([^\\]]*)\\](.*)\\[/img\\]"),
- "
");
- m_TagMap["email="] = std::make_pair(QRegExp("\\[email=\"?([^\\]]*)\"?\\](.*)\\[/email\\]"),
- "\\2");
- m_TagMap["youtube"] = std::make_pair(QRegExp("\\[youtube\\](.*)\\[/youtube\\]"),
- "http://www.youtube.com/v/\\1");
-
+ BBCodeMap() : m_TagNameExp("^[a-zA-Z*]*=?") {
+ m_TagMap["b"] = std::make_pair(QRegExp("\\[b\\](.*)\\[/b\\]"), "\\1");
+ m_TagMap["i"] = std::make_pair(QRegExp("\\[i\\](.*)\\[/i\\]"), "\\1");
+ m_TagMap["u"] = std::make_pair(QRegExp("\\[u\\](.*)\\[/u\\]"), "\\1");
+ m_TagMap["s"] = std::make_pair(QRegExp("\\[s\\](.*)\\[/s\\]"), "\\1");
+ m_TagMap["sub"] = std::make_pair(QRegExp("\\[sub\\](.*)\\[/sub\\]"), "\\1");
+ m_TagMap["sup"] = std::make_pair(QRegExp("\\[sup\\](.*)\\[/sup\\]"), "\\1");
+ m_TagMap["size="] =
+ std::make_pair(QRegExp("\\[size=([^\\]]*)\\](.*)\\[/size\\]"), "\\2");
+ m_TagMap["color="] = std::make_pair(QRegExp("\\[color=([^\\]]*)\\](.*)\\[/color\\]"), "");
+ m_TagMap["font="] = std::make_pair(QRegExp("\\[font=([^\\]]*)\\](.*)\\[/font\\]"),
+ "\\2");
+ m_TagMap["center"] =
+ std::make_pair(QRegExp("\\[center\\](.*)\\[/center\\]"), "\\1
");
+ m_TagMap["quote"] = std::make_pair(QRegExp("\\[quote\\](.*)\\[/quote\\]"), "\"\\1\"
");
+ m_TagMap["quote="] = std::make_pair(QRegExp("\\[quote=([^\\]]*)\\](.*)\\[/quote\\]"),
+ "\"\\2\"
--\\1
");
+ m_TagMap["code"] = std::make_pair(QRegExp("\\[code\\](.*)\\[/code\\]"), "\\1
");
+ m_TagMap["heading"] =
+ std::make_pair(QRegExp("\\[heading\\](.*)\\[/heading\\]"), "\\1
");
+ m_TagMap["line"] = std::make_pair(QRegExp("\\[line\\]"), "
");
+
+ // lists
+ m_TagMap["list"] = std::make_pair(QRegExp("\\[list\\](.*)\\[/list\\]"), "");
+ m_TagMap["list="] = std::make_pair(QRegExp("\\[list.*\\](.*)\\[/list\\]"), "\\1
");
+ m_TagMap["ul"] = std::make_pair(QRegExp("\\[ul\\](.*)\\[/ul\\]"), "");
+ m_TagMap["ol"] = std::make_pair(QRegExp("\\[ol\\](.*)\\[/ol\\]"), "\\1
");
+ m_TagMap["li"] = std::make_pair(QRegExp("\\[li\\](.*)\\[/li\\]"), "\\1");
+
+ // tables
+ m_TagMap["table"] = std::make_pair(QRegExp("\\[table\\](.*)\\[/table\\]"), "");
+ m_TagMap["tr"] = std::make_pair(QRegExp("\\[tr\\](.*)\\[/tr\\]"), "\\1
");
+ m_TagMap["th"] = std::make_pair(QRegExp("\\[th\\](.*)\\[/th\\]"), "\\1 | ");
+ m_TagMap["td"] = std::make_pair(QRegExp("\\[td\\](.*)\\[/td\\]"), "\\1 | ");
+
+ // web content
+ m_TagMap["url"] = std::make_pair(QRegExp("\\[url\\](.*)\\[/url\\]"), "\\1");
+ m_TagMap["url="] = std::make_pair(QRegExp("\\[url=([^\\]]*)\\](.*)\\[/url\\]"), "\\2");
+ m_TagMap["img"] = std::make_pair(QRegExp("\\[img\\](.*)\\[/img\\]"), "
");
+ m_TagMap["img="] =
+ std::make_pair(QRegExp("\\[img=([^\\]]*)\\](.*)\\[/img\\]"), "
");
+ m_TagMap["email="] =
+ std::make_pair(QRegExp("\\[email=\"?([^\\]]*)\"?\\](.*)\\[/email\\]"), "\\2");
+ m_TagMap["youtube"] =
+ std::make_pair(QRegExp("\\[youtube\\](.*)\\[/youtube\\]"),
+ "http://www.youtube.com/v/\\1");
+
+ // make all patterns non-greedy and case-insensitive
+ for (TagMap::iterator iter = m_TagMap.begin(); iter != m_TagMap.end(); ++iter) {
+ iter->second.first.setCaseSensitivity(Qt::CaseInsensitive);
+ iter->second.first.setMinimal(true);
+ }
- // make all patterns non-greedy and case-insensitive
- for (TagMap::iterator iter = m_TagMap.begin(); iter != m_TagMap.end(); ++iter) {
- iter->second.first.setCaseSensitivity(Qt::CaseInsensitive);
- iter->second.first.setMinimal(true);
+ // this tag is in fact greedy
+ m_TagMap["*"] = std::make_pair(QRegExp("\\[\\*\\](.*)"), "\\1");
+
+ m_ColorMap.insert(std::make_pair("red", "FF0000"));
+ m_ColorMap.insert(std::make_pair("green", "00FF00"));
+ m_ColorMap.insert(std::make_pair("blue", "0000FF"));
+ m_ColorMap.insert(std::make_pair("black", "000000"));
+ m_ColorMap.insert(std::make_pair("gray", "7F7F7F"));
+ m_ColorMap.insert(std::make_pair("white", "FFFFFF"));
+ m_ColorMap.insert(std::make_pair("yellow", "FFFF00"));
+ m_ColorMap.insert(std::make_pair("cyan", "00FFFF"));
+ m_ColorMap.insert(std::make_pair("magenta", "FF00FF"));
+ m_ColorMap.insert(std::make_pair("brown", "A52A2A"));
+ m_ColorMap.insert(std::make_pair("orange", "FFA500"));
+ m_ColorMap.insert(std::make_pair("gold", "FFD700"));
+ m_ColorMap.insert(std::make_pair("deepskyblue", "00BFFF"));
+ m_ColorMap.insert(std::make_pair("salmon", "FA8072"));
+ m_ColorMap.insert(std::make_pair("dodgerblue", "1E90FF"));
+ m_ColorMap.insert(std::make_pair("greenyellow", "ADFF2F"));
+ m_ColorMap.insert(std::make_pair("peru", "CD853F"));
}
- // this tag is in fact greedy
- m_TagMap["*"] = std::make_pair(QRegExp("\\[\\*\\](.*)"),
- "\\1");
-
- m_ColorMap.insert(std::make_pair("red", "FF0000"));
- m_ColorMap.insert(std::make_pair("green", "00FF00"));
- m_ColorMap.insert(std::make_pair("blue", "0000FF"));
- m_ColorMap.insert(std::make_pair("black", "000000"));
- m_ColorMap.insert(std::make_pair("gray", "7F7F7F"));
- m_ColorMap.insert(std::make_pair("white", "FFFFFF"));
- m_ColorMap.insert(std::make_pair("yellow", "FFFF00"));
- m_ColorMap.insert(std::make_pair("cyan", "00FFFF"));
- m_ColorMap.insert(std::make_pair("magenta", "FF00FF"));
- m_ColorMap.insert(std::make_pair("brown", "A52A2A"));
- m_ColorMap.insert(std::make_pair("orange", "FFA500"));
- m_ColorMap.insert(std::make_pair("gold", "FFD700"));
- m_ColorMap.insert(std::make_pair("deepskyblue", "00BFFF"));
- m_ColorMap.insert(std::make_pair("salmon", "FA8072"));
- m_ColorMap.insert(std::make_pair("dodgerblue", "1E90FF"));
- m_ColorMap.insert(std::make_pair("greenyellow", "ADFF2F"));
- m_ColorMap.insert(std::make_pair("peru", "CD853F"));
- }
-
private:
-
- QRegExp m_TagNameExp;
- TagMap m_TagMap;
- std::map m_ColorMap;
+ QRegExp m_TagNameExp;
+ TagMap m_TagMap;
+ std::map m_ColorMap;
};
-
-QString convertToHTML(const QString &inputParam)
-{
- // this code goes over the input string once and replaces all bbtags
- // it encounters. This function is called recursively for every replaced
- // string to convert nested tags.
- //
- // This could be implemented simpler by applying a set of regular expressions
- // for each recognized bb-tag one after the other but that would probably be
- // very inefficient (O(n^2)).
-
- QString input = inputParam.mid(0).replace("\r\n", "
");
- input.replace("\\\"", "\"").replace("\\'", "'");
- QString result;
- int lastBlock = 0;
- int pos = 0;
-
- // iterate over the input buffer
- while ((pos = input.indexOf('[', lastBlock)) != -1) {
- // append everything between the previous tag-block and the current one
- result.append(input.midRef(lastBlock, pos - lastBlock));
-
- if ((pos < (input.size() - 1)) && (input.at(pos + 1) == '/')) {
- // skip invalid end tag
- int tagEnd = input.indexOf(']', pos) + 1;
- pos = tagEnd;
- } else {
- // convert the tag and content if necessary
- int length = -1;
- QString replacement = BBCodeMap::instance().convertTag(input.mid(pos), length);
- if (length != 0) {
- result.append(convertToHTML(replacement));
- // length contains the number of characters in the original tag
- pos += length;
- } else {
- // nothing replaced
- result.append('[');
- ++pos;
- }
+QString convertToHTML(const QString& inputParam) {
+ // this code goes over the input string once and replaces all bbtags
+ // it encounters. This function is called recursively for every replaced
+ // string to convert nested tags.
+ //
+ // This could be implemented simpler by applying a set of regular expressions
+ // for each recognized bb-tag one after the other but that would probably be
+ // very inefficient (O(n^2)).
+
+ QString input = inputParam.mid(0).replace("\r\n", "
");
+ input.replace("\\\"", "\"").replace("\\'", "'");
+ QString result;
+ int lastBlock = 0;
+ int pos = 0;
+
+ // iterate over the input buffer
+ while ((pos = input.indexOf('[', lastBlock)) != -1) {
+ // append everything between the previous tag-block and the current one
+ result.append(input.midRef(lastBlock, pos - lastBlock));
+
+ if ((pos < (input.size() - 1)) && (input.at(pos + 1) == '/')) {
+ // skip invalid end tag
+ int tagEnd = input.indexOf(']', pos) + 1;
+ pos = tagEnd;
+ } else {
+ // convert the tag and content if necessary
+ int length = -1;
+ QString replacement = BBCodeMap::instance().convertTag(input.mid(pos), length);
+ if (length != 0) {
+ result.append(convertToHTML(replacement));
+ // length contains the number of characters in the original tag
+ pos += length;
+ } else {
+ // nothing replaced
+ result.append('[');
+ ++pos;
+ }
+ }
+ lastBlock = pos;
}
- lastBlock = pos;
- }
- // append the remainder (everything after the last tag)
- result.append(input.midRef(lastBlock));
- return result;
+ // append the remainder (everything after the last tag)
+ result.append(input.midRef(lastBlock));
+ return result;
}
} // namespace BBCode
-
diff --git a/src/bbcode.h b/src/bbcode.h
index 708dfe71..d8a10337 100644
--- a/src/bbcode.h
+++ b/src/bbcode.h
@@ -20,10 +20,8 @@ along with Mod Organizer. If not, see .
#ifndef BBCODE_H
#define BBCODE_H
-
#include
-
namespace BBCode {
/**
@@ -32,9 +30,8 @@ namespace BBCode {
* @param replaceOccured if not nullptr, this parameter will be set to true if any bb tags were replaced
* @return the same string in html representation
**/
-QString convertToHTML(const QString &input);
-
-}
+QString convertToHTML(const QString& input);
+} // namespace BBCode
#endif // BBCODE_H
diff --git a/src/browserdialog.cpp b/src/browserdialog.cpp
index c2c65acc..d5a43332 100644
--- a/src/browserdialog.cpp
+++ b/src/browserdialog.cpp
@@ -19,276 +19,228 @@ along with Mod Organizer. If not, see .
#include "browserdialog.h"
-#include "ui_browserdialog.h"
#include "browserview.h"
#include "messagedialog.h"
-#include "report.h"
#include "persistentcookiejar.h"
+#include "report.h"
+#include "ui_browserdialog.h"
-#include
#include "settings.h"
+#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
#include
+#include
+#include
#include
+#include
+#include
+#include
+#include
+#include
+BrowserDialog::BrowserDialog(QWidget* parent)
+ : QDialog(parent), ui(new Ui::BrowserDialog), m_AccessManager(new QNetworkAccessManager(this)) {
+ ui->setupUi(this);
+ m_AccessManager->setCookieJar(
+ new PersistentCookieJar(QDir::fromNativeSeparators(Settings::instance().getCacheDirectory() + "/cookies.dat")));
-BrowserDialog::BrowserDialog(QWidget *parent)
- : QDialog(parent)
- , ui(new Ui::BrowserDialog)
- , m_AccessManager(new QNetworkAccessManager(this))
-{
- ui->setupUi(this);
-
- m_AccessManager->setCookieJar(new PersistentCookieJar(
- QDir::fromNativeSeparators(Settings::instance().getCacheDirectory() + "/cookies.dat")));
-
- Qt::WindowFlags flags = windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint;
- Qt::WindowFlags helpFlag = Qt::WindowContextHelpButtonHint;
- flags = flags & (~helpFlag);
- setWindowFlags(flags);
+ Qt::WindowFlags flags = windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint;
+ Qt::WindowFlags helpFlag = Qt::WindowContextHelpButtonHint;
+ flags = flags & (~helpFlag);
+ setWindowFlags(flags);
- m_Tabs = this->findChild("browserTabWidget");
+ m_Tabs = this->findChild("browserTabWidget");
- installEventFilter(this);
+ installEventFilter(this);
- connect(m_Tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));
+ connect(m_Tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));
- ui->urlEdit->setVisible(false);
+ ui->urlEdit->setVisible(false);
}
-BrowserDialog::~BrowserDialog()
-{
- delete ui;
-}
+BrowserDialog::~BrowserDialog() { delete ui; }
-void BrowserDialog::closeEvent(QCloseEvent *event)
-{
-// m_AccessManager->showCookies();
- QDialog::closeEvent(event);
+void BrowserDialog::closeEvent(QCloseEvent* event) {
+ // m_AccessManager->showCookies();
+ QDialog::closeEvent(event);
}
-void BrowserDialog::initTab(BrowserView *newView)
-{
- //newView->page()->setNetworkAccessManager(m_AccessManager);
- //newView->page()->setForwardUnsupportedContent(true);
-
- connect(newView, SIGNAL(loadProgress(int)), this, SLOT(progress(int)));
- connect(newView, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged(QString)));
- connect(newView, SIGNAL(initTab(BrowserView*)), this, SLOT(initTab(BrowserView*)));
- connect(newView, SIGNAL(startFind()), this, SLOT(startSearch()));
- connect(newView, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
- connect(newView, SIGNAL(openUrlInNewTab(QUrl)), this, SLOT(openInNewTab(QUrl)));
- connect(newView, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));
- connect(newView, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent(QNetworkReply*)));
-
- ui->backBtn->setEnabled(false);
- ui->fwdBtn->setEnabled(false);
- m_Tabs->addTab(newView, tr("new"));
- newView->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
- newView->settings()->setAttribute(QWebEngineSettings::AutoLoadImages, true);
-}
+void BrowserDialog::initTab(BrowserView* newView) {
+ // newView->page()->setNetworkAccessManager(m_AccessManager);
+ // newView->page()->setForwardUnsupportedContent(true);
+ connect(newView, SIGNAL(loadProgress(int)), this, SLOT(progress(int)));
+ connect(newView, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged(QString)));
+ connect(newView, SIGNAL(initTab(BrowserView*)), this, SLOT(initTab(BrowserView*)));
+ connect(newView, SIGNAL(startFind()), this, SLOT(startSearch()));
+ connect(newView, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
+ connect(newView, SIGNAL(openUrlInNewTab(QUrl)), this, SLOT(openInNewTab(QUrl)));
+ connect(newView, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest)));
+ connect(newView, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent(QNetworkReply*)));
-void BrowserDialog::openInNewTab(const QUrl &url)
-{
- BrowserView *newView = new BrowserView(this);
- initTab(newView);
- newView->setUrl(url);
+ ui->backBtn->setEnabled(false);
+ ui->fwdBtn->setEnabled(false);
+ m_Tabs->addTab(newView, tr("new"));
+ newView->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
+ newView->settings()->setAttribute(QWebEngineSettings::AutoLoadImages, true);
}
-
-BrowserView *BrowserDialog::getCurrentView()
-{
- return qobject_cast(m_Tabs->currentWidget());
+void BrowserDialog::openInNewTab(const QUrl& url) {
+ BrowserView* newView = new BrowserView(this);
+ initTab(newView);
+ newView->setUrl(url);
}
+BrowserView* BrowserDialog::getCurrentView() { return qobject_cast(m_Tabs->currentWidget()); }
-void BrowserDialog::urlChanged(const QUrl &url)
-{
- BrowserView *currentView = getCurrentView();
- if (currentView != nullptr) {
- ui->backBtn->setEnabled(currentView->history()->canGoBack());
- ui->fwdBtn->setEnabled(currentView->history()->canGoForward());
- }
- ui->urlEdit->setText(url.toString());
+void BrowserDialog::urlChanged(const QUrl& url) {
+ BrowserView* currentView = getCurrentView();
+ if (currentView != nullptr) {
+ ui->backBtn->setEnabled(currentView->history()->canGoBack());
+ ui->fwdBtn->setEnabled(currentView->history()->canGoForward());
+ }
+ ui->urlEdit->setText(url.toString());
}
-
-void BrowserDialog::openUrl(const QUrl &url)
-{
- if (isHidden()) {
- show();
- }
- openInNewTab(url);
+void BrowserDialog::openUrl(const QUrl& url) {
+ if (isHidden()) {
+ show();
+ }
+ openInNewTab(url);
}
+void BrowserDialog::maximizeWidth() {
+ int viewportWidth = getCurrentView()->page()->contentsSize().width();
+ int frameWidth = width() - viewportWidth;
-void BrowserDialog::maximizeWidth()
-{
- int viewportWidth = getCurrentView()->page()->contentsSize ().width();
- int frameWidth = width() - viewportWidth;
-
- int contentWidth = getCurrentView()->page()->contentsSize().width();
-
- QDesktopWidget screen;
- int currentScreen = screen.screenNumber(this);
- int screenWidth = screen.screenGeometry(currentScreen).size().width();
-
- int targetWidth = std::min(std::max(viewportWidth, contentWidth) + frameWidth, screenWidth);
- this->resize(targetWidth, height());
-}
+ int contentWidth = getCurrentView()->page()->contentsSize().width();
+ QDesktopWidget screen;
+ int currentScreen = screen.screenNumber(this);
+ int screenWidth = screen.screenGeometry(currentScreen).size().width();
-void BrowserDialog::progress(int value)
-{
- ui->loadProgress->setValue(value);
- if (value == 100) {
- maximizeWidth();
- ui->loadProgress->setVisible(false);
- } else {
- ui->loadProgress->setVisible(true);
- }
+ int targetWidth = std::min(std::max(viewportWidth, contentWidth) + frameWidth, screenWidth);
+ this->resize(targetWidth, height());
}
-
-void BrowserDialog::titleChanged(const QString &title)
-{
- BrowserView *view = qobject_cast(sender());
- for (int i = 0; i < m_Tabs->count(); ++i) {
- if (m_Tabs->widget(i) == view) {
- m_Tabs->setTabText(i, title.mid(0, 15));
- m_Tabs->setTabToolTip(i, title);
+void BrowserDialog::progress(int value) {
+ ui->loadProgress->setValue(value);
+ if (value == 100) {
+ maximizeWidth();
+ ui->loadProgress->setVisible(false);
+ } else {
+ ui->loadProgress->setVisible(true);
}
- }
}
-
-QString BrowserDialog::guessFileName(const QString &url)
-{
- QRegExp uploadsExp(QString("http://.+/uploads/([^/]+)$"));
- if (uploadsExp.indexIn(url) != -1) {
- // these seem to be premium downloads
- return uploadsExp.cap(1);
- }
-
- QRegExp filesExp(QString("http://.+\\?file=([^&]+)"));
- if (filesExp.indexIn(url) != -1) {
- // a regular manual download?
- return filesExp.cap(1);
- }
- return "unknown";
+void BrowserDialog::titleChanged(const QString& title) {
+ BrowserView* view = qobject_cast(sender());
+ for (int i = 0; i < m_Tabs->count(); ++i) {
+ if (m_Tabs->widget(i) == view) {
+ m_Tabs->setTabText(i, title.mid(0, 15));
+ m_Tabs->setTabToolTip(i, title);
+ }
+ }
}
-void BrowserDialog::unsupportedContent(QNetworkReply *reply)
-{
- try {
- QWebEnginePage *page = qobject_cast(sender());
- if (page == nullptr) {
- qCritical("sender not a page");
- return;
- }
- BrowserView *view = qobject_cast(page->view());
- if (view == nullptr) {
- qCritical("no view?");
- return;
+QString BrowserDialog::guessFileName(const QString& url) {
+ QRegExp uploadsExp(QString("http://.+/uploads/([^/]+)$"));
+ if (uploadsExp.indexIn(url) != -1) {
+ // these seem to be premium downloads
+ return uploadsExp.cap(1);
}
- emit requestDownload(view->url(), reply);
- } catch (const std::exception &e) {
- if (isVisible()) {
- MessageDialog::showMessage(tr("failed to start download"), this);
+ QRegExp filesExp(QString("http://.+\\?file=([^&]+)"));
+ if (filesExp.indexIn(url) != -1) {
+ // a regular manual download?
+ return filesExp.cap(1);
+ }
+ return "unknown";
+}
+
+void BrowserDialog::unsupportedContent(QNetworkReply* reply) {
+ try {
+ QWebEnginePage* page = qobject_cast(sender());
+ if (page == nullptr) {
+ qCritical("sender not a page");
+ return;
+ }
+ BrowserView* view = qobject_cast(page->view());
+ if (view == nullptr) {
+ qCritical("no view?");
+ return;
+ }
+
+ emit requestDownload(view->url(), reply);
+ } catch (const std::exception& e) {
+ if (isVisible()) {
+ MessageDialog::showMessage(tr("failed to start download"), this);
+ }
+ qCritical("exception downloading unsupported content: %s", e.what());
}
- qCritical("exception downloading unsupported content: %s", e.what());
- }
-}
-
-
-void BrowserDialog::downloadRequested(const QNetworkRequest &request)
-{
- qCritical("download request %s ignored", request.url().toString().toUtf8().constData());
}
-
-void BrowserDialog::tabCloseRequested(int index)
-{
- if (m_Tabs->count() == 1) {
- this->close();
- } else {
- m_Tabs->widget(index)->deleteLater();
- m_Tabs->removeTab(index);
- }
+void BrowserDialog::downloadRequested(const QNetworkRequest& request) {
+ qCritical("download request %s ignored", request.url().toString().toUtf8().constData());
}
-void BrowserDialog::on_backBtn_clicked()
-{
- BrowserView *currentView = getCurrentView();
- if (currentView != nullptr) {
- currentView->back();
- }
+void BrowserDialog::tabCloseRequested(int index) {
+ if (m_Tabs->count() == 1) {
+ this->close();
+ } else {
+ m_Tabs->widget(index)->deleteLater();
+ m_Tabs->removeTab(index);
+ }
}
-void BrowserDialog::on_fwdBtn_clicked()
-{
- BrowserView *currentView = getCurrentView();
- if (currentView != nullptr) {
- currentView->forward();
- }
+void BrowserDialog::on_backBtn_clicked() {
+ BrowserView* currentView = getCurrentView();
+ if (currentView != nullptr) {
+ currentView->back();
+ }
}
-
-void BrowserDialog::startSearch()
-{
- ui->searchEdit->setFocus();
+void BrowserDialog::on_fwdBtn_clicked() {
+ BrowserView* currentView = getCurrentView();
+ if (currentView != nullptr) {
+ currentView->forward();
+ }
}
+void BrowserDialog::startSearch() { ui->searchEdit->setFocus(); }
-void BrowserDialog::on_searchEdit_returnPressed()
-{
-// BrowserView *currentView = getCurrentView();
-// if (currentView != nullptr) {
-// currentView->findText(ui->searchEdit->text(), QWebEnginePage::FindWrapsAroundDocument);
-// }
+void BrowserDialog::on_searchEdit_returnPressed() {
+ // BrowserView *currentView = getCurrentView();
+ // if (currentView != nullptr) {
+ // currentView->findText(ui->searchEdit->text(), QWebEnginePage::FindWrapsAroundDocument);
+ // }
}
-void BrowserDialog::on_refreshBtn_clicked()
-{
- getCurrentView()->reload();
-}
+void BrowserDialog::on_refreshBtn_clicked() { getCurrentView()->reload(); }
-void BrowserDialog::on_browserTabWidget_currentChanged(int index)
-{
- BrowserView *currentView = qobject_cast(ui->browserTabWidget->widget(index));
- if (currentView != nullptr) {
- ui->backBtn->setEnabled(currentView->history()->canGoBack());
- ui->fwdBtn->setEnabled(currentView->history()->canGoForward());
- }
+void BrowserDialog::on_browserTabWidget_currentChanged(int index) {
+ BrowserView* currentView = qobject_cast(ui->browserTabWidget->widget(index));
+ if (currentView != nullptr) {
+ ui->backBtn->setEnabled(currentView->history()->canGoBack());
+ ui->fwdBtn->setEnabled(currentView->history()->canGoForward());
+ }
}
-void BrowserDialog::on_urlEdit_returnPressed()
-{
- QWebEngineView *currentView = getCurrentView();
- if (currentView != nullptr) {
- currentView->setUrl(QUrl(ui->urlEdit->text()));
- }
+void BrowserDialog::on_urlEdit_returnPressed() {
+ QWebEngineView* currentView = getCurrentView();
+ if (currentView != nullptr) {
+ currentView->setUrl(QUrl(ui->urlEdit->text()));
+ }
}
-bool BrowserDialog::eventFilter(QObject *object, QEvent *event)
-{
- if (event->type() == QEvent::KeyPress) {
- QKeyEvent *keyEvent = reinterpret_cast(event);
- if ((keyEvent->modifiers() & Qt::ControlModifier)
- && (keyEvent->key() == Qt::Key_U)) {
- ui->urlEdit->setVisible(!ui->urlEdit->isVisible());
- return true;
+bool BrowserDialog::eventFilter(QObject* object, QEvent* event) {
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent* keyEvent = reinterpret_cast(event);
+ if ((keyEvent->modifiers() & Qt::ControlModifier) && (keyEvent->key() == Qt::Key_U)) {
+ ui->urlEdit->setVisible(!ui->urlEdit->isVisible());
+ return true;
+ }
}
- }
- return QDialog::eventFilter(object, event);
+ return QDialog::eventFilter(object, event);
}
diff --git a/src/browserdialog.h b/src/browserdialog.h
index 354a377b..6947cc43 100644
--- a/src/browserdialog.h
+++ b/src/browserdialog.h
@@ -20,18 +20,17 @@ along with Mod Organizer. If not, see .
#ifndef BROWSERDIALOG_H
#define BROWSERDIALOG_H
+#include
#include
-#include
#include
-#include
-#include
+#include
#include
#include
-#include
-
+#include
+#include
namespace Ui {
- class BrowserDialog;
+class BrowserDialog;
}
class BrowserView;
@@ -39,88 +38,81 @@ class BrowserView;
/**
* @brief a dialog containing a webbrowser that is intended to browse the nexus network
**/
-class BrowserDialog : public QDialog
-{
+class BrowserDialog : public QDialog {
Q_OBJECT
public:
-
- /**
- * @brief constructor
- *
- * @param accessManager the access manager to use for network requests
- * @param parent parent widget
- **/
- explicit BrowserDialog(QWidget *parent = 0);
- ~BrowserDialog();
-
- /**
- * @brief set the url to open. If automatic login is enabled, the url is opened after login
- *
- * @param url the url to open
- **/
- void openUrl(const QUrl &url);
-
- virtual bool eventFilter(QObject *object, QEvent *event);
+ /**
+ * @brief constructor
+ *
+ * @param accessManager the access manager to use for network requests
+ * @param parent parent widget
+ **/
+ explicit BrowserDialog(QWidget* parent = 0);
+ ~BrowserDialog();
+
+ /**
+ * @brief set the url to open. If automatic login is enabled, the url is opened after login
+ *
+ * @param url the url to open
+ **/
+ void openUrl(const QUrl& url);
+
+ virtual bool eventFilter(QObject* object, QEvent* event);
signals:
- /**
- * @brief emitted when the user starts a download
- * @param pageUrl url of the current web site from which the download was started
- * @param reply network reply of the started download
- */
- void requestDownload(const QUrl &pageUrl, QNetworkReply *reply);
+ /**
+ * @brief emitted when the user starts a download
+ * @param pageUrl url of the current web site from which the download was started
+ * @param reply network reply of the started download
+ */
+ void requestDownload(const QUrl& pageUrl, QNetworkReply* reply);
protected:
-
- virtual void closeEvent(QCloseEvent *);
+ virtual void closeEvent(QCloseEvent*);
private slots:
- void initTab(BrowserView *newView);
- void openInNewTab(const QUrl &url);
+ void initTab(BrowserView* newView);
+ void openInNewTab(const QUrl& url);
- void progress(int value);
+ void progress(int value);
- void titleChanged(const QString &title);
- void unsupportedContent(QNetworkReply *reply);
- void downloadRequested(const QNetworkRequest &request);
+ void titleChanged(const QString& title);
+ void unsupportedContent(QNetworkReply* reply);
+ void downloadRequested(const QNetworkRequest& request);
- void tabCloseRequested(int index);
+ void tabCloseRequested(int index);
- void urlChanged(const QUrl &url);
+ void urlChanged(const QUrl& url);
- void on_backBtn_clicked();
+ void on_backBtn_clicked();
- void on_fwdBtn_clicked();
+ void on_fwdBtn_clicked();
- void on_searchEdit_returnPressed();
+ void on_searchEdit_returnPressed();
- void startSearch();
+ void startSearch();
- void on_refreshBtn_clicked();
+ void on_refreshBtn_clicked();
- void on_browserTabWidget_currentChanged(int index);
+ void on_browserTabWidget_currentChanged(int index);
- void on_urlEdit_returnPressed();
+ void on_urlEdit_returnPressed();
private:
+ QString guessFileName(const QString& url);
- QString guessFileName(const QString &url);
-
- BrowserView *getCurrentView();
+ BrowserView* getCurrentView();
- void maximizeWidth();
+ void maximizeWidth();
private:
+ Ui::BrowserDialog* ui;
- Ui::BrowserDialog *ui;
-
- QNetworkAccessManager *m_AccessManager;
-
- QTabWidget *m_Tabs;
-
+ QNetworkAccessManager* m_AccessManager;
+ QTabWidget* m_Tabs;
};
#endif // BROWSERDIALOG_H
diff --git a/src/browserview.cpp b/src/browserview.cpp
index 0b871e23..a44792b2 100644
--- a/src/browserview.cpp
+++ b/src/browserview.cpp
@@ -19,58 +19,53 @@ along with Mod Organizer. If not, see .
#include "browserview.h"
+#include "utility.h"
#include
#include
+#include
#include
#include
#include
-#include
#include
-#include "utility.h"
-
-BrowserView::BrowserView(QWidget *parent)
- : QWebEngineView(parent)
-{
- installEventFilter(this);
+BrowserView::BrowserView(QWidget* parent) : QWebEngineView(parent) {
+ installEventFilter(this);
- //page()->settings()->setMaximumPagesInCache(10);
+ // page()->settings()->setMaximumPagesInCache(10);
}
-QWebEngineView *BrowserView::createWindow(QWebEnginePage::WebWindowType)
-{
- BrowserView *newView = new BrowserView(parentWidget());
- emit initTab(newView);
- return newView;
+QWebEngineView* BrowserView::createWindow(QWebEnginePage::WebWindowType) {
+ BrowserView* newView = new BrowserView(parentWidget());
+ emit initTab(newView);
+ return newView;
}
-bool BrowserView::eventFilter(QObject *obj, QEvent *event)
-{
- if (event->type() == QEvent::ShortcutOverride) {
- QKeyEvent *keyEvent = static_cast(event);
- if (keyEvent->matches(QKeySequence::Find)) {
- emit startFind();
- } else if (keyEvent->matches(QKeySequence::FindNext)) {
- emit findAgain();
- }
- } else if (event->type() == QEvent::MouseButtonPress) {
- QMouseEvent *mouseEvent = static_cast(event);
- if (mouseEvent->button() == Qt::MidButton) {
- mouseEvent->ignore();
- return true;
+bool BrowserView::eventFilter(QObject* obj, QEvent* event) {
+ if (event->type() == QEvent::ShortcutOverride) {
+ QKeyEvent* keyEvent = static_cast(event);
+ if (keyEvent->matches(QKeySequence::Find)) {
+ emit startFind();
+ } else if (keyEvent->matches(QKeySequence::FindNext)) {
+ emit findAgain();
+ }
+ } else if (event->type() == QEvent::MouseButtonPress) {
+ QMouseEvent* mouseEvent = static_cast(event);
+ if (mouseEvent->button() == Qt::MidButton) {
+ mouseEvent->ignore();
+ return true;
+ }
+ // TODO This is due to that QTWebEnginePage doesn't support QWebFrame anymore
+ // } else if (event->type() == QEvent::MouseButtonRelease) {
+ // QMouseEvent *mouseEvent = static_cast(event);
+ // if (mouseEvent->button() == Qt::MidButton) {
+ // QWebEngineContextMenuData hitTest = page()->hitTestContent(mouseEvent->pos());
+ // if (hitTest.linkUrl().isValid()) {
+ // emit openUrlInNewTab(hitTest.linkUrl());
+ // }
+ // mouseEvent->ignore();
+ //
+ // return true;
+ // }
}
-// TODO This is due to that QTWebEnginePage doesn't support QWebFrame anymore
-// } else if (event->type() == QEvent::MouseButtonRelease) {
-// QMouseEvent *mouseEvent = static_cast(event);
-// if (mouseEvent->button() == Qt::MidButton) {
-// QWebEngineContextMenuData hitTest = page()->hitTestContent(mouseEvent->pos());
-// if (hitTest.linkUrl().isValid()) {
-// emit openUrlInNewTab(hitTest.linkUrl());
-// }
-// mouseEvent->ignore();
-//
-// return true;
-// }
- }
- return QWebEngineView::eventFilter(obj, event);
+ return QWebEngineView::eventFilter(obj, event);
}
diff --git a/src/browserview.h b/src/browserview.h
index 24be21c1..b390ed4e 100644
--- a/src/browserview.h
+++ b/src/browserview.h
@@ -20,62 +20,55 @@ along with Mod Organizer. If not, see .
#ifndef NEXUSVIEW_H
#define NEXUSVIEW_H
-
class QEvent;
class QUrl;
class QWidget;
-#include
#include
+#include
/**
* @brief web view used to display a nexus page
**/
-class BrowserView : public QWebEngineView
-{
+class BrowserView : public QWebEngineView {
Q_OBJECT
public:
-
- explicit BrowserView(QWidget *parent = 0);
+ explicit BrowserView(QWidget* parent = 0);
signals:
- /**
- * @brief emitted when the user opens a new window to be displayed in another tab
- *
- * @param newView the view for the newly opened window
- **/
- void initTab(BrowserView *newView);
-
- /**
- * @brief emitted when the user requests a link to be opened in a new tab by middle-clicking
- *
- * @param url the url to open
- */
- void openUrlInNewTab(const QUrl &url);
-
- /**
- * @brief Ctrl-f was clicked. The containing dialog should activate its find-facility
- */
- void startFind();
-
- /**
- * @brief F3 was pressed. The containing dialog should search again
- */
- void findAgain();
+ /**
+ * @brief emitted when the user opens a new window to be displayed in another tab
+ *
+ * @param newView the view for the newly opened window
+ **/
+ void initTab(BrowserView* newView);
+
+ /**
+ * @brief emitted when the user requests a link to be opened in a new tab by middle-clicking
+ *
+ * @param url the url to open
+ */
+ void openUrlInNewTab(const QUrl& url);
+
+ /**
+ * @brief Ctrl-f was clicked. The containing dialog should activate its find-facility
+ */
+ void startFind();
+
+ /**
+ * @brief F3 was pressed. The containing dialog should search again
+ */
+ void findAgain();
protected:
+ virtual QWebEngineView* createWindow(QWebEnginePage::WebWindowType type);
- virtual QWebEngineView *createWindow(QWebEnginePage::WebWindowType type);
-
- virtual bool eventFilter(QObject *obj, QEvent *event);
-
+ virtual bool eventFilter(QObject* obj, QEvent* event);
private:
-
- QString m_FindPattern;
- bool m_MiddleClick;
-
+ QString m_FindPattern;
+ bool m_MiddleClick;
};
#endif // NEXUSVIEW_H
diff --git a/src/categories.cpp b/src/categories.cpp
index d8cd49fb..c88227e6 100644
--- a/src/categories.cpp
+++ b/src/categories.cpp
@@ -19,350 +19,302 @@ along with Mod Organizer. If not, see .
#include "categories.h"
-#include
#include
+#include
-#include
-#include
+#include
#include
+#include
#include
-#include
-
+#include
using namespace MOBase;
-
CategoryFactory* CategoryFactory::s_Instance = nullptr;
+QString CategoryFactory::categoriesFilePath() { return qApp->property("dataPath").toString() + "/categories.dat"; }
-QString CategoryFactory::categoriesFilePath()
-{
- return qApp->property("dataPath").toString() + "/categories.dat";
-}
+CategoryFactory::CategoryFactory() { atexit(&cleanup); }
+void CategoryFactory::loadCategories() {
+ reset();
-CategoryFactory::CategoryFactory()
-{
- atexit(&cleanup);
-}
+ QFile categoryFile(categoriesFilePath());
-void CategoryFactory::loadCategories()
-{
- reset();
-
- QFile categoryFile(categoriesFilePath());
-
- if (!categoryFile.open(QIODevice::ReadOnly)) {
- loadDefaultCategories();
- } else {
- int lineNum = 0;
- while (!categoryFile.atEnd()) {
- QByteArray line = categoryFile.readLine();
- ++lineNum;
- QList cells = line.split('|');
- if (cells.count() != 4) {
- qCritical("invalid category line %d: %s (%d cells)",
- lineNum, line.constData(), cells.count());
- } else {
- std::vector nexusIDs;
- if (cells[2].length() > 0) {
- QList nexusIDStrings = cells[2].split(',');
- for (QList::iterator iter = nexusIDStrings.begin();
- iter != nexusIDStrings.end(); ++iter) {
- bool ok = false;
- int temp = iter->toInt(&ok);
- if (!ok) {
- qCritical("invalid id %s", iter->constData());
+ if (!categoryFile.open(QIODevice::ReadOnly)) {
+ loadDefaultCategories();
+ } else {
+ int lineNum = 0;
+ while (!categoryFile.atEnd()) {
+ QByteArray line = categoryFile.readLine();
+ ++lineNum;
+ QList cells = line.split('|');
+ if (cells.count() != 4) {
+ qCritical("invalid category line %d: %s (%d cells)", lineNum, line.constData(), cells.count());
+ } else {
+ std::vector nexusIDs;
+ if (cells[2].length() > 0) {
+ QList nexusIDStrings = cells[2].split(',');
+ for (QList::iterator iter = nexusIDStrings.begin(); iter != nexusIDStrings.end();
+ ++iter) {
+ bool ok = false;
+ int temp = iter->toInt(&ok);
+ if (!ok) {
+ qCritical("invalid id %s", iter->constData());
+ }
+ nexusIDs.push_back(temp);
+ }
+ }
+ bool cell0Ok = true;
+ bool cell3Ok = true;
+ int id = cells[0].toInt(&cell0Ok);
+ int parentID = cells[3].trimmed().toInt(&cell3Ok);
+ if (!cell0Ok || !cell3Ok) {
+ qCritical("invalid category line %d: %s", lineNum, line.constData());
+ }
+ addCategory(id, QString::fromUtf8(cells[1].constData()), nexusIDs, parentID);
}
- nexusIDs.push_back(temp);
- }
- }
- bool cell0Ok = true;
- bool cell3Ok = true;
- int id = cells[0].toInt(&cell0Ok);
- int parentID = cells[3].trimmed().toInt(&cell3Ok);
- if (!cell0Ok || !cell3Ok) {
- qCritical("invalid category line %d: %s",
- lineNum, line.constData());
}
- addCategory(id, QString::fromUtf8(cells[1].constData()), nexusIDs, parentID);
- }
+ categoryFile.close();
}
- categoryFile.close();
- }
- std::sort(m_Categories.begin(), m_Categories.end());
- setParents();
+ std::sort(m_Categories.begin(), m_Categories.end());
+ setParents();
}
-
-CategoryFactory &CategoryFactory::instance()
-{
- if (s_Instance == nullptr) {
- s_Instance = new CategoryFactory;
- }
- return *s_Instance;
+CategoryFactory& CategoryFactory::instance() {
+ if (s_Instance == nullptr) {
+ s_Instance = new CategoryFactory;
+ }
+ return *s_Instance;
}
-
-void CategoryFactory::reset()
-{
- m_Categories.clear();
- m_IDMap.clear();
- // 28 =
- // 43 = Savegames (makes no sense to install them through MO)
- // 45 = Videos and trailers
- // 87 = Miscelanous
- addCategory(0, "None", MakeVector(4, 28, 43, 45, 87), 0);
+void CategoryFactory::reset() {
+ m_Categories.clear();
+ m_IDMap.clear();
+ // 28 =
+ // 43 = Savegames (makes no sense to install them through MO)
+ // 45 = Videos and trailers
+ // 87 = Miscelanous
+ addCategory(0, "None", MakeVector(4, 28, 43, 45, 87), 0);
}
+void CategoryFactory::setParents() {
+ for (std::vector::iterator iter = m_Categories.begin(); iter != m_Categories.end(); ++iter) {
+ iter->m_HasChildren = false;
+ }
-void CategoryFactory::setParents()
-{
- for (std::vector::iterator iter = m_Categories.begin();
- iter != m_Categories.end(); ++iter) {
- iter->m_HasChildren = false;
- }
-
- for (std::vector::const_iterator categoryIter = m_Categories.begin();
- categoryIter != m_Categories.end(); ++categoryIter) {
- if (categoryIter->m_ParentID != 0) {
- std::map::const_iterator iter = m_IDMap.find(categoryIter->m_ParentID);
- if (iter != m_IDMap.end()) {
- m_Categories[iter->second].m_HasChildren = true;
- }
+ for (std::vector::const_iterator categoryIter = m_Categories.begin(); categoryIter != m_Categories.end();
+ ++categoryIter) {
+ if (categoryIter->m_ParentID != 0) {
+ std::map::const_iterator iter = m_IDMap.find(categoryIter->m_ParentID);
+ if (iter != m_IDMap.end()) {
+ m_Categories[iter->second].m_HasChildren = true;
+ }
+ }
}
- }
}
-void CategoryFactory::cleanup()
-{
- delete s_Instance;
- s_Instance = nullptr;
+void CategoryFactory::cleanup() {
+ delete s_Instance;
+ s_Instance = nullptr;
}
+void CategoryFactory::saveCategories() {
+ QFile categoryFile(categoriesFilePath());
-void CategoryFactory::saveCategories()
-{
- QFile categoryFile(categoriesFilePath());
-
- if (!categoryFile.open(QIODevice::WriteOnly)) {
- reportError(QObject::tr("Failed to save custom categories"));
- return;
- }
+ if (!categoryFile.open(QIODevice::WriteOnly)) {
+ reportError(QObject::tr("Failed to save custom categories"));
+ return;
+ }
- categoryFile.resize(0);
- for (std::vector::const_iterator iter = m_Categories.begin();
- iter != m_Categories.end(); ++iter) {
- if (iter->m_ID == 0) {
- continue;
+ categoryFile.resize(0);
+ for (std::vector::const_iterator iter = m_Categories.begin(); iter != m_Categories.end(); ++iter) {
+ if (iter->m_ID == 0) {
+ continue;
+ }
+ QByteArray line;
+ line.append(QByteArray::number(iter->m_ID))
+ .append("|")
+ .append(iter->m_Name.toUtf8())
+ .append("|")
+ .append(VectorJoin(iter->m_NexusIDs, ","))
+ .append("|")
+ .append(QByteArray::number(iter->m_ParentID))
+ .append("\n");
+ categoryFile.write(line);
}
- QByteArray line;
- line.append(QByteArray::number(iter->m_ID)).append("|")
- .append(iter->m_Name.toUtf8()).append("|")
- .append(VectorJoin(iter->m_NexusIDs, ",")).append("|")
- .append(QByteArray::number(iter->m_ParentID)).append("\n");
- categoryFile.write(line);
- }
- categoryFile.close();
+ categoryFile.close();
}
-
-unsigned int CategoryFactory::countCategories(std::tr1::function filter)
-{
- unsigned int result = 0;
- for (const Category &cat : m_Categories) {
- if (filter(cat)) {
- ++result;
+unsigned int CategoryFactory::countCategories(std::tr1::function filter) {
+ unsigned int result = 0;
+ for (const Category& cat : m_Categories) {
+ if (filter(cat)) {
+ ++result;
+ }
}
- }
- return result;
+ return result;
}
-int CategoryFactory::addCategory(const QString &name, const std::vector &nexusIDs, int parentID)
-{
- int id = 1;
- while (m_IDMap.find(id) != m_IDMap.end()) {
- ++id;
- }
- addCategory(id, name, nexusIDs, parentID);
-
- saveCategories();
- return id;
-}
+int CategoryFactory::addCategory(const QString& name, const std::vector& nexusIDs, int parentID) {
+ int id = 1;
+ while (m_IDMap.find(id) != m_IDMap.end()) {
+ ++id;
+ }
+ addCategory(id, name, nexusIDs, parentID);
-void CategoryFactory::addCategory(int id, const QString &name, const std::vector &nexusIDs, int parentID)
-{
- int index = static_cast(m_Categories.size());
- m_Categories.push_back(Category(index, id, name, nexusIDs, parentID));
- for (int nexusID : nexusIDs) {
- m_NexusMap[nexusID] = index;
- }
- m_IDMap[id] = index;
+ saveCategories();
+ return id;
}
-
-void CategoryFactory::loadDefaultCategories()
-{
- // the order here is relevant as it defines the order in which the
- // mods appear in the combo box
- addCategory(1, "Animations", MakeVector(2, 4, 51), 0);
- addCategory(52, "Poses", MakeVector(1, 29), 1);
- addCategory(2, "Armour", MakeVector(2, 5, 54), 0);
- addCategory(53, "Power Armor", MakeVector(1, 53), 2);
- addCategory(3, "Audio", MakeVector(3, 33, 35, 106), 0);
- addCategory(38, "Music", MakeVector(2, 34, 61), 0);
- addCategory(39, "Voice", MakeVector(2, 36, 107), 0);
- addCategory(5, "Clothing", MakeVector(2, 9, 60), 0);
- addCategory(41, "Jewelry", MakeVector(1, 102), 5);
- addCategory(42, "Backpacks", MakeVector(1, 49), 5);
- addCategory(6, "Collectables", MakeVector(2, 10, 92), 0);
- addCategory(28, "Companions", MakeVector(3, 11, 66, 96), 0);
- addCategory(7, "Creatures, Mounts, & Vehicles", MakeVector(4, 12, 65, 83, 101), 0);
- addCategory(8, "Factions", MakeVector(2, 16, 25), 0);
- addCategory(9, "Gameplay", MakeVector(2, 15, 24), 0);
- addCategory(27, "Combat", MakeVector(1, 77), 9);
- addCategory(43, "Crafting", MakeVector(2, 50, 100), 9);
- addCategory(48, "Overhauls", MakeVector(2, 24, 79), 9);
- addCategory(49, "Perks", MakeVector(1, 27), 9);
- addCategory(54, "Radio", MakeVector(1, 31), 9);
- addCategory(55, "Shouts", MakeVector(1, 104), 9);
- addCategory(22, "Skills & Levelling", MakeVector(2, 46, 73), 9);
- addCategory(58, "Weather & Lighting", MakeVector(1, 56), 9);
- addCategory(44, "Equipment", MakeVector(1, 44), 43);
- addCategory(45, "Home/Settlement", MakeVector(1, 45), 43);
- addCategory(10, "Body, Face, & Hair", MakeVector(2, 17, 26), 0);
- addCategory(39, "Tattoos", MakeVector(1, 57), 10);
- addCategory(40, "Character Presets", MakeVector(1, 58), 0);
- addCategory(11, "Items", MakeVector(2, 27, 85), 0);
- addCategory(32, "Mercantile", MakeVector(2, 23, 69), 0);
- addCategory(37, "Ammo", MakeVector(1, 3), 11);
- addCategory(19, "Weapons", MakeVector(2, 41, 55), 11);
- addCategory(36, "Weapon & Armour Sets", MakeVector(1, 42), 11);
- addCategory(23, "Player Homes", MakeVector(2, 28, 67), 0);
- addCategory(25, "Castles & Mansions", MakeVector(1, 68), 23);
- addCategory(51, "Settlements", MakeVector(1, 48), 23);
- addCategory(12, "Locations", MakeVector(10, 20, 21, 22, 30, 47, 70, 88, 89, 90, 91), 0);
- addCategory(4, "Cities", MakeVector(1, 53), 12);
- addCategory(31, "Landscape Changes", MakeVector(1, 58), 0);
- addCategory(29, "Environment", MakeVector(2, 14, 74), 0);
- addCategory(30, "Immersion", MakeVector(2, 51, 78), 0);
- addCategory(20, "Magic", MakeVector(3, 75, 93, 94), 0);
- addCategory(21, "Models & Textures", MakeVector(2, 19, 29), 0);
- addCategory(33, "Modders resources", MakeVector(2, 18, 82), 0);
- addCategory(13, "NPCs", MakeVector(3, 22, 33, 99), 0);
- addCategory(24, "Bugfixes", MakeVector(2, 6, 95), 0);
- addCategory(14, "Patches", MakeVector(2, 25, 84), 24);
- addCategory(35, "Utilities", MakeVector(2, 38, 39), 0);
- addCategory(26, "Cheats", MakeVector(1, 8), 0);
- addCategory(15, "Quests", MakeVector(2, 30, 35), 0);
- addCategory(16, "Races & Classes", MakeVector(1, 34), 0);
- addCategory(34, "Stealth", MakeVector(1, 76), 0);
- addCategory(17, "UI", MakeVector(2, 37, 42), 0);
- addCategory(18, "Visuals", MakeVector(2, 40, 62), 0);
- addCategory(50, "Pip-Boy", MakeVector(1, 52), 18);
- addCategory(46, "Shader Presets", MakeVector(3, 13, 97, 105), 0);
- addCategory(47, "Miscellaneous", MakeVector(2, 2, 28), 0);
+void CategoryFactory::addCategory(int id, const QString& name, const std::vector& nexusIDs, int parentID) {
+ int index = static_cast(m_Categories.size());
+ m_Categories.push_back(Category(index, id, name, nexusIDs, parentID));
+ for (int nexusID : nexusIDs) {
+ m_NexusMap[nexusID] = index;
+ }
+ m_IDMap[id] = index;
}
-
-int CategoryFactory::getParentID(unsigned int index) const
-{
- if (index >= m_Categories.size()) {
- throw MyException(QObject::tr("invalid index %1").arg(index));
- }
-
- return m_Categories[index].m_ParentID;
+void CategoryFactory::loadDefaultCategories() {
+ // the order here is relevant as it defines the order in which the
+ // mods appear in the combo box
+ addCategory(1, "Animations", MakeVector(2, 4, 51), 0);
+ addCategory(52, "Poses", MakeVector(1, 29), 1);
+ addCategory(2, "Armour", MakeVector(2, 5, 54), 0);
+ addCategory(53, "Power Armor", MakeVector(1, 53), 2);
+ addCategory(3, "Audio", MakeVector(3, 33, 35, 106), 0);
+ addCategory(38, "Music", MakeVector(2, 34, 61), 0);
+ addCategory(39, "Voice", MakeVector(2, 36, 107), 0);
+ addCategory(5, "Clothing", MakeVector(2, 9, 60), 0);
+ addCategory(41, "Jewelry", MakeVector(1, 102), 5);
+ addCategory(42, "Backpacks", MakeVector(1, 49), 5);
+ addCategory(6, "Collectables", MakeVector(2, 10, 92), 0);
+ addCategory(28, "Companions", MakeVector(3, 11, 66, 96), 0);
+ addCategory(7, "Creatures, Mounts, & Vehicles", MakeVector(4, 12, 65, 83, 101), 0);
+ addCategory(8, "Factions", MakeVector(2, 16, 25), 0);
+ addCategory(9, "Gameplay", MakeVector(2, 15, 24), 0);
+ addCategory(27, "Combat", MakeVector(1, 77), 9);
+ addCategory(43, "Crafting", MakeVector(2, 50, 100), 9);
+ addCategory(48, "Overhauls", MakeVector(2, 24, 79), 9);
+ addCategory(49, "Perks", MakeVector(1, 27), 9);
+ addCategory(54, "Radio", MakeVector(1, 31), 9);
+ addCategory(55, "Shouts", MakeVector(1, 104), 9);
+ addCategory(22, "Skills & Levelling", MakeVector(2, 46, 73), 9);
+ addCategory(58, "Weather & Lighting", MakeVector(1, 56), 9);
+ addCategory(44, "Equipment", MakeVector(1, 44), 43);
+ addCategory(45, "Home/Settlement", MakeVector(1, 45), 43);
+ addCategory(10, "Body, Face, & Hair", MakeVector(2, 17, 26), 0);
+ addCategory(39, "Tattoos", MakeVector(1, 57), 10);
+ addCategory(40, "Character Presets", MakeVector(1, 58), 0);
+ addCategory(11, "Items", MakeVector(2, 27, 85), 0);
+ addCategory(32, "Mercantile", MakeVector(2, 23, 69), 0);
+ addCategory(37, "Ammo", MakeVector(1, 3), 11);
+ addCategory(19, "Weapons", MakeVector(2, 41, 55), 11);
+ addCategory(36, "Weapon & Armour Sets", MakeVector(1, 42), 11);
+ addCategory(23, "Player Homes", MakeVector(2, 28, 67), 0);
+ addCategory(25, "Castles & Mansions", MakeVector(1, 68), 23);
+ addCategory(51, "Settlements", MakeVector(1, 48), 23);
+ addCategory(12, "Locations", MakeVector(10, 20, 21, 22, 30, 47, 70, 88, 89, 90, 91), 0);
+ addCategory(4, "Cities", MakeVector(1, 53), 12);
+ addCategory(31, "Landscape Changes", MakeVector(1, 58), 0);
+ addCategory(29, "Environment", MakeVector(2, 14, 74), 0);
+ addCategory(30, "Immersion", MakeVector(2, 51, 78), 0);
+ addCategory(20, "Magic", MakeVector(3, 75, 93, 94), 0);
+ addCategory(21, "Models & Textures", MakeVector(2, 19, 29), 0);
+ addCategory(33, "Modders resources", MakeVector(2, 18, 82), 0);
+ addCategory(13, "NPCs", MakeVector(3, 22, 33, 99), 0);
+ addCategory(24, "Bugfixes", MakeVector(2, 6, 95), 0);
+ addCategory(14, "Patches", MakeVector(2, 25, 84), 24);
+ addCategory(35, "Utilities", MakeVector(2, 38, 39), 0);
+ addCategory(26, "Cheats", MakeVector(1, 8), 0);
+ addCategory(15, "Quests", MakeVector(2, 30, 35), 0);
+ addCategory(16, "Races & Classes", MakeVector(1, 34), 0);
+ addCategory(34, "Stealth", MakeVector(1, 76), 0);
+ addCategory(17, "UI", MakeVector(2, 37, 42), 0);
+ addCategory(18, "Visuals", MakeVector(2, 40, 62), 0);
+ addCategory(50, "Pip-Boy", MakeVector(1, 52), 18);
+ addCategory(46, "Shader Presets", MakeVector(3, 13, 97, 105), 0);
+ addCategory(47, "Miscellaneous", MakeVector(2, 2, 28), 0);
}
+int CategoryFactory::getParentID(unsigned int index) const {
+ if (index >= m_Categories.size()) {
+ throw MyException(QObject::tr("invalid index %1").arg(index));
+ }
-bool CategoryFactory::categoryExists(int id) const
-{
- return m_IDMap.find(id) != m_IDMap.end();
+ return m_Categories[index].m_ParentID;
}
-
-bool CategoryFactory::isDecendantOf(int id, int parentID) const
-{
- std::map