#pragma once #include #include #include #include #include class Game; class ScreenshotModel; class MediaManager : public QObject { Q_OBJECT QML_ELEMENT Q_PROPERTY(QString screenshotsBasePath READ screenshotsBasePath CONSTANT) public: explicit MediaManager(QObject *parent = nullptr); QString screenshotsBasePath() const; Q_INVOKABLE QString screenshotsFolderPath(Game *game) const; Q_INVOKABLE QUrl screenshotsFolderUrl(Game *game) const; Q_INVOKABLE QObject *screenshotsModel(Game *game); Q_INVOKABLE bool importScreenshot(Game *game, const QUrl &sourceUrl); Q_SIGNALS: void screenshotsImported(Game *game, int count); void importError(Game *game, const QString &error); private: QString gameId(Game *game) const; QString gameScreenshotsFolderPath(Game *game) const; QString ensureDirectory(const QString &path) const; QString uniqueDestinationPath(const QString &folderPath, const QString &fileName) const; QHash> m_models; };