From 484749e612489336e5bfbe50ddc3cbe307069d4c Mon Sep 17 00:00:00 2001 From: Tannin Date: Mon, 16 Jun 2014 21:49:57 +0200 Subject: - added pseudo-categories to filter for mo-managed vs. unmanaged mods - deleted mods are now moved to the recycle bin instead of being deleted permanently - reduced modinfo dialog for foreign mods - foreign mods are now displayed with a pseudo-category - added a signal when a plugin is moved - bugfix: refreshing of directory structure for mods with bsas didn't work correctly when enabling a mod and on changing display of foreign mods - bugfix: one mod in the list was assigned the same priority on the directory structure as the data directory - bugfix: conflicts tab in the mod info dialog offered the hide option for files in bsas --- src/modlist.cpp | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src/modlist.cpp') diff --git a/src/modlist.cpp b/src/modlist.cpp index e4728618..3f46b85f 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -166,25 +166,29 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const return QVariant(); } } else if (column == COL_CATEGORY) { - int category = modInfo->getPrimaryCategory(); - if (category != -1) { - CategoryFactory &categoryFactory = CategoryFactory::instance(); - if (categoryFactory.categoryExists(category)) { - try { - int categoryIdx = categoryFactory.getCategoryIndex(category); - return categoryFactory.getCategoryName(categoryIdx); - } catch (const std::exception &e) { - qCritical("failed to retrieve category name: %s", e.what()); + if (modInfo->hasFlag(ModInfo::FLAG_FOREIGN)) { + return tr("Non-MO"); + } else { + int category = modInfo->getPrimaryCategory(); + if (category != -1) { + CategoryFactory &categoryFactory = CategoryFactory::instance(); + if (categoryFactory.categoryExists(category)) { + try { + int categoryIdx = categoryFactory.getCategoryIndex(category); + return categoryFactory.getCategoryName(categoryIdx); + } catch (const std::exception &e) { + qCritical("failed to retrieve category name: %s", e.what()); + return QString(); + } + } else { + qWarning("category %d doesn't exist (may have been removed)", category); + modInfo->setCategory(category, false); return QString(); } } else { - qWarning("category %d doesn't exist (may have been removed)", category); - modInfo->setCategory(category, false); - return QString(); + //return tr("None"); + return QVariant(); } - } else { - //return tr("None"); - return QVariant(); } } else if (column == COL_INSTALLTIME) { // display installation time for mods that can be updated @@ -253,6 +257,8 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const if (modInfo->getHighlight() & ModInfo::HIGHLIGHT_INVALID) { result.setItalic(true); } + } else if ((column == COL_CATEGORY) && (modInfo->hasFlag(ModInfo::FLAG_FOREIGN))) { + result.setItalic(true); } else if (column == COL_VERSION) { if (modInfo->updateAvailable() || modInfo->downgradeAvailable()) { result.setWeight(QFont::Bold); @@ -650,7 +656,6 @@ bool ModList::setPriority(const QString &name, int newPriority) } } - bool ModList::onModStateChanged(const std::function &func) { auto conn = m_ModStateChanged.connect(func); -- cgit v1.3.1