#pragma once #include "backend/boxartmanager.h" #include "backend/computermanager.h" #include "streaming/session.hpp" #include class AppModel : public QAbstractListModel { Q_OBJECT enum Roles { NameRole = Qt::UserRole, RunningRole, BoxArtRole }; public: explicit AppModel(QObject *parent = nullptr); // Must be called before any QAbstractListModel functions Q_INVOKABLE void initialize(ComputerManager* computerManager, int computerIndex); Q_INVOKABLE Session* createSessionForApp(int appIndex); Q_INVOKABLE int getRunningAppIndex(); Q_INVOKABLE QString getRunningAppName(); Q_INVOKABLE void quitRunningApp(); QVariant data(const QModelIndex &index, int role) const override; int rowCount(const QModelIndex &parent) const override; virtual QHash roleNames() const override; private slots: void handleComputerStateChanged(NvComputer* computer); void handleBoxArtLoaded(NvComputer* computer, NvApp app, QUrl image); signals: void computerLost(); private: NvComputer* m_Computer; BoxArtManager m_BoxArtManager; ComputerManager* m_ComputerManager; QVector m_Apps; int m_CurrentGameId; };