mirror of
https://invent.kde.org/marcoa/a-la-karte.git
synced 2026-02-09 21:13:08 +00:00
Import: Avoid re-importing sources
Skip sources that already have imported games and avoid importing platforms that are disabled in settings. Remove imported games when a source is disabled so the library stays in sync with user preferences.
This commit is contained in:
parent
9c3c0e1dfd
commit
3357e48cc7
1 changed files with 424 additions and 199 deletions
623
src/app.cpp
623
src/app.cpp
|
|
@ -30,6 +30,116 @@ App::App(QObject *parent)
|
|||
, m_config(new Config(this))
|
||||
{
|
||||
loadLibrary();
|
||||
|
||||
if (!m_config->importSteam()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Steam")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
if (!m_config->importLutris()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Lutris")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
if (!m_config->importHeroic()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Heroic")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
if (!m_config->importDesktop()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Desktop")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
if (!m_config->importBottles()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Bottles")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
if (!m_config->importFlatpak()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Flatpak")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
if (!m_config->importItch()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("itch.io")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
if (!m_config->importLegendary()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Legendary")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
if (!m_config->importRetroArch()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("RetroArch")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
|
||||
connect(m_config, &Config::importSteamChanged, this, [this]() {
|
||||
if (!m_config->importSteam()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Steam")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(m_config, &Config::importLutrisChanged, this, [this]() {
|
||||
if (!m_config->importLutris()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Lutris")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(m_config, &Config::importHeroicChanged, this, [this]() {
|
||||
if (!m_config->importHeroic()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Heroic")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(m_config, &Config::importDesktopChanged, this, [this]() {
|
||||
if (!m_config->importDesktop()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Desktop")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(m_config, &Config::importBottlesChanged, this, [this]() {
|
||||
if (!m_config->importBottles()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Bottles")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(m_config, &Config::importFlatpakChanged, this, [this]() {
|
||||
if (!m_config->importFlatpak()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Flatpak")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(m_config, &Config::importItchChanged, this, [this]() {
|
||||
if (!m_config->importItch()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("itch.io")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(m_config, &Config::importLegendaryChanged, this, [this]() {
|
||||
if (!m_config->importLegendary()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("Legendary")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(m_config, &Config::importRetroArchChanged, this, [this]() {
|
||||
if (!m_config->importRetroArch()) {
|
||||
if (m_gameModel->removeByPlatformPrefix(QStringLiteral("RetroArch")) > 0) {
|
||||
saveLibrary();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
App *App::instance()
|
||||
|
|
@ -98,237 +208,352 @@ void App::importAllGames()
|
|||
if (m_importing)
|
||||
return;
|
||||
|
||||
const bool anyEnabled = m_config->importSteam() || m_config->importLutris() || m_config->importHeroic() || m_config->importDesktop()
|
||||
|| m_config->importBottles() || m_config->importFlatpak() || m_config->importItch() || m_config->importLegendary() || m_config->importRetroArch();
|
||||
|
||||
const bool doSteam = m_config->importSteam() && !m_gameModel->hasPlatformPrefix(QStringLiteral("Steam"));
|
||||
const bool doLutris = m_config->importLutris() && !m_gameModel->hasPlatformPrefix(QStringLiteral("Lutris"));
|
||||
const bool doHeroic = m_config->importHeroic() && !m_gameModel->hasPlatformPrefix(QStringLiteral("Heroic"));
|
||||
const bool doDesktop = m_config->importDesktop() && !m_gameModel->hasPlatformPrefix(QStringLiteral("Desktop"));
|
||||
const bool doBottles = m_config->importBottles() && !m_gameModel->hasPlatformPrefix(QStringLiteral("Bottles"));
|
||||
const bool doFlatpak = m_config->importFlatpak() && !m_gameModel->hasPlatformPrefix(QStringLiteral("Flatpak"));
|
||||
const bool doItch = m_config->importItch() && !m_gameModel->hasPlatformPrefix(QStringLiteral("itch.io"));
|
||||
const bool doLegendary = m_config->importLegendary() && !m_gameModel->hasPlatformPrefix(QStringLiteral("Legendary"));
|
||||
const bool doRetroArch = m_config->importRetroArch() && !m_gameModel->hasPlatformPrefix(QStringLiteral("RetroArch"));
|
||||
|
||||
if (!anyEnabled) {
|
||||
setImportStatus(tr("No import sources enabled"));
|
||||
Q_EMIT importCompleted(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(doSteam || doLutris || doHeroic || doDesktop || doBottles || doFlatpak || doItch || doLegendary || doRetroArch)) {
|
||||
setImportStatus(tr("All enabled sources already imported"));
|
||||
Q_EMIT importCompleted(0);
|
||||
return;
|
||||
}
|
||||
|
||||
setImporting(true);
|
||||
setImportStatus(tr("Importing games..."));
|
||||
|
||||
QtConcurrent::run([this]() {
|
||||
[[maybe_unused]] auto future = QtConcurrent::run([this, doSteam, doLutris, doHeroic, doDesktop, doBottles, doFlatpak, doItch, doLegendary, doRetroArch]() {
|
||||
int totalCount = 0;
|
||||
|
||||
// Import from Steam
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Steam library..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
if (doSteam) {
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Steam library..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
SteamImporter steamImporter;
|
||||
QList<Game *> steamGames = steamImporter.importGames();
|
||||
for (Game *game : steamGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
SteamImporter steamImporter;
|
||||
QList<Game *> steamGames = steamImporter.importGames();
|
||||
for (Game *game : steamGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, steamGames]() {
|
||||
if (!m_config->importSteam()) {
|
||||
for (Game *game : steamGames) {
|
||||
if (game) {
|
||||
game->deleteLater();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Game *game : steamGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += steamGames.count();
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, steamGames]() {
|
||||
for (Game *game : steamGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += steamGames.count();
|
||||
|
||||
// Import from Lutris
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Lutris library..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
if (doLutris) {
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Lutris library..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
LutrisImporter lutrisImporter;
|
||||
QList<Game *> lutrisGames = lutrisImporter.importGames();
|
||||
for (Game *game : lutrisGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
LutrisImporter lutrisImporter;
|
||||
QList<Game *> lutrisGames = lutrisImporter.importGames();
|
||||
for (Game *game : lutrisGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, lutrisGames]() {
|
||||
if (!m_config->importLutris()) {
|
||||
for (Game *game : lutrisGames) {
|
||||
if (game) {
|
||||
game->deleteLater();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Game *game : lutrisGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += lutrisGames.count();
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, lutrisGames]() {
|
||||
for (Game *game : lutrisGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += lutrisGames.count();
|
||||
|
||||
// Import from Heroic
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Heroic library..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
if (doHeroic) {
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Heroic library..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
HeroicImporter heroicImporter;
|
||||
QList<Game *> heroicGames = heroicImporter.importGames();
|
||||
for (Game *game : heroicGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
HeroicImporter heroicImporter;
|
||||
QList<Game *> heroicGames = heroicImporter.importGames();
|
||||
for (Game *game : heroicGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, heroicGames]() {
|
||||
if (!m_config->importHeroic()) {
|
||||
for (Game *game : heroicGames) {
|
||||
if (game) {
|
||||
game->deleteLater();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Game *game : heroicGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += heroicGames.count();
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, heroicGames]() {
|
||||
for (Game *game : heroicGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += heroicGames.count();
|
||||
|
||||
// Import from Desktop entries
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning desktop entries..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
if (doDesktop) {
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning desktop entries..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
DesktopImporter desktopImporter;
|
||||
QList<Game *> desktopGames = desktopImporter.importGames();
|
||||
for (Game *game : desktopGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
DesktopImporter desktopImporter;
|
||||
QList<Game *> desktopGames = desktopImporter.importGames();
|
||||
for (Game *game : desktopGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, desktopGames]() {
|
||||
if (!m_config->importDesktop()) {
|
||||
for (Game *game : desktopGames) {
|
||||
if (game) {
|
||||
game->deleteLater();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Game *game : desktopGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += desktopGames.count();
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, desktopGames]() {
|
||||
for (Game *game : desktopGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += desktopGames.count();
|
||||
|
||||
// Import from Bottles
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Bottles..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
if (doBottles) {
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Bottles..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
BottlesImporter bottlesImporter;
|
||||
QList<Game *> bottlesGames = bottlesImporter.importGames();
|
||||
for (Game *game : bottlesGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
BottlesImporter bottlesImporter;
|
||||
QList<Game *> bottlesGames = bottlesImporter.importGames();
|
||||
for (Game *game : bottlesGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, bottlesGames]() {
|
||||
if (!m_config->importBottles()) {
|
||||
for (Game *game : bottlesGames) {
|
||||
if (game) {
|
||||
game->deleteLater();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Game *game : bottlesGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += bottlesGames.count();
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, bottlesGames]() {
|
||||
for (Game *game : bottlesGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += bottlesGames.count();
|
||||
|
||||
// Import from Flatpak
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Flatpak games..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
if (doFlatpak) {
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Flatpak games..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
FlatpakImporter flatpakImporter;
|
||||
QList<Game *> flatpakGames = flatpakImporter.importGames();
|
||||
for (Game *game : flatpakGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
FlatpakImporter flatpakImporter;
|
||||
QList<Game *> flatpakGames = flatpakImporter.importGames();
|
||||
for (Game *game : flatpakGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, flatpakGames]() {
|
||||
if (!m_config->importFlatpak()) {
|
||||
for (Game *game : flatpakGames) {
|
||||
if (game) {
|
||||
game->deleteLater();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Game *game : flatpakGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += flatpakGames.count();
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, flatpakGames]() {
|
||||
for (Game *game : flatpakGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += flatpakGames.count();
|
||||
|
||||
// Import from itch.io
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning itch.io library..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
if (doItch) {
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning itch.io library..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
ItchImporter itchImporter;
|
||||
QList<Game *> itchGames = itchImporter.importGames();
|
||||
for (Game *game : itchGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
ItchImporter itchImporter;
|
||||
QList<Game *> itchGames = itchImporter.importGames();
|
||||
for (Game *game : itchGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, itchGames]() {
|
||||
if (!m_config->importItch()) {
|
||||
for (Game *game : itchGames) {
|
||||
if (game) {
|
||||
game->deleteLater();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Game *game : itchGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += itchGames.count();
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, itchGames]() {
|
||||
for (Game *game : itchGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += itchGames.count();
|
||||
|
||||
// Import from Legendary
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Legendary library..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
if (doLegendary) {
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning Legendary library..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
LegendaryImporter legendaryImporter;
|
||||
QList<Game *> legendaryGames = legendaryImporter.importGames();
|
||||
for (Game *game : legendaryGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
LegendaryImporter legendaryImporter;
|
||||
QList<Game *> legendaryGames = legendaryImporter.importGames();
|
||||
for (Game *game : legendaryGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, legendaryGames]() {
|
||||
if (!m_config->importLegendary()) {
|
||||
for (Game *game : legendaryGames) {
|
||||
if (game) {
|
||||
game->deleteLater();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Game *game : legendaryGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += legendaryGames.count();
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, legendaryGames]() {
|
||||
for (Game *game : legendaryGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += legendaryGames.count();
|
||||
|
||||
// Import from RetroArch
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning RetroArch playlists..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
if (doRetroArch) {
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this]() {
|
||||
setImportStatus(tr("Scanning RetroArch playlists..."));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
RetroArchImporter retroArchImporter;
|
||||
QList<Game *> retroArchGames = retroArchImporter.importGames();
|
||||
for (Game *game : retroArchGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
RetroArchImporter retroArchImporter;
|
||||
QList<Game *> retroArchGames = retroArchImporter.importGames();
|
||||
for (Game *game : retroArchGames) {
|
||||
game->moveToThread(this->thread());
|
||||
game->setParent(nullptr);
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, retroArchGames]() {
|
||||
if (!m_config->importRetroArch()) {
|
||||
for (Game *game : retroArchGames) {
|
||||
if (game) {
|
||||
game->deleteLater();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Game *game : retroArchGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += retroArchGames.count();
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
[this, retroArchGames]() {
|
||||
for (Game *game : retroArchGames) {
|
||||
m_gameModel->addGame(game);
|
||||
}
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
totalCount += retroArchGames.count();
|
||||
|
||||
// Complete
|
||||
QMetaObject::invokeMethod(
|
||||
this,
|
||||
|
|
@ -350,7 +575,7 @@ void App::importFromSteam()
|
|||
setImporting(true);
|
||||
setImportStatus(tr("Scanning Steam library..."));
|
||||
|
||||
QtConcurrent::run([this]() {
|
||||
[[maybe_unused]] auto future = QtConcurrent::run([this]() {
|
||||
SteamImporter importer;
|
||||
QList<Game *> games = importer.importGames();
|
||||
|
||||
|
|
@ -382,7 +607,7 @@ void App::importFromLutris()
|
|||
setImporting(true);
|
||||
setImportStatus(tr("Scanning Lutris library..."));
|
||||
|
||||
QtConcurrent::run([this]() {
|
||||
[[maybe_unused]] auto future = QtConcurrent::run([this]() {
|
||||
LutrisImporter importer;
|
||||
QList<Game *> games = importer.importGames();
|
||||
|
||||
|
|
@ -414,7 +639,7 @@ void App::importFromHeroic()
|
|||
setImporting(true);
|
||||
setImportStatus(tr("Scanning Heroic library..."));
|
||||
|
||||
QtConcurrent::run([this]() {
|
||||
[[maybe_unused]] auto future = QtConcurrent::run([this]() {
|
||||
HeroicImporter importer;
|
||||
QList<Game *> games = importer.importGames();
|
||||
|
||||
|
|
@ -446,7 +671,7 @@ void App::importFromDesktop()
|
|||
setImporting(true);
|
||||
setImportStatus(tr("Scanning desktop entries..."));
|
||||
|
||||
QtConcurrent::run([this]() {
|
||||
[[maybe_unused]] auto future = QtConcurrent::run([this]() {
|
||||
DesktopImporter importer;
|
||||
QList<Game *> games = importer.importGames();
|
||||
|
||||
|
|
@ -478,7 +703,7 @@ void App::importFromBottles()
|
|||
setImporting(true);
|
||||
setImportStatus(tr("Scanning Bottles..."));
|
||||
|
||||
QtConcurrent::run([this]() {
|
||||
[[maybe_unused]] auto future = QtConcurrent::run([this]() {
|
||||
BottlesImporter importer;
|
||||
QList<Game *> games = importer.importGames();
|
||||
|
||||
|
|
@ -510,7 +735,7 @@ void App::importFromFlatpak()
|
|||
setImporting(true);
|
||||
setImportStatus(tr("Scanning Flatpak games..."));
|
||||
|
||||
QtConcurrent::run([this]() {
|
||||
[[maybe_unused]] auto future = QtConcurrent::run([this]() {
|
||||
FlatpakImporter importer;
|
||||
QList<Game *> games = importer.importGames();
|
||||
|
||||
|
|
@ -542,7 +767,7 @@ void App::importFromItch()
|
|||
setImporting(true);
|
||||
setImportStatus(tr("Scanning itch.io library..."));
|
||||
|
||||
QtConcurrent::run([this]() {
|
||||
[[maybe_unused]] auto future = QtConcurrent::run([this]() {
|
||||
ItchImporter importer;
|
||||
QList<Game *> games = importer.importGames();
|
||||
|
||||
|
|
@ -574,7 +799,7 @@ void App::importFromLegendary()
|
|||
setImporting(true);
|
||||
setImportStatus(tr("Scanning Legendary library..."));
|
||||
|
||||
QtConcurrent::run([this]() {
|
||||
[[maybe_unused]] auto future = QtConcurrent::run([this]() {
|
||||
LegendaryImporter importer;
|
||||
QList<Game *> games = importer.importGames();
|
||||
|
||||
|
|
@ -606,7 +831,7 @@ void App::importFromRetroArch()
|
|||
setImporting(true);
|
||||
setImportStatus(tr("Scanning RetroArch playlists..."));
|
||||
|
||||
QtConcurrent::run([this]() {
|
||||
[[maybe_unused]] auto future = QtConcurrent::run([this]() {
|
||||
RetroArchImporter importer;
|
||||
QList<Game *> games = importer.importGames();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue