diff options
| author | Tannin <devnull@localhost> | 2013-06-07 18:16:52 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-06-07 18:16:52 +0200 |
| commit | 50d05236226d04d3854008073420282b8d21f614 (patch) | |
| tree | 67f4916017f52f1d1b8d746c81b19de808a3568a /src/mainwindow.cpp | |
| parent | 97111de1409a59eea9e7ab5050ab70f4d01ddb8e (diff) | |
- locking/unlocking esps can now be done for the whole selection
- bugfix: MO crashed if the locked index file is borked. This shouldn't happen
anymore so I'm not sure how that file breaks to begin with
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fb88bbad..64a3d0de 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1588,7 +1588,6 @@ void MainWindow::refreshESPList() m_CurrentProfile->getPluginsFileName(), m_CurrentProfile->getLoadOrderFileName(), m_CurrentProfile->getLockedOrderFileName()); - //m_PluginList.readFrom(m_CurrentProfile->getPluginsFileName()); } @@ -2520,6 +2519,9 @@ void MainWindow::modlistChanged(const QModelIndex &index, int role) if (enabled > 1) { MessageDialog::showMessage(tr("Multiple esps activated, please check that they don't conflict."), this); } + m_PluginList.refreshLoadOrder(); + // immediately save plugin list + savePluginList(); } } } @@ -4234,14 +4236,28 @@ void MainWindow::on_categoriesList_customContextMenuRequested(const QPoint &pos) } +void MainWindow::updateESPLock(bool locked) +{ + QItemSelection currentSelection = ui->espList->selectionModel()->selection(); + if (currentSelection.count() == 0) { + // this path is probably useless + m_PluginList.lockESPIndex(m_ContextRow, locked); + } else { + Q_FOREACH (const QModelIndex &idx, currentSelection.indexes()) { + m_PluginList.lockESPIndex(mapToModel(&m_PluginList, idx).row(), locked); + } + } +} + + void MainWindow::lockESPIndex() { - m_PluginList.lockESPIndex(m_ContextRow, true); + updateESPLock(true); } void MainWindow::unlockESPIndex() { - m_PluginList.lockESPIndex(m_ContextRow, false); + updateESPLock(false); } @@ -4253,14 +4269,27 @@ void MainWindow::on_espList_customContextMenuRequested(const QPoint &pos) menu.addAction(tr("Enable all"), &m_PluginList, SLOT(enableAll())); menu.addAction(tr("Disable all"), &m_PluginList, SLOT(disableAll())); - if ((m_ContextRow != -1) && m_PluginList.isEnabled(m_ContextRow)) { - if (m_PluginList.isESPLocked(m_ContextRow)) { - menu.addAction(tr("Unlock index"), this, SLOT(unlockESPIndex())); - } else { - menu.addAction(tr("Lock index"), this, SLOT(lockESPIndex())); + QItemSelection currentSelection = ui->espList->selectionModel()->selection(); + bool hasLocked = false; + bool hasUnlocked = false; + Q_FOREACH (const QModelIndex &idx, currentSelection.indexes()) { + int row = m_PluginListSortProxy->mapToSource(idx).row(); + if (m_PluginList.isEnabled(row)) { + if (m_PluginList.isESPLocked(row)) { + hasLocked = true; + } else { + hasUnlocked = true; + } } } + if (hasLocked) { + menu.addAction(tr("Unlock load order"), this, SLOT(unlockESPIndex())); + } + if (hasUnlocked) { + menu.addAction(tr("Lock load order"), this, SLOT(lockESPIndex())); + } + try { menu.exec(ui->espList->mapToGlobal(pos)); } catch (const std::exception &e) { |
