moonlight-qt/app/gui/computermodel.h

60 lines
1.5 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,
StatusUnknownRole,
ServerSupportedRole
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);
Q_INVOKABLE QString generatePinString();
2018-07-06 06:12:55 +00:00
Q_INVOKABLE void pairComputer(int computerIndex, QString pin);
Q_INVOKABLE void testConnectionForComputer(int computerIndex);
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);
void connectionTestCompleted(int result, QString blockedPorts);
2018-07-06 06:12:55 +00:00
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
};