From a611c355ce732961c2a9ba1a8909f0c144afa860 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Fri, 20 Oct 2017 20:27:06 -0500 Subject: Basic ESL updates --- src/pluginlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pluginlist.cpp') diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index a4d8561c..f2c52d5b 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -135,7 +135,7 @@ void PluginList::refresh(const QString &profileName QString extension = filename.right(3).toLower(); - if ((extension == "esp") || (extension == "esm")) { + if ((extension == "esp") || (extension == "esm") || (extension == "esl")) { bool forceEnabled = Settings::instance().forceEnableCoreFiles() && std::find(primaryPlugins.begin(), primaryPlugins.end(), filename.toLower()) != primaryPlugins.end(); -- cgit v1.3.1 From b16a0ab3d94fad599347098e79e4a8131de08efa Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Fri, 20 Oct 2017 23:16:04 -0500 Subject: Add ESL flag type detection * ESL files can be sorted like ESMs * ESL files are displayed italicized but not bold --- src/pluginlist.cpp | 24 ++++++++++++++++++++---- src/pluginlist.h | 2 ++ 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index f2c52d5b..2a252d27 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -593,6 +593,16 @@ bool PluginList::isMaster(const QString &name) const } } +bool PluginList::isLight(const QString &name) const +{ + auto iter = m_ESPsByName.find(name.toLower()); + if (iter == m_ESPsByName.end()) { + return false; + } else { + return m_ESPs[iter->second].m_IsLight; + } +} + QStringList PluginList::masters(const QString &name) const { auto iter = m_ESPsByName.find(name.toLower()); @@ -736,6 +746,8 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const if (m_ESPs[index].m_IsMaster) { result.setItalic(true); result.setWeight(QFont::Bold); + } else if (m_ESPs[index].m_IsLight) { + result.setItalic(true); } return result; } else if (role == Qt::TextAlignmentRole) { @@ -895,16 +907,18 @@ void PluginList::setPluginPriority(int row, int &newPriority) { int newPriorityTemp = newPriority; - if (!m_ESPs[row].m_IsMaster) { + if (!m_ESPs[row].m_IsMaster && !m_ESPs[row].m_IsLight) { // don't allow esps to be moved above esms while ((newPriorityTemp < static_cast(m_ESPsByPriority.size() - 1)) && - m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).m_IsMaster) { + (m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).m_IsMaster || + m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).m_IsLight)) { ++newPriorityTemp; } } else { // don't allow esms to be moved below esps while ((newPriorityTemp > 0) && - !m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).m_IsMaster) { + !m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).m_IsMaster && + !m_ESPs.at(m_ESPsByPriority.at(newPriorityTemp)).m_IsLight) { --newPriorityTemp; } // also don't allow "regular" esms to be moved above primary plugins @@ -1110,7 +1124,8 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, { try { ESP::File file(ToWString(fullPath)); - m_IsMaster = file.isMaster(); + m_IsMaster = file.isMaster() && !file.isLight(); + m_IsLight = file.isMaster() && file.isLight(); m_Author = QString::fromLatin1(file.author().c_str()); m_Description = QString::fromLatin1(file.description().c_str()); std::set masters = file.masters(); @@ -1120,6 +1135,7 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, } catch (const std::exception &e) { qCritical("failed to parse esp file %s: %s", qPrintable(fullPath), e.what()); m_IsMaster = false; + m_IsLight = false; } } diff --git a/src/pluginlist.h b/src/pluginlist.h index 78623cae..aaa45bc1 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -213,6 +213,7 @@ public: virtual int loadOrder(const QString &name) const; virtual bool onRefreshed(const std::function &callback); virtual bool isMaster(const QString &name) const; + virtual bool isLight(const QString &name) const; virtual QStringList masters(const QString &name) const; virtual QString origin(const QString &name) const; virtual void setLoadOrder(const QStringList &pluginList) override; @@ -275,6 +276,7 @@ private: FILETIME m_Time; QString m_OriginName; bool m_IsMaster; + bool m_IsLight; QString m_Author; QString m_Description; bool m_HasIni; -- cgit v1.3.1 From eaeb48d745d74857d47da5d66d82fea005a16555 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Sat, 21 Oct 2017 22:43:45 -0500 Subject: Correctly render the modindex for ESLs --- src/pluginlist.cpp | 20 +++++++++++++++++--- src/pluginlist.h | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 2a252d27..f1e28cb2 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -102,7 +102,7 @@ QString PluginList::getColumnToolTip(int column) case COL_NAME: return tr("Name of your mods"); case COL_PRIORITY: return tr("Load priority of your mod. The higher, the more \"important\" it is and thus " "overwrites data from plugins with lower priority."); - case COL_MODINDEX: return tr("The modindex determins the formids of objects originating from this mods."); + case COL_MODINDEX: return tr("The modindex determines the formids of objects originating from this mods."); default: return tr("unknown"); } } @@ -713,7 +713,7 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const if ((role == Qt::DisplayRole) || (role == Qt::EditRole)) { switch (modelIndex.column()) { - case COL_NAME: { + case COL_NAME: { return m_ESPs[index].m_Name; } break; case COL_PRIORITY: { @@ -723,7 +723,21 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const if (m_ESPs[index].m_LoadOrder == -1) { return QString(); } else { - return QString("%1").arg(m_ESPs[index].m_LoadOrder, 2, 16, QChar('0')).toUpper(); + int numESLs = 0; + std::vector sortESPs(m_ESPs); + std::sort(sortESPs.begin(), sortESPs.end()); + for (auto sortedESP: sortESPs) { + if (sortedESP.m_LoadOrder == m_ESPs[index].m_LoadOrder) + break; + if (sortedESP.m_IsLight && sortedESP.m_LoadOrder != -1) + ++numESLs; + } + if (m_ESPs[index].m_IsLight) { + int ESLpos = 254 + (numESLs+1 / 4096); + return QString("%1").arg(ESLpos, 2, 16, QChar('0')).toUpper(); + } else { + return QString("%1").arg(m_ESPs[index].m_LoadOrder - numESLs, 2, 16, QChar('0')).toUpper(); + } } } break; default: { diff --git a/src/pluginlist.h b/src/pluginlist.h index aaa45bc1..e98f5c41 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -282,6 +282,10 @@ private: bool m_HasIni; std::set m_Masters; mutable std::set m_MasterUnset; + bool operator < (const ESPInfo& str) const + { + return (m_LoadOrder < str.m_LoadOrder); + } }; struct AdditionalInfo { -- cgit v1.3.1 From e4d431fe2111134ec38f69a1924a2730e89767fc Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Sat, 21 Oct 2017 23:00:32 -0500 Subject: Display the index of the ESL in the mod index space to differentiate ESLs --- src/organizer_en.ts | 159 +++++++++++++++++++++++++++------------------------- src/pluginlist.cpp | 2 +- 2 files changed, 83 insertions(+), 78 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/organizer_en.ts b/src/organizer_en.ts index f73717f2..535c16a5 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -3019,197 +3019,197 @@ p, li { white-space: pre-wrap; } - - + + Save changes? - - + + Save changes to "%1"? - + File Exists - + A file with that name exists, please enter a new one - + failed to move file - + failed to create directory "optional" - - + + Info requested, please wait - + Main - + Update - + Optional - + Old - + Misc - + Unknown - + Current Version: %1 - + No update available - + (description incomplete, please visit nexus) - + <a href="%1">Visit on Nexus</a> - + Failed to delete %1 - - + + Confirm - + Are sure you want to delete "%1"? - + Are sure you want to delete the selected files? - - + + New Folder - + Failed to create "%1" - - + + 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? - - + + failed to rename %1 to %2 - + There already is a visible version of this file. Replace it? - + Un-Hide - + Hide - + Name - + Please enter a name - - + + Error - + Invalid name. Must be a valid file name - + A tweak by that name exists - + Create Tweak @@ -3240,7 +3240,8 @@ p, li { white-space: pre-wrap; } - %1 contains no esp/esm and no asset (textures, meshes, interface, ...) directory + %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 @@ -3253,7 +3254,8 @@ p, li { white-space: pre-wrap; } ModList - Game plugins (esp/esm) + Game plugins (esp/esm/esl) + Game plugins (esp/esm) @@ -3459,7 +3461,8 @@ p, li { white-space: pre-wrap; } - 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> + 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> @@ -3659,81 +3662,81 @@ p, li { white-space: pre-wrap; } - - Multiple esps activated, please check that they don't conflict. + + 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. @@ -3902,37 +3905,37 @@ Continue? - + 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 @@ -5670,7 +5673,8 @@ On Windows XP: - I told you in the "First Steps" tutorial how the esp/esm plugins contain changes to the game world like modifications to the terrain or existing NPCs. Each change like this is stored in a record, hence the name "record conflict". For example when two mods try to change the same location, only one change can become active. + I told you in the "First Steps" tutorial how the esp/esm/esl plugins contain changes to the game world like modifications to the terrain or existing NPCs. Each change like this is stored in a record, hence the name "record conflict". For example when two mods try to change the same location, only one change can become active. + I told you in the "First Steps" tutorial how the esp/esm plugins contain changes to the game world like modifications to the terrain or existing NPCs. Each change like this is stored in a record, hence the name "record conflict". For example when two mods try to change the same location, only one change can become active. @@ -5977,7 +5981,8 @@ Please open the "Nexus"-tab - Plugins (esp/esm files) of the mods in the current profile. They need to be checked to be loaded. + Plugins (esp/esm/esl files) of the mods in the current profile. They need to be checked to be loaded. + Plugins (esp/esm files) of the mods in the current profile. They need to be checked to be loaded. diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index f1e28cb2..d2ffad91 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -734,7 +734,7 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const } if (m_ESPs[index].m_IsLight) { int ESLpos = 254 + (numESLs+1 / 4096); - return QString("%1").arg(ESLpos, 2, 16, QChar('0')).toUpper(); + return QString("%1:%2").arg(ESLpos, 2, 16, QChar('0')).arg((numESLs+1)%4096).toUpper(); } else { return QString("%1").arg(m_ESPs[index].m_LoadOrder - numESLs, 2, 16, QChar('0')).toUpper(); } -- cgit v1.3.1 From 56a3dd46247bc1ef1ccc9d2f213c48041f1669a1 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Tue, 24 Oct 2017 01:45:29 -0500 Subject: Fix minor ESL issues and set a useful URL for issue reporting --- src/mainwindow.cpp | 2 +- src/pluginlist.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7c853578..79be617b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1684,7 +1684,7 @@ void MainWindow::wikiTriggered() void MainWindow::issueTriggered() { - ::ShellExecuteW(nullptr, L"open", L"http://issue.tannin.eu/tbg", nullptr, nullptr, SW_SHOWNORMAL); + ::ShellExecuteW(nullptr, L"open", L"http://github.com/LePresidente/modorganizer/issues", nullptr, nullptr, SW_SHOWNORMAL); } void MainWindow::tutorialTriggered() diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index d2ffad91..a66a2fb4 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -733,8 +733,8 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const ++numESLs; } if (m_ESPs[index].m_IsLight) { - int ESLpos = 254 + (numESLs+1 / 4096); - return QString("%1:%2").arg(ESLpos, 2, 16, QChar('0')).arg((numESLs+1)%4096).toUpper(); + int ESLpos = 254 + ((numESLs+1) / 4096); + return QString("%1:%2").arg(ESLpos, 2, 16, QChar('0')).arg((numESLs)%4096).toUpper(); } else { return QString("%1").arg(m_ESPs[index].m_LoadOrder - numESLs, 2, 16, QChar('0')).toUpper(); } @@ -1139,7 +1139,7 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, try { ESP::File file(ToWString(fullPath)); m_IsMaster = file.isMaster() && !file.isLight(); - m_IsLight = file.isMaster() && file.isLight(); + m_IsLight = file.isLight(); m_Author = QString::fromLatin1(file.author().c_str()); m_Description = QString::fromLatin1(file.description().c_str()); std::set masters = file.masters(); -- cgit v1.3.1 From d659ad7294af2bc67a3b569dc90a7920f5469b07 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Thu, 26 Oct 2017 16:28:15 -0500 Subject: Update master parsing and detect ESLs by extension --- src/organizer_en.ts | 173 +++++++++++++++++++++++++--------------------------- src/pluginlist.cpp | 26 ++++---- 2 files changed, 98 insertions(+), 101 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 15785d1f..f8e6ffaa 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -2989,227 +2989,227 @@ p, li { white-space: pre-wrap; } - + &Delete - + &Rename - + &Hide - + &Unhide - + &Open - + &New Folder - - + + Save changes? - - + + Save changes to "%1"? - + File Exists - + A file with that name exists, please enter a new one - + failed to move file - + failed to create directory "optional" - - + + Info requested, please wait - + Main - + Update - + Optional - + Old - + Misc - + Unknown - + Current Version: %1 - + No update available - + (description incomplete, please visit nexus) - + <a href="%1">Visit on Nexus</a> - + Failed to delete %1 - - + + Confirm - + Are sure you want to delete "%1"? - + Are sure you want to delete the selected files? - - + + New Folder - + Failed to create "%1" - - + + 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? - - + + failed to rename %1 to %2 - + There already is a visible version of this file. Replace it? - + Un-Hide - + Hide - + Name - + Please enter a name - - + + Error - + Invalid name. Must be a valid file name - + A tweak by that name exists - + Create Tweak @@ -4769,52 +4769,52 @@ Start elevated anyway? (you will be asked if you want to allow ModOrganizer.exe - + New update available (%1) - + Install - + Download failed - + Failed to find correct download, please try again later. - + Update - + Download in progress - + Download failed: %1 - + Failed to install update: %1 - + Failed to start %1: %2 - + Error @@ -5919,113 +5919,108 @@ Please open the "Nexus"-tab tutorial_primer_main - + This window shows all the mods that are installed. The column headers can be used for sorting. Only checked mods are active in the current profile. - + Each profile is a separate set of enabled mods and ini settings. - + The dropdown allows various ways of grouping the mods shown in the mod list. - + Show/hide the category pane. - + Quickly filter the mod list as you type. - + Switch between information views. - + This shows mod categories and some meta categories (in angle-brackets). Select some to filter the mod list. For example select "<Checked>" to show only active mods. - + Customizable list for choosing the program to run. - + When this button is clicked, Mod Organizer creates a virtual directory structure then runs the program selected to the left. - + Will create a shortcut for quick access. The shortcut can be placed in the toolbar at the top, in the Start Menu or on the Windows Desktop. - + Log messages produced by MO. Please note that messages with a light bulb usually don't require your attention. - + Configure Mod Organizer. - + Reports potential Problems about the current setup. - + Activates if there is an update for MO. Please note that if, for any reason, MO can't communicate with NMM, this will not work either. - + Plugins (esp/esm/esl files) of the mods in the current profile. They need to be checked to be loaded. Plugins (esp/esm files) of the mods in the current profile. They need to be checked to be loaded. - + Automatically sort plugins using the bundled LOOT application. - + Quickly filter plugin list as you type. - - All the asset archives (.bsa files) for all active mods. - - - - + The directory tree and all files that the program will see. - + Save game browser. Shows all the saves for the current profile and whether or not the current mod-load status is correct. - + Shows the mods that have been downloaded and if they’ve been installed. - + Click to quit diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index a66a2fb4..4420bf17 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -686,18 +686,18 @@ void PluginList::testMasters() // emit layoutAboutToBeChanged(); std::set enabledMasters; - for (auto iter = m_ESPs.begin(); iter != m_ESPs.end(); ++iter) { - if (iter->m_Enabled) { - enabledMasters.insert(iter->m_Name.toLower()); + for (const auto& iter: m_ESPs) { + if (iter.m_Enabled) { + enabledMasters.insert(iter.m_Name.toLower()); } } - for (auto iter = m_ESPs.begin(); iter != m_ESPs.end(); ++iter) { - iter->m_MasterUnset.clear(); - if (iter->m_Enabled) { - for (auto master = iter->m_Masters.begin(); master != iter->m_Masters.end(); ++master) { - if (enabledMasters.find(master->toLower()) == enabledMasters.end()) { - iter->m_MasterUnset.insert(*master); + for (auto& iter: m_ESPs) { + iter.m_MasterUnset.clear(); + if (iter.m_Enabled) { + for (const auto& master: iter.m_Masters) { + if (enabledMasters.find(master.toLower()) == enabledMasters.end()) { + iter.m_MasterUnset.insert(master); } } } @@ -1138,8 +1138,10 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, { try { ESP::File file(ToWString(fullPath)); - m_IsMaster = file.isMaster() && !file.isLight(); - m_IsLight = file.isLight(); + m_IsMaster = file.isMaster(); + auto extension = name.right(3).toLower(); + m_IsLight = (extension == "esl"); // The .isLight() header is apparently meaningless. + m_Author = QString::fromLatin1(file.author().c_str()); m_Description = QString::fromLatin1(file.description().c_str()); std::set masters = file.masters(); @@ -1147,7 +1149,7 @@ PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, m_Masters.insert(QString(iter->c_str())); } } catch (const std::exception &e) { - qCritical("failed to parse esp file %s: %s", qPrintable(fullPath), e.what()); + qCritical("failed to parse plugin file %s: %s", qPrintable(fullPath), e.what()); m_IsMaster = false; m_IsLight = false; } -- 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/pluginlist.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
modlistview.h
+ + PluginListView + QTreeView +
pluginlistview.h
+
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 797a007eab2695c231a00240225d77b3a9928992 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Thu, 30 Nov 2017 17:34:28 -0600 Subject: Add unmanaged mods and fix plugin identification --- src/modinfoforeign.cpp | 6 +++++- src/pluginlist.cpp | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/modinfoforeign.cpp b/src/modinfoforeign.cpp index 4ba16bb1..6ad8b6d8 100644 --- a/src/modinfoforeign.cpp +++ b/src/modinfoforeign.cpp @@ -30,12 +30,16 @@ std::vector ModInfoForeign::getFlags() const std::vector result = ModInfoWithConflictInfo::getFlags(); result.push_back(FLAG_FOREIGN); + if (m_PluginSelected) { + result.push_back(ModInfo::FLAG_PLUGIN_SELECTED); + } + return result; } int ModInfoForeign::getHighlight() const { - return 0; + return m_PluginSelected ? ModInfo::HIGHLIGHT_PLUGIN : ModInfo::HIGHLIGHT_NONE; } QString ModInfoForeign::getDescription() const diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index a215b9d3..add34b3f 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -118,8 +118,15 @@ void PluginList::highlightPlugins(const QItemSelection &selected, const MOShared if (!selectedMod.isNull()) { 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) { + 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()) + continue; + } std::map::iterator iter = m_ESPsByName.find(plugin.toLower()); if (iter != m_ESPsByName.end()) { m_ESPs[iter->second].m_ModSelected = true; -- cgit v1.3.1 From e19597ee4e8d045d61bd6c4a85e280e500475ed6 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Sat, 2 Dec 2017 13:36:33 -0600 Subject: Final highlighting changes --- src/mainwindow.cpp | 2 +- src/pluginlist.cpp | 4 ++-- src/pluginlist.h | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 84860767..cdc32918 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2126,7 +2126,7 @@ void MainWindow::modlistSelectionChanged(const QModelIndex ¤t, const QMode void MainWindow::modlistSelectionsChanged(const QItemSelection &selected) { - m_OrganizerCore.pluginList()->highlightPlugins(selected, *m_OrganizerCore.directoryStructure()); + m_OrganizerCore.pluginList()->highlightPlugins(selected, *m_OrganizerCore.directoryStructure(), *m_OrganizerCore.currentProfile()); ui->espList->verticalScrollBar()->repaint(); } diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index add34b3f..61d33fe9 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -108,14 +108,14 @@ QString PluginList::getColumnToolTip(int column) } } -void PluginList::highlightPlugins(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry) +void PluginList::highlightPlugins(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry, const Profile &profile) { 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()) { + 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()); diff --git a/src/pluginlist.h b/src/pluginlist.h index 19e98989..8d1a5491 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -22,6 +22,7 @@ along with Mod Organizer. If not, see . #include #include +#include "profile.h" namespace MOBase { class IPluginGame; } #include @@ -200,7 +201,7 @@ public: static QString getColumnName(int column); static QString getColumnToolTip(int column); - void highlightPlugins(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry); + void highlightPlugins(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry, const Profile &profile); void refreshLoadOrder(); -- cgit v1.3.1