moonlight-qt/app/gui/computermodel.h

51 lines
1.2 KiB
C
Raw Normal View History

2018-07-04 23:40:21 +00:00
#include "backend/computermanager.h"
#include "streaming/session.hpp"
2018-07-04 23:40:21 +00:00
#include <QAbstractListModel>
class ComputerModel : public QAbstractListModel
{
Q_OBJECT
2018-07-04 23:40:21 +00:00
enum Roles
{
NameRole = Qt::UserRole,
OnlineRole,
PairedRole,
BusyRole,
AddPcRole
};
public:
explicit ComputerModel(QObject* object = nullptr);
2018-07-04 23:40:21 +00:00
// Must be called before any QAbstractListModel functions
Q_INVOKABLE void initialize(ComputerManager* computerManager);
2018-07-04 23:40:21 +00:00
QVariant data(const QModelIndex &index, int role) const override;
int rowCount(const QModelIndex &parent) const override;
virtual QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE void deleteComputer(int computerIndex);
2018-07-06 06:12:55 +00:00
Q_INVOKABLE void pairComputer(int computerIndex, QString pin);
2018-07-06 07:34:16 +00:00
Q_INVOKABLE bool wakeComputer(int computerIndex);
Q_INVOKABLE Session* createSessionForCurrentGame(int computerIndex);
2018-07-06 06:12:55 +00:00
signals:
void pairingCompleted(QVariant error);
2018-07-04 23:40:21 +00:00
private slots:
void handleComputerStateChanged(NvComputer* computer);
2018-07-06 06:12:55 +00:00
void handlePairingCompleted(NvComputer* computer, QString error);
2018-07-04 23:40:21 +00:00
private:
QVector<NvComputer*> m_Computers;
ComputerManager* m_ComputerManager;
2018-07-04 23:40:21 +00:00
};