diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-26 10:31:26 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-26 10:31:26 -0500 |
| commit | 9519bd62193ac1233e8087c4c143689557288c34 (patch) | |
| tree | 459f4cf323306d06e0ad1104b0260f3e008ba3c4 /src/mainwindow.cpp | |
| parent | b8e1a45840a72e1e959f1fad2f00015a72500161 (diff) | |
added open mod info to data tab context menu
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 79604c9a..06e22e4e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5428,6 +5428,27 @@ void MainWindow::openDataOriginExplorer_clicked() shell::Explore(fullPath); } +void MainWindow::openDataModInfo_clicked() +{ + if (m_ContextItem == nullptr) { + return; + } + + const auto originID = m_ContextItem->data(1, Qt::UserRole + 1).toInt(); + 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) { + return; + } + + ModInfo::Ptr modInfo = ModInfo::getByIndex(index); + if (modInfo) { + displayModInformation(modInfo, index, ModInfoTabIDs::None); + } +} + void MainWindow::updateAvailable() { ui->actionUpdate->setEnabled(true); @@ -5473,6 +5494,8 @@ void MainWindow::on_dataTree_customContextMenuRequested(const QPoint &pos) menu.addAction("Open Origin in Explorer", this, SLOT(openDataOriginExplorer_clicked())); } + menu.addAction("Open Mod Info", this, SLOT(openDataModInfo_clicked())); + // offer to hide/unhide file, but not for files from archives if (!isArchive) { if (m_ContextItem->text(0).endsWith(ModInfo::s_HiddenExt)) { |
