Added action receiver, refactored controller, extracted parsing logic from controller

This commit is contained in:
David Kaya
2017-02-03 14:21:14 +01:00
parent 5d800be890
commit 001093d3bb
8 changed files with 116 additions and 75 deletions

29
actionreceiver.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef ACTIONRECEIVER_H
#define ACTIONRECEIVER_H
#include <QObject>
#include <QtWebSockets>
class ActionReceiver : public QObject
{
Q_OBJECT
public:
explicit ActionReceiver(const QUrl &address, QObject *parent = 0);
~ActionReceiver();
private slots:
void socketConnected();
void socketReceivedStringMessage(const QString &message);
void socketError(QAbstractSocket::SocketError socketError);
signals:
void loadUrlReceived(QString);
void setProgressReceived(float);
void showNotificationReceived(QString, QString);
private:
QUrl address;
QWebSocket* webSocket;
QString getActionType(const QJsonObject &jsonObject);
QJsonObject getParameters(const QJsonObject &jsonObject);
};
#endif // ACTIONRECEIVER_H