From a3fe2859f5491c416e0e17e22d044a3e3bce976d Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Sat, 15 Feb 2025 01:31:31 +0100 Subject: [PATCH] open repository --- launcher/modManager/cmodlistview_moc.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/launcher/modManager/cmodlistview_moc.cpp b/launcher/modManager/cmodlistview_moc.cpp index 6eccc6f79..8d04cf443 100644 --- a/launcher/modManager/cmodlistview_moc.cpp +++ b/launcher/modManager/cmodlistview_moc.cpp @@ -484,6 +484,19 @@ void CModListView::onCustomContextMenu(const QPoint &point) [this](ModState mod){ openModDictionary(mod.getID()); } ); #endif + addContextEntry( + !mod.getDownloadUrl().isEmpty(), + tr("Open repository"), + [this](ModState mod){ + QUrl url(mod.getDownloadUrl()); + QString repoUrl = QString("%1://%2/%3/%4") + .arg(url.scheme()) + .arg(url.host()) + .arg(url.path().split('/')[1]) + .arg(url.path().split('/')[2]); + QDesktopServices::openUrl(repoUrl); + } + ); contextMenu->exec(ui->allModsView->viewport()->mapToGlobal(point)); } @@ -678,7 +691,7 @@ void CModListView::openModDictionary(const QString & modName) { QString tmp = modName; tmp.replace(".", "/Mods/"); - + ResourcePath resID(std::string("Mods/") + tmp.toStdString(), EResType::DIRECTORY); // Get location of the mod, in case-insensitive way QString modDir = pathToQString(*CResourceHandler::get()->getResourceName(resID));