moonlight-qt/app/gui/computermodel.h

54 lines
1.3 KiB
C
Raw Normal View History

2018-07-04 23:40:21 +00:00
#include "backend/computermanager.h"
2018-09-29 23:18:46 +00:00
#include "streaming/session.h"
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,
WakeableRole,
2019-03-27 04:31:51 +00:00
StatusUnknownRole
2018-07-04 23:40:21 +00:00
};
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);
Q_INVOKABLE void wakeComputer(int computerIndex);
2018-07-06 07:34:16 +00:00
2020-05-02 01:34:15 +00:00
Q_INVOKABLE void renameComputer(int computerIndex, QString name);
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
};