Retroshare QML App: Implemesh some basic stuff

Implement location creation, selection and login
Implement people listing
Implement firends adding (not working yet)
Depend on androidextra qt module only if compiling for android
LibresapiLocalClient parse one line at time to avoid error if two
requests are sent rapidly one after another
LibresapiLocalClient socket path now is a parameter of openConnection()
to use it as qml type constructor without parameter must be useful
Added JSONListModel for JASON based MVC pattern
This commit is contained in:
Gio 2016-09-15 13:07:13 +02:00
parent ad21d7202a
commit 8d6d3d1894
15 changed files with 565 additions and 99 deletions

View file

@ -1,5 +1,6 @@
/*
* libresapi local socket client
* Copyright (C) 2016 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2016 Manu Pineda <manu@cooperativa.cat>
*
* This program is free software: you can redistribute it and/or modify
@ -26,39 +27,30 @@
class LibresapiLocalClient : public QObject
{
Q_OBJECT
Q_OBJECT
public:
public:
LibresapiLocalClient() : mLocalSocket(this) {}
LibresapiLocalClient() {}
// LibresapiLocalClient(const LibresapiLocalClient & l);
LibresapiLocalClient(const QString & socketPath);
// potser abstreure el següent amb QUrl urlPath (path) i amb QJson jsonData.
Q_INVOKABLE int request(const QString & path, const QString & jsonData);
const QJsonDocument & getJson();
Q_INVOKABLE void openConnection();
// potser abstreure el següent amb QUrl urlPath (path) i amb QJson jsonData.
Q_INVOKABLE int request(const QString & path, const QString & jsonData);
const QJsonDocument & getJson();
Q_INVOKABLE void openConnection(QString socketPath);
private:
private:
QLocalSocket mLocalSocket;
QByteArray receivedBytes;
QJsonDocument json;
//QVector<QJsonDocument> responses;
QString mSocketPath;
QLocalSocket mLocalSocket;
QByteArray receivedBytes;
QJsonDocument json;
//QVector<QJsonDocument> responses;
bool parseResponse(); //std::string msg);
bool parseResponse(); //std::string msg);
private slots:
void socketError(QLocalSocket::LocalSocketError error);
void read();
signals:
void goodResponseReceived(const QString & msg);//, int requestId);
public slots:
private slots:
void socketError(QLocalSocket::LocalSocketError error);
void read();
signals:
void goodResponseReceived(const QString & msg);//, int requestId);
};
#endif // LIBRESAPILOCALCLIENT_H