summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 58fe95d5..17bc46fd 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -155,14 +155,15 @@ QString ModList::getFlagText(ModInfo::EFlag flag, ModInfo::Ptr modInfo) const
if (!modInfo->comments().isEmpty())
output << QString("<i>%1</i>").arg(modInfo->comments());
if (!modInfo->notes().isEmpty())
- output << QString("<i>%1</i>").arg(modInfo->notes()).replace("\n", "<br>");
- return output.join("<br>");
+ output << QString("<i>%1</i>").arg(modInfo->notes());
+ return output.join("");
}
case ModInfo::FLAG_CONFLICT_OVERWRITE: return tr("Overwrites files");
case ModInfo::FLAG_CONFLICT_OVERWRITTEN: return tr("Overwritten files");
case ModInfo::FLAG_CONFLICT_MIXED: return tr("Overwrites & Overwritten");
case ModInfo::FLAG_CONFLICT_REDUNDANT: return tr("Redundant");
- case ModInfo::FLAG_ALTERNATE_GAME: return tr("This mod targets a different game");
+ case ModInfo::FLAG_ALTERNATE_GAME: return tr("<br>This mod is for a different game, "
+ "make sure it's compatible or it could cause crashes.");
default: return "";
}
}
@@ -527,7 +528,7 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role)
m_Profile->setModEnabled(modID, enabled);
m_Modified = true;
m_LastCheck.restart();
- emit modlist_changed(index, role);
+ emit modlistChanged(index, role);
}
result = true;
emit dataChanged(index, index);
@@ -562,7 +563,7 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role)
int newID = value.toInt(&ok);
if (ok) {
info->setNexusID(newID);
- emit modlist_changed(index, role);
+ emit modlistChanged(index, role);
result = true;
} else {
result = false;
@@ -1283,12 +1284,24 @@ bool ModList::toggleSelection(QAbstractItemView *itemView)
QItemSelectionModel *selectionModel = itemView->selectionModel();
+ QList<unsigned int> modsToEnable;
+ QList<unsigned int> modsToDisable;
+ QModelIndexList dirtyMods;
for (QModelIndex idx : selectionModel->selectedRows()) {
int modId = idx.data(Qt::UserRole + 1).toInt();
- m_Profile->setModEnabled(modId, !m_Profile->modEnabled(modId));
- emit modlist_changed(idx, 0);
+ if (m_Profile->modEnabled(modId)) {
+ modsToDisable.append(modId);
+ dirtyMods.append(idx);
+ } else {
+ modsToEnable.append(modId);
+ dirtyMods.append(idx);
+ }
}
+ m_Profile->setModsEnabled(modsToEnable, modsToDisable);
+
+ emit modlistChanged(dirtyMods, 0);
+
m_Modified = true;
m_LastCheck.restart();
@@ -1331,13 +1344,12 @@ bool ModList::eventFilter(QObject *obj, QEvent *event)
void ModList::enableSelected(const QItemSelectionModel *selectionModel)
{
if (selectionModel->hasSelection()) {
- bool dirty = false;
+ QList<unsigned int> modsToEnable;
for (auto row : selectionModel->selectedRows(COL_PRIORITY)) {
int modID = m_Profile->modIndexByPriority(row.data().toInt());
- if (!m_Profile->modEnabled(modID)) {
- m_Profile->setModEnabled(modID, true);
- }
+ modsToEnable.append(modID);
}
+ m_Profile->setModsEnabled(modsToEnable, QList<unsigned int>());
}
}
@@ -1345,14 +1357,11 @@ void ModList::enableSelected(const QItemSelectionModel *selectionModel)
void ModList::disableSelected(const QItemSelectionModel *selectionModel)
{
if (selectionModel->hasSelection()) {
- bool dirty = false;
+ QList<unsigned int> modsToDisable;
for (auto row : selectionModel->selectedRows(COL_PRIORITY)) {
int modID = m_Profile->modIndexByPriority(row.data().toInt());
- if (m_Profile->modEnabled(modID)) {
- m_Profile->setModEnabled(modID, false);
- }
+ modsToDisable.append(modID);
}
-
-
+ m_Profile->setModsEnabled(QList<unsigned int>(), modsToDisable);
}
}