1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

open repository

This commit is contained in:
Laserlicht
2025-02-15 01:31:31 +01:00
parent 7b73c20229
commit a3fe2859f5

View File

@ -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));