From fecb66f66b651daf6bc9b092e5e14c3efd2a82cc Mon Sep 17 00:00:00 2001 From: Al Date: Wed, 26 Dec 2018 15:49:00 +0100 Subject: Added "Visible" counters for modlist. Improved counters tool tip view. --- src/mainwindow.cpp | 62 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3e8323e5..1e51977f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -367,6 +367,7 @@ MainWindow::MainWindow(QSettings &initSettings connect(ui->modList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(modlistSelectionChanged(QModelIndex,QModelIndex))); connect(m_ModListSortProxy, SIGNAL(filterActive(bool)), this, SLOT(modFilterActive(bool))); + connect(m_ModListSortProxy, SIGNAL(layoutChanged()), this, SLOT(updateModCount())); connect(ui->modFilterEdit, SIGNAL(textChanged(QString)), m_ModListSortProxy, SLOT(updateFilter(QString))); connect(ui->espFilterEdit, SIGNAL(textChanged(QString)), m_PluginListSortProxy, SLOT(updateFilter(QString))); @@ -3110,10 +3111,15 @@ void MainWindow::searchClear_activated() void MainWindow::updateModCount() { int activeCount = 0; + int visActiveCount = 0; int backupCount = 0; + int visBackupCount = 0; int foreignCount = 0; + int visForeignCount = 0; int separatorCount = 0; + int visSeparatorCount = 0; int regularCount = 0; + int visRegularCount = 0; QStringList allMods = m_OrganizerCore.modList()->allMods(); @@ -3121,15 +3127,29 @@ void MainWindow::updateModCount() return std::find(flags.begin(), flags.end(), filter) != flags.end(); }; + bool isEnabled; + bool isVisible; for (QString mod : allMods) { int modIndex = ModInfo::getIndex(mod); ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex); std::vector modFlags = modInfo->getFlags(); + isEnabled = m_OrganizerCore.currentProfile()->modEnabled(modIndex); + isVisible = m_ModListSortProxy->filterMatchesMod(modInfo, isEnabled); + for (auto flag : modFlags) { switch (flag) { - case ModInfo::FLAG_BACKUP: backupCount++; break; - case ModInfo::FLAG_FOREIGN: foreignCount++; break; - case ModInfo::FLAG_SEPARATOR: separatorCount++; break; + case ModInfo::FLAG_BACKUP: backupCount++; + if (isVisible) + visBackupCount++; + break; + case ModInfo::FLAG_FOREIGN: foreignCount++; + if (isVisible) + visForeignCount++; + break; + case ModInfo::FLAG_SEPARATOR: separatorCount++; + if (isVisible) + visSeparatorCount++; + break; } } @@ -3137,24 +3157,35 @@ void MainWindow::updateModCount() !hasFlag(modFlags, ModInfo::FLAG_FOREIGN) && !hasFlag(modFlags, ModInfo::FLAG_SEPARATOR) && !hasFlag(modFlags, ModInfo::FLAG_OVERWRITE)) { - if (m_OrganizerCore.currentProfile()->modEnabled(modIndex)) + if (isEnabled) { activeCount++; + if (isVisible) + visActiveCount++; + } + if (isVisible) + visRegularCount++; regularCount++; } } ui->activeModsCounter->display(activeCount); - ui->activeModsCounter->setToolTip(tr("" - "" - "" - "" - "" + ui->activeModsCounter->setToolTip(tr("
Active mods: %1 of %2
Unmanaged mods/DLC: %3
Mod backups: %4
Separators: %5
" + "" + "" + "" + "" + "" "
TypeAllVisible
Enabled mods: %1 / %2%3 / %4
Unmanaged/DLCs: %5%6
Mod backups: %7%8
Separators: %9%10
") .arg(activeCount) .arg(regularCount) + .arg(visActiveCount) + .arg(visRegularCount) .arg(foreignCount) + .arg(visForeignCount) .arg(backupCount) + .arg(visBackupCount) .arg(separatorCount) + .arg(visSeparatorCount) ); } @@ -3187,12 +3218,13 @@ void MainWindow::updatePluginCount() int totalCount = masterCount + lightMasterCount + regularCount; ui->activePluginsCounter->display(activeCount); - ui->activePluginsCounter->setToolTip(tr("" - "" - "" - "" - "" - "" + ui->activePluginsCounter->setToolTip(tr("
Active plugins: %1 of %2
Active ESMs: %3 of %4
Active ESLs: %5 of %6
Active ESPs: %7 of %8
Active ESMs+ESPs: %9 of %10
" + "" + "" + "" + "" + "" + "" "
TypeActiveTotal
Active plugins:%1%2
Active ESMs:%3%4
Active ESPs:%7%8
Active ESMs+ESPs:%9%10
Active ESLs:%5%6
") .arg(activeCount).arg(totalCount) .arg(activeMasterCount).arg(masterCount) -- cgit v1.3.1