Compare commits

...
Author SHA1 Message Date
Tannin 849e946284 - loot client now only updates the masterlist once per MO session
- new event to notify plugins of changed mod priority
- overwrite now shows up in the "checked" category instead of "unchecked"
- display of "foreign" mods can now be limited to only official content
- bugfix: bsa extraction dialog showed up even if the plugin was disabled
- bugfix: after detection of foreign mods the priority of the overwrite folder could get messed up
- bugfix: when displaying only the context menu for the mod list as a whole, the menu didn't disappear
- bugfix: MO crashed when trying to download via the integrated browser
2014-06-08 15:10:08 +02:00
Tannin 58a8406335 - plugin-list now displays loot messages 2014-06-02 19:15:23 +02:00
Tannin c8308f1612 - added a new mod type that represents files handled externally (i.e. DLCs) as mods in MO
- hashes of file names in bsa files are no longer checked all the time
- author and description is now read from esp files
- rewrote the code that fixes modlists after a rename, should be a bit more robust
- fixes to qt 5 and msvc 2013 compatibility
- started to update the tutorial (not done yet!)
- bugfix: counter for the problems badge wasn't calculated correctly
2014-05-31 13:43:48 +02:00
Tannin 75d821c46a - files in bsas are now only displayed in the data tab if they are managed by mo
- number of problems detected by MO is now displayed as a badge on the icon
- rephrased the explanation text on the Archives tab. unchecked plugin-loaded bsas no longer prompt a warning
- bsa extraction is now handled in a plugin
- added a way for plugins to react to mod installation
- re-enabled the automatic fix for asset order problems
- bugfix: In some cases when a download wasn't started successfully the download urls weren't stored in the meta file so no resume was possible
- bugfix: MO tried to resume downloads when it didn't have and download urls
- bugfix: downloads couldn't be paused if the download was already broken on the network layer
- bugfix: download managear did not recognize a file as downloaded if the download completed before signals were hooked up
- bugfix: in-place file replacement was re-broken
2014-05-25 15:39:45 +02:00
Tannin f784c34877 - bugfix: endless loop in detection of mod order problems 2014-05-04 16:13:35 +02:00
Tannin b529b1f6a8 - main window now has a small view displaying log messages
- mod list will now be highlighted when grouping is active is active
- download tooltip now supports bbcode markup in the description
- bbcode translator will now translate some named colors
- algorithm for detection of mod order problems is now more sophisticated
- exposed more functionality to python plugins
- updated to qt 4.8.6 dlls
- bugfix: plugin list wasn't
- bugfix: state changes in mod list wasn't always reported
- bugfix: loot client will now create necessary directory
- bugfix: NCC sometimes used wrong source path for extracting
- bugfix: removed noisy debug message
2014-05-04 14:50:01 +02:00
Tannin be9382e684 some fixes towards qt5 compatibility 2014-03-16 20:04:57 +01:00
Tannin 35cc2bb91c - ini file changes that would have to overwrite ini tweaks are now stored in a separate file
and actually get used.
- a warning message advices users to clean out that separate file
- slightly improved default main window layout
- bugfix: newly created ini tweaks were added to the list with incorrect  properties
2014-02-17 21:15:20 +01:00
Tannin 402d6b3a7d - moved code for file previews to plugins 2014-01-14 21:16:36 +01:00
Tannin 6e84aac467 - minor text fixes
- versions without a subminor version are now displayed without it (1.1 instead of 1.1.0)
- version compares now prefer the decimal comparison over the traditional
2013-12-07 16:07:28 +01:00
Tannin 2b711162ff - archive.dll now supports querying the crc value of files
- esptk now determines if a esp is a dummy (without records)
- hook.dll no longer creates a log file if noone wrote to it
- nexus id and installtime columns are now hidden by default
- modlist can now be refreshed without saving first (so plugins can replace the modlist.txt as a whole)
- plugins can now query more details about virtualised files
- added style options "plastique" and "cleanlooks"
- "overwrite" is no longer listed with a creation time
- a warning will now be displayed if the user has too many plugins active
- a warning will now be displayed if mods with scripts have an installation order that doesn't match the corresponding esp load order
- nmm importer now has select all/deselect all buttons
- nmm importer no longer tries to unpack missing files from archives (won't work anyway)
- initial support for importing from nmm 0.5 alpha
- removed some broken warning suppresions
- python runner now works with bundled python
- extended qbs build system (still fails to build the main gui application)
- implemented a nsis-based installer
2013-11-18 20:17:14 +01:00
Tannin b9aa3d7668 - diagnosis plugins can now request to be re-evaluated
- main application now contains means for plugins to react on some changes (to be extended)
- plugins can now retrieve more information about a mod
- user-agent sent to nexus now automatically contains the current MO version
- included updated russian translation
- problems dialog now refreshes itself after a fix was applied
- fixed new esp/asset ordering diagnosis. May be fully functional now
- bugfix: restoring locked load order could leave MO in an endless loop (not sure if this fix is correct yet)
- bugfix: plugin list was not visually updated after some changes
- bugfix: nmm importer threw away mod ordering
2013-11-06 18:35:27 +01:00
Tannin d4a7f6fcb9 - added a new diagnosis to detect potential problems in regards to esp vs. asset ordering (not fully functional yet)
- new plugin interfaces to the mod list
- plugins can now query the origin (mod) of a esp/esm
- bugfix: potential access to profile before one was activated
- bugfix: regression in previous (not-yet-released) commit prevented changes to bsa list from being saved
2013-11-01 14:59:25 +01:00
Tannin 49c1251f77 diagnosis plugin now warns when nitpick is installed 2013-09-30 18:33:45 +02:00
Tannin d36dd7f48a - esp reader now handles invalid files more gracefully
- files moved will now also be treated as "deleted" in the old location so a newly created file with that same name is not created in overwrite
- introduced a mechanism by which MO can recognize if it crashed before when attempting to load a plugin. That plugin can be blacklisted so it doesn't get loaded again
- plugins can now programaticaly change their settings
- plugins can now store data persistently without exposing that data as settings
- requesting an unset-setting from a plugin is no longer treated as a bug
- clarified warning message for when files are in overwrite directory
- the proxyPython plugin will now discover if python initialization crashed MO on a previous session and give the user a chance to fix it or disable the plugin
- bugfix: GetModuleFileName modified the buffer past the zero termination. While this doesn't violate the API documentation it is different from the regular windows implementation
- bugfix: proxy plugins couldn't access the parent widget
- bugfix: when moving a file from overwrite to a mod the in-memory file structure wasn't updated
- bugfix: name input dialog for profiles allowed names that weren't valid directory names
- bugfix: profile dialog wasn't able to delete profiles if the name started or ended in whitespaces
- bugfix: The name-cells for plugin settings could be changed (without effect)
- removed a few obsolete files from the repository
2013-09-21 19:25:33 +02:00
3 changed files with 440 additions and 15 deletions
+8 -3
View File
@@ -4,24 +4,29 @@
#
#-------------------------------------------------
QT -= gui
TARGET = diagnoseBasic
TEMPLATE = lib
CONFIG += plugins
CONFIG += dll
contains(QT_VERSION, "^5.*") {
QT += widgets
}
DEFINES += DIAGNOSEBASIC_LIBRARY
DEFINES += NOMINMAX
# suppress a few warnings caused by boost vs vc++ paranoia
DEFINES += _SCL_SECURE_NO_WARNINGS
SOURCES += diagnosebasic.cpp
HEADERS += diagnosebasic.h
include(../plugin_template.pri)
INCLUDEPATH += "$(BOOSTPATH)"
INCLUDEPATH += "$(BOOSTPATH)"
#CONFIG += dll
+357 -11
View File
@@ -1,12 +1,44 @@
/*
* Copyright (C) 2013 Sebastian Herbord. All rights reserved.
*
* This file is part of the basic diagnosis plugin for Mod Organizer
*
* This plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this plugin. If not, see <http://www.gnu.org/licenses/>.
*/
#include "diagnosebasic.h"
#include <report.h>
#include <utility.h>
#include <QtPlugin>
#include <QFile>
#include <QDir>
#include <QDebug>
#include <QCoreApplication>
#include <QMessageBox>
#include <QDateTime>
#include <regex>
#include <functional>
#include <vector>
#include <algorithm>
#pragma warning( push, 2 )
#include <boost/assign.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/topological_sort.hpp>
#include <boost/graph/connected_components.hpp>
#pragma warning( pop )
using namespace MOBase;
@@ -19,6 +51,17 @@ DiagnoseBasic::DiagnoseBasic()
bool DiagnoseBasic::init(IOrganizer *moInfo)
{
m_MOInfo = moInfo;
m_MOInfo->modList()->onModStateChanged([&] (const QString &modName, IModList::ModStates) {
if (modName == "Overwrite") invalidate();
});
m_MOInfo->modList()->onModMoved([&] (const QString&, int, int) {
// invalidates only the assetOrder check but there is currently no way to recheck individual
// checks
invalidate();
});
m_MOInfo->pluginList()->onRefreshed([&] () { this->invalidate(); });
return true;
}
@@ -39,7 +82,7 @@ QString DiagnoseBasic::description() const
VersionInfo DiagnoseBasic::version() const
{
return VersionInfo(1, 0, 0, VersionInfo::RELEASE_FINAL);
return VersionInfo(1, 1, 0, VersionInfo::RELEASE_FINAL);
}
bool DiagnoseBasic::isActive() const
@@ -105,9 +148,241 @@ bool DiagnoseBasic::errorReported() const
bool DiagnoseBasic::overwriteFiles() const
{
QDir dir(QCoreApplication::applicationDirPath() + "/overwrite");
return dir.count() != 2; // account for . and ..
}
bool DiagnoseBasic::nitpickInstalled() const
{
QString path = m_MOInfo->resolvePath("skse/plugins/nitpick.dll");
return !path.isEmpty();
}
/// unused code to remove duplicates from a vector
template<typename T>
void makeUnique(std::vector<T> &vector)
{
std::set<T> done;
auto read = vector.begin();
auto write = vector.begin();
for (; read != vector.end(); ++read) {
if (done.insert(*read).second) {
*write = *read;
++write;
}
}
vector.erase(write, vector.end());
}
bool operator<(const DiagnoseBasic::Move &lhs, const DiagnoseBasic::Move &rhs)
{
if (lhs.item.modName != rhs.item.modName) return lhs.item.modName < rhs.item.modName;
else return lhs.reference.modName < rhs.reference.modName;
}
void DiagnoseBasic::topoSort(std::vector<DiagnoseBasic::ListElement> &list) const
{
typedef std::pair<int, int> Edge;
std::vector<Edge> before;
// create a graph with edges where each edge tells us that mod a has to come before mod b
// this takes into account only pairs of mods that actually have conflicting scripts
for (unsigned i = 0; i < list.size(); ++i) {
for (unsigned j = i + 1; j < list.size(); ++j) {
if (!(list[i].relevantScripts & list[j].relevantScripts).empty()) {
before.push_back(Edge(i, j));
}
}
}
{
typedef boost::adjacency_list<boost::vecS,boost::vecS, boost::bidirectionalS, boost::property<boost::vertex_color_t, boost::default_color_type>> Graph;
using namespace boost;
Graph graph(before.begin(), before.end(), list.size());
typedef graph_traits<Graph>::vertex_descriptor Vertex;
typedef std::list<Vertex> Order;
// figure out disconnected components of the graph
std::vector<int> component(num_vertices(graph));
connected_components(graph, &component[0]);
for (int i = 0; i != component.size(); ++i) {
list[i].sortGroup = component[i];
}
Order order;
// do the actual sorting. This sorts the graph in full although the order between unconnected components doesn't
// really matter to us
boost::topological_sort(graph, std::front_inserter(order));
}
}
void DiagnoseBasic::Sorter::sortGroup(std::vector<ListElement> modList)
{
std::vector<ListElement> sorted;
{
auto maxSeqBegin = modList.end();
auto maxSeqEnd = modList.end();
int maxSeqAvoidMove = 0;
// first, determine the longest sequence of correctly sorted mods
auto curSeqBegin = modList.begin();
auto curSeqEnd = modList.begin();
int curSeqAvoidMove = 0;
auto iter = modList.begin() + 1;
for (; iter != modList.end(); ++iter) {
if (iter->modPriority < curSeqEnd->modPriority) {
// sequence ends
// use this sequence of correctly sorted mods if it is longer than the previously longest
// sequence and doesn't have fewer mods that don't want to move. Thus the need for mods to
// stay in place beats our gole to have the minimal number of moves
if ((maxSeqBegin == modList.end())
|| (((curSeqEnd - curSeqBegin) > (maxSeqEnd - maxSeqBegin))
&& (curSeqAvoidMove >= maxSeqAvoidMove))) {
maxSeqBegin = curSeqBegin;
maxSeqEnd = iter;
maxSeqAvoidMove = curSeqAvoidMove;
}
curSeqBegin = curSeqEnd = iter;
curSeqAvoidMove = 0;
} else {
curSeqEnd = iter;
if (iter->avoidMove) {
++curSeqAvoidMove;
}
}
}
if ((maxSeqBegin == modList.end()) || ((curSeqEnd - curSeqBegin) > (maxSeqEnd - maxSeqBegin))) {
maxSeqBegin = curSeqBegin;
maxSeqEnd = modList.end();
}
sorted = std::vector<ListElement>(maxSeqBegin, maxSeqEnd);
modList.erase(maxSeqBegin, maxSeqEnd);
}
// now move the elements NOT in this sequence to the correct location within
while (modList.begin() != modList.end()) {
auto iter = modList.begin();
bool found = false;
auto targetIter = sorted.begin();
for (; targetIter != sorted.end(); ++targetIter) {
if (targetIter->pluginPriority > iter->pluginPriority) {
moves.push_back(Move(*iter, *targetIter, Move::BEFORE));
found = true;
break;
}
}
if (!found) {
// add to end!
moves.push_back(Move(*iter, *sorted.rbegin(), Move::AFTER));
}
sorted.insert(targetIter, *iter);
modList.erase(iter);
}
}
void DiagnoseBasic::Sorter::operator()(std::vector<ListElement> modList)
{
if (modList.size() == 0) {
return;
}
int currentGroup = 0;
while (true) {
std::vector<ListElement> filtered;
std::copy_if(modList.begin(), modList.end(), std::back_inserter(filtered),
[currentGroup] (const ListElement &ele) -> bool { return ele.sortGroup == currentGroup; });
++currentGroup;
if (filtered.size() == 0) {
break;
} else if (filtered.size() == 1) {
// skip if there is only one element, there can't be a necessary move
continue;
}
sortGroup(filtered);
}
}
bool DiagnoseBasic::assetOrder() const
{
Sorter minSorter;
std::vector<ListElement> modList;
// list of mods containing conflicted scripts. We care only for those
std::map<QString, QSet<QString>> scriptMods;
foreach (const IOrganizer::FileInfo & pex, m_MOInfo->findFileInfos("scripts",
[] (const IOrganizer::FileInfo &file) -> bool { return file.filePath.endsWith(".pex", Qt::CaseInsensitive); })) {
QStringList origins = pex.origins;
origins.removeAll("data"); // ignore files in base directory
if (origins.size() > 1) {
foreach(const QString &origin, origins) {
scriptMods[origin].insert(pex.filePath);
}
}
}
// produce a list with the information we need: plugin, mod and the priority for each
QStringList esps = m_MOInfo->findFiles("",
[] (const QString &fileName) -> bool { return fileName.endsWith(".esp", Qt::CaseInsensitive)
|| fileName.endsWith(".esm", Qt::CaseInsensitive); });
foreach (const QString &esp, esps) {
ListElement ele;
ele.espName = QFileInfo(esp).fileName();
ele.modName = m_MOInfo->pluginList()->origin(ele.espName);
ele.pluginPriority = m_MOInfo->pluginList()->priority(ele.espName);
ele.modPriority = m_MOInfo->modList()->priority(ele.modName);
IModList::ModStates state = m_MOInfo->modList()->state(ele.modName);
ele.avoidMove = state.testFlag(IModList::STATE_ESSENTIAL);
auto iter = scriptMods.find(ele.modName);
if (state.testFlag(IModList::STATE_EXISTS)
&& (iter != scriptMods.end())) {
ele.relevantScripts = iter->second;
modList.push_back(ele);
}
}
// generate a copy of list that contains each mod only once, otherwise
// strange things happen if a mod contains multiple esps that are mixed
// with esps from other mods
std::vector<ListElement> distinctModList;
{
// sort the input list so we get predictable results
std::sort(modList.begin(), modList.end(),
[] (const ListElement &lhs, const ListElement &rhs) -> bool { return lhs.pluginPriority < rhs.pluginPriority; });
std::set<QString> includedMods;
foreach(const ListElement &ele, modList) {
if (includedMods.find(ele.modName) == includedMods.end()) {
distinctModList.push_back(ele);
includedMods.insert(ele.modName);
}
}
}
// sort the list by plugin priority. This step is probably unnecessary as the list was already sorted when we removed duplicates
std::sort(distinctModList.begin(), distinctModList.end(),
[] (const ListElement &lhs, const ListElement &rhs) -> bool { return lhs.pluginPriority < rhs.pluginPriority; });
topoSort(distinctModList);
// now determine the moves necessary to bring the mod list into this order
minSorter(distinctModList);
m_SuggestedMoves = minSorter.moves;
return m_SuggestedMoves.size() > 0;
}
bool DiagnoseBasic::invalidFontConfig() const
{
if (m_MOInfo->gameInfo().type() != IGameInfo::TYPE_SKYRIM) {
@@ -117,7 +392,7 @@ bool DiagnoseBasic::invalidFontConfig() const
// files from skyrim_interface.bsa
static std::vector<QString> defaultFonts = boost::assign::list_of("interface\\fonts_console.swf")
("interface\\fonts_en.swf");
("interface\\fonts_en.swf");
QString configPath = m_MOInfo->resolvePath("interface/fontconfig.txt");
if (configPath.isEmpty()) {
@@ -137,7 +412,7 @@ bool DiagnoseBasic::invalidFontConfig() const
std::string temp = match[1];
QString path(temp.c_str());
bool isDefault = false;
foreach (const QString &def, defaultFonts) {
foreach(const QString &def, defaultFonts) {
if (QString::compare(def, path, Qt::CaseInsensitive) == 0) {
isDefault = true;
break;
@@ -166,6 +441,15 @@ std::vector<unsigned int> DiagnoseBasic::activeProblems() const
if (invalidFontConfig()) {
result.push_back(PROBLEM_INVALIDFONT);
}
if (nitpickInstalled()) {
result.push_back(PROBLEM_NITPICKINSTALLED);
}
if (assetOrder()) {
result.push_back(PROBLEM_ASSETORDER);
}
if (QFile::exists(m_MOInfo->profilePath() + "/profile_tweaks.ini")) {
result.push_back(PROBLEM_PROFILETWEAKS);
}
return result;
}
@@ -179,6 +463,12 @@ QString DiagnoseBasic::shortDescription(unsigned int key) const
return tr("There are files in your overwrite mod");
case PROBLEM_INVALIDFONT:
return tr("Your font configuration may be broken");
case PROBLEM_NITPICKINSTALLED:
return tr("Nitpick installed");
case PROBLEM_ASSETORDER:
return tr("Potential Mod order problem");
case PROBLEM_PROFILETWEAKS:
return tr("Ini Tweaks overwritten");
default:
throw MyException(tr("invalid problem key %1").arg(key));
}
@@ -190,28 +480,84 @@ QString DiagnoseBasic::fullDescription(unsigned int key) const
case PROBLEM_ERRORLOG:
return "<code>" + m_ErrorMessage.replace("\n", "<br>") + "</code>";
case PROBLEM_OVERWRITE:
return tr("Files in the <font color=\"red\"><i>Overwrite</i></font> mod are are usually files created by a foreign tool (i.e. Wrye Bash, Automatic Variants, ...).<br>"
"For technical reasons it's not possible to assign those files to the corresponding mod automatically, you have to deal with these "
"files manually.<br>Use the right-click menu on <font color=\"red\"><i>Overwrite</i></font> to create a regular mod from all the files currently in that folder or double "
"click it and then drag&drop files to an existing mod.");
return tr("Files in the <font color=\"red\"><i>Overwrite</i></font> mod are are usually files created by an external tool (i.e. Wrye Bash, Automatic Variants, ...).<br>"
"It is advisable you empty the Overwrite directory by moving those files to an existing mod. You can do this by double-clicking the <font color=\"red\"><i>Overwrite</i></font> mod and use drag&drop to move the files to a mod.<br>"
"Alternatively, right-click on <font color=\"red\"><i>Overwrite</i></font> and create a new regular mod from the files there.<br>"
"<br>"
"Why is this necessary? Generated files may depend on the other mods active in a profile and may thus be incompatible with a different profile (i.e. bashed patches from Wrye Bash). "
"On the other hand the file may be necessary in all profiles (i.e. dlc esms after cleaning with TESVEdit)<br>"
"This can NOT be automated you HAVE to read up on the tools you use and make an educated decision.");
case PROBLEM_INVALIDFONT:
return tr("Your current configuration seems to reference a font that is not installed. You may see only boxes instead of letters.<br>"
"The font configuration is in Data\\interface\\fontconfig.txt. Most likely you have a broken installation of a font replacer mod.");
case PROBLEM_NITPICKINSTALLED:
return tr("You have the nitpick skse plugin installed. This plugin is not needed with Mod Organizer because MO already offers the same functionality. "
"Worse: The two solutions may conflict so it's strongly suggested you remove this plugin.");
case PROBLEM_ASSETORDER: {
QString res = tr("The conflict resolution order for some mods containing scripts differs from that of the corresponding esp.<br>"
"This may lead to subtle, hard to locate bugs. You should re-order the affected mods (left list!).<br>"
"There is no way to reliably know if each of these changes is absolutely necessary but its definitively safer.<br>"
"If someone suggested you ignore this message, please give them a proper slapping from me. <b>Do not ignore this warning</b><br>"
"The following changes should prevent these kinds of errors:") + "<ul>";
foreach(const Move &op, m_SuggestedMoves) {
if (op.type == Move::BEFORE) {
res += "<li>" + tr("Move %1 before %2").arg(op.item.modName).arg(op.reference.modName) + "</li>";
} else {
res += "<li>" + tr("Move %1 after %2").arg(op.item.modName).arg(op.reference.modName) + "</li>";
}
}
res += "</ul>";
return res;
} break;
case PROBLEM_PROFILETWEAKS: {
QString fileContent = readFileText(m_MOInfo->profilePath() + "/profile_tweaks.ini");
return tr("Settings provided in ini tweaks have been overwritten in-game or in an applications.<br>"
"These overwrites are stored in a separate file (<i>profile_tweaks.ini</i> within the profile directory)<br>"
"to keep ini-tweaks in their original state but you should really get rid of this file as there is<br>"
"no tool support in MO to work on it. <br>"
"Advice: Copy settings you want to keep to an appropriate ini tweak, then delete <i>profile_tweaks.ini</i>.<br>"
"Hitting the <i>Fix</i> button will delete that file")
+ "<hr><i>profile_tweaks.ini:</i><pre>" + fileContent + "</pre>";
} break;
default:
throw MyException(tr("invalid problem key %1").arg(key));
}
}
bool DiagnoseBasic::hasGuidedFix(unsigned int) const
bool DiagnoseBasic::hasGuidedFix(unsigned int key) const
{
return false;
return (key == PROBLEM_ASSETORDER) || (key == PROBLEM_PROFILETWEAKS);
}
void DiagnoseBasic::startGuidedFix(unsigned int key) const
{
throw MyException(tr("invalid problem key %1").arg(key));
switch (key) {
case PROBLEM_ASSETORDER: {
if (QMessageBox::warning(NULL, tr("Continue?"), tr("This <b>BETA</b> feature will rearrange your mods to eliminate all "
"possible ordering conflicts. Proceed?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
foreach (const Move &op, m_SuggestedMoves) {
int oldPriority = m_MOInfo->modList()->priority(op.item.modName);
int targetPriority = -1;
if (op.type == Move::BEFORE) {
targetPriority = m_MOInfo->modList()->priority(op.reference.modName);
} else {
targetPriority = m_MOInfo->modList()->priority(op.reference.modName) + 1;
}
if (oldPriority < targetPriority) {
--targetPriority;
}
m_MOInfo->modList()->setPriority(op.item.modName, targetPriority);
}
}
} break;
case PROBLEM_PROFILETWEAKS: {
shellDeleteQuiet(m_MOInfo->profilePath() + "/profile_tweaks.ini");
} break;
default:
throw MyException(tr("invalid problem key %1").arg(key));
}
}
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
Q_EXPORT_PLUGIN2(diagnosebasic, DiagnoseBasic)
#endif
+75 -1
View File
@@ -1,3 +1,22 @@
/*
Copyright (C) 2013 Sebastian Herbord. All rights reserved.
This file is part of basic diagnosis plugin for MO
This plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this plugin. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DIAGNOSEBASIC_H
#define DIAGNOSEBASIC_H
@@ -5,6 +24,9 @@
#include <iplugin.h>
#include <iplugindiagnose.h>
#include <imoinfo.h>
#include <imodlist.h>
#include <QString>
#include <QSet>
class DiagnoseBasic : public QObject, MOBase::IPlugin, MOBase::IPluginDiagnose
@@ -42,19 +64,71 @@ private:
bool errorReported() const;
bool overwriteFiles() const;
bool invalidFontConfig() const;
bool nitpickInstalled() const;
bool assetOrder() const;
private:
static const unsigned int PROBLEM_ERRORLOG = 1;
static const unsigned int PROBLEM_OVERWRITE = 2;
static const unsigned int PROBLEM_INVALIDFONT = 3;
static const unsigned int PROBLEM_NITPICKINSTALLED = 4;
static const unsigned int PROBLEM_ASSETORDER = 5;
static const unsigned int PROBLEM_PROFILETWEAKS = 7;
static const unsigned int NUM_CONTEXT_ROWS = 5;
private:
const MOBase::IOrganizer *m_MOInfo;
struct ListElement {
QString espName;
QString modName;
int pluginPriority;
int modPriority;
int sortGroup;
bool avoidMove;
QSet<QString> relevantScripts;
};
struct Move {
ListElement item;
ListElement reference;
enum EType {
BEFORE,
AFTER
} type;
Move(const ListElement &initItem, const ListElement &initReference, EType initType)
: item(initItem), reference(initReference), type(initType) {}
};
struct Sorter {
struct {
int operator()(const ListElement &lhs, const ListElement &rhs)
{
return lhs.modPriority < rhs.modPriority;
}
} minMod;
std::vector<Move> moves;
void operator()(std::vector<ListElement> modList);
private:
void sortGroup(std::vector<ListElement> modList);
};
friend bool operator<(const Move &lhs, const Move &rhs);
private:
void topoSort(std::vector<ListElement> &list) const;
private:
MOBase::IOrganizer *m_MOInfo;
mutable QString m_ErrorMessage;
mutable std::vector <Move> m_SuggestedMoves;
mutable QString m_NewestModlistBackup;
};