diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-27 12:05:11 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-27 12:05:11 -0500 |
| commit | 21cddd0ad3cef165c3860c2031b4cd00802c499d (patch) | |
| tree | 393c943689805e899cd6c53c7b1a6a807e3caaff /src/mainwindow.cpp | |
| parent | a5bd29f1117ec56632138640d508afad0232e5ed (diff) | |
changed mod name of unmanaged files from "data" to "<Unmanaged>" in the data tab and for the root item in the archives tab
log error when trying to open mod info for a managed file but the mod isn't found
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 06e22e4e..e134d64a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -190,6 +190,11 @@ const QSize SmallToolbarSize(24, 24); const QSize MediumToolbarSize(32, 32); const QSize LargeToolbarSize(42, 36); +QString UnmanagedModName() +{ + return QObject::tr("<Unmanaged>"); +} + bool runLoot(QWidget* parent, OrganizerCore& core, bool didUpdateMasterList); @@ -1661,9 +1666,13 @@ void MainWindow::updateTo(QTreeWidgetItem *subTree, const std::wstring &director QString fileName = ToQString(current->getName()); QStringList columns(fileName); FilesOrigin origin = m_OrganizerCore.directoryStructure()->getOriginByID(originID); - QString source("data"); - unsigned int modIndex = ModInfo::getIndex(ToQString(origin.getName())); - if (modIndex != UINT_MAX) { + + QString source; + const unsigned int modIndex = ModInfo::getIndex(ToQString(origin.getName())); + + if (modIndex == UINT_MAX) { + source = UnmanagedModName(); + } else { ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex); source = modInfo->name(); } @@ -2046,12 +2055,17 @@ void MainWindow::updateBSAList(const QStringList &defaultArchives, const QString int originID = iter->second->data(1, Qt::UserRole).toInt(); FilesOrigin origin = m_OrganizerCore.directoryStructure()->getOriginByID(originID); - QString modName("data"); - unsigned int modIndex = ModInfo::getIndex(ToQString(origin.getName())); - if (modIndex != UINT_MAX) { + + QString modName; + const unsigned int modIndex = ModInfo::getIndex(ToQString(origin.getName())); + + if (modIndex == UINT_MAX) { + modName = UnmanagedModName(); + } else { ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex); modName = modInfo->name(); } + QList<QTreeWidgetItem*> items = ui->bsaList->findItems(modName, Qt::MatchFixedString); QTreeWidgetItem * subItem = nullptr; if (items.length() > 0) { @@ -5435,11 +5449,17 @@ void MainWindow::openDataModInfo_clicked() } const auto originID = m_ContextItem->data(1, Qt::UserRole + 1).toInt(); + if (originID == 0) { + // unmanaged + return; + } + const auto& origin = m_OrganizerCore.directoryStructure()->getOriginByID(originID); const auto& name = QString::fromStdWString(origin.getName()); unsigned int index = ModInfo::getIndex(name); if (index == UINT_MAX) { + log::error("can't open mod info, mod '{}' not found", name); return; } |
