From 84c66727bff954fd0820fc9f33833848496e9531 Mon Sep 17 00:00:00 2001 From: Tannin Date: Mon, 14 Jul 2014 21:22:44 +0200 Subject: - when highlighting a mod the overwritten and overwriting mods are now highlighted in the list - when starting an external application MO now wraps the process in a job and waits on that instead. This way MO is not unlocked early when skyrim is started through skse - mod info dialog no longer offers the esp tab for foreign mods because that caused confusion - updated translation files - download directory and mod directory are now created if necessary - bugfix: staging script created unnecessary copies of translation files - bugfix: potential invalid array access when trying to determine best mod order - bugfix: deleter file wasn't removed after esp hiding was disabled - bugfix: potential access to to un-initialized login reply - bugfix: changed the initialization order to allow more ui controls to be localized --- src/pluginlist.cpp | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 4f363900..9f0924a2 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -469,20 +469,21 @@ void PluginList::saveTo(const QString &pluginFileName writeLockedOrder(lockedOrderFileName); if (hideUnchecked) { - QFile deleterFile(deleterFileName); - deleterFile.open(QIODevice::WriteOnly); - deleterFile.resize(0); - deleterFile.write(QString("# This file was automatically generated by Mod Organizer.\r\n").toUtf8()); + SafeWriteFile deleterFile(deleterFileName); + deleterFile->write(QString("# This file was automatically generated by Mod Organizer.\r\n").toUtf8()); for (size_t i = 0; i < m_ESPs.size(); ++i) { int priority = m_ESPsByPriority[i]; if (!m_ESPs[priority].m_Enabled) { - deleterFile.write(m_ESPs[priority].m_Name.toUtf8()); - deleterFile.write("\r\n"); + deleterFile->write(m_ESPs[priority].m_Name.toUtf8()); + deleterFile->write("\r\n"); } } - deleterFile.close(); - qDebug("%s saved", QDir::toNativeSeparators(deleterFileName).toUtf8().constData()); + if (deleterFile.commitIfDifferent(m_LastSaveHash[deleterFileName])) { + qDebug("%s saved", qPrintable(QDir::toNativeSeparators(deleterFileName))); + } + } else { + shellDelete(QStringList() << deleterFileName); } m_SaveTimer.stop(); @@ -744,7 +745,8 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const { int index = modelIndex.row(); - if (role == Qt::DisplayRole) { + if ((role == Qt::DisplayRole) + || (role == Qt::EditRole)) { switch (modelIndex.column()) { case COL_NAME: { return m_ESPs[index].m_Name; @@ -860,6 +862,7 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const bool PluginList::setData(const QModelIndex &modIndex, const QVariant &value, int role) { + bool result = false; if (role == Qt::CheckStateRole) { m_ESPs[modIndex.row()].m_Enabled = value.toInt() == Qt::Checked; emit dataChanged(modIndex, modIndex); @@ -867,10 +870,19 @@ bool PluginList::setData(const QModelIndex &modIndex, const QVariant &value, int refreshLoadOrder(); startSaveTime(); - return true; - } else { - return false; + result = true; + } else if (role == Qt::EditRole) { + if (modIndex.column() == COL_PRIORITY) { + bool ok = false; + int newPriority = value.toInt(&ok); + if (ok) { + setPluginPriority(modIndex.row(), newPriority); + result = true; + } + refreshLoadOrder(); + } } + return result; } @@ -902,6 +914,9 @@ Qt::ItemFlags PluginList::flags(const QModelIndex &modelIndex) const if (!m_ESPs[index].m_ForceEnabled) { result |= Qt::ItemIsUserCheckable | Qt::ItemIsDragEnabled; } + if (modelIndex.column() == COL_PRIORITY) { + result |= Qt::ItemIsEditable; + } } else { result |= Qt::ItemIsDropEnabled; } -- cgit v1.3.1