// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: 2026 A-La-Karte Contributors #pragma once #include #include #include class Game; class SteamGridDB : public QObject { Q_OBJECT Q_PROPERTY(QString apiKey READ apiKey WRITE setApiKey NOTIFY apiKeyChanged) Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(bool preferSteamGridDB READ preferSteamGridDB WRITE setPreferSteamGridDB NOTIFY preferSteamGridDBChanged) Q_PROPERTY(bool busy READ busy NOTIFY busyChanged) public: explicit SteamGridDB(QObject *parent = nullptr); QString apiKey() const; void setApiKey(const QString &key); bool enabled() const; void setEnabled(bool enabled); bool preferSteamGridDB() const; void setPreferSteamGridDB(bool prefer); bool busy() const; Q_INVOKABLE void fetchCover(Game *game); Q_INVOKABLE void fetchAllCovers(); Q_SIGNALS: void apiKeyChanged(); void enabledChanged(); void preferSteamGridDBChanged(); void busyChanged(); void coverFetched(Game *game, const QUrl &coverUrl); void fetchError(Game *game, const QString &error); void fetchProgress(int current, int total); private Q_SLOTS: void onSearchFinished(); void onGridsFinished(); void onImageDownloaded(); private: void searchGame(Game *game); void fetchGrids(Game *game, int gameId); void downloadImage(Game *game, const QUrl &imageUrl); void saveSettings(); void loadSettings(); void processNextGame(); QNetworkAccessManager *m_networkManager; QString m_apiKey; bool m_enabled = false; bool m_preferSteamGridDB = false; bool m_busy = false; QList m_pendingGames; Game *m_currentGame = nullptr; int m_totalGames = 0; int m_processedGames = 0; };