1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Add more logging to Launcher

This commit is contained in:
Ivan Savenko
2024-12-15 19:17:06 +00:00
parent 63af2d174f
commit 88bf46f57b

View File

@@ -779,25 +779,34 @@ void CModListView::installFiles(QStringList files)
if (!accumulatedRepositoryData.isNull() && !repositoryFilesEnqueued) if (!accumulatedRepositoryData.isNull() && !repositoryFilesEnqueued)
{ {
logGlobal->info("Installing repository: started");
manager->setRepositoryData(accumulatedRepositoryData); manager->setRepositoryData(accumulatedRepositoryData);
modModel->reloadRepositories(); modModel->reloadRepositories();
static const QString repositoryCachePath = CLauncherDirs::downloadsPath() + "/repositoryCache.json"; static const QString repositoryCachePath = CLauncherDirs::downloadsPath() + "/repositoryCache.json";
JsonUtils::jsonToFile(repositoryCachePath, modStateModel->getRepositoryData()); JsonUtils::jsonToFile(repositoryCachePath, modStateModel->getRepositoryData());
logGlobal->info("Installing repository: ended");
} }
if(!mods.empty()) if(!mods.empty())
{ {
logGlobal->info("Installing mods: started");
installMods(mods); installMods(mods);
modStateModel->reloadLocalState(); modStateModel->reloadLocalState();
modModel->reloadRepositories(); modModel->reloadRepositories();
logGlobal->info("Installing mods: ended");
} }
if(!maps.empty()) if(!maps.empty())
{
logGlobal->info("Installing maps: started");
installMaps(maps); installMaps(maps);
logGlobal->info("Installing maps: ended");
}
if(!exe.empty()) if(!exe.empty())
{ {
logGlobal->info("Installing chronicles: started");
ui->progressBar->setFormat(tr("Installing Heroes Chronicles")); ui->progressBar->setFormat(tr("Installing Heroes Chronicles"));
ui->progressWidget->setVisible(true); ui->progressWidget->setVisible(true);
ui->pushButton->setEnabled(false); ui->pushButton->setEnabled(false);
@@ -827,6 +836,7 @@ void CModListView::installFiles(QStringList files)
modStateModel->reloadLocalState(); modStateModel->reloadLocalState();
modModel->reloadRepositories(); modModel->reloadRepositories();
} }
logGlobal->info("Installing chronicles: ended");
} }
if(!images.empty()) if(!images.empty())
@@ -852,6 +862,7 @@ void CModListView::installMods(QStringList archives)
{ {
if(modStateModel->getMod(mod).isInstalled()) if(modStateModel->getMod(mod).isInstalled())
{ {
logGlobal->info("Uninstalling old version of mod '%s'", mod.toStdString());
if (modStateModel->isModEnabled(mod)) if (modStateModel->isModEnabled(mod))
modsToEnable.push_back(mod); modsToEnable.push_back(mod);
@@ -866,17 +877,23 @@ void CModListView::installMods(QStringList archives)
for(int i = 0; i < modNames.size(); i++) for(int i = 0; i < modNames.size(); i++)
{ {
logGlobal->info("Installing mod '%s'", modNames[i].toStdString());
ui->progressBar->setFormat(tr("Installing mod %1").arg(modNames[i])); ui->progressBar->setFormat(tr("Installing mod %1").arg(modNames[i]));
manager->installMod(modNames[i], archives[i]); manager->installMod(modNames[i], archives[i]);
} }
if (!modsToEnable.empty()) if (!modsToEnable.empty())
{
manager->enableMods(modsToEnable); manager->enableMods(modsToEnable);
}
checkManagerErrors(); checkManagerErrors();
for(QString archive : archives) for(QString archive : archives)
{
logGlobal->info("Erasing archive '%s'", archive.toStdString());
QFile::remove(archive); QFile::remove(archive);
}
} }
void CModListView::installMaps(QStringList maps) void CModListView::installMaps(QStringList maps)
@@ -885,6 +902,7 @@ void CModListView::installMaps(QStringList maps)
for(QString map : maps) for(QString map : maps)
{ {
logGlobal->info("Importing map '%s'", map.toStdString());
QFile(map).rename(destDir + map.section('/', -1, -1)); QFile(map).rename(destDir + map.section('/', -1, -1));
} }
} }