From 245944fca9b02f696a5de3682db5200786e34804 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Tue, 3 Feb 2026 10:41:29 +0100 Subject: [PATCH] Make imports incremental and refreshable --- src/app.cpp | 450 ++++++++++++++++++++++++++++++++------- src/qml/Main.qml | 36 ++-- src/qml/SettingsPage.qml | 18 +- 3 files changed, 405 insertions(+), 99 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index 72bc0c3..4016dc2 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -18,7 +18,9 @@ #include #include #include +#include #include +#include #include App *App::s_instance = nullptr; @@ -142,6 +144,12 @@ App::App(QObject *parent) } } }); + + if (m_config->autoImportOnStartup()) { + QTimer::singleShot(0, this, [this]() { + importAllGames(); + }); + } } App *App::instance() @@ -215,18 +223,17 @@ 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(); + const bool doLutris = m_config->importLutris(); + const bool doHeroic = m_config->importHeroic(); + const bool doDesktop = m_config->importDesktop(); + const bool doBottles = m_config->importBottles(); + const bool doFlatpak = m_config->importFlatpak(); + const bool doItch = m_config->importItch(); + const bool doLegendary = m_config->importLegendary(); + const bool doRetroArch = 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")); + const bool anyEnabled = doSteam || doLutris || doHeroic || doDesktop || doBottles || doFlatpak || doItch || doLegendary || doRetroArch; if (!anyEnabled) { setImportStatus(tr("No import sources enabled")); @@ -234,17 +241,55 @@ void App::importAllGames() return; } - if (!(doSteam || doLutris || doHeroic || doDesktop || doBottles || doFlatpak || doItch || doLegendary || doRetroArch)) { - setImportStatus(tr("All enabled sources already imported")); - Q_EMIT importCompleted(0); - return; - } + const QSet existingIds = [this]() { + QSet ids; + const QList games = m_gameModel->allGames(); + for (Game *game : games) { + if (game) { + ids.insert(game->id()); + } + } + return ids; + }(); setImporting(true); setImportStatus(tr("Importing games...")); - [[maybe_unused]] auto future = QtConcurrent::run([this, doSteam, doLutris, doHeroic, doDesktop, doBottles, doFlatpak, doItch, doLegendary, doRetroArch]() { + [[maybe_unused]] auto future = QtConcurrent::run([this, + doSteam, + doLutris, + doHeroic, + doDesktop, + doBottles, + doFlatpak, + doItch, + doLegendary, + doRetroArch, + existingIds]() { int totalCount = 0; + QSet seenIds = existingIds; + + const auto keepNewGames = [&seenIds](const QList &games) { + QList result; + result.reserve(games.size()); + + for (Game *game : games) { + if (!game) { + continue; + } + + const QString id = game->id(); + if (id.isEmpty() || seenIds.contains(id)) { + delete game; + continue; + } + + seenIds.insert(id); + result.append(game); + } + + return result; + }; // Import from Steam if (doSteam) { @@ -256,7 +301,7 @@ void App::importAllGames() Qt::QueuedConnection); SteamImporter steamImporter; - QList steamGames = steamImporter.importGames(); + QList steamGames = keepNewGames(steamImporter.importGames()); for (Game *game : steamGames) { game->moveToThread(this->thread()); game->setParent(nullptr); @@ -291,7 +336,7 @@ void App::importAllGames() Qt::QueuedConnection); LutrisImporter lutrisImporter; - QList lutrisGames = lutrisImporter.importGames(); + QList lutrisGames = keepNewGames(lutrisImporter.importGames()); for (Game *game : lutrisGames) { game->moveToThread(this->thread()); game->setParent(nullptr); @@ -326,7 +371,7 @@ void App::importAllGames() Qt::QueuedConnection); HeroicImporter heroicImporter; - QList heroicGames = heroicImporter.importGames(); + QList heroicGames = keepNewGames(heroicImporter.importGames()); for (Game *game : heroicGames) { game->moveToThread(this->thread()); game->setParent(nullptr); @@ -361,7 +406,7 @@ void App::importAllGames() Qt::QueuedConnection); DesktopImporter desktopImporter; - QList desktopGames = desktopImporter.importGames(); + QList desktopGames = keepNewGames(desktopImporter.importGames()); for (Game *game : desktopGames) { game->moveToThread(this->thread()); game->setParent(nullptr); @@ -396,7 +441,7 @@ void App::importAllGames() Qt::QueuedConnection); BottlesImporter bottlesImporter; - QList bottlesGames = bottlesImporter.importGames(); + QList bottlesGames = keepNewGames(bottlesImporter.importGames()); for (Game *game : bottlesGames) { game->moveToThread(this->thread()); game->setParent(nullptr); @@ -431,7 +476,7 @@ void App::importAllGames() Qt::QueuedConnection); FlatpakImporter flatpakImporter; - QList flatpakGames = flatpakImporter.importGames(); + QList flatpakGames = keepNewGames(flatpakImporter.importGames()); for (Game *game : flatpakGames) { game->moveToThread(this->thread()); game->setParent(nullptr); @@ -466,7 +511,7 @@ void App::importAllGames() Qt::QueuedConnection); ItchImporter itchImporter; - QList itchGames = itchImporter.importGames(); + QList itchGames = keepNewGames(itchImporter.importGames()); for (Game *game : itchGames) { game->moveToThread(this->thread()); game->setParent(nullptr); @@ -501,7 +546,7 @@ void App::importAllGames() Qt::QueuedConnection); LegendaryImporter legendaryImporter; - QList legendaryGames = legendaryImporter.importGames(); + QList legendaryGames = keepNewGames(legendaryImporter.importGames()); for (Game *game : legendaryGames) { game->moveToThread(this->thread()); game->setParent(nullptr); @@ -536,7 +581,7 @@ void App::importAllGames() Qt::QueuedConnection); RetroArchImporter retroArchImporter; - QList retroArchGames = retroArchImporter.importGames(); + QList retroArchGames = keepNewGames(retroArchImporter.importGames()); for (Game *game : retroArchGames) { game->moveToThread(this->thread()); game->setParent(nullptr); @@ -565,7 +610,7 @@ void App::importAllGames() QMetaObject::invokeMethod( this, [this, totalCount]() { - setImportStatus(tr("Import complete: %1 games found").arg(totalCount)); + setImportStatus(tr("Import complete: %1 new games found").arg(totalCount)); setImporting(false); saveLibrary(); Q_EMIT importCompleted(totalCount); @@ -579,28 +624,57 @@ void App::importFromSteam() if (m_importing) return; + const QSet existingIds = [this]() { + QSet ids; + const QList games = m_gameModel->allGames(); + for (Game *game : games) { + if (game) { + ids.insert(game->id()); + } + } + return ids; + }(); + setImporting(true); setImportStatus(tr("Scanning Steam library...")); - [[maybe_unused]] auto future = QtConcurrent::run([this]() { + [[maybe_unused]] auto future = QtConcurrent::run([this, existingIds]() { SteamImporter importer; QList games = importer.importGames(); + QSet seenIds = existingIds; + QList newGames; + newGames.reserve(games.size()); for (Game *game : games) { + if (!game) { + continue; + } + + const QString id = game->id(); + if (id.isEmpty() || seenIds.contains(id)) { + delete game; + continue; + } + + seenIds.insert(id); + newGames.append(game); + } + + for (Game *game : newGames) { game->moveToThread(this->thread()); game->setParent(nullptr); } QMetaObject::invokeMethod( this, - [this, games]() { - for (Game *game : games) { + [this, newGames]() { + for (Game *game : newGames) { m_gameModel->addGame(game); } - setImportStatus(tr("Steam import complete: %1 games found").arg(games.count())); + setImportStatus(tr("Steam import complete: %1 new games found").arg(newGames.count())); setImporting(false); saveLibrary(); - Q_EMIT importCompleted(games.count()); + Q_EMIT importCompleted(newGames.count()); }, Qt::QueuedConnection); }); @@ -611,28 +685,57 @@ void App::importFromLutris() if (m_importing) return; + const QSet existingIds = [this]() { + QSet ids; + const QList games = m_gameModel->allGames(); + for (Game *game : games) { + if (game) { + ids.insert(game->id()); + } + } + return ids; + }(); + setImporting(true); setImportStatus(tr("Scanning Lutris library...")); - [[maybe_unused]] auto future = QtConcurrent::run([this]() { + [[maybe_unused]] auto future = QtConcurrent::run([this, existingIds]() { LutrisImporter importer; QList games = importer.importGames(); + QSet seenIds = existingIds; + QList newGames; + newGames.reserve(games.size()); for (Game *game : games) { + if (!game) { + continue; + } + + const QString id = game->id(); + if (id.isEmpty() || seenIds.contains(id)) { + delete game; + continue; + } + + seenIds.insert(id); + newGames.append(game); + } + + for (Game *game : newGames) { game->moveToThread(this->thread()); game->setParent(nullptr); } QMetaObject::invokeMethod( this, - [this, games]() { - for (Game *game : games) { + [this, newGames]() { + for (Game *game : newGames) { m_gameModel->addGame(game); } - setImportStatus(tr("Lutris import complete: %1 games found").arg(games.count())); + setImportStatus(tr("Lutris import complete: %1 new games found").arg(newGames.count())); setImporting(false); saveLibrary(); - Q_EMIT importCompleted(games.count()); + Q_EMIT importCompleted(newGames.count()); }, Qt::QueuedConnection); }); @@ -643,28 +746,57 @@ void App::importFromHeroic() if (m_importing) return; + const QSet existingIds = [this]() { + QSet ids; + const QList games = m_gameModel->allGames(); + for (Game *game : games) { + if (game) { + ids.insert(game->id()); + } + } + return ids; + }(); + setImporting(true); setImportStatus(tr("Scanning Heroic library...")); - [[maybe_unused]] auto future = QtConcurrent::run([this]() { + [[maybe_unused]] auto future = QtConcurrent::run([this, existingIds]() { HeroicImporter importer; QList games = importer.importGames(); + QSet seenIds = existingIds; + QList newGames; + newGames.reserve(games.size()); for (Game *game : games) { + if (!game) { + continue; + } + + const QString id = game->id(); + if (id.isEmpty() || seenIds.contains(id)) { + delete game; + continue; + } + + seenIds.insert(id); + newGames.append(game); + } + + for (Game *game : newGames) { game->moveToThread(this->thread()); game->setParent(nullptr); } QMetaObject::invokeMethod( this, - [this, games]() { - for (Game *game : games) { + [this, newGames]() { + for (Game *game : newGames) { m_gameModel->addGame(game); } - setImportStatus(tr("Heroic import complete: %1 games found").arg(games.count())); + setImportStatus(tr("Heroic import complete: %1 new games found").arg(newGames.count())); setImporting(false); saveLibrary(); - Q_EMIT importCompleted(games.count()); + Q_EMIT importCompleted(newGames.count()); }, Qt::QueuedConnection); }); @@ -675,28 +807,57 @@ void App::importFromDesktop() if (m_importing) return; + const QSet existingIds = [this]() { + QSet ids; + const QList games = m_gameModel->allGames(); + for (Game *game : games) { + if (game) { + ids.insert(game->id()); + } + } + return ids; + }(); + setImporting(true); setImportStatus(tr("Scanning desktop entries...")); - [[maybe_unused]] auto future = QtConcurrent::run([this]() { + [[maybe_unused]] auto future = QtConcurrent::run([this, existingIds]() { DesktopImporter importer; QList games = importer.importGames(); + QSet seenIds = existingIds; + QList newGames; + newGames.reserve(games.size()); for (Game *game : games) { + if (!game) { + continue; + } + + const QString id = game->id(); + if (id.isEmpty() || seenIds.contains(id)) { + delete game; + continue; + } + + seenIds.insert(id); + newGames.append(game); + } + + for (Game *game : newGames) { game->moveToThread(this->thread()); game->setParent(nullptr); } QMetaObject::invokeMethod( this, - [this, games]() { - for (Game *game : games) { + [this, newGames]() { + for (Game *game : newGames) { m_gameModel->addGame(game); } - setImportStatus(tr("Desktop import complete: %1 games found").arg(games.count())); + setImportStatus(tr("Desktop import complete: %1 new games found").arg(newGames.count())); setImporting(false); saveLibrary(); - Q_EMIT importCompleted(games.count()); + Q_EMIT importCompleted(newGames.count()); }, Qt::QueuedConnection); }); @@ -707,28 +868,57 @@ void App::importFromBottles() if (m_importing) return; + const QSet existingIds = [this]() { + QSet ids; + const QList games = m_gameModel->allGames(); + for (Game *game : games) { + if (game) { + ids.insert(game->id()); + } + } + return ids; + }(); + setImporting(true); setImportStatus(tr("Scanning Bottles...")); - [[maybe_unused]] auto future = QtConcurrent::run([this]() { + [[maybe_unused]] auto future = QtConcurrent::run([this, existingIds]() { BottlesImporter importer; QList games = importer.importGames(); + QSet seenIds = existingIds; + QList newGames; + newGames.reserve(games.size()); for (Game *game : games) { + if (!game) { + continue; + } + + const QString id = game->id(); + if (id.isEmpty() || seenIds.contains(id)) { + delete game; + continue; + } + + seenIds.insert(id); + newGames.append(game); + } + + for (Game *game : newGames) { game->moveToThread(this->thread()); game->setParent(nullptr); } QMetaObject::invokeMethod( this, - [this, games]() { - for (Game *game : games) { + [this, newGames]() { + for (Game *game : newGames) { m_gameModel->addGame(game); } - setImportStatus(tr("Bottles import complete: %1 games found").arg(games.count())); + setImportStatus(tr("Bottles import complete: %1 new games found").arg(newGames.count())); setImporting(false); saveLibrary(); - Q_EMIT importCompleted(games.count()); + Q_EMIT importCompleted(newGames.count()); }, Qt::QueuedConnection); }); @@ -739,28 +929,57 @@ void App::importFromFlatpak() if (m_importing) return; + const QSet existingIds = [this]() { + QSet ids; + const QList games = m_gameModel->allGames(); + for (Game *game : games) { + if (game) { + ids.insert(game->id()); + } + } + return ids; + }(); + setImporting(true); setImportStatus(tr("Scanning Flatpak games...")); - [[maybe_unused]] auto future = QtConcurrent::run([this]() { + [[maybe_unused]] auto future = QtConcurrent::run([this, existingIds]() { FlatpakImporter importer; QList games = importer.importGames(); + QSet seenIds = existingIds; + QList newGames; + newGames.reserve(games.size()); for (Game *game : games) { + if (!game) { + continue; + } + + const QString id = game->id(); + if (id.isEmpty() || seenIds.contains(id)) { + delete game; + continue; + } + + seenIds.insert(id); + newGames.append(game); + } + + for (Game *game : newGames) { game->moveToThread(this->thread()); game->setParent(nullptr); } QMetaObject::invokeMethod( this, - [this, games]() { - for (Game *game : games) { + [this, newGames]() { + for (Game *game : newGames) { m_gameModel->addGame(game); } - setImportStatus(tr("Flatpak import complete: %1 games found").arg(games.count())); + setImportStatus(tr("Flatpak import complete: %1 new games found").arg(newGames.count())); setImporting(false); saveLibrary(); - Q_EMIT importCompleted(games.count()); + Q_EMIT importCompleted(newGames.count()); }, Qt::QueuedConnection); }); @@ -771,28 +990,57 @@ void App::importFromItch() if (m_importing) return; + const QSet existingIds = [this]() { + QSet ids; + const QList games = m_gameModel->allGames(); + for (Game *game : games) { + if (game) { + ids.insert(game->id()); + } + } + return ids; + }(); + setImporting(true); setImportStatus(tr("Scanning itch.io library...")); - [[maybe_unused]] auto future = QtConcurrent::run([this]() { + [[maybe_unused]] auto future = QtConcurrent::run([this, existingIds]() { ItchImporter importer; QList games = importer.importGames(); + QSet seenIds = existingIds; + QList newGames; + newGames.reserve(games.size()); for (Game *game : games) { + if (!game) { + continue; + } + + const QString id = game->id(); + if (id.isEmpty() || seenIds.contains(id)) { + delete game; + continue; + } + + seenIds.insert(id); + newGames.append(game); + } + + for (Game *game : newGames) { game->moveToThread(this->thread()); game->setParent(nullptr); } QMetaObject::invokeMethod( this, - [this, games]() { - for (Game *game : games) { + [this, newGames]() { + for (Game *game : newGames) { m_gameModel->addGame(game); } - setImportStatus(tr("itch.io import complete: %1 games found").arg(games.count())); + setImportStatus(tr("itch.io import complete: %1 new games found").arg(newGames.count())); setImporting(false); saveLibrary(); - Q_EMIT importCompleted(games.count()); + Q_EMIT importCompleted(newGames.count()); }, Qt::QueuedConnection); }); @@ -803,28 +1051,57 @@ void App::importFromLegendary() if (m_importing) return; + const QSet existingIds = [this]() { + QSet ids; + const QList games = m_gameModel->allGames(); + for (Game *game : games) { + if (game) { + ids.insert(game->id()); + } + } + return ids; + }(); + setImporting(true); setImportStatus(tr("Scanning Legendary library...")); - [[maybe_unused]] auto future = QtConcurrent::run([this]() { + [[maybe_unused]] auto future = QtConcurrent::run([this, existingIds]() { LegendaryImporter importer; QList games = importer.importGames(); + QSet seenIds = existingIds; + QList newGames; + newGames.reserve(games.size()); for (Game *game : games) { + if (!game) { + continue; + } + + const QString id = game->id(); + if (id.isEmpty() || seenIds.contains(id)) { + delete game; + continue; + } + + seenIds.insert(id); + newGames.append(game); + } + + for (Game *game : newGames) { game->moveToThread(this->thread()); game->setParent(nullptr); } QMetaObject::invokeMethod( this, - [this, games]() { - for (Game *game : games) { + [this, newGames]() { + for (Game *game : newGames) { m_gameModel->addGame(game); } - setImportStatus(tr("Legendary import complete: %1 games found").arg(games.count())); + setImportStatus(tr("Legendary import complete: %1 new games found").arg(newGames.count())); setImporting(false); saveLibrary(); - Q_EMIT importCompleted(games.count()); + Q_EMIT importCompleted(newGames.count()); }, Qt::QueuedConnection); }); @@ -835,28 +1112,57 @@ void App::importFromRetroArch() if (m_importing) return; + const QSet existingIds = [this]() { + QSet ids; + const QList games = m_gameModel->allGames(); + for (Game *game : games) { + if (game) { + ids.insert(game->id()); + } + } + return ids; + }(); + setImporting(true); setImportStatus(tr("Scanning RetroArch playlists...")); - [[maybe_unused]] auto future = QtConcurrent::run([this]() { + [[maybe_unused]] auto future = QtConcurrent::run([this, existingIds]() { RetroArchImporter importer; QList games = importer.importGames(); + QSet seenIds = existingIds; + QList newGames; + newGames.reserve(games.size()); for (Game *game : games) { + if (!game) { + continue; + } + + const QString id = game->id(); + if (id.isEmpty() || seenIds.contains(id)) { + delete game; + continue; + } + + seenIds.insert(id); + newGames.append(game); + } + + for (Game *game : newGames) { game->moveToThread(this->thread()); game->setParent(nullptr); } QMetaObject::invokeMethod( this, - [this, games]() { - for (Game *game : games) { + [this, newGames]() { + for (Game *game : newGames) { m_gameModel->addGame(game); } - setImportStatus(tr("RetroArch import complete: %1 games found").arg(games.count())); + setImportStatus(tr("RetroArch import complete: %1 new games found").arg(newGames.count())); setImporting(false); saveLibrary(); - Q_EMIT importCompleted(games.count()); + Q_EMIT importCompleted(newGames.count()); }, Qt::QueuedConnection); }); diff --git a/src/qml/Main.qml b/src/qml/Main.qml index a879bc4..9762727 100644 --- a/src/qml/Main.qml +++ b/src/qml/Main.qml @@ -1143,7 +1143,7 @@ Kirigami.ApplicationWindow { secondary: "steam" resourceFallback: Qt.resolvedUrl("icons/brand/steam-symbolic.svg") } - enabled: !App.importing && App.config.importSteam && !App.gameModel.hasPlatformPrefix("Steam") && App.gameModel.count >= 0 + enabled: !App.importing && App.config.importSteam && App.gameModel.count >= 0 onClicked: App.importFromSteam() } @@ -1157,7 +1157,7 @@ Kirigami.ApplicationWindow { primary: "lutris" secondary: "applications-games" } - enabled: !App.importing && App.config.importLutris && !App.gameModel.hasPlatformPrefix("Lutris") && App.gameModel.count >= 0 + enabled: !App.importing && App.config.importLutris && App.gameModel.count >= 0 onClicked: App.importFromLutris() } @@ -1171,7 +1171,7 @@ Kirigami.ApplicationWindow { primary: "com.heroicgameslauncher.hgl" secondary: "applications-games" } - enabled: !App.importing && App.config.importHeroic && !App.gameModel.hasPlatformPrefix("Heroic") && App.gameModel.count >= 0 + enabled: !App.importing && App.config.importHeroic && App.gameModel.count >= 0 onClicked: App.importFromHeroic() } @@ -1185,7 +1185,7 @@ Kirigami.ApplicationWindow { primary: "user-desktop" secondary: "computer" } - enabled: !App.importing && App.config.importDesktop && !App.gameModel.hasPlatformPrefix("Desktop") && App.gameModel.count >= 0 + enabled: !App.importing && App.config.importDesktop && App.gameModel.count >= 0 onClicked: App.importFromDesktop() } @@ -1199,7 +1199,7 @@ Kirigami.ApplicationWindow { primary: "com.usebottles.bottles" secondary: "application-x-executable" } - enabled: !App.importing && App.config.importBottles && !App.gameModel.hasPlatformPrefix("Bottles") && App.gameModel.count >= 0 + enabled: !App.importing && App.config.importBottles && App.gameModel.count >= 0 onClicked: App.importFromBottles() } @@ -1213,7 +1213,7 @@ Kirigami.ApplicationWindow { primary: "flatpak-discover" secondary: "applications-games" } - enabled: !App.importing && App.config.importFlatpak && !App.gameModel.hasPlatformPrefix("Flatpak") && App.gameModel.count >= 0 + enabled: !App.importing && App.config.importFlatpak && App.gameModel.count >= 0 onClicked: App.importFromFlatpak() } @@ -1228,7 +1228,7 @@ Kirigami.ApplicationWindow { secondary: "itch" resourceFallback: Qt.resolvedUrl("icons/brand/itchdotio-symbolic.svg") } - enabled: !App.importing && App.config.importItch && !App.gameModel.hasPlatformPrefix("itch.io") && App.gameModel.count >= 0 + enabled: !App.importing && App.config.importItch && App.gameModel.count >= 0 onClicked: App.importFromItch() } @@ -1242,7 +1242,7 @@ Kirigami.ApplicationWindow { primary: "legendary" secondary: "applications-games" } - enabled: !App.importing && App.config.importLegendary && !App.gameModel.hasPlatformPrefix("Legendary") && App.gameModel.count >= 0 + enabled: !App.importing && App.config.importLegendary && App.gameModel.count >= 0 onClicked: App.importFromLegendary() } @@ -1257,7 +1257,7 @@ Kirigami.ApplicationWindow { secondary: "retroarch" resourceFallback: Qt.resolvedUrl("icons/brand/retroarch-symbolic.svg") } - enabled: !App.importing && App.config.importRetroArch && !App.gameModel.hasPlatformPrefix("RetroArch") && App.gameModel.count >= 0 + enabled: !App.importing && App.config.importRetroArch && App.gameModel.count >= 0 onClicked: App.importFromRetroArch() } } @@ -1269,15 +1269,15 @@ Kirigami.ApplicationWindow { QQC2.Button { text: i18n("Import All") icon.name: "document-import" - enabled: !App.importing && App.gameModel.count >= 0 && ((App.config.importSteam && !App.gameModel.hasPlatformPrefix("Steam")) - || (App.config.importLutris && !App.gameModel.hasPlatformPrefix("Lutris")) - || (App.config.importHeroic && !App.gameModel.hasPlatformPrefix("Heroic")) - || (App.config.importDesktop && !App.gameModel.hasPlatformPrefix("Desktop")) - || (App.config.importBottles && !App.gameModel.hasPlatformPrefix("Bottles")) - || (App.config.importFlatpak && !App.gameModel.hasPlatformPrefix("Flatpak")) - || (App.config.importItch && !App.gameModel.hasPlatformPrefix("itch.io")) - || (App.config.importLegendary && !App.gameModel.hasPlatformPrefix("Legendary")) - || (App.config.importRetroArch && !App.gameModel.hasPlatformPrefix("RetroArch"))) + enabled: !App.importing && App.gameModel.count >= 0 && (App.config.importSteam + || App.config.importLutris + || App.config.importHeroic + || App.config.importDesktop + || App.config.importBottles + || App.config.importFlatpak + || App.config.importItch + || App.config.importLegendary + || App.config.importRetroArch) onClicked: App.importAllGames() } diff --git a/src/qml/SettingsPage.qml b/src/qml/SettingsPage.qml index 419747b..0c831a4 100644 --- a/src/qml/SettingsPage.qml +++ b/src/qml/SettingsPage.qml @@ -643,15 +643,15 @@ FormCard.FormHeader { text: i18n("Import All Games") description: i18n("Scan all enabled sources") icon.name: "document-import" - enabled: !App.importing && App.gameModel.count >= 0 && ((App.config.importSteam && !App.gameModel.hasPlatformPrefix("Steam")) - || (App.config.importLutris && !App.gameModel.hasPlatformPrefix("Lutris")) - || (App.config.importHeroic && !App.gameModel.hasPlatformPrefix("Heroic")) - || (App.config.importDesktop && !App.gameModel.hasPlatformPrefix("Desktop")) - || (App.config.importBottles && !App.gameModel.hasPlatformPrefix("Bottles")) - || (App.config.importFlatpak && !App.gameModel.hasPlatformPrefix("Flatpak")) - || (App.config.importItch && !App.gameModel.hasPlatformPrefix("itch.io")) - || (App.config.importLegendary && !App.gameModel.hasPlatformPrefix("Legendary")) - || (App.config.importRetroArch && !App.gameModel.hasPlatformPrefix("RetroArch"))) + enabled: !App.importing && App.gameModel.count >= 0 && (App.config.importSteam + || App.config.importLutris + || App.config.importHeroic + || App.config.importDesktop + || App.config.importBottles + || App.config.importFlatpak + || App.config.importItch + || App.config.importLegendary + || App.config.importRetroArch) onClicked: App.importAllGames() }