Remove dead code before merge

Drop the empty loadFlatpakGames() stub — desktop .desktop files
with the Game category are already covered by loadDesktopGames().

Remove InstalledRole: the field was always true and nothing in QML
consumed it.

gamepadAt() is an internal helper; drop Q_INVOKABLE so it isn't
part of the public QML surface.
This commit is contained in:
Marco Allegretti 2026-04-25 10:19:04 +02:00
parent 69b8484025
commit bbb22b9289
3 changed files with 1 additions and 24 deletions

View file

@ -304,8 +304,6 @@ QVariant GameLauncherProvider::data(const QModelIndex &index, int role) const
return g.artwork; return g.artwork;
case LastPlayedTextRole: case LastPlayedTextRole:
return formatLastPlayed(g.lastPlayed); return formatLastPlayed(g.lastPlayed);
case InstalledRole:
return g.installed;
case PinnedRole: case PinnedRole:
return m_pinnedGames.contains(g.storageId); return m_pinnedGames.contains(g.storageId);
} }
@ -323,7 +321,6 @@ QHash<int, QByteArray> GameLauncherProvider::roleNames() const
{LaunchMethodRole, "launchMethod"}, {LaunchMethodRole, "launchMethod"},
{ArtworkRole, "artwork"}, {ArtworkRole, "artwork"},
{LastPlayedTextRole, "lastPlayedText"}, {LastPlayedTextRole, "lastPlayedText"},
{InstalledRole, "installed"},
{PinnedRole, "pinned"}, {PinnedRole, "pinned"},
}; };
} }
@ -362,7 +359,6 @@ void GameLauncherProvider::refresh()
loadDesktopGames(); loadDesktopGames();
loadSteamGames(); loadSteamGames();
loadFlatpakGames();
loadLutrisGames(); loadLutrisGames();
loadHeroicGames(); loadHeroicGames();
loadRecentTimestamps(); loadRecentTimestamps();
@ -423,7 +419,6 @@ QVariantMap GameLauncherProvider::gameDetails(const QString &storageId) const
{QStringLiteral("launchMethod"), launchMethodForEntry(entry)}, {QStringLiteral("launchMethod"), launchMethodForEntry(entry)},
{QStringLiteral("artwork"), entry.artwork}, {QStringLiteral("artwork"), entry.artwork},
{QStringLiteral("lastPlayedText"), formatLastPlayed(entry.lastPlayed)}, {QStringLiteral("lastPlayedText"), formatLastPlayed(entry.lastPlayed)},
{QStringLiteral("installed"), entry.installed},
{QStringLiteral("pinned"), m_pinnedGames.contains(entry.storageId)}, {QStringLiteral("pinned"), m_pinnedGames.contains(entry.storageId)},
{QStringLiteral("perGameFpsLimit"), perGameFpsLimit(entry.storageId)}, {QStringLiteral("perGameFpsLimit"), perGameFpsLimit(entry.storageId)},
{QStringLiteral("perGameOverlayState"), perGameOverlayState(entry.storageId)}, {QStringLiteral("perGameOverlayState"), perGameOverlayState(entry.storageId)},
@ -593,7 +588,6 @@ void GameLauncherProvider::loadDesktopGames()
entry.source = isWaydroidApp ? QStringLiteral("waydroid") : QStringLiteral("desktop"); entry.source = isWaydroidApp ? QStringLiteral("waydroid") : QStringLiteral("desktop");
entry.storageId = service->storageId(); entry.storageId = service->storageId();
entry.launchCommand = service->exec(); entry.launchCommand = service->exec();
entry.installed = true;
m_allGames.append(entry); m_allGames.append(entry);
} }
} }
@ -682,7 +676,6 @@ void GameLauncherProvider::loadSteamGames()
entry.source = QStringLiteral("steam"); entry.source = QStringLiteral("steam");
entry.storageId = QStringLiteral("steam://rungameid/") + appId; entry.storageId = QStringLiteral("steam://rungameid/") + appId;
entry.launchCommand = QStringLiteral("steam steam://rungameid/") + appId; entry.launchCommand = QStringLiteral("steam steam://rungameid/") + appId;
entry.installed = true;
// Check for grid artwork // Check for grid artwork
for (const auto &root : steamRoots) { for (const auto &root : steamRoots) {
@ -708,17 +701,6 @@ void GameLauncherProvider::loadSteamGames()
} }
} }
// --- Flatpak games (non-Steam) ---
void GameLauncherProvider::loadFlatpakGames()
{
// Flatpak games that export .desktop files with Game category
// are already picked up by loadDesktopGames() via KService.
// This method is a hook for future Flatpak-specific enrichment
// (e.g. querying flatpak metadata for games that don't set
// the Game category properly).
}
// --- Lutris library (SQLite) --- // --- Lutris library (SQLite) ---
void GameLauncherProvider::loadLutrisGames() void GameLauncherProvider::loadLutrisGames()
@ -767,7 +749,6 @@ void GameLauncherProvider::loadLutrisGames()
entry.storageId = QStringLiteral("lutris:%1").arg(slug); entry.storageId = QStringLiteral("lutris:%1").arg(slug);
entry.icon = QStringLiteral("lutris"); entry.icon = QStringLiteral("lutris");
entry.launchCommand = QStringLiteral("lutris lutris:rungameid/%1").arg(gameId); entry.launchCommand = QStringLiteral("lutris lutris:rungameid/%1").arg(gameId);
entry.installed = true;
// Cover art: Lutris stores covers in ~/.local/share/lutris/coverart/ // Cover art: Lutris stores covers in ~/.local/share/lutris/coverart/
if (!coverart.isEmpty()) { if (!coverart.isEmpty()) {
@ -852,7 +833,6 @@ void GameLauncherProvider::loadHeroicGames()
entry.source = QStringLiteral("heroic"); entry.source = QStringLiteral("heroic");
entry.storageId = QStringLiteral("heroic:%1").arg(appName); entry.storageId = QStringLiteral("heroic:%1").arg(appName);
entry.icon = QStringLiteral("heroic"); entry.icon = QStringLiteral("heroic");
entry.installed = true;
// Launch via Heroic protocol handler // Launch via Heroic protocol handler
if (isGog) { if (isGog) {

View file

@ -44,7 +44,6 @@ public:
LaunchMethodRole, LaunchMethodRole,
ArtworkRole, // path to banner/grid image (empty if none) ArtworkRole, // path to banner/grid image (empty if none)
LastPlayedTextRole, LastPlayedTextRole,
InstalledRole,
PinnedRole, PinnedRole,
}; };
Q_ENUM(Roles) Q_ENUM(Roles)
@ -106,12 +105,10 @@ private:
QString launchCommand; QString launchCommand;
QString artwork; QString artwork;
QDateTime lastPlayed; QDateTime lastPlayed;
bool installed = true;
}; };
void loadDesktopGames(); void loadDesktopGames();
void loadSteamGames(); void loadSteamGames();
void loadFlatpakGames();
void loadLutrisGames(); void loadLutrisGames();
void loadHeroicGames(); void loadHeroicGames();
void deduplicateGames(); void deduplicateGames();

View file

@ -78,7 +78,7 @@ public:
bool hasGamepad() const; bool hasGamepad() const;
GamepadDevice *primaryGamepad() const; GamepadDevice *primaryGamepad() const;
Q_INVOKABLE GamepadDevice *gamepadAt(int index) const; GamepadDevice *gamepadAt(int index) const;
Q_INVOKABLE QString buttonLabel(int button, int gamepadIndex = -1) const; Q_INVOKABLE QString buttonLabel(int button, int gamepadIndex = -1) const;
Q_SIGNALS: Q_SIGNALS: