mirror of
https://invent.kde.org/marcoa/a-la-karte.git
synced 2026-03-27 01:03:09 +00:00
42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <QHash>
|
||
|
|
#include <QObject>
|
||
|
|
#include <QPointer>
|
||
|
|
#include <QQmlEngine>
|
||
|
|
#include <QUrl>
|
||
|
|
|
||
|
|
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<QString, QPointer<ScreenshotModel>> m_models;
|
||
|
|
};
|